diff --git a/application/views/templates/FHC-Footer.php b/application/views/templates/FHC-Footer.php index 9387cf92c..5d81f2da3 100644 --- a/application/views/templates/FHC-Footer.php +++ b/application/views/templates/FHC-Footer.php @@ -30,7 +30,7 @@ // Generates the global object to pass phrases to javascripts // NOTE: must be called before including the PhrasesLib.js if ($phrases != null) generateJSPhrasesStorageObject($phrases); - + // -------------------------------------------------------------------------------------------------------- // From vendor folder @@ -123,6 +123,13 @@ } generateJSsInclude('vendor/vuejs/vuerouter4/vue-router.global.js'); } + + // Highcharts + if ($highcharts) + { + generateJSsInclude('vendor/highcharts/highcharts-dist/highcharts.js'); + generateJSsInclude('vendor/highcharts/highcharts-dist/modules/current-date-indicator.js'); + } // PrimeVue if ($primevue3) diff --git a/composer.json b/composer.json index 216d315d9..15d61f3d1 100644 --- a/composer.json +++ b/composer.json @@ -351,23 +351,34 @@ { "type": "package", "package": { - "name": "vuejs/vuedatepicker_js", - "version": "7.2.0", - "dist": { - "url": "https://unpkg.com/@vuepic/vue-datepicker@7.2.0/dist/vue-datepicker.iife.js", - "type": "file" - } + "name": "vuejs/vuedatepicker_js", + "version": "7.2.0", + "dist": { + "url": "https://unpkg.com/@vuepic/vue-datepicker@7.2.0/dist/vue-datepicker.iife.js", + "type": "file" + } } }, { "type": "package", "package": { - "name": "vuejs/vuedatepicker_css", - "version": "7.2.0", - "dist": { - "url": "https://unpkg.com/@vuepic/vue-datepicker@7.2.0/dist/main.css", - "type": "file" - } + "name": "vuejs/vuedatepicker_css", + "version": "7.2.0", + "dist": { + "url": "https://unpkg.com/@vuepic/vue-datepicker@7.2.0/dist/main.css", + "type": "file" + } + } + }, + { + "type": "package", + "package": { + "name": "highcharts/highcharts-dist", + "version": "7.1.2", + "dist": { + "url": "https://github.com/highcharts/highcharts-dist/archive/v7.1.2.zip", + "type": "zip" + } } }, { @@ -402,6 +413,8 @@ "fortawesome/font-awesome6": "6.1.*", "fzaninotto/faker": "1.*", + "highcharts/highcharts-dist": "^7.1.2", + "joeldbirch/superfish": "1.7.*", "jquery/jquery1": "1.*", "jquery/jquery2": "2.*", @@ -442,13 +455,14 @@ "vuejs/vuejs3": "3.3.8", "vuejs/vuerouter4": "4.1.3", - "vuejs/vuedatepicker_js": "7.2.0", - "vuejs/vuedatepicker_css": "7.2.0" + "vuejs/vuedatepicker_js": "7.2.0", + "vuejs/vuedatepicker_css": "7.2.0" + }, "config": { "bin-dir": "vendor/bin" }, - + "require-dev": { "vuejs/vuejs3_dev": "3.3.8", "squizlabs/php_codesniffer": "3.6.*", diff --git a/composer.lock b/composer.lock index 27132ecff..3d83ea836 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "01ea35652d88680f8262c5365828eb46", + "content-hash": "86d9ee6aa7cbf758f847f7aad13177a2", "packages": [ { "name": "afarkas/html5shiv", @@ -322,9 +322,6 @@ "extra": { "component": { "name": "angularjs", - "scripts": [ - "angular.js" - ], "files": [ "angular-animate.js", "angular-animate.min.js", @@ -597,6 +594,9 @@ "i18n/angular-locale_zh.js", "i18n/angular-locale_zu-za.js", "i18n/angular-locale_zu.js" + ], + "scripts": [ + "angular.js" ] } }, @@ -682,20 +682,20 @@ "extra": { "component": { "name": "jquery-ui", - "scripts": [ - "jquery-ui.js" - ], - "files": [ - "ui/**", - "themes/**", - "jquery-ui.min.js" - ], "shim": { "deps": [ "jquery" ], "exports": "jQuery" - } + }, + "files": [ + "ui/**", + "themes/**", + "jquery-ui.min.js" + ], + "scripts": [ + "jquery-ui.js" + ] } }, "notification-url": "https://packagist.org/downloads/", @@ -955,6 +955,15 @@ "abandoned": true, "time": "2020-12-11T09:56:16+00:00" }, + { + "name": "highcharts/highcharts-dist", + "version": "7.1.2", + "dist": { + "type": "zip", + "url": "https://github.com/highcharts/highcharts-dist/archive/v7.1.2.zip" + }, + "type": "library" + }, { "name": "joeldbirch/superfish", "version": "1.7.9", @@ -1015,12 +1024,12 @@ "version": "1.3.7", "source": { "type": "git", - "url": "https://github.com/justinrainbow/json-schema.git", + "url": "https://github.com/jsonrainbow/json-schema.git", "reference": "87b54b460febed69726c781ab67462084e97a105" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/87b54b460febed69726c781ab67462084e97a105", + "url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/87b54b460febed69726c781ab67462084e97a105", "reference": "87b54b460febed69726c781ab67462084e97a105", "shasum": "" }, @@ -1075,8 +1084,8 @@ "schema" ], "support": { - "issues": "https://github.com/justinrainbow/json-schema/issues", - "source": "https://github.com/justinrainbow/json-schema/tree/master" + "issues": "https://github.com/jsonrainbow/json-schema/issues", + "source": "https://github.com/jsonrainbow/json-schema/tree/1.3.7" }, "time": "2014-08-25T02:48:14+00:00" }, @@ -1116,6 +1125,7 @@ "issues": "https://github.com/kingsquare/json-schema-form/issues", "source": "https://github.com/kingsquare/json-schema-form/tree/master" }, + "abandoned": true, "time": "2014-07-10T12:27:19+00:00" }, { @@ -1297,16 +1307,16 @@ }, { "name": "mottie/tablesorter", - "version": "v2.31.3", + "version": "v2.32.0", "source": { "type": "git", "url": "https://github.com/Mottie/tablesorter.git", - "reference": "7202d5faf8105a5ecd1a2b7a653777618713ffe5" + "reference": "1423f5408982f58d5baa97648d2e5ee0b55fd3b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Mottie/tablesorter/zipball/7202d5faf8105a5ecd1a2b7a653777618713ffe5", - "reference": "7202d5faf8105a5ecd1a2b7a653777618713ffe5", + "url": "https://api.github.com/repos/Mottie/tablesorter/zipball/1423f5408982f58d5baa97648d2e5ee0b55fd3b6", + "reference": "1423f5408982f58d5baa97648d2e5ee0b55fd3b6", "shasum": "" }, "require": { @@ -1315,10 +1325,10 @@ "type": "component", "extra": { "component": { + "files": "dist/", "scripts": [ "dist/js/jquery.tablesorter.combined.js" - ], - "files": "dist/" + ] } }, "notification-url": "https://packagist.org/downloads/", @@ -1331,7 +1341,8 @@ }, { "name": "Rob Garrison", - "email": "wowmotty@gmail.com" + "email": "wowmotty@gmail.com", + "homepage": "https://github.com/Mottie" } ], "description": "tablesorter (FORK) is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable table without page refreshes. tablesorter can successfully parse and sort many types of data including linked data in a cell.", @@ -1352,7 +1363,7 @@ "source": "https://github.com/Mottie/tablesorter", "wiki": "https://github.com/Mottie/tablesorter/wiki" }, - "time": "2020-03-03T13:46:03+00:00" + "time": "2024-08-14T01:23:57+00:00" }, { "name": "nategood/httpful", @@ -1520,16 +1531,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "2.0.46", + "version": "2.0.48", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "498e67a0c82bd5791fda9b0dd0f4ec8e8aebb02d" + "reference": "eaa7be704b8b93a6913b69eb7f645a59d7731b61" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/498e67a0c82bd5791fda9b0dd0f4ec8e8aebb02d", - "reference": "498e67a0c82bd5791fda9b0dd0f4ec8e8aebb02d", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/eaa7be704b8b93a6913b69eb7f645a59d7731b61", + "reference": "eaa7be704b8b93a6913b69eb7f645a59d7731b61", "shasum": "" }, "require": { @@ -1610,7 +1621,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/2.0.46" + "source": "https://github.com/phpseclib/phpseclib/tree/2.0.48" }, "funding": [ { @@ -1626,7 +1637,7 @@ "type": "tidelift" } ], - "time": "2023-12-29T01:52:43+00:00" + "time": "2024-12-14T21:03:54+00:00" }, { "name": "rmariuzzo/jquery-checkboxes", @@ -1668,12 +1679,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + }, "branch-alias": { "dev-main": "1.19-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -3273,16 +3284,16 @@ }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" + "reference": "92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", - "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54", + "reference": "92a1a52e86d34cde6caa54f1b5ffa9fda18e5d54", "shasum": "" }, "require": { @@ -3316,7 +3327,7 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.3" }, "funding": [ { @@ -3324,7 +3335,7 @@ "type": "github" } ], - "time": "2020-11-30T08:15:22+00:00" + "time": "2024-03-01T13:45:45+00:00" }, { "name": "sebastian/comparator", @@ -3682,16 +3693,16 @@ }, { "name": "sebastian/object-enumerator", - "version": "3.0.4", + "version": "3.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" + "reference": "ac5b293dba925751b808e02923399fb44ff0d541" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", - "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/ac5b293dba925751b808e02923399fb44ff0d541", + "reference": "ac5b293dba925751b808e02923399fb44ff0d541", "shasum": "" }, "require": { @@ -3727,7 +3738,7 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.5" }, "funding": [ { @@ -3735,20 +3746,20 @@ "type": "github" } ], - "time": "2020-11-30T07:40:27+00:00" + "time": "2024-03-01T13:54:02+00:00" }, { "name": "sebastian/object-reflector", - "version": "1.1.2", + "version": "1.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" + "reference": "1d439c229e61f244ff1f211e5c99737f90c67def" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", - "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/1d439c229e61f244ff1f211e5c99737f90c67def", + "reference": "1d439c229e61f244ff1f211e5c99737f90c67def", "shasum": "" }, "require": { @@ -3782,7 +3793,7 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" + "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.3" }, "funding": [ { @@ -3790,7 +3801,7 @@ "type": "github" } ], - "time": "2020-11-30T07:37:18+00:00" + "time": "2024-03-01T13:56:04+00:00" }, { "name": "sebastian/phpcpd", @@ -3849,16 +3860,16 @@ }, { "name": "sebastian/recursion-context", - "version": "3.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" + "reference": "9bfd3c6f1f08c026f542032dfb42813544f7d64c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", - "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/9bfd3c6f1f08c026f542032dfb42813544f7d64c", + "reference": "9bfd3c6f1f08c026f542032dfb42813544f7d64c", "shasum": "" }, "require": { @@ -3900,7 +3911,7 @@ "homepage": "http://www.github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" + "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.2" }, "funding": [ { @@ -3908,7 +3919,7 @@ "type": "github" } ], - "time": "2020-11-30T07:34:24+00:00" + "time": "2024-03-01T14:07:30+00:00" }, { "name": "sebastian/resource-operations", @@ -4530,12 +4541,12 @@ }, "type": "library", "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + }, "branch-alias": { "dev-main": "1.19-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" } }, "autoload": { diff --git a/public/js/plugin/highchartsVue.js b/public/js/plugin/highchartsVue.js new file mode 100644 index 000000000..3a324db19 --- /dev/null +++ b/public/js/plugin/highchartsVue.js @@ -0,0 +1,113 @@ +function doCopy (copy, original, copyArray) { + // Callback function to iterate on array or object elements + function callback (value, key) { + // Copy the contents of objects + if (Highcharts.isObject(value, !copyArray) && + !Highcharts.isClass(value) && + !Highcharts.isDOMElement(value) + ) { + copy[key] = doCopy(copy[key] || Highcharts.isArray(value) ? [] : {}, value, copyArray) + } else { + // Primitives are copied over directly + copy[key] = original[key] + } + } + + if (Highcharts.isArray(original)) { + original.forEach(callback) + } else { + Highcharts.objectEach(original, callback) + } + return copy + } + +const copyObject = function (obj, copyArray) { + return doCopy({}, obj, copyArray) +} + +const highchartsPlugin = { + + install(app, options) { + + function destroyChart() { + if (this.chart) { + this.chart.destroy() + } + } + + function generateVueComponent(Highcharts, VueVersion) { + const VUE_MAJOR = VueVersion.split('.')[0] + const VERSION_DEPENDENT_PROPS = VUE_MAJOR < 3 + ? { + // Fallback options for Vue v2 to keep backward compatibility. + render: (createElement) => createElement('div', { + ref: 'chart' + }), + beforeDestroy: destroyChart + // The new Vue's 3 syntax. + } : { + render () { + return Vue.h('div', { ref: 'chart' }) + }, + beforeUnmount: destroyChart + } + + return { + template: '
', + props: { + constructorType: { + type: String, + default: 'chart' + }, + options: { + type: Object, + required: true + }, + callback: Function, + updateArgs: { + type: Array, + default: () => [true, true] + }, + highcharts: { + type: Object + }, + deepCopyOnUpdate: { + type: Boolean, + default: true + } + }, + watch: { + options: { + handler (newValue) { + this.chart.update(copyObject(newValue, this.deepCopyOnUpdate), ...this.updateArgs) + }, + deep: true + } + }, + mounted () { + let HC = this.highcharts || Highcharts + + // Check whether the chart configuration object is passed, as well as the constructor is valid. + if (this.options && HC[this.constructorType]) { + this.chart = HC[this.constructorType]( + this.$refs.chart, + copyObject(this.options, true), // Always pass the deep copy when generating a chart. #80 + this.callback ? this.callback : null + ) + } else { + (!this.options) ? console.warn('The "options" parameter was not passed.') : console.warn(`'${this.constructorType}' constructor-type is incorrect. Sometimes this error is caused by the fact, that the corresponding module wasn't imported.`) + } + }, + ...VERSION_DEPENDENT_PROPS + } + } + + app.component( + options.tagName || 'highcharts', + generateVueComponent(options.highcharts || Highcharts, Vue.version) + ) + }, + +} + +export default highchartsPlugin \ No newline at end of file