@gov-cy/govcy-frontend-renderer 1.18.1 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2829,7 +2829,61 @@ kwargs = kwargs || {};
|
|
|
2829
2829
|
if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {
|
|
2830
2830
|
frame.set("caller", kwargs.caller); }
|
|
2831
2831
|
frame.set("params", l_params);
|
|
2832
|
-
var t_2 = "";
|
|
2832
|
+
var t_2 = "";if(runtime.memberLookup((l_params),"enctype") == "application") {
|
|
2833
|
+
var t_3;
|
|
2834
|
+
t_3 = "application/x-www-form-urlencoded";
|
|
2835
|
+
frame.set("enctype", t_3, true);
|
|
2836
|
+
if(frame.topLevel) {
|
|
2837
|
+
context.setVariable("enctype", t_3);
|
|
2838
|
+
}
|
|
2839
|
+
if(frame.topLevel) {
|
|
2840
|
+
context.addExport("enctype", t_3);
|
|
2841
|
+
}
|
|
2842
|
+
;
|
|
2843
|
+
}
|
|
2844
|
+
else {
|
|
2845
|
+
if(runtime.memberLookup((l_params),"enctype") == "multipart") {
|
|
2846
|
+
var t_4;
|
|
2847
|
+
t_4 = "multipart/form-data";
|
|
2848
|
+
frame.set("enctype", t_4, true);
|
|
2849
|
+
if(frame.topLevel) {
|
|
2850
|
+
context.setVariable("enctype", t_4);
|
|
2851
|
+
}
|
|
2852
|
+
if(frame.topLevel) {
|
|
2853
|
+
context.addExport("enctype", t_4);
|
|
2854
|
+
}
|
|
2855
|
+
;
|
|
2856
|
+
}
|
|
2857
|
+
else {
|
|
2858
|
+
if(runtime.memberLookup((l_params),"enctype") == "text") {
|
|
2859
|
+
var t_5;
|
|
2860
|
+
t_5 = "text/plain";
|
|
2861
|
+
frame.set("enctype", t_5, true);
|
|
2862
|
+
if(frame.topLevel) {
|
|
2863
|
+
context.setVariable("enctype", t_5);
|
|
2864
|
+
}
|
|
2865
|
+
if(frame.topLevel) {
|
|
2866
|
+
context.addExport("enctype", t_5);
|
|
2867
|
+
}
|
|
2868
|
+
;
|
|
2869
|
+
}
|
|
2870
|
+
else {
|
|
2871
|
+
var t_6;
|
|
2872
|
+
t_6 = false;
|
|
2873
|
+
frame.set("enctype", t_6, true);
|
|
2874
|
+
if(frame.topLevel) {
|
|
2875
|
+
context.setVariable("enctype", t_6);
|
|
2876
|
+
}
|
|
2877
|
+
if(frame.topLevel) {
|
|
2878
|
+
context.addExport("enctype", t_6);
|
|
2879
|
+
}
|
|
2880
|
+
;
|
|
2881
|
+
}
|
|
2882
|
+
;
|
|
2883
|
+
}
|
|
2884
|
+
;
|
|
2885
|
+
}
|
|
2886
|
+
t_2 += "<form ";
|
|
2833
2887
|
if(runtime.memberLookup((l_params),"id")) {
|
|
2834
2888
|
t_2 += "id=\"";
|
|
2835
2889
|
t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"id"), env.opts.autoescape);
|
|
@@ -2842,6 +2896,12 @@ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"method"), env.opts
|
|
|
2842
2896
|
t_2 += "\" ";
|
|
2843
2897
|
;
|
|
2844
2898
|
}
|
|
2899
|
+
if(runtime.contextOrFrameLookup(context, frame, "enctype")) {
|
|
2900
|
+
t_2 += " enctype=\"";
|
|
2901
|
+
t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "enctype"), env.opts.autoescape);
|
|
2902
|
+
t_2 += "\" ";
|
|
2903
|
+
;
|
|
2904
|
+
}
|
|
2845
2905
|
t_2 += "action=\"";
|
|
2846
2906
|
t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"action"), env.opts.autoescape);
|
|
2847
2907
|
t_2 += "\" class=\"govcy-form";
|
|
@@ -2851,33 +2911,33 @@ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"classes"), env.opt
|
|
|
2851
2911
|
;
|
|
2852
2912
|
}
|
|
2853
2913
|
t_2 += "\" novalidate=\"\">\n ";
|
|
2854
|
-
t_2 += runtime.suppressValue((lineno =
|
|
2914
|
+
t_2 += runtime.suppressValue((lineno = 28, colno = 13, runtime.callWrap(runtime.contextOrFrameLookup(context, frame, "caller"), "caller", context, [])), env.opts.autoescape);
|
|
2855
2915
|
if(runtime.memberLookup((l_params),"elements")) {
|
|
2856
|
-
env.getTemplate("govcyElement.njk", false, "elements/form.njk", false, function(
|
|
2857
|
-
if(
|
|
2858
|
-
|
|
2859
|
-
if(
|
|
2860
|
-
if(Object.prototype.hasOwnProperty.call(
|
|
2861
|
-
var
|
|
2916
|
+
env.getTemplate("govcyElement.njk", false, "elements/form.njk", false, function(t_8,t_7) {
|
|
2917
|
+
if(t_8) { cb(t_8); return; }
|
|
2918
|
+
t_7.getExported(function(t_9,t_7) {
|
|
2919
|
+
if(t_9) { cb(t_9); return; }
|
|
2920
|
+
if(Object.prototype.hasOwnProperty.call(t_7, "govcyElement")) {
|
|
2921
|
+
var t_10 = t_7.govcyElement;
|
|
2862
2922
|
} else {
|
|
2863
2923
|
cb(new Error("cannot import 'govcyElement'")); return;
|
|
2864
2924
|
}
|
|
2865
|
-
context.setVariable("govcyElement",
|
|
2925
|
+
context.setVariable("govcyElement", t_10);
|
|
2866
2926
|
frame = frame.push();
|
|
2867
|
-
var
|
|
2868
|
-
if(
|
|
2869
|
-
var
|
|
2870
|
-
for(var
|
|
2871
|
-
var
|
|
2872
|
-
frame.set("element",
|
|
2873
|
-
frame.set("loop.index",
|
|
2874
|
-
frame.set("loop.index0",
|
|
2875
|
-
frame.set("loop.revindex",
|
|
2876
|
-
frame.set("loop.revindex0",
|
|
2877
|
-
frame.set("loop.first",
|
|
2878
|
-
frame.set("loop.last",
|
|
2879
|
-
frame.set("loop.length",
|
|
2880
|
-
t_2 += runtime.suppressValue((lineno =
|
|
2927
|
+
var t_13 = runtime.memberLookup((l_params),"elements");
|
|
2928
|
+
if(t_13) {t_13 = runtime.fromIterator(t_13);
|
|
2929
|
+
var t_12 = t_13.length;
|
|
2930
|
+
for(var t_11=0; t_11 < t_13.length; t_11++) {
|
|
2931
|
+
var t_14 = t_13[t_11];
|
|
2932
|
+
frame.set("element", t_14);
|
|
2933
|
+
frame.set("loop.index", t_11 + 1);
|
|
2934
|
+
frame.set("loop.index0", t_11);
|
|
2935
|
+
frame.set("loop.revindex", t_12 - t_11);
|
|
2936
|
+
frame.set("loop.revindex0", t_12 - t_11 - 1);
|
|
2937
|
+
frame.set("loop.first", t_11 === 0);
|
|
2938
|
+
frame.set("loop.last", t_11 === t_12 - 1);
|
|
2939
|
+
frame.set("loop.length", t_12);
|
|
2940
|
+
t_2 += runtime.suppressValue((lineno = 34, colno = 33, runtime.callWrap(t_10, "govcyElement", context, [runtime.memberLookup((t_14),"element"),runtime.memberLookup((t_14),"params"),runtime.makeKeywordArgs({"caller": (function (){var macro_t_15 = runtime.makeMacro(
|
|
2881
2941
|
[],
|
|
2882
2942
|
[],
|
|
2883
2943
|
function (kwargs) {
|
|
@@ -2886,11 +2946,11 @@ frame = frame.push(true);
|
|
|
2886
2946
|
kwargs = kwargs || {};
|
|
2887
2947
|
if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {
|
|
2888
2948
|
frame.set("caller", kwargs.caller); }
|
|
2889
|
-
var
|
|
2949
|
+
var t_16 = "";;
|
|
2890
2950
|
frame = frame.pop();
|
|
2891
|
-
return new runtime.SafeString(
|
|
2951
|
+
return new runtime.SafeString(t_16);
|
|
2892
2952
|
});
|
|
2893
|
-
return
|
|
2953
|
+
return macro_t_15;})()})])), env.opts.autoescape);
|
|
2894
2954
|
;
|
|
2895
2955
|
}
|
|
2896
2956
|
}
|
package/package.json
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
@param {string} id The hint id. Will escape text
|
|
4
4
|
@param {string} classes Additional classes to add to the outer div. Optional
|
|
5
5
|
@param {string} method The form method. Will escape text. Optional
|
|
6
|
+
@param {string} enctype The form enctype. Will escape text. Optional. Can be:
|
|
7
|
+
- `application`
|
|
8
|
+
- `multipart`
|
|
9
|
+
- `text`
|
|
6
10
|
@param {array} elements If defined will be rendered elements inside the form.
|
|
7
11
|
i.e. `[
|
|
8
12
|
{element:"button",params:{text:{en:"Button 1",el:"Κουμπί 1"},lang:"en",id:"govcy-test-23b"} },
|
|
@@ -11,7 +15,17 @@
|
|
|
11
15
|
@returns govcy form html
|
|
12
16
|
#}
|
|
13
17
|
{% macro form(params) -%}
|
|
14
|
-
|
|
18
|
+
{#- set default values -#}
|
|
19
|
+
{%- if params.enctype=='application' -%}
|
|
20
|
+
{%- set enctype = 'application/x-www-form-urlencoded' -%}
|
|
21
|
+
{%- elif params.enctype=='multipart' -%}
|
|
22
|
+
{%- set enctype = 'multipart/form-data' -%}
|
|
23
|
+
{%- elif params.enctype=='text' -%}
|
|
24
|
+
{%- set enctype = 'text/plain' -%}
|
|
25
|
+
{%- else -%}
|
|
26
|
+
{%- set enctype = false -%}
|
|
27
|
+
{%- endif -%}
|
|
28
|
+
<form {% if params.id %}id="{{ params.id }}" {% endif %}{% if params.method %} method="{{ params.method }}" {% endif %}{% if enctype %} enctype="{{ enctype }}" {% endif %}action="{{ params.action }}" class="govcy-form{% if params.classes %} {{ params.classes }}{% endif %}" novalidate="">
|
|
15
29
|
{{ caller() }}
|
|
16
30
|
{#- if it has elements to be called -#}
|
|
17
31
|
{%- if params.elements -%}
|