From 7bbcaebef1d271402df77c837b8f39fa5c7b55e3 Mon Sep 17 00:00:00 2001 From: tsv2013 Date: Thu, 29 Aug 2024 14:38:41 +0300 Subject: [PATCH] Resolved #466 - Remove wordcloud2.js from dependencies in code --- examples/bar-vertical.html | 2 -- examples/chart_text.html | 2 -- examples/custom-gauge.html | 2 -- examples/custom_vis.html | 2 -- examples/debug.html | 2 -- examples/histogram.html | 2 -- examples/matrix-one-row.html | 2 -- examples/matrixdropdown-grouped.html | 2 -- examples/matrixdropdown.html | 2 -- examples/matrixes.html | 2 -- examples/multi_lang.html | 2 -- examples/ranking.html | 2 -- examples/state_in_localstorage.html | 2 -- examples/summary.html | 2 -- examples/summarytest.html | 2 -- package-lock.json | 28 ++--------------- package.json | 4 +-- src/wordcloud/wordcloud.ts | 46 ---------------------------- webpack.config.js | 6 ---- 19 files changed, 3 insertions(+), 111 deletions(-) diff --git a/examples/bar-vertical.html b/examples/bar-vertical.html index c757a8ddb..ed315400f 100644 --- a/examples/bar-vertical.html +++ b/examples/bar-vertical.html @@ -13,8 +13,6 @@ - - diff --git a/examples/chart_text.html b/examples/chart_text.html index 46febaaa6..6c036ef96 100644 --- a/examples/chart_text.html +++ b/examples/chart_text.html @@ -13,8 +13,6 @@ - - diff --git a/examples/custom-gauge.html b/examples/custom-gauge.html index 95691d462..b7ae619f7 100644 --- a/examples/custom-gauge.html +++ b/examples/custom-gauge.html @@ -13,8 +13,6 @@ - - diff --git a/examples/custom_vis.html b/examples/custom_vis.html index 1d7131fa2..37246de03 100644 --- a/examples/custom_vis.html +++ b/examples/custom_vis.html @@ -13,8 +13,6 @@ - - diff --git a/examples/debug.html b/examples/debug.html index 7268bd127..76c1c8ab3 100644 --- a/examples/debug.html +++ b/examples/debug.html @@ -13,8 +13,6 @@ - - diff --git a/examples/histogram.html b/examples/histogram.html index e37886404..7200e4609 100644 --- a/examples/histogram.html +++ b/examples/histogram.html @@ -13,8 +13,6 @@ - - diff --git a/examples/matrix-one-row.html b/examples/matrix-one-row.html index 1883d4994..a0dd79893 100644 --- a/examples/matrix-one-row.html +++ b/examples/matrix-one-row.html @@ -13,8 +13,6 @@ - - diff --git a/examples/matrixdropdown-grouped.html b/examples/matrixdropdown-grouped.html index 06a296f5e..5f8946f42 100644 --- a/examples/matrixdropdown-grouped.html +++ b/examples/matrixdropdown-grouped.html @@ -13,8 +13,6 @@ - - diff --git a/examples/matrixdropdown.html b/examples/matrixdropdown.html index 5d3875276..648eb4f62 100644 --- a/examples/matrixdropdown.html +++ b/examples/matrixdropdown.html @@ -13,8 +13,6 @@ - - diff --git a/examples/matrixes.html b/examples/matrixes.html index 99b61f5c5..41848c43a 100644 --- a/examples/matrixes.html +++ b/examples/matrixes.html @@ -13,8 +13,6 @@ - - diff --git a/examples/multi_lang.html b/examples/multi_lang.html index cb2d327c6..e51f547bc 100644 --- a/examples/multi_lang.html +++ b/examples/multi_lang.html @@ -14,8 +14,6 @@ - - diff --git a/examples/ranking.html b/examples/ranking.html index 27feb8c08..11540bfe4 100644 --- a/examples/ranking.html +++ b/examples/ranking.html @@ -13,8 +13,6 @@ - - diff --git a/examples/state_in_localstorage.html b/examples/state_in_localstorage.html index bc778ede2..4edd5b795 100644 --- a/examples/state_in_localstorage.html +++ b/examples/state_in_localstorage.html @@ -13,8 +13,6 @@ - - diff --git a/examples/summary.html b/examples/summary.html index 022da0b6c..28f3dc6ab 100644 --- a/examples/summary.html +++ b/examples/summary.html @@ -13,8 +13,6 @@ - - diff --git a/examples/summarytest.html b/examples/summarytest.html index f64eed541..5012d2cf5 100644 --- a/examples/summarytest.html +++ b/examples/summarytest.html @@ -13,8 +13,6 @@ - - diff --git a/package-lock.json b/package-lock.json index 39cde0be2..56911fc8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "survey-analytics", - "version": "1.11.11", + "version": "1.11.13", "license": "SEE LICENSE IN LICENSE", "dependencies": { "datatables.net": "^1.11.5", @@ -25,15 +25,13 @@ "muuri": "^0.8.0", "plotly.js-dist-min": "^2.28.0", "survey-core": "latest", - "tabulator-tables": "4.8.4", - "wordcloud": "^1.2.2" + "tabulator-tables": "4.8.4" }, "devDependencies": { "@types/jest": "^26.0.24", "@types/jquery": "3.3.29", "@types/lodash": "4.14.121", "@types/node": "7.0.4", - "@types/wordcloud": "^1.1.3", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", "ajv": "6.12.3", @@ -3757,12 +3755,6 @@ "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", "dev": true }, - "node_modules/@types/wordcloud": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@types/wordcloud/-/wordcloud-1.2.2.tgz", - "integrity": "sha512-UMKd/doXE3karDUd5l+2LqFKUU4SmuPWOT/VA22OrPOUGMlb8/qQvSf+DBLQf/sd8UphuBGxOK/jB/1BB5oQRw==", - "dev": true - }, "node_modules/@types/ws": { "version": "8.5.11", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.11.tgz", @@ -18840,11 +18832,6 @@ "node": ">=0.10.0" } }, - "node_modules/wordcloud": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/wordcloud/-/wordcloud-1.2.2.tgz", - "integrity": "sha512-fUnDsGrHXou+49j1OeKaC7nOeZPx+sWjIet0L/j6eAcm0nXy+a+AuUs/iDAX4PLBg1Zc6wgXWXhoXdQsXRWAEw==" - }, "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", @@ -21961,12 +21948,6 @@ "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", "dev": true }, - "@types/wordcloud": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@types/wordcloud/-/wordcloud-1.2.2.tgz", - "integrity": "sha512-UMKd/doXE3karDUd5l+2LqFKUU4SmuPWOT/VA22OrPOUGMlb8/qQvSf+DBLQf/sd8UphuBGxOK/jB/1BB5oQRw==", - "dev": true - }, "@types/ws": { "version": "8.5.11", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.11.tgz", @@ -33397,11 +33378,6 @@ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true }, - "wordcloud": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/wordcloud/-/wordcloud-1.2.2.tgz", - "integrity": "sha512-fUnDsGrHXou+49j1OeKaC7nOeZPx+sWjIet0L/j6eAcm0nXy+a+AuUs/iDAX4PLBg1Zc6wgXWXhoXdQsXRWAEw==" - }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", diff --git a/package.json b/package.json index e52fe934d..81f7b6b52 100644 --- a/package.json +++ b/package.json @@ -59,15 +59,13 @@ "muuri": "^0.8.0", "plotly.js-dist-min": "^2.28.0", "survey-core": "latest", - "tabulator-tables": "4.8.4", - "wordcloud": "^1.2.2" + "tabulator-tables": "4.8.4" }, "devDependencies": { "@types/jest": "^26.0.24", "@types/jquery": "3.3.29", "@types/lodash": "4.14.121", "@types/node": "7.0.4", - "@types/wordcloud": "^1.1.3", "@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/parser": "^4.33.0", "ajv": "6.12.3", diff --git a/src/wordcloud/wordcloud.ts b/src/wordcloud/wordcloud.ts index 2a1294224..840b4fa29 100644 --- a/src/wordcloud/wordcloud.ts +++ b/src/wordcloud/wordcloud.ts @@ -4,7 +4,6 @@ import { VisualizationManager } from "../visualizationManager"; import { textHelper } from "./stopwords/index"; import { DocumentHelper } from "../utils"; import { localization } from "../localizationManager"; -// import WordCloudLib from "wordcloud"; import { WordCloudWidget, defaultOptions } from "./widget"; export class WordCloudAdapter { @@ -27,51 +26,6 @@ export class WordCloudAdapter { return this._wordcloud; } - private async createWordCloud2(node: HTMLElement) { - const data = await this.model.getCalculatedValues(); - const colors = this.model.getColors(); - const canvasNode = ( - DocumentHelper.createElement("canvas", "") - ); - const emptyTextNode = DocumentHelper.createElement("p", "", { - innerText: localization.getString("noResults"), - }); - - if (data.length === 0) { - node.appendChild(emptyTextNode); - return; - } - - node.appendChild(canvasNode); - - const config = { - list: data, - weightFactor: WordCloudAdapter.weightFactor, - abortThreshold: WordCloudAdapter.abortThreshold, - drawOutOfBound: WordCloudAdapter.drawOutOfBound, - shrinkToFit: WordCloudAdapter.shrinkToFit, - fontFamily: "Segoe UI Bold, sans-serif", - color: (word: string, weight: number) => { - return this.model.getRandomColor(); - }, - rotateRatio: 0.5, - rotationSteps: 2, - backgroundColor: this.model.backgroundColor, - click: function (item: any) { - // eslint-disable-next-line no-console - console.log(item[0] + ": " + item[1]); - }, - }; - - const options = { - canvas: canvasNode, - config - }; - WordCloudAdapter.onWordcloudCreating.fire(this.model, options); - // this._wordcloud = WordCloudLib(options.canvas, options.config as any); - return this._wordcloud; - } - public async create(element: HTMLElement): Promise { const data = await this.model.getCalculatedValues(); const colors = this.model.getColors(); diff --git a/webpack.config.js b/webpack.config.js index 9e2ede582..8ee7592f1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -185,12 +185,6 @@ module.exports = function (options) { commonjs: "survey-core", amd: "survey-core", }, - wordcloud: { - root: "WordCloud", - commonjs2: "wordcloud", - commonjs: "wordcloud", - amd: "wordcloud", - }, "plotly.js-dist-min": { root: "Plotly", commonjs2: "plotly.js-dist-min",