From 4ae481c6c947536c1e6a71d0f03dbe51685f8165 Mon Sep 17 00:00:00 2001 From: Quimet <63587466+DnomaidGit@users.noreply.github.com> Date: Sun, 31 Mar 2024 16:31:06 +0200 Subject: [PATCH] Add files via upload --- Sources/CustomControls/Table/control/LICENSE | 21 ++++++ .../CustomControls/Table/control/README.md | 64 +++++++++++++++++ .../Table/control/codeDnomaid.js | 54 +++++++++++++++ .../CustomControls/Table/control/index.html | 19 +++++ .../CustomControls/Table/control/webcc.min.js | 2 + .../Table/control/webccInterface.js | 69 +++++++++++++++++++ 6 files changed, 229 insertions(+) create mode 100644 Sources/CustomControls/Table/control/LICENSE create mode 100644 Sources/CustomControls/Table/control/README.md create mode 100644 Sources/CustomControls/Table/control/codeDnomaid.js create mode 100644 Sources/CustomControls/Table/control/index.html create mode 100644 Sources/CustomControls/Table/control/webcc.min.js create mode 100644 Sources/CustomControls/Table/control/webccInterface.js diff --git a/Sources/CustomControls/Table/control/LICENSE b/Sources/CustomControls/Table/control/LICENSE new file mode 100644 index 0000000..dd236b2 --- /dev/null +++ b/Sources/CustomControls/Table/control/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2020 Oli Folkerd + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Sources/CustomControls/Table/control/README.md b/Sources/CustomControls/Table/control/README.md new file mode 100644 index 0000000..afcf52d --- /dev/null +++ b/Sources/CustomControls/Table/control/README.md @@ -0,0 +1,64 @@ +![Tabulator Table](http://olifolkerd.github.io/tabulator/images/tabulator.png) + +An easy to use interactive table generation JavaScript library + +Full documentation & demos can be found at: [http://tabulator.info](http://tabulator.info) +*** +![Tabulator Table](http://tabulator.info/images/tabulator_table.jpg) +*** + +Features +================================ +Tabulator allows you to create interactive tables in seconds from any HTML Table, Javascript Array or JSON formatted data. + +Simply include the library and the css in your project and you're away! + +Tabulator is packed with useful features including: + +![Tabulator Features](http://olifolkerd.github.io/tabulator/images/featurelist_share.png) + + +Frontend Framework Support +================================ +Tabulator is built to work with all the major front end JavaScript frameworks including React, Angular and Vue. + + +Setup +================================ +Setting up tabulator could not be simpler. + +Include the library and the css +```html + + +``` + +Create an element to hold the table +```html +
+``` + +Turn the element into a tabulator with some simple javascript +```js +var table = new Tabulator("#example-table", {}); +``` + + +### Bower Installation +To get Tabulator via the Bower package manager, open a terminal in your project directory and run the following commmand: +``` +bower install tabulator --save +``` + +### NPM Installation +To get Tabulator via the NPM package manager, open a terminal in your project directory and run the following commmand: +``` +npm install tabulator-tables --save +``` + +### CDN - UNPKG +To access Tabulator directly from the UNPKG CDN servers, include the following two lines at the start of your project, instead of the localy hosted versions: +```html + + +``` \ No newline at end of file diff --git a/Sources/CustomControls/Table/control/codeDnomaid.js b/Sources/CustomControls/Table/control/codeDnomaid.js new file mode 100644 index 0000000..8033278 --- /dev/null +++ b/Sources/CustomControls/Table/control/codeDnomaid.js @@ -0,0 +1,54 @@ + let ArrayData = []; + let ArrayColumn = []; + let table; + let selectedRow = null; + // Initialize the custom control (without a successful initialization, the CWC will remain empty. Make sure to include the webcc.min.js script!) + // "result" is a boolean defining if the connection was successfull or not. + function init(result) { + if (result) { + webccInterfaceInit(); + } else { + console.log('Connection NOK'); + } + } + WebCC.start(init, webccInterface.contract, EXTENSIONS, TIMEOUT); + function showDemoData() { + // Get the table container element + var tableContainer = document.getElementById("example-table"); + } + function drawTable(columnStyleString, tableDataString) { + try { + var tabledata = (tableDataString && JSON.parse(tableDataString)) || []; + var columnStyle = (columnStyleString && JSON.parse(columnStyleString)) || []; + } catch(e) { + console.error('Error parsing JSON:', e); + return; + } + //choose how the table should look like or behave. More information on http://tabulator.info/ + table = new Tabulator("#example-table", { + height: 'calc(100% - 2px)', // set height of table to 100% minus 2 px, because the border of the table is 1px top and border + data: tabledata, //load initial data into table + layout: "fitColumns", //fit columns to width of table (optional) + columns: columnStyle, + selectable: true, // Enable selection + rowClick: function (e, row) { // Table configuration options + // Deselect all rows + if (selectedRow) { + table.deselectRow(); + } + // Select the clicked row + row.select(); + selectedRow = row; + } + }); + } + function showRuntimeData() { + // Get the table container element + var tableContainer = document.getElementById("example-table"); + // Attach a click event listener to the table container + tableContainer.addEventListener("click", function () { + // Get the selected row(s) + var selectedRows = table.getSelectedRows(); + WebCC.Events.fire("SelectedRow",selectedRows[0]._row.data); + }); + } \ No newline at end of file diff --git a/Sources/CustomControls/Table/control/index.html b/Sources/CustomControls/Table/control/index.html new file mode 100644 index 0000000..47d4907 --- /dev/null +++ b/Sources/CustomControls/Table/control/index.html @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/Sources/CustomControls/Table/control/webcc.min.js b/Sources/CustomControls/Table/control/webcc.min.js new file mode 100644 index 0000000..16a7d2c --- /dev/null +++ b/Sources/CustomControls/Table/control/webcc.min.js @@ -0,0 +1,2 @@ +/* Version 1.4.2, copyright (C) 2018, Siemens AG. All Rights Reserved. */ +var WebCC=WebCC||function(){var a="pending",b=-1,c=window.parent,d=null,e=null,f={},g=[],h={},i=function(){window.clearTimeout(b),window.removeEventListener?window.removeEventListener("message",d):window.detachEvent("onmessage",d)},j=function(a,b,c){var d=document.createElement("script");d.setAttribute("type","text/javascript"),d.setAttribute("src",a),(b||c)&&(d.addEventListener?(b&&d.addEventListener("load",b),c&&d.addEventListener("error",function(){c("Failed to load "+a+" library")})):b&&(d.onreadystatechange=function(){"loaded"===this.readyState||"complete"===this.readyState?b():c&&c()})),document.getElementsByTagName("head")?document.getElementsByTagName("head")[0].appendChild(d):document.getElementsByTagName("body")[0].appendChild(d)},k=function(a){return JSON.stringify({t:"boot",c:a})},l=function(b,c,d){var l,m,n,o,p,q,r={},s=null,t=null,u=null;if(("waiting"===a||"ok"===a)&&"string"==typeof b.data&&b.data.length>0){try{if(r=JSON.parse(b.data),!(r&&r.t&&r.c))throw new Error("Incompatible message received");if("boot"!==r.t)throw new Error("Unknown message received: "+r.t)}catch(v){return}if(m=function(b){a="failed",i(),d({message:b}),swacPostMessage(k({message:"failed"}),"*")},"boot"===r.t&&"pong"===r.c.message){if(n=function(){SWAC.isContainer=!1,a="ok",e=r.c,e.containerVersion=e.containerVersion||"1.0.0",swacPostMessage(k({message:"ok"}),"*")},p=function(){var a,b=g.length,c=null;if("undefined"!=typeof SWAC.Hub.prototype.Extensions)c=SWAC.Hub.prototype.Extensions;else{if("undefined"==typeof WebCC)return n(),void 0;c=WebCC.Extensions}if(null!==t){if(Object.keys(c).length!==t+1&&"undefined"==typeof SWACBoot)return m("Invalid Extension"),void 0;for(var d in c)c.hasOwnProperty(d)&&"undefined"!=typeof h[d]&&(c[h[d]]=c[d],delete c[d],delete h[d])}0===b||"undefined"==typeof WebCC&&SWAC._internal.Utils.checkVersion(u,"1.4.1")<0?n():(a=g.pop(),"undefined"==typeof defineExtension?j(a,p,m):"undefined"==typeof SWACBoot&&"undefined"==typeof WebCC.Extensions?(s=/^\s+|\s+$/g,void 0===a||null===a||""===a.replace(s,"")?m("Failed to load SWAC.Config.Control.URLs library"):(l=function(){"undefined"!=typeof WebCC.Extensions?p():m("Failed to load SWAC.Config.Control.URLs library")},j(a,l,m)),s=null):"$$unknownExtension$$"===a?"undefined"!=typeof SWACBoot?p():m("Unknown Extension"):(t=Object.keys(c).length,j(a,p,"undefined"!=typeof SWACBoot?p:m)))},r.c.extensions)for(q in r.c.extensions)r.c.extensions.hasOwnProperty(q)&&g.unshift(r.c.extensions[q]);u=r.c.containerVersion||"1.0.0","undefined"!=typeof SWAC?p():(s=/^\s+|\s+$/g,void 0===r.c.url||null===r.c.url||""===r.c.url.replace(s,"")?m("Failed to load SWAC.Config.Container.URLs library"):(l=function(){"undefined"!=typeof SWAC||"undefined"!=typeof r.c.namespace&&"undefined"!=typeof window[r.c.namespace]?p():m("Failed to load SWAC.Config.Container.URLs library")},a="upgrading",j(r.c.url,l,m)),s=null)}else if("boot"===r.t&&"ok2"===r.c.message){a="done",i();for(o in e)e.hasOwnProperty(o)&&(f[o]=e[o]);e.message="SWAC successfully loaded",e.auth=e.authentication,delete e.authentication,delete e.url,delete e.extensions,delete e.namespace,r.c.details||(f.details={path:[""]});for(o in r.c)"message"!==o&&r.c.hasOwnProperty(o)&&(f.hasOwnProperty(o)||(f[o]=r.c[o]));delete e._internal,SWAC.Hub.prototype.containerVersion=e.containerVersion,c(e)}else"boot"===r.t&&"peng"===r.c.message&&(i(),d({message:r.c.reason}))}},m=function(){if(c===self){if("object"==typeof swacNative&&"function"==typeof swacNative.postMessage)return swacNative.postMessage;if(window.external&&"function"==typeof window.external.postMessage)return window.external.postMessage}return null},n=function(e,g,j,n,o){j=j||"*",o=o||1e3,g=g||function(){},n=n||"no";var p,q,r,s=[];if("done"===a)return window.setTimeout(function(){g({message:"Boot phase already done"})},0),void 0;if(p=m(),c===self&&"function"!=typeof p&&"function"!=typeof window.swacPostMessage)a="failed",f.details={path:[""]},window.setTimeout(function(){g({message:"Component is not embedded into an iframe"})},0);else{if("function"!=typeof window.swacPostMessage&&(window.swacPostMessage="function"==typeof p?p:function(a,b){return c.postMessage(a,b)}),d=function(a){l(a,e,g)},a="waiting",window.addEventListener?window.addEventListener("message",d,!1):window.attachEvent("onmessage",d),b=window.setTimeout(function(){"done"!==a&&(a="timedout",f.details={path:[""]},i(),g({message:"Bootload sequence timed out"}))},o),null!==arguments[6]&&"undefined"!=typeof arguments[6])for(r=0;r',' Value <', data.value, '>'); + }; + var subscribe_ = function () { + WebCC.onPropertyChanged.subscribe(webccInterface.setProperty); + console.log('Subscribe'); + }; + return { + init: init_, + setProperty: setProperty_, + subscribe: subscribe_, + contract: CONTRACT + }; +}(); + +var webccInterfaceInit = function () { + // Initialize + if (WebCC.isDesignMode) { + webccInterface.init(); + showDemoData(); + console.log('Design Mode'); + }else { + webccInterface.init(); + showRuntimeData(); + console.log('Connection OK'); + } +}; \ No newline at end of file