@saltcorn/data 0.9.4-beta.10 → 0.9.4-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/base-plugin/actions.d.ts +59 -3
  2. package/dist/base-plugin/actions.d.ts.map +1 -1
  3. package/dist/base-plugin/actions.js +17 -3
  4. package/dist/base-plugin/actions.js.map +1 -1
  5. package/dist/base-plugin/index.d.ts +227 -227
  6. package/dist/base-plugin/viewtemplates/edit.d.ts.map +1 -1
  7. package/dist/base-plugin/viewtemplates/edit.js +29 -4
  8. package/dist/base-plugin/viewtemplates/edit.js.map +1 -1
  9. package/dist/base-plugin/viewtemplates/filter.js +2 -2
  10. package/dist/base-plugin/viewtemplates/filter.js.map +1 -1
  11. package/dist/base-plugin/viewtemplates/show.d.ts.map +1 -1
  12. package/dist/base-plugin/viewtemplates/show.js +32 -4
  13. package/dist/base-plugin/viewtemplates/show.js.map +1 -1
  14. package/dist/base-plugin/viewtemplates/viewable_fields.js +1 -1
  15. package/dist/base-plugin/viewtemplates/viewable_fields.js.map +1 -1
  16. package/dist/migrations/202402071125.d.ts +2 -0
  17. package/dist/migrations/202402071125.d.ts.map +1 -0
  18. package/dist/migrations/202402071125.js +4 -0
  19. package/dist/migrations/202402071125.js.map +1 -0
  20. package/dist/models/index.d.ts +1 -1
  21. package/dist/models/page_group.d.ts +1 -0
  22. package/dist/models/page_group.d.ts.map +1 -1
  23. package/dist/models/page_group.js +1 -0
  24. package/dist/models/page_group.js.map +1 -1
  25. package/dist/plugin-helper.d.ts +1 -0
  26. package/dist/tests/edit.test.js +204 -0
  27. package/dist/tests/edit.test.js.map +1 -1
  28. package/dist/tests/show.test.d.ts +2 -0
  29. package/dist/tests/show.test.d.ts.map +1 -0
  30. package/dist/tests/show.test.js +325 -0
  31. package/dist/tests/show.test.js.map +1 -0
  32. package/dist/tests/view.test.js +9 -1
  33. package/dist/tests/view.test.js.map +1 -1
  34. package/dist/utils.d.ts +2 -2
  35. package/package.json +8 -8
