diff --git a/src/resources/dist/js/tablemaker.js b/src/resources/dist/js/tablemaker.js index 1a7f475..4f1fdc4 100644 --- a/src/resources/dist/js/tablemaker.js +++ b/src/resources/dist/js/tablemaker.js @@ -1,2 +1,2 @@ -!function($){Craft.TableMaker=Garnish.Base.extend({columnsTableId:null,rowsTableId:null,columnsTableName:null,rowsTableName:null,columnsTableInputPath:null,rowsTableInputPath:null,columns:null,rows:null,columnSettings:null,columnOptions:null,fieldId:null,columnsTable:null,rowsTable:null,dropdownSettingsHtml:null,dropdownSettingsCols:null,$columnsTable:null,$rowsTable:null,$input:null,init:function(t,e,s,i,n,o,l,a,h,d){for(var r in this.columnsTableId=e,this.rowsTableId=s,this.columnsTableName=i,this.rowsTableName=n,this.columnsTableInputPath=this.columnsTableName.replace(/]/g,"").split("["),this.rowsTableInputPath=this.rowsTableName.replace(/]/g,"").split("["),this.columns=o,this.rows=l,this.columnSettings=a,this.fieldId=t,this.dropdownSettingsHtml=h,this.dropdownSettingsCols=d,this.$columnsTable=$("#"+this.columnsTableId),this.$rowsTable=$("#"+this.rowsTableId),this.$input=$("#"+t+"-field").find("input.table-maker-field"),this.columnOptions=[],o)"select"===o[r].type&&o[r].hasOwnProperty("options")&&(this.columnOptions[r]=o[r].options);this.initColumnsTable(),this.initRowsTable(),this.makeDataBlob()},onColumnsAddRow:function(){this.bindColumnsTableChanges(),this.reconstructRowsTable()},onRowsAddRow:function(){this.bindRowsTableTextChanges(),this.makeDataBlob()},bindColumnsTableChanges:function(){var t=this.columnsTable.$tbody.find("textarea");this.removeListener(t,"textchange"),this.addListener(t,"textchange",$.debounce(250,(function(t){this.reconstructRowsTable(t)})));var e=this.columnsTable.$tbody.find("select");this.removeListener(e,"change"),this.addListener(e,"change",$.debounce(250,(function(t){this.reconstructRowsTable(t)})))},bindRowsTableTextChanges:function(){var t=this.rowsTable.$tbody.find("textarea");this.removeListener(t,"textchange"),this.addListener(t,"textchange",$.debounce(250,(function(t){this.makeDataBlob(t)})))},initColumnsTable:function(){this.columnsTable=new t(this,this.columnsTableId,this.columnsTableName,this.columnSettings,{rowIdPrefix:"col",defaultValues:{type:"singleline"},allowAdd:!0,allowDelete:!0,allowReorder:!0,onAddRow:$.proxy(this,"onColumnsAddRow"),onDeleteRow:$.proxy(this,"reconstructRowsTable")}),this.bindColumnsTableChanges(),this.columnsTable.sorter.settings.onSortChange=$.proxy(this,"reconstructRowsTable")},initRowsTable:function(t){this.rowsTable=new Craft.EditableTable(this.rowsTableId,this.rowsTableName,this.columns,{rowIdPrefix:"row",allowAdd:!0,allowDelete:!0,allowReorder:!0,onAddRow:$.proxy(this,"onRowsAddRow"),onDeleteRow:$.proxy(this,"makeDataBlob")}),this.bindRowsTableTextChanges(),this.rowsTable.sorter.settings.onSortChange=$.proxy(this,"makeDataBlob")},reconstructRowsTable:function(){this.getDataFromTables();var t="";for(var e in this.columns)t+=''+(this.columns[e].heading?this.columns[e].heading:" ")+"";t+='';var s=$("",{id:this.rowsTableId,class:"editable fullwidth"}).append(t),i=$("").appendTo(s);for(var n in this.rows)this.rows.hasOwnProperty(n)&&Craft.EditableTable.createRow(n,this.columns,this.rowsTableName,this.rows[n],!0,!0).appendTo(i);this.rowsTable.$table.replaceWith(s),this.rowsTable.destroy(),delete this.rowsTable,this.initRowsTable(this.columns),this.makeDataBlob()},getDataFromTables:function(){var t=Craft.expandPostArray(Garnish.getPostData(this.columnsTable.$tbody)),e=Craft.expandPostArray(Garnish.getPostData(this.rowsTable.$tbody));if(!$.isEmptyObject(t))for(var s=0;s",{class:"settings light invisible",role:"button","data-icon":"settings"}),$("
",{class:"flex flex-nowrap"}).appendTo(s).append(i).append(this.$settingsBtn)),this.$typeSelect=i.find("select"),"select"===this.$typeSelect.val()&&this.$settingsBtn.removeClass("invisible"),this.optionsInput=$("",{type:"hidden",name:this.table.fieldSettings.columnsTableName+"["+this.id+"][options]"}),this.optionsInput.appendTo(this.$tr.closest("form")),this.updateColumnDataWithOptions(),this.addListener(this.$typeSelect,"change","handleTypeChange"),this.addListener(this.$settingsBtn,"click","showSettingsModal")},deleteRow:function(){this.optionsInput.remove(),this.optionsInput=null,delete this.table.fieldSettings.columnOptions[this.id],this.base()},handleTypeChange:function(){"select"===this.$typeSelect.val()?this.$settingsBtn.removeClass("invisible"):this.$settingsBtn.addClass("invisible"),this.table.fieldSettings.reconstructRowsTable()},showSettingsModal:function(t){var e=this;if(this.settingsModal)this.settingsModal.show();else{var s="dropdownsettingsmodal"+Math.floor(1e6*Math.random()),i=$("
",{class:"modal dropdownsettingsmodal"}).appendTo(Garnish.$bod),n=$("
",{class:"body"}).appendTo(i).html(this.table.fieldSettings.dropdownSettingsHtml.replace(/__ID__/g,s));if(this.optionsTable=new Craft.EditableTable(s,"__NAME__",this.table.fieldSettings.dropdownSettingsCols,{allowAdd:!0,allowDelete:!0,allowReorder:!0,onAddRow:this.handleOptionsRowChange.bind(this),onDeleteRow:this.handleOptionsRowChange.bind(this)}),this.options&&this.options.length)for(var o,l=0;l",{type:"button",class:"btn submit",text:Craft.t("app","Done")}).appendTo(n);this.settingsModal=new Garnish.Modal(i,{onHide:this.handleSettingsModalHide.bind(this)}),this.addListener(a,"click",(function(){this.settingsModal.hide()}))}setTimeout((function(){e.optionsTable.$tbody.find("textarea").first().trigger("focus")}),100)},handleOptionsRowChange:function(){this.settingsModal&&this.settingsModal.updateSizeAndPosition()},handleSettingsModalHide:function(){this.options=[];for(var t=this.optionsTable.$table.find("tbody tr"),e=0;et?o():!0!==s&&(l=setTimeout(n?h:o,n===e?t-r:t))}var l,a=0;return"boolean"!=typeof s&&(n=i,i=s,s=e),$.guid&&(o.guid=i.guid=i.guid||$.guid++),o},$.debounce=function(t,i,n){return n===e?s(t,i,!1):s(t,n,!1!==i)}}(this)}(jQuery); +!function($){Craft.TableMaker=Garnish.Base.extend({columnsTableId:null,rowsTableId:null,columnsTableName:null,rowsTableName:null,columnsTableInputPath:null,rowsTableInputPath:null,columns:null,rows:null,columnSettings:null,columnOptions:null,fieldId:null,columnsTable:null,rowsTable:null,dropdownSettingsHtml:null,dropdownSettingsCols:null,$columnsTable:null,$rowsTable:null,$input:null,init:function(t,e,s,i,n,o,l,a,h,d){for(var r in this.columnsTableId=e,this.rowsTableId=s,this.columnsTableName=i,this.rowsTableName=n,this.columnsTableInputPath=this.columnsTableName.replace(/]/g,"").split("["),this.rowsTableInputPath=this.rowsTableName.replace(/]/g,"").split("["),this.columns=o,this.rows=l,this.columnSettings=a,this.fieldId=t,this.dropdownSettingsHtml=h,this.dropdownSettingsCols=d,this.$columnsTable=$("#"+this.columnsTableId),this.$rowsTable=$("#"+this.rowsTableId),this.$input=$("#"+t+"-field").find("input.table-maker-field"),this.columnOptions=[],o)"select"===o[r].type&&o[r].hasOwnProperty("options")&&(this.columnOptions[r]=o[r].options);this.initColumnsTable(),this.initRowsTable(),this.makeDataBlob()},onColumnsAddRow:function(){this.bindColumnsTableChanges(),this.reconstructRowsTable()},onRowsAddRow:function(){this.bindRowsTableTextChanges(),this.makeDataBlob()},bindColumnsTableChanges:function(){var t=this.columnsTable.$tbody.find("textarea");this.removeListener(t,"textchange"),this.addListener(t,"textchange",$.debounce(250,(function(t){this.reconstructRowsTable(t)})));var e=this.columnsTable.$tbody.find("select");this.removeListener(e,"change"),this.addListener(e,"change",$.debounce(250,(function(t){this.reconstructRowsTable(t)})))},bindRowsTableTextChanges:function(){var t=this.rowsTable.$tbody.find("textarea");this.removeListener(t,"textchange"),this.addListener(t,"textchange",$.debounce(250,(function(t){this.makeDataBlob(t)})))},initColumnsTable:function(){this.columnsTable=new t(this,this.columnsTableId,this.columnsTableName,this.columnSettings,{rowIdPrefix:"col",defaultValues:{type:"singleline"},allowAdd:!0,allowDelete:!0,allowReorder:!0,onAddRow:$.proxy(this,"onColumnsAddRow"),onDeleteRow:$.proxy(this,"reconstructRowsTable")}),this.bindColumnsTableChanges(),this.columnsTable.sorter.settings.onSortChange=$.proxy(this,"reconstructRowsTable")},initRowsTable:function(t){this.rowsTable=new e(this,this.rowsTableId,this.rowsTableName,this.columns,{rowIdPrefix:"row",allowAdd:!0,allowDelete:!0,allowReorder:!0,onAddRow:$.proxy(this,"onRowsAddRow"),onDeleteRow:$.proxy(this,"makeDataBlob")}),this.bindRowsTableTextChanges(),this.rowsTable.sorter.settings.onSortChange=$.proxy(this,"makeDataBlob")},reconstructRowsTable:function(){this.getDataFromTables();var t="
";for(var e in this.columns)t+='";t+='';var s=$("
'+(this.columns[e].heading?this.columns[e].heading:" ")+"
",{id:this.rowsTableId,class:"editable fullwidth"}).append(t),i=$("").appendTo(s);for(var n in this.rows)this.rows.hasOwnProperty(n)&&Craft.EditableTable.createRow(n,this.columns,this.rowsTableName,this.rows[n],!0,!0).appendTo(i);this.rowsTable.$table.replaceWith(s),this.rowsTable.destroy(),delete this.rowsTable,this.initRowsTable(this.columns),this.makeDataBlob()},getDataFromTables:function(){var t=Craft.expandPostArray(Garnish.getPostData(this.columnsTable.$tbody)),e=Craft.expandPostArray(Garnish.getPostData(this.rowsTable.$tbody));if(!$.isEmptyObject(t))for(var s=0;s",{class:"settings light invisible",role:"button","data-icon":"settings"}),$("
",{class:"flex flex-nowrap"}).appendTo(s).append(i).append(this.$settingsBtn)),this.$typeSelect=i.find("select"),"select"===this.$typeSelect.val()&&this.$settingsBtn.removeClass("invisible"),this.optionsInput=$("",{type:"hidden",name:this.table.fieldSettings.columnsTableName+"["+this.id+"][options]"}),this.optionsInput.appendTo(this.$tr.closest("form")),this.updateColumnDataWithOptions(),this.addListener(this.$typeSelect,"change","handleTypeChange"),this.addListener(this.$settingsBtn,"click","showSettingsModal")},deleteRow:function(){this.optionsInput.remove(),this.optionsInput=null,delete this.table.fieldSettings.columnOptions[this.id],this.base()},handleTypeChange:function(){"select"===this.$typeSelect.val()?this.$settingsBtn.removeClass("invisible"):this.$settingsBtn.addClass("invisible"),this.table.fieldSettings.reconstructRowsTable()},showSettingsModal:function(t){var e=this;if(this.settingsModal)this.settingsModal.show();else{var s="dropdownsettingsmodal"+Math.floor(1e6*Math.random()),i=$("
",{class:"modal dropdownsettingsmodal"}).appendTo(Garnish.$bod),n=$("
",{class:"body"}).appendTo(i).html(this.table.fieldSettings.dropdownSettingsHtml.replace(/__ID__/g,s));if(this.optionsTable=new Craft.EditableTable(s,"__NAME__",this.table.fieldSettings.dropdownSettingsCols,{allowAdd:!0,allowDelete:!0,allowReorder:!0,onAddRow:this.handleOptionsRowChange.bind(this),onDeleteRow:this.handleOptionsRowChange.bind(this)}),this.options&&this.options.length)for(var o,l=0;l",{type:"button",class:"btn submit",text:Craft.t("app","Done")}).appendTo(n);this.settingsModal=new Garnish.Modal(i,{onHide:this.handleSettingsModalHide.bind(this)}),this.addListener(a,"click",(function(){this.settingsModal.hide()}))}setTimeout((function(){e.optionsTable.$tbody.find("textarea").first().trigger("focus")}),100)},handleOptionsRowChange:function(){this.settingsModal&&this.settingsModal.updateSizeAndPosition()},handleSettingsModalHide:function(){this.options=[];for(var t=this.optionsTable.$table.find("tbody tr"),e=0;et?o():!0!==s&&(l=setTimeout(n?h:o,n===e?t-r:t))}var l,a=0;return"boolean"!=typeof s&&(n=i,i=s,s=e),$.guid&&(o.guid=i.guid=i.guid||$.guid++),o},$.debounce=function(t,i,n){return n===e?s(t,i,!1):s(t,n,!1!==i)}}(this)}(jQuery); //# sourceMappingURL=tablemaker.js.map \ No newline at end of file diff --git a/src/resources/dist/js/tablemaker.js.map b/src/resources/dist/js/tablemaker.js.map index d8879d6..0511220 100644 --- a/src/resources/dist/js/tablemaker.js.map +++ b/src/resources/dist/js/tablemaker.js.map @@ -1 +1 @@ -{"version":3,"names":["$","Craft","TableMaker","Garnish","Base","extend","columnsTableId","rowsTableId","columnsTableName","rowsTableName","columnsTableInputPath","rowsTableInputPath","columns","rows","columnSettings","columnOptions","fieldId","columnsTable","rowsTable","dropdownSettingsHtml","dropdownSettingsCols","$columnsTable","$rowsTable","$input","init","colKey","this","replace","split","find","type","hasOwnProperty","options","initColumnsTable","initRowsTable","makeDataBlob","onColumnsAddRow","bindColumnsTableChanges","reconstructRowsTable","onRowsAddRow","bindRowsTableTextChanges","$textareas","$tbody","removeListener","addListener","debounce","e","$selects","ColumnTable","rowIdPrefix","defaultValues","allowAdd","allowDelete","allowReorder","onAddRow","proxy","onDeleteRow","sorter","settings","onSortChange","EditableTable","getDataFromTables","tableHtml","colId","heading","$table","id","class","append","appendTo","rowId","createRow","replaceWith","destroy","expandPostArray","getPostData","isEmptyObject","i","length","key","dateColIds","push","rowKey","dateArray","date","Date","dataBlob","val","JSON","stringify","fieldSettings","baseName","lazyInitRows","base","initialize","createRowObj","$tr","Row","$typeSelect","$settingsBtn","settingsModal","optionsTable","optionsInput","table","tr","$typeCell","$typeSelectContainer","role","removeClass","name","closest","updateColumnDataWithOptions","deleteRow","remove","handleTypeChange","addClass","showSettingsModal","ev","s","show","Math","floor","random","$modal","$bod","$body","html","handleOptionsRowChange","bind","row","addRow","label","value","prop","default","$closeButton","text","t","Modal","onHide","handleSettingsModalHide","hide","setTimeout","first","trigger","updateSizeAndPosition","$rows","$row","eq","b","c","jQuery","Cowboy","a","throttle","f","j","g","l","d","apply","o","n","k","h","m","arguments","clearTimeout","guid"],"sources":["../../src/js/tablemaker.js"],"mappings":"CAOA,SAAUA,GAEVC,MAAMC,WAAaC,QAAQC,KAAKC,OAAO,CACnCC,eAAgB,KAChBC,YAAa,KACbC,iBAAkB,KAClBC,cAAe,KACfC,sBAAuB,KACvBC,mBAAoB,KACpBC,QAAS,KACTC,KAAM,KACNC,eAAgB,KAChBC,cAAe,KACfC,QAAS,KAETC,aAAc,KACdC,UAAW,KAEXC,qBAAsB,KACtBC,qBAAsB,KAEtBC,cAAe,KACfC,WAAY,KACZC,OAAQ,KAERC,KAAM,SAASR,EAASV,EAAgBC,EAAaC,EAAkBC,EAAeG,EAASC,EAAMC,EAAgBK,EAAsBC,GA0BvI,IAAK,IAAIK,KAzBTC,KAAKpB,eAAiBA,EACtBoB,KAAKnB,YAAcA,EAEnBmB,KAAKlB,iBAAmBA,EACxBk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C,UAAU/D,KAAKM,SAC9C,IAYJ,SAAUqH,EAAEC,GAAG,IAAItJ,EAAEqJ,EAAEE,QAAQF,EAAEG,SAASH,EAAEG,OAAO,CAAC,GAAGC,EAAEzJ,EAAE0J,SAASD,EAAE,SAAS3G,EAAE6G,EAAEC,EAAE/E,GAAkD,SAASgF,IAA2C,SAASC,IAAIC,GAAG,IAAI1E,KAAOuE,EAAEI,MAAMC,EAAEC,EAAE,CAAC,SAASC,IAAIC,EAAEd,CAAC,CAA/F,IAAIW,EAAEvI,KAAK2I,GAAG,IAAIhF,KAAO0E,EAAEG,EAAEI,UAAsEzF,IAAIuF,GAAGN,IAAIM,GAAGG,aAAaH,GAAMvF,IAAIyE,GAAGe,EAAEvH,EAAGgH,KAAgB,IAAJH,IAAUS,EAAEtB,WAAWjE,EAAEsF,EAAEL,EAAEjF,IAAIyE,EAAExG,EAAEuH,EAAEvH,GAAI,CAAnQ,IAAIsH,EAAEL,EAAE,EAAsS,MAAtR,kBAAJJ,IAAe9E,EAAE+E,EAAEA,EAAED,EAAEA,EAAEL,GAA0NtJ,EAAEwK,OAAMX,EAAEW,KAAKZ,EAAEY,KAAKZ,EAAEY,MAAMxK,EAAEwK,QAAcX,CAAC,EAAE7J,EAAE6C,SAAS,SAASkH,EAAEjH,EAAE6G,GAAG,OAAOA,IAAIL,EAAEG,EAAEM,EAAEjH,GAAE,GAAO2G,EAAEM,EAAEJ,GAAM,IAAJ7G,EAAU,CAAE,CAAvd,CAAydpB,KAExd,CA5aD,CA4aG6H"} \ No newline at end of file +{"version":3,"names":["$","Craft","TableMaker","Garnish","Base","extend","columnsTableId","rowsTableId","columnsTableName","rowsTableName","columnsTableInputPath","rowsTableInputPath","columns","rows","columnSettings","columnOptions","fieldId","columnsTable","rowsTable","dropdownSettingsHtml","dropdownSettingsCols","$columnsTable","$rowsTable","$input","init","colKey","this","replace","split","find","type","hasOwnProperty","options","initColumnsTable","initRowsTable","makeDataBlob","onColumnsAddRow","bindColumnsTableChanges","reconstructRowsTable","onRowsAddRow","bindRowsTableTextChanges","$textareas","$tbody","removeListener","addListener","debounce","e","$selects","ColumnTable","rowIdPrefix","defaultValues","allowAdd","allowDelete","allowReorder","onAddRow","proxy","onDeleteRow","sorter","settings","onSortChange","RowTable","getDataFromTables","tableHtml","colId","heading","$table","id","class","append","appendTo","rowId","EditableTable","createRow","replaceWith","destroy","expandPostArray","getPostData","isEmptyObject","i","length","key","dateColIds","push","rowKey","dateArray","date","Date","dataBlob","val","JSON","stringify","fieldSettings","baseName","lazyInitRows","base","initialize","isVisible","createRowObj","$tr","Row","$typeSelect","$settingsBtn","settingsModal","optionsTable","optionsInput","table","tr","$typeCell","$typeSelectContainer","role","removeClass","name","closest","updateColumnDataWithOptions","deleteRow","remove","handleTypeChange","addClass","showSettingsModal","ev","s","show","Math","floor","random","$modal","$bod","$body","html","handleOptionsRowChange","bind","row","addRow","label","value","prop","default","$closeButton","text","t","Modal","onHide","handleSettingsModalHide","hide","setTimeout","first","trigger","updateSizeAndPosition","$rows","$row","eq","b","c","jQuery","Cowboy","a","throttle","f","j","g","l","d","apply","o","n","k","h","m","arguments","clearTimeout","guid"],"sources":["../../src/js/tablemaker.js"],"mappings":"CAOA,SAAUA,GAEVC,MAAMC,WAAaC,QAAQC,KAAKC,OAAO,CACnCC,eAAgB,KAChBC,YAAa,KACbC,iBAAkB,KAClBC,cAAe,KACfC,sBAAuB,KACvBC,mBAAoB,KACpBC,QAAS,KACTC,KAAM,KACNC,eAAgB,KAChBC,cAAe,KACfC,QAAS,KAETC,aAAc,KACdC,UAAW,KAEXC,qBAAsB,KACtBC,qBAAsB,KAEtBC,cAAe,KACfC,WAAY,KACZC,OAAQ,KAERC,KAAM,SAASR,EAASV,EAAgBC,EAAaC,EAAkBC,EAAeG,EAASC,EAAMC,EAAgBK,EAAsBC,GA0BvI,IAAK,IAAIK,KAzBTC,KAAKpB,eAAiBA,EACtBoB,KAAKnB,YAAcA,EAEnBmB,KAAKlB,iBAAmBA,EACx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/G,EAAU,CAAE,CAAvd,CAAydpB,KAExd,CAzcD,CAycG+H"} \ No newline at end of file diff --git a/src/resources/src/js/tablemaker.js b/src/resources/src/js/tablemaker.js index 6c2bba6..273c58b 100644 --- a/src/resources/src/js/tablemaker.js +++ b/src/resources/src/js/tablemaker.js @@ -128,7 +128,7 @@ Craft.TableMaker = Garnish.Base.extend({ }, initRowsTable: function(columns) { - this.rowsTable = new Craft.EditableTable(this.rowsTableId, this.rowsTableName, this.columns, { + this.rowsTable = new RowTable(this, this.rowsTableId, this.rowsTableName, this.columns, { rowIdPrefix: 'row', allowAdd: true, allowDelete: true, @@ -263,6 +263,11 @@ var ColumnTable = Craft.EditableTable.extend({ return true; }, + isVisible: function() { + // Fix an issue with collapsed Matrix fields - https://github.com/verbb/tablemaker/issues/47 + return true; + }, + createRowObj: function($tr) { return new ColumnTable.Row(this, $tr); } @@ -420,7 +425,31 @@ ColumnTable.Row = Craft.EditableTable.Row.extend({ this.table.fieldSettings.columnOptions[this.id] = this.options; this.optionsInput.val(JSON.stringify(this.options)); }, +}); + +var RowTable = Craft.EditableTable.extend({ + fieldSettings: null, + + init: function(fieldSettings, id, baseName, columns, settings) { + // Disable Craft's lazy table behaviour - https://github.com/verbb/tablemaker/issues/44 + settings.lazyInitRows = false; + + this.fieldSettings = fieldSettings; + this.base(id, baseName, columns, settings); + }, + + initialize: function() { + if (!this.base()) { + return false; + } + + return true; + }, + isVisible: function() { + // Fix an issue with collapsed Matrix fields - https://github.com/verbb/tablemaker/issues/47 + return true; + }, }); /*