@gov-cy/govcy-frontend-renderer 1.4.0 → 1.5.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.
|
@@ -1203,7 +1203,7 @@ context.addExport("ariaDescribedBy", t_50);
|
|
|
1203
1203
|
}
|
|
1204
1204
|
;
|
|
1205
1205
|
}
|
|
1206
|
-
t_2 += runtime.suppressValue((lineno = 65, colno = 20, runtime.callWrap(t_13, "fieldset", context, [{"ariaDescribedby": runtime.contextOrFrameLookup(context, frame, "ariaDescribedBy"),"classes": runtime.memberLookup((l_params),"classes"),"lang": runtime.memberLookup((l_params),"lang")},runtime.makeKeywordArgs({"caller": (function (){var macro_t_51 = runtime.makeMacro(
|
|
1206
|
+
t_2 += runtime.suppressValue((lineno = 65, colno = 20, runtime.callWrap(t_13, "fieldset", context, [{"ariaDescribedby": runtime.contextOrFrameLookup(context, frame, "ariaDescribedBy"),"classes": runtime.memberLookup((l_params),"classes"),"ariaRole": "group","lang": runtime.memberLookup((l_params),"lang")},runtime.makeKeywordArgs({"caller": (function (){var macro_t_51 = runtime.makeMacro(
|
|
1207
1207
|
[],
|
|
1208
1208
|
[],
|
|
1209
1209
|
function (kwargs) {
|
|
@@ -1881,15 +1881,21 @@ t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"classes"), env.opt
|
|
|
1881
1881
|
;
|
|
1882
1882
|
}
|
|
1883
1883
|
t_2 += "\"";
|
|
1884
|
+
if(runtime.memberLookup((l_params),"ariaRole")) {
|
|
1885
|
+
t_2 += " role=\"";
|
|
1886
|
+
t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"ariaRole"), env.opts.autoescape);
|
|
1887
|
+
t_2 += "\"";
|
|
1888
|
+
;
|
|
1889
|
+
}
|
|
1884
1890
|
if(runtime.memberLookup((l_params),"ariaDescribedby")) {
|
|
1885
1891
|
t_2 += " aria-describedby=\"";
|
|
1886
1892
|
t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"ariaDescribedby"), env.opts.autoescape);
|
|
1887
1893
|
t_2 += "\"";
|
|
1888
1894
|
;
|
|
1889
1895
|
}
|
|
1890
|
-
t_2 += runtime.suppressValue((lineno =
|
|
1896
|
+
t_2 += runtime.suppressValue((lineno = 16, colno = 312, runtime.callWrap(t_7, "govcyLangAttribute", context, [runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
|
|
1891
1897
|
t_2 += ">\n";
|
|
1892
|
-
t_2 += runtime.suppressValue((lineno =
|
|
1898
|
+
t_2 += runtime.suppressValue((lineno = 17, colno = 9, runtime.callWrap(runtime.contextOrFrameLookup(context, frame, "caller"), "caller", context, [])), env.opts.autoescape);
|
|
1893
1899
|
if(runtime.memberLookup((l_params),"elements")) {
|
|
1894
1900
|
env.getTemplate("govcyElement.njk", false, "elements/fieldset.njk", false, function(t_9,t_8) {
|
|
1895
1901
|
if(t_9) { cb(t_9); return; }
|
|
@@ -1915,7 +1921,7 @@ frame.set("loop.revindex0", t_13 - t_12 - 1);
|
|
|
1915
1921
|
frame.set("loop.first", t_12 === 0);
|
|
1916
1922
|
frame.set("loop.last", t_12 === t_13 - 1);
|
|
1917
1923
|
frame.set("loop.length", t_13);
|
|
1918
|
-
t_2 += runtime.suppressValue((lineno =
|
|
1924
|
+
t_2 += runtime.suppressValue((lineno = 23, colno = 33, runtime.callWrap(t_11, "govcyElement", context, [runtime.memberLookup((t_15),"element"),runtime.memberLookup((t_15),"params"),runtime.makeKeywordArgs({"caller": (function (){var macro_t_16 = runtime.makeMacro(
|
|
1919
1925
|
[],
|
|
1920
1926
|
[],
|
|
1921
1927
|
function (kwargs) {
|
|
@@ -4949,6 +4955,184 @@ root: root
|
|
|
4949
4955
|
})();
|
|
4950
4956
|
})();
|
|
4951
4957
|
|
|
4958
|
+
(function() {(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})["elements/taskList.njk"] = (function() {
|
|
4959
|
+
function root(env, context, frame, runtime, cb) {
|
|
4960
|
+
var lineno = 0;
|
|
4961
|
+
var colno = 0;
|
|
4962
|
+
var output = "";
|
|
4963
|
+
try {
|
|
4964
|
+
var parentTemplate = null;
|
|
4965
|
+
output += "\n";
|
|
4966
|
+
var macro_t_1 = runtime.makeMacro(
|
|
4967
|
+
["params"],
|
|
4968
|
+
[],
|
|
4969
|
+
function (l_params, kwargs) {
|
|
4970
|
+
var callerFrame = frame;
|
|
4971
|
+
frame = new runtime.Frame();
|
|
4972
|
+
kwargs = kwargs || {};
|
|
4973
|
+
if (Object.prototype.hasOwnProperty.call(kwargs, "caller")) {
|
|
4974
|
+
frame.set("caller", kwargs.caller); }
|
|
4975
|
+
frame.set("params", l_params);
|
|
4976
|
+
var t_2 = "";if(runtime.memberLookup((l_params),"items")) {
|
|
4977
|
+
env.getTemplate("utilities/govcyUtilities.njk", false, "elements/taskList.njk", false, function(t_4,t_3) {
|
|
4978
|
+
if(t_4) { cb(t_4); return; }
|
|
4979
|
+
t_3.getExported(function(t_5,t_3) {
|
|
4980
|
+
if(t_5) { cb(t_5); return; }
|
|
4981
|
+
if(Object.prototype.hasOwnProperty.call(t_3, "govcyLocalizeContent")) {
|
|
4982
|
+
var t_6 = t_3.govcyLocalizeContent;
|
|
4983
|
+
} else {
|
|
4984
|
+
cb(new Error("cannot import 'govcyLocalizeContent'")); return;
|
|
4985
|
+
}
|
|
4986
|
+
context.setVariable("govcyLocalizeContent", t_6);
|
|
4987
|
+
if(Object.prototype.hasOwnProperty.call(t_3, "govcyLangAttribute")) {
|
|
4988
|
+
var t_7 = t_3.govcyLangAttribute;
|
|
4989
|
+
} else {
|
|
4990
|
+
cb(new Error("cannot import 'govcyLangAttribute'")); return;
|
|
4991
|
+
}
|
|
4992
|
+
context.setVariable("govcyLangAttribute", t_7);
|
|
4993
|
+
if(runtime.memberLookup((l_params),"visuallyHiddenStatus")) {
|
|
4994
|
+
var t_8;
|
|
4995
|
+
t_8 = (function() {
|
|
4996
|
+
var output = "";
|
|
4997
|
+
output += runtime.suppressValue((lineno = 39, colno = 65, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((l_params),"visuallyHiddenStatus"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
|
|
4998
|
+
;
|
|
4999
|
+
return output;
|
|
5000
|
+
})()
|
|
5001
|
+
;
|
|
5002
|
+
frame.set("visuallyHiddenStatus", t_8, true);
|
|
5003
|
+
if(frame.topLevel) {
|
|
5004
|
+
context.setVariable("visuallyHiddenStatus", t_8);
|
|
5005
|
+
}
|
|
5006
|
+
if(frame.topLevel) {
|
|
5007
|
+
context.addExport("visuallyHiddenStatus", t_8);
|
|
5008
|
+
}
|
|
5009
|
+
;
|
|
5010
|
+
}
|
|
5011
|
+
else {
|
|
5012
|
+
var t_9;
|
|
5013
|
+
t_9 = (function() {
|
|
5014
|
+
var output = "";
|
|
5015
|
+
output += runtime.suppressValue((lineno = 41, colno = 65, runtime.callWrap(t_6, "govcyLocalizeContent", context, [{"en": "with status ","el": "με κατάσταση "},runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
|
|
5016
|
+
;
|
|
5017
|
+
return output;
|
|
5018
|
+
})()
|
|
5019
|
+
;
|
|
5020
|
+
frame.set("visuallyHiddenStatus", t_9, true);
|
|
5021
|
+
if(frame.topLevel) {
|
|
5022
|
+
context.setVariable("visuallyHiddenStatus", t_9);
|
|
5023
|
+
}
|
|
5024
|
+
if(frame.topLevel) {
|
|
5025
|
+
context.addExport("visuallyHiddenStatus", t_9);
|
|
5026
|
+
}
|
|
5027
|
+
;
|
|
5028
|
+
}
|
|
5029
|
+
t_2 += "\n <table class=\"govcy-table";
|
|
5030
|
+
if(runtime.memberLookup((l_params),"classes")) {
|
|
5031
|
+
t_2 += " ";
|
|
5032
|
+
t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"classes"), env.opts.autoescape);
|
|
5033
|
+
;
|
|
5034
|
+
}
|
|
5035
|
+
t_2 += "\"";
|
|
5036
|
+
if(runtime.memberLookup((l_params),"id")) {
|
|
5037
|
+
t_2 += " id=\"";
|
|
5038
|
+
t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"id"), env.opts.autoescape);
|
|
5039
|
+
t_2 += "\"";
|
|
5040
|
+
;
|
|
5041
|
+
}
|
|
5042
|
+
t_2 += runtime.suppressValue((lineno = 43, colno = 156, runtime.callWrap(t_7, "govcyLangAttribute", context, [runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
|
|
5043
|
+
t_2 += ">\n <tbody>";
|
|
5044
|
+
frame = frame.push();
|
|
5045
|
+
var t_12 = runtime.memberLookup((l_params),"items");
|
|
5046
|
+
if(t_12) {t_12 = runtime.fromIterator(t_12);
|
|
5047
|
+
var t_11 = t_12.length;
|
|
5048
|
+
for(var t_10=0; t_10 < t_12.length; t_10++) {
|
|
5049
|
+
var t_13 = t_12[t_10];
|
|
5050
|
+
frame.set("item", t_13);
|
|
5051
|
+
frame.set("loop.index", t_10 + 1);
|
|
5052
|
+
frame.set("loop.index0", t_10);
|
|
5053
|
+
frame.set("loop.revindex", t_11 - t_10);
|
|
5054
|
+
frame.set("loop.revindex0", t_11 - t_10 - 1);
|
|
5055
|
+
frame.set("loop.first", t_10 === 0);
|
|
5056
|
+
frame.set("loop.last", t_10 === t_11 - 1);
|
|
5057
|
+
frame.set("loop.length", t_11);
|
|
5058
|
+
if(t_13) {
|
|
5059
|
+
if(runtime.memberLookup((t_13),"task") && runtime.memberLookup((t_13),"status")) {
|
|
5060
|
+
t_2 += "\n <tr";
|
|
5061
|
+
if(runtime.memberLookup((l_params),"id")) {
|
|
5062
|
+
t_2 += " id=\"";
|
|
5063
|
+
t_2 += runtime.suppressValue(runtime.memberLookup((l_params),"id"), env.opts.autoescape);
|
|
5064
|
+
t_2 += "-row-";
|
|
5065
|
+
t_2 += runtime.suppressValue(runtime.memberLookup((runtime.contextOrFrameLookup(context, frame, "loop")),"index"), env.opts.autoescape);
|
|
5066
|
+
t_2 += "\"";
|
|
5067
|
+
;
|
|
5068
|
+
}
|
|
5069
|
+
t_2 += ">\n <td classes=\"govcy-valign-top\">\n ";
|
|
5070
|
+
if(runtime.memberLookup((runtime.memberLookup((t_13),"task")),"link")) {
|
|
5071
|
+
t_2 += "<a href=\"";
|
|
5072
|
+
t_2 += runtime.suppressValue(runtime.memberLookup((runtime.memberLookup((t_13),"task")),"link"), env.opts.autoescape);
|
|
5073
|
+
t_2 += "\">";
|
|
5074
|
+
;
|
|
5075
|
+
}
|
|
5076
|
+
t_2 += runtime.suppressValue((lineno = 50, colno = 119, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((runtime.memberLookup((t_13),"task")),"text"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
|
|
5077
|
+
t_2 += "<span class=\"govcy-visually-hidden\"> ";
|
|
5078
|
+
t_2 += runtime.suppressValue(runtime.contextOrFrameLookup(context, frame, "visuallyHiddenStatus"), env.opts.autoescape);
|
|
5079
|
+
t_2 += " ";
|
|
5080
|
+
t_2 += runtime.suppressValue((lineno = 50, colno = 238, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((runtime.memberLookup((t_13),"status")),"text"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
|
|
5081
|
+
t_2 += "</span>";
|
|
5082
|
+
if(runtime.memberLookup((runtime.memberLookup((t_13),"task")),"link")) {
|
|
5083
|
+
t_2 += "</a>";
|
|
5084
|
+
;
|
|
5085
|
+
}
|
|
5086
|
+
if(runtime.memberLookup((t_13),"description")) {
|
|
5087
|
+
t_2 += "<p>";
|
|
5088
|
+
t_2 += runtime.suppressValue((lineno = 51, colno = 85, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((t_13),"description"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
|
|
5089
|
+
t_2 += "</p>";
|
|
5090
|
+
;
|
|
5091
|
+
}
|
|
5092
|
+
t_2 += "\n </td>";
|
|
5093
|
+
if(runtime.memberLookup((t_13),"status")) {
|
|
5094
|
+
t_2 += "\n <td class=\"govcy-valign-top govcy-text-end\">\n <span class=\"govcy-tag ";
|
|
5095
|
+
t_2 += runtime.suppressValue(runtime.memberLookup((runtime.memberLookup((t_13),"status")),"classes"), env.opts.autoescape);
|
|
5096
|
+
t_2 += "\">";
|
|
5097
|
+
t_2 += runtime.suppressValue((lineno = 55, colno = 105, runtime.callWrap(t_6, "govcyLocalizeContent", context, [runtime.memberLookup((runtime.memberLookup((t_13),"status")),"text"),runtime.memberLookup((l_params),"lang")])), env.opts.autoescape);
|
|
5098
|
+
t_2 += "</span>\n </td>";
|
|
5099
|
+
;
|
|
5100
|
+
}
|
|
5101
|
+
t_2 += "\n </tr>";
|
|
5102
|
+
;
|
|
5103
|
+
}
|
|
5104
|
+
;
|
|
5105
|
+
}
|
|
5106
|
+
;
|
|
5107
|
+
}
|
|
5108
|
+
}
|
|
5109
|
+
frame = frame.pop();
|
|
5110
|
+
t_2 += "\n </tbody>\n </table>\n";
|
|
5111
|
+
})});
|
|
5112
|
+
}
|
|
5113
|
+
;
|
|
5114
|
+
frame = callerFrame;
|
|
5115
|
+
return new runtime.SafeString(t_2);
|
|
5116
|
+
});
|
|
5117
|
+
context.addExport("taskList");
|
|
5118
|
+
context.setVariable("taskList", macro_t_1);
|
|
5119
|
+
if(parentTemplate) {
|
|
5120
|
+
parentTemplate.rootRenderFunc(env, context, frame, runtime, cb);
|
|
5121
|
+
} else {
|
|
5122
|
+
cb(null, output);
|
|
5123
|
+
}
|
|
5124
|
+
;
|
|
5125
|
+
} catch (e) {
|
|
5126
|
+
cb(runtime.handleError(e, lineno, colno));
|
|
5127
|
+
}
|
|
5128
|
+
}
|
|
5129
|
+
return {
|
|
5130
|
+
root: root
|
|
5131
|
+
};
|
|
5132
|
+
|
|
5133
|
+
})();
|
|
5134
|
+
})();
|
|
5135
|
+
|
|
4952
5136
|
(function() {(window.nunjucksPrecompiled = window.nunjucksPrecompiled || {})["elements/textArea.njk"] = (function() {
|
|
4953
5137
|
function root(env, context, frame, runtime, cb) {
|
|
4954
5138
|
var lineno = 0;
|
|
@@ -5933,7 +6117,7 @@ var output = "";
|
|
|
5933
6117
|
try {
|
|
5934
6118
|
var parentTemplate = null;
|
|
5935
6119
|
var t_1;
|
|
5936
|
-
t_1 = ["label","legend","hint","button","errorMessage","select","textElement","htmlElement","textInput","radios","checkboxes","fileInput","fileView","backLink","tag","table","summaryList","textArea","markdown","panel","datePicker","dateInput"];
|
|
6120
|
+
t_1 = ["label","legend","hint","button","errorMessage","select","textElement","htmlElement","textInput","radios","checkboxes","fileInput","fileView","backLink","tag","table","summaryList","textArea","markdown","panel","datePicker","dateInput","taskList"];
|
|
5937
6121
|
frame.set("macroSimpleBlocks", t_1, true);
|
|
5938
6122
|
if(frame.topLevel) {
|
|
5939
6123
|
context.setVariable("macroSimpleBlocks", t_1);
|
package/package.json
CHANGED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{# taskList
|
|
2
|
+
@param {string} id The id on the task list table. Will escape text.
|
|
3
|
+
@param {string} classes Additional classes to add to the table. Optional
|
|
4
|
+
@param {object} visuallyHiddenStatus The visuallyHiddenText text indicating status . Optional. Will escape text. Default value is `{en:"with status ",el:"με κατάσταση "}`
|
|
5
|
+
@param {string} lang The language used. Can be 'en','el'. Optional.
|
|
6
|
+
@param {array} items The array of items to turn onto taskList
|
|
7
|
+
i.e. `[
|
|
8
|
+
{
|
|
9
|
+
"id": "task1",
|
|
10
|
+
"task": {
|
|
11
|
+
"text": {
|
|
12
|
+
"el": "Εργασία ένα",
|
|
13
|
+
"en": "Task one"
|
|
14
|
+
},
|
|
15
|
+
"link": "#task1"
|
|
16
|
+
},
|
|
17
|
+
"description": {
|
|
18
|
+
"el": "Επεξήγηση",
|
|
19
|
+
"en": "Some explanation text"
|
|
20
|
+
}
|
|
21
|
+
,
|
|
22
|
+
"status": {
|
|
23
|
+
"text": {
|
|
24
|
+
"el": "ΟΛΟΚΛΗΡΩΘΗΚΕ",
|
|
25
|
+
"en": "COMPLETED"
|
|
26
|
+
},
|
|
27
|
+
"classes": ""
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
]`
|
|
31
|
+
@returns govcy taskList html
|
|
32
|
+
#}
|
|
33
|
+
{% macro taskList(params) -%}
|
|
34
|
+
{#- legend, id and name are mandatory -#}
|
|
35
|
+
{%- if params.items -%}
|
|
36
|
+
{#- Import localizer from utilities -#}
|
|
37
|
+
{%- from "../utilities/govcyUtilities.njk" import govcyLocalizeContent, govcyLangAttribute -%}
|
|
38
|
+
{#- set localizations -#}
|
|
39
|
+
{%- if params.visuallyHiddenStatus -%}
|
|
40
|
+
{%- set visuallyHiddenStatus -%} {{- govcyLocalizeContent(params.visuallyHiddenStatus, params.lang) -}}{%- endset -%}
|
|
41
|
+
{%- else -%}
|
|
42
|
+
{%- set visuallyHiddenStatus -%} {{- govcyLocalizeContent({en:"with status ",el:"με κατάσταση "} , params.lang) -}}{%- endset -%}
|
|
43
|
+
{%- endif %}
|
|
44
|
+
<table class="govcy-table{% if params.classes %} {{ params.classes }}{% endif %}"{% if params.id %} id="{{ params.id }}"{% endif %}{{ govcyLangAttribute(params.lang) }}>
|
|
45
|
+
<tbody>
|
|
46
|
+
{%- for item in params.items -%}
|
|
47
|
+
{%- if item -%}
|
|
48
|
+
{%- if item.task and item.status %}
|
|
49
|
+
<tr{% if params.id %} id="{{ params.id }}-row-{{ loop.index }}"{% endif %}>
|
|
50
|
+
<td classes="govcy-valign-top">
|
|
51
|
+
{%if item.task.link %}<a href="{{ item.task.link }}">{% endif %}{{ govcyLocalizeContent(item.task.text, params.lang) }}<span class="govcy-visually-hidden"> {{ visuallyHiddenStatus }} {{ govcyLocalizeContent(item.status.text, params.lang) }}</span>{%if item.task.link %}</a>{% endif %}
|
|
52
|
+
{%- if item.description -%}<p>{{ govcyLocalizeContent(item.description, params.lang) }}</p>{%- endif %}
|
|
53
|
+
</td>
|
|
54
|
+
{%- if item.status %}
|
|
55
|
+
<td class="govcy-valign-top govcy-text-end">
|
|
56
|
+
<span class="govcy-tag {{ item.status.classes }}">{{ govcyLocalizeContent(item.status.text, params.lang) }}</span>
|
|
57
|
+
</td>
|
|
58
|
+
{%- endif %}
|
|
59
|
+
</tr>
|
|
60
|
+
{%- endif -%}
|
|
61
|
+
{%- endif -%}
|
|
62
|
+
{%- endfor %}
|
|
63
|
+
</tbody>
|
|
64
|
+
</table>
|
|
65
|
+
{% endif -%}
|
|
66
|
+
{%- endmacro %}
|
package/src/njk/govcyElement.njk
CHANGED
|
@@ -25,7 +25,7 @@ To use:
|
|
|
25
25
|
{%- set macroSimpleBlocks = ['label', 'legend', 'hint', 'button',
|
|
26
26
|
'errorMessage','select','textElement','htmlElement','textInput','radios','checkboxes',
|
|
27
27
|
'fileInput','fileView','backLink','tag','table', 'summaryList', 'textArea','markdown',
|
|
28
|
-
'panel', 'datePicker','dateInput'] -%}
|
|
28
|
+
'panel', 'datePicker','dateInput', 'taskList'] -%}
|
|
29
29
|
{%- set macroCallerBlocks = ['formControl','form','fieldset'] -%}
|
|
30
30
|
{%- macro govcyElement(component, params) -%}
|
|
31
31
|
{#- Simple blocks -#}
|