diff --git a/build/rollup.config.js b/build/rollup.config.js index 3bb8a194..6ec259d3 100644 --- a/build/rollup.config.js +++ b/build/rollup.config.js @@ -32,24 +32,6 @@ const Handlebars = require('handlebars'); const production = process.env.NODE_ENV === 'production'; -/** - * Support of handlebars 1.3.0 - * TODO remove once migrated to hbs >= 3.0.0 - */ -const originalVisitor = Handlebars.Visitor; -Handlebars.Visitor = function () { - return originalVisitor.call(this); -}; -Handlebars.Visitor.prototype = Object.create(originalVisitor.prototype); -Handlebars.Visitor.prototype.accept = function () { - try { - originalVisitor.prototype.accept.apply(this, arguments); - } catch (e) { - // ignore - } -}; -/* --------------------------------------------------------- */ - const globPath = p => p.replace(/\\/g, '/'); const inputs = glob.sync(globPath(path.join(srcDir, '**', '*.js'))); diff --git a/package-lock.json b/package-lock.json index 67e16267..9e87f104 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,8 +18,8 @@ "@oat-sa/prettier-config": "^0.1.1", "@oat-sa/rollup-plugin-wildcard-external": "^1.0.0", "@oat-sa/tao-calculator": "^0.6.2", - "@oat-sa/tao-core-libs": "^0.5.3", - "@oat-sa/tao-core-sdk": "^2.0.1", + "@oat-sa/tao-core-libs": "oat-sa/tao-core-libs-fe#breaking/TDR-9/handlebars-4-upgrade", + "@oat-sa/tao-core-sdk": "oat-sa/tao-core-sdk-fe#breaking/TDR-9/handlebars-4-upgrade", "@oat-sa/tao-core-shared-libs": "^1.4.1", "@oat-sa/tao-qunit-testrunner": "^2.0.0", "async": "^0.2.10", @@ -32,7 +32,7 @@ "fs-extra": "^11.1.1", "gamp": "^0.2.1", "glob": "^8.1.0", - "handlebars": "1.3.0", + "handlebars": "4.7.8", "interactjs": "1.3.4", "jquery": "1.9.1", "jquery-mockjax": "^2.5.0", @@ -2118,14 +2118,14 @@ }, "node_modules/@oat-sa/tao-core-libs": { "version": "0.5.3", - "resolved": "https://registry.npmjs.org/@oat-sa/tao-core-libs/-/tao-core-libs-0.5.3.tgz", - "integrity": "sha512-0zRfr1xOrLvbPG6Mqra07qfoG5A46hcz4/2sFmz+b+hNl6YfCIgElSUkniXyQo4dcC651kS61VfGPedkuue3cQ==", + "resolved": "https://github.com/oat-sa/tao-core-libs-fe.git#8ae0ec41b01efea8d37b03c395c85caf53e8c296", "dev": true, + "license": "GPL-2.0", "peerDependencies": { "async": "0.2.10", "dompurify": "^2.4.0", "gamp": "0.2.1", - "handlebars": "1.3.0", + "handlebars": "4.7.8", "interactjs": "1.3.4", "jquery": ">= 1.9.1 < 3.0.0", "lodash": "2.4.1", @@ -2138,10 +2138,10 @@ } }, "node_modules/@oat-sa/tao-core-sdk": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@oat-sa/tao-core-sdk/-/tao-core-sdk-2.0.1.tgz", - "integrity": "sha512-1kiqbHOk5+uVqVBRKiiJgfLJWQc0Iqmw4d0vrtsgQk/foiiEGy8tW0lHRRS0cO1nnmBftov7eINuPgEsVYwiJw==", + "version": "2.0.2", + "resolved": "https://github.com/oat-sa/tao-core-sdk-fe.git#06bcf536309f5fef1e28bc0a352bae5259086a15", "dev": true, + "license": "GPL-2.0", "dependencies": { "fastestsmallesttextencoderdecoder": "1.0.14", "idb-wrapper": "1.7.2", @@ -2566,16 +2566,6 @@ "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true, - "optional": true, - "engines": { - "node": ">=0.4.2" - } - }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -4956,12 +4946,15 @@ "dev": true }, "node_modules/handlebars": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-1.3.0.tgz", - "integrity": "sha1-npsTCpPjiUkTItl1zz7BgYw3zjQ=", + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", + "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", "dev": true, "dependencies": { - "optimist": "~0.3" + "minimist": "^1.2.5", + "neo-async": "^2.6.2", + "source-map": "^0.6.1", + "wordwrap": "^1.0.0" }, "bin": { "handlebars": "bin/handlebars" @@ -4970,7 +4963,7 @@ "node": ">=0.4.7" }, "optionalDependencies": { - "uglify-js": "~2.3" + "uglify-js": "^3.1.4" } }, "node_modules/hard-rejection": { @@ -6898,15 +6891,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/optimist": { - "version": "0.3.7", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.3.7.tgz", - "integrity": "sha1-yQlBrVnkJzMokjB00s8ufLxuwNk=", - "dev": true, - "dependencies": { - "wordwrap": "~0.0.2" - } - }, "node_modules/optionator": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", @@ -8005,46 +7989,6 @@ "handlebars": "^4.0.5" } }, - "node_modules/rollup-plugin-handlebars-plus/node_modules/handlebars": { - "version": "4.7.7", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", - "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", - "dev": true, - "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.0", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" - }, - "engines": { - "node": ">=0.4.7" - }, - "optionalDependencies": { - "uglify-js": "^3.1.4" - } - }, - "node_modules/rollup-plugin-handlebars-plus/node_modules/uglify-js": { - "version": "3.17.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", - "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", - "dev": true, - "optional": true, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/rollup-plugin-handlebars-plus/node_modules/wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", - "dev": true - }, "node_modules/rollup-plugin-istanbul": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/rollup-plugin-istanbul/-/rollup-plugin-istanbul-2.0.1.tgz", @@ -8699,6 +8643,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/svelte": { + "version": "3.59.2", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-3.59.2.tgz", + "integrity": "sha512-vzSyuGr3eEoAtT/A6bmajosJZIUWySzY2CzB3w2pgPvnkUjGqlDnsNnA0PMO+mMAhuyMul6C2uuZzY6ELSkzyA==", + "dev": true, + "peer": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/temp-dir": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-2.0.0.tgz", @@ -8786,7 +8740,7 @@ }, "node_modules/text": { "version": "2.0.16", - "resolved": "git+ssh://git@github.com/requirejs/text.git#3f9d4c19b3a1a3c6f35650c5788cbea1db93197a", + "resolved": "https://github.com/requirejs/text.git#3f9d4c19b3a1a3c6f35650c5788cbea1db93197a", "integrity": "sha512-HQpx7jBXZlnKoEEBvLzoJyADPHUzCbIYp+KCvWqqA+hYAEWiQ3h8tlXX9FTXzExhGwI+DPkknZItQONtmfHbbA==", "dev": true, "license": "MIT" @@ -8958,32 +8912,28 @@ "is-typedarray": "^1.0.0" } }, - "node_modules/uglify-js": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.3.6.tgz", - "integrity": "sha1-+gmEdwtCi3qbKoBY9GNV0U/vIRo=", + "node_modules/typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, - "optional": true, - "dependencies": { - "async": "~0.2.6", - "optimist": "~0.3.5", - "source-map": "~0.1.7" - }, + "peer": true, "bin": { - "uglifyjs": "bin/uglifyjs" + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" }, "engines": { - "node": ">=0.4.0" + "node": ">=14.17" } }, - "node_modules/uglify-js/node_modules/source-map": { - "version": "0.1.43", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz", - "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=", + "node_modules/uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", "dev": true, "optional": true, - "dependencies": { - "amdefine": ">=0.0.4" + "bin": { + "uglifyjs": "bin/uglifyjs" }, "engines": { "node": ">=0.8.0" @@ -9199,13 +9149,10 @@ } }, "node_modules/wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true, - "engines": { - "node": ">=0.4.0" - } + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", + "dev": true }, "node_modules/wrap-ansi": { "version": "7.0.0", diff --git a/package.json b/package.json index 362ea6c3..90b07992 100644 --- a/package.json +++ b/package.json @@ -52,8 +52,8 @@ "@oat-sa/prettier-config": "^0.1.1", "@oat-sa/rollup-plugin-wildcard-external": "^1.0.0", "@oat-sa/tao-calculator": "^0.6.2", - "@oat-sa/tao-core-libs": "^0.5.3", - "@oat-sa/tao-core-sdk": "^2.0.1", + "@oat-sa/tao-core-libs": "oat-sa/tao-core-libs-fe#breaking/TDR-9/handlebars-4-upgrade", + "@oat-sa/tao-core-sdk": "oat-sa/tao-core-sdk-fe#breaking/TDR-9/handlebars-4-upgrade", "@oat-sa/tao-core-shared-libs": "^1.4.1", "@oat-sa/tao-qunit-testrunner": "^2.0.0", "async": "^0.2.10", @@ -66,7 +66,7 @@ "fs-extra": "^11.1.1", "gamp": "^0.2.1", "glob": "^8.1.0", - "handlebars": "1.3.0", + "handlebars": "4.7.8", "interactjs": "1.3.4", "jquery": "1.9.1", "jquery-mockjax": "^2.5.0", diff --git a/src/datalist/tpl/list.tpl b/src/datalist/tpl/list.tpl index bcf87b3b..75b08f7d 100644 --- a/src/datalist/tpl/list.tpl +++ b/src/datalist/tpl/list.tpl @@ -1,20 +1,18 @@ -{{#each list}} +{{#each list as |row|}} - {{#if ../selectable}} + {{#if @root.selectable}} {{/if}} {{label}} - {{#if ../actions}} + {{#if @root.actions}} - {{#each ../../actions}} - {{#with ../../line}} - {{#unless ../hidden}} - {{#with ../../this}} - - {{/with}} {{/unless}} {{/with}} {{/each}} diff --git a/src/datatable/tpl/layout.tpl b/src/datatable/tpl/layout.tpl index 0d4816e8..9223f008 100644 --- a/src/datatable/tpl/layout.tpl +++ b/src/datatable/tpl/layout.tpl @@ -10,12 +10,12 @@
{{#with options.status}}

- + - {{#if loading}}{{loading}}{{else}}{{../../options.labels.loading}}{{/if}}... + {{#if loading}}{{loading}}{{else}}{{@root.options.labels.loading}}{{/if}}...

{{/with}} @@ -83,25 +83,25 @@ - {{#each dataset.data}} + {{#each dataset.data as |row|}} - {{#if ../options.selectable}} + {{#if @root.options.selectable}} {{/if}} {{! IMPORTANT:START IF YOU'RE GOING TO MAKE CHANGES TO THIS SECTION, PLEASE UPDATE shallowUpdate METHOD ACCORDINGLY}} - {{#each ../options.model}} + {{#each @root.options.model}} {{#if type}} - {{#each ../actions}} + {{#each actions as |action|}} {{#if id}} - {{#with ../../../../this}} - {{#unless ../hidden}} - {{/unless}} {{/with}} @@ -116,23 +116,23 @@ {{/each}} {{else}} - {{{dompurify (property id ../../this)}}} + {{{dompurify (property id row)}}} {{/if}} {{/each}} {{! IMPORTANT:END IF YOU'RE GOING TO MAKE CHANGES TO THIS SECTION, PLEASE UPDATE shallowUpdate METHOD ACCORDINGLY}} - {{#with ../options.actions}} + {{#with @root.options.actions}} - {{#each this}} + {{#each this as |action|}} {{#if id}} - {{#with ../../../this}} - {{#unless ../hidden}} - {{/unless}} {{/with}} diff --git a/src/form/widget/tpl/checkBox.tpl b/src/form/widget/tpl/checkBox.tpl index 8a40c487..7769940f 100644 --- a/src/form/widget/tpl/checkBox.tpl +++ b/src/form/widget/tpl/checkBox.tpl @@ -1,6 +1,6 @@
- {{> ui-form-widget-label }} + {{> 'ui/form/widget/tpl/label' }}
diff --git a/src/form/widget/tpl/comboBox.tpl b/src/form/widget/tpl/comboBox.tpl index 0b64b092..02cc3b34 100644 --- a/src/form/widget/tpl/comboBox.tpl +++ b/src/form/widget/tpl/comboBox.tpl @@ -1,6 +1,6 @@
- {{> ui-form-widget-label }} + {{> 'ui/form/widget/tpl/label' }}
@@ -9,7 +9,7 @@
- {{> ui-form-widget-label confirmation}} + {{> 'ui/form/widget/tpl/label' confirmation}}
diff --git a/src/form/widget/tpl/radioBox.tpl b/src/form/widget/tpl/radioBox.tpl index 06713439..06278cbb 100644 --- a/src/form/widget/tpl/radioBox.tpl +++ b/src/form/widget/tpl/radioBox.tpl @@ -1,6 +1,6 @@
- {{> ui-form-widget-label }} + {{> 'ui/form/widget/tpl/label' }}
diff --git a/src/form/widget/tpl/textArea.tpl b/src/form/widget/tpl/textArea.tpl index 3fe3c2a2..292cc980 100644 --- a/src/form/widget/tpl/textArea.tpl +++ b/src/form/widget/tpl/textArea.tpl @@ -1,6 +1,6 @@
- {{> ui-form-widget-label }} + {{> 'ui/form/widget/tpl/label' }}
diff --git a/src/form/widget/tpl/widget.tpl b/src/form/widget/tpl/widget.tpl index 91bfb40f..e8508cfd 100644 --- a/src/form/widget/tpl/widget.tpl +++ b/src/form/widget/tpl/widget.tpl @@ -1,6 +1,6 @@
- {{> ui-form-widget-label }} + {{> 'ui/form/widget/tpl/label' }}
diff --git a/src/form/widget/widget.js b/src/form/widget/widget.js index dcf804a4..93cea1ee 100644 --- a/src/form/widget/widget.js +++ b/src/form/widget/widget.js @@ -364,7 +364,7 @@ function widgetFactory(container, config) { } // expose a partial that can be used by every form widget to inject the label markup -Handlebars.registerPartial('ui-form-widget-label', labelTpl); +Handlebars.registerPartial('ui/form/widget/tpl/label', labelTpl); // the widgetFactory is also a providers registry providerRegistry(widgetFactory); diff --git a/src/generis/widget/checkBox/checkBox.tpl b/src/generis/widget/checkBox/checkBox.tpl index 10902bd9..e2dc2c56 100644 --- a/src/generis/widget/checkBox/checkBox.tpl +++ b/src/generis/widget/checkBox/checkBox.tpl @@ -1,6 +1,6 @@
- {{> ui-generis-widget-label }} + {{> 'ui/generis/widget/widget' }}
@@ -16,4 +16,4 @@ {{/each}}
-
\ No newline at end of file +
diff --git a/src/generis/widget/comboBox/comboBox.tpl b/src/generis/widget/comboBox/comboBox.tpl index dbba9483..d32a18f8 100644 --- a/src/generis/widget/comboBox/comboBox.tpl +++ b/src/generis/widget/comboBox/comboBox.tpl @@ -1,6 +1,6 @@
- {{> ui-generis-widget-label }} + {{> 'ui/generis/widget/widget' }}
-
\ No newline at end of file +
diff --git a/src/generis/widget/hiddenBox/hiddenBox.tpl b/src/generis/widget/hiddenBox/hiddenBox.tpl index 2bb59795..f8bd5af9 100644 --- a/src/generis/widget/hiddenBox/hiddenBox.tpl +++ b/src/generis/widget/hiddenBox/hiddenBox.tpl @@ -1,6 +1,6 @@
- {{> ui-generis-widget-label }} + {{> 'ui/generis/widget/widget' }}
@@ -9,9 +9,9 @@
- {{> ui-generis-widget-label confirmation }} + {{> 'ui/generis/widget/widget'confirmation }}
-
\ No newline at end of file +
diff --git a/src/generis/widget/textBox/textBox.tpl b/src/generis/widget/textBox/textBox.tpl index d2e3baf3..b5992f77 100644 --- a/src/generis/widget/textBox/textBox.tpl +++ b/src/generis/widget/textBox/textBox.tpl @@ -1,8 +1,8 @@
- {{> ui-generis-widget-label }} + {{> 'ui/generis/widget/widget'}}
-
\ No newline at end of file +
diff --git a/src/generis/widget/widget.js b/src/generis/widget/widget.js index 4928d3b0..7270584a 100644 --- a/src/generis/widget/widget.js +++ b/src/generis/widget/widget.js @@ -24,7 +24,7 @@ import Handlebars from 'handlebars'; import ptl from 'ui/generis/widget/widget.tpl'; import 'ui/generis/widget/css/widget.css'; -Handlebars.registerPartial('ui-generis-widget-label', ptl); +Handlebars.registerPartial('ui/generis/widget/widget', ptl); /** * The factory * @param {Object} [options.validator] diff --git a/src/listbox/tpl/list.tpl b/src/listbox/tpl/list.tpl index ad8b9837..d06faf6f 100644 --- a/src/listbox/tpl/list.tpl +++ b/src/listbox/tpl/list.tpl @@ -1,6 +1,6 @@