web-mojo 2.1.715 → 2.1.758

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 (61) hide show
  1. package/dist/admin.cjs.js +1 -1
  2. package/dist/admin.cjs.js.map +1 -1
  3. package/dist/admin.es.js +38 -10
  4. package/dist/admin.es.js.map +1 -1
  5. package/dist/auth.cjs.js +1 -1
  6. package/dist/auth.cjs.js.map +1 -1
  7. package/dist/auth.es.js +3 -3
  8. package/dist/auth.es.js.map +1 -1
  9. package/dist/charts.cjs.js +1 -1
  10. package/dist/charts.es.js +2 -2
  11. package/dist/chunks/{ChatView-7Tl6j0_F.js → ChatView-CoCylKpB.js} +6 -6
  12. package/dist/chunks/{ChatView-7Tl6j0_F.js.map → ChatView-CoCylKpB.js.map} +1 -1
  13. package/dist/chunks/{ChatView-CE-aPq-f.js → ChatView-S4pMSPhI.js} +2 -2
  14. package/dist/chunks/{ChatView-CE-aPq-f.js.map → ChatView-S4pMSPhI.js.map} +1 -1
  15. package/dist/chunks/{ContextMenu-CvnzcVHB.js → ContextMenu-BKUnE3JT.js} +2 -2
  16. package/dist/chunks/{ContextMenu-CvnzcVHB.js.map → ContextMenu-BKUnE3JT.js.map} +1 -1
  17. package/dist/chunks/{ContextMenu-Cii4P-GY.js → ContextMenu-C5RTltSd.js} +2 -2
  18. package/dist/chunks/{ContextMenu-Cii4P-GY.js.map → ContextMenu-C5RTltSd.js.map} +1 -1
  19. package/dist/chunks/{DataView-CcrHGiuV.js → DataView-D7CYJ31b.js} +2 -2
  20. package/dist/chunks/{DataView-CcrHGiuV.js.map → DataView-D7CYJ31b.js.map} +1 -1
  21. package/dist/chunks/{DataView-ZL2WzpAF.js → DataView-idgJVB89.js} +2 -2
  22. package/dist/chunks/{DataView-ZL2WzpAF.js.map → DataView-idgJVB89.js.map} +1 -1
  23. package/dist/chunks/{Dialog-C6aTVGxC.js → Dialog-4ra2w2tV.js} +2 -2
  24. package/dist/chunks/{Dialog-C6aTVGxC.js.map → Dialog-4ra2w2tV.js.map} +1 -1
  25. package/dist/chunks/{Dialog-BN3tLJrQ.js → Dialog-BPhwGiQx.js} +5 -5
  26. package/dist/chunks/{Dialog-BN3tLJrQ.js.map → Dialog-BPhwGiQx.js.map} +1 -1
  27. package/dist/chunks/{FormView-DtnOoMzi.js → FormView-C1ljUoea.js} +3 -3
  28. package/dist/chunks/FormView-C1ljUoea.js.map +1 -0
  29. package/dist/chunks/{FormView-sG1KQVJ8.js → FormView-a7Rl2bmm.js} +108 -78
  30. package/dist/chunks/FormView-a7Rl2bmm.js.map +1 -0
  31. package/dist/chunks/{MetricsMiniChartWidget-Yaiay78O.js → MetricsMiniChartWidget-hdDNDf7M.js} +3 -3
  32. package/dist/chunks/{MetricsMiniChartWidget-Yaiay78O.js.map → MetricsMiniChartWidget-hdDNDf7M.js.map} +1 -1
  33. package/dist/chunks/{MetricsMiniChartWidget-CUDzMBUf.js → MetricsMiniChartWidget-m_U_ucCF.js} +2 -2
  34. package/dist/chunks/{MetricsMiniChartWidget-CUDzMBUf.js.map → MetricsMiniChartWidget-m_U_ucCF.js.map} +1 -1
  35. package/dist/chunks/{PDFViewer-BpxaCqau.js → PDFViewer-DwJDeXQH.js} +3 -3
  36. package/dist/chunks/{PDFViewer-BpxaCqau.js.map → PDFViewer-DwJDeXQH.js.map} +1 -1
  37. package/dist/chunks/{PDFViewer-BGkd1E_i.js → PDFViewer-OvkZ_4H3.js} +2 -2
  38. package/dist/chunks/{PDFViewer-BGkd1E_i.js.map → PDFViewer-OvkZ_4H3.js.map} +1 -1
  39. package/dist/chunks/{Page-DCQIIrE5.js → Page-CbWUdARI.js} +2 -2
  40. package/dist/chunks/{Page-DCQIIrE5.js.map → Page-CbWUdARI.js.map} +1 -1
  41. package/dist/chunks/{Page-bKLxXw4z.js → Page-D7lbK30W.js} +2 -2
  42. package/dist/chunks/{Page-bKLxXw4z.js.map → Page-D7lbK30W.js.map} +1 -1
  43. package/dist/chunks/{TopNav-CPyGSny9.js → TopNav-B7o7jhkD.js} +5 -5
  44. package/dist/chunks/{TopNav-CPyGSny9.js.map → TopNav-B7o7jhkD.js.map} +1 -1
  45. package/dist/chunks/{TopNav-LA4BgF6l.js → TopNav-CKfu-goV.js} +2 -2
  46. package/dist/chunks/{TopNav-LA4BgF6l.js.map → TopNav-CKfu-goV.js.map} +1 -1
  47. package/dist/chunks/{WebApp-CPQTGurF.js → WebApp-CYCNA3GB.js} +13 -13
  48. package/dist/chunks/{WebApp-CPQTGurF.js.map → WebApp-CYCNA3GB.js.map} +1 -1
  49. package/dist/chunks/{WebApp-PnDZlAh-.js → WebApp-Cnkm2125.js} +2 -2
  50. package/dist/chunks/{WebApp-PnDZlAh-.js.map → WebApp-Cnkm2125.js.map} +1 -1
  51. package/dist/core.css +12 -0
  52. package/dist/css/web-mojo.css +1 -1
  53. package/dist/docit.cjs.js +1 -1
  54. package/dist/docit.es.js +5 -5
  55. package/dist/index.cjs.js +1 -1
  56. package/dist/index.es.js +11 -11
  57. package/dist/lightbox.cjs.js +1 -1
  58. package/dist/lightbox.es.js +4 -4
  59. package/package.json +1 -1
  60. package/dist/chunks/FormView-DtnOoMzi.js.map +0 -1
  61. package/dist/chunks/FormView-sG1KQVJ8.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { M as Mustache, h as MOJOUtils, V as View } from "./WebApp-CPQTGurF.js";