@@ -805,45 +805,63 @@ export const types: ({
805
805
  export const viewtemplates: ({
806
806
  name: string;
807
807
  description: string;
808
- get_state_fields: () => object[];
809
- configuration_workflow: () => import("../models/workflow");
810
- run: (table_id: number, viewname: string, { columns, layout }: {
808
+ configuration_workflow: (req: object) => import("../models/workflow");
809
+ run: (table_id: string | number, viewname: string, { columns, view_to_create, create_view_display, create_view_label, default_state, create_view_location, create_link_style, create_link_size, create_view_showif, }: {
811
810
  columns: object[];
812
- layout: object;
813
- }, state: object, extra: object, { distinctValuesQuery }: {
814
- distinctValuesQuery: any;
815
- }) => Promise<Layout>;
816
- initial_config: () => Promise<object>;
817
- display_state_form: boolean;
818
- getStringsForI18n({ layout }: {
819
- layout: any;
820
- }): string[];
811
+ view_to_create?: string | undefined;
812
+ create_view_display: string;
813
+ create_view_label?: string | undefined;
814
+ default_state?: object | undefined;
815
+ create_view_location?: string | undefined;
816
+ }, stateWithId?: object | undefined, extraOpts: object, { listQuery }: {
817
+ listQuery: any;
818
+ }) => Promise<any>;
819
+ view_quantity: string;
820
+ get_state_fields: (table_id: string, viewname: any, { columns }: {
821
+ columns: object[];
822
+ }) => Function;
823
+ initial_config: Function;
824
+ on_delete: (table_id: any, viewname: string, { default_state }: {
825
+ default_state: any;
826
+ }) => Promise<void>;
821
827
  routes: {
822
- run_action: (table_id: any, viewname: any, config: any, body: any, { req, res }: {
823
- req: any;
828
+ run_action: (table_id: number, viewname: any, { columns, layout }: {
829
+ columns: object[];
830
+ layout: any;
831
+ }, body: object, { req, res }: {
832
+ req: object;
824
833
  res: any;
825
- }, { actionQuery }: {
826
- actionQuery: any;
827
- }) => Promise<any>;
834
+ }, { getRowQuery }: {
835
+ getRowQuery: any;
836
+ }) => Promise<object>;
828
837
  };
829
- queries: ({ table_id, viewname, configuration: { columns }, req, res, exttable_name, }: {
838
+ display_state_form: (opts: object) => boolean;
839
+ default_state_form: ({ default_state }: object) => boolean;
840
+ getStringsForI18n({ columns, create_view_label }: {
841
+ columns: any;
842
+ create_view_label: any;
843
+ }): string[];
844
+ queries: ({ table_id, exttable_name, name, configuration: { columns, default_state }, req, }: {
830
845
  table_id: any;
831
- viewname: any;
846
+ exttable_name: any;
847
+ name: any;
832
848
  configuration: {
833
849
  columns: any;
850
+ default_state: any;
834
851
  };
835
852
  req: any;
836
- res: any;
837
- exttable_name: any;
838
853
  }) => {
839
- actionQuery(state: any, rndid: any): Promise<{
840
- json: any;
841
- }>;
842
- distinctValuesQuery(state: any): Promise<{
843
- distinct_values: {};
844
- role: any;
854
+ listQuery(state: any, stateHash: any): Promise<{
855
+ rows: import("@saltcorn/db-common/internal").Row[];
856
+ rowCount: number;
845
857
  }>;
858
+ getRowQuery(id: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
846
859
  };
860
+ configCheck: (view: any) => Promise<{
861
+ errors: string[];
862
+ warnings: string[];
863
+ }>;
864
+ connectedObjects: (configuration: any) => Promise<import("@saltcorn/types/base_types").ConnectedObjects>;
847
865
  } | {
848
866
  name: string;
849
867
  description: string;
@@ -995,146 +1013,6 @@ export const viewtemplates: ({
995
1013
  warnings: string[];
996
1014
  }>;
997
1015
  connectedObjects: (configuration: any) => Promise<import("@saltcorn/types/base_types").ConnectedObjects>;
998
- } | {
999
- name: string;
1000
- description: string;
1001
- configuration_workflow: (req: object) => import("../models/workflow");
1002
- run: (table_id: string, viewname: string, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: {
1003
- participant_field: string;
1004
- msg_relation: string;
1005
- msgsender_field: any;
1006
- msgview: string;
1007
- msgform: string;
1008
- participant_maxread_field: string;
1009
- }, state: object, { req, res }: {
1010
- req: object;
1011
- res: object;
1012
- }, { getRowQuery, updateQuery, optionsQuery }: {
1013
- getRowQuery: any;
1014
- updateQuery: any;
1015
- optionsQuery: any;
1016
- }) => Promise<div>;
1017
- get_state_fields: () => object[];
1018
- display_state_form: boolean;
1019
- routes: {
1020
- submit_msg_ajax: (table_id: any, viewname: string, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: {
1021
- participant_field: string;
1022
- msg_relation: string;
1023
- msgsender_field: any;
1024
- msgview: string;
1025
- msgform: string;
1026
- participant_maxread_field: string;
1027
- }, body: any, { req, res }: {
1028
- req: object;
1029
- res: object;
1030
- }, { submitAjaxQuery }: {
1031
- submitAjaxQuery: any;
1032
- }) => Promise<object>;
1033
- ack_read: (table_id: any, viewname: any, { participant_field, participant_maxread_field }: {
1034
- participant_field: string;
1035
- participant_maxread_field: string;
1036
- }, body: any, { req, res }: {
1037
- req: object;
1038
- res: object;
1039
- }, { ackReadQuery }: {
1040
- ackReadQuery: any;
1041
- }) => Promise<void>;
1042
- fetch_older_msg: (table_id: any, viewname: any, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: object, body: object, { req, res }: string, { fetchOlderMsgQuery }: any) => Promise<object>;
1043
- };
1044
- noAutoTest: boolean;
1045
- authorize_join: ({ table_id, min_role, configuration: { participant_field } }: {
1046
- participant_field: object;
1047
- }, room_id: string, user: object) => Promise<object>;
1048
- virtual_triggers: (table_id: any, viewname: string, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: {
1049
- participant_field: any;
1050
- msg_relation: string;
1051
- msgsender_field: string;
1052
- msgview: string;
1053
- msgform: any;
1054
- participant_maxread_field: any;
1055
- }) => object[];
1056
- getStringsForI18n(): object[];
1057
- queries: ({ table_id, viewname, configuration: { columns, default_state }, req, }: {
1058
- table_id: any;
1059
- viewname: any;
1060
- configuration: {
1061
- columns: any;
1062
- default_state: any;
1063
- };
1064
- req: any;
1065
- }) => {
1066
- getRowQuery(state_id: any, part_table_name: any, part_user_field: any, part_key_to_room: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
1067
- updateQuery(partRow: any, part_table_name: any, max_read_id: any, part_maxread_field: any): Promise<void>;
1068
- submitAjaxQuery(msg_relation: any, participant_field: any, body: any, msgform: any, msgsender_field: any, participant_maxread_field: any): Promise<{
1069
- json: {
1070
- msgid: {
1071
- error: string;
1072
- } | {
1073
- success: any;
1074
- };
1075
- error?: undefined;
1076
- };
1077
- } | {
1078
- json: {
1079
- error: any;
1080
- msgid?: undefined;
1081
- };
1082
- }>;
1083
- ackReadQuery(participant_field: any, participant_maxread_field: any, body: any): Promise<{
1084
- json: {
1085
- error: string;
1086
- success?: undefined;
1087
- };
1088
- } | {
1089
- json: {
1090
- success: string;
1091
- error?: undefined;
1092
- };
1093
- }>;
1094
- fetchOlderMsgQuery(participant_field: any, body: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
1095
- optionsQuery(reftable_name: any, type: any, attributes: any, where: any): Promise<any>;
1096
- };
1097
- connectedObjects: (configuration: any) => Promise<import("@saltcorn/types/base_types").ConnectedObjects>;
1098
- } | {
1099
- name: string;
1100
- description: string;
1101
- configuration_workflow: (req: object) => import("../models/workflow");
1102
- run: (table_id: number, viewname: string, { show_view, order_field, descending, view_to_create, create_view_display, in_card, view_decoration, initial_open_accordions, title_formula, masonry_columns, rows_per_page, hide_pagination, create_view_label, create_view_location, create_link_style, create_link_size, create_view_showif, always_create_view, include_fml, exclusion_relation, exclusion_where, empty_view, groupby, ...cols }: {
1103
- show_view: string;
1104
- order_field: void;
1105
- descending: boolean;
1106
- view_to_create?: string | undefined;
1107
- create_view_display: string;
1108
- in_card: boolean;
1109
- masonry_columns: string;
1110
- rows_per_page?: number | undefined;
1111
- hide_pagination: boolean;
1112
- create_view_label?: string | undefined;
1113
- create_view_location?: string | undefined;
1114
- always_create_view: boolean;
1115
- cols: any;
1116
- }, state: object, extraArgs: any, { countRowsQuery }: {
1117
- countRowsQuery: any;
1118
- }) => Promise<div>;
1119
- get_state_fields: (table_id: number, viewname: any, { show_view }: {
1120
- show_view: any;
1121
- }) => Promise<import("../models/field")>;
1122
- display_state_form: boolean;
1123
- getStringsForI18n({ create_view_label }: {
1124
- create_view_label: any;
1125
- }): string[] | Object[];
1126
- queries: ({ table_id, viewname, configuration: { columns, default_state }, req, }: {
1127
- table_id: any;
1128
- viewname: any;
1129
- configuration: {
1130
- columns: any;
1131
- default_state: any;
1132
- };
1133
- req: any;
1134
- }) => {
1135
- countRowsQuery(state: any): Promise<number>;
1136
- };
1137
- connectedObjects: (configuration: any) => Promise<import("@saltcorn/types/base_types").ConnectedObjects>;
1138
1016
  } | {
1139
1017
  name: string;
1140
1018
  description: string;
@@ -1210,66 +1088,6 @@ export const viewtemplates: ({
1210
1088
  warnings: string[];
1211
1089
  }>;
1212
1090
  connectedObjects: (configuration: any) => Promise<import("@saltcorn/types/base_types").ConnectedObjects>;
1213
- } | {
1214
- name: string;
1215
- description: string;
1216
- configuration_workflow: (req: object) => import("../models/workflow");
1217
- run: (table_id: string | number, viewname: string, { columns, view_to_create, create_view_display, create_view_label, default_state, create_view_location, create_link_style, create_link_size, create_view_showif, }: {
1218
- columns: object[];
1219
- view_to_create?: string | undefined;
1220
- create_view_display: string;
1221
- create_view_label?: string | undefined;
1222
- default_state?: object | undefined;
1223
- create_view_location?: string | undefined;
1224
- }, stateWithId?: object | undefined, extraOpts: object, { listQuery }: {
1225
- listQuery: any;
1226
- }) => Promise<any>;
1227
- view_quantity: string;
1228
- get_state_fields: (table_id: string, viewname: any, { columns }: {
1229
- columns: object[];
1230
- }) => Function;
1231
- initial_config: Function;
1232
- on_delete: (table_id: any, viewname: string, { default_state }: {
1233
- default_state: any;
1234
- }) => Promise<void>;
1235
- routes: {
1236
- run_action: (table_id: number, viewname: any, { columns, layout }: {
1237
- columns: object[];
1238
- layout: any;
1239
- }, body: object, { req, res }: {
1240
- req: object;
1241
- res: any;
1242
- }, { getRowQuery }: {
1243
- getRowQuery: any;
1244
- }) => Promise<object>;
1245
- };
1246
- display_state_form: (opts: object) => boolean;
1247
- default_state_form: ({ default_state }: object) => boolean;
1248
- getStringsForI18n({ columns, create_view_label }: {
1249
- columns: any;
1250
- create_view_label: any;
1251
- }): string[];
1252
- queries: ({ table_id, exttable_name, name, configuration: { columns, default_state }, req, }: {
1253
- table_id: any;
1254
- exttable_name: any;
1255
- name: any;
1256
- configuration: {
1257
- columns: any;
1258
- default_state: any;
1259
- };
1260
- req: any;
1261
- }) => {
1262
- listQuery(state: any, stateHash: any): Promise<{
1263
- rows: import("@saltcorn/db-common/internal").Row[];
1264
- rowCount: number;
1265
- }>;
1266
- getRowQuery(id: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
1267
- };
1268
- configCheck: (view: any) => Promise<{
1269
- errors: string[];
1270
- warnings: string[];
1271
- }>;
1272
- connectedObjects: (configuration: any) => Promise<import("@saltcorn/types/base_types").ConnectedObjects>;
1273
1091
  } | {
1274
1092
  name: string;
1275
1093
  description: string;
@@ -1306,6 +1124,188 @@ export const viewtemplates: ({
1306
1124
  }) => Promise<{
1307
1125
  embeddedViews: import("../models/view")[];
1308
1126
  }>;
1127
+ } | {
1128
+ name: string;
1129
+ description: string;
1130
+ configuration_workflow: (req: object) => import("../models/workflow");
1131
+ run: (table_id: number, viewname: string, { show_view, order_field, descending, view_to_create, create_view_display, in_card, view_decoration, initial_open_accordions, title_formula, masonry_columns, rows_per_page, hide_pagination, create_view_label, create_view_location, create_link_style, create_link_size, create_view_showif, always_create_view, include_fml, exclusion_relation, exclusion_where, empty_view, groupby, ...cols }: {
1132
+ show_view: string;
1133
+ order_field: void;
1134
+ descending: boolean;
1135
+ view_to_create?: string | undefined;
1136
+ create_view_display: string;
1137
+ in_card: boolean;
1138
+ masonry_columns: string;
1139
+ rows_per_page?: number | undefined;
1140
+ hide_pagination: boolean;
1141
+ create_view_label?: string | undefined;
1142
+ create_view_location?: string | undefined;
1143
+ always_create_view: boolean;
1144
+ cols: any;
1145
+ }, state: object, extraArgs: any, { countRowsQuery }: {
1146
+ countRowsQuery: any;
1147
+ }) => Promise<div>;
1148
+ get_state_fields: (table_id: number, viewname: any, { show_view }: {
1149
+ show_view: any;
1150
+ }) => Promise<import("../models/field")>;
1151
+ display_state_form: boolean;
1152
+ getStringsForI18n({ create_view_label }: {
1153
+ create_view_label: any;
1154
+ }): string[] | Object[];
1155
+ queries: ({ table_id, viewname, configuration: { columns, default_state }, req, }: {
1156
+ table_id: any;
1157
+ viewname: any;
1158
+ configuration: {
1159
+ columns: any;
1160
+ default_state: any;
1161
+ };
1162
+ req: any;
1163
+ }) => {
1164
+ countRowsQuery(state: any): Promise<number>;
1165
+ };
1166
+ connectedObjects: (configuration: any) => Promise<import("@saltcorn/types/base_types").ConnectedObjects>;
1167
+ } | {
1168
+ name: string;
1169
+ description: string;
1170
+ get_state_fields: () => object[];
1171
+ configuration_workflow: () => import("../models/workflow");
1172
+ run: (table_id: number, viewname: string, { columns, layout }: {
1173
+ columns: object[];
1174
+ layout: object;
1175
+ }, state: object, extra: object, { distinctValuesQuery }: {
1176
+ distinctValuesQuery: any;
1177
+ }) => Promise<Layout>;
1178
+ initial_config: () => Promise<object>;
1179
+ display_state_form: boolean;
1180
+ getStringsForI18n({ layout }: {
1181
+ layout: any;
1182
+ }): string[];
1183
+ routes: {
1184
+ run_action: (table_id: any, viewname: any, config: any, body: any, { req, res }: {
1185
+ req: any;
1186
+ res: any;
1187
+ }, { actionQuery }: {
1188
+ actionQuery: any;
1189
+ }) => Promise<any>;
1190
+ };
1191
+ queries: ({ table_id, viewname, configuration: { columns }, req, res, exttable_name, }: {
1192
+ table_id: any;
1193
+ viewname: any;
1194
+ configuration: {
1195
+ columns: any;
1196
+ };
1197
+ req: any;
1198
+ res: any;
1199
+ exttable_name: any;
1200
+ }) => {
1201
+ actionQuery(state: any, rndid: any): Promise<{
1202
+ json: any;
1203
+ }>;
1204
+ distinctValuesQuery(state: any): Promise<{
1205
+ distinct_values: {};
1206
+ role: any;
1207
+ }>;
1208
+ };
1209
+ } | {
1210
+ name: string;
1211
+ description: string;
1212
+ configuration_workflow: (req: object) => import("../models/workflow");
1213
+ run: (table_id: string, viewname: string, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: {
1214
+ participant_field: string;
1215
+ msg_relation: string;
1216
+ msgsender_field: any;
1217
+ msgview: string;
1218
+ msgform: string;
1219
+ participant_maxread_field: string;
1220
+ }, state: object, { req, res }: {
1221
+ req: object;
1222
+ res: object;
1223
+ }, { getRowQuery, updateQuery, optionsQuery }: {
1224
+ getRowQuery: any;
1225
+ updateQuery: any;
1226
+ optionsQuery: any;
1227
+ }) => Promise<div>;
1228
+ get_state_fields: () => object[];
1229
+ display_state_form: boolean;
1230
+ routes: {
1231
+ submit_msg_ajax: (table_id: any, viewname: string, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: {
1232
+ participant_field: string;
1233
+ msg_relation: string;
1234
+ msgsender_field: any;
1235
+ msgview: string;
1236
+ msgform: string;
1237
+ participant_maxread_field: string;
1238
+ }, body: any, { req, res }: {
1239
+ req: object;
1240
+ res: object;
1241
+ }, { submitAjaxQuery }: {
1242
+ submitAjaxQuery: any;
1243
+ }) => Promise<object>;
1244
+ ack_read: (table_id: any, viewname: any, { participant_field, participant_maxread_field }: {
1245
+ participant_field: string;
1246
+ participant_maxread_field: string;
1247
+ }, body: any, { req, res }: {
1248
+ req: object;
1249
+ res: object;
1250
+ }, { ackReadQuery }: {
1251
+ ackReadQuery: any;
1252
+ }) => Promise<void>;
1253
+ fetch_older_msg: (table_id: any, viewname: any, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: object, body: object, { req, res }: string, { fetchOlderMsgQuery }: any) => Promise<object>;
1254
+ };
1255
+ noAutoTest: boolean;
1256
+ authorize_join: ({ table_id, min_role, configuration: { participant_field } }: {
1257
+ participant_field: object;
1258
+ }, room_id: string, user: object) => Promise<object>;
1259
+ virtual_triggers: (table_id: any, viewname: string, { participant_field, msg_relation, msgsender_field, msgview, msgform, participant_maxread_field, }: {
1260
+ participant_field: any;
1261
+ msg_relation: string;
1262
+ msgsender_field: string;
1263
+ msgview: string;
1264
+ msgform: any;
1265
+ participant_maxread_field: any;
1266
+ }) => object[];
1267
+ getStringsForI18n(): object[];
1268
+ queries: ({ table_id, viewname, configuration: { columns, default_state }, req, }: {
1269
+ table_id: any;
1270
+ viewname: any;
1271
+ configuration: {
1272
+ columns: any;
1273
+ default_state: any;
1274
+ };
1275
+ req: any;
1276
+ }) => {
1277
+ getRowQuery(state_id: any, part_table_name: any, part_user_field: any, part_key_to_room: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
1278
+ updateQuery(partRow: any, part_table_name: any, max_read_id: any, part_maxread_field: any): Promise<void>;
1279
+ submitAjaxQuery(msg_relation: any, participant_field: any, body: any, msgform: any, msgsender_field: any, participant_maxread_field: any): Promise<{
1280
+ json: {
1281
+ msgid: {
1282
+ error: string;
1283
+ } | {
1284
+ success: any;
1285
+ };
1286
+ error?: undefined;
1287
+ };
1288
+ } | {
1289
+ json: {
1290
+ error: any;
1291
+ msgid?: undefined;
1292
+ };
1293
+ }>;
1294
+ ackReadQuery(participant_field: any, participant_maxread_field: any, body: any): Promise<{
1295
+ json: {
1296
+ error: string;
1297
+ success?: undefined;
1298
+ };
1299
+ } | {
1300
+ json: {
1301
+ success: string;
1302
+ error?: undefined;
1303
+ };
1304
+ }>;
1305
+ fetchOlderMsgQuery(participant_field: any, body: any): Promise<import("@saltcorn/db-common/internal").Row | null>;
1306
+ optionsQuery(reftable_name: any, type: any, attributes: any, where: any): Promise<any>;
1307
+ };
1308
+ connectedObjects: (configuration: any) => Promise<import("@saltcorn/types/base_types").ConnectedObjects>;
1309
1309
  })[];
1310
1310
  import fileviews = require("./fileviews");
1311
1311
  import actions = require("./actions");
@@ -1 +1 @@
1
- {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../base-plugin/viewtemplates/edit.js"],"names":[],"mappings":"AAkGA;;;GAGG;AAEH,4CAJW,MAAM,GACJ,QAAQ,CA8VjB;AA+CJ;;;;;;;;;;;GAWG;AACH,8BAXW,MAAM,YACN,MAAM,mBAIN,MAAM;IAEU,GAAG,EAAnB,MAAM;IACU,GAAG,EAAnB,MAAM;;;IACJ,QAAQ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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4TP;;;;;AAEF,sGAsBC;AAtBD,sGAsBC;AACY;;;GA2DZ;AACiB,6HAEjB"}
@@ -471,6 +471,11 @@ const transformForm = async ({ form, table, req, row, res, getRowQuery, viewname
471
471
  });
472
472
  }
473
473
  await traverse(form.layout, {
474
+ container(segment) {
475
+ if (segment.click_action) {
476
+ segment.url = `javascript:view_post('${viewname}', 'run_action', {click_action: '${segment.click_action}', ...get_form_record({viewname: '${viewname}'}) })`;
477
+ }
478
+ },
474
479
  async action(segment) {
475
480
  if (segment.action_style === "on_page_load") {
476
481
  //TODO check segment.min_role
@@ -482,7 +487,7 @@ const transformForm = async ({ form, table, req, row, res, getRowQuery, viewname
482
487
  try {
483
488
  const actionResult = await run_action_column({
484
489
  col: { ...segment },
485
- referrer: req.get("Referrer"),
490
+ referrer: req?.get?.("Referrer"),
486
491
  req,
487
492
  res,
488
493
  table,
@@ -1521,7 +1526,7 @@ module.exports = {
1521
1526
  });
1522
1527
  },
1523
1528
  async actionQuery() {
1524
- const { rndid, _csrf, onchange_action, onchange_field, ...body } = req.body;
1529
+ const { rndid, _csrf, onchange_action, onchange_field, click_action, ...body } = req.body;
1525
1530
  const table = Table.findOne({ id: table_id });
1526
1531
  const dbrow = body.id
1527
1532
  ? await table.getRow({ id: body.id }, {
@@ -1531,7 +1536,27 @@ module.exports = {
1531
1536
  : undefined;
1532
1537
  const row = { ...dbrow, ...body };
1533
1538
  try {
1534
- if (onchange_action && !rndid) {
1539
+ if (click_action) {
1540
+ let container;
1541
+ traverseSync(layout, {
1542
+ container(segment) {
1543
+ if (segment.click_action === click_action)
1544
+ container = segment;
1545
+ },
1546
+ });
1547
+ if (!container)
1548
+ return { json: { error: "Action not found" } };
1549
+ const trigger = Trigger.findOne({ name: click_action });
1550
+ const result = await trigger.runWithoutRow({
1551
+ table,
1552
+ Table,
1553
+ req,
1554
+ row,
1555
+ user: req.user,
1556
+ });
1557
+ return { json: { success: "ok", ...(result || {}) } };
1558
+ }
1559
+ else if (onchange_action && !rndid) {
1535
1560
  const fldCol = columns.find((c) => c.field_name === onchange_field &&
1536
1561
  c.onchange_action === onchange_action);
1537
1562
  if (!fldCol)
@@ -1554,7 +1579,7 @@ module.exports = {
1554
1579
  table,
1555
1580
  row,
1556
1581
  res,
1557
- referrer: req.get("Referrer"),
1582
+ referrer: req?.get?.("Referrer"),
1558
1583
  });
1559
1584
  //console.log("result", result);
1560
1585
  return { json: { success: "ok", ...(result || {}) } };