Broken Rule.js example1

Developer
Size
3,541 Kb
Views
22,264

How do I make an broken rule.js example1?

What is a broken rule.js example1? How do you make a broken rule.js example1? This script and codes were developed by Khalid Munir on 26 August 2022, Friday.

Broken Rule.js example1 Previews

Broken Rule.js example1 - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Broken Rule.js example1</title> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="col-xs-12"> <section> <h1 class="page-header">RuleJS</h1> <p class="view"><a href="https://github.com/handsontable/RuleJS" target="_blank">View the Project on GitHub <small>handsontable/RuleJS</small></a></p> <ul> <li><a href="https://github.com/handsontable/RuleJS/zipball/master">Download <strong>ZIP File</strong></a></li> <li><a href="https://github.com/handsontable/RuleJS/tarball/master">Download <strong>TAR Ball</strong></a></li> <li><a href="https://github.com/handsontable/RuleJS">View On <strong>GitHub</strong></a></li> </ul> <h2>JS Library to parse excel formulas (based on <a href="https://github.com/zaach/jison" target="_blank">jison parser</a> and <a href="https://github.com/sutoiku/formula.js" target="_blank">formula</a>).</h2> <p>Supported formulas are listed below.</p> </section> <section> <p>List of supported formulas:</p> <div id="suportedList" class="col-xs-6" style="height: 400px; overflow-y: scroll;"></div> </section> <div class="clearfix"></div> <section> <h1 class="page-header">Demo</h1> <p>Try to parse the formula by typing ex. <code>AND(1,0)</code> into input below and press <kbd>Parse</kbd> button.</p> <div class="col-xs-6" style="padding: 0px;" id="demo1"> <input type="text" id="X1" placeholder="ex. AND(1,0)"><button>Parse</button> <p class="bg-info" style="display: none">result: <span id="result"></span></p> <p class="bg-danger" style="display: none">error: <span id="error"></span></p> <p class="clearfix"></p> <p>Try to insert formula into input field by typing ex. <code>=A1</code>. It's possible to edit formula by double clicked on input field.</p> <table class="table table-bordered"> <thead> <tr> <td></td> <td>A</td> <td>B</td> <td>C</td> <td>D</td> <td>E</td> <td>F</td> <td>G</td> <td>H</td> <td>I</td> <td>J</td> <td colspan="2" class="text-center">fn(x)</td> </tr> </thead> <tbody> <tr> <td>1</td> <td><input class="dataItem" id="A1" value="1"></td> <td><input class="dataItem" id="B1" value="2"></td> <td><input class="dataItem" id="C1" value="3"></td> <td><input class="dataItem" id="D1" value="4"></td> <td><input class="dataItem" id="E1" value="5"></td> <td><input class="dataItem" id="F1" value="6"></td> <td><input class="dataItem" id="G1" value="7"></td> <td><input class="dataItem" id="H1" value="8"></td> <td><input class="dataItem" id="I1" value="9"></td> <td><input class="dataItem" id="J1" value="10"></td> <td>SUM(A1:D1, H1)</td> <td><span id="K1" data-formula="SUM(A1:D1, H1)"></span></td> </tr> <tr> <td>2</td> <td><input class="dataItem" id="A2" value="-1"></td> <td><input class="dataItem" id="B2" value="-10"></td> <td><input class="dataItem" id="C2" value="2"></td> <td><input class="dataItem" id="D2" value="4"></td> <td><input class="dataItem" id="E2" value="100"></td> <td><input class="dataItem" id="F2" value="1"></td> <td><input class="dataItem" id="G2" value="50"></td> <td><input class="dataItem" id="H2" value="20"></td> <td><input class="dataItem" id="I2" value="200"></td> <td><input class="dataItem" id="J2" value="-100"></td> <td>MAX(A2:J2)</td> <td><span id="K2" data-formula="MAX(A2:J2)"></span></td> </tr> <tr> <td>3</td> <td><input class="dataItem" id="A3" value="-1"></td> <td><input class="dataItem" id="B3" value="-40"></td> <td><input class="dataItem" id="C3" value="-53"></td> <td><input class="dataItem" id="D3" value="1"></td> <td><input class="dataItem" id="E3" value="10"></td> <td><input class="dataItem" id="F3" value="30"></td> <td><input class="dataItem" id="G3" value="10"></td> <td><input class="dataItem" id="H3" value="301"></td> <td><input class="dataItem" id="I3" value="-1"></td> <td><input class="dataItem" id="J3" value="-20"></td> <td>MIN(A3:J3)</td> <td><span id="K3" data-formula="MIN(A3:J3)"></span></td> </tr> <tr> <td>4</td> <td><input class="dataItem" id="A4" value="20"></td> <td><input class="dataItem" id="B4" value="50"></td> <td><input class="dataItem" id="C4" value="100"></td> <td><input class="dataItem" id="D4" value="20"></td> <td><input class="dataItem" id="E4" value="1"></td> <td><input class="dataItem" id="F4" value="5"></td> <td><input class="dataItem" id="G4" value="15"></td> <td><input class="dataItem" id="H4" value="25"></td> <td><input class="dataItem" id="I4" value="45"></td> <td><input class="dataItem" id="J4" value="23"></td> <td>AVERAGE(A4:J4):</td> <td><span id="K4" data-formula="AVERAGE(A4:J4)"></span></td> </tr> <tr> <td>5</td> <td><input class="dataItem" id="A5" value="0"></td> <td><input class="dataItem" id="B5" value="10"></td> <td><input class="dataItem" id="C5" value="1"></td> <td><input class="dataItem" id="D5" value="10"></td> <td><input class="dataItem" id="E5" value="2"></td> <td><input class="dataItem" id="F5" value="10"></td> <td><input class="dataItem" id="G5" value="3"></td> <td><input class="dataItem" id="H5" value="10"></td> <td><input class="dataItem" id="I5" value="4"></td> <td><input class="dataItem" id="J5" value="10"></td> <td>SUMIF(A5:J5,'>5')</td> <td><span id="K5" data-formula="SUMIF(A5:J5,'>5')"></span></td> </tr> </tbody> </table> </div> </section>
</div>
<br><br><br> <script src='http://handsontable.github.io/ruleJS/dist/lib/lodash/lodash.js'></script>
<script src='http://handsontable.github.io/ruleJS/dist/lib/underscore.string/underscore.string.js'></script>
<script src='http://handsontable.github.io/ruleJS/dist/lib/moment/moment.js'></script>
<script src='http://handsontable.github.io/ruleJS/dist/lib/numeral/numeral.js'></script>
<script src='http://handsontable.github.io/ruleJS/dist/lib/numericjs/numeric.js'></script>
<script src='http://handsontable.github.io/ruleJS/dist/lib/js-md5/md5.js'></script>
<script src='http://handsontable.github.io/ruleJS/dist/lib/jstat/jstat.js'></script>
<script src='http://handsontable.github.io/ruleJS/dist/lib/formulajs/formula.js'></script>
<script src='http://handsontable.github.io/ruleJS/dist/js/parser.js'></script>
<script src='http://handsontable.github.io/ruleJS/dist/js/ruleJS.js'></script> <script src="js/index.js"></script>
</body>
</html>

