@saltcorn/data 1.5.4 → 1.5.5
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 +8 -8
- package/dist/migrations/202603101553.d.ts +0 -4
- package/dist/migrations/202603101553.d.ts.map +0 -1
- package/dist/migrations/202603101553.js +0 -22
- package/dist/migrations/202603101553.js.map +0 -1
- package/dist/mobile-mocks/node/assert.d.ts +0 -1
- package/dist/mobile-mocks/node/assert.d.ts.map +0 -1
- package/dist/mobile-mocks/node/assert.js +0 -2
- package/dist/mobile-mocks/node/assert.js.map +0 -1
- package/dist/mobile-mocks/npm/apns2.d.ts +0 -1
- package/dist/mobile-mocks/npm/apns2.d.ts.map +0 -1
- package/dist/mobile-mocks/npm/apns2.js +0 -2
- package/dist/mobile-mocks/npm/apns2.js.map +0 -1
- package/dist/mobile-mocks/npm/vm2.d.ts +0 -1
- package/dist/mobile-mocks/npm/vm2.d.ts.map +0 -1
- package/dist/mobile-mocks/npm/vm2.js +0 -2
- package/dist/mobile-mocks/npm/vm2.js.map +0 -1
- package/dist/mobile-mocks/npm/xml2js.d.ts +0 -1
- package/dist/mobile-mocks/npm/xml2js.d.ts.map +0 -1
- package/dist/mobile-mocks/npm/xml2js.js +0 -2
- package/dist/mobile-mocks/npm/xml2js.js.map +0 -1
- package/dist/tests/actions.test.d.ts +0 -2
- package/dist/tests/actions.test.d.ts.map +0 -1
- package/dist/tests/actions.test.js +0 -936
- package/dist/tests/actions.test.js.map +0 -1
- package/dist/tests/auth.test.d.ts +0 -2
- package/dist/tests/auth.test.d.ts.map +0 -1
- package/dist/tests/auth.test.js +0 -824
- package/dist/tests/auth.test.js.map +0 -1
- package/dist/tests/auxtest.test.d.ts +0 -2
- package/dist/tests/auxtest.test.d.ts.map +0 -1
- package/dist/tests/auxtest.test.js +0 -562
- package/dist/tests/auxtest.test.js.map +0 -1
- package/dist/tests/base.test.d.ts +0 -2
- package/dist/tests/base.test.d.ts.map +0 -1
- package/dist/tests/base.test.js +0 -30
- package/dist/tests/base.test.js.map +0 -1
- package/dist/tests/calc.test.d.ts +0 -2
- package/dist/tests/calc.test.d.ts.map +0 -1
- package/dist/tests/calc.test.js +0 -1081
- package/dist/tests/calc.test.js.map +0 -1
- package/dist/tests/composite_pk.test.d.ts +0 -2
- package/dist/tests/composite_pk.test.d.ts.map +0 -1
- package/dist/tests/composite_pk.test.js +0 -98
- package/dist/tests/composite_pk.test.js.map +0 -1
- package/dist/tests/config.test.d.ts +0 -2
- package/dist/tests/config.test.d.ts.map +0 -1
- package/dist/tests/config.test.js +0 -86
- package/dist/tests/config.test.js.map +0 -1
- package/dist/tests/db.test.d.ts +0 -2
- package/dist/tests/db.test.d.ts.map +0 -1
- package/dist/tests/db.test.js +0 -178
- package/dist/tests/db.test.js.map +0 -1
- package/dist/tests/discover.test.d.ts +0 -2
- package/dist/tests/discover.test.d.ts.map +0 -1
- package/dist/tests/discover.test.js +0 -245
- package/dist/tests/discover.test.js.map +0 -1
- package/dist/tests/edit.test.d.ts +0 -2
- package/dist/tests/edit.test.d.ts.map +0 -1
- package/dist/tests/edit.test.js +0 -1161
- package/dist/tests/edit.test.js.map +0 -1
- package/dist/tests/email.test.d.ts +0 -2
- package/dist/tests/email.test.d.ts.map +0 -1
- package/dist/tests/email.test.js +0 -255
- package/dist/tests/email.test.js.map +0 -1
- package/dist/tests/exact_views.test.d.ts +0 -2
- package/dist/tests/exact_views.test.d.ts.map +0 -1
- package/dist/tests/exact_views.test.js +0 -1363
- package/dist/tests/exact_views.test.js.map +0 -1
- package/dist/tests/field.test.d.ts +0 -2
- package/dist/tests/field.test.d.ts.map +0 -1
- package/dist/tests/field.test.js +0 -588
- package/dist/tests/field.test.js.map +0 -1
- package/dist/tests/fieldviews.test.d.ts +0 -2
- package/dist/tests/fieldviews.test.d.ts.map +0 -1
- package/dist/tests/fieldviews.test.js +0 -74
- package/dist/tests/fieldviews.test.js.map +0 -1
- package/dist/tests/file.test.d.ts +0 -2
- package/dist/tests/file.test.d.ts.map +0 -1
- package/dist/tests/file.test.js +0 -148
- package/dist/tests/file.test.js.map +0 -1
- package/dist/tests/filter.test.d.ts +0 -2
- package/dist/tests/filter.test.d.ts.map +0 -1
- package/dist/tests/filter.test.js +0 -496
- package/dist/tests/filter.test.js.map +0 -1
- package/dist/tests/form.test.d.ts +0 -2
- package/dist/tests/form.test.d.ts.map +0 -1
- package/dist/tests/form.test.js +0 -264
- package/dist/tests/form.test.js.map +0 -1
- package/dist/tests/list.test.d.ts +0 -2
- package/dist/tests/list.test.d.ts.map +0 -1
- package/dist/tests/list.test.js +0 -1037
- package/dist/tests/list.test.js.map +0 -1
- package/dist/tests/models.test.d.ts +0 -2
- package/dist/tests/models.test.d.ts.map +0 -1
- package/dist/tests/models.test.js +0 -417
- package/dist/tests/models.test.js.map +0 -1
- package/dist/tests/page.test.d.ts +0 -2
- package/dist/tests/page.test.d.ts.map +0 -1
- package/dist/tests/page.test.js +0 -26
- package/dist/tests/page.test.js.map +0 -1
- package/dist/tests/page_group.test.d.ts +0 -2
- package/dist/tests/page_group.test.d.ts.map +0 -1
- package/dist/tests/page_group.test.js +0 -51
- package/dist/tests/page_group.test.js.map +0 -1
- package/dist/tests/plugin.test.d.ts +0 -2
- package/dist/tests/plugin.test.d.ts.map +0 -1
- package/dist/tests/plugin.test.js +0 -60
- package/dist/tests/plugin.test.js.map +0 -1
- package/dist/tests/show.test.d.ts +0 -2
- package/dist/tests/show.test.d.ts.map +0 -1
- package/dist/tests/show.test.js +0 -561
- package/dist/tests/show.test.js.map +0 -1
- package/dist/tests/state.test.d.ts +0 -2
- package/dist/tests/state.test.d.ts.map +0 -1
- package/dist/tests/state.test.js +0 -82
- package/dist/tests/state.test.js.map +0 -1
- package/dist/tests/table.test.d.ts +0 -2
- package/dist/tests/table.test.d.ts.map +0 -1
- package/dist/tests/table.test.js +0 -2717
- package/dist/tests/table.test.js.map +0 -1
- package/dist/tests/table_history.test.d.ts +0 -2
- package/dist/tests/table_history.test.d.ts.map +0 -1
- package/dist/tests/table_history.test.js +0 -413
- package/dist/tests/table_history.test.js.map +0 -1
- package/dist/tests/tag.test.d.ts +0 -2
- package/dist/tests/tag.test.d.ts.map +0 -1
- package/dist/tests/tag.test.js +0 -97
- package/dist/tests/tag.test.js.map +0 -1
- package/dist/tests/user.test.d.ts +0 -2
- package/dist/tests/user.test.d.ts.map +0 -1
- package/dist/tests/user.test.js +0 -441
- package/dist/tests/user.test.js.map +0 -1
- package/dist/tests/view.test.d.ts +0 -2
- package/dist/tests/view.test.d.ts.map +0 -1
- package/dist/tests/view.test.js +0 -699
- package/dist/tests/view.test.js.map +0 -1
- package/dist/tests/workflow.test.d.ts +0 -2
- package/dist/tests/workflow.test.d.ts.map +0 -1
- package/dist/tests/workflow.test.js +0 -303
- package/dist/tests/workflow.test.js.map +0 -1
- package/dist/tests/workflow_run.test.d.ts +0 -2
- package/dist/tests/workflow_run.test.d.ts.map +0 -1
- package/dist/tests/workflow_run.test.js +0 -922
- package/dist/tests/workflow_run.test.js.map +0 -1
- package/dist/viewable_fields.d.ts +0 -227
- package/dist/viewable_fields.d.ts.map +0 -1
- package/dist/viewable_fields.js +0 -1928
- package/dist/viewable_fields.js.map +0 -1
|
@@ -1,1363 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const table_1 = __importDefault(require("../models/table"));
|
|
7
|
-
const view_1 = __importDefault(require("../models/view"));
|
|
8
|
-
const db_1 = __importDefault(require("../db"));
|
|
9
|
-
const mocks_1 = __importDefault(require("./mocks"));
|
|
10
|
-
const { mockReqRes } = mocks_1.default;
|
|
11
|
-
const { getState } = require("../db/state");
|
|
12
|
-
const page_1 = __importDefault(require("../models/page"));
|
|
13
|
-
const globals_1 = require("@jest/globals");
|
|
14
|
-
const assertions_1 = require("./assertions");
|
|
15
|
-
const remote_query_helper_1 = require("./remote_query_helper");
|
|
16
|
-
let remoteQueries = false;
|
|
17
|
-
getState().registerPlugin("base", require("../base-plugin"));
|
|
18
|
-
(0, globals_1.afterAll)(db_1.default.close);
|
|
19
|
-
(0, globals_1.beforeAll)(async () => {
|
|
20
|
-
await require("../db/reset_schema")();
|
|
21
|
-
await require("../db/fixtures")();
|
|
22
|
-
if (process.env.REMOTE_QUERIES === "true") {
|
|
23
|
-
getState().setConfig("base_url", "http://localhost:3000");
|
|
24
|
-
remoteQueries = true;
|
|
25
|
-
await (0, remote_query_helper_1.prepareQueryEnviroment)();
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const mkTester = ({ name, viewtemplate, set_id, table, }) => async ({ response, id, ...rest }) => {
|
|
29
|
-
const tbl = table_1.default.findOne({ name: rest.table || table });
|
|
30
|
-
(0, assertions_1.assertIsSet)(tbl);
|
|
31
|
-
const viewCfg = {
|
|
32
|
-
table_id: tbl.id,
|
|
33
|
-
name: rest.name || name,
|
|
34
|
-
viewtemplate,
|
|
35
|
-
configuration: rest,
|
|
36
|
-
min_role: 100,
|
|
37
|
-
};
|
|
38
|
-
const v = await view_1.default.create(viewCfg);
|
|
39
|
-
await getState().refresh_views();
|
|
40
|
-
if (remoteQueries)
|
|
41
|
-
await (0, remote_query_helper_1.sendViewToServer)(viewCfg);
|
|
42
|
-
const configFlow = await v.get_config_flow(mockReqRes.req);
|
|
43
|
-
await configFlow.run({
|
|
44
|
-
table_id: tbl.id,
|
|
45
|
-
exttable_name: v.exttable_name,
|
|
46
|
-
viewname: v.name,
|
|
47
|
-
...v.configuration,
|
|
48
|
-
}, mockReqRes.req);
|
|
49
|
-
for (const step of configFlow.steps)
|
|
50
|
-
await configFlow.run({
|
|
51
|
-
table_id: tbl.id,
|
|
52
|
-
exttable_name: v.exttable_name,
|
|
53
|
-
viewname: v.name,
|
|
54
|
-
...v.configuration,
|
|
55
|
-
stepName: step.name,
|
|
56
|
-
}, mockReqRes.req);
|
|
57
|
-
const res = await v.run(id ? { id } : set_id ? { id: set_id } : {}, mockReqRes, remoteQueries);
|
|
58
|
-
//if (res !== response) console.log(res);
|
|
59
|
-
(0, globals_1.expect)(res).toBe(response);
|
|
60
|
-
if (!rest.noDelete) {
|
|
61
|
-
await v.delete();
|
|
62
|
-
if (remoteQueries)
|
|
63
|
-
await (0, remote_query_helper_1.deleteViewFromServer)(v.id);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const test_page = async ({ response, ...rest }) => {
|
|
67
|
-
const p = await page_1.default.create(rest);
|
|
68
|
-
const contents = await p.run({}, mockReqRes);
|
|
69
|
-
(0, globals_1.expect)(contents).toStrictEqual(response);
|
|
70
|
-
await p.delete();
|
|
71
|
-
};
|
|
72
|
-
const test_show = mkTester({
|
|
73
|
-
name: "testshow",
|
|
74
|
-
viewtemplate: "Show",
|
|
75
|
-
set_id: 1,
|
|
76
|
-
table: "books",
|
|
77
|
-
});
|
|
78
|
-
const test_edit = mkTester({
|
|
79
|
-
name: "testedit",
|
|
80
|
-
viewtemplate: "Edit",
|
|
81
|
-
table: "patients",
|
|
82
|
-
});
|
|
83
|
-
const test_list = mkTester({
|
|
84
|
-
name: "testlist",
|
|
85
|
-
viewtemplate: "List",
|
|
86
|
-
table: "patients",
|
|
87
|
-
});
|
|
88
|
-
const test_feed = mkTester({
|
|
89
|
-
name: "testlist",
|
|
90
|
-
viewtemplate: "Feed",
|
|
91
|
-
table: "patients",
|
|
92
|
-
});
|
|
93
|
-
const test_filter = mkTester({
|
|
94
|
-
name: "testfilter",
|
|
95
|
-
viewtemplate: "Filter",
|
|
96
|
-
table: "books",
|
|
97
|
-
});
|
|
98
|
-
(0, globals_1.describe)("Show view", () => {
|
|
99
|
-
(0, globals_1.it)("should render exactly", async () => {
|
|
100
|
-
await test_show({
|
|
101
|
-
layout: { type: "blank", contents: "Hello world", isFormula: {} },
|
|
102
|
-
columns: [],
|
|
103
|
-
response: `Hello world`,
|
|
104
|
-
});
|
|
105
|
-
await test_show({
|
|
106
|
-
layout: { type: "field", fieldview: "as_text", field_name: "author" },
|
|
107
|
-
columns: [{ type: "Field", fieldview: "as_text", field_name: "author" }],
|
|
108
|
-
response: `Herman Melville`,
|
|
109
|
-
});
|
|
110
|
-
await test_show({
|
|
111
|
-
layout: {
|
|
112
|
-
type: "field",
|
|
113
|
-
fieldview: "as_text",
|
|
114
|
-
textStyle: "h3",
|
|
115
|
-
field_name: "author",
|
|
116
|
-
},
|
|
117
|
-
columns: [{ type: "Field", fieldview: "as_text", field_name: "author" }],
|
|
118
|
-
response: `<h3>Herman Melville</h3>`,
|
|
119
|
-
});
|
|
120
|
-
await test_show({
|
|
121
|
-
layout: {
|
|
122
|
-
widths: [6, 6],
|
|
123
|
-
besides: [
|
|
124
|
-
{
|
|
125
|
-
stat: "Count",
|
|
126
|
-
type: "aggregation",
|
|
127
|
-
agg_field: "name",
|
|
128
|
-
agg_relation: "patients.favbook",
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
type: "action",
|
|
132
|
-
rndid: "1a8ac3",
|
|
133
|
-
minRole: 100,
|
|
134
|
-
isFormula: {},
|
|
135
|
-
action_name: "run_js_code",
|
|
136
|
-
action_size: "btn-sm",
|
|
137
|
-
action_label: "you're my number",
|
|
138
|
-
action_style: "btn-success",
|
|
139
|
-
configuration: { code: 'console.log("1")' },
|
|
140
|
-
},
|
|
141
|
-
],
|
|
142
|
-
},
|
|
143
|
-
columns: [
|
|
144
|
-
{
|
|
145
|
-
stat: "Count",
|
|
146
|
-
type: "Aggregation",
|
|
147
|
-
agg_field: "name",
|
|
148
|
-
agg_relation: "patients.favbook",
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
type: "Action",
|
|
152
|
-
rndid: "1a8ac3",
|
|
153
|
-
minRole: 100,
|
|
154
|
-
isFormula: {},
|
|
155
|
-
action_name: "run_js_code",
|
|
156
|
-
action_size: "btn-sm",
|
|
157
|
-
action_label: "you're my number",
|
|
158
|
-
action_style: "btn-success",
|
|
159
|
-
configuration: { code: 'console.log("1")' },
|
|
160
|
-
},
|
|
161
|
-
],
|
|
162
|
-
response: `<div class="row"><div class="col-6">1</div><div class="col-6"><a href="javascript:void(0)" onclick="view_post('testshow', 'run_action', {rndid:'1a8ac3', id:'1'});" class="btn btn-success btn-sm">you're my number</a></div></div>`,
|
|
163
|
-
});
|
|
164
|
-
await test_show({
|
|
165
|
-
layout: {
|
|
166
|
-
widths: [6, 6],
|
|
167
|
-
besides: [
|
|
168
|
-
{
|
|
169
|
-
above: [
|
|
170
|
-
null,
|
|
171
|
-
{
|
|
172
|
-
type: "card",
|
|
173
|
-
contents: {
|
|
174
|
-
type: "view_link",
|
|
175
|
-
view: "Own:authorshow",
|
|
176
|
-
minRole: 100,
|
|
177
|
-
in_modal: true,
|
|
178
|
-
view_label: "foo it",
|
|
179
|
-
},
|
|
180
|
-
isFormula: {},
|
|
181
|
-
},
|
|
182
|
-
],
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
type: "container",
|
|
186
|
-
bgType: "Color",
|
|
187
|
-
hAlign: "left",
|
|
188
|
-
vAlign: "top",
|
|
189
|
-
bgColor: "#a9a7a7",
|
|
190
|
-
bgFileId: 1,
|
|
191
|
-
contents: {
|
|
192
|
-
url: "'https://countto.com/'+pages",
|
|
193
|
-
text: "author",
|
|
194
|
-
type: "link",
|
|
195
|
-
isFormula: { url: true, text: true },
|
|
196
|
-
},
|
|
197
|
-
imageSize: "contain",
|
|
198
|
-
minHeight: "100",
|
|
199
|
-
textColor: "#ffffff",
|
|
200
|
-
borderStyle: "solid",
|
|
201
|
-
borderWidth: "1",
|
|
202
|
-
},
|
|
203
|
-
],
|
|
204
|
-
},
|
|
205
|
-
columns: [
|
|
206
|
-
{
|
|
207
|
-
type: "ViewLink",
|
|
208
|
-
view: "Own:authorshow",
|
|
209
|
-
minRole: 100,
|
|
210
|
-
in_modal: true,
|
|
211
|
-
},
|
|
212
|
-
],
|
|
213
|
-
response: !remoteQueries
|
|
214
|
-
? `<div class="row"><div class="col-6"><div class="card mt-4 shadow"><div class="card-body"><a href="javascript:void(0)" onclick="ajax_modal('/view/authorshow?id=1', {'reload_view': 'testshow'})">foo it</a></div></div></div><div class="col-6"><div class="text-start" style="min-height: 100px;border: 1px solid black; background-color: #a9a7a7; "><a href="https://countto.com/967">Herman Melville</a></div></div></div>`
|
|
215
|
-
: `<div class="row"><div class="col-6"><div class="card mt-4 shadow"><div class="card-body"><a href="javascript:void(0)" onclick="mobile_modal('/view/authorshow?id=1', {'reload_view': 'testshow'})">foo it</a></div></div></div><div class="col-6"><div class="text-start" style="min-height: 100px;border: 1px solid black; background-color: #a9a7a7; "><a onclick="execLink('https://countto.com/967', 'URL')">Herman Melville</a></div></div></div>`,
|
|
216
|
-
});
|
|
217
|
-
await test_show({
|
|
218
|
-
layout: {
|
|
219
|
-
type: "card",
|
|
220
|
-
contents: {
|
|
221
|
-
above: [
|
|
222
|
-
{ type: "blank", contents: "author", isFormula: { text: true } },
|
|
223
|
-
{ type: "line_break" },
|
|
224
|
-
{
|
|
225
|
-
name: "5da0c7",
|
|
226
|
-
type: "view",
|
|
227
|
-
view: "authorshow",
|
|
228
|
-
state: "shared",
|
|
229
|
-
contents: "Herman Melville",
|
|
230
|
-
},
|
|
231
|
-
],
|
|
232
|
-
},
|
|
233
|
-
isFormula: {},
|
|
234
|
-
},
|
|
235
|
-
columns: [],
|
|
236
|
-
response: `<div class="card mt-4 shadow"><div class="card-body">Herman Melville<br />Herman Melville</div></div>`,
|
|
237
|
-
});
|
|
238
|
-
const showbooks1 = {
|
|
239
|
-
layout: {
|
|
240
|
-
above: [
|
|
241
|
-
{
|
|
242
|
-
widths: [2, 10],
|
|
243
|
-
besides: [
|
|
244
|
-
{
|
|
245
|
-
above: [
|
|
246
|
-
null,
|
|
247
|
-
{
|
|
248
|
-
font: "",
|
|
249
|
-
type: "blank",
|
|
250
|
-
block: false,
|
|
251
|
-
contents: "Author",
|
|
252
|
-
labelFor: "",
|
|
253
|
-
isFormula: {},
|
|
254
|
-
textStyle: "",
|
|
255
|
-
},
|
|
256
|
-
],
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
above: [
|
|
260
|
-
null,
|
|
261
|
-
{
|
|
262
|
-
type: "field",
|
|
263
|
-
block: false,
|
|
264
|
-
fieldview: "as_text",
|
|
265
|
-
textStyle: "",
|
|
266
|
-
field_name: "author",
|
|
267
|
-
configuration: {},
|
|
268
|
-
},
|
|
269
|
-
],
|
|
270
|
-
},
|
|
271
|
-
],
|
|
272
|
-
breakpoints: ["", ""],
|
|
273
|
-
},
|
|
274
|
-
{ type: "line_break" },
|
|
275
|
-
{
|
|
276
|
-
widths: [2, 10],
|
|
277
|
-
besides: [
|
|
278
|
-
{
|
|
279
|
-
above: [
|
|
280
|
-
null,
|
|
281
|
-
{
|
|
282
|
-
font: "",
|
|
283
|
-
type: "blank",
|
|
284
|
-
block: false,
|
|
285
|
-
contents: "Pages",
|
|
286
|
-
labelFor: "",
|
|
287
|
-
isFormula: {},
|
|
288
|
-
textStyle: "",
|
|
289
|
-
},
|
|
290
|
-
],
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
above: [
|
|
294
|
-
null,
|
|
295
|
-
{
|
|
296
|
-
type: "field",
|
|
297
|
-
block: false,
|
|
298
|
-
fieldview: "show",
|
|
299
|
-
textStyle: "",
|
|
300
|
-
field_name: "pages",
|
|
301
|
-
configuration: {},
|
|
302
|
-
},
|
|
303
|
-
],
|
|
304
|
-
},
|
|
305
|
-
],
|
|
306
|
-
breakpoints: ["", ""],
|
|
307
|
-
},
|
|
308
|
-
{ type: "line_break" },
|
|
309
|
-
{
|
|
310
|
-
type: "container",
|
|
311
|
-
style: {},
|
|
312
|
-
bgType: "None",
|
|
313
|
-
hAlign: "left",
|
|
314
|
-
margin: [0, 0, 0, 0],
|
|
315
|
-
rotate: 0,
|
|
316
|
-
vAlign: "top",
|
|
317
|
-
bgColor: "#ffffff",
|
|
318
|
-
display: "block",
|
|
319
|
-
padding: [0, 0, 0, 0],
|
|
320
|
-
bgFileId: 0,
|
|
321
|
-
contents: {
|
|
322
|
-
type: "action",
|
|
323
|
-
block: false,
|
|
324
|
-
rndid: "746098",
|
|
325
|
-
confirm: false,
|
|
326
|
-
minRole: 100,
|
|
327
|
-
isFormula: {},
|
|
328
|
-
action_icon: "",
|
|
329
|
-
action_name: "Delete",
|
|
330
|
-
action_label: "",
|
|
331
|
-
configuration: {},
|
|
332
|
-
},
|
|
333
|
-
imageSize: "contain",
|
|
334
|
-
isFormula: {},
|
|
335
|
-
minHeight: 0,
|
|
336
|
-
textColor: "#ffffff",
|
|
337
|
-
widthUnit: "px",
|
|
338
|
-
heightUnit: "px",
|
|
339
|
-
htmlElement: "div",
|
|
340
|
-
showForRole: [
|
|
341
|
-
null,
|
|
342
|
-
true,
|
|
343
|
-
null,
|
|
344
|
-
null,
|
|
345
|
-
true,
|
|
346
|
-
null,
|
|
347
|
-
null,
|
|
348
|
-
null,
|
|
349
|
-
false,
|
|
350
|
-
null,
|
|
351
|
-
false,
|
|
352
|
-
],
|
|
353
|
-
gradEndColor: "#88ff88",
|
|
354
|
-
setTextColor: false,
|
|
355
|
-
fullPageWidth: false,
|
|
356
|
-
gradDirection: "0",
|
|
357
|
-
minHeightUnit: "px",
|
|
358
|
-
showIfFormula: "",
|
|
359
|
-
gradStartColor: "#ff8888",
|
|
360
|
-
maxScreenWidth: "",
|
|
361
|
-
minScreenWidth: "",
|
|
362
|
-
show_for_owner: false,
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
type: "container",
|
|
366
|
-
style: {},
|
|
367
|
-
bgType: "None",
|
|
368
|
-
hAlign: "left",
|
|
369
|
-
margin: [0, 0, 0, 0],
|
|
370
|
-
rotate: 0,
|
|
371
|
-
vAlign: "top",
|
|
372
|
-
bgColor: "#ffffff",
|
|
373
|
-
display: "block",
|
|
374
|
-
padding: [0, 0, 0, 0],
|
|
375
|
-
bgFileId: 0,
|
|
376
|
-
contents: {
|
|
377
|
-
font: "",
|
|
378
|
-
icon: "",
|
|
379
|
-
type: "blank",
|
|
380
|
-
block: false,
|
|
381
|
-
contents: "VERY LONG",
|
|
382
|
-
labelFor: "",
|
|
383
|
-
isFormula: {},
|
|
384
|
-
textStyle: "",
|
|
385
|
-
},
|
|
386
|
-
imageSize: "contain",
|
|
387
|
-
isFormula: {},
|
|
388
|
-
minHeight: 0,
|
|
389
|
-
textColor: "#ffffff",
|
|
390
|
-
widthUnit: "px",
|
|
391
|
-
heightUnit: "px",
|
|
392
|
-
htmlElement: "div",
|
|
393
|
-
showForRole: [],
|
|
394
|
-
gradEndColor: "#88ff88",
|
|
395
|
-
setTextColor: false,
|
|
396
|
-
fullPageWidth: false,
|
|
397
|
-
gradDirection: "0",
|
|
398
|
-
minHeightUnit: "px",
|
|
399
|
-
showIfFormula: "pages>800",
|
|
400
|
-
gradStartColor: "#ff8888",
|
|
401
|
-
maxScreenWidth: "",
|
|
402
|
-
minScreenWidth: "",
|
|
403
|
-
show_for_owner: false,
|
|
404
|
-
},
|
|
405
|
-
],
|
|
406
|
-
},
|
|
407
|
-
columns: [
|
|
408
|
-
{
|
|
409
|
-
type: "Field",
|
|
410
|
-
block: false,
|
|
411
|
-
fieldview: "as_text",
|
|
412
|
-
textStyle: "",
|
|
413
|
-
field_name: "author",
|
|
414
|
-
configuration: {},
|
|
415
|
-
},
|
|
416
|
-
{
|
|
417
|
-
type: "Field",
|
|
418
|
-
block: false,
|
|
419
|
-
fieldview: "show",
|
|
420
|
-
textStyle: "",
|
|
421
|
-
field_name: "pages",
|
|
422
|
-
configuration: {},
|
|
423
|
-
},
|
|
424
|
-
{
|
|
425
|
-
type: "Action",
|
|
426
|
-
rndid: "746098",
|
|
427
|
-
confirm: false,
|
|
428
|
-
minRole: 100,
|
|
429
|
-
isFormula: {},
|
|
430
|
-
action_icon: "",
|
|
431
|
-
action_name: "Delete",
|
|
432
|
-
action_label: "",
|
|
433
|
-
configuration: {},
|
|
434
|
-
},
|
|
435
|
-
],
|
|
436
|
-
};
|
|
437
|
-
await test_show({
|
|
438
|
-
...showbooks1,
|
|
439
|
-
response: `<div class="row"><div class="col-2">Author</div><div class="col-10">Herman Melville</div></div><br /><div class="row"><div class="col-2">Pages</div><div class="col-10">967</div></div><br /><div class="text-start" style="min-height: 0px; "><form action="/delete/books/1?redirect=%2F" method="post" class="d-inline"><input type="hidden" name="_csrf" value=""><button type="submit" class=" btn btn-primary d-inline-block">Delete</button></form></div><div class="text-start" style="min-height: 0px; ">VERY LONG</div>`,
|
|
440
|
-
});
|
|
441
|
-
await test_show({
|
|
442
|
-
...showbooks1,
|
|
443
|
-
id: 2,
|
|
444
|
-
response: `<div class="row"><div class="col-2">Author</div><div class="col-10">Leo Tolstoy</div></div><br /><div class="row"><div class="col-2">Pages</div><div class="col-10">728</div></div><br /><div class="text-start" style="min-height: 0px; "><form action="/delete/books/2?redirect=%2F" method="post" class="d-inline"><input type="hidden" name="_csrf" value=""><button type="submit" class=" btn btn-primary d-inline-block">Delete</button></form></div>`,
|
|
445
|
-
});
|
|
446
|
-
});
|
|
447
|
-
(0, globals_1.it)("should render double join embedded exactly", async () => {
|
|
448
|
-
await test_list({
|
|
449
|
-
name: "ListReadings",
|
|
450
|
-
noDelete: true,
|
|
451
|
-
table: "readings",
|
|
452
|
-
columns: [
|
|
453
|
-
{
|
|
454
|
-
type: "Field",
|
|
455
|
-
fieldview: "showDay",
|
|
456
|
-
field_name: "date",
|
|
457
|
-
state_field: "on",
|
|
458
|
-
},
|
|
459
|
-
{
|
|
460
|
-
type: "Field",
|
|
461
|
-
fieldview: "show",
|
|
462
|
-
field_name: "normalised",
|
|
463
|
-
state_field: "on",
|
|
464
|
-
},
|
|
465
|
-
{
|
|
466
|
-
//, this)" class="link-style"
|
|
467
|
-
type: "JoinField",
|
|
468
|
-
join_field: "patient_id.name",
|
|
469
|
-
},
|
|
470
|
-
{
|
|
471
|
-
type: "Field",
|
|
472
|
-
fieldview: "show",
|
|
473
|
-
field_name: "temperature",
|
|
474
|
-
state_field: "on",
|
|
475
|
-
},
|
|
476
|
-
],
|
|
477
|
-
response: `<div class="table-responsive"><table class="table table-sm table-valign-middle "><thead><tr><th><span onclick="sortby('date', false, 'c3cde', this)" class="link-style">Date</span></th><th><span onclick="sortby('normalised', false, 'c3cde', this)" class="link-style">Normalised</span></th><th><span onclick="sortby(\'patient_id_name\', false, \'c3cde\', this)" class="link-style">name</span></th><th class="text-align-right"><span onclick="sortby('temperature', false, 'c3cde', this)" class="link-style">Temperature</span></th></tr></thead><tbody><tr data-row-id="1"><td><time datetime="2019-11-11T10:34:00.000Z" locale-date-options="%7B%7D">11/11/2019</time></td><td><i class="fas fa-lg fa-check-circle text-success"></i></td><td>Kirk Douglas</td><td class="text-align-right">37</td></tr><tr data-row-id="2"><td></td><td><i class="fas fa-lg fa-times-circle text-danger"></i></td><td>Kirk Douglas</td><td class="text-align-right">39</td></tr><tr data-row-id="3"><td></td><td><i class="fas fa-lg fa-times-circle text-danger"></i></td><td>Michael Douglas</td><td class="text-align-right">37</td></tr></tbody></table></div>`,
|
|
478
|
-
});
|
|
479
|
-
await test_show({
|
|
480
|
-
id: 1,
|
|
481
|
-
layout: {
|
|
482
|
-
above: [
|
|
483
|
-
{
|
|
484
|
-
style: {},
|
|
485
|
-
widths: [2, 10],
|
|
486
|
-
besides: [
|
|
487
|
-
{
|
|
488
|
-
above: [
|
|
489
|
-
null,
|
|
490
|
-
{
|
|
491
|
-
font: "",
|
|
492
|
-
type: "blank",
|
|
493
|
-
block: false,
|
|
494
|
-
style: {},
|
|
495
|
-
inline: false,
|
|
496
|
-
contents: "Author",
|
|
497
|
-
labelFor: "",
|
|
498
|
-
isFormula: {},
|
|
499
|
-
textStyle: "",
|
|
500
|
-
},
|
|
501
|
-
],
|
|
502
|
-
},
|
|
503
|
-
{
|
|
504
|
-
above: [
|
|
505
|
-
null,
|
|
506
|
-
{
|
|
507
|
-
type: "field",
|
|
508
|
-
block: false,
|
|
509
|
-
fieldview: "as_text",
|
|
510
|
-
textStyle: "",
|
|
511
|
-
field_name: "author",
|
|
512
|
-
configuration: {},
|
|
513
|
-
},
|
|
514
|
-
],
|
|
515
|
-
},
|
|
516
|
-
],
|
|
517
|
-
breakpoints: ["", ""],
|
|
518
|
-
},
|
|
519
|
-
{
|
|
520
|
-
type: "line_break",
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
style: {},
|
|
524
|
-
widths: [2, 10],
|
|
525
|
-
besides: [
|
|
526
|
-
{
|
|
527
|
-
above: [
|
|
528
|
-
null,
|
|
529
|
-
{
|
|
530
|
-
font: "",
|
|
531
|
-
type: "blank",
|
|
532
|
-
block: false,
|
|
533
|
-
style: {},
|
|
534
|
-
inline: false,
|
|
535
|
-
contents: "Pages",
|
|
536
|
-
labelFor: "",
|
|
537
|
-
isFormula: {},
|
|
538
|
-
textStyle: "",
|
|
539
|
-
},
|
|
540
|
-
],
|
|
541
|
-
},
|
|
542
|
-
{
|
|
543
|
-
above: [
|
|
544
|
-
null,
|
|
545
|
-
{
|
|
546
|
-
type: "field",
|
|
547
|
-
block: false,
|
|
548
|
-
fieldview: "show",
|
|
549
|
-
textStyle: "",
|
|
550
|
-
field_name: "pages",
|
|
551
|
-
configuration: {},
|
|
552
|
-
},
|
|
553
|
-
],
|
|
554
|
-
},
|
|
555
|
-
],
|
|
556
|
-
breakpoints: ["", ""],
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
type: "line_break",
|
|
560
|
-
},
|
|
561
|
-
{
|
|
562
|
-
style: {},
|
|
563
|
-
widths: [2, 10],
|
|
564
|
-
besides: [
|
|
565
|
-
{
|
|
566
|
-
above: [
|
|
567
|
-
null,
|
|
568
|
-
{
|
|
569
|
-
font: "",
|
|
570
|
-
type: "blank",
|
|
571
|
-
block: false,
|
|
572
|
-
style: {},
|
|
573
|
-
inline: false,
|
|
574
|
-
contents: "Publisher",
|
|
575
|
-
labelFor: "",
|
|
576
|
-
isFormula: {},
|
|
577
|
-
textStyle: "",
|
|
578
|
-
},
|
|
579
|
-
],
|
|
580
|
-
},
|
|
581
|
-
{
|
|
582
|
-
above: [
|
|
583
|
-
null,
|
|
584
|
-
{
|
|
585
|
-
type: "join_field",
|
|
586
|
-
block: false,
|
|
587
|
-
textStyle: "",
|
|
588
|
-
join_field: "publisher.name",
|
|
589
|
-
fieldview: "as_header",
|
|
590
|
-
configuration: {},
|
|
591
|
-
},
|
|
592
|
-
],
|
|
593
|
-
},
|
|
594
|
-
],
|
|
595
|
-
breakpoints: ["", ""],
|
|
596
|
-
},
|
|
597
|
-
{
|
|
598
|
-
type: "line_break",
|
|
599
|
-
},
|
|
600
|
-
{
|
|
601
|
-
name: "46d4bc",
|
|
602
|
-
type: "view",
|
|
603
|
-
view: "ChildList:ListReadings.patients.favbook.readings.patient_id",
|
|
604
|
-
state: "shared",
|
|
605
|
-
configuration: {},
|
|
606
|
-
},
|
|
607
|
-
],
|
|
608
|
-
},
|
|
609
|
-
columns: [
|
|
610
|
-
{
|
|
611
|
-
type: "Field",
|
|
612
|
-
block: false,
|
|
613
|
-
fieldview: "as_text",
|
|
614
|
-
textStyle: "",
|
|
615
|
-
field_name: "author",
|
|
616
|
-
configuration: {},
|
|
617
|
-
},
|
|
618
|
-
{
|
|
619
|
-
type: "Field",
|
|
620
|
-
block: false,
|
|
621
|
-
fieldview: "show",
|
|
622
|
-
textStyle: "",
|
|
623
|
-
field_name: "pages",
|
|
624
|
-
configuration: {},
|
|
625
|
-
},
|
|
626
|
-
{
|
|
627
|
-
type: "JoinField",
|
|
628
|
-
block: false,
|
|
629
|
-
textStyle: "",
|
|
630
|
-
fieldview: "as_header",
|
|
631
|
-
join_field: "publisher.name",
|
|
632
|
-
configuration: {},
|
|
633
|
-
},
|
|
634
|
-
],
|
|
635
|
-
response: `<div class="row"><div class="col-2">Author</div><div class="col-10">Herman Melville</div></div><br /><div class="row"><div class="col-2">Pages</div><div class="col-10">967</div></div><br /><div class="row"><div class="col-2">Publisher</div><div class="col-10"><h3></h3></div></div><br /><div class="d-inline" data-sc-embed-viewname="ListReadings" data-sc-view-source="/view/ListReadings?readings.patient_id.patients.favbook=1"><div class="table-responsive"><table class="table table-sm table-valign-middle "><thead><tr><th><span onclick="sortby('date', false, '8e146', this)" class="link-style">Date</span></th><th><span onclick="sortby('normalised', false, '8e146', this)" class="link-style">Normalised</span></th><th><span onclick="sortby(\'patient_id_name\', false, \'8e146\', this)" class="link-style">name</span></th><th class="text-align-right"><span onclick="sortby('temperature', false, '8e146', this)" class="link-style">Temperature</span></th></tr></thead><tbody><tr data-row-id="1"><td><time datetime="2019-11-11T10:34:00.000Z" locale-date-options="%7B%7D">11/11/2019</time></td><td><i class="fas fa-lg fa-check-circle text-success"></i></td><td>Kirk Douglas</td><td class="text-align-right">37</td></tr><tr data-row-id="2"><td></td><td><i class="fas fa-lg fa-times-circle text-danger"></i></td><td>Kirk Douglas</td><td class="text-align-right">39</td></tr></tbody></table></div></div>`,
|
|
636
|
-
});
|
|
637
|
-
});
|
|
638
|
-
});
|
|
639
|
-
(0, globals_1.describe)("Edit view", () => {
|
|
640
|
-
(0, globals_1.it)("should render exactly", async () => {
|
|
641
|
-
const layout = {
|
|
642
|
-
above: [
|
|
643
|
-
{
|
|
644
|
-
widths: [2, 10],
|
|
645
|
-
besides: [
|
|
646
|
-
{
|
|
647
|
-
above: [null, { type: "blank", contents: "Name", isFormula: {} }],
|
|
648
|
-
},
|
|
649
|
-
{
|
|
650
|
-
above: [
|
|
651
|
-
null,
|
|
652
|
-
{ type: "field", fieldview: "edit", field_name: "name" },
|
|
653
|
-
],
|
|
654
|
-
},
|
|
655
|
-
],
|
|
656
|
-
},
|
|
657
|
-
{ type: "line_break" },
|
|
658
|
-
{
|
|
659
|
-
widths: [2, 10],
|
|
660
|
-
besides: [
|
|
661
|
-
{
|
|
662
|
-
above: [
|
|
663
|
-
null,
|
|
664
|
-
{ type: "blank", contents: "Favourite book", isFormula: {} },
|
|
665
|
-
],
|
|
666
|
-
},
|
|
667
|
-
{
|
|
668
|
-
above: [
|
|
669
|
-
null,
|
|
670
|
-
{ type: "field", fieldview: "select", field_name: "favbook" },
|
|
671
|
-
],
|
|
672
|
-
},
|
|
673
|
-
],
|
|
674
|
-
},
|
|
675
|
-
{ type: "line_break" },
|
|
676
|
-
{
|
|
677
|
-
widths: [2, 10],
|
|
678
|
-
besides: [
|
|
679
|
-
{
|
|
680
|
-
above: [
|
|
681
|
-
null,
|
|
682
|
-
{ type: "blank", contents: "Parent", isFormula: {} },
|
|
683
|
-
],
|
|
684
|
-
},
|
|
685
|
-
{
|
|
686
|
-
above: [
|
|
687
|
-
null,
|
|
688
|
-
{ type: "field", fieldview: "select", field_name: "parent" },
|
|
689
|
-
],
|
|
690
|
-
},
|
|
691
|
-
],
|
|
692
|
-
},
|
|
693
|
-
{ type: "line_break" },
|
|
694
|
-
{
|
|
695
|
-
type: "action",
|
|
696
|
-
rndid: "74310f",
|
|
697
|
-
minRole: 100,
|
|
698
|
-
isFormula: {},
|
|
699
|
-
action_name: "Save",
|
|
700
|
-
action_style: "btn-primary",
|
|
701
|
-
configuration: {},
|
|
702
|
-
},
|
|
703
|
-
],
|
|
704
|
-
};
|
|
705
|
-
const columns = [
|
|
706
|
-
{ type: "Field", fieldview: "edit", field_name: "name" },
|
|
707
|
-
{ type: "Field", fieldview: "select", field_name: "favbook" },
|
|
708
|
-
{ type: "Field", fieldview: "select", field_name: "parent" },
|
|
709
|
-
{
|
|
710
|
-
type: "Action",
|
|
711
|
-
rndid: "74310f",
|
|
712
|
-
minRole: 100,
|
|
713
|
-
isFormula: {},
|
|
714
|
-
action_name: "Save",
|
|
715
|
-
action_style: "btn-primary",
|
|
716
|
-
configuration: {},
|
|
717
|
-
},
|
|
718
|
-
];
|
|
719
|
-
await test_edit({
|
|
720
|
-
layout,
|
|
721
|
-
columns,
|
|
722
|
-
response: !remoteQueries
|
|
723
|
-
? `<form data-viewname="testedit" action="/view/testedit" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Atrue%2C%22user%22%3A%7B%22id%22%3A1%2C%22role_id%22%3A1%2C%22attributes%22%3A%7B%7D%7D%7D" id="test-form-id"><input type="hidden" name="_csrf" value=""><div class="row"><div class="col-2">Name</div><div class="col-10"><input type="text" class="form-control " data-fieldname="name" name="name" required id="inputname"></div></div><br /><div class="row"><div class="col-2">Favourite book</div><div class="col-10"><select class="form-control form-select " data-fieldname="favbook" name="favbook" id="inputfavbook" autocomplete="off"><option value=""></option><option value="1">Herman Melville</option><option value="2">Leo Tolstoy</option></select></div></div><br /><div class="row"><div class="col-2">Parent</div><div class="col-10"><select class="form-control form-select " data-fieldname="parent" name="parent" id="inputparent" autocomplete="off"><option value=""></option><option value="1">Kirk Douglas</option><option value="2">Michael Douglas</option></select></div></div><br /><button type="submit" class="btn btn-primary ">Save</button></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script>`
|
|
724
|
-
: `<form data-viewname="testedit" action="javascript:void(0)" onsubmit="javascript:formSubmit(this, '/view/', 'testedit')" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Atrue%2C%22user%22%3A%7B%22email%22%3A%22admin%40foo.com%22%2C%22id%22%3A1%2C%22role_id%22%3A1%2C%22language%22%3Anull%2C%22tenant%22%3A%22public%22%2C%22attributes%22%3A%7B%7D%7D%7D" id="test-form-id"><input type="hidden" name="_csrf" value="false"><div class="row"><div class="col-2">Name</div><div class="col-10"><input type="text" class="form-control " data-fieldname="name" name="name" required id="inputname"></div></div><br /><div class="row"><div class="col-2">Favourite book</div><div class="col-10"><select class="form-control form-select " data-fieldname="favbook" name="favbook" id="inputfavbook" autocomplete="off"><option value=""></option><option value="1">Herman Melville</option><option value="2">Leo Tolstoy</option></select></div></div><br /><div class="row"><div class="col-2">Parent</div><div class="col-10"><select class="form-control form-select " data-fieldname="parent" name="parent" id="inputparent" autocomplete="off"><option value=""></option><option value="1">Kirk Douglas</option><option value="2">Michael Douglas</option></select></div></div><br /><button type="submit" class="btn btn-primary ">Save</button></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script>`,
|
|
725
|
-
});
|
|
726
|
-
await test_edit({
|
|
727
|
-
id: 1,
|
|
728
|
-
layout,
|
|
729
|
-
columns,
|
|
730
|
-
response: !remoteQueries
|
|
731
|
-
? `<form data-viewname="testedit" action="/view/testedit" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Afalse%2C%22user%22%3A%7B%22id%22%3A1%2C%22role_id%22%3A1%2C%22attributes%22%3A%7B%7D%7D%7D" id="test-form-id"><input type="hidden" name="_csrf" value=""><input type="hidden" class="form-control " name="id" value="1"><div class="row"><div class="col-2">Name</div><div class="col-10"><input type="text" class="form-control " data-fieldname="name" name="name" required id="inputname" value="Kirk Douglas"></div></div><br /><div class="row"><div class="col-2">Favourite book</div><div class="col-10"><select class="form-control form-select " data-fieldname="favbook" name="favbook" id="inputfavbook" autocomplete="off"><option value=""></option><option value="1" selected>Herman Melville</option><option value="2">Leo Tolstoy</option></select></div></div><br /><div class="row"><div class="col-2">Parent</div><div class="col-10"><select class="form-control form-select " data-fieldname="parent" name="parent" id="inputparent" autocomplete="off"><option value=""></option><option value="1">Kirk Douglas</option><option value="2">Michael Douglas</option></select></div></div><br /><button type="submit" class="btn btn-primary ">Save</button></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script>`
|
|
732
|
-
: `<form data-viewname="testedit" action="javascript:void(0)" onsubmit="javascript:formSubmit(this, '/view/', 'testedit')" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Afalse%2C%22user%22%3A%7B%22email%22%3A%22admin%40foo.com%22%2C%22id%22%3A1%2C%22role_id%22%3A1%2C%22language%22%3Anull%2C%22tenant%22%3A%22public%22%2C%22attributes%22%3A%7B%7D%7D%7D" id="test-form-id"><input type="hidden" name="_csrf" value="false"><input type="hidden" class="form-control " name="id" value="1"><div class="row"><div class="col-2">Name</div><div class="col-10"><input type="text" class="form-control " data-fieldname="name" name="name" required id="inputname" value="Kirk Douglas"></div></div><br /><div class="row"><div class="col-2">Favourite book</div><div class="col-10"><select class="form-control form-select " data-fieldname="favbook" name="favbook" id="inputfavbook" autocomplete="off"><option value=""></option><option value="1" selected>Herman Melville</option><option value="2">Leo Tolstoy</option></select></div></div><br /><div class="row"><div class="col-2">Parent</div><div class="col-10"><select class="form-control form-select " data-fieldname="parent" name="parent" id="inputparent" autocomplete="off"><option value=""></option><option value="1">Kirk Douglas</option><option value="2">Michael Douglas</option></select></div></div><br /><button type="submit" class="btn btn-primary ">Save</button></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script>`,
|
|
733
|
-
});
|
|
734
|
-
});
|
|
735
|
-
(0, globals_1.it)("should render edit-in-edit", async () => {
|
|
736
|
-
await test_edit({
|
|
737
|
-
name: "innerReads",
|
|
738
|
-
...remote_query_helper_1.renderEditInEditConfig.innerEdit,
|
|
739
|
-
noDelete: true,
|
|
740
|
-
table: "readings",
|
|
741
|
-
response: !remoteQueries
|
|
742
|
-
? `<form data-viewname="innerReads" action="/view/innerReads" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Atrue%2C%22user%22%3A%7B%22id%22%3A1%2C%22role_id%22%3A1%2C%22attributes%22%3A%7B%7D%7D%7D" id="test-form-id"><input type="hidden" name="_csrf" value=""><div class="row"><div class="col-2"><label for="inputdate">Date</label></div><div class="col-10"><input type="text" class="form-control " data-fieldname="date" name="date" id="inputdate"></div></div><br /><div class="row"><div class="col-2"><label for="inputnormalised">Normalised</label></div><div class="col-10"><input class="me-2 mt-1 " data-fieldname="normalised" type="checkbox" name="normalised" id="inputnormalised"></div></div><br /><div class="row"><div class="col-2"><label for="inputtemperature">Temperature</label></div><div class="col-10"><input type="number" class="form-control " data-fieldname="temperature" name="temperature" id="inputtemperature" step="1" required></div></div></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script>`
|
|
743
|
-
: `<form data-viewname="innerReads" action="javascript:void(0)" onsubmit="javascript:formSubmit(this, '/view/', 'innerReads')" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Atrue%2C%22user%22%3A%7B%22email%22%3A%22admin%40foo.com%22%2C%22id%22%3A1%2C%22role_id%22%3A1%2C%22language%22%3Anull%2C%22tenant%22%3A%22public%22%2C%22attributes%22%3A%7B%7D%7D%7D" id="test-form-id"><input type="hidden" name="_csrf" value="false"><div class="row"><div class="col-2"><label for="inputdate">Date</label></div><div class="col-10"><input type="text" class="form-control " data-fieldname="date" name="date" id="inputdate"></div></div><br /><div class="row"><div class="col-2"><label for="inputnormalised">Normalised</label></div><div class="col-10"><input class="me-2 mt-1 " data-fieldname="normalised" type="checkbox" name="normalised" id="inputnormalised"></div></div><br /><div class="row"><div class="col-2"><label for="inputtemperature">Temperature</label></div><div class="col-10"><input type="number" class="form-control " data-fieldname="temperature" name="temperature" id="inputtemperature" step="1" required></div></div></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script>`,
|
|
744
|
-
});
|
|
745
|
-
await test_edit({
|
|
746
|
-
name: "PatientEditWithReads",
|
|
747
|
-
...remote_query_helper_1.renderEditInEditConfig.outerEdit,
|
|
748
|
-
table: "patients",
|
|
749
|
-
response: !remoteQueries
|
|
750
|
-
? `<form data-viewname="PatientEditWithReads" action="/view/PatientEditWithReads" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Atrue%2C%22user%22%3A%7B%22id%22%3A1%2C%22role_id%22%3A1%2C%22attributes%22%3A%7B%7D%7D%7D" id="test-form-id"><input type="hidden" name="_csrf" value=""><div class="row"><div class="col-2"><label for="inputfavbook">Favourite book</label></div><div class="col-10"><select class="form-control form-select " data-fieldname="favbook" name="favbook" id="inputfavbook" autocomplete="off"><option value=""></option><option value="1">Herman Melville</option><option value="2">Leo Tolstoy</option></select></div></div><br /><span style="margin-bottom:1.5rem"><div class="row" style="margin-bottom:1.5rem"><div class="col-2"><label for="inputname">Name</label></div><div class="col-10"><input type="text" class="form-control " data-fieldname="name" name="name" required id="inputname"></div></div></span><div class="row"><div class="col-2"><label for="inputparent">Parent</label></div><div class="col-10"><select class="form-control form-select " data-fieldname="parent" name="parent" id="inputparent" autocomplete="off"><option value=""></option><option value="1">Kirk Douglas</option><option value="2">Michael Douglas</option></select></div></div><br /><div><div class="repeats-patient_id"><div class="form-repeat form-namespace repeat-patient_id"><div class="float-end"><span onclick="rep_up(this)"><i class="fa fa-arrow-up pull-right"></i></span> <span onclick="rep_del(this)"><i class="fa fa-times pull-right"></i></span> <span onclick="rep_down(this)"><i class="fa fa-arrow-down pull-right"></i></span></div><div class="row"><div class="col-2"><label for="inputdate">Date</label></div><div class="col-10"><input type="text" class="form-control " data-fieldname="date" name="date_0" id="inputdate_0"></div></div><br /><div class="row"><div class="col-2"><label for="inputnormalised">Normalised</label></div><div class="col-10"><input class="me-2 mt-1 " data-fieldname="normalised" type="checkbox" name="normalised_0" id="inputnormalised_0"></div></div><br /><div class="row"><div class="col-2"><label for="inputtemperature">Temperature</label></div><div class="col-10"><input type="number" class="form-control " data-fieldname="temperature" name="temperature_0" id="inputtemperature_0" step="1" required></div></div></div></div><a class="btn btn-sm btn-outline-primary mb-3" href="javascript:void(0)" onclick="add_repeater('patient_id', this)" title="Add"><i class="fas fa-plus"></i></a></div><button type="submit" class="btn btn-primary ">Save</button><button onClick="reset_nearest_form(this)" type="button" class="btn btn-primary ">Reset</button></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script>`
|
|
751
|
-
: `<form data-viewname="PatientEditWithReads" action="javascript:void(0)" onsubmit="javascript:formSubmit(this, '/view/', 'PatientEditWithReads')" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Atrue%2C%22user%22%3A%7B%22email%22%3A%22admin%40foo.com%22%2C%22id%22%3A1%2C%22role_id%22%3A1%2C%22language%22%3Anull%2C%22tenant%22%3A%22public%22%2C%22attributes%22%3A%7B%7D%7D%7D" id="test-form-id"><input type="hidden" name="_csrf" value="false"><div class="row"><div class="col-2"><label for="inputfavbook">Favourite book</label></div><div class="col-10"><select class="form-control form-select " data-fieldname="favbook" name="favbook" id="inputfavbook" autocomplete="off"><option value=""></option><option value="1">Herman Melville</option><option value="2">Leo Tolstoy</option></select></div></div><br /><span style="margin-bottom:1.5rem"><div class="row" style="margin-bottom:1.5rem"><div class="col-2"><label for="inputname">Name</label></div><div class="col-10"><input type="text" class="form-control " data-fieldname="name" name="name" required id="inputname"></div></div></span><div class="row"><div class="col-2"><label for="inputparent">Parent</label></div><div class="col-10"><select class="form-control form-select " data-fieldname="parent" name="parent" id="inputparent" autocomplete="off"><option value=""></option><option value="1">Kirk Douglas</option><option value="2">Michael Douglas</option></select></div></div><br /><div><div class="repeats-patient_id"><div class="form-repeat form-namespace repeat-patient_id"><div class="float-end"><span onclick="rep_up(this)"><i class="fa fa-arrow-up pull-right"></i></span> <span onclick="rep_del(this)"><i class="fa fa-times pull-right"></i></span> <span onclick="rep_down(this)"><i class="fa fa-arrow-down pull-right"></i></span></div><div class="row"><div class="col-2"><label for="inputdate">Date</label></div><div class="col-10"><input type="text" class="form-control " data-fieldname="date" name="date_0" id="inputdate_0"></div></div><br /><div class="row"><div class="col-2"><label for="inputnormalised">Normalised</label></div><div class="col-10"><input class="me-2 mt-1 " data-fieldname="normalised" type="checkbox" name="normalised_0" id="inputnormalised_0"></div></div><br /><div class="row"><div class="col-2"><label for="inputtemperature">Temperature</label></div><div class="col-10"><input type="number" class="form-control " data-fieldname="temperature" name="temperature_0" id="inputtemperature_0" step="1" required></div></div></div></div><a class="btn btn-sm btn-outline-primary mb-3" href="javascript:void(0)" onclick="add_repeater('patient_id', this)" title="Add"><i class="fas fa-plus"></i></a></div><button type="submit" class="btn btn-primary ">Save</button><button onClick="reset_nearest_form(this)" type="button" class="btn btn-primary ">Reset</button></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script>`,
|
|
752
|
-
});
|
|
753
|
-
await test_edit({
|
|
754
|
-
name: "PatientEditWithReads",
|
|
755
|
-
id: 1,
|
|
756
|
-
...remote_query_helper_1.renderEditInEditConfig.outerEdit,
|
|
757
|
-
table: "patients",
|
|
758
|
-
response: !remoteQueries
|
|
759
|
-
? `<form data-viewname="PatientEditWithReads" action="/view/PatientEditWithReads" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Afalse%2C%22user%22%3A%7B%22id%22%3A1%2C%22role_id%22%3A1%2C%22attributes%22%3A%7B%7D%7D%7D" id="test-form-id"><input type="hidden" name="_csrf" value=""><input type="hidden" class="form-control " name="id" value="1"><div class="row"><div class="col-2"><label for="inputfavbook">Favourite book</label></div><div class="col-10"><select class="form-control form-select " data-fieldname="favbook" name="favbook" id="inputfavbook" autocomplete="off"><option value=""></option><option value="1" selected>Herman Melville</option><option value="2">Leo Tolstoy</option></select></div></div><br /><span style="margin-bottom:1.5rem"><div class="row" style="margin-bottom:1.5rem"><div class="col-2"><label for="inputname">Name</label></div><div class="col-10"><input type="text" class="form-control " data-fieldname="name" name="name" required id="inputname" value="Kirk Douglas"></div></div></span><div class="row"><div class="col-2"><label for="inputparent">Parent</label></div><div class="col-10"><select class="form-control form-select " data-fieldname="parent" name="parent" id="inputparent" autocomplete="off"><option value=""></option><option value="1">Kirk Douglas</option><option value="2">Michael Douglas</option></select></div></div><br /><div><div class="repeats-patient_id"><div class="form-repeat form-namespace repeat-patient_id"><div class="float-end"><span onclick="rep_up(this)"><i class="fa fa-arrow-up pull-right"></i></span> <span onclick="rep_del(this)"><i class="fa fa-times pull-right"></i></span> <span onclick="rep_down(this)"><i class="fa fa-arrow-down pull-right"></i></span></div><div class="row"><div class="col-2"><label for="inputdate">Date</label></div><div class="col-10"><input type="text" class="form-control " data-fieldname="date" name="date_0" id="inputdate_0" value="11/11/2019"></div></div><br /><div class="row"><div class="col-2"><label for="inputnormalised">Normalised</label></div><div class="col-10"><input class="me-2 mt-1 " data-fieldname="normalised" type="checkbox" name="normalised_0" id="inputnormalised_0" checked></div></div><br /><div class="row"><div class="col-2"><label for="inputtemperature">Temperature</label></div><div class="col-10"><input type="number" class="form-control " data-fieldname="temperature" name="temperature_0" id="inputtemperature_0" step="1" required value="37"></div></div><input type="hidden" class="form-control omit-repeater-clone" name="id_0" value="1"></div><div class="form-repeat form-namespace repeat-patient_id"><div class="float-end"><span onclick="rep_up(this)"><i class="fa fa-arrow-up pull-right"></i></span> <span onclick="rep_del(this)"><i class="fa fa-times pull-right"></i></span> <span onclick="rep_down(this)"><i class="fa fa-arrow-down pull-right"></i></span></div><div class="row"><div class="col-2"><label for="inputdate">Date</label></div><div class="col-10"><input type="text" class="form-control " data-fieldname="date" name="date_1" id="inputdate_1"></div></div><br /><div class="row"><div class="col-2"><label for="inputnormalised">Normalised</label></div><div class="col-10"><input class="me-2 mt-1 " data-fieldname="normalised" type="checkbox" name="normalised_1" id="inputnormalised_1"></div></div><br /><div class="row"><div class="col-2"><label for="inputtemperature">Temperature</label></div><div class="col-10"><input type="number" class="form-control " data-fieldname="temperature" name="temperature_1" id="inputtemperature_1" step="1" required value="39"></div></div><input type="hidden" class="form-control omit-repeater-clone" name="id_1" value="2"></div></div><a class="btn btn-sm btn-outline-primary mb-3" href="javascript:void(0)" onclick="add_repeater('patient_id', this)" title="Add"><i class="fas fa-plus"></i></a></div><button type="submit" class="btn btn-primary ">Save</button><button onClick="reset_nearest_form(this)" type="button" class="btn btn-primary ">Reset</button><button onClick="if(confirm('Are you sure?'))ajax_post('/delete/patients/1', {success:()=>{history.back();}})" type="button" class="btn btn-primary ">Delete</button></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script>`
|
|
760
|
-
: `<form data-viewname="PatientEditWithReads" action="javascript:void(0)" onsubmit="javascript:formSubmit(this, '/view/', 'PatientEditWithReads')" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Afalse%2C%22user%22%3A%7B%22email%22%3A%22admin%40foo.com%22%2C%22id%22%3A1%2C%22role_id%22%3A1%2C%22language%22%3Anull%2C%22tenant%22%3A%22public%22%2C%22attributes%22%3A%7B%7D%7D%7D" id="test-form-id"><input type="hidden" name="_csrf" value="false"><input type="hidden" class="form-control " name="id" value="1"><div class="row"><div class="col-2"><label for="inputfavbook">Favourite book</label></div><div class="col-10"><select class="form-control form-select " data-fieldname="favbook" name="favbook" id="inputfavbook" autocomplete="off"><option value=""></option><option value="1" selected>Herman Melville</option><option value="2">Leo Tolstoy</option></select></div></div><br /><span style="margin-bottom:1.5rem"><div class="row" style="margin-bottom:1.5rem"><div class="col-2"><label for="inputname">Name</label></div><div class="col-10"><input type="text" class="form-control " data-fieldname="name" name="name" required id="inputname" value="Kirk Douglas"></div></div></span><div class="row"><div class="col-2"><label for="inputparent">Parent</label></div><div class="col-10"><select class="form-control form-select " data-fieldname="parent" name="parent" id="inputparent" autocomplete="off"><option value=""></option><option value="1">Kirk Douglas</option><option value="2">Michael Douglas</option></select></div></div><br /><div><div class="repeats-patient_id"><div class="form-repeat form-namespace repeat-patient_id"><div class="float-end"><span onclick="rep_up(this)"><i class="fa fa-arrow-up pull-right"></i></span> <span onclick="rep_del(this)"><i class="fa fa-times pull-right"></i></span> <span onclick="rep_down(this)"><i class="fa fa-arrow-down pull-right"></i></span></div><div class="row"><div class="col-2"><label for="inputdate">Date</label></div><div class="col-10"><input type="text" class="form-control " data-fieldname="date" name="date_0" id="inputdate_0" value="11/11/2019"></div></div><br /><div class="row"><div class="col-2"><label for="inputnormalised">Normalised</label></div><div class="col-10"><input class="me-2 mt-1 " data-fieldname="normalised" type="checkbox" name="normalised_0" id="inputnormalised_0" checked></div></div><br /><div class="row"><div class="col-2"><label for="inputtemperature">Temperature</label></div><div class="col-10"><input type="number" class="form-control " data-fieldname="temperature" name="temperature_0" id="inputtemperature_0" step="1" required value="37"></div></div><input type="hidden" class="form-control omit-repeater-clone" name="id_0" value="1"></div><div class="form-repeat form-namespace repeat-patient_id"><div class="float-end"><span onclick="rep_up(this)"><i class="fa fa-arrow-up pull-right"></i></span> <span onclick="rep_del(this)"><i class="fa fa-times pull-right"></i></span> <span onclick="rep_down(this)"><i class="fa fa-arrow-down pull-right"></i></span></div><div class="row"><div class="col-2"><label for="inputdate">Date</label></div><div class="col-10"><input type="text" class="form-control " data-fieldname="date" name="date_1" id="inputdate_1"></div></div><br /><div class="row"><div class="col-2"><label for="inputnormalised">Normalised</label></div><div class="col-10"><input class="me-2 mt-1 " data-fieldname="normalised" type="checkbox" name="normalised_1" id="inputnormalised_1"></div></div><br /><div class="row"><div class="col-2"><label for="inputtemperature">Temperature</label></div><div class="col-10"><input type="number" class="form-control " data-fieldname="temperature" name="temperature_1" id="inputtemperature_1" step="1" required value="39"></div></div><input type="hidden" class="form-control omit-repeater-clone" name="id_1" value="2"></div></div><a class="btn btn-sm btn-outline-primary mb-3" href="javascript:void(0)" onclick="add_repeater('patient_id', this)" title="Add"><i class="fas fa-plus"></i></a></div><button type="submit" class="btn btn-primary ">Save</button><button onClick="reset_nearest_form(this)" type="button" class="btn btn-primary ">Reset</button><button onClick="if(confirm('Are you sure?'))local_post('/delete/patients/1', {after_delete_url:'/'})" type="button" class="btn btn-primary ">Delete</button></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script>`,
|
|
761
|
-
});
|
|
762
|
-
});
|
|
763
|
-
});
|
|
764
|
-
(0, globals_1.describe)("Exact list view", () => {
|
|
765
|
-
(0, globals_1.it)("should render list view exactly", async () => {
|
|
766
|
-
await test_list({
|
|
767
|
-
columns: [
|
|
768
|
-
{
|
|
769
|
-
type: "Field",
|
|
770
|
-
fieldview: "as_text",
|
|
771
|
-
field_name: "name",
|
|
772
|
-
state_field: "on",
|
|
773
|
-
header_label: "",
|
|
774
|
-
},
|
|
775
|
-
{ type: "JoinField", join_field: "parent.name", header_label: "" },
|
|
776
|
-
{ type: "JoinField", join_field: "favbook.author", header_label: "" },
|
|
777
|
-
{
|
|
778
|
-
code: 'console.log("hi")',
|
|
779
|
-
type: "Action",
|
|
780
|
-
action_name: "run_js_code",
|
|
781
|
-
action_size: "",
|
|
782
|
-
action_label: "say hi",
|
|
783
|
-
action_style: "btn-primary",
|
|
784
|
-
header_label: "Helloer",
|
|
785
|
-
},
|
|
786
|
-
{
|
|
787
|
-
type: "ViewLink",
|
|
788
|
-
view: "ParentShow:authorshow.books.favbook",
|
|
789
|
-
view_label: "id+5",
|
|
790
|
-
header_label: "",
|
|
791
|
-
view_label_formula: "on",
|
|
792
|
-
},
|
|
793
|
-
{
|
|
794
|
-
stat: "Count",
|
|
795
|
-
type: "Aggregation",
|
|
796
|
-
agg_field: "temperature",
|
|
797
|
-
agg_relation: "readings.patient_id",
|
|
798
|
-
header_label: "readings",
|
|
799
|
-
},
|
|
800
|
-
{
|
|
801
|
-
type: "Link",
|
|
802
|
-
link_url: "'https://lmgtfy.app/?q='+name",
|
|
803
|
-
link_text: "name.toUpperCase()",
|
|
804
|
-
header_label: "",
|
|
805
|
-
link_url_formula: "on",
|
|
806
|
-
link_text_formula: "on",
|
|
807
|
-
},
|
|
808
|
-
{
|
|
809
|
-
type: "Action",
|
|
810
|
-
confirm: "on",
|
|
811
|
-
action_name: "Delete",
|
|
812
|
-
action_size: "btn-sm",
|
|
813
|
-
action_label: "",
|
|
814
|
-
action_style: "btn-outline-primary",
|
|
815
|
-
header_label: "",
|
|
816
|
-
},
|
|
817
|
-
],
|
|
818
|
-
response: !remoteQueries
|
|
819
|
-
? '<div class="table-responsive"><table class="table table-sm table-valign-middle "><thead><tr><th><span onclick="sortby(\'name\', false, \'4b4ab\', this)" class="link-style">Name</span></th><th><span onclick="sortby(\'parent_name\', false, \'4b4ab\', this)" class="link-style">name</span></th><th><span onclick="sortby(\'favbook_author\', false, \'4b4ab\', this)" class="link-style">author</span></th><th>Helloer</th><th>authorshow</th><th><span onclick="sortby(\'count_readings_patient_id_temperature_undefined\', false, \'4b4ab\', this)" class="link-style">readings</span></th><th></th><th></th></tr></thead><tbody><tr data-row-id="1"><td>Kirk Douglas</td><td></td><td>Herman Melville</td><td><a href="javascript:void(0)" class="btn btn-primary " onclick="view_post(\'testlist\', \'run_action\', {action_name:\'run_js_code\', id:\'1\', column_index: 3});">say hi</a></td><td><a href="/view/authorshow?id=1">6</a></td><td>2</td><td><a href="https://lmgtfy.app/?q=Kirk Douglas">KIRK DOUGLAS</a></td><td><a href="javascript:void(0)" class="btn btn-outline-primary btn-sm" onclick="if(confirm(\'Are you sure?\'))ajax_post_btn(\'/delete/patients/1?redirect=/view/testlist\', true)">Delete</a></td></tr><tr data-row-id="2"><td>Michael Douglas</td><td>Kirk Douglas</td><td>Leo Tolstoy</td><td><a href="javascript:void(0)" class="btn btn-primary " onclick="view_post(\'testlist\', \'run_action\', {action_name:\'run_js_code\', id:\'2\', column_index: 3});">say hi</a></td><td><a href="/view/authorshow?id=2">7</a></td><td>1</td><td><a href="https://lmgtfy.app/?q=Michael Douglas">MICHAEL DOUGLAS</a></td><td><a href="javascript:void(0)" class="btn btn-outline-primary btn-sm" onclick="if(confirm(\'Are you sure?\'))ajax_post_btn(\'/delete/patients/2?redirect=/view/testlist\', true)">Delete</a></td></tr></tbody></table></div>'
|
|
820
|
-
: '<div class="table-responsive"><table class="table table-sm table-valign-middle "><thead><tr><th><span onclick="sortby(\'name\', false, \'4b4ab\', this)" class="link-style">Name</span></th><th><span onclick="sortby(\'parent_name\', false, \'4b4ab\', this)" class="link-style">name</span></th><th><span onclick="sortby(\'favbook_author\', false, \'4b4ab\', this)" class="link-style">author</span></th><th>Helloer</th><th>authorshow</th><th><span onclick="sortby(\'count_readings_patient_id_temperature_undefined\', false, \'4b4ab\', this)" class="link-style">readings</span></th><th></th><th></th></tr></thead><tbody><tr data-row-id="1"><td>Kirk Douglas</td><td></td><td>Herman Melville</td><td><a href="javascript:void(0)" class="btn btn-primary " onclick="view_post(\'testlist\', \'run_action\', {action_name:\'run_js_code\', id:\'1\', column_index: 3});">say hi</a></td><td><a href="javascript:execLink(\'/view/authorshow?id=1\')">6</a></td><td>2</td><td><a href="https://lmgtfy.app/?q=Kirk Douglas">KIRK DOUGLAS</a></td><td><a href="javascript:void(0)" class="btn btn-outline-primary btn-sm" onclick="if(confirm(\'Are you sure?\'))local_post_btn(\'post/delete/patients/1?redirect=/view/testlist\', true)">Delete</a></td></tr><tr data-row-id="2"><td>Michael Douglas</td><td>Kirk Douglas</td><td>Leo Tolstoy</td><td><a href="javascript:void(0)" class="btn btn-primary " onclick="view_post(\'testlist\', \'run_action\', {action_name:\'run_js_code\', id:\'2\', column_index: 3});">say hi</a></td><td><a href="javascript:execLink(\'/view/authorshow?id=2\')">7</a></td><td>1</td><td><a href="https://lmgtfy.app/?q=Michael Douglas">MICHAEL DOUGLAS</a></td><td><a href="javascript:void(0)" class="btn btn-outline-primary btn-sm" onclick="if(confirm(\'Are you sure?\'))local_post_btn(\'post/delete/patients/2?redirect=/view/testlist\', true)">Delete</a></td></tr></tbody></table></div>',
|
|
821
|
-
});
|
|
822
|
-
});
|
|
823
|
-
(0, globals_1.it)("should render list view with where aggregations exactly", async () => {
|
|
824
|
-
await test_list({
|
|
825
|
-
table: "books",
|
|
826
|
-
columns: [
|
|
827
|
-
{
|
|
828
|
-
type: "Field",
|
|
829
|
-
col_width: "",
|
|
830
|
-
fieldview: "as_text",
|
|
831
|
-
field_name: "author",
|
|
832
|
-
state_field: "on",
|
|
833
|
-
header_label: "",
|
|
834
|
-
},
|
|
835
|
-
{
|
|
836
|
-
stat: "Count",
|
|
837
|
-
type: "Aggregation",
|
|
838
|
-
aggwhere: "",
|
|
839
|
-
agg_field: "name",
|
|
840
|
-
col_width: "",
|
|
841
|
-
agg_relation: "patients.favbook",
|
|
842
|
-
header_label: "",
|
|
843
|
-
},
|
|
844
|
-
{
|
|
845
|
-
stat: "Count",
|
|
846
|
-
type: "Aggregation",
|
|
847
|
-
aggwhere: "id==1",
|
|
848
|
-
agg_field: "id",
|
|
849
|
-
col_width: "",
|
|
850
|
-
agg_relation: "patients.favbook",
|
|
851
|
-
header_label: "count 1",
|
|
852
|
-
},
|
|
853
|
-
],
|
|
854
|
-
response: `<div class="table-responsive"><table class="table table-sm table-valign-middle "><thead><tr><th><span onclick="sortby('author', false, '4b4ab', this)" class="link-style">Author</span></th><th><span onclick=\"sortby('count_patients_favbook_name_', false, '4b4ab', this)\" class=\"link-style\">Count patients</span></th><th><span onclick=\"sortby('count_patients_favbook_id_id1', false, '4b4ab', this)\" class=\"link-style\">count 1</span></th></tr></thead><tbody><tr data-row-id="1"><td>Herman Melville</td><td>1</td><td>1</td></tr><tr data-row-id="2"><td>Leo Tolstoy</td><td>1</td><td>0</td></tr></tbody></table></div>`,
|
|
855
|
-
});
|
|
856
|
-
});
|
|
857
|
-
(0, globals_1.it)("should render triply joined formulae list view exactly", async () => {
|
|
858
|
-
await test_list({
|
|
859
|
-
table: "readings",
|
|
860
|
-
columns: [
|
|
861
|
-
{
|
|
862
|
-
type: "Field",
|
|
863
|
-
col_width: "",
|
|
864
|
-
fieldview: "show",
|
|
865
|
-
field_name: "temperature",
|
|
866
|
-
state_field: "on",
|
|
867
|
-
header_label: "",
|
|
868
|
-
},
|
|
869
|
-
{
|
|
870
|
-
type: "Link",
|
|
871
|
-
link_url: "http://bbc.co.uk",
|
|
872
|
-
col_width: "",
|
|
873
|
-
link_text: "patient_id.name",
|
|
874
|
-
header_label: "name",
|
|
875
|
-
link_text_formula: "on",
|
|
876
|
-
},
|
|
877
|
-
{
|
|
878
|
-
type: "Link",
|
|
879
|
-
link_url: "http://bbc.co.uk",
|
|
880
|
-
col_width: "",
|
|
881
|
-
link_text: "patient_id.favbook.author",
|
|
882
|
-
header_label: "author",
|
|
883
|
-
link_text_formula: "on",
|
|
884
|
-
},
|
|
885
|
-
{
|
|
886
|
-
type: "Link",
|
|
887
|
-
link_url: "http://bbc.co.uk",
|
|
888
|
-
col_width: "",
|
|
889
|
-
link_text: "patient_id.favbook.publisher?.name",
|
|
890
|
-
header_label: "publisher",
|
|
891
|
-
link_text_formula: "on",
|
|
892
|
-
},
|
|
893
|
-
],
|
|
894
|
-
response: `<div class="table-responsive"><table class="table table-sm table-valign-middle "><thead><tr><th class="text-align-right"><span onclick="sortby('temperature', false, '4b4ab', this)" class="link-style">Temperature</span></th><th>name</th><th>author</th><th>publisher</th></tr></thead><tbody><tr data-row-id="1"><td class="text-align-right">37</td><td><a href="http://bbc.co.uk">Kirk Douglas</a></td><td><a href="http://bbc.co.uk">Herman Melville</a></td><td><a href="http://bbc.co.uk"></a></td></tr><tr data-row-id="2"><td class="text-align-right">39</td><td><a href="http://bbc.co.uk">Kirk Douglas</a></td><td><a href="http://bbc.co.uk">Herman Melville</a></td><td><a href="http://bbc.co.uk"></a></td></tr><tr data-row-id="3"><td class="text-align-right">37</td><td><a href="http://bbc.co.uk">Michael Douglas</a></td><td><a href="http://bbc.co.uk">Leo Tolstoy</a></td><td><a href="http://bbc.co.uk">AK Press</a></td></tr></tbody></table></div>`,
|
|
895
|
-
});
|
|
896
|
-
});
|
|
897
|
-
(0, globals_1.it)("should render triply joined with dropdown list view", async () => {
|
|
898
|
-
await test_list({
|
|
899
|
-
table: "readings",
|
|
900
|
-
columns: [
|
|
901
|
-
{
|
|
902
|
-
type: "Field",
|
|
903
|
-
col_width: "",
|
|
904
|
-
fieldview: "show",
|
|
905
|
-
field_name: "normalised",
|
|
906
|
-
state_field: "on",
|
|
907
|
-
header_label: "",
|
|
908
|
-
},
|
|
909
|
-
{
|
|
910
|
-
type: "JoinField",
|
|
911
|
-
col_width: "",
|
|
912
|
-
join_field: "patient_id.favbook.author",
|
|
913
|
-
header_label: "",
|
|
914
|
-
},
|
|
915
|
-
{
|
|
916
|
-
type: "Field",
|
|
917
|
-
col_width: "",
|
|
918
|
-
fieldview: "show",
|
|
919
|
-
field_name: "temperature",
|
|
920
|
-
state_field: "on",
|
|
921
|
-
header_label: "",
|
|
922
|
-
},
|
|
923
|
-
{
|
|
924
|
-
type: "JoinField",
|
|
925
|
-
col_width: "",
|
|
926
|
-
join_field: "patient_id.favbook.publisher.name",
|
|
927
|
-
header_label: "",
|
|
928
|
-
},
|
|
929
|
-
{
|
|
930
|
-
type: "ViewLink",
|
|
931
|
-
view: "Own:showreads",
|
|
932
|
-
col_width: "",
|
|
933
|
-
link_size: "",
|
|
934
|
-
link_style: "",
|
|
935
|
-
view_label: "",
|
|
936
|
-
header_label: "",
|
|
937
|
-
},
|
|
938
|
-
{
|
|
939
|
-
type: "Link",
|
|
940
|
-
link_url: "http://bbc.co.uk",
|
|
941
|
-
col_width: "",
|
|
942
|
-
link_text: '"Foo "+temperature.toString().substring(1,3)',
|
|
943
|
-
header_label: "",
|
|
944
|
-
link_text_formula: "on",
|
|
945
|
-
},
|
|
946
|
-
{
|
|
947
|
-
type: "Action",
|
|
948
|
-
col_width: "",
|
|
949
|
-
action_name: "Delete",
|
|
950
|
-
action_size: "",
|
|
951
|
-
in_dropdown: "on",
|
|
952
|
-
action_label: "",
|
|
953
|
-
action_style: "btn-primary",
|
|
954
|
-
header_label: "",
|
|
955
|
-
},
|
|
956
|
-
{
|
|
957
|
-
type: "ViewLink",
|
|
958
|
-
view: "Own:showreads",
|
|
959
|
-
in_modal: "on",
|
|
960
|
-
col_width: "",
|
|
961
|
-
link_size: "",
|
|
962
|
-
link_style: "",
|
|
963
|
-
view_label: "",
|
|
964
|
-
in_dropdown: "on",
|
|
965
|
-
header_label: "",
|
|
966
|
-
},
|
|
967
|
-
],
|
|
968
|
-
response: !remoteQueries
|
|
969
|
-
? '<div class="table-responsive"><table class="table table-sm table-valign-middle "><thead><tr><th><span onclick="sortby(\'normalised\', false, \'4b4ab\', this)" class="link-style">Normalised</span></th><th><span onclick="sortby(\'patient_id_favbook_author\', false, \'4b4ab\', this)" class="link-style">author</span></th><th class="text-align-right"><span onclick="sortby(\'temperature\', false, \'4b4ab\', this)" class="link-style">Temperature</span></th><th><span onclick="sortby(\'patient_id_favbook_publisher_name\', false, \'4b4ab\', this)" class="link-style">name</span></th><th>showreads</th><th></th><th>Action</th></tr></thead><tbody><tr data-row-id="1"><td><i class="fas fa-lg fa-check-circle text-success"></i></td><td>Herman Melville</td><td class="text-align-right">37</td><td></td><td><a href="/view/showreads?id=1">showreads</a></td><td><a href="http://bbc.co.uk">Foo 7</a></td><td><div class="dropdown"><button class="btn btn-sm btn-xs btn-outline-secondary dropdown-toggle" data-boundary="viewport" type="button" id="actiondd1" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Action</button><div class="dropdown-menu dropdown-menu-end" aria-labelledby="actiondd1"><a href="javascript:void(0)" class="dropdown-item btn btn-primary " onclick="ajax_post_btn(\'/delete/readings/1?redirect=/view/testlist\', true)">Delete</a><a href="javascript:void(0)" onclick="ajax_modal(\'/view/showreads?id=1\', {\'reload_view\': \'testlist\'})" class="dropdown-item">showreads</a></div></div></td></tr><tr data-row-id="2"><td><i class="fas fa-lg fa-times-circle text-danger"></i></td><td>Herman Melville</td><td class="text-align-right">39</td><td></td><td><a href="/view/showreads?id=2">showreads</a></td><td><a href="http://bbc.co.uk">Foo 9</a></td><td><div class="dropdown"><button class="btn btn-sm btn-xs btn-outline-secondary dropdown-toggle" data-boundary="viewport" type="button" id="actiondd2" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Action</button><div class="dropdown-menu dropdown-menu-end" aria-labelledby="actiondd2"><a href="javascript:void(0)" class="dropdown-item btn btn-primary " onclick="ajax_post_btn(\'/delete/readings/2?redirect=/view/testlist\', true)">Delete</a><a href="javascript:void(0)" onclick="ajax_modal(\'/view/showreads?id=2\', {\'reload_view\': \'testlist\'})" class="dropdown-item">showreads</a></div></div></td></tr><tr data-row-id="3"><td><i class="fas fa-lg fa-times-circle text-danger"></i></td><td>Leo Tolstoy</td><td class="text-align-right">37</td><td>AK Press</td><td><a href="/view/showreads?id=3">showreads</a></td><td><a href="http://bbc.co.uk">Foo 7</a></td><td><div class="dropdown"><button class="btn btn-sm btn-xs btn-outline-secondary dropdown-toggle" data-boundary="viewport" type="button" id="actiondd3" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Action</button><div class="dropdown-menu dropdown-menu-end" aria-labelledby="actiondd3"><a href="javascript:void(0)" class="dropdown-item btn btn-primary " onclick="ajax_post_btn(\'/delete/readings/3?redirect=/view/testlist\', true)">Delete</a><a href="javascript:void(0)" onclick="ajax_modal(\'/view/showreads?id=3\', {\'reload_view\': \'testlist\'})" class="dropdown-item">showreads</a></div></div></td></tr></tbody></table></div>'
|
|
970
|
-
: '<div class="table-responsive"><table class="table table-sm table-valign-middle "><thead><tr><th><span onclick="sortby(\'normalised\', false, \'4b4ab\', this)" class="link-style">Normalised</span></th><th><span onclick="sortby(\'patient_id_favbook_author\', false, \'4b4ab\', this)" class="link-style">author</span></th><th class="text-align-right"><span onclick="sortby(\'temperature\', false, \'4b4ab\', this)" class="link-style">Temperature</span></th><th><span onclick="sortby(\'patient_id_favbook_publisher_name\', false, \'4b4ab\', this)" class="link-style">name</span></th><th>showreads</th><th></th><th>Action</th></tr></thead><tbody><tr data-row-id="1"><td><i class="fas fa-lg fa-check-circle text-success"></i></td><td>Herman Melville</td><td class="text-align-right">37</td><td></td><td><a href="javascript:execLink(\'/view/showreads?id=1\')">showreads</a></td><td><a href="http://bbc.co.uk">Foo 7</a></td><td><div class="dropdown"><button class="btn btn-sm btn-xs btn-outline-secondary dropdown-toggle" data-boundary="viewport" type="button" id="actiondd1" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Action</button><div class="dropdown-menu dropdown-menu-end" aria-labelledby="actiondd1"><a href="javascript:void(0)" class="dropdown-item btn btn-primary " onclick="local_post_btn(\'post/delete/readings/1?redirect=/view/testlist\', true)">Delete</a><a href="javascript:void(0)" onclick="mobile_modal(\'/view/showreads?id=1\', {\'reload_view\': \'testlist\'})" class="dropdown-item">showreads</a></div></div></td></tr><tr data-row-id="2"><td><i class="fas fa-lg fa-times-circle text-danger"></i></td><td>Herman Melville</td><td class="text-align-right">39</td><td></td><td><a href="javascript:execLink(\'/view/showreads?id=2\')">showreads</a></td><td><a href="http://bbc.co.uk">Foo 9</a></td><td><div class="dropdown"><button class="btn btn-sm btn-xs btn-outline-secondary dropdown-toggle" data-boundary="viewport" type="button" id="actiondd2" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Action</button><div class="dropdown-menu dropdown-menu-end" aria-labelledby="actiondd2"><a href="javascript:void(0)" class="dropdown-item btn btn-primary " onclick="local_post_btn(\'post/delete/readings/2?redirect=/view/testlist\', true)">Delete</a><a href="javascript:void(0)" onclick="mobile_modal(\'/view/showreads?id=2\', {\'reload_view\': \'testlist\'})" class="dropdown-item">showreads</a></div></div></td></tr><tr data-row-id="3"><td><i class="fas fa-lg fa-times-circle text-danger"></i></td><td>Leo Tolstoy</td><td class="text-align-right">37</td><td>AK Press</td><td><a href="javascript:execLink(\'/view/showreads?id=3\')">showreads</a></td><td><a href="http://bbc.co.uk">Foo 7</a></td><td><div class="dropdown"><button class="btn btn-sm btn-xs btn-outline-secondary dropdown-toggle" data-boundary="viewport" type="button" id="actiondd3" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Action</button><div class="dropdown-menu dropdown-menu-end" aria-labelledby="actiondd3"><a href="javascript:void(0)" class="dropdown-item btn btn-primary " onclick="local_post_btn(\'post/delete/readings/3?redirect=/view/testlist\', true)">Delete</a><a href="javascript:void(0)" onclick="mobile_modal(\'/view/showreads?id=3\', {\'reload_view\': \'testlist\'})" class="dropdown-item">showreads</a></div></div></td></tr></tbody></table></div>',
|
|
971
|
-
});
|
|
972
|
-
});
|
|
973
|
-
});
|
|
974
|
-
(0, globals_1.describe)("Filter view", () => {
|
|
975
|
-
(0, globals_1.it)("should render exactly", async () => {
|
|
976
|
-
await test_filter({
|
|
977
|
-
layout: {
|
|
978
|
-
above: [
|
|
979
|
-
{
|
|
980
|
-
widths: [6, 6],
|
|
981
|
-
besides: [
|
|
982
|
-
{ type: "dropdown_filter", field_name: "patients.favbook.name" },
|
|
983
|
-
{
|
|
984
|
-
type: "toggle_filter",
|
|
985
|
-
label: "thirteen",
|
|
986
|
-
value: "13",
|
|
987
|
-
field_name: "pages",
|
|
988
|
-
},
|
|
989
|
-
],
|
|
990
|
-
},
|
|
991
|
-
{
|
|
992
|
-
type: "toggle_filter",
|
|
993
|
-
label: "Jim",
|
|
994
|
-
value: "Jim",
|
|
995
|
-
field_name: "patients.favbook.name",
|
|
996
|
-
},
|
|
997
|
-
{ type: "dropdown_filter", field_name: "author" },
|
|
998
|
-
],
|
|
999
|
-
},
|
|
1000
|
-
columns: [
|
|
1001
|
-
{ type: "DropDownFilter", field_name: "patients.favbook.name" },
|
|
1002
|
-
{ type: "ToggleFilter", value: "13", field_name: "pages" },
|
|
1003
|
-
{
|
|
1004
|
-
type: "ToggleFilter",
|
|
1005
|
-
value: "Jim",
|
|
1006
|
-
field_name: "patients.favbook.name",
|
|
1007
|
-
},
|
|
1008
|
-
{ type: "DropDownFilter", field_name: "author" },
|
|
1009
|
-
],
|
|
1010
|
-
viewname: "testfilter",
|
|
1011
|
-
response: '<div class="form-namespace"><div class="row"><div class="col-6"><select name="ddfilterpatients.favbook.name" class="form-control form-select d-inline-maybe scfilter selectizable" style="width: unset;" required onchange="this.value==\'\' ? unset_state_field(\'patients.favbook.name\', this): set_state_field(\'patients.favbook.name\', this.value, this)"><option value="" selected class="text-muted"></option><option value="Kirk Douglas">Kirk Douglas</option><option value="Michael Douglas">Michael Douglas</option></select></div><div class="col-6"><button class="btn btn-outline-primary" onClick="set_state_field(\'pages\', \'13\', this)">thirteen</button></div></div><button class="btn btn-outline-primary" onClick="set_state_field(\'patients.favbook.name\', \'Jim\', this)">Jim</button><select name="ddfilterauthor" class="form-control form-select d-inline-maybe scfilter selectizable" style="width: unset;" required onchange="this.value==\'\' ? unset_state_field(\'author\', this): set_state_field(\'author\', this.value, this)"><option value="" selected class="text-muted"></option><option value="Herman Melville">Herman Melville</option><option value="Leo Tolstoy">Leo Tolstoy</option></select></div>',
|
|
1012
|
-
});
|
|
1013
|
-
});
|
|
1014
|
-
});
|
|
1015
|
-
(0, globals_1.describe)("Page", () => {
|
|
1016
|
-
(0, globals_1.it)("should render page exactly", async () => {
|
|
1017
|
-
await test_page({
|
|
1018
|
-
response: {
|
|
1019
|
-
above: [
|
|
1020
|
-
{
|
|
1021
|
-
widths: [6, 6],
|
|
1022
|
-
besides: [
|
|
1023
|
-
{
|
|
1024
|
-
type: "container",
|
|
1025
|
-
block: true,
|
|
1026
|
-
bgType: "None",
|
|
1027
|
-
hAlign: "left",
|
|
1028
|
-
height: "50",
|
|
1029
|
-
vAlign: "top",
|
|
1030
|
-
bgColor: "#ffffff",
|
|
1031
|
-
contents: {
|
|
1032
|
-
type: "blank",
|
|
1033
|
-
isHTML: true,
|
|
1034
|
-
contents: "<h6>a h6</h6>",
|
|
1035
|
-
},
|
|
1036
|
-
imageSize: "contain",
|
|
1037
|
-
isFormula: {},
|
|
1038
|
-
textColor: "#ffffff",
|
|
1039
|
-
borderStyle: "solid",
|
|
1040
|
-
borderWidth: "1",
|
|
1041
|
-
showForRole: [],
|
|
1042
|
-
},
|
|
1043
|
-
{
|
|
1044
|
-
url: "https://abc.com",
|
|
1045
|
-
type: "card",
|
|
1046
|
-
title: "The Title goes Here",
|
|
1047
|
-
contents: {
|
|
1048
|
-
url: "https://saltcorn.com/",
|
|
1049
|
-
text: "Click here",
|
|
1050
|
-
type: "link",
|
|
1051
|
-
nofollow: true,
|
|
1052
|
-
isFormula: {},
|
|
1053
|
-
},
|
|
1054
|
-
isFormula: {},
|
|
1055
|
-
},
|
|
1056
|
-
],
|
|
1057
|
-
},
|
|
1058
|
-
{
|
|
1059
|
-
name: "806e61",
|
|
1060
|
-
type: "view",
|
|
1061
|
-
view: "authorlist",
|
|
1062
|
-
state: "shared",
|
|
1063
|
-
contents: !remoteQueries
|
|
1064
|
-
? '<div class="d-inline" data-sc-embed-viewname="authorlist" data-sc-view-source="/view/authorlist"><div class="table-responsive"><table class="table table-sm table-valign-middle "><thead><tr><th><span onclick="sortby(\'author\', false, \'28b3d\', this)" class="link-style">Author</span></th><th>authorshow</th><th></th><th><span onclick="sortby(\'count_patients_favbook_name_undefined\', false, \'28b3d\', this)" class="link-style">Count patients</span></th></tr></thead><tbody><tr data-row-id="1"><td>Herman Melville</td><td><a href="/view/authorshow?id=1">authorshow</a></td><td><a href="javascript:void(0)" class="btn btn-primary " onclick="ajax_post_btn(\'/delete/books/1?redirect=/view/authorlist\', true)">Delete</a></td><td>1</td></tr><tr data-row-id="2"><td>Leo Tolstoy</td><td><a href="/view/authorshow?id=2">authorshow</a></td><td><a href="javascript:void(0)" class="btn btn-primary " onclick="ajax_post_btn(\'/delete/books/2?redirect=/view/authorlist\', true)">Delete</a></td><td>1</td></tr></tbody></table></div></div>'
|
|
1065
|
-
: '<div class="d-inline" data-sc-embed-viewname="authorlist" data-sc-view-source="/view/authorlist"><div class="table-responsive"><table class="table table-sm table-valign-middle "><thead><tr><th><span onclick="sortby(\'author\', false, \'28b3d\', this)" class="link-style">Author</span></th><th>authorshow</th><th></th><th><span onclick="sortby(\'count_patients_favbook_name_undefined\', false, \'28b3d\', this)" class="link-style">Count patients</span></th></tr></thead><tbody><tr data-row-id="1"><td>Herman Melville</td><td><a href="javascript:execLink(\'/view/authorshow?id=1\')">authorshow</a></td><td><a href="javascript:void(0)" class="btn btn-primary " onclick="local_post_btn(\'post/delete/books/1?redirect=/view/authorlist\', true)">Delete</a></td><td>1</td></tr><tr data-row-id="2"><td>Leo Tolstoy</td><td><a href="javascript:execLink(\'/view/authorshow?id=2\')">authorshow</a></td><td><a href="javascript:void(0)" class="btn btn-primary " onclick="local_post_btn(\'post/delete/books/2?redirect=/view/authorlist\', true)">Delete</a></td><td>1</td></tr></tbody></table></div></div>',
|
|
1066
|
-
},
|
|
1067
|
-
{
|
|
1068
|
-
name: "18a8cc",
|
|
1069
|
-
type: "view",
|
|
1070
|
-
view: "authorshow",
|
|
1071
|
-
state: "fixed",
|
|
1072
|
-
contents: '<div class="d-inline" data-sc-embed-viewname="authorshow" data-sc-view-source="/view/authorshow?id=1">Herman Melville</div>',
|
|
1073
|
-
},
|
|
1074
|
-
],
|
|
1075
|
-
},
|
|
1076
|
-
name: "testpage",
|
|
1077
|
-
title: "gergerger",
|
|
1078
|
-
description: "greger",
|
|
1079
|
-
min_role: 100,
|
|
1080
|
-
id: 2,
|
|
1081
|
-
layout: {
|
|
1082
|
-
above: [
|
|
1083
|
-
{
|
|
1084
|
-
widths: [6, 6],
|
|
1085
|
-
besides: [
|
|
1086
|
-
{
|
|
1087
|
-
type: "container",
|
|
1088
|
-
block: true,
|
|
1089
|
-
bgType: "None",
|
|
1090
|
-
hAlign: "left",
|
|
1091
|
-
height: "50",
|
|
1092
|
-
vAlign: "top",
|
|
1093
|
-
bgColor: "#ffffff",
|
|
1094
|
-
contents: {
|
|
1095
|
-
type: "blank",
|
|
1096
|
-
isHTML: true,
|
|
1097
|
-
contents: "<h6>a h6</h6>",
|
|
1098
|
-
},
|
|
1099
|
-
imageSize: "contain",
|
|
1100
|
-
isFormula: {},
|
|
1101
|
-
textColor: "#ffffff",
|
|
1102
|
-
borderStyle: "solid",
|
|
1103
|
-
borderWidth: "1",
|
|
1104
|
-
showForRole: [],
|
|
1105
|
-
},
|
|
1106
|
-
{
|
|
1107
|
-
url: "https://abc.com",
|
|
1108
|
-
type: "card",
|
|
1109
|
-
title: "The Title goes Here",
|
|
1110
|
-
contents: {
|
|
1111
|
-
url: "https://saltcorn.com/",
|
|
1112
|
-
text: "Click here",
|
|
1113
|
-
type: "link",
|
|
1114
|
-
nofollow: true,
|
|
1115
|
-
isFormula: {},
|
|
1116
|
-
},
|
|
1117
|
-
isFormula: {},
|
|
1118
|
-
},
|
|
1119
|
-
],
|
|
1120
|
-
},
|
|
1121
|
-
{
|
|
1122
|
-
name: "806e61",
|
|
1123
|
-
type: "view",
|
|
1124
|
-
view: "authorlist",
|
|
1125
|
-
state: "shared",
|
|
1126
|
-
contents: '<div class="table-responsive"><table class="table table-sm table-valign-middle "><thead><tr><th><span onclick="sortby(\'author\', false, this)" class="link-style">Author</span></th><th>authorshow</th><th></th><th><span onclick="sortby(\'count_patients_favbook_name_undefined\', false, \'28b3d\', this)" class="link-style">Count patients</span></th></tr></thead><tbody><tr><td>Herman Melville</td><td><a href="/view/authorshow?id=1">authorshow</a></td><td><form action="/delete/books/1?redirect=/view/authorlist" method="post">\n <input type="hidden" name="_csrf" value="">\n<button type="button" onclick="ajax_post_btn(this, true, undefined)" class=" btn btn-sm btn-primary">Delete</button></form></td><td>1</td></tr><tr><td>Leo Tolstoy</td><td><a href="/view/authorshow?id=2">authorshow</a></td><td><form action="/delete/books/2?redirect=/view/authorlist" method="post">\n <input type="hidden" name="_csrf" value="">\n<button type="button" onclick="ajax_post_btn(this, true, undefined)" class=" btn btn-sm btn-primary">Delete</button></form></td><td>1</td></tr></tbody></table></div>',
|
|
1127
|
-
},
|
|
1128
|
-
{
|
|
1129
|
-
name: "18a8cc",
|
|
1130
|
-
type: "view",
|
|
1131
|
-
view: "authorshow",
|
|
1132
|
-
state: "fixed",
|
|
1133
|
-
contents: "Herman Melville",
|
|
1134
|
-
},
|
|
1135
|
-
],
|
|
1136
|
-
},
|
|
1137
|
-
fixed_states: { "18a8cc": { id: 1 }, fixed_stateforauthorshowview: null },
|
|
1138
|
-
});
|
|
1139
|
-
});
|
|
1140
|
-
});
|
|
1141
|
-
(0, globals_1.describe)("Feed view", () => {
|
|
1142
|
-
(0, globals_1.it)("should render exactly", async () => {
|
|
1143
|
-
await test_feed({
|
|
1144
|
-
table: "books",
|
|
1145
|
-
cols_lg: 3,
|
|
1146
|
-
cols_md: 2,
|
|
1147
|
-
cols_sm: 1,
|
|
1148
|
-
cols_xl: 4,
|
|
1149
|
-
in_card: false,
|
|
1150
|
-
viewname: "authorfeed",
|
|
1151
|
-
show_view: "authoredit",
|
|
1152
|
-
descending: false,
|
|
1153
|
-
include_fml: "",
|
|
1154
|
-
order_field: "pages",
|
|
1155
|
-
exttable_name: null,
|
|
1156
|
-
rows_per_page: 20,
|
|
1157
|
-
view_to_create: "authoredit",
|
|
1158
|
-
hide_pagination: false,
|
|
1159
|
-
masonry_columns: false,
|
|
1160
|
-
create_view_label: null,
|
|
1161
|
-
create_view_display: "Embedded",
|
|
1162
|
-
create_view_location: null,
|
|
1163
|
-
response: !remoteQueries
|
|
1164
|
-
? `<div><div class="row"><div class="col-sm-12 col-md-6 col-lg-4 col-xl-3"><div class="d-inline" data-sc-embed-viewname="authoredit" data-sc-view-source="/view/authoredit?id=2"><form data-viewname="authoredit" action="/view/authoredit" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Afalse%2C%22user%22%3A%7B%22id%22%3A1%2C%22role_id%22%3A1%2C%22attributes%22%3A%7B%7D%7D%2C%22author%22%3A%22Leo%20Tolstoy%22%2C%22pages%22%3A728%2C%22publisher%22%3A1%7D" id="test-form-id"><input type="hidden" name="_csrf" value=""><input type="hidden" class="form-control " name="id" value="2"><input type="text" class="form-control " data-fieldname="author" name="author" required id="inputauthor" value="Leo Tolstoy"></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script><script id="test-script-id">(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const collabCfg = {
|
|
1165
|
-
events: {
|
|
1166
|
-
'authoredit_UPDATE_EVENT?id=2': async (data) => {
|
|
1167
|
-
console.log("Update event received for view authoredit", data);
|
|
1168
|
-
const script = document.getElementById('test-script-id');
|
|
1169
|
-
const closestDiv = script?.closest(
|
|
1170
|
-
'div[data-sc-embed-viewname="authoredit"]'
|
|
1171
|
-
);
|
|
1172
|
-
if (data.updates) {
|
|
1173
|
-
if (closestDiv) await common_done({set_fields: data.updates, no_onchange: true}, closestDiv);
|
|
1174
|
-
else await common_done({set_fields: data.updates, no_onchange: true}, "authoredit");
|
|
1175
|
-
}
|
|
1176
|
-
if (data.actions) {
|
|
1177
|
-
for (const action of data.actions) {
|
|
1178
|
-
if (closestDiv) await common_done(action, closestDiv);
|
|
1179
|
-
else await common_done(action, "authoredit");
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
};
|
|
1185
|
-
init_collab_room('authoredit', collabCfg);});</script></div></div><div class="col-sm-12 col-md-6 col-lg-4 col-xl-3"><div class="d-inline" data-sc-embed-viewname="authoredit" data-sc-view-source="/view/authoredit?id=1"><form data-viewname="authoredit" action="/view/authoredit" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Afalse%2C%22user%22%3A%7B%22id%22%3A1%2C%22role_id%22%3A1%2C%22attributes%22%3A%7B%7D%7D%2C%22author%22%3A%22Herman%20Melville%22%2C%22pages%22%3A967%2C%22publisher%22%3Anull%7D" id="test-form-id"><input type="hidden" name="_csrf" value=""><input type="hidden" class="form-control " name="id" value="1"><input type="text" class="form-control " data-fieldname="author" name="author" required id="inputauthor" value="Herman Melville"></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script><script id="test-script-id">(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const collabCfg = {
|
|
1186
|
-
events: {
|
|
1187
|
-
'authoredit_UPDATE_EVENT?id=1': async (data) => {
|
|
1188
|
-
console.log("Update event received for view authoredit", data);
|
|
1189
|
-
const script = document.getElementById('test-script-id');
|
|
1190
|
-
const closestDiv = script?.closest(
|
|
1191
|
-
'div[data-sc-embed-viewname="authoredit"]'
|
|
1192
|
-
);
|
|
1193
|
-
if (data.updates) {
|
|
1194
|
-
if (closestDiv) await common_done({set_fields: data.updates, no_onchange: true}, closestDiv);
|
|
1195
|
-
else await common_done({set_fields: data.updates, no_onchange: true}, "authoredit");
|
|
1196
|
-
}
|
|
1197
|
-
if (data.actions) {
|
|
1198
|
-
for (const action of data.actions) {
|
|
1199
|
-
if (closestDiv) await common_done(action, closestDiv);
|
|
1200
|
-
else await common_done(action, "authoredit");
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
};
|
|
1206
|
-
init_collab_room('authoredit', collabCfg);});</script></div></div></div><form data-viewname="authoredit" action="/view/authoredit" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Atrue%2C%22user%22%3A%7B%22id%22%3A1%2C%22role_id%22%3A1%2C%22attributes%22%3A%7B%7D%7D%7D" id="test-form-id"><input type="hidden" name="_csrf" value=""><input type="text" class="form-control " data-fieldname="author" name="author" required id="inputauthor"></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script></div>`
|
|
1207
|
-
: `<div><div class=\"row\"><div class=\"col-sm-12 col-md-6 col-lg-4 col-xl-3\"><div class=\"d-inline\" data-sc-embed-viewname=\"authoredit\" data-sc-view-source=\"/view/authoredit?id=2\"><form data-viewname=\"authoredit\" action=\"javascript:void(0)\" onsubmit=\"javascript:formSubmit(this, '/view/', 'authoredit')\" class=\"form-namespace \" method=\"post\" data-row-values=\"%7B%22_creating%22%3Afalse%2C%22user%22%3A%7B%22email%22%3A%22admin%40foo.com%22%2C%22id%22%3A1%2C%22role_id%22%3A1%2C%22language%22%3Anull%2C%22tenant%22%3A%22public%22%2C%22attributes%22%3A%7B%7D%7D%2C%22author%22%3A%22Leo%20Tolstoy%22%2C%22pages%22%3A728%2C%22publisher%22%3A1%7D\" id="test-form-id"><input type=\"hidden\" name=\"_csrf\" value=\"false\"><input type=\"hidden\" class=\"form-control \" name=\"id\" value=\"2\"><input type=\"text\" class=\"form-control \" data-fieldname=\"author\" name=\"author\" required id=\"inputauthor\" value=\"Leo Tolstoy\"></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script><script id="test-script-id">(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const collabCfg = {
|
|
1208
|
-
events: {
|
|
1209
|
-
'authoredit_UPDATE_EVENT?id=2': async (data) => {
|
|
1210
|
-
console.log("Update event received for view authoredit", data);
|
|
1211
|
-
const script = document.getElementById('test-script-id');
|
|
1212
|
-
const closestDiv = script?.closest(
|
|
1213
|
-
'div[data-sc-embed-viewname="authoredit"]'
|
|
1214
|
-
);
|
|
1215
|
-
if (data.updates) {
|
|
1216
|
-
if (closestDiv) await common_done({set_fields: data.updates, no_onchange: true}, closestDiv);
|
|
1217
|
-
else await common_done({set_fields: data.updates, no_onchange: true}, "authoredit");
|
|
1218
|
-
}
|
|
1219
|
-
if (data.actions) {
|
|
1220
|
-
for (const action of data.actions) {
|
|
1221
|
-
if (closestDiv) await common_done(action, closestDiv);
|
|
1222
|
-
else await common_done(action, "authoredit");
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
};
|
|
1228
|
-
init_collab_room('authoredit', collabCfg);});</script></div></div><div class=\"col-sm-12 col-md-6 col-lg-4 col-xl-3\"><div class=\"d-inline\" data-sc-embed-viewname=\"authoredit\" data-sc-view-source=\"/view/authoredit?id=1\"><form data-viewname=\"authoredit\" action=\"javascript:void(0)\" onsubmit=\"javascript:formSubmit(this, '/view/', 'authoredit')\" class=\"form-namespace \" method=\"post\" data-row-values=\"%7B%22_creating%22%3Afalse%2C%22user%22%3A%7B%22email%22%3A%22admin%40foo.com%22%2C%22id%22%3A1%2C%22role_id%22%3A1%2C%22language%22%3Anull%2C%22tenant%22%3A%22public%22%2C%22attributes%22%3A%7B%7D%7D%2C%22author%22%3A%22Herman%20Melville%22%2C%22pages%22%3A967%2C%22publisher%22%3Anull%7D\" id="test-form-id"><input type=\"hidden\" name=\"_csrf\" value=\"false\"><input type=\"hidden\" class=\"form-control \" name=\"id\" value=\"1\"><input type=\"text\" class=\"form-control \" data-fieldname=\"author\" name=\"author\" required id=\"inputauthor\" value=\"Herman Melville\"></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script><script id="test-script-id">(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const collabCfg = {
|
|
1229
|
-
events: {
|
|
1230
|
-
'authoredit_UPDATE_EVENT?id=1': async (data) => {
|
|
1231
|
-
console.log("Update event received for view authoredit", data);
|
|
1232
|
-
const script = document.getElementById('test-script-id');
|
|
1233
|
-
const closestDiv = script?.closest(
|
|
1234
|
-
'div[data-sc-embed-viewname="authoredit"]'
|
|
1235
|
-
);
|
|
1236
|
-
if (data.updates) {
|
|
1237
|
-
if (closestDiv) await common_done({set_fields: data.updates, no_onchange: true}, closestDiv);
|
|
1238
|
-
else await common_done({set_fields: data.updates, no_onchange: true}, "authoredit");
|
|
1239
|
-
}
|
|
1240
|
-
if (data.actions) {
|
|
1241
|
-
for (const action of data.actions) {
|
|
1242
|
-
if (closestDiv) await common_done(action, closestDiv);
|
|
1243
|
-
else await common_done(action, "authoredit");
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
};
|
|
1249
|
-
init_collab_room('authoredit', collabCfg);});</script></div></div></div><form data-viewname=\"authoredit\" action=\"javascript:void(0)\" onsubmit=\"javascript:formSubmit(this, '/view/', 'authoredit')\" class=\"form-namespace \" method=\"post\" data-row-values=\"%7B%22_creating%22%3Atrue%2C%22user%22%3A%7B%22email%22%3A%22admin%40foo.com%22%2C%22id%22%3A1%2C%22role_id%22%3A1%2C%22language%22%3Anull%2C%22tenant%22%3A%22public%22%2C%22attributes%22%3A%7B%7D%7D%7D\" id="test-form-id"><input type=\"hidden\" name=\"_csrf\" value=\"false\"><input type=\"text\" class=\"form-control \" data-fieldname=\"author\" name=\"author\" required id=\"inputauthor\"></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script></div>`,
|
|
1250
|
-
});
|
|
1251
|
-
});
|
|
1252
|
-
(0, globals_1.it)("should render masonry exactly", async () => {
|
|
1253
|
-
await test_feed({
|
|
1254
|
-
table: "books",
|
|
1255
|
-
cols_lg: 3,
|
|
1256
|
-
cols_md: 2,
|
|
1257
|
-
cols_sm: 1,
|
|
1258
|
-
cols_xl: 4,
|
|
1259
|
-
in_card: true,
|
|
1260
|
-
viewname: "authorfeed",
|
|
1261
|
-
show_view: "authoredit",
|
|
1262
|
-
descending: false,
|
|
1263
|
-
include_fml: "",
|
|
1264
|
-
order_field: "pages",
|
|
1265
|
-
exttable_name: null,
|
|
1266
|
-
rows_per_page: 20,
|
|
1267
|
-
view_to_create: "authoredit",
|
|
1268
|
-
hide_pagination: false,
|
|
1269
|
-
masonry_columns: true,
|
|
1270
|
-
create_view_label: "New book",
|
|
1271
|
-
create_view_display: "Link",
|
|
1272
|
-
create_view_location: "Top left",
|
|
1273
|
-
response: !remoteQueries
|
|
1274
|
-
? `<div><a href="/view/authoredit">New book</a><div class="card-columns"><div class="card shadow mt-2"><div class="card-body"><div class="d-inline" data-sc-embed-viewname="authoredit" data-sc-view-source="/view/authoredit?id=2"><form data-viewname="authoredit" action="/view/authoredit" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Afalse%2C%22user%22%3A%7B%22id%22%3A1%2C%22role_id%22%3A1%2C%22attributes%22%3A%7B%7D%7D%2C%22author%22%3A%22Leo%20Tolstoy%22%2C%22pages%22%3A728%2C%22publisher%22%3A1%7D" id="test-form-id"><input type="hidden" name="_csrf" value=""><input type="hidden" class="form-control " name="id" value="2"><input type="text" class="form-control " data-fieldname="author" name="author" required id="inputauthor" value="Leo Tolstoy"></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script><script id="test-script-id">(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const collabCfg = {
|
|
1275
|
-
events: {
|
|
1276
|
-
'authoredit_UPDATE_EVENT?id=2': async (data) => {
|
|
1277
|
-
console.log("Update event received for view authoredit", data);
|
|
1278
|
-
const script = document.getElementById('test-script-id');
|
|
1279
|
-
const closestDiv = script?.closest(
|
|
1280
|
-
'div[data-sc-embed-viewname="authoredit"]'
|
|
1281
|
-
);
|
|
1282
|
-
if (data.updates) {
|
|
1283
|
-
if (closestDiv) await common_done({set_fields: data.updates, no_onchange: true}, closestDiv);
|
|
1284
|
-
else await common_done({set_fields: data.updates, no_onchange: true}, "authoredit");
|
|
1285
|
-
}
|
|
1286
|
-
if (data.actions) {
|
|
1287
|
-
for (const action of data.actions) {
|
|
1288
|
-
if (closestDiv) await common_done(action, closestDiv);
|
|
1289
|
-
else await common_done(action, "authoredit");
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
};
|
|
1295
|
-
init_collab_room('authoredit', collabCfg);});</script></div></div></div><div class="card shadow mt-2"><div class="card-body"><div class="d-inline" data-sc-embed-viewname="authoredit" data-sc-view-source="/view/authoredit?id=1"><form data-viewname="authoredit" action="/view/authoredit" class="form-namespace " method="post" data-row-values="%7B%22_creating%22%3Afalse%2C%22user%22%3A%7B%22id%22%3A1%2C%22role_id%22%3A1%2C%22attributes%22%3A%7B%7D%7D%2C%22author%22%3A%22Herman%20Melville%22%2C%22pages%22%3A967%2C%22publisher%22%3Anull%7D" id="test-form-id"><input type="hidden" name="_csrf" value=""><input type="hidden" class="form-control " name="id" value="1"><input type="text" class="form-control " data-fieldname="author" name="author" required id="inputauthor" value="Herman Melville"></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script><script id="test-script-id">(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const collabCfg = {
|
|
1296
|
-
events: {
|
|
1297
|
-
'authoredit_UPDATE_EVENT?id=1': async (data) => {
|
|
1298
|
-
console.log("Update event received for view authoredit", data);
|
|
1299
|
-
const script = document.getElementById('test-script-id');
|
|
1300
|
-
const closestDiv = script?.closest(
|
|
1301
|
-
'div[data-sc-embed-viewname="authoredit"]'
|
|
1302
|
-
);
|
|
1303
|
-
if (data.updates) {
|
|
1304
|
-
if (closestDiv) await common_done({set_fields: data.updates, no_onchange: true}, closestDiv);
|
|
1305
|
-
else await common_done({set_fields: data.updates, no_onchange: true}, "authoredit");
|
|
1306
|
-
}
|
|
1307
|
-
if (data.actions) {
|
|
1308
|
-
for (const action of data.actions) {
|
|
1309
|
-
if (closestDiv) await common_done(action, closestDiv);
|
|
1310
|
-
else await common_done(action, "authoredit");
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
};
|
|
1316
|
-
init_collab_room('authoredit', collabCfg);});</script></div></div></div></div></div>`
|
|
1317
|
-
: `<div><a href=\"javascript:execLink('/view/authoredit');\">New book</a><div class=\"card-columns\"><div class=\"card shadow mt-2\"><div class=\"card-body\"><div class=\"d-inline\" data-sc-embed-viewname=\"authoredit\" data-sc-view-source=\"/view/authoredit?id=2\"><form data-viewname=\"authoredit\" action=\"javascript:void(0)\" onsubmit=\"javascript:formSubmit(this, '/view/', 'authoredit')\" class=\"form-namespace \" method=\"post\" data-row-values=\"%7B%22_creating%22%3Afalse%2C%22user%22%3A%7B%22email%22%3A%22admin%40foo.com%22%2C%22id%22%3A1%2C%22role_id%22%3A1%2C%22language%22%3Anull%2C%22tenant%22%3A%22public%22%2C%22attributes%22%3A%7B%7D%7D%2C%22author%22%3A%22Leo%20Tolstoy%22%2C%22pages%22%3A728%2C%22publisher%22%3A1%7D\" id="test-form-id"><input type=\"hidden\" name=\"_csrf\" value=\"false\"><input type=\"hidden\" class=\"form-control \" name=\"id\" value=\"2\"><input type=\"text\" class=\"form-control \" data-fieldname=\"author\" name=\"author\" required id=\"inputauthor\" value=\"Leo Tolstoy\"></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script><script id="test-script-id">(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const collabCfg = {
|
|
1318
|
-
events: {
|
|
1319
|
-
'authoredit_UPDATE_EVENT?id=2': async (data) => {
|
|
1320
|
-
console.log("Update event received for view authoredit", data);
|
|
1321
|
-
const script = document.getElementById('test-script-id');
|
|
1322
|
-
const closestDiv = script?.closest(
|
|
1323
|
-
'div[data-sc-embed-viewname="authoredit"]'
|
|
1324
|
-
);
|
|
1325
|
-
if (data.updates) {
|
|
1326
|
-
if (closestDiv) await common_done({set_fields: data.updates, no_onchange: true}, closestDiv);
|
|
1327
|
-
else await common_done({set_fields: data.updates, no_onchange: true}, "authoredit");
|
|
1328
|
-
}
|
|
1329
|
-
if (data.actions) {
|
|
1330
|
-
for (const action of data.actions) {
|
|
1331
|
-
if (closestDiv) await common_done(action, closestDiv);
|
|
1332
|
-
else await common_done(action, "authoredit");
|
|
1333
|
-
}
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
};
|
|
1338
|
-
init_collab_room('authoredit', collabCfg);});</script></div></div></div><div class=\"card shadow mt-2\"><div class=\"card-body\"><div class=\"d-inline\" data-sc-embed-viewname=\"authoredit\" data-sc-view-source=\"/view/authoredit?id=1\"><form data-viewname=\"authoredit\" action=\"javascript:void(0)\" onsubmit=\"javascript:formSubmit(this, '/view/', 'authoredit')\" class=\"form-namespace \" method=\"post\" data-row-values=\"%7B%22_creating%22%3Afalse%2C%22user%22%3A%7B%22email%22%3A%22admin%40foo.com%22%2C%22id%22%3A1%2C%22role_id%22%3A1%2C%22language%22%3Anull%2C%22tenant%22%3A%22public%22%2C%22attributes%22%3A%7B%7D%7D%2C%22author%22%3A%22Herman%20Melville%22%2C%22pages%22%3A967%2C%22publisher%22%3Anull%7D\" id="test-form-id"><input type=\"hidden\" name=\"_csrf\" value=\"false\"><input type=\"hidden\" class=\"form-control \" name=\"id\" value=\"1\"><input type=\"text\" class=\"form-control \" data-fieldname=\"author\" name=\"author\" required id=\"inputauthor\" value=\"Herman Melville\"></form><script>(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const editForm = document.getElementById('test-form-id'); if (editForm) editForm.addEventListener("change", handle_identical_fields, true);});</script><script id="test-script-id">(function(f){if (document.readyState === "complete") f(); else document.addEventListener('DOMContentLoaded',()=>setTimeout(f),false)})(function(){const collabCfg = {
|
|
1339
|
-
events: {
|
|
1340
|
-
'authoredit_UPDATE_EVENT?id=1': async (data) => {
|
|
1341
|
-
console.log("Update event received for view authoredit", data);
|
|
1342
|
-
const script = document.getElementById('test-script-id');
|
|
1343
|
-
const closestDiv = script?.closest(
|
|
1344
|
-
'div[data-sc-embed-viewname="authoredit"]'
|
|
1345
|
-
);
|
|
1346
|
-
if (data.updates) {
|
|
1347
|
-
if (closestDiv) await common_done({set_fields: data.updates, no_onchange: true}, closestDiv);
|
|
1348
|
-
else await common_done({set_fields: data.updates, no_onchange: true}, "authoredit");
|
|
1349
|
-
}
|
|
1350
|
-
if (data.actions) {
|
|
1351
|
-
for (const action of data.actions) {
|
|
1352
|
-
if (closestDiv) await common_done(action, closestDiv);
|
|
1353
|
-
else await common_done(action, "authoredit");
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
};
|
|
1359
|
-
init_collab_room('authoredit', collabCfg);});</script></div></div></div></div></div>`,
|
|
1360
|
-
});
|
|
1361
|
-
});
|
|
1362
|
-
});
|
|
1363
|
-
//# sourceMappingURL=exact_views.test.js.map
|