@saltcorn/data 0.6.1 → 0.6.2-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/base-plugin/fieldviews.js +33 -28
- package/base-plugin/types.js +223 -94
- package/base-plugin/viewtemplates/edit.js +21 -17
- package/base-plugin/viewtemplates/filter.js +62 -15
- package/base-plugin/viewtemplates/list.js +16 -16
- package/base-plugin/viewtemplates/room.js +24 -22
- package/base-plugin/viewtemplates/show.js +26 -26
- package/base-plugin/viewtemplates/viewable_fields.js +25 -26
- package/db/index.js +6 -3
- package/models/expression.js +37 -25
- package/models/field.js +18 -12
- package/models/form.js +7 -6
- package/package.json +12 -7
- package/plugin-helper.js +31 -11
- package/tests/calc.test.js +22 -0
|
@@ -43,7 +43,7 @@ const {
|
|
|
43
43
|
const { asyncMap } = require("../../utils");
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* @param {object} req
|
|
46
|
+
* @param {object} req
|
|
47
47
|
* @returns {Workflow}
|
|
48
48
|
*/
|
|
49
49
|
const configuration_workflow = (req) =>
|
|
@@ -59,7 +59,7 @@ const configuration_workflow = (req) =>
|
|
|
59
59
|
|
|
60
60
|
const { field_view_options, handlesTextStyle } = calcfldViewOptions(
|
|
61
61
|
fields,
|
|
62
|
-
|
|
62
|
+
"edit"
|
|
63
63
|
);
|
|
64
64
|
const fieldViewConfigForms = await calcfldViewConfig(fields, true);
|
|
65
65
|
|
|
@@ -251,8 +251,8 @@ const configuration_workflow = (req) =>
|
|
|
251
251
|
});
|
|
252
252
|
|
|
253
253
|
/**
|
|
254
|
-
* @param {*} table_id
|
|
255
|
-
* @param {*} viewname
|
|
254
|
+
* @param {*} table_id
|
|
255
|
+
* @param {*} viewname
|
|
256
256
|
* @param {object} opts
|
|
257
257
|
* @param {*} opts.columns
|
|
258
258
|
* @returns {Promise<object[]>}
|
|
@@ -266,8 +266,8 @@ const get_state_fields = async (table_id, viewname, { columns }) => [
|
|
|
266
266
|
];
|
|
267
267
|
|
|
268
268
|
/**
|
|
269
|
-
* @param {Form} form
|
|
270
|
-
* @param {string} locale
|
|
269
|
+
* @param {Form} form
|
|
270
|
+
* @param {string} locale
|
|
271
271
|
*/
|
|
272
272
|
const setDateLocales = (form, locale) => {
|
|
273
273
|
form.fields.forEach((f) => {
|
|
@@ -281,12 +281,12 @@ const setDateLocales = (form, locale) => {
|
|
|
281
281
|
const initial_config = initial_config_all_fields(true);
|
|
282
282
|
|
|
283
283
|
/**
|
|
284
|
-
* @param {number} table_id
|
|
285
|
-
* @param {string} viewname
|
|
284
|
+
* @param {number} table_id
|
|
285
|
+
* @param {string} viewname
|
|
286
286
|
* @param {object} optsOne
|
|
287
287
|
* @param {*} optsOne.columns
|
|
288
288
|
* @param {*} optsOne.layout
|
|
289
|
-
* @param {string} state
|
|
289
|
+
* @param {string} state
|
|
290
290
|
* @param {object} optsTwo
|
|
291
291
|
* @param {object} optsTwo.req
|
|
292
292
|
* @param {object} optsTwo.res
|
|
@@ -320,13 +320,13 @@ const run = async (
|
|
|
320
320
|
};
|
|
321
321
|
|
|
322
322
|
/**
|
|
323
|
-
* @param {number} table_id
|
|
324
|
-
* @param {string} viewname
|
|
323
|
+
* @param {number} table_id
|
|
324
|
+
* @param {string} viewname
|
|
325
325
|
* @param {object} opts
|
|
326
326
|
* @param {*} opts.columns
|
|
327
327
|
* @param {*} opts.layout
|
|
328
|
-
* @param {State} state
|
|
329
|
-
* @param {object} extra
|
|
328
|
+
* @param {State} state
|
|
329
|
+
* @param {object} extra
|
|
330
330
|
* @returns {Promise<Form[]>}
|
|
331
331
|
*/
|
|
332
332
|
const runMany = async (
|
|
@@ -477,21 +477,24 @@ const render = async ({
|
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
});
|
|
480
|
+
await form.fill_fkey_options();
|
|
481
|
+
|
|
480
482
|
await transformForm({ form, table, req, row, res });
|
|
483
|
+
|
|
481
484
|
return renderForm(form, req.csrfToken());
|
|
482
485
|
};
|
|
483
486
|
|
|
484
487
|
/**
|
|
485
|
-
* @param {number} table_id
|
|
486
|
-
* @param {string} viewname
|
|
488
|
+
* @param {number} table_id
|
|
489
|
+
* @param {string} viewname
|
|
487
490
|
* @param {object} optsOne
|
|
488
491
|
* @param {object[]} optsOne.columns
|
|
489
492
|
* @param {Layout} optsOne.layout
|
|
490
493
|
* @param {object} optsOne.fixed
|
|
491
494
|
* @param {boolean} optsOne.view_when_done
|
|
492
495
|
* @param {object[]} optsOne.formula_destinations
|
|
493
|
-
* @param {object} state
|
|
494
|
-
* @param {*} body
|
|
496
|
+
* @param {object} state
|
|
497
|
+
* @param {*} body
|
|
495
498
|
* @param {object} optsTwo
|
|
496
499
|
* @param {object} optsTwo.res
|
|
497
500
|
* @param {object} optsTwo.req
|
|
@@ -520,6 +523,7 @@ const runPost = async (
|
|
|
520
523
|
form.validate(body);
|
|
521
524
|
if (form.hasErrors) {
|
|
522
525
|
if (req.xhr) res.status(422);
|
|
526
|
+
await form.fill_fkey_options();
|
|
523
527
|
await transformForm({ form, table, req });
|
|
524
528
|
res.sendWrap(viewname, renderForm(form, req.csrfToken()));
|
|
525
529
|
} else {
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
const User = require("../../models/user");
|
|
7
7
|
const View = require("../../models/view");
|
|
8
8
|
const Table = require("../../models/table");
|
|
9
|
+
const Field = require("../../models/field");
|
|
9
10
|
const Workflow = require("../../models/workflow");
|
|
10
11
|
|
|
11
12
|
const {
|
|
@@ -17,10 +18,15 @@ const {
|
|
|
17
18
|
select,
|
|
18
19
|
button,
|
|
19
20
|
text_attr,
|
|
21
|
+
script,
|
|
20
22
|
} = require("@saltcorn/markup/tags");
|
|
21
23
|
const renderLayout = require("@saltcorn/markup/layout");
|
|
22
24
|
|
|
23
|
-
const {
|
|
25
|
+
const {
|
|
26
|
+
readState,
|
|
27
|
+
calcfldViewOptions,
|
|
28
|
+
calcfldViewConfig,
|
|
29
|
+
} = require("../../plugin-helper");
|
|
24
30
|
const { search_bar } = require("@saltcorn/markup/helpers");
|
|
25
31
|
const {
|
|
26
32
|
eachView,
|
|
@@ -53,11 +59,13 @@ const configuration_workflow = () =>
|
|
|
53
59
|
const cfields = await cr.table.getFields();
|
|
54
60
|
cfields.forEach((cf) => {
|
|
55
61
|
if (cf.name !== cr.key_field.name)
|
|
56
|
-
fields.push(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
fields.push(
|
|
63
|
+
new Field({
|
|
64
|
+
...cf,
|
|
65
|
+
label: `${cr.table.name}.${cr.key_field.name}→${cf.name}`,
|
|
66
|
+
name: `${cr.table.name}.${cr.key_field.name}.${cf.name}`,
|
|
67
|
+
})
|
|
68
|
+
);
|
|
61
69
|
});
|
|
62
70
|
}
|
|
63
71
|
const actions = ["Clear"];
|
|
@@ -76,12 +84,21 @@ const configuration_workflow = () =>
|
|
|
76
84
|
const library = (await Library.find({})).filter((l) =>
|
|
77
85
|
l.suitableFor("filter")
|
|
78
86
|
);
|
|
87
|
+
const fieldViewConfigForms = await calcfldViewConfig(fields, false);
|
|
88
|
+
|
|
89
|
+
const { field_view_options, handlesTextStyle } = calcfldViewOptions(
|
|
90
|
+
fields,
|
|
91
|
+
"filter"
|
|
92
|
+
);
|
|
79
93
|
return {
|
|
80
94
|
fields,
|
|
95
|
+
tableName: table.name,
|
|
81
96
|
roles,
|
|
82
97
|
actions,
|
|
83
98
|
views,
|
|
84
99
|
library,
|
|
100
|
+
field_view_options,
|
|
101
|
+
fieldViewConfigForms,
|
|
85
102
|
mode: "filter",
|
|
86
103
|
};
|
|
87
104
|
},
|
|
@@ -93,19 +110,19 @@ const configuration_workflow = () =>
|
|
|
93
110
|
const get_state_fields = () => [];
|
|
94
111
|
|
|
95
112
|
/**
|
|
96
|
-
*
|
|
113
|
+
*
|
|
97
114
|
* @returns {Promise<object>}
|
|
98
115
|
*/
|
|
99
116
|
const initial_config = async () => ({ layout: {}, columns: [] });
|
|
100
117
|
|
|
101
118
|
/**
|
|
102
|
-
* @param {number} table_id
|
|
103
|
-
* @param {string} viewname
|
|
119
|
+
* @param {number} table_id
|
|
120
|
+
* @param {string} viewname
|
|
104
121
|
* @param {object} opts
|
|
105
122
|
* @param {object[]} opts.columns
|
|
106
123
|
* @param {object} opts.layout
|
|
107
|
-
* @param {object} state
|
|
108
|
-
* @param {object} extra
|
|
124
|
+
* @param {object} state
|
|
125
|
+
* @param {object} extra
|
|
109
126
|
* @returns {Promise<Layout>}
|
|
110
127
|
*/
|
|
111
128
|
const run = async (table_id, viewname, { columns, layout }, state, extra) => {
|
|
@@ -115,6 +132,7 @@ const run = async (table_id, viewname, { columns, layout }, state, extra) => {
|
|
|
115
132
|
const table = await Table.findOne(table_id);
|
|
116
133
|
const fields = await table.getFields();
|
|
117
134
|
readState(state, fields);
|
|
135
|
+
|
|
118
136
|
const role = extra.req.user ? extra.req.user.role_id : 10;
|
|
119
137
|
const distinct_values = {};
|
|
120
138
|
for (const col of columns) {
|
|
@@ -181,6 +199,35 @@ const run = async (table_id, viewname, { columns, layout }, state, extra) => {
|
|
|
181
199
|
});
|
|
182
200
|
translateLayout(layout, extra.req.getLocale());
|
|
183
201
|
const blockDispatch = {
|
|
202
|
+
field(segment) {
|
|
203
|
+
const { field_name, fieldview, configuration } = segment;
|
|
204
|
+
let field = fields.find((fld) => fld.name === field_name);
|
|
205
|
+
if (!field) return "";
|
|
206
|
+
|
|
207
|
+
if (
|
|
208
|
+
fieldview &&
|
|
209
|
+
field.type &&
|
|
210
|
+
field.type.fieldviews &&
|
|
211
|
+
field.type.fieldviews[fieldview]
|
|
212
|
+
) {
|
|
213
|
+
const fv = field.type.fieldviews[fieldview];
|
|
214
|
+
if (fv.isEdit || fv.isFilter)
|
|
215
|
+
return fv.run(
|
|
216
|
+
field_name,
|
|
217
|
+
state[field_name],
|
|
218
|
+
{
|
|
219
|
+
onChange: `set_state_field('${field_name}', this.value)`,
|
|
220
|
+
...field.attributes,
|
|
221
|
+
...configuration,
|
|
222
|
+
},
|
|
223
|
+
"",
|
|
224
|
+
false,
|
|
225
|
+
segment,
|
|
226
|
+
state
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
return "";
|
|
230
|
+
},
|
|
184
231
|
search_bar({ has_dropdown, contents, show_badges }, go) {
|
|
185
232
|
const rendered_contents = go(contents);
|
|
186
233
|
return search_bar("_fts", state["_fts"], {
|
|
@@ -276,15 +323,15 @@ const run = async (table_id, viewname, { columns, layout }, state, extra) => {
|
|
|
276
323
|
};
|
|
277
324
|
|
|
278
325
|
/**
|
|
279
|
-
* @param {object|undefined} x
|
|
280
|
-
* @param {object|undefined} y
|
|
326
|
+
* @param {object|undefined} x
|
|
327
|
+
* @param {object|undefined} y
|
|
281
328
|
* @returns {object}
|
|
282
329
|
*/
|
|
283
330
|
const or_if_undef = (x, y) => (typeof x === "undefined" ? y : x);
|
|
284
331
|
|
|
285
332
|
/**
|
|
286
|
-
* @param {string} x
|
|
287
|
-
* @param {string} y
|
|
333
|
+
* @param {string} x
|
|
334
|
+
* @param {string} y
|
|
288
335
|
* @returns {boolean}
|
|
289
336
|
*/
|
|
290
337
|
const eq_string = (x, y) => `${x}` === `${y}`;
|
|
@@ -37,7 +37,7 @@ const { get_existing_views } = require("../../models/discovery");
|
|
|
37
37
|
const { InvalidConfiguration } = require("../../utils");
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* @param {object} context
|
|
40
|
+
* @param {object} context
|
|
41
41
|
* @returns {Promise<void>}
|
|
42
42
|
*/
|
|
43
43
|
const create_db_view = async (context) => {
|
|
@@ -64,8 +64,8 @@ const create_db_view = async (context) => {
|
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
|
-
* @param {*} table_id
|
|
68
|
-
* @param {string} viewname
|
|
67
|
+
* @param {*} table_id
|
|
68
|
+
* @param {string} viewname
|
|
69
69
|
* @param {object} opts
|
|
70
70
|
* @param {*} opts.default_state
|
|
71
71
|
* @returns {Promise<void>}
|
|
@@ -83,7 +83,7 @@ const on_delete = async (table_id, viewname, { default_state }) => {
|
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
|
-
* @param {object} req
|
|
86
|
+
* @param {object} req
|
|
87
87
|
* @returns {Workflow}
|
|
88
88
|
*/
|
|
89
89
|
const configuration_workflow = (req) =>
|
|
@@ -283,8 +283,8 @@ const configuration_workflow = (req) =>
|
|
|
283
283
|
});
|
|
284
284
|
|
|
285
285
|
/**
|
|
286
|
-
* @param {string} table_id
|
|
287
|
-
* @param {*} viewname
|
|
286
|
+
* @param {string} table_id
|
|
287
|
+
* @param {*} viewname
|
|
288
288
|
* @param {object} opts
|
|
289
289
|
* @param {object[]} opts.columns
|
|
290
290
|
* @returns {function}
|
|
@@ -313,8 +313,8 @@ const get_state_fields = async (table_id, viewname, { columns }) => {
|
|
|
313
313
|
const initial_config = initial_config_all_fields(false);
|
|
314
314
|
|
|
315
315
|
/**
|
|
316
|
-
* @param {string|number} table_id
|
|
317
|
-
* @param {string} viewname
|
|
316
|
+
* @param {string|number} table_id
|
|
317
|
+
* @param {string} viewname
|
|
318
318
|
* @param {object} opts
|
|
319
319
|
* @param {object[]} opts.columns
|
|
320
320
|
* @param {string} [opts.view_to_create]
|
|
@@ -323,7 +323,7 @@ const initial_config = initial_config_all_fields(false);
|
|
|
323
323
|
* @param {object} [opts.default_state]
|
|
324
324
|
* @param {string} [opts.create_view_location]
|
|
325
325
|
* @param {object} [stateWithId]
|
|
326
|
-
* @param {object} extraOpts
|
|
326
|
+
* @param {object} extraOpts
|
|
327
327
|
* @returns {Promise<*>}
|
|
328
328
|
*/
|
|
329
329
|
const run = async (
|
|
@@ -473,12 +473,12 @@ const run = async (
|
|
|
473
473
|
};
|
|
474
474
|
|
|
475
475
|
/**
|
|
476
|
-
* @param {number} table_id
|
|
477
|
-
* @param {*} viewname
|
|
476
|
+
* @param {number} table_id
|
|
477
|
+
* @param {*} viewname
|
|
478
478
|
* @param {object} optsOne
|
|
479
479
|
* @param {object[]} optsOne.columns
|
|
480
480
|
* @param {*} optsOne.layout
|
|
481
|
-
* @param {object} body
|
|
481
|
+
* @param {object} body
|
|
482
482
|
* @param {object} optsTwo
|
|
483
483
|
* @param {object} optsTwo.req
|
|
484
484
|
* @param {*} optsTwo.res
|
|
@@ -527,7 +527,7 @@ module.exports = {
|
|
|
527
527
|
name: "List",
|
|
528
528
|
/** @type {string} */
|
|
529
529
|
description:
|
|
530
|
-
"Display multiple rows from a table in a grid with columns you specify",
|
|
530
|
+
"Display multiple rows from a table in a grid with columns you specify",
|
|
531
531
|
configuration_workflow,
|
|
532
532
|
run,
|
|
533
533
|
/** @type {string} */
|
|
@@ -537,13 +537,13 @@ module.exports = {
|
|
|
537
537
|
on_delete,
|
|
538
538
|
routes: { run_action },
|
|
539
539
|
/**
|
|
540
|
-
* @param {object} opts
|
|
540
|
+
* @param {object} opts
|
|
541
541
|
* @returns {boolean}
|
|
542
542
|
*/
|
|
543
543
|
display_state_form: (opts) =>
|
|
544
544
|
!(opts && opts.default_state && opts.default_state._omit_state_form),
|
|
545
545
|
/**
|
|
546
|
-
* @param {object} opts
|
|
546
|
+
* @param {object} opts
|
|
547
547
|
* @returns {boolean}
|
|
548
548
|
*/
|
|
549
549
|
default_state_form: ({ default_state }) => {
|
|
@@ -552,7 +552,7 @@ module.exports = {
|
|
|
552
552
|
return ds && removeDefaultColor(removeEmptyStrings(ds));
|
|
553
553
|
},
|
|
554
554
|
/**
|
|
555
|
-
* @param {object} opts
|
|
555
|
+
* @param {object} opts
|
|
556
556
|
* @param {*} opts.columns
|
|
557
557
|
* @param {*} opts.create_view_label
|
|
558
558
|
* @returns {string[]}
|
|
@@ -36,8 +36,8 @@ const db = require("../../db");
|
|
|
36
36
|
const { getForm, fill_presets } = require("./viewable_fields");
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
* @param {object} req
|
|
39
|
+
*
|
|
40
|
+
* @param {object} req
|
|
41
41
|
* @returns {Workflow}
|
|
42
42
|
*/
|
|
43
43
|
const configuration_workflow = (req) =>
|
|
@@ -184,8 +184,8 @@ const get_state_fields = () => [
|
|
|
184
184
|
const limit = 10;
|
|
185
185
|
|
|
186
186
|
/**
|
|
187
|
-
* @param {string} table_id
|
|
188
|
-
* @param {string} viewname
|
|
187
|
+
* @param {string} table_id
|
|
188
|
+
* @param {string} viewname
|
|
189
189
|
* @param {object} optsOne
|
|
190
190
|
* @param {string} optsOne.participant_field,
|
|
191
191
|
* @param {string} optsOne.msg_relation
|
|
@@ -193,7 +193,7 @@ const limit = 10;
|
|
|
193
193
|
* @param {string} optsOne.msgview
|
|
194
194
|
* @param {string} optsOne.msgform
|
|
195
195
|
* @param {string} optsOne.participant_maxread_field
|
|
196
|
-
* @param {object} state
|
|
196
|
+
* @param {object} state
|
|
197
197
|
* @param {object} optsTwo
|
|
198
198
|
* @param {object} optsTwo.req
|
|
199
199
|
* @param {object} optsTwo.res
|
|
@@ -286,6 +286,8 @@ const run = async (
|
|
|
286
286
|
form.class = `room-${state.id}`;
|
|
287
287
|
form.hidden("room_id");
|
|
288
288
|
form.values = { room_id: state.id };
|
|
289
|
+
await form.fill_fkey_options();
|
|
290
|
+
|
|
289
291
|
return div(
|
|
290
292
|
n_retrieved === limit &&
|
|
291
293
|
button(
|
|
@@ -305,13 +307,13 @@ const run = async (
|
|
|
305
307
|
};
|
|
306
308
|
|
|
307
309
|
/**
|
|
308
|
-
* @param {*} table_id
|
|
309
|
-
* @param {*} viewname
|
|
310
|
-
* @param {object} optsOne
|
|
310
|
+
* @param {*} table_id
|
|
311
|
+
* @param {*} viewname
|
|
312
|
+
* @param {object} optsOne
|
|
311
313
|
* @param {string} optsOne.participant_field
|
|
312
314
|
* @param {string} optsOne.participant_maxread_field
|
|
313
|
-
* @param {body} body
|
|
314
|
-
* @param {object} optsTwo
|
|
315
|
+
* @param {body} body
|
|
316
|
+
* @param {object} optsTwo
|
|
315
317
|
* @param {object} optsTwo.req
|
|
316
318
|
* @param {object} optsTwo.res
|
|
317
319
|
* @returns {Promise<void>}
|
|
@@ -365,8 +367,8 @@ const ack_read = async (
|
|
|
365
367
|
};
|
|
366
368
|
|
|
367
369
|
/**
|
|
368
|
-
* @param {*} table_id
|
|
369
|
-
* @param {*} viewname
|
|
370
|
+
* @param {*} table_id
|
|
371
|
+
* @param {*} viewname
|
|
370
372
|
* @param {object} optsOne.
|
|
371
373
|
* @param {string} optsOne.participant_field
|
|
372
374
|
* @param {string} optsOne.msg_relation
|
|
@@ -374,10 +376,10 @@ const ack_read = async (
|
|
|
374
376
|
* @param {string} optsOne.msgview
|
|
375
377
|
* @param {*} optsOne.msgform
|
|
376
378
|
* @param {*} optsOne.participant_maxread_field
|
|
377
|
-
* @param {object} body
|
|
378
|
-
* @param {object} optsTwo
|
|
379
|
+
* @param {object} body
|
|
380
|
+
* @param {object} optsTwo
|
|
379
381
|
* @param {object} optsTwo.req
|
|
380
|
-
* @param {object} optsTwo.res
|
|
382
|
+
* @param {object} optsTwo.res
|
|
381
383
|
* @returns {Promise<object>}
|
|
382
384
|
*/
|
|
383
385
|
const fetch_older_msg = async (
|
|
@@ -445,8 +447,8 @@ const fetch_older_msg = async (
|
|
|
445
447
|
};
|
|
446
448
|
|
|
447
449
|
/**
|
|
448
|
-
* @param {*} table_id
|
|
449
|
-
* @param {string} viewname
|
|
450
|
+
* @param {*} table_id
|
|
451
|
+
* @param {string} viewname
|
|
450
452
|
* @param {object} optsOne
|
|
451
453
|
* @param {string} optsOne.participant_field
|
|
452
454
|
* @param {string} optsOne.msg_relation
|
|
@@ -454,7 +456,7 @@ const fetch_older_msg = async (
|
|
|
454
456
|
* @param {string} optsOne.msgview
|
|
455
457
|
* @param {string} optsOne.msgform
|
|
456
458
|
* @param {string} optsOne.participant_maxread_field
|
|
457
|
-
* @param {*} body
|
|
459
|
+
* @param {*} body
|
|
458
460
|
* @param {object} optsTwo
|
|
459
461
|
* @param {object} optsTwo.req
|
|
460
462
|
* @param {object} optsTwo.res
|
|
@@ -549,8 +551,8 @@ const submit_msg_ajax = async (
|
|
|
549
551
|
};
|
|
550
552
|
|
|
551
553
|
/**
|
|
552
|
-
* @param {*} table_id
|
|
553
|
-
* @param {string} viewname
|
|
554
|
+
* @param {*} table_id
|
|
555
|
+
* @param {string} viewname
|
|
554
556
|
* @param {object} opts
|
|
555
557
|
* @param {*} opts.participant_field
|
|
556
558
|
* @param {string} opts.msg_relation,
|
|
@@ -617,8 +619,8 @@ module.exports = {
|
|
|
617
619
|
/**
|
|
618
620
|
* @param {object} opts
|
|
619
621
|
* @param {object} opts.participant_field
|
|
620
|
-
* @param {string} room_id
|
|
621
|
-
* @param {object} user
|
|
622
|
+
* @param {string} room_id
|
|
623
|
+
* @param {object} user
|
|
622
624
|
* @returns {Promise<object>}
|
|
623
625
|
*/
|
|
624
626
|
authorize_join: async ({ participant_field }, room_id, user) => {
|
|
@@ -55,7 +55,7 @@ const { get_base_url } = require("../../models/config");
|
|
|
55
55
|
const Library = require("../../models/library");
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* @param {object} req
|
|
58
|
+
* @param {object} req
|
|
59
59
|
* @returns {Workflow}
|
|
60
60
|
*/
|
|
61
61
|
const configuration_workflow = (req) =>
|
|
@@ -106,7 +106,7 @@ const configuration_workflow = (req) =>
|
|
|
106
106
|
const fieldViewConfigForms = await calcfldViewConfig(fields, false);
|
|
107
107
|
const { field_view_options, handlesTextStyle } = calcfldViewOptions(
|
|
108
108
|
fields,
|
|
109
|
-
|
|
109
|
+
"show"
|
|
110
110
|
);
|
|
111
111
|
if (table.name === "users") {
|
|
112
112
|
fields.push(
|
|
@@ -207,15 +207,15 @@ const get_state_fields = () => [
|
|
|
207
207
|
const initial_config = initial_config_all_fields(false);
|
|
208
208
|
|
|
209
209
|
/**
|
|
210
|
-
* @param {string} table_id
|
|
211
|
-
* @param {string} viewname
|
|
210
|
+
* @param {string} table_id
|
|
211
|
+
* @param {string} viewname
|
|
212
212
|
* @param {object} opts
|
|
213
213
|
* @param {object[]} opts.columns
|
|
214
214
|
* @param {object} opts.layout
|
|
215
215
|
* @param {string} [opts.page_title]
|
|
216
216
|
* @param {boolean} opts.page_title_formula
|
|
217
|
-
* @param {object} state
|
|
218
|
-
* @param {object} extra
|
|
217
|
+
* @param {object} state
|
|
218
|
+
* @param {object} extra
|
|
219
219
|
* @returns {Promise<string>}
|
|
220
220
|
*/
|
|
221
221
|
const run = async (
|
|
@@ -332,13 +332,13 @@ const set_join_fieldviews = async ({ layout, fields }) => {
|
|
|
332
332
|
};
|
|
333
333
|
|
|
334
334
|
/**
|
|
335
|
-
* @param {object} table
|
|
336
|
-
* @param {string} viewname
|
|
335
|
+
* @param {object} table
|
|
336
|
+
* @param {string} viewname
|
|
337
337
|
* @param {object} opts
|
|
338
338
|
* @param {object[]} opts.columns
|
|
339
339
|
* @param {object} opts.layout
|
|
340
|
-
* @param {object} extra
|
|
341
|
-
* @param {object[]} rows
|
|
340
|
+
* @param {object} extra
|
|
341
|
+
* @param {object[]} rows
|
|
342
342
|
* @returns {Promise<string>}
|
|
343
343
|
*/
|
|
344
344
|
const renderRows = async (
|
|
@@ -431,13 +431,13 @@ const renderRows = async (
|
|
|
431
431
|
};
|
|
432
432
|
|
|
433
433
|
/**
|
|
434
|
-
* @param {number} table_id
|
|
435
|
-
* @param {string} viewname
|
|
434
|
+
* @param {number} table_id
|
|
435
|
+
* @param {string} viewname
|
|
436
436
|
* @param {object} opts
|
|
437
437
|
* @param {object[]} opts.columns
|
|
438
438
|
* @param {object} opts.layout
|
|
439
|
-
* @param {object} state
|
|
440
|
-
* @param {object} extra
|
|
439
|
+
* @param {object} state
|
|
440
|
+
* @param {object} extra
|
|
441
441
|
* @returns {Promise<object[]>}
|
|
442
442
|
*/
|
|
443
443
|
const runMany = async (
|
|
@@ -477,14 +477,14 @@ const runMany = async (
|
|
|
477
477
|
};
|
|
478
478
|
|
|
479
479
|
/**
|
|
480
|
-
* @param {object} row
|
|
481
|
-
* @param {Field[]} fields
|
|
482
|
-
* @param {Layout} layout0
|
|
483
|
-
* @param {string} viewname
|
|
484
|
-
* @param {Table} table
|
|
485
|
-
* @param {Role} role
|
|
486
|
-
* @param {object} req
|
|
487
|
-
* @param {object} is_owner
|
|
480
|
+
* @param {object} row
|
|
481
|
+
* @param {Field[]} fields
|
|
482
|
+
* @param {Layout} layout0
|
|
483
|
+
* @param {string} viewname
|
|
484
|
+
* @param {Table} table
|
|
485
|
+
* @param {Role} role
|
|
486
|
+
* @param {object} req
|
|
487
|
+
* @param {object} is_owner
|
|
488
488
|
* @throws {Error}
|
|
489
489
|
* @returns {Layout}
|
|
490
490
|
*/
|
|
@@ -627,14 +627,14 @@ const render = (row, fields, layout0, viewname, table, role, req, is_owner) => {
|
|
|
627
627
|
};
|
|
628
628
|
|
|
629
629
|
/**
|
|
630
|
-
* @param {number} table_id
|
|
631
|
-
* @param {*} viewname
|
|
630
|
+
* @param {number} table_id
|
|
631
|
+
* @param {*} viewname
|
|
632
632
|
* @param {object} opts
|
|
633
633
|
* @param {object[]} opts.columns
|
|
634
634
|
* @param {*} opts.layout
|
|
635
|
-
* @param {*} body
|
|
635
|
+
* @param {*} body
|
|
636
636
|
* @param {object} optsTwo
|
|
637
|
-
* @param {object} optsTwo.req
|
|
637
|
+
* @param {object} optsTwo.req
|
|
638
638
|
* @param {*} optsTwo.res
|
|
639
639
|
* @returns {Promise<object>}
|
|
640
640
|
*/
|