1
+ import { M as Mustache, h as MOJOUtils, V as View } from "./WebApp-CYCNA3GB.js";
2
2
  class FormBuilder {
3
3
  constructor(config = {}) {
4
4
  this.fields = config.fields || [];
@@ -3282,35 +3282,32 @@ class CollectionMultiSelectView extends View {
3282
3282
  {{label}}{{#required}}<span class="text-danger">*</span>{{/required}}
3283
3283
  </label>
3284
3284
  {{/label}}
3285
-
3286
- {{#data.loading}}
3285
+
3286
+ {{#loading}}
3287
3287
  <div class="text-center py-3">
3288
3288
  <div class="spinner-border spinner-border-sm" role="status">
3289
3289
  <span class="visually-hidden">Loading...</span>
3290
3290
  </div>
3291
3291
  </div>
3292
- {{/data.loading}}
3293
-
3294
- {{^data.loading}}
3295
- {{#data.items.length}}
3296
- <div class="collection-multiselect-list border rounded" style="max-height: {{maxHeight}}px; overflow-y: auto;">
3297
- {{#data.items}}
3298
- <div class="form-check px-3 py-2 border-bottom">
3299
- <input class="form-check-input"
3300
- type="checkbox"
3301
- value="{{valueField}}"
3302
- id="{{fieldId}}_{{valueField}}"
3303
- data-action="toggle-item"
3304
- data-value="{{valueField}}"
3305
- {{#isSelected}}checked{{/isSelected}}
3306
- {{#disabled}}disabled{{/disabled}}>
3307
- <label class="form-check-label w-100" for="{{fieldId}}_{{valueField}}">
3308
- {{labelField}}
3309
- </label>
3292
+ {{/loading}}
3293
+
3294
+ {{^loading}}
3295
+ {{#items.length}}
3296
+ <div class="collection-multiselect-list border rounded p-3" style="max-height: {{maxHeight}}px; overflow-y: auto; background: #fff;">
3297
+ {{#items}}
3298
+ <div class="d-flex align-items-center mb-2 py-1 px-2 rounded {{^disabled}}hover-bg{{/disabled}}"
3299
+ style="cursor: {{^disabled}}pointer{{/disabled}}{{#disabled}}not-allowed{{/disabled}}; user-select: none; transition: background-color 0.15s;"
3300
+ data-action="{{^disabled}}toggle-item{{/disabled}}"
3301
+ data-value="{{value}}"
3302
+ data-index="{{index}}"
3303
+ {{#disabled}}data-disabled="true"{{/disabled}}>
3304
+ <i class="bi {{#isSelected}}bi-check-square-fill text-primary{{/isSelected}}{{^isSelected}}bi-square{{/isSelected}} me-2"
3305
+ style="font-size: 1.25rem;"></i>
3306
+ <span {{#disabled}}class="text-muted"{{/disabled}}>{{label}}</span>
3310
3307
  </div>
3311
- {{/data.items}}
3308
+ {{/items}}
3312
3309
  </div>
3313
-
3310
+
3314
3311
  {{#showSelectAll}}
3315
3312
  <div class="mt-2">
3316
3313
  <button type="button" class="btn btn-sm btn-outline-secondary me-2" data-action="select-all">
@@ -3321,15 +3318,15 @@ class CollectionMultiSelectView extends View {
3321
3318
  </button>
3322
3319
  </div>
3323
3320
  {{/showSelectAll}}
3324
- {{/data.items.length}}
3325
-
3326
- {{^data.items.length}}
3321
+ {{/items.length}}
3322
+
3323
+ {{^items.length}}
3327
3324
  <div class="text-muted text-center py-3 border rounded">
3328
3325
  No items available
3329
3326
  </div>
3330
- {{/^data.items.length}}
3331
- {{/data.loading}}
3332
-
3327
+ {{/^items.length}}
3328
+ {{/loading}}
3329
+
3333
3330
  {{#help}}
3334
3331
  <div class="form-text">{{help}}</div>
3335
3332
  {{/help}}
@@ -3357,8 +3354,14 @@ class CollectionMultiSelectView extends View {
3357
3354
  this.showSelectAll = options.showSelectAll !== false;
3358
3355
  this.selectedValues = Array.isArray(options.value) ? options.value : [];
3359
3356
  this.loading = false;
3357
+ this.items = [];
3358
+ this.lastClickedIndex = -1;
3360
3359
  this.fieldId = options.fieldId || `field_${this.name}`;
3361
- this.setupCollection();
3360
+ }
3361
+ onInit() {
3362
+ if (this.collection) {
3363
+ this.setupCollection();
3364
+ }
3362
3365
  }
3363
3366
  setupCollection() {
3364
3367
  if (!this.collection) {
@@ -3374,46 +3377,43 @@ class CollectionMultiSelectView extends View {
3374
3377
  this.collection.params.group = app.activeGroup.id;
3375
3378
  }
3376
3379
  }
3377
- this.collection.on("sync", () => {
3378
- this.loading = false;
3379
- this.render();
3380
+ this.collection.on("fetch:start", () => {
3381
+ this.loading = true;
3382
+ this.render(false);
3380
3383
  });
3381
- this.collection.on("error", (error) => {
3384
+ this.collection.on("fetch:end", () => {
3382
3385
  this.loading = false;
3383
- console.error("CollectionMultiSelect: Collection fetch error", error);
3384
- this.render();
3386
+ this.updateItems();
3387
+ this.render(false);
3385
3388
  });
3386
- if (this.collection.isEmpty()) {
3387
- this.loading = true;
3389
+ if (!this.collection.isEmpty()) {
3390
+ this.updateItems();
3391
+ }
3392
+ }
3393
+ onAfterMount() {
3394
+ if (this.collection && this.collection.isEmpty()) {
3388
3395
  this.collection.fetch();
3389
3396
  }
3390
3397
  }
3391
- async getViewData() {
3392
- const filteredModels = this.collection ? this.collection.models.filter((model) => {
3393
- const modelId = MOJOUtils.getNestedValue(model, this.valueField);
3394
- return !this.excludeIds.includes(modelId);
3395
- }) : [];
3396
- const items = filteredModels.map((model) => {
3398
+ /**
3399
+ * Update items array from collection
3400
+ */
3401
+ updateItems() {
3402
+ const filteredModels = this.collection.models.filter((model) => {
3403
+ const modelId = this.getFieldValue(model, this.valueField);
3404
+ return !this.excludeIds.some((id) => id == modelId);
3405
+ });
3406
+ this.items = filteredModels.map((model, index) => {
3397
3407
  const labelValue = this.getFieldValue(model, this.labelField);
3398
3408
  const fieldValue = this.getFieldValue(model, this.valueField);
3399
3409
  return {
3400
- labelField: labelValue,
3401
- valueField: fieldValue,
3402
- isSelected: this.selectedValues.includes(fieldValue),
3410
+ label: labelValue,
3411
+ value: fieldValue,
3412
+ index,
3413
+ isSelected: this.selectedValues.some((v) => v == fieldValue),
3403
3414
  disabled: this.disabled
3404
3415
  };
3405
3416
  });
3406
- return {
3407
- loading: this.loading,
3408
- items,
3409
- label: this.label,
3410
- help: this.help,
3411
- error: this.error,
3412
- required: this.required,
3413
- showSelectAll: this.showSelectAll && items.length > 0,
3414
- maxHeight: this.maxHeight,
3415
- fieldId: this.fieldId
3416
- };
3417
3417
  }
3418
3418
  /**
3419
3419
  * Get field value from model or object, supporting dot notation
@@ -3430,18 +3430,48 @@ class CollectionMultiSelectView extends View {
3430
3430
  return MOJOUtils.getNestedValue(item, fieldPath);
3431
3431
  }
3432
3432
  /**
3433
- * Handle checkbox toggle
3433
+ * Handle item toggle with shift-click range selection support
3434
3434
  */
3435
- async handleActionToggleItem(event, element) {
3435
+ handleActionToggleItem(event, element) {
3436
3436
  const value = element.getAttribute("data-value");
3437
- const isChecked = element.checked;
3438
- if (isChecked) {
3439
- if (!this.selectedValues.includes(value)) {
3440
- this.selectedValues.push(value);
3437
+ const clickedIndex = parseInt(element.getAttribute("data-index"), 10);
3438
+ const numValue = Number(value);
3439
+ const typedValue = !isNaN(numValue) && String(numValue) === value ? numValue : value;
3440
+ if (event.shiftKey && this.lastClickedIndex !== -1 && this.lastClickedIndex !== clickedIndex) {
3441
+ const isCurrentlySelected = this.selectedValues.some((v) => v == typedValue);
3442
+ const shouldSelect = !isCurrentlySelected;
3443
+ const start = Math.min(this.lastClickedIndex, clickedIndex);
3444
+ const end = Math.max(this.lastClickedIndex, clickedIndex);
3445
+ for (let i = start; i <= end; i++) {
3446
+ const item = this.items[i];
3447
+ if (item && !item.disabled) {
3448
+ const itemNumValue = Number(item.value);
3449
+ const itemTypedValue = !isNaN(itemNumValue) && String(itemNumValue) === String(item.value) ? itemNumValue : item.value;
3450
+ if (shouldSelect) {
3451
+ if (!this.selectedValues.some((v) => v == itemTypedValue)) {
3452
+ this.selectedValues.push(itemTypedValue);
3453
+ }
3454
+ item.isSelected = true;
3455
+ } else {
3456
+ this.selectedValues = this.selectedValues.filter((v) => v != itemTypedValue);
3457
+ item.isSelected = false;
3458
+ }
3459
+ }
3441
3460
  }
3442
3461
  } else {
3443
- this.selectedValues = this.selectedValues.filter((v) => v !== value);
3462
+ const isCurrentlySelected = this.selectedValues.some((v) => v == typedValue);
3463
+ if (isCurrentlySelected) {
3464
+ this.selectedValues = this.selectedValues.filter((v) => v != typedValue);
3465
+ } else {
3466
+ this.selectedValues.push(typedValue);
3467
+ }
3468
+ const item = this.items.find((i) => i.value == value);
3469
+ if (item) {
3470
+ item.isSelected = !isCurrentlySelected;
3471
+ }
3444
3472
  }
3473
+ this.lastClickedIndex = clickedIndex;
3474
+ this.render(false);
3445
3475
  this.emit("change", {
3446
3476
  value: this.selectedValues,
3447
3477
  name: this.name
@@ -3452,14 +3482,13 @@ class CollectionMultiSelectView extends View {
3452
3482
  */
3453
3483
  async handleActionSelectAll(event, element) {
3454
3484
  event.preventDefault();
3455
- const checkboxes = this.element.querySelectorAll('input[type="checkbox"]:not(:disabled)');
3456
- checkboxes.forEach((cb) => {
3457
- const value = cb.getAttribute("data-value");
3458
- if (!this.selectedValues.includes(value)) {
3459
- this.selectedValues.push(value);
3485
+ this.selectedValues = this.items.filter((item) => !item.disabled).map((item) => item.value);
3486
+ this.items.forEach((item) => {
3487
+ if (!item.disabled) {
3488
+ item.isSelected = true;
3460
3489
  }
3461
- cb.checked = true;
3462
3490
  });
3491
+ this.render(false);
3463
3492
  this.emit("change", {
3464
3493
  value: this.selectedValues,
3465
3494
  name: this.name
@@ -3470,11 +3499,11 @@ class CollectionMultiSelectView extends View {
3470
3499
  */
3471
3500
  async handleActionDeselectAll(event, element) {
3472
3501
  event.preventDefault();
3473
- const checkboxes = this.element.querySelectorAll('input[type="checkbox"]');
3474
- checkboxes.forEach((cb) => {
3475
- cb.checked = false;
3476
- });
3477
3502
  this.selectedValues = [];
3503
+ this.items.forEach((item) => {
3504
+ item.isSelected = false;
3505
+ });
3506
+ this.render(false);
3478
3507
  this.emit("change", {
3479
3508
  value: this.selectedValues,
3480
3509
  name: this.name
@@ -3491,6 +3520,7 @@ class CollectionMultiSelectView extends View {
3491
3520
  */
3492
3521
  setValue(values) {
3493
3522
  this.selectedValues = Array.isArray(values) ? values : [];
3523
+ this.updateItems();
3494
3524
  this.render();
3495
3525
  }
3496
3526
  /**
@@ -3498,14 +3528,13 @@ class CollectionMultiSelectView extends View {
3498
3528
  */
3499
3529
  setExcludeIds(ids) {
3500
3530
  this.excludeIds = Array.isArray(ids) ? ids : [];
3531
+ this.updateItems();
3501
3532
  this.render();
3502
3533
  }
3503
3534
  /**
3504
3535
  * Refresh the collection
3505
3536
  */
3506
3537
  async refresh() {
3507
- this.loading = true;
3508
- this.render();
3509
3538
  await this.collection.fetch();
3510
3539
  }
3511
3540
  /**
@@ -4966,6 +4995,7 @@ class FormView extends View {
4966
4995
  this.handleFieldChange(fieldName, data.value);
4967
4996
  });
4968
4997
  } catch (error) {
4998
+ console.error("CollectionMultiSelect initialization failed:", error);
4969
4999
  }
4970
5000
  });
4971
5001
  }
@@ -6566,4 +6596,4 @@ export {
6566
6596
  applyFileDropMixin as a,
6567
6597
  FormView$1 as b
6568
6598
  };
6569
- //# sourceMappingURL=FormView-sG1KQVJ8.js.map
6599
+ //# sourceMappingURL=FormView-a7Rl2bmm.js.map