From 96333f46974bdba03e936db13aa552c0203ac64a Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 14 Nov 2023 23:24:29 +0100 Subject: [PATCH] Serve locally xlsx-populate (no CDN) --- app/static/libjs/xlsx-populate-1.21.0.min.js | 2 ++ app/templates/scolar/partition_editor.j2 | 2 +- app/templates/scolar/students_groups_auto_assignment.j2 | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 app/static/libjs/xlsx-populate-1.21.0.min.js diff --git a/app/static/libjs/xlsx-populate-1.21.0.min.js b/app/static/libjs/xlsx-populate-1.21.0.min.js new file mode 100644 index 000000000..8a7afb033 --- /dev/null +++ b/app/static/libjs/xlsx-populate-1.21.0.min.js @@ -0,0 +1,2 @@ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).XlsxPopulate=e()}}(function(){var define,module,exports;return function a(o,s,f){function u(t,e){if(!s[t]){if(!o[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(c)return c(t,!0);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}var i=s[t]={exports:{}};o[t][0].call(i.exports,function(e){return u(o[t][1][e]||e)},i,i.exports,a,o,s,f)}return s[t].exports}for(var c="function"==typeof require&&require,e=0;es.length&&(l=s.length);var d=s.slice(h+u,l+u),p=d.length%i;p&&(d=g.concat([d,g.alloc(i-p)]));var b=this._createIV(n,a,i,c),m=this._crypt(e,t,r,o,b,d);f.push(m),c++}var v=g.concat(f);if(e)v=g.concat([this._createUInt32LEBuffer(s.length,8),v]);else{var y=s.readUInt32LE(0);v=v.slice(0,y)}return v}},{key:"_createUInt32LEBuffer",value:function(e,t){var r=1c&&(s=s.slice(0,c));return s}},{key:"_createIV",value:function(e,t,r,n){"number"==typeof n&&(n=this._createUInt32LEBuffer(n));var i=this._hash(e,t,n);if(i.lengthr&&(i=i.slice(0,r));return i}}])&&i(t.prototype,r),n&&i(t,n),e}();r.exports=e}).call(this,t("buffer").Buffer)},{"./XmlBuilder":21,"./XmlParser":22,"./externals":27,"./xmlq":29,buffer:77,cfb:78,crypto:86,lodash:170}],8:[function(e,t,r){"use strict";function i(e,t){for(var r=0;r=r._nextId&&(r._nextId=t+1)})}},{key:"_init",value:function(e){e=e||{name:"Relationships",attributes:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"},children:[]},this._node=e}}])&&i(e.prototype,r),n&&i(e,n),t}();t.exports=n},{lodash:170}],12:[function(e,t,r){"use strict";function i(e,t){for(var r=0;rt){var o=u.cloneDeep(n);o.attributes.min=t+1;for(var s=o.attributes.min;s<=o.attributes.max;s++)this._colNodes[s]=o}}else r={name:"col",attributes:{min:t,max:t},children:[]},this._colNodes[t]=r;var f=new h(this,r);return this._columns[t]=f}},{key:"definedName",value:function(){var r=this;return new b("Workbook.definedName").case("string",function(e){return r.workbook().scopedDefinedName(r,e)}).case(["string","*"],function(e,t){return r.workbook().scopedDefinedName(r,e,t),r}).handle(arguments)}},{key:"delete",value:function(){return this.workbook().deleteSheet(this),this.workbook()}},{key:"find",value:function(t,r){t=f(t);var n=[];return this._rows.forEach(function(e){e&&(n=n.concat(e.find(t,r)))}),n}},{key:"gridLinesVisible",value:function(){var t=this,r=this._getOrCreateSheetViewNode();return new b("Sheet.gridLinesVisible").case(function(){return 1===r.attributes.showGridLines||void 0===r.attributes.showGridLines}).case("boolean",function(e){return r.attributes.showGridLines=e?1:0,t}).handle(arguments)}},{key:"hidden",value:function(){var r=this;return new b("Sheet.hidden").case(function(){return"hidden"===r._idNode.attributes.state||"veryHidden"===r._idNode.attributes.state&&"very"}).case("*",function(e){if(e){var t=u.filter(r.workbook().sheets(),function(e){return!e.hidden()});if(1===t.length&&t[0]===r)throw new Error("This sheet may not be hidden as a workbook must contain at least one visible sheet.");if(r.active())t[t[0]===r?1:0].active(!0)}return"very"===e?r._idNode.attributes.state="veryHidden":e?r._idNode.attributes.state="hidden":delete r._idNode.attributes.state,r}).handle(arguments)}},{key:"move",value:function(e){return this.workbook().moveSheet(this,e),this}},{key:"name",value:function(){var t=this;return new b("Sheet.name").case(function(){return"".concat(t._idNode.attributes.name)}).case("string",function(e){return t._idNode.attributes.name=e,t}).handle(arguments)}},{key:"range",value:function(){var i=this;return new b("Sheet.range").case("string",function(e){var t=p.fromAddress(e);if("range"!==t.type)throw new Error("Sheet.range: Invalid address");return i.range(t.startRowNumber,t.startColumnNumber,t.endRowNumber,t.endColumnNumber)}).case(["*","*"],function(e,t){return"string"==typeof e&&(e=i.cell(e)),"string"==typeof t&&(t=i.cell(t)),new o(e,t)}).case(["number","*","number","*"],function(e,t,r,n){return i.range(i.cell(e,t),i.cell(r,n))}).handle(arguments)}},{key:"autoFilter",value:function(e){return this._autoFilter=e,this}},{key:"row",value:function(e){if(e<1)throw new RangeError("Invalid row number ".concat(e,". Remember that spreadsheets use 1-based indexing."));if(this._rows[e])return this._rows[e];var t=new c(this,{name:"row",attributes:{r:e},children:[]});return this._rows[e]=t}},{key:"tabColor",value:function(){var r=this;return new b("Sheet.tabColor").case(function(){var e=d.findChild(r._sheetPrNode,"tabColor");if(e){var t={};return e.attributes.hasOwnProperty("rgb")?t.rgb=e.attributes.rgb:e.attributes.hasOwnProperty("theme")?t.theme=e.attributes.theme:e.attributes.hasOwnProperty("indexed")&&(t.rgb=m[e.attributes.indexed]),e.attributes.hasOwnProperty("tint")&&(t.tint=e.attributes.tint),t}}).case("string",function(e){return r.tabColor({rgb:e})}).case("integer",function(e){return r.tabColor({theme:e})}).case("nil",function(){return d.removeChild(r._sheetPrNode,"tabColor"),r}).case("object",function(e){var t=d.appendChildIfNotFound(r._sheetPrNode,"tabColor");return d.setAttributes(t,{rgb:e.rgb&&e.rgb.toUpperCase(),indexed:null,theme:e.theme,tint:e.tint}),r}).handle(arguments)}},{key:"tabSelected",value:function(){var t=this,r=this._getOrCreateSheetViewNode();return new b("Sheet.tabSelected").case(function(){return 1===r.attributes.tabSelected}).case("boolean",function(e){return e?r.attributes.tabSelected=1:delete r.attributes.tabSelected,t}).handle(arguments)}},{key:"rightToLeft",value:function(){var t=this,r=this._getOrCreateSheetViewNode();return new b("Sheet.rightToLeft").case(function(){return r.attributes.rightToLeft}).case("boolean",function(e){return e?r.attributes.rightToLeft=!0:delete r.attributes.rightToLeft,t}).handle(arguments)}},{key:"usedRange",value:function(){for(var e=u.findIndex(this._rows),t=this._rows.length-1,r=0,n=0,i=0;ithis._maxSharedFormulaId&&(this._maxSharedFormulaId=e)}},{key:"printOptions",value:function(){var r=this,n=this._getCheckAttributeNameHelper("printOptions",["gridLines","gridLinesSet","headings","horizontalCentered","verticalCentered"]);return new b("Sheet.printOptions").case(["string"],function(e){return n(e),1===r._printOptionsNode.attributes[e]}).case(["string","nil"],function(e){return n(e),delete r._printOptionsNode.attributes[e],r}).case(["string","boolean"],function(e,t){return n(e),t?(r._printOptionsNode.attributes[e]=1,r):r.printOptions(e,void 0)}).handle(arguments)}},{key:"printGridLines",value:function(){var t=this;return new b("Sheet.gridLines").case(function(){return t.printOptions("gridLines")&&t.printOptions("gridLinesSet")}).case(["nil"],function(){return t.printOptions("gridLines",void 0),t.printOptions("gridLinesSet",void 0),t}).case(["boolean"],function(e){return t.printOptions("gridLines",e),t.printOptions("gridLinesSet",e),t}).handle(arguments)}},{key:"pageMargins",value:function(){var r=this;if(void 0===this.pageMarginsPreset())throw new Error("Sheet.pageMargins: preset is undefined.");var n=this._getCheckAttributeNameHelper("pageMargins",["left","right","top","bottom","header","footer"]),i=this._getCheckRangeHelper("pageMargins",0,void 0);return new b("Sheet.pageMargins").case(["string"],function(e){n(e);var t=r._pageMarginsNode.attributes[e];return void 0!==t?parseFloat(t):r._pageMarginsPresetName?parseFloat(r._pageMarginsPresets[r._pageMarginsPresetName][e]):void 0}).case(["string","nil"],function(e){return n(e),delete r._pageMarginsNode.attributes[e],r}).case(["string","number"],function(e,t){return n(e),i(t),r._pageMarginsNode.attributes[e]=t,r}).case(["string","string"],function(e,t){return r.pageMargins(e,parseFloat(t))}).handle(arguments)}},{key:"pageMarginsPreset",value:function(){var r=this;return new b("Sheet.pageMarginsPreset").case(function(){return r._pageMarginsPresetName}).case(["nil"],function(){return r._pageMarginsPresetName=void 0,r._pageMarginsNode.attributes={},r}).case(["string"],function(e){return r._getCheckAttributeNameHelper("pageMarginsPreset",Object.keys(r._pageMarginsPresets))(e),r._pageMarginsPresetName=e,r._pageMarginsNode.attributes={},r}).case(["string","object"],function(e,t){if(r._pageMarginsPresets.hasOwnProperty(e))throw new Error("Sheet.pageMarginsPreset: The preset ".concat(e," already exists!"));if(!1===u.isEqual(u.sortBy(["left","right","top","bottom","header","footer"]),u.sortBy(Object.keys(t))))throw new Error('Sheet.pageMarginsPreset: Invalid preset attributes for one or key(s)! - "'.concat(Object.keys(t),'"'));return u.forEach(function(e,t){var r=parseFloat(e);if(u.isNaN(r)||!1===u.isNumber(r))throw new Error('Sheet.pageMarginsPreset: Invalid preset attribute value! - "'.concat(e,'"'))}),r._pageMarginsPresetName=e,r._pageMarginsNode.attributes={},r._pageMarginsPresets[e]=t,r}).handle(arguments)}},{key:"panes",value:function(){var r=this,n=this._getCheckAttributeNameHelper("pane.state",["split","frozen","frozenSplit"]),i=this._getCheckAttributeNameHelper("pane.activePane",["bottomLeft","bottomRight","topLeft","topRight"]),a=this._getOrCreateSheetViewNode(),o=d.findChild(a,"pane");return new b("Sheet.pane").case(function(){if(o){var e=u.cloneDeep(o.attributes);return e.state||(e.state="split"),e}}).case(["nil"],function(){return d.removeChild(a,"pane"),r}).case(["object"],function(e){var t=u.assign({activePane:"bottomRight"},e);return n(t.state),i(t.activePane),o?o.attributes=t:(o={name:"pane",attributes:t,children:[]},d.appendChild(a,o)),r}).handle(arguments)}},{key:"freezePanes",value:function(){var a=this;return new b("Sheet.feezePanes").case(["integer","integer"],function(e,t){var r=p.columnNumberToName(e+1)+(t+1),n=0===e?"bottomLeft":"bottomRight";return n=0===t?"topRight":n,a.panes({state:"frozen",topLeftCell:r,xSplit:e,ySplit:t,activePane:n})}).case(["string"],function(e){var t=p.fromAddress(e),r=t.columnNumber-1,n=t.rowNumber-1,i=0==r?"bottomLeft":"bottomRight";return i=0==n?"topRight":i,a.panes({state:"frozen",topLeftCell:e,xSplit:r,ySplit:n,activePane:i})}).handle(arguments)}},{key:"splitPanes",value:function(e,t){return this.panes({state:"split",xSplit:e,ySplit:t})}},{key:"resetPanes",value:function(){return this.panes(null)}},{key:"_getCheckAttributeNameHelper",value:function(t,r){return function(e){if(!u.includes(r,e))throw new Error("Sheet.".concat(t,': "').concat(e,'" is not supported.'))}}},{key:"_getCheckTypeHelper",value:function(t,r){return function(e){if(n(e)!==r)throw new TypeError("Sheet.".concat(t,": invalid type - value must be of type ").concat(r,"."))}}},{key:"_getCheckRangeHelper",value:function(t,r,n){var i=this._getCheckTypeHelper(t,"number");return function(e){if(i(e),void 0!==r&&e=n._nextNumFormatId&&(n._nextNumFormatId=t+1)})}},{key:"_init",value:function(e){this._node=e,this._numFmtsNode=c.findChild(this._node,"numFmts"),this._fontsNode=c.findChild(this._node,"fonts"),this._fillsNode=c.findChild(this._node,"fills"),this._bordersNode=c.findChild(this._node,"borders"),this._cellXfsNode=c.findChild(this._node,"cellXfs"),this._numFmtsNode||(this._numFmtsNode={name:"numFmts",attributes:{},children:[]},c.insertBefore(this._node,this._numFmtsNode,this._fontsNode)),delete this._numFmtsNode.attributes.count,delete this._fontsNode.attributes.count,delete this._fillsNode.attributes.count,delete this._bordersNode.attributes.count,delete this._cellXfsNode.attributes.count}}])&&i(e.prototype,r),n&&i(e,n),t}();t.exports=n},{"./Style":17,"./xmlq":29,lodash:170}],19:[function(M,T,e){(function(i,a){"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var r=0;r