Broken Rule.js example1 - Script Codes CSS Codes


.table input[type=text] { width: 50px; }
#suportedList ul { -webkit-column-count: 4; -webkit-column-gap:20px; -moz-column-count:4; -moz-column-gap:20px; -o-column-count:4; -o-column-gap:20px; column-count:4; column-gap:20px; }

Broken Rule.js example1 - Script Codes JS Codes

window.onready = (function () { var rules = new ruleJS('demo1'); rules.init(); var button = document.querySelector('button'), input = document.querySelector('input.dataItem'), result = document.querySelector('#result'), error = document.querySelector('#error'); console.log(input); console.log(button); button.addEventListener('click', function () { result.parentNode.style.display = 'none'; error.parentNode.style.display = 'none'; var formula = input.value; var parsed = rules.parse(formula, input); if (parsed.result !== null) { result.parentNode.style.display = ''; result.innerText = parsed.result; } if (parsed.error) { error.parentNode.style.display = ''; error.innerText = parsed.error; } }); // this can be removed - a little later var listFormulas = (function() { var container = document.querySelector('#suportedList'), ul = document.createElement('ul'); container.appendChild(ul); //var methods = []; //for (var method in rules.helper.SUPPORTED_FORMULAS) { // methods.push(method); //} //methods.sort(); var methods = rules.helper.SUPPORTED_FORMULAS.sort(); methods.forEach(function (item) { var li = document.createElement('li'), a = document.createElement('a'); a.href = 'http://www.stoic.com/pages/formula/function?function=' + item; a.target = '_blank'; a.innerHTML = item; li.appendChild(a); ul.appendChild(li); }); })(); })();
Broken Rule.js example1 - Script Codes
Broken Rule.js example1 - Script Codes
Home Page Home
Developer Khalid Munir
Username khalidmunir
Uploaded August 26, 2022
Rating 3
Size 3,541 Kb
Views 22,264
Do you need developer help for Broken Rule.js example1?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Khalid Munir (khalidmunir) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!