@saltcorn/server 0.8.5-beta.2 → 0.8.5-beta.4

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/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@saltcorn/server",
3
- "version": "0.8.5-beta.2",
3
+ "version": "0.8.5-beta.4",
4
4
  "description": "Server app for Saltcorn, open-source no-code platform",
5
5
  "homepage": "https://saltcorn.com",
6
6
  "main": "index.js",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "@saltcorn/base-plugin": "0.8.5-beta.2",
10
- "@saltcorn/builder": "0.8.5-beta.2",
11
- "@saltcorn/data": "0.8.5-beta.2",
12
- "@saltcorn/admin-models": "0.8.5-beta.2",
13
- "@saltcorn/filemanager": "0.8.5-beta.2",
14
- "@saltcorn/markup": "0.8.5-beta.2",
15
- "@saltcorn/sbadmin2": "0.8.5-beta.2",
9
+ "@saltcorn/base-plugin": "0.8.5-beta.4",
10
+ "@saltcorn/builder": "0.8.5-beta.4",
11
+ "@saltcorn/data": "0.8.5-beta.4",
12
+ "@saltcorn/admin-models": "0.8.5-beta.4",
13
+ "@saltcorn/filemanager": "0.8.5-beta.4",
14
+ "@saltcorn/markup": "0.8.5-beta.4",
15
+ "@saltcorn/sbadmin2": "0.8.5-beta.4",
16
16
  "@socket.io/cluster-adapter": "^0.2.1",
17
17
  "@socket.io/sticky": "^1.0.1",
18
18
  "adm-zip": "0.5.10",
@@ -52,6 +52,7 @@
52
52
  "qrcode": "1.5.1",
53
53
  "resize-with-sharp-or-jimp": "0.1.6",
54
54
  "socket.io": "4.6.0",
55
+ "systeminformation": "^5.11.12",
55
56
  "thirty-two": "1.0.2",
56
57
  "tmp-promise": "^3.0.2",
57
58
  "uuid": "^8.2.0",
@@ -145,7 +145,7 @@ function apply_showif() {
145
145
  });
146
146
  element.dispatchEvent(new Event("RefreshSelectOptions"));
