• R/O
  • SSH

fcf: コミット

FCF - Full Stack Javascript Framework

OpenSource is a full stack development framework designed to simplify the development of WEB projects of various complexity levels.

It is based on unique technologies that open up new opportunities in development approaches with NODEJS.


コミットメタ情報

リビジョンc040ce3ccbd24f9021d87e47be58373bd9636726 (tree)
日時2021-04-08 19:08:30
作者Vladimir Markin <v.o.markin221@gmai...>
コミッターVladimir Markin

ログメッセージ

Rendering the view on the client and restoring order with the theme on the client

変更サマリ

差分

diff -r 06b9b6c37e16 -r c040ce3ccbd2 NClient/Wrapper.js
--- a/NClient/Wrapper.js Thu Apr 08 11:31:27 2021 +0300
+++ b/NClient/Wrapper.js Thu Apr 08 13:08:30 2021 +0300
@@ -14,11 +14,15 @@
1414 this._callMap = {};
1515 }
1616
17+ getTheme(){
18+ return fcf.application.getTheme();
19+ }
20+
1721 write(a_context) {
1822 this.buffer.push(a_context);
1923 }
2024
21- template(a_options){
25+ template(a_options, a_args){
2226 let self = this;
2327 if (typeof a_options === "string"){
2428 a_options = {
@@ -315,7 +319,13 @@
315319
316320 recalculate(a_id, args);
317321
318- await ri.renderFunction(render, args, theme.getDecor(), fcf.getContext().route);
322+ let argsRenderFunction = {
323+ render: render,
324+ args: args,
325+ decor: theme.getDecor(),
326+ route: fcf.getContext().route,
327+ }
328+ await ri.renderFunction(argsRenderFunction);
319329
320330 let template = await render._build();
321331
diff -r 06b9b6c37e16 -r c040ce3ccbd2 NRender/NDetails/TemplateProcessor.js
--- a/NRender/NDetails/TemplateProcessor.js Thu Apr 08 11:31:27 2021 +0300
+++ b/NRender/NDetails/TemplateProcessor.js Thu Apr 08 13:08:30 2021 +0300
@@ -58,13 +58,11 @@
5858 {
5959 render: templateRender,
6060 args:a_options.args,
61- sources: a_options.sources,
6261 route: a_options.route,
6362 decor: decor,
64- aliases: aliases,
65- path: a_options.rawTemplate.template.path,
66- stringNumber: a_options.rawTemplate.template.stringNumber,
6763 },
64+ a_options.rawTemplate.template.path,
65+ a_options.rawTemplate.template.stringNumber,
6866 template);
6967 } catch (e){
7068 fcf.setContext(a_options.context);
@@ -109,11 +107,11 @@
109107 a_options.onResult(undefined, result);
110108 }
111109
112- this._renderBlock = async function(a_code, a_options, a_template) {
113- fcf.getContext().currentTemplate = {id: a_options.args.fcfId};
110+ this._renderBlock = async function(a_code, a_args, a_path, a_stringNumber, a_template) {
111+ fcf.getContext().currentTemplate = {id: a_args.args.fcfId};
114112 let ov = fcf.NDetails.currentTemplate;
115113 fcf.NDetails.currentTemplate = a_template;
116- await fcf.scriptExecutor.execute(a_code, a_options, a_options.path, a_options.stringNumber, 0, true);
114+ await fcf.scriptExecutor.execute(a_code, a_args, a_path, a_stringNumber, 0, true);
117115 fcf.NDetails.currentTemplate = ov;
118116 }
119117
diff -r 06b9b6c37e16 -r c040ce3ccbd2 NRender/NDetails/TemplateRender.js
--- a/NRender/NDetails/TemplateRender.js Thu Apr 08 11:31:27 2021 +0300
+++ b/NRender/NDetails/TemplateRender.js Thu Apr 08 13:08:30 2021 +0300
@@ -59,6 +59,10 @@
5959 this.markerHeader = this.markerPrefix + "header" + this.markerSuffix;;
6060 this._callMap = {};
6161
62+ this.getTheme = function(){
63+ return fcf.application.getTheme();
64+ }
65+
6266 this.build = async function(){
6367 let result = "";
6468 let ctxt = fcf.getContext();
diff -r 06b9b6c37e16 -r c040ce3ccbd2 NServer/NControllers/NDetails/wrapperBuilder.js
--- a/NServer/NControllers/NDetails/wrapperBuilder.js Thu Apr 08 11:31:27 2021 +0300
+++ b/NServer/NControllers/NDetails/wrapperBuilder.js Thu Apr 08 13:08:30 2021 +0300
@@ -76,7 +76,11 @@
7676
7777 let templateCode = !block ? (template.templates[""] ? template.templates[""].template.template : "") :
7878 (template.templates[block] ? template.templates[block].template.template : "");
79- let renderFunction = "async function(render, args, decor, route) {" + templateCode + "}";
79+ let renderFunction = "async function fcfinnerevalfunction(a_args){";
80+ for(let key in {render:1, args:1, decor:1, route:1})
81+ renderFunction += `let ${key} = a_args.${key};`;
82+ renderFunction += templateCode;
83+ renderFunction += "}";
8084
8185
8286 let wrapperCode = false;
diff -r 06b9b6c37e16 -r c040ce3ccbd2 fcf.js
--- a/fcf.js Thu Apr 08 11:31:27 2021 +0300
+++ b/fcf.js Thu Apr 08 13:08:30 2021 +0300
@@ -1144,22 +1144,6 @@
11441144 return result;
11451145 }
11461146
1147-fcf.getRouteVariablesByString = (a_str) => {
1148- var result = [];
1149- var vars = fcf.getVariablesString(a_str);
1150- for(var i = 0; i < vars.length; ++i){
1151- var item = fcf.parseObjectAddress(vars[i]);
1152- if (item[0] == "route" && item[1] == "args" && !fcf.empty(item[2]))
1153- result.push(item[2]);
1154- }
1155- return result;
1156-}
1157-
1158-fcf.getRouteVariablesBySource = (a_object) => {
1159- if (!fcf.isArg(a_object))
1160- return [];
1161- return fcf.getRouteVariablesByString(a_object.value);
1162-}
11631147
11641148
11651149 fcf.unslash = (a_txt) => {
@@ -3389,10 +3373,11 @@
33893373 func = self._funcStorage[a_file][a_startLine][a_startChar].func;
33903374 code = self._funcStorage[a_file][a_startLine][a_startChar].code;
33913375 } else {
3392- code = "( " + (a_async ? "async" : "") + " function fcfinnerevalfunction(a_args){";
3376+ code = "(" + (a_async ? "async" : "") + " function fcfinnerevalfunction(a_args){";
33933377 for(let key in a_args)
3394- code += "let "+ key + " = a_args[\"" + key + "\"];";
3395- code += a_code + " })";
3378+ code += `let ${key} = a_args.${key};`;
3379+ code += a_code;
3380+ code += "})";
33963381 func = eval(code);
33973382 if (!self._funcStorage[a_file])
33983383 self._funcStorage[a_file] = {};
diff -r 06b9b6c37e16 -r c040ce3ccbd2 packages/fcfControls/templates/link.tmpl
--- a/packages/fcfControls/templates/link.tmpl Thu Apr 08 11:31:27 2021 +0300
+++ b/packages/fcfControls/templates/link.tmpl Thu Apr 08 13:08:30 2021 +0300
@@ -26,7 +26,7 @@
2626
2727 //~TEMPLATE
2828 %{{
29- var link = fcf.link({url: args.url, args: args.args}, aliases);
29+ var link = fcf.link({url: args.url, args: args.args}, render.getTheme().getAliases());
3030 }}%
3131 <a href="@{{link}}@" class="${{decor.link}}$ @{{args.active ? 'active' : ''}}@">${{args.title}}$</a>
3232
diff -r 06b9b6c37e16 -r c040ce3ccbd2 packages/fcfControls/templates/multiselect.tmpl
--- a/packages/fcfControls/templates/multiselect.tmpl Thu Apr 08 11:31:27 2021 +0300
+++ b/packages/fcfControls/templates/multiselect.tmpl Thu Apr 08 13:08:30 2021 +0300
@@ -1,6 +1,6 @@
11 //~OPTIONS
22 {
3-
3+ clientRendering: true,
44 }
55
66 //~ARGUMENTS
diff -r 06b9b6c37e16 -r c040ce3ccbd2 packages/fcfControls/templates/pagination.hooks.js
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/fcfControls/templates/pagination.hooks.js Thu Apr 08 13:08:30 2021 +0300
@@ -0,0 +1,75 @@
1+fcf.module({
2+ name: "fcfControls:templates/pagination.hooks.js",
3+ dependencies: [],
4+ module: function(){
5+ return {
6+ /**
7+ * void async hookRender(a_options)
8+ * @brief Called when rendering from the current template
9+ * @param a_options
10+ * object args [modify] initial parameters of template arguments
11+ * object options template options
12+ * string path path to the template being rendered
13+ **/
14+ // hookRender: (a_options) => {
15+ // },
16+
17+ //
18+ // void hookBeforeBuild(a_taskInfo)
19+ // The hook is executed before assembling the template arguments
20+ //
21+ // hookBeforeBuild: function(a_taskInfo) {
22+ // },
23+
24+ //
25+ // void hookAfterBuild(a_taskInfo)
26+ // The hook is executed after assembling the template arguments
27+ //
28+ // hookAfterBuild: function(a_taskInfo) {
29+ // },
30+
31+ //
32+ // void hookAfterBuild(a_taskInfo)
33+ // The hook is executed after building the template's system arguments
34+ //
35+ // hookAfterSystemBuild: function(a_taskInfo) {
36+ // },
37+
38+ //
39+ // Object of hooks for programmatically populated arguments
40+ //
41+ hooksProgramableArgument: {
42+ //
43+ // @result Returns the value of an argument or a Promise object
44+ //
45+ urlParamenter: (a_taskInfo)=>{
46+ let pageSrcArg = a_taskInfo.fullSrcArgs.page;
47+ if (!fcf.isArg(pageSrcArg) || pageSrcArg.type != "url")
48+ return;
49+ return pageSrcArg.arg;
50+ }
51+ },
52+
53+ //
54+ // Object of the hooks preprocessing of the template arguments
55+ //
56+ // hooksBeforeArgument: {
57+ // //
58+ // // @result Can return the value of an argument or Promise or undefined
59+ // //
60+ // ARG_NAME: (a_taskInfo)=>{
61+ // }
62+ // },
63+
64+ //
65+ // Object of the hooks postprocessing of the template arguments
66+ // hooksAfterArgument: {
67+ // //
68+ // // @result Can return the value of an argument or Promise or undefined
69+ // //
70+ // ARG_NAME: (a_taskInfo)=>{
71+ // }
72+ // },
73+ };
74+ }
75+});
diff -r 06b9b6c37e16 -r c040ce3ccbd2 packages/fcfControls/templates/pagination.tmpl
--- a/packages/fcfControls/templates/pagination.tmpl Thu Apr 08 11:31:27 2021 +0300
+++ b/packages/fcfControls/templates/pagination.tmpl Thu Apr 08 13:08:30 2021 +0300
@@ -3,12 +3,12 @@
33 page: 1,
44 pageCount: 10,
55 outputPageCount: 5,
6+ urlParamenter: fcf.argProg(),
67 }
78
89 //~TEMPLATE
910 <div class="${{decor.paginationClass}}$">
1011 %{{
11- var addressArgs = fcf.getRouteVariablesBySource(sources.page);
1212 var pageCount = fcf.range(args.pageCount, 0);
1313 var outputPageCount = fcf.range(args.outputPageCount, 0, pageCount);
1414 var page = fcf.range(args.page, 1, pageCount);
@@ -19,8 +19,8 @@
1919 if (startPage != 1) {
2020 var r = fcf.append(true, {}, route);
2121 var switchPage = fcf.range(page - outputPageCount-1, 1, pageCount);
22- for(var j = 0; j < addressArgs.length; ++j)
23- r.args[addressArgs[j]] = switchPage;
22+ if (!fcf.empty(args.urlParamenter))
23+ r.args[args.urlParamenter] = switchPage;
2424 var link = fcf.link(r);
2525 }}%
2626 <div class="${{decor.paginationItem}}$">
@@ -32,8 +32,8 @@
3232 var n = startPage + i;
3333 var activeClass = n == page ? "active" : "";
3434 var r = fcf.append(true, {}, route);
35- for(var j = 0; j < addressArgs.length; ++j)
36- r.args[addressArgs[j]] = n;
35+ if (!fcf.empty(args.urlParamenter))
36+ r.args[args.urlParamenter] = n;
3737 var link = fcf.link(r);
3838 }}%
3939 <div class="${{decor.paginationItem}}$ @{{activeClass}}@">
@@ -45,8 +45,8 @@
4545 if (startPage + outputPageCount <= pageCount) {
4646 var r = fcf.append(true, {}, route);
4747 var switchPage = fcf.range(page + outputPageCount+1, 1, pageCount);
48- for(var j = 0; j < addressArgs.length; ++j)
49- r.args[addressArgs[j]] = switchPage;
48+ if (!fcf.empty(args.urlParamenter))
49+ r.args[args.urlParamenter] = switchPage;
5050 var link = fcf.link(r);
5151 }}%
5252 <div class="${{decor.paginationItem}}$">
旧リポジトリブラウザで表示