@saltcorn/history-control 0.5.0 → 0.5.1

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 (2) hide show
  1. package/package.json +1 -1
  2. package/rowdiffview.js +33 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/history-control",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Allow users to interact with row history",
5
5
  "main": "index.js",
6
6
  "dependencies": {
package/rowdiffview.js CHANGED
@@ -49,7 +49,23 @@ const configuration_workflow = (req) =>
49
49
  state_fields.some((sf) => sf.name === "id")
50
50
  );
51
51
  const show_view_opts = show_views.map((v) => v.select_option);
52
+ let blurb;
53
+ if (table.provider_name)
54
+ blurb = [
55
+ div(
56
+ { class: "alert alert-danger fst-normal" },
57
+ `Use this view on a standard database table, not a provided table`
58
+ ),
59
+ ];
60
+ else if (!table.versioned)
61
+ blurb = [
62
+ div(
63
+ { class: "alert alert-danger fst-normal" },
64
+ `Version history is not enabled for this table`
65
+ ),
66
+ ];
52
67
  return new Form({
68
+ blurb,
53
69
  fields: [
54
70
  {
55
71
  name: "show_view",
@@ -70,6 +86,11 @@ const configuration_workflow = (req) =>
70
86
  options: show_view_opts,
71
87
  },
72
88
  },
89
+ {
90
+ name: "comparison",
91
+ label: "Side-by-side comparison",
92
+ type: "Bool",
93
+ },
73
94
  {
74
95
  name: "min_interval_secs",
75
96
  label: "Minimum interval (s)",
@@ -91,7 +112,7 @@ const configuration_workflow = (req) =>
91
112
  const run = async (
92
113
  table_id,
93
114
  viewname,
94
- { show_view, min_interval_secs, date_format },
115
+ { show_view, min_interval_secs, date_format, comparison },
95
116
  state,
96
117
  extraArgs
97
118
  ) => {
@@ -169,7 +190,17 @@ const run = async (
169
190
  "aria-labelledby": `a${stateHash}head${ix}`,
170
191
  "data-bs-parent": `#top${stateHash}`,
171
192
  },
172
- div({ class: ["accordion-body"] }, html)
193
+ div(
194
+ { class: ["accordion-body"] },
195
+ comparison && ix < rendered.length - 1
196
+ ? div(
197
+ { class: "d-flex align-middle" },
198
+ div({ class: "border p-1 m-1" }, rendered[ix + 1]),
199
+ i({ class: "m-2 fas fa-arrow-right" }),
200
+ div({ class: "border p-1 m-1" }, html)
201
+ )
202
+ : html
203
+ )
173
204
  )
174
205
  );
175
206
  })