@saltcorn/server 0.7.3-beta.6 → 0.7.4-beta.0

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/markup/admin.js CHANGED
@@ -345,7 +345,7 @@ const flash_restart = (req) => {
345
345
  * @param {*} opts.formArgs
346
346
  * @returns {Promise<Form>}
347
347
  */
348
- const config_fields_form = async ({ field_names, req, ...formArgs }) => {
348
+ const config_fields_form = async ({ field_names, req, action, ...formArgs }) => {
349
349
  const values = {};
350
350
  const state = getState();
351
351
  const fields = [];
@@ -396,8 +396,9 @@ const config_fields_form = async ({ field_names, req, ...formArgs }) => {
396
396
  const form = new Form({
397
397
  fields,
398
398
  values,
399
- submitButtonClass: "btn-outline-primary",
400
- onChange: "remove_outline(this)",
399
+ action,
400
+ noSubmitButton: true,
401
+ onChange: `saveAndContinue(this)`,
401
402
  ...formArgs,
402
403
  });
403
404
  await form.fill_fkey_options();
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@saltcorn/server",
3
- "version": "0.7.3-beta.6",
3
+ "version": "0.7.4-beta.0",
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.7.3-beta.6",
10
- "@saltcorn/builder": "0.7.3-beta.6",
11
- "@saltcorn/data": "0.7.3-beta.6",
12
- "@saltcorn/admin-models": "0.7.3-beta.6",
13
- "@saltcorn/markup": "0.7.3-beta.6",
14
- "@saltcorn/sbadmin2": "0.7.3-beta.6",
9
+ "@saltcorn/base-plugin": "0.7.4-beta.0",
10
+ "@saltcorn/builder": "0.7.4-beta.0",
11
+ "@saltcorn/data": "0.7.4-beta.0",
12
+ "@saltcorn/admin-models": "0.7.4-beta.0",
13
+ "@saltcorn/markup": "0.7.4-beta.0",
14
+ "@saltcorn/sbadmin2": "0.7.4-beta.0",
15
15
  "@socket.io/cluster-adapter": "^0.1.0",
16
16
  "@socket.io/sticky": "^1.0.1",
17
17
  "aws-sdk": "^2.1037.0",
@@ -142,8 +142,18 @@ function MenuEditor(e, t) {
142
142
  ? c.iconpicker("setIcon", t.icon)
143
143
  : c.iconpicker("setIcon", "empty");
144
144
  r.removeAttr("disabled");
145
+ i.find("[name]").each(function () {
146
+ try {
147
+ const el = $(this);
148
+ if (typeof t[el.attr("name")] === "undefined") {
149
+ el.val("");
150
+ }
151
+ } catch (e) {
152
+ console.warn(e);
153
+ }
154
+ });
145
155
  })((n = $(this).closest("li")));
146
- l.onUpdate();
156
+ //l.onUpdate();
147
157
  }),
148
158
  s.on("click", ".btnUp", function (e) {
149
159
  e.preventDefault();
@@ -39,16 +39,26 @@ function apply_showif() {
39
39
  $("[data-show-if]").each(function (ix, element) {
40
40
  var e = $(element);
41
41
  try {
42
- var to_show = new Function(
43
- "e",
44
- "return " + decodeURIComponent(e.attr("data-show-if"))
45
- );
42
+ let to_show = e.data("data-show-if-fun");
43
+ if (!to_show) {
44
+ to_show = new Function(
45
+ "e",
46
+ "return " + decodeURIComponent(e.attr("data-show-if"))
47
+ );
48
+ e.data("data-show-if-fun", to_show);
49
+ }
50
+ if (!e.data("data-closest-form-ns"))
51
+ e.data("data-closest-form-ns", e.closest(".form-namespace"));
46
52
  if (to_show(e))
47
53
  e.show()
48
54
  .find("input, textarea, button, select")
49
55
  .prop("disabled", e.attr("data-disabled") || false);
50
56
  else
51
- e.hide().find("input, textarea, button, select").prop("disabled", true);
57
+ e.hide()
58
+ .find(
59
+ "input:enabled, textarea:enabled, button:enabled, select:enabled"
60
+ )
61
+ .prop("disabled", true);
52
62
  } catch (e) {
53
63
  console.error(e);
54
64
  }
@@ -111,7 +121,12 @@ function apply_showif() {
111
121
  `<option ${
112
122
  `${current}` === `${r[dynwhere.refname]}` ? "selected" : ""
113
123
  } value="${r[dynwhere.refname]}">${
114
- r[dynwhere.summary_field]
124
+ dynwhere.label_formula
125
+ ? new Function(
126
+ `{${Object.keys(r).join(",")}}`,
127
+ "return " + dynwhere.label_formula
128
+ )(r)
129
+ : r[dynwhere.summary_field]
115
130
  }</option>`
116
131
  )
117
132
  );
@@ -502,7 +517,7 @@ function common_done(res, isWeb = true) {
502
517
  }
503
518
  }
504
519
 
505
- const repeaterCopyValuesToForm = (form, editor) => {
520
+ const repeaterCopyValuesToForm = (form, editor, noTriggerChange) => {
506
521
  const vs = JSON.parse(editor.getString());
507
522
 
508
523
  const setVal = (k, ix, v) => {
@@ -510,7 +525,7 @@ const repeaterCopyValuesToForm = (form, editor) => {
510
525
  if ($e.length) $e.val(v);
511
526
  else
512
527
  form.append(
513
- `<input type="hidden" name="${k}_${ix}" value="${v}"></input>`
528
+ `<input type="hidden" data-repeater-ix="${ix}" name="${k}_${ix}" value="${v}"></input>`
514
529
  );
515
530
  };
516
531
  vs.forEach((v, ix) => {
@@ -521,8 +536,8 @@ const repeaterCopyValuesToForm = (form, editor) => {
521
536
  });
522
537
  });
523
538
  //delete
524
- //for (let ix = vs.length; ix < vs.length + 20; ix++) {
525
- // $(`input[name="${k}_${ix}"]`).remove();
539
+ //for (let ix = vs.length; ix < vs.length + 5; ix++) {
540
+ // $(`input[data-repeater-ix="${ix}"]`).remove();
526
541
  //}
527
542
  $(`input[type=hidden]`).each(function () {
528
543
  const name = $(this).attr("name");
@@ -533,6 +548,7 @@ const repeaterCopyValuesToForm = (form, editor) => {
533
548
  if (typeof ix !== "number" || isNaN(ix)) return;
534
549
  if (ix >= vs.length) $(this).remove();
535
550
  });
551
+ !noTriggerChange && form.trigger("change");
536
552
  };
537
553
  function align_dropdown(id) {
538
554
  setTimeout(() => {
@@ -302,4 +302,21 @@ section.range-slider input[type="range"]::-moz-focus-outer {
302
302
  table.table-inner-grid, table.table-inner-grid th, table.table-inner-grid td {
303
303
  border: 1px solid black;
304
304
  border-collapse: collapse;
305
+ }
306
+
307
+ /* https://codepen.io/pezmotion/pen/RQERdm */
308
+
309
+ .editStarRating {
310
+ direction: rtl;
311
+ unicode-bidi: bidi-override;
312
+ color: #ddd;
313
+ }
314
+ .editStarRating input {
315
+ display: none;
316
+ }
317
+ .editStarRating label:hover,
318
+ .editStarRating label:hover ~ label,
319
+ .editStarRating input:checked + label,
320
+ .editStarRating input:checked + label ~ label {
321
+ color: #ffc107;
305
322
  }
@@ -213,6 +213,7 @@ function ajax_modal(url, opts = {}) {
213
213
  (opts.onOpen || function () {})(res);
214
214
  $("#scmodal").on("hidden.bs.modal", function (e) {
215
215
  (opts.onClose || function () {})(res);
216
+ $("body").css("overflow", "");
216
217
  });
217
218
  },
218
219
  });
@@ -248,7 +249,7 @@ function saveAndContinue(e, k) {
248
249
  return false;
249
250
  }
250
251
 
251
- function applyViewConfig(e, url) {
252
+ function applyViewConfig(e, url, k) {
252
253
  var form = $(e).closest("form");
253
254
  var form_data = form.serializeArray();
254
255
  const cfg = {};
@@ -264,6 +265,9 @@ function applyViewConfig(e, url) {
264
265
  },
265
266
  data: JSON.stringify(cfg),
266
267
  error: function (request) {},
268
+ success: function (res) {
269
+ k && k(res);
270
+ },
267
271
  });
268
272
 
269
273
  return false;