147
147
  if (e.hasClass("selectized") && $().selectize) {
148
- e.selectize()[0].selectize.clearOptions();
148
+ e.selectize()[0].selectize.clearOptions(true);
149
149
  e.selectize()[0].selectize.addOption(dataOptions);
150
150
  if (typeof currentDataOption !== "undefined")
151
151
  e.selectize()[0].selectize.setValue(currentDataOption);
@@ -428,6 +428,10 @@ function initialize_page() {
428
428
  var key = $(this).attr("data-inline-edit-field") || "value";
429
429
  var ajax = !!$(this).attr("data-inline-edit-ajax");
430
430
  var type = $(this).attr("data-inline-edit-type");
431
+ var schema = $(this).attr("data-inline-edit-schema");
432
+ if (schema) {
433
+ schema = JSON.parse(decodeURIComponent(schema));
434
+ }
431
435
  var is_key = type?.startsWith("Key:");
432
436
  const opts = encodeURIComponent(
433
437
  JSON.stringify({
@@ -438,12 +442,16 @@ function initialize_page() {
438
442
  current_label: $(this).attr("data-inline-edit-current-label"),
439
443
  type,
440
444
  is_key,
445
+ schema,
441
446
  })
442
447
  );
443
- if (is_key) {
444
- const [tblName, target] = type.replace("Key:", "").split(".");
448
+ const doAjaxOptionsFetch = (tblName, target) => {
445
449
  $.ajax(`/api/${tblName}`).then((resp) => {
446
450
  if (resp.success) {
451
+ resp.success.sort((a, b) =>
452
+ a[target]?.toLowerCase?.() > b[target]?.toLowerCase?.() ? 1 : -1
453
+ );
454
+
447
455
  const selopts = resp.success.map(
448
456
  (r) =>
449
457
  `<option ${current == r.id ? `selected ` : ``}value="${
@@ -463,6 +471,14 @@ function initialize_page() {
463
471
  );
464
472
  }
465
473
  });
474
+ };
475
+ if (type === "JSON" && schema && schema.type.startsWith("Key to ")) {
476
+ const tblName = schema.type.replace("Key to ", "");
477
+ const target = schema.summary_field || "id";
478
+ doAjaxOptionsFetch(tblName, target);
479
+ } else if (is_key) {
480
+ const [tblName, target] = type.replace("Key:", "").split(".");
481
+ doAjaxOptionsFetch(tblName, target);
466
482
  } else
467
483
  $(this).replaceWith(
468
484
  `<form method="post" action="${url}" ${
@@ -590,7 +606,10 @@ $(initialize_page);
590
606
  function cancel_inline_edit(e, opts1) {
591
607
  var opts = JSON.parse(decodeURIComponent(opts1 || "") || "{}");
592
608
  var form = $(e.target).closest("form");
593
-
609
+ var json_fk_opt;
610
+ if (opts.schema) {
611
+ json_fk_opt = form.find(`option[value="${opts.current}"]`).text();
612
+ }
594
613
  form.replaceWith(`<div
595
614
  data-inline-edit-field="${opts.key}"
596
615
  ${opts.ajax ? `data-inline-edit-ajax="true"` : ""}
@@ -601,8 +620,17 @@ function cancel_inline_edit(e, opts1) {
601
620
  ? `data-inline-edit-current-label="${opts.current_label}"`
602
621
  : ""
603
622
  }
623
+ ${
624
+ opts.schema
625
+ ? `data-inline-edit-schema="${encodeURIComponent(
626
+ JSON.stringify(opts.schema)
627
+ )}"`
628
+ : ""
629
+ }
604
630
  data-inline-edit-dest-url="${opts.url}">
605
- <span class="current">${opts.current_label || opts.current}</span>
631
+ <span class="current">${
632
+ json_fk_opt || opts.current_label || opts.current
633
+ }</span>
606
634
  <i class="editicon fas fa-edit ms-1"></i>
607
635
  </div>`);
608
636
  initialize_page();
@@ -624,15 +652,23 @@ function inline_ajax_submit(e, opts1) {
624
652
  success: function (res) {
625
653
  if (opts) {
626
654
  let rawVal = formDataArray.find((f) => f.name == opts.key).value;
627
- let val = opts.is_key
628
- ? form.find("select").find("option:selected").text()
629
- : rawVal;
655
+ let val =
656
+ opts.is_key || (opts.schema && opts.schema.type.startsWith("Key to "))
657
+ ? form.find("select").find("option:selected").text()
658
+ : rawVal;
630
659
 
631
660
  $(e.target).replaceWith(`<div
632
661
  data-inline-edit-field="${opts.key}"
633
662
  ${opts.ajax ? `data-inline-edit-ajax="true"` : ""}
634
663
  ${opts.type ? `data-inline-edit-type="${opts.type}"` : ""}
635
664
  ${opts.current ? `data-inline-edit-current="${rawVal}"` : ""}
665
+ ${
666
+ opts.schema
667
+ ? `data-inline-edit-schema="${encodeURIComponent(
668
+ JSON.stringify(opts.schema)
669
+ )}"`
670
+ : ""
671
+ }
636
672
  ${opts.current_label ? `data-inline-edit-current-label="${val}"` : ""}
637
673
  data-inline-edit-dest-url="${opts.url}">
638
674
  <span class="current">${val}</span>
@@ -375,3 +375,26 @@ table.table-inner-grid td {
375
375
  margin-bottom: 0 !important;
376
376
  text-decoration: underline;
377
377
  }
378
+
379
+ @supports (zoom: 2) {
380
+ input[type="radio"].large,
381
+ input[type="checkbox"].large {
382
+ zoom: 2;
383
+ }
384
+ input[type="radio"].medium,
385
+ input[type="checkbox"].medium {
386
+ zoom: 1.5;
387
+ }
388
+ }
389
+ @supports not (zoom: 2) {
390
+ input[type="radio"].large,
391
+ input[type="checkbox"].large {
392
+ transform: scale(2);
393
+ margin: 15px;
394
+ }
395
+ input[type="radio"].medium,
396
+ input[type="checkbox"].medium {
397
+ transform: scale(1.5);
398
+ margin: 8px;
399
+ }
400
+ }