jqgrid_utils 1.38.1 → 1.39.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -42,7 +42,7 @@ A module for Jqgrid_utils
42
42
  * [module.exports#grid_ratio_on(grid, fraction_col, denominator_col, ratio_col)](#exp_module_Jqgrid_utils--module.exports+grid_ratio_on) ⏏
43
43
  * [module.exports#is_html(str)](#exp_module_Jqgrid_utils--module.exports+is_html) ⇒ <code>boolean</code> ⏏
44
44
  * [module.exports#_grid_sum_on()](#exp_module_Jqgrid_utils--module.exports+_grid_sum_on) ⏏
45
- * [module.exports#grid_sum_on(grid, fields)](#exp_module_Jqgrid_utils--module.exports+grid_sum_on) ⏏
45
+ * [module.exports#grid_sum_on(grid, fields, format)](#exp_module_Jqgrid_utils--module.exports+grid_sum_on) ⏏
46
46
  * [module.exports#_grid_avg_on()](#exp_module_Jqgrid_utils--module.exports+_grid_avg_on) ⏏
47
47
  * [module.exports#grid_avg_on(grid, fields)](#exp_module_Jqgrid_utils--module.exports+grid_avg_on) ⏏
48
48
  * [module.exports#_grid_percent_on()](#exp_module_Jqgrid_utils--module.exports+_grid_percent_on) ⏏
@@ -88,7 +88,8 @@ A module for Jqgrid_utils
88
88
  * [module.exports#add_link_details(col_model, url, edit_field, attr, keys)](#exp_module_Jqgrid_utils--module.exports+add_link_details) ⏏
89
89
  * [module.exports#add_link_details_separator(col_model, url, edit_field, attr, keys)](#exp_module_Jqgrid_utils--module.exports+add_link_details_separator) ⏏
90
90
  * [module.exports#add_link_separator(col_model, url, edit_field, fields)](#exp_module_Jqgrid_utils--module.exports+add_link_separator) ⏏
91
- * [module.exports#__cell_format()](#exp_module_Jqgrid_utils--module.exports+__cell_format) ⏏
91
+ * [module.exports#_format_number_with_commas(number)](#exp_module_Jqgrid_utils--module.exports+_format_number_with_commas) ⏏
92
+ * [module.exports#__cell_format(cell_value, format)](#exp_module_Jqgrid_utils--module.exports+__cell_format) ⏏
92
93
  * [module.exports#subgrid(_id, id, url, col_model, caption)](#exp_module_Jqgrid_utils--module.exports+subgrid) ⏏
93
94
  * [module.exports#add_image(col_model, edit_field, size, link)](#exp_module_Jqgrid_utils--module.exports+add_image) ⏏
94
95
  * [module.exports#set_filter(grid, data, fx, append_to)](#exp_module_Jqgrid_utils--module.exports+set_filter) ⏏
@@ -248,7 +249,7 @@ Syncron Alias grid_sum_on
248
249
  **Kind**: Exported function
249
250
  <a name="exp_module_Jqgrid_utils--module.exports+grid_sum_on"></a>
250
251
 
251
- ### module.exports#grid\_sum\_on(grid, fields) ⏏
252
+ ### module.exports#grid\_sum\_on(grid, fields, format) ⏏
252
253
  Sum the columns values together
253
254
 
254
255
  **Kind**: Exported function
@@ -257,6 +258,7 @@ Sum the columns values together
257
258
  | --- | --- | --- |
258
259
  | grid | <code>object</code> | Grid Object (required) |
259
260
  | fields | <code>string</code> | Column/Field Name to sum |
261
+ | format | <code>string</code> | format, currency sign |
260
262
 
261
263
  **Example**
262
264
  ```js
@@ -1151,12 +1153,29 @@ var jqu = new Jqgrid_utils();
1151
1153
  //other example
1152
1154
  col_model = await jqu.add_link_separator(col_model, 'https://wiki.salamander-jewelry.net/index.php/grid_loss' , 'e',[{'field':'e'}],'target="_blank"');
1153
1155
  ```
1156
+ <a name="exp_module_Jqgrid_utils--module.exports+_format_number_with_commas"></a>
1157
+
1158
+ ### module.exports#\_format\_number\_with\_commas(number) ⏏
1159
+ Private Function
1160
+
1161
+ **Kind**: Exported function
1162
+
1163
+ | Param | Type | Description |
1164
+ | --- | --- | --- |
1165
+ | number | <code>string</code> | number to add comma |
1166
+
1154
1167
  <a name="exp_module_Jqgrid_utils--module.exports+__cell_format"></a>
1155
1168
 
1156
- ### module.exports#\_\_cell\_format() ⏏
1169
+ ### module.exports#\_\_cell\_format(cell_value, format) ⏏
1157
1170
  Private Function
1158
1171
 
1159
1172
  **Kind**: Exported function
1173
+
1174
+ | Param | Type | Description |
1175
+ | --- | --- | --- |
1176
+ | cell_value | <code>object</code> | cell_value |
1177
+ | format | <code>string</code> | format_ok or $ sign |
1178
+
1160
1179
  <a name="exp_module_Jqgrid_utils--module.exports+subgrid"></a>
1161
1180
 
1162
1181
  ### module.exports#subgrid(_id, id, url, col_model, caption) ⏏
@@ -320,15 +320,16 @@ var jqu = new Jqgrid_utils({page:page});
320
320
  * Syncron Alias grid_sum_on
321
321
  @alias module:Jqgrid_utils
322
322
  */
323
- async _grid_sum_on(grid, fields = []) {
324
- return await this.grid_sum_on(grid, fields);
323
+ async _grid_sum_on(grid, fields = [], format = "") {
324
+ return await this.grid_sum_on(grid, fields, format);
325
325
  }
326
326
 
327
327
  /**
328
328
  * Sum the columns values together
329
329
  @alias module:Jqgrid_utils
330
330
  @param {object} - Grid Object (required)
331
- @param {string} - Column/Field Name to sum
331
+ @param {string} - Column/Field Name to sum
332
+ @param {string} - format, currency sign
332
333
  @example
333
334
  var jqu = new Jqgrid_utils({page:page});
334
335
  gridComplete: function () {
@@ -340,7 +341,8 @@ gridComplete: function () {
340
341
  ]);
341
342
  },
342
343
  */
343
- async grid_sum_on(grid, fields = []) {
344
+ async grid_sum_on(grid, fields = [], format = "") {
345
+ //console.log(format);
344
346
  let $self = jQuery(grid);
345
347
  let rows = $self.jqGrid("getGridParam", "data");
346
348
  let footer = {
@@ -380,8 +382,14 @@ gridComplete: function () {
380
382
  if (sum != Math.floor(sum)) {
381
383
  sum = sum.toFixed(2);
382
384
  }
383
- footer[fields[i]] = sum;
385
+
386
+ if (format != "") {
387
+ footer[fields[i]] = format + "" + this._format_number_with_commas(sum);
388
+ } else {
389
+ footer[fields[i]] = sum;
390
+ }
384
391
  }
392
+
385
393
  $self.jqGrid("footerData", "set", footer);
386
394
  return footer;
387
395
  }
@@ -1972,6 +1980,19 @@ var jqu = new Jqgrid_utils();
1972
1980
  /**
1973
1981
  * Private Function
1974
1982
  @alias module:Jqgrid_utils
1983
+ @param {string} - number to add comma
1984
+ */
1985
+ _format_number_with_commas(number) {
1986
+ const parts = number.toString().split(".");
1987
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1988
+ return parts.join(".");
1989
+ }
1990
+
1991
+ /**
1992
+ * Private Function
1993
+ @alias module:Jqgrid_utils
1994
+ @param {object} - cell_value
1995
+ @param {string} - format_ok or $ sign
1975
1996
  */
1976
1997
  __cell_format(cell_value, format) {
1977
1998
  if (format == "format_ok") {
@@ -1982,7 +2003,13 @@ var jqu = new Jqgrid_utils();
1982
2003
  cell_value =
1983
2004
  '<i data-check="ok" class="fa fa-check-circle" aria-hidden="true" style="color:#008000;"></i>';
1984
2005
  }
2006
+ } else if (format == "$") {
2007
+ if (cell_value) {
2008
+ const number = this._format_number_with_commas(cell_value);
2009
+ cell_value = format + "" + number;
2010
+ }
1985
2011
  }
2012
+
1986
2013
  return cell_value;
1987
2014
  }
1988
2015
 
@@ -1 +1 @@
1
- !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).Jqgrid_utils=e()}}((function(){return function e(t,r,a){function n(o,s){if(!r[o]){if(!t[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(i)return i(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var c=r[o]={exports:{}};t[o][0].call(c.exports,(function(e){return n(t[o][1][e]||e)}),c,c.exports,e,t,r,a)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o<a.length;o++)n(a[o]);return n}({1:[function(e,t,r){"use strict";t.exports=class{constructor(e=!1){e&&e.hasOwnProperty("page")&&(this.page=e.page,localStorage.setItem("page",this.page))}async format_currency_on_value(e,t,r="$"){for(let a=0;a<e.length;a++)e[a].name===t&&(e[a].formatoptions={prefix:r,decimalSeparator:".",thousandsSeparator:",",decimalPlaces:2},e[a].formatter=function(e,t,r){if(null==e||""===e)return"";if(0===parseFloat(e))return"";var a=t.colModel.formatoptions.prefix,n=t.colModel.formatoptions.decimalSeparator,i=t.colModel.formatoptions.thousandsSeparator,o=t.colModel.formatoptions.decimalPlaces,s=parseFloat(e).toFixed(o),l=(s=s.replace(".",n)).split(n);return l[0]=l[0].replace(/\B(?=(\d{3})+(?!\d))/g,i),a+(s=l.join(n))});return e}async format_currency(e,t,r="$"){for(let a=0;a<e.length;a++)e[a].name===t&&(e[a].formatter="currency",e[a].formatoptions={prefix:r,decimalSeparator:".",thousandsSeparator:",",decimalPlaces:2});return e}async add_checkbox(e,t){for(let r=0;r<e.length;r++)e[r].name===t&&(e[r].formatter="checkbox",e[r].formatoptions={disabled:!1},e[r].edittype="checkbox",e[r].editoptions={value:"Yes:No",defaultValue:"Yes"});return e}async add_class(e,t,r){for(let a=0;a<e.length;a++)e[a].name===t&&(e[a].classes?e[a].classes+=" "+r:e[a].classes=r);return e}async _grid_substract_on(e,t=[],r=[],a,n=!1){return await this.grid_substract_on(e,t,r,a,n)}async grid_substract_on(e,t=[],r=[],a,n=!1){let i=jQuery(e),o=i.jqGrid("getGridParam","data"),s={invdate:"Total"},l=0,d=0;for(let e in t){let r=0;for(let a in o)if(o[a].hasOwnProperty(t[e])){let n=o[a][t[e]];"string"==typeof n&&is_digit(n)&&(n=parseFloat(n)),r+=n}r!=Math.floor(r)&&(r=r.toFixed(2)),s[t[e]]=r,l=r}for(let e in r){let t=0;for(let a in o)if(o[a].hasOwnProperty(r[e])){let n=o[a][r[e]];"string"==typeof n&&is_digit(n)&&(n=parseFloat(n)),t+=n}t!=Math.floor(t)&&(t=t.toFixed(2)),s[r[e]]=t,d=t}let c=l-d;return n&&c<0&&(c=0),s[a]=c,i.jqGrid("footerData","set",s),s}_grid_ratio_on(e,t,r,a){return this.grid_ratio_on(e,t,r,a)}async grid_ratio_on(e,t,r,a){jQuery("#grid").jqGrid("getGridParam","data");let n=jQuery(e),i=n.jqGrid("getGridParam","data"),o={invdate:"Total"};fraction_sum=0,denominator_sum=0,ratio_sum=0;for(let e in i)i[e].hasOwnProperty(t)&&(fraction_sum+=i[e][t]),i[e].hasOwnProperty(r)&&(denominator_sum+=i[e][r]);return o.qc_eta_ratio=(fraction_sum/denominator_sum).toFixed(2),n.jqGrid("footerData","set",o),o}is_html(e){let t=!1;try{const r=(new DOMParser).parseFromString(e,"text/html");Array.from(r.body.childNodes).some((e=>1===e.nodeType))&&(t=!0)}catch(e){}return t}async _grid_sum_on(e,t=[]){return await this.grid_sum_on(e,t)}async grid_sum_on(e,t=[]){let r=jQuery(e),a=r.jqGrid("getGridParam","data"),n={invdate:"Total"};for(let e in t){let r=0;for(let n in a){let i=0;if(a[n].hasOwnProperty(t[e])){let o=a[n][t[e]];if(o){if("string"==typeof o)if(this.is_html(o)){const e=(new DOMParser).parseFromString(o,"text/html").querySelectorAll("a"),t=Array.from(e).map((e=>e.text));if(t.length){const e=t[0].replace(",","");is_digit(e)&&(i=parseFloat(e))}}else is_digit(o)&&(i=parseFloat(o));else"number"==typeof o&&(i=o);r+=i}}}r!=Math.floor(r)&&(r=r.toFixed(2)),n[t[e]]=r}return r.jqGrid("footerData","set",n),n}_grid_avg_on(e,t=[]){return this.grid_avg_on(e,t)}async grid_avg_on(e,t=[]){let r=jQuery(e),a=r.jqGrid("getGridParam","data"),n=0,i={invdate:"Total"};for(let e in t){let r=0;for(let i in a)if(a[i].hasOwnProperty(t[e])){let o=a[i][t[e]];"string"==typeof o&&is_digit(o)&&(o=parseFloat(o)),r+=o,n++}r/=n,r!=Math.floor(r)&&(r=r.toFixed(2)),i[t[e]]=r}return r.jqGrid("footerData","set",i),i}_grid_percent_on(e,t){return grid_percent_on(e,t)}async grid_percent_on(e,t){let r=jQuery(e),a=r.jqGrid("getGridParam","data"),n={},i=t.id?t.id:"invate";footer[i]="Total";let o=t.total,s=JSON.parse(JSON.stringify(t.percent));s.push(o);for(let e in s){let t=s[e],r=0,i=0;for(let e in a)if(a[e].hasOwnProperty(t)){let n=a[e][t];"string"==typeof n?is_digit(n)&&(n=parseFloat(n),r+=n,i++):(r+=n,i++)}n[t]=r}for(let e in s){let t=s[e],r=n[t]/(n[o]/100);r=r.toFixed(2),footer[t]=r+"%"}r.jqGrid("footerData","set",footer)}async update_row_to_api(e,t="",r=["id"],a={},n){let i=this,o=[],s={},l={},d={};const c=e.jqGrid("getGridParam","record_data");if(""!=t&&Object.keys(a).length>0&&"edit"==a.inputData.oper){for(let e in c)if(c[e].id===a.rowid){for(let t in r)c[e].hasOwnProperty(r[t])&&(s[r[t]]=c[e][r[t]]);for(let t in a.inputData)"oper"!=t&&Object.keys(s).indexOf(t)<0&&a.inputData[t]!=c[e][t]&&(d[t]=a.inputData[t])}for(let e in d)if(Object.keys(s).indexOf(e)<0&&"oper"!=e){let r={};r[e]=d[e],n.ids=s,n.values=r,n.operator="edit";const a=await i.post_json(t,JSON.stringify(n));o.push(a)}}else if(""!=t&&Object.keys(a).length>0&&"add"==a.inputData.oper){for(let e in a.inputData)a.inputData[e]&&"id"!=e&&"oper"!=e&&(l[e]=a.inputData[e]);n.ids=s,n.values=l,n.operator="add";let e=await i.post_json(t,JSON.stringify(n));o.push(e)}return o}async delete_row_to_api(e,t="",r,a=[],n={}){let i={msg:"failed"},o=this,s=[],l={};const d=e.jqGrid("getGridParam","record_data");for(let e in d)if(d[e].id===r){for(let t in a)d[e].hasOwnProperty(a[t])&&(l[a[t]]=d[e][a[t]],s.push(a[t]));break}return""!=t&&Object.keys(l).length==s.length&&(n.ids=s,n.values=l,i=await o.adelete_api(t,JSON.stringify(n))),i}async append_seperator_link_column(e,t,r,a,n="",i){t+="/";return a.formatter=function(e,a){let o=r;if("object"==typeof i){let r="";for(let e in i){let t=e,n=i[e],o=a.rowData[n];o&&o&&(r+=""!=t?t+"/"+encodeURIComponent(o)+"/":encodeURIComponent(o))}r&&("&"!==r.slice(-1)&&"/"!==r.slice(-1)||(r=r.slice(0,-1)),e="<a "+n+'href="'+t+r+'"> '+o+"</a>")}return e},e.push(a),e}async add_edit(e,t,r,a){for(let n=0;n<e.length;n++)e[n].name===t&&(Object.assign(e[n],r),Object.assign(e[n],a));return e}async add_textarea(e,t,r='style="width:100%;height:100px"'){for(let a=0;a<e.length;a++)e[a].name===t&&(e[a].formatter=function(e){return"<textarea "+r+">"+e+"</textarea>"});return e}async get_col_model_from_data(e,t,r=[],a=[]){let n=[];for(let e in t){const r=Object.keys(t[e]);for(let e in r){const t=r[e];n.push(t)}}n=n.filter(((e,t)=>n.indexOf(e)===t));let i=[];for(let e in a)i.push(a[e].name);let o=n.filter((e=>!i.includes(e)));const s=new Set(r);o=o.filter((e=>!s.has(e))),o.sort();for(let e=0;e<o.length;e++)a.push({name:o[e],label:o[e]});return a}binary_replace(e,t="zero",r="one"){let a=t;return 1!=e&&0!=e||1==e&&(a=r),a}_date112_to_DMY(e,t="/"){let r=e;if(e.length>=8&&-1===e.indexOf(t)){let a=[];a.push(e.substr(6,2)),a.push(e.substr(4,2)),a.push(e.substr(0,4)),r=a.join(t)}return r}async date112_to_DMY(e,t,r="/"){for(let a=0;a<e.length;a++)e[a].name===t&&(e[a].formatter=function(e,t){if(e){let t=e=e.toString();if(e.length>=8&&-1===e.indexOf(r)){let a=[];a.push(e.substr(6,2)),a.push(e.substr(4,2)),a.push(e.substr(0,4)),t=a.join(r)}return t}return e});return e}async add_formatter(e,t,r){for(let a=0;a<e.length;a++)e[a].name===t&&r.hasOwnProperty("formatter")&&r.hasOwnProperty("formatoptions")&&(e[a].formatter=r.formatter,e[a].formatoptions=r.formatoptions,e[a].edittype=r.formatter,e[a].editoptions=r.formatoptions);return e}async natural_sort(e,t){for(let r=0;r<e.length;r++)e[r].name===t&&(e[r].sortfunc=function(e,t,r){void 0===r&&(r=1);var a,n,i=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,o=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,l=/^0x[0-9a-f]+$/i,d=/^0/,c=function(e){return self.insensitive&&(""+e).toLowerCase()||""+e},f=c(e).replace(o,"")||"",u=c(t).replace(o,"")||"",p=f.replace(i,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),_=u.replace(i,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=parseInt(f.match(l))||1!=p.length&&f.match(s)&&Date.parse(f),h=parseInt(u.match(l))||m&&u.match(s)&&Date.parse(u)||null;if(h){if(m<h)return-r;if(m>h)return r}for(var y=0,g=Math.max(p.length,_.length);y<g;y++){if(a=!(p[y]||"").match(d)&&parseFloat(p[y])||p[y]||0,n=!(_[y]||"").match(d)&&parseFloat(_[y])||_[y]||0,isNaN(a)!==isNaN(n))return isNaN(a)?r:-r;if(typeof a!=typeof n&&(a+="",n+=""),a<n)return-r;if(a>n)return r}return 0});return e}async add_html_formatter(e,t,r){for(let a=0;a<e.length;a++)e[a].name===t&&(e[a].formatter=function(e,t){return r});return e}async add_ok_button(e,t){let r=this;for(let a=0;a<e.length;a++)t.indexOf(e[a].name)>-1&&(e[a].formatter=function(e){return null!=e?r.__cell_format(e,"format_ok"):""});return e}async get_filled_cell_table_data(e,t=[]){let r=jQuery(e).jqGrid("getGridParam","data"),a=t,n=[];for(let e in r)if(r[e].hasOwnProperty("id")){let t=[r[e].id];for(let n in a)r[e].hasOwnProperty(a[n])?t.push(r[e][a[n]]):t.push("");var i=t.filter((function(e,t,r){return""!==e}));Object.keys(i).length>1&&n.push(t)}return n}async get_filled_cell_data(e,t=[]){let r=jQuery(e).jqGrid("getGridParam","data"),a=t,n=[];for(let e in r)if(r[e].hasOwnProperty("id")){let t={id:r[e].id};for(let n in a)r[e].hasOwnProperty(a[n])&&""!=r[e][a[n]]&&(t[a[n]]=r[e][a[n]]);Object.keys(t).length>1&&n.push(t)}return n}async set_link(e,t,r,a=""){for(let n=0;n<e.length;n++)e[n].name===t&&(e[n].formatter=function(e,t){return'<a class="gl" '+a+'href="'+t.rowData[r]+'">'+e+"</a>"});return e}async hide_all_columns_except(e,t){for(let r=0;r<e.length;r++)t.indexOf(e[r].name)>-1?e[r].hidden=!1:e[r].hidden=!0;return e}async hide_column(e,t){for(let r=0;r<e.length;r++)e[r].name===t&&(e[r].hidden=!0);return e}s_grid_set_caption(e,t=[]){this.grid_set_captionn(e,[])}async grid_set_caption(e,t=[]){if(e){const r=jQuery(e);let a=0;a=0===t.length?r.jqGrid("getGridParam","records"):t.length;const n=/\d.*x/,i=r.jqGrid("getGridParam","caption").replace(n,"");r.jqGrid("setCaption",i+" "+a+"x")}}s_resize_saved_cell_width(e,t=!1,r=!1){this.grid_set_caption(e,t,r)}async resize_saved_cell_width(e,t=!1,r=!1){let a=t||this.page;a+=r?"-"+r+"-w-":"-grid-w-";for(let t=0;t<=e.length;t++)if(e[t]&&e[t].name){const r=e[t].name,n=localStorage.getItem(a+r);n&&(e[t].width=n)}return e}resize_cell(e,t,r=!1){const a=jQuery(this).jqGrid("getGridParam","colModel");if(a[t]&&a[t].name){const n=a[t].name;let i=(r||localStorage.getItem("page"))+"-"+this.id+"-w-"+n;localStorage.setItem(i,e);localStorage.getItem(i)}}async upsert_row(e,t,r={}){if(e.rowid.startsWith("jqg")){return await this.insert_row(e,t)}return await this.update_row(e,t)}async insert_row(e,t){let r={},a="";if(e.inputData.hasOwnProperty("id")){r._id="id",r._id_val=e.inputData.id;for(let t in e.inputData)r[t]=e.inputData[t];delete r.id,delete r.oper,a=await this.put_json(t,JSON.stringify(r))}return a}async update_row(e,t,r={}){let a="";r._id||(r._id="id"),r._id_val=e.inputData.id;for(let t in e.inputData)r[t]=e.inputData[t];return delete r.id,delete r.oper,a=await this.post_json(t,JSON.stringify(r)),a}async delete_row(e,t){let r="";return t.indexOf("?")>-1?t+="&_id="+encodeURIComponent(unescape(e)):t+="?_id="+encodeURIComponent(unescape(e)),r=JSON.parse(await this.adelete_api(t)),r.message}async adelete_api(e,t=!1){let r="application/x-www-form-urlencoded",a=null;return t&&(r="application/json;charset=UTF-8",a=t),new Promise(((t,n)=>{let i=new XMLHttpRequest;i.open("DELETE",e),i.setRequestHeader("Content-type",r),i.onload=()=>t(i.responseText),i.onerror=()=>n(i.statusText),i.send(a)}))}async post_json(e,t){return new Promise(((r,a)=>{let n=new XMLHttpRequest;n.open("POST",e),n.setRequestHeader("Content-type","application/json"),n.onload=()=>r(n.responseText),n.onerror=()=>a(n.statusText),n.send(t)}))}async put_json(e,t){return new Promise(((r,a)=>{let n=new XMLHttpRequest;n.open("PUT",e),n.setRequestHeader("Content-type","application/json"),n.onload=()=>r(n.responseText),n.onerror=()=>a(n.statusText),n.send(t)}))}s_hide_del_icon(){hide_del_icon()}async hide_del_icon(){jQuery(".ui-inline-del").each((function(e){jQuery(this).html("")}))}async add_link_details_csv(e,t,r,a="",n,i,o=","){let s=this;t.indexOf("?")>-1?t+="&":t+="?";for(let l=0;l<e.length;l++)e[l].name===r&&(e[l].formatter=function(e,r){let l=e;const d=s.__cell_format(e,i),c=d.split(o);let f="";for(let i in c){const s=c[i].trim();if(s&&"object"==typeof n){let e="";for(let t in n){let a=t,i=n[t];l=r.rowData[i],l&&(e=-1!==a.indexOf("=")?e+""+a+encodeURIComponent(s)+"&":e+""+a+"="+encodeURIComponent(s)+"&")}"&"===e.slice(-1)&&(e=e.slice(0,-1)),f+="<a "+a+'href="'+t+e+'"> '+s+"</a>"+o+" "}(e=f.trim()).slice(-1)===o&&(e=e.slice(0,-1))}return e||d});return e}async compare(e,t,r,a){const n=jQuery(e).jqGrid("getGridParam","data");for(let i in n)n[i][t]!=n[i][r]&&(jQuery(e).jqGrid("setCell",n[i].id,t,"",a),jQuery(e).jqGrid("setCell",n[i].id,r,"",a))}async compare_smaller(e,t,r,a){const n=jQuery(e).jqGrid("getGridParam","data");for(let i in n)n[i][t]<n[i][r]&&(jQuery(e).jqGrid("setCell",n[i].id,t,"",a),jQuery(e).jqGrid("setCell",n[i].id,r,"",a))}async compare_bigger(e,t,r,a){const n=jQuery(e).jqGrid("getGridParam","data");for(let i in n)n[i][t]>n[i][r]&&(jQuery(e).jqGrid("setCell",n[i].id,t,"",a),jQuery(e).jqGrid("setCell",n[i].id,r,"",a))}async set_styles(e,t="styles"){const r=jQuery(e).jqGrid("getGridParam","data");for(let a in r)if(r[a][t]){const n=JSON.parse(r[a][t]);for(let t in n){const i=r[a].id,o=t;r[a].hasOwnProperty(o)&&jQuery(e).jqGrid("setCell",i,o,"",n[t])}}}async set_classes(e,t){const r=jQuery(e).getDataIDs();for(var a=0;a<r.length;a+=1){const t=jQuery(e).getRowData(r[a]);var n=jQuery("#"+r[a],jQuery(e));n.removeClass("ui-widget-content"),n.addClass(t.class)}}async add_link_details(e,t,r,a="",n,i){let o=this;t.indexOf("?")>-1?t+="&":t+="?";for(let s=0;s<e.length;s++)e[s].name===r&&(e[s].formatter=function(e,r){let s="";(e=String(e))&&(s=e);let l="";if(e&&(l=e.toString()),"object"==typeof n){let d="";for(let e in n){let t=e,a=n[e];s=r.rowData[a],s&&s&&(d=-1!==t.indexOf("=")?d+""+t+encodeURIComponent(s)+"&":d+""+t+"="+encodeURIComponent(s)+"&")}if(d){"&"===d.slice(-1)&&(d=d.slice(0,-1));const r=o.__cell_format(e,i);e=""!=l&&r&&l?"<a "+a+'href="'+t+d+'"> '+r+"</a>":""}}return l?e:""});return e}async add_link_details_separator(e,t,r,a="",n,i){t+="/";let o=this;for(let s=0;s<e.length;s++)e[s].name===r&&(e[s].formatter=function(e,r){let s=e;if("object"==typeof n){let l="";for(let e in n){let t=e,a=n[e];s=r.rowData[a],s&&s&&(l+=""!=t?t+"/"+encodeURIComponent(s)+"/":encodeURIComponent(s))}if(l){"&"!==l.slice(-1)&&"/"!==l.slice(-1)||(l=l.slice(0,-1));const r=o.__cell_format(e,i);e="<a "+a+'href="'+t+l+'"> '+r+"</a>"}}return e});return e}async add_link_separator(e,t,r,a,n=""){t+="/";for(let i=0;i<e.length;i++)e[i].name===r&&(e[i].formatter=function(e,r){let i="";for(let e in a)for(let t in a[e]){if("field"===t){i+=r.rowData[a[e][t]]}if("extension"===t&&(i+=a[e][t]),"fields"===t){i+="?";for(let n in a[e][t]){let o=r.rowData[a[e][t][n]];i=i+""+n+"="+encodeURIComponent(o)+"&"}}}return i&&("&"!==i.slice(-1)&&"/"!==i.slice(-1)||(i=i.slice(0,-1)),e="<a "+n+'href="'+t+i+'"> '+e+"</a>"),e});return e}__cell_format(e,t){return"format_ok"==t&&(e=0==e||"fail"===e?'<i data-check="failed" class="fa fa-times-circle" aria-hidden="true" style="color:#ff0000;"></i>':'<i data-check="ok" class="fa fa-check-circle" aria-hidden="true" style="color:#008000;"></i>'),e}async subgrid(e,t,r,a,n=""){n=""!=n?n+" ":"",t?r+=t:t="";let i=jQuery("<table style='margin: 5px 0' class='"+e+"_t'></table>");i.appendTo("#"+jQuery.jgrid.jqID(e)),i.jqGrid({caption:n+t,colModel:a,datatype:"json",url:r,gridview:!0,rownumbers:!0,autoencode:!0,sortname:"c1",sortorder:"desc"})}async add_image(e,t,r,a=!1){void 0===r&&(r=60);for(let n=0;n<e.length;n++)e[n].name===t&&(e[n].picture=!0,e[n].width=r,e[n].height=r,e[n].formatter=function(e){const t=e.toLowerCase();return(t.startsWith("https://",0)||t.startsWith("http://",0))&&(t.includes(".png")||t.includes(".jpg")||t.includes(".jpeg")||t.includes(".gif")||t.includes(".svg")||t.includes(".svgz")||t.includes(".webp"))?a?'<a target="blank" href="'+e+'"><img src="'+e+'" alt="my image" width="'+r+'" /></a>':'<img src="'+e+'" alt="my image" width="'+r+'" />':e});return e}async set_filter(e,t,r,a="#filter"){jQuery(e).jqGrid("setGridParam",{fdata:t});let n=document.querySelector(a);for(const e in t)for(let a in r)r[a].push(t[e][a]);for(let e in r)r[e]=r[e].filter(((e,t,r)=>r.indexOf(e)===t)),r[e].sort();for(let t in r){let a=document.createElement("ul"),i=document.createElement("lh");i.innerHTML=t,a.appendChild(i);for(let n in r[t]){let i=document.createElement("li"),o=document.createElement("label");o.innerHTML=r[t][n];let s=document.createElement("input");s.setAttribute("type","checkbox"),s.setAttribute("class",t),s.setAttribute("id",t+"_"+r[t][n]),o.setAttribute("for",t+"_"+r[t][n]),s.value=r[t][n],s.onchange=async()=>{await this._filter(e,r)},i.appendChild(o),i.appendChild(s),a.appendChild(i)}n.appendChild(a)}}async _filter(e,t){let r=[],a=jQuery(e).jqGrid("getGridParam","fdata"),n=[];for(let e in t){let t=document.querySelectorAll("."+e);n[e]=[];for(let r in t)t[r].checked&&n[e].push(t[r].value)}for(let e in a){let i=!1;for(let r in t)-1!=n[r].indexOf(a[e][r])&&(i=!0);i&&r.push(a[e])}jQuery(e).jqGrid("clearGridData"),jQuery(e).jqGrid("setGridParam",{data:r}),jQuery(e).trigger("reloadGrid")}}},{}]},{},[1])(1)}));
1
+ !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).Jqgrid_utils=e()}}((function(){return function e(t,r,a){function n(o,s){if(!r[o]){if(!t[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(i)return i(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var c=r[o]={exports:{}};t[o][0].call(c.exports,(function(e){return n(t[o][1][e]||e)}),c,c.exports,e,t,r,a)}return r[o].exports}for(var i="function"==typeof require&&require,o=0;o<a.length;o++)n(a[o]);return n}({1:[function(e,t,r){"use strict";t.exports=class{constructor(e=!1){e&&e.hasOwnProperty("page")&&(this.page=e.page,localStorage.setItem("page",this.page))}async format_currency_on_value(e,t,r="$"){for(let a=0;a<e.length;a++)e[a].name===t&&(e[a].formatoptions={prefix:r,decimalSeparator:".",thousandsSeparator:",",decimalPlaces:2},e[a].formatter=function(e,t,r){if(null==e||""===e)return"";if(0===parseFloat(e))return"";var a=t.colModel.formatoptions.prefix,n=t.colModel.formatoptions.decimalSeparator,i=t.colModel.formatoptions.thousandsSeparator,o=t.colModel.formatoptions.decimalPlaces,s=parseFloat(e).toFixed(o),l=(s=s.replace(".",n)).split(n);return l[0]=l[0].replace(/\B(?=(\d{3})+(?!\d))/g,i),a+(s=l.join(n))});return e}async format_currency(e,t,r="$"){for(let a=0;a<e.length;a++)e[a].name===t&&(e[a].formatter="currency",e[a].formatoptions={prefix:r,decimalSeparator:".",thousandsSeparator:",",decimalPlaces:2});return e}async add_checkbox(e,t){for(let r=0;r<e.length;r++)e[r].name===t&&(e[r].formatter="checkbox",e[r].formatoptions={disabled:!1},e[r].edittype="checkbox",e[r].editoptions={value:"Yes:No",defaultValue:"Yes"});return e}async add_class(e,t,r){for(let a=0;a<e.length;a++)e[a].name===t&&(e[a].classes?e[a].classes+=" "+r:e[a].classes=r);return e}async _grid_substract_on(e,t=[],r=[],a,n=!1){return await this.grid_substract_on(e,t,r,a,n)}async grid_substract_on(e,t=[],r=[],a,n=!1){let i=jQuery(e),o=i.jqGrid("getGridParam","data"),s={invdate:"Total"},l=0,d=0;for(let e in t){let r=0;for(let a in o)if(o[a].hasOwnProperty(t[e])){let n=o[a][t[e]];"string"==typeof n&&is_digit(n)&&(n=parseFloat(n)),r+=n}r!=Math.floor(r)&&(r=r.toFixed(2)),s[t[e]]=r,l=r}for(let e in r){let t=0;for(let a in o)if(o[a].hasOwnProperty(r[e])){let n=o[a][r[e]];"string"==typeof n&&is_digit(n)&&(n=parseFloat(n)),t+=n}t!=Math.floor(t)&&(t=t.toFixed(2)),s[r[e]]=t,d=t}let c=l-d;return n&&c<0&&(c=0),s[a]=c,i.jqGrid("footerData","set",s),s}_grid_ratio_on(e,t,r,a){return this.grid_ratio_on(e,t,r,a)}async grid_ratio_on(e,t,r,a){jQuery("#grid").jqGrid("getGridParam","data");let n=jQuery(e),i=n.jqGrid("getGridParam","data"),o={invdate:"Total"};fraction_sum=0,denominator_sum=0,ratio_sum=0;for(let e in i)i[e].hasOwnProperty(t)&&(fraction_sum+=i[e][t]),i[e].hasOwnProperty(r)&&(denominator_sum+=i[e][r]);return o.qc_eta_ratio=(fraction_sum/denominator_sum).toFixed(2),n.jqGrid("footerData","set",o),o}is_html(e){let t=!1;try{const r=(new DOMParser).parseFromString(e,"text/html");Array.from(r.body.childNodes).some((e=>1===e.nodeType))&&(t=!0)}catch(e){}return t}async _grid_sum_on(e,t=[],r=""){return await this.grid_sum_on(e,t,r)}async grid_sum_on(e,t=[],r=""){let a=jQuery(e),n=a.jqGrid("getGridParam","data"),i={invdate:"Total"};for(let e in t){let a=0;for(let r in n){let i=0;if(n[r].hasOwnProperty(t[e])){let o=n[r][t[e]];if(o){if("string"==typeof o)if(this.is_html(o)){const e=(new DOMParser).parseFromString(o,"text/html").querySelectorAll("a"),t=Array.from(e).map((e=>e.text));if(t.length){const e=t[0].replace(",","");is_digit(e)&&(i=parseFloat(e))}}else is_digit(o)&&(i=parseFloat(o));else"number"==typeof o&&(i=o);a+=i}}}a!=Math.floor(a)&&(a=a.toFixed(2)),i[t[e]]=""!=r?r+""+this._format_number_with_commas(a):a}return a.jqGrid("footerData","set",i),i}_grid_avg_on(e,t=[]){return this.grid_avg_on(e,t)}async grid_avg_on(e,t=[]){let r=jQuery(e),a=r.jqGrid("getGridParam","data"),n=0,i={invdate:"Total"};for(let e in t){let r=0;for(let i in a)if(a[i].hasOwnProperty(t[e])){let o=a[i][t[e]];"string"==typeof o&&is_digit(o)&&(o=parseFloat(o)),r+=o,n++}r/=n,r!=Math.floor(r)&&(r=r.toFixed(2)),i[t[e]]=r}return r.jqGrid("footerData","set",i),i}_grid_percent_on(e,t){return grid_percent_on(e,t)}async grid_percent_on(e,t){let r=jQuery(e),a=r.jqGrid("getGridParam","data"),n={},i=t.id?t.id:"invate";footer[i]="Total";let o=t.total,s=JSON.parse(JSON.stringify(t.percent));s.push(o);for(let e in s){let t=s[e],r=0,i=0;for(let e in a)if(a[e].hasOwnProperty(t)){let n=a[e][t];"string"==typeof n?is_digit(n)&&(n=parseFloat(n),r+=n,i++):(r+=n,i++)}n[t]=r}for(let e in s){let t=s[e],r=n[t]/(n[o]/100);r=r.toFixed(2),footer[t]=r+"%"}r.jqGrid("footerData","set",footer)}async update_row_to_api(e,t="",r=["id"],a={},n){let i=this,o=[],s={},l={},d={};const c=e.jqGrid("getGridParam","record_data");if(""!=t&&Object.keys(a).length>0&&"edit"==a.inputData.oper){for(let e in c)if(c[e].id===a.rowid){for(let t in r)c[e].hasOwnProperty(r[t])&&(s[r[t]]=c[e][r[t]]);for(let t in a.inputData)"oper"!=t&&Object.keys(s).indexOf(t)<0&&a.inputData[t]!=c[e][t]&&(d[t]=a.inputData[t])}for(let e in d)if(Object.keys(s).indexOf(e)<0&&"oper"!=e){let r={};r[e]=d[e],n.ids=s,n.values=r,n.operator="edit";const a=await i.post_json(t,JSON.stringify(n));o.push(a)}}else if(""!=t&&Object.keys(a).length>0&&"add"==a.inputData.oper){for(let e in a.inputData)a.inputData[e]&&"id"!=e&&"oper"!=e&&(l[e]=a.inputData[e]);n.ids=s,n.values=l,n.operator="add";let e=await i.post_json(t,JSON.stringify(n));o.push(e)}return o}async delete_row_to_api(e,t="",r,a=[],n={}){let i={msg:"failed"},o=this,s=[],l={};const d=e.jqGrid("getGridParam","record_data");for(let e in d)if(d[e].id===r){for(let t in a)d[e].hasOwnProperty(a[t])&&(l[a[t]]=d[e][a[t]],s.push(a[t]));break}return""!=t&&Object.keys(l).length==s.length&&(n.ids=s,n.values=l,i=await o.adelete_api(t,JSON.stringify(n))),i}async append_seperator_link_column(e,t,r,a,n="",i){t+="/";return a.formatter=function(e,a){let o=r;if("object"==typeof i){let r="";for(let e in i){let t=e,n=i[e],o=a.rowData[n];o&&o&&(r+=""!=t?t+"/"+encodeURIComponent(o)+"/":encodeURIComponent(o))}r&&("&"!==r.slice(-1)&&"/"!==r.slice(-1)||(r=r.slice(0,-1)),e="<a "+n+'href="'+t+r+'"> '+o+"</a>")}return e},e.push(a),e}async add_edit(e,t,r,a){for(let n=0;n<e.length;n++)e[n].name===t&&(Object.assign(e[n],r),Object.assign(e[n],a));return e}async add_textarea(e,t,r='style="width:100%;height:100px"'){for(let a=0;a<e.length;a++)e[a].name===t&&(e[a].formatter=function(e){return"<textarea "+r+">"+e+"</textarea>"});return e}async get_col_model_from_data(e,t,r=[],a=[]){let n=[];for(let e in t){const r=Object.keys(t[e]);for(let e in r){const t=r[e];n.push(t)}}n=n.filter(((e,t)=>n.indexOf(e)===t));let i=[];for(let e in a)i.push(a[e].name);let o=n.filter((e=>!i.includes(e)));const s=new Set(r);o=o.filter((e=>!s.has(e))),o.sort();for(let e=0;e<o.length;e++)a.push({name:o[e],label:o[e]});return a}binary_replace(e,t="zero",r="one"){let a=t;return 1!=e&&0!=e||1==e&&(a=r),a}_date112_to_DMY(e,t="/"){let r=e;if(e.length>=8&&-1===e.indexOf(t)){let a=[];a.push(e.substr(6,2)),a.push(e.substr(4,2)),a.push(e.substr(0,4)),r=a.join(t)}return r}async date112_to_DMY(e,t,r="/"){for(let a=0;a<e.length;a++)e[a].name===t&&(e[a].formatter=function(e,t){if(e){let t=e=e.toString();if(e.length>=8&&-1===e.indexOf(r)){let a=[];a.push(e.substr(6,2)),a.push(e.substr(4,2)),a.push(e.substr(0,4)),t=a.join(r)}return t}return e});return e}async add_formatter(e,t,r){for(let a=0;a<e.length;a++)e[a].name===t&&r.hasOwnProperty("formatter")&&r.hasOwnProperty("formatoptions")&&(e[a].formatter=r.formatter,e[a].formatoptions=r.formatoptions,e[a].edittype=r.formatter,e[a].editoptions=r.formatoptions);return e}async natural_sort(e,t){for(let r=0;r<e.length;r++)e[r].name===t&&(e[r].sortfunc=function(e,t,r){void 0===r&&(r=1);var a,n,i=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,o=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,l=/^0x[0-9a-f]+$/i,d=/^0/,c=function(e){return self.insensitive&&(""+e).toLowerCase()||""+e},f=c(e).replace(o,"")||"",u=c(t).replace(o,"")||"",p=f.replace(i,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),_=u.replace(i,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),m=parseInt(f.match(l))||1!=p.length&&f.match(s)&&Date.parse(f),h=parseInt(u.match(l))||m&&u.match(s)&&Date.parse(u)||null;if(h){if(m<h)return-r;if(m>h)return r}for(var y=0,g=Math.max(p.length,_.length);y<g;y++){if(a=!(p[y]||"").match(d)&&parseFloat(p[y])||p[y]||0,n=!(_[y]||"").match(d)&&parseFloat(_[y])||_[y]||0,isNaN(a)!==isNaN(n))return isNaN(a)?r:-r;if(typeof a!=typeof n&&(a+="",n+=""),a<n)return-r;if(a>n)return r}return 0});return e}async add_html_formatter(e,t,r){for(let a=0;a<e.length;a++)e[a].name===t&&(e[a].formatter=function(e,t){return r});return e}async add_ok_button(e,t){let r=this;for(let a=0;a<e.length;a++)t.indexOf(e[a].name)>-1&&(e[a].formatter=function(e){return null!=e?r.__cell_format(e,"format_ok"):""});return e}async get_filled_cell_table_data(e,t=[]){let r=jQuery(e).jqGrid("getGridParam","data"),a=t,n=[];for(let e in r)if(r[e].hasOwnProperty("id")){let t=[r[e].id];for(let n in a)r[e].hasOwnProperty(a[n])?t.push(r[e][a[n]]):t.push("");var i=t.filter((function(e,t,r){return""!==e}));Object.keys(i).length>1&&n.push(t)}return n}async get_filled_cell_data(e,t=[]){let r=jQuery(e).jqGrid("getGridParam","data"),a=t,n=[];for(let e in r)if(r[e].hasOwnProperty("id")){let t={id:r[e].id};for(let n in a)r[e].hasOwnProperty(a[n])&&""!=r[e][a[n]]&&(t[a[n]]=r[e][a[n]]);Object.keys(t).length>1&&n.push(t)}return n}async set_link(e,t,r,a=""){for(let n=0;n<e.length;n++)e[n].name===t&&(e[n].formatter=function(e,t){return'<a class="gl" '+a+'href="'+t.rowData[r]+'">'+e+"</a>"});return e}async hide_all_columns_except(e,t){for(let r=0;r<e.length;r++)t.indexOf(e[r].name)>-1?e[r].hidden=!1:e[r].hidden=!0;return e}async hide_column(e,t){for(let r=0;r<e.length;r++)e[r].name===t&&(e[r].hidden=!0);return e}s_grid_set_caption(e,t=[]){this.grid_set_captionn(e,[])}async grid_set_caption(e,t=[]){if(e){const r=jQuery(e);let a=0;a=0===t.length?r.jqGrid("getGridParam","records"):t.length;const n=/\d.*x/,i=r.jqGrid("getGridParam","caption").replace(n,"");r.jqGrid("setCaption",i+" "+a+"x")}}s_resize_saved_cell_width(e,t=!1,r=!1){this.grid_set_caption(e,t,r)}async resize_saved_cell_width(e,t=!1,r=!1){let a=t||this.page;a+=r?"-"+r+"-w-":"-grid-w-";for(let t=0;t<=e.length;t++)if(e[t]&&e[t].name){const r=e[t].name,n=localStorage.getItem(a+r);n&&(e[t].width=n)}return e}resize_cell(e,t,r=!1){const a=jQuery(this).jqGrid("getGridParam","colModel");if(a[t]&&a[t].name){const n=a[t].name;let i=(r||localStorage.getItem("page"))+"-"+this.id+"-w-"+n;localStorage.setItem(i,e);localStorage.getItem(i)}}async upsert_row(e,t,r={}){if(e.rowid.startsWith("jqg")){return await this.insert_row(e,t)}return await this.update_row(e,t)}async insert_row(e,t){let r={},a="";if(e.inputData.hasOwnProperty("id")){r._id="id",r._id_val=e.inputData.id;for(let t in e.inputData)r[t]=e.inputData[t];delete r.id,delete r.oper,a=await this.put_json(t,JSON.stringify(r))}return a}async update_row(e,t,r={}){let a="";r._id||(r._id="id"),r._id_val=e.inputData.id;for(let t in e.inputData)r[t]=e.inputData[t];return delete r.id,delete r.oper,a=await this.post_json(t,JSON.stringify(r)),a}async delete_row(e,t){let r="";return t.indexOf("?")>-1?t+="&_id="+encodeURIComponent(unescape(e)):t+="?_id="+encodeURIComponent(unescape(e)),r=JSON.parse(await this.adelete_api(t)),r.message}async adelete_api(e,t=!1){let r="application/x-www-form-urlencoded",a=null;return t&&(r="application/json;charset=UTF-8",a=t),new Promise(((t,n)=>{let i=new XMLHttpRequest;i.open("DELETE",e),i.setRequestHeader("Content-type",r),i.onload=()=>t(i.responseText),i.onerror=()=>n(i.statusText),i.send(a)}))}async post_json(e,t){return new Promise(((r,a)=>{let n=new XMLHttpRequest;n.open("POST",e),n.setRequestHeader("Content-type","application/json"),n.onload=()=>r(n.responseText),n.onerror=()=>a(n.statusText),n.send(t)}))}async put_json(e,t){return new Promise(((r,a)=>{let n=new XMLHttpRequest;n.open("PUT",e),n.setRequestHeader("Content-type","application/json"),n.onload=()=>r(n.responseText),n.onerror=()=>a(n.statusText),n.send(t)}))}s_hide_del_icon(){hide_del_icon()}async hide_del_icon(){jQuery(".ui-inline-del").each((function(e){jQuery(this).html("")}))}async add_link_details_csv(e,t,r,a="",n,i,o=","){let s=this;t.indexOf("?")>-1?t+="&":t+="?";for(let l=0;l<e.length;l++)e[l].name===r&&(e[l].formatter=function(e,r){let l=e;const d=s.__cell_format(e,i),c=d.split(o);let f="";for(let i in c){const s=c[i].trim();if(s&&"object"==typeof n){let e="";for(let t in n){let a=t,i=n[t];l=r.rowData[i],l&&(e=-1!==a.indexOf("=")?e+""+a+encodeURIComponent(s)+"&":e+""+a+"="+encodeURIComponent(s)+"&")}"&"===e.slice(-1)&&(e=e.slice(0,-1)),f+="<a "+a+'href="'+t+e+'"> '+s+"</a>"+o+" "}(e=f.trim()).slice(-1)===o&&(e=e.slice(0,-1))}return e||d});return e}async compare(e,t,r,a){const n=jQuery(e).jqGrid("getGridParam","data");for(let i in n)n[i][t]!=n[i][r]&&(jQuery(e).jqGrid("setCell",n[i].id,t,"",a),jQuery(e).jqGrid("setCell",n[i].id,r,"",a))}async compare_smaller(e,t,r,a){const n=jQuery(e).jqGrid("getGridParam","data");for(let i in n)n[i][t]<n[i][r]&&(jQuery(e).jqGrid("setCell",n[i].id,t,"",a),jQuery(e).jqGrid("setCell",n[i].id,r,"",a))}async compare_bigger(e,t,r,a){const n=jQuery(e).jqGrid("getGridParam","data");for(let i in n)n[i][t]>n[i][r]&&(jQuery(e).jqGrid("setCell",n[i].id,t,"",a),jQuery(e).jqGrid("setCell",n[i].id,r,"",a))}async set_styles(e,t="styles"){const r=jQuery(e).jqGrid("getGridParam","data");for(let a in r)if(r[a][t]){const n=JSON.parse(r[a][t]);for(let t in n){const i=r[a].id,o=t;r[a].hasOwnProperty(o)&&jQuery(e).jqGrid("setCell",i,o,"",n[t])}}}async set_classes(e,t){const r=jQuery(e).getDataIDs();for(var a=0;a<r.length;a+=1){const t=jQuery(e).getRowData(r[a]);var n=jQuery("#"+r[a],jQuery(e));n.removeClass("ui-widget-content"),n.addClass(t.class)}}async add_link_details(e,t,r,a="",n,i){let o=this;t.indexOf("?")>-1?t+="&":t+="?";for(let s=0;s<e.length;s++)e[s].name===r&&(e[s].formatter=function(e,r){let s="";(e=String(e))&&(s=e);let l="";if(e&&(l=e.toString()),"object"==typeof n){let d="";for(let e in n){let t=e,a=n[e];s=r.rowData[a],s&&s&&(d=-1!==t.indexOf("=")?d+""+t+encodeURIComponent(s)+"&":d+""+t+"="+encodeURIComponent(s)+"&")}if(d){"&"===d.slice(-1)&&(d=d.slice(0,-1));const r=o.__cell_format(e,i);e=""!=l&&r&&l?"<a "+a+'href="'+t+d+'"> '+r+"</a>":""}}return l?e:""});return e}async add_link_details_separator(e,t,r,a="",n,i){t+="/";let o=this;for(let s=0;s<e.length;s++)e[s].name===r&&(e[s].formatter=function(e,r){let s=e;if("object"==typeof n){let l="";for(let e in n){let t=e,a=n[e];s=r.rowData[a],s&&s&&(l+=""!=t?t+"/"+encodeURIComponent(s)+"/":encodeURIComponent(s))}if(l){"&"!==l.slice(-1)&&"/"!==l.slice(-1)||(l=l.slice(0,-1));const r=o.__cell_format(e,i);e="<a "+a+'href="'+t+l+'"> '+r+"</a>"}}return e});return e}async add_link_separator(e,t,r,a,n=""){t+="/";for(let i=0;i<e.length;i++)e[i].name===r&&(e[i].formatter=function(e,r){let i="";for(let e in a)for(let t in a[e]){if("field"===t){i+=r.rowData[a[e][t]]}if("extension"===t&&(i+=a[e][t]),"fields"===t){i+="?";for(let n in a[e][t]){let o=r.rowData[a[e][t][n]];i=i+""+n+"="+encodeURIComponent(o)+"&"}}}return i&&("&"!==i.slice(-1)&&"/"!==i.slice(-1)||(i=i.slice(0,-1)),e="<a "+n+'href="'+t+i+'"> '+e+"</a>"),e});return e}_format_number_with_commas(e){const t=e.toString().split(".");return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),t.join(".")}__cell_format(e,t){if("format_ok"==t)e=0==e||"fail"===e?'<i data-check="failed" class="fa fa-times-circle" aria-hidden="true" style="color:#ff0000;"></i>':'<i data-check="ok" class="fa fa-check-circle" aria-hidden="true" style="color:#008000;"></i>';else if("$"==t&&e){e=t+""+this._format_number_with_commas(e)}return e}async subgrid(e,t,r,a,n=""){n=""!=n?n+" ":"",t?r+=t:t="";let i=jQuery("<table style='margin: 5px 0' class='"+e+"_t'></table>");i.appendTo("#"+jQuery.jgrid.jqID(e)),i.jqGrid({caption:n+t,colModel:a,datatype:"json",url:r,gridview:!0,rownumbers:!0,autoencode:!0,sortname:"c1",sortorder:"desc"})}async add_image(e,t,r,a=!1){void 0===r&&(r=60);for(let n=0;n<e.length;n++)e[n].name===t&&(e[n].picture=!0,e[n].width=r,e[n].height=r,e[n].formatter=function(e){const t=e.toLowerCase();return(t.startsWith("https://",0)||t.startsWith("http://",0))&&(t.includes(".png")||t.includes(".jpg")||t.includes(".jpeg")||t.includes(".gif")||t.includes(".svg")||t.includes(".svgz")||t.includes(".webp"))?a?'<a target="blank" href="'+e+'"><img src="'+e+'" alt="my image" width="'+r+'" /></a>':'<img src="'+e+'" alt="my image" width="'+r+'" />':e});return e}async set_filter(e,t,r,a="#filter"){jQuery(e).jqGrid("setGridParam",{fdata:t});let n=document.querySelector(a);for(const e in t)for(let a in r)r[a].push(t[e][a]);for(let e in r)r[e]=r[e].filter(((e,t,r)=>r.indexOf(e)===t)),r[e].sort();for(let t in r){let a=document.createElement("ul"),i=document.createElement("lh");i.innerHTML=t,a.appendChild(i);for(let n in r[t]){let i=document.createElement("li"),o=document.createElement("label");o.innerHTML=r[t][n];let s=document.createElement("input");s.setAttribute("type","checkbox"),s.setAttribute("class",t),s.setAttribute("id",t+"_"+r[t][n]),o.setAttribute("for",t+"_"+r[t][n]),s.value=r[t][n],s.onchange=async()=>{await this._filter(e,r)},i.appendChild(o),i.appendChild(s),a.appendChild(i)}n.appendChild(a)}}async _filter(e,t){let r=[],a=jQuery(e).jqGrid("getGridParam","fdata"),n=[];for(let e in t){let t=document.querySelectorAll("."+e);n[e]=[];for(let r in t)t[r].checked&&n[e].push(t[r].value)}for(let e in a){let i=!1;for(let r in t)-1!=n[r].indexOf(a[e][r])&&(i=!0);i&&r.push(a[e])}jQuery(e).jqGrid("clearGridData"),jQuery(e).jqGrid("setGridParam",{data:r}),jQuery(e).trigger("reloadGrid")}}},{}]},{},[1])(1)}));
package/jqgrid_utils.js CHANGED
@@ -319,15 +319,16 @@ var jqu = new Jqgrid_utils({page:page});
319
319
  * Syncron Alias grid_sum_on
320
320
  @alias module:Jqgrid_utils
321
321
  */
322
- async _grid_sum_on(grid, fields = []) {
323
- return await this.grid_sum_on(grid, fields);
322
+ async _grid_sum_on(grid, fields = [], format = "") {
323
+ return await this.grid_sum_on(grid, fields, format);
324
324
  }
325
325
 
326
326
  /**
327
327
  * Sum the columns values together
328
328
  @alias module:Jqgrid_utils
329
329
  @param {object} - Grid Object (required)
330
- @param {string} - Column/Field Name to sum
330
+ @param {string} - Column/Field Name to sum
331
+ @param {string} - format, currency sign
331
332
  @example
332
333
  var jqu = new Jqgrid_utils({page:page});
333
334
  gridComplete: function () {
@@ -339,7 +340,8 @@ gridComplete: function () {
339
340
  ]);
340
341
  },
341
342
  */
342
- async grid_sum_on(grid, fields = []) {
343
+ async grid_sum_on(grid, fields = [], format = "") {
344
+ //console.log(format);
343
345
  let $self = jQuery(grid);
344
346
  let rows = $self.jqGrid("getGridParam", "data");
345
347
  let footer = {
@@ -379,8 +381,14 @@ gridComplete: function () {
379
381
  if (sum != Math.floor(sum)) {
380
382
  sum = sum.toFixed(2);
381
383
  }
382
- footer[fields[i]] = sum;
384
+
385
+ if (format != "") {
386
+ footer[fields[i]] = format + "" + this._format_number_with_commas(sum);
387
+ } else {
388
+ footer[fields[i]] = sum;
389
+ }
383
390
  }
391
+
384
392
  $self.jqGrid("footerData", "set", footer);
385
393
  return footer;
386
394
  }
@@ -1971,6 +1979,19 @@ var jqu = new Jqgrid_utils();
1971
1979
  /**
1972
1980
  * Private Function
1973
1981
  @alias module:Jqgrid_utils
1982
+ @param {string} - number to add comma
1983
+ */
1984
+ _format_number_with_commas(number) {
1985
+ const parts = number.toString().split(".");
1986
+ parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1987
+ return parts.join(".");
1988
+ }
1989
+
1990
+ /**
1991
+ * Private Function
1992
+ @alias module:Jqgrid_utils
1993
+ @param {object} - cell_value
1994
+ @param {string} - format_ok or $ sign
1974
1995
  */
1975
1996
  __cell_format(cell_value, format) {
1976
1997
  if (format == "format_ok") {
@@ -1981,7 +2002,13 @@ var jqu = new Jqgrid_utils();
1981
2002
  cell_value =
1982
2003
  '<i data-check="ok" class="fa fa-check-circle" aria-hidden="true" style="color:#008000;"></i>';
1983
2004
  }
2005
+ } else if (format == "$") {
2006
+ if (cell_value) {
2007
+ const number = this._format_number_with_commas(cell_value);
2008
+ cell_value = format + "" + number;
2009
+ }
1984
2010
  }
2011
+
1985
2012
  return cell_value;
1986
2013
  }
1987
2014
 
package/package.json CHANGED
@@ -26,6 +26,6 @@
26
26
  "url": "https://github.com/myridia/jqgrid_utils"
27
27
  },
28
28
 
29
- "version": "1.38.1"
29
+ "version": "1.39.1"
30
30
 
31
31
  }
@@ -0,0 +1,554 @@
1
+ <?xml version="1.0"?>
2
+ <svg
3
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ xmlns:cc="http://creativecommons.org/ns#"
6
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
7
+ xmlns:svg="http://www.w3.org/2000/svg"
8
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
9
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
10
+ xmlns:ns1="http://sozi.baierouge.fr"
11
+ xmlns:xlink="http://www.w3.org/1999/xlink"
12
+ id="svg2"
13
+ viewBox="0 0 788.61 950.38"
14
+ version="1.1"
15
+ >
16
+ <g
17
+ id="layer1"
18
+ transform="translate(1107.1 -294.84)"
19
+ >
20
+ <path
21
+ id="path4015"
22
+ style="color:#000000"
23
+ d="m-556.59 623.05-84.348 254.31s-3.1819 23.907-14.189 32.517c-6.0193 4.7085-10.222 3.7977-15.113 3.1522-4.6993-0.62018-10.131-0.82063-13.752-3.9596-3.5864-3.1089-14.225-2.7423-13.009-10.244 6.0609-37.376 44.447-43.437 44.447-43.437l52.528-212.13 50.508-30.305"
24
+ />
25
+ <path
26
+ id="path4041"
27
+ d="m-871.42 1052.1 87.277 17.665 11.137 81.584-21.906-73.179-69.66-1.1307"
28
+ style="color:#000000"
29
+ fill="#28170b"
30
+ />
31
+ <path
32
+ id="path3968"
33
+ d="m-909.14 1017.5s35.86 113.64 95.964 98.995c60.104-14.647 88.641-153.8 109.85-195.72 21.213-41.921 29.294-56.316 29.294-56.316l-10.607 2.0203s-63.387 272.24-121.98 241.43c-58.589-30.81-85.358-63.135-85.358-63.135"
34
+ style="color:#000000"
35
+ fill="#500"
36
+ />
37
+ <path
38
+ id="path4039"
39
+ d="m-867.16 1050.8 90.643 8.7865 32.369 84.456-41.321-73.232-68.245 5.0777"
40
+ style="color:#000000"
41
+ fill="#28170b"
42
+ />
43
+ <path
44
+ id="path4037"
45
+ d="m-986.82 1048.9-79.142 51.673 18.772 88.477-5.155-83.928 67.888-27.857"
46
+ style="color:#000000"
47
+ fill="#28170b"
48
+ />
49
+ <path
50
+ id="path4035"
51
+ d="m-835.17 1045.3 79.142 51.673-18.772 88.477 5.155-83.928-67.888-27.857"
52
+ style="color:#000000"
53
+ fill="#28170b"
54
+ />
55
+ <path
56
+ id="path3947"
57
+ d="m-807.14 1050.9 28.571-68.571 45.714 128.57-20 115.71 7.1428-114.29-31.429-57.857-51.429 31.429z"
58
+ style="color:#000000"
59
+ fill="#502d16"
60
+ />
61
+ <path
62
+ id="path3970"
63
+ d="m-971.66 1087.2-37.651-56.867-70.571 91.673 18.772 88.477-5.155-83.928 59.316-67.857 54.49 50.429"
64
+ style="color:#000000"
65
+ fill="#28170b"
66
+ />
67
+ <path
68
+ id="path3963"
69
+ d="m-1009.3 1085.9-49.286-47.143-48.572 105 37.857 82.143-23.571-80.714 42.857-79.286 64.286 37.143"
70
+ style="color:#000000"
71
+ fill="#28170b"
72
+ />
73
+ <path
74
+ id="path3116"
75
+ d="m-487.14 930.93 11.429 167.14s11.429 8.5714 14.286 2.8571c2.8571-5.7143 28.571-190 28.571-190z"
76
+ style="color:#000000"
77
+ fill="#ccc"
78
+ />
79
+ <path
80
+ id="path3106"
81
+ d="m-590 946.65 11.429 167.14s11.429 8.5714 14.286 2.8571c2.8571-5.7143 28.571-190 28.571-190z"
82
+ style="color:#000000"
83
+ fill="#ccc"
84
+ />
85
+ <path
86
+ id="path3104"
87
+ style="color:#000000"
88
+ d="m-557.14 606.65-87.143 348.57s218.57-32.857 261.43-20c42.857 12.857-80-331.43-80-331.43z"
89
+ />
90
+ <path
91
+ id="path3094"
92
+ d="m-694.29 619.51a89.286 44.286 0 1 1 -178.57 0 89.286 44.286 0 1 1 178.57 0z"
93
+ style="color:#000000"
94
+ fill="#784421"
95
+ transform="matrix(1.268 0 0 1.268 73.926 271.39)"
96
+ />
97
+ <path
98
+ id="path3886"
99
+ style="color:#000000"
100
+ d="m-587.5 981.65 43.214 0.71428-2.1428 15-39.643-1.0714z"
101
+ />
102
+ <path
103
+ id="path3888"
104
+ style="color:#000000"
105
+ d="m-584.64 1022.7 34.643 1.7857-1.7857 14.286-32.143-2.5z"
106
+ />
107
+ <path
108
+ id="path3890"
109
+ style="color:#000000"
110
+ d="m-580.71 1065.6h23.929l-1.7857 15.357-22.143-2.1428z"
111
+ />
112
+ <path
113
+ id="path3892"
114
+ style="color:#000000"
115
+ d="m-589.29 954.86 48.929-5 1.0714-10-50.357 5z"
116
+ />
117
+ <path
118
+ id="path3894"
119
+ style="color:#000000"
120
+ d="m-565.71 1117-16.071-2.8571s-12.5-1.0714-19.643 12.5c-7.1429 13.571-16.071 16.786-19.286 16.786-3.2143 0 28.929 23.571 43.929 8.2143s25.714-38.214 18.214-37.143c-7.5 1.0715-9.6429 2.1429-9.6429 2.1429v1.4286"
121
+ />
122
+ <path
123
+ id="path3896"
124
+ style="color:#000000"
125
+ d="m-476.07 1091.3s-10.357 1.0714-11.786 4.6428c-1.4286 3.5714-5.3572 17.857 3.9286 20 9.2857 2.1429 58.929 12.143 60.357 14.286 1.4286 2.1429 10.327-26.544-1.4286-21.786-15 6.0714-32.857-17.143-32.857-17.143z"
126
+ />
127
+ <path
128
+ id="path3898"
129
+ style="color:#000000"
130
+ d="m-476.43 1074.1 20.357-3.5714 0.71429-10-22.857 2.5z"
131
+ />
132
+ <path
133
+ id="path3900"
134
+ style="color:#000000"
135
+ d="m-480.36 1022.4 31.786-3.2143-3.2143 18.929-26.429-1.0715z"
136
+ />
137
+ <path
138
+ id="path3902"
139
+ style="color:#000000"
140
+ d="m-484.64 980.93h41.786l-2.5 14.286-37.15-1.07z"
141
+ />
142
+ <path
143
+ id="path3904"
144
+ style="color:#000000"
145
+ d="m-486.91 946.63 50.357-2.3618v-12.281l-50 3.7788z"
146
+ />
147
+ <path
148
+ id="path3108"
149
+ d="m-871.43 1035.9a26.429 26.429 0 1 1 -52.857 0 26.429 26.429 0 1 1 52.857 0z"
150
+ style="color:#000000"
151
+ transform="matrix(.86486 0 0 .86486 -215.4 129.22)"
152
+ />
153
+ <path
154
+ id="path3912"
155
+ d="m-871.43 1035.9a26.429 26.429 0 1 1 -52.857 0 26.429 26.429 0 1 1 52.857 0z"
156
+ style="color:#000000"
157
+ fill="#fff"
158
+ transform="matrix(.45946 0 0 .45946 -585.11 540.62)"
159
+ />
160
+ <path
161
+ id="path3914"
162
+ d="m-871.43 1035.9a26.429 26.429 0 1 1 -52.857 0 26.429 26.429 0 1 1 52.857 0z"
163
+ style="color:#000000"
164
+ fill="#fff"
165
+ transform="matrix(.28378 0 0 .28378 -730.34 740.82)"
166
+ />
167
+ <path
168
+ id="path3923"
169
+ d="m-871.43 1035.9a26.429 26.429 0 1 1 -52.857 0 26.429 26.429 0 1 1 52.857 0z"
170
+ style="color:#000000"
171
+ transform="matrix(.86486 0 0 .86486 -53.669 124.05)"
172
+ />
173
+ <path
174
+ id="path3925"
175
+ d="m-871.43 1035.9a26.429 26.429 0 1 1 -52.857 0 26.429 26.429 0 1 1 52.857 0z"
176
+ style="color:#000000"
177
+ fill="#fff"
178
+ transform="matrix(.45946 0 0 .45946 -423.38 535.45)"
179
+ />
180
+ <path
181
+ id="path3927"
182
+ d="m-871.43 1035.9a26.429 26.429 0 1 1 -52.857 0 26.429 26.429 0 1 1 52.857 0z"
183
+ style="color:#000000"
184
+ fill="#fff"
185
+ transform="matrix(.28378 0 0 .28378 -568.61 735.65)"
186
+ />
187
+ <path
188
+ id="path3931"
189
+ d="m-871.43 1035.9a26.429 26.429 0 1 1 -52.857 0 26.429 26.429 0 1 1 52.857 0z"
190
+ style="color:#000000"
191
+ transform="matrix(.5 0 0 .5 -489.57 515.15)"
192
+ />
193
+ <path
194
+ id="path3933"
195
+ d="m-871.43 1035.9a26.429 26.429 0 1 1 -52.857 0 26.429 26.429 0 1 1 52.857 0z"
196
+ style="color:#000000"
197
+ fill="#fff"
198
+ transform="matrix(.26563 0 0 .26563 -703.31 752.99)"
199
+ />
200
+ <path
201
+ id="path3935"
202
+ d="m-871.43 1035.9a26.429 26.429 0 1 1 -52.857 0 26.429 26.429 0 1 1 52.857 0z"
203
+ style="color:#000000"
204
+ fill="#fff"
205
+ transform="matrix(.16406 0 0 .16406 -787.27 868.73)"
206
+ />
207
+ <path
208
+ id="path3939"
209
+ d="m-871.43 1035.9a26.429 26.429 0 1 1 -52.857 0 26.429 26.429 0 1 1 52.857 0z"
210
+ style="color:#000000"
211
+ transform="matrix(.5 0 0 .5 -430.34 516.45)"
212
+ />
213
+ <path
214
+ id="path3941"
215
+ d="m-871.43 1035.9a26.429 26.429 0 1 1 -52.857 0 26.429 26.429 0 1 1 52.857 0z"
216
+ style="color:#000000"
217
+ fill="#fff"
218
+ transform="matrix(.26563 0 0 .26563 -644.08 754.3)"
219
+ />
220
+ <path
221
+ id="path3943"
222
+ d="m-871.43 1035.9a26.429 26.429 0 1 1 -52.857 0 26.429 26.429 0 1 1 52.857 0z"
223
+ style="color:#000000"
224
+ fill="#fff"
225
+ transform="matrix(.16406 0 0 .16406 -728.04 870.04)"
226
+ />
227
+ <path
228
+ id="path3945"
229
+ d="m-1016.4 1050.9-42.143-59.286-46.429 135 17.857 118.57-5.7142-120 36.428-75.714 43.572 33.572z"
230
+ style="color:#000000"
231
+ fill="#502d16"
232
+ />
233
+ <path
234
+ id="path3949"
235
+ d="m-932.86 1083.1s-27.143 38.571-12.143 54.286c15 15.714 32.857 12.857 32.857 12.857l-25-15 7.8571-4.2857-7.8571-12.143 17.143-30"
236
+ style="color:#000000"
237
+ fill="#502d16"
238
+ />
239
+ <path
240
+ id="path3951"
241
+ d="m-870 1082.4s12.857 51.429 1.4286 58.571c-11.429 7.1429-12.857 7.1429-12.857 7.1429l8.5714-16.429-7.8572-7.1429 11.429-6.4285-17.143-7.1429 4.2857-18.571"
242
+ style="color:#000000"
243
+ fill="#502d16"
244
+ />
245
+ <path
246
+ id="path3989"
247
+ d="m-897.27 1051.1 65.786 40.911-8.8388 5.3033-56.19-38.007z"
248
+ style="color:#000000"
249
+ fill="#d40000"
250
+ />
251
+ <path
252
+ id="path3979"
253
+ d="m-911.66 1054.9s-67.175 46.467-68.185 48.74c-1.0102 2.2728 17.173 4.7982 17.173 4.7982l51.518-44.699z"
254
+ style="color:#000000"
255
+ fill="#d40000"
256
+ />
257
+ <path
258
+ id="path3953"
259
+ d="m-925.9 999.17c13.383 37.875 15.979 26.56 13.058 67.039l14.281-1.4375s4.4373-0.2447 1.5802-14.53c-2.0057-10.028-12.67-50.719-12.67-50.719z"
260
+ style="color:#000000"
261
+ fill="#d40000"
262
+ />
263
+ <path
264
+ id="path3955"
265
+ d="m-917.64 996.78c-5.1536 0.0456-10.97 0.26987-10.765 0.87403 0.32809 0.96667 0.31578 1.7763 0.31578 1.7763l0.17225-1.1278s2.4647 13.848 6.4018 14.492c3.937 0.6444 16.568 0.8136 17.224-0.9586 0.65616-1.7723-3.1414-14.838-6.2582-15-1.1688-0.0604-3.9986-0.0838-7.0907-0.0564zm3.2726 2.1146c1.338-0.008 2.4401 0.0161 3.0143 0.0564 2.2966 0.16111 4.9172 8.0516 3.9329 10.629-0.98425 2.5778-8.0422 2.7469-12.143 1.297-4.1011-1.4501-4.909-11.785-4.909-11.785s6.0911-0.17471 10.105-0.19737z"
266
+ style="color:#000000"
267
+ fill="#ff0"
268
+ />
269
+ <path
270
+ id="path3960"
271
+ d="m-916.99 1003.6s1.7857 4.4643 2.6786 4.6429c0.89286 0.1786-0.35713-5.7143-0.35713-5.7143"
272
+ style="color:#000000"
273
+ fill="#808000"
274
+ />
275
+ <path
276
+ id="path3981"
277
+ d="m-909.14 1018.1a1.894 1.894 0 1 1 -3.7881 0 1.894 1.894 0 1 1 3.7881 0z"
278
+ style="color:#000000"
279
+ fill="#800000"
280
+ />
281
+ <path
282
+ id="path3983"
283
+ d="m-906.61 1024.8a1.5152 2.0203 0 1 1 -3.0305 0 1.5152 2.0203 0 1 1 3.0305 0z"
284
+ style="color:#000000"
285
+ fill="#800000"
286
+ transform="translate(-.50508 1.0102)"
287
+ />
288
+ <path
289
+ id="path3985"
290
+ d="m-905.85 1032a1.6415 2.1466 0 1 1 -3.283 0 1.6415 2.1466 0 1 1 3.283 0z"
291
+ style="color:#000000"
292
+ fill="#800000"
293
+ />
294
+ <path
295
+ id="path3987"
296
+ d="m-910.65 1048.8c1.6415-0.3788 12.627-1.1364 12.627-1.1364l-1.0102-4.7982-13.132 2.1466z"
297
+ style="color:#000000"
298
+ fill="#800000"
299
+ />
300
+ <path
301
+ id="path3096"
302
+ d="m-381.43 629.51a60 64.286 0 1 1 -120 0 60 64.286 0 1 1 120 0z"
303
+ style="color:#000000"
304
+ fill="#c8beb7"
305
+ transform="matrix(1.9226 0 0 1.8861 333.34 -685.5)"
306
+ />
307
+ <path
308
+ id="path3098"
309
+ style="color:#000000"
310
+ d="m-381.43 629.51a60 64.286 0 1 1 -120 0 60 64.286 0 1 1 120 0z"
311
+ transform="matrix(.68093 0 0 .668 -253.91 46.79)"
312
+ stroke="#000"
313
+ stroke-width="16"
314
+ fill="#fff"
315
+ />
316
+ <path
317
+ id="path4007"
318
+ style="color:#000000"
319
+ d="m-1238.4 26.552a31.82 31.82 0 1 1 -63.64 0 31.82 31.82 0 1 1 63.64 0z"
320
+ transform="matrix(.973 0 0 .973 679.55 440.37)"
321
+ stroke="#f00"
322
+ stroke-width="1.2115"
323
+ />
324
+ <path
325
+ id="path3100"
326
+ style="color:#000000"
327
+ d="m-381.43 629.51a60 64.286 0 1 1 -120 0 60 64.286 0 1 1 120 0z"
328
+ transform="matrix(.68093 0 0 .668 -159.61 45.106)"
329
+ stroke="#000"
330
+ stroke-width="16"
331
+ fill="#fff"
332
+ />
333
+ <path
334
+ id="path4011"
335
+ style="color:#000000"
336
+ d="m-1238.4 26.552a31.82 31.82 0 1 1 -63.64 0 31.82 31.82 0 1 1 63.64 0z"
337
+ transform="matrix(.973 0 0 .973 780.77 439.18)"
338
+ stroke="#f00"
339
+ stroke-width="1.2115"
340
+ />
341
+ <path
342
+ id="path4009"
343
+ opacity=".68649"
344
+ style="color:#000000"
345
+ d="m-1238.4 26.552a31.82 31.82 0 1 1 -63.64 0 31.82 31.82 0 1 1 63.64 0z"
346
+ transform="matrix(.43037 0 0 .43037 -17.446 434.19)"
347
+ fill="#fff"
348
+ />
349
+ <path
350
+ id="path4025"
351
+ style="color:#000000"
352
+ d="m-920.34 1096.7s22.37 12.947 32.01-0.4384"
353
+ stroke="#000"
354
+ stroke-width="1.0977"
355
+ fill="none"
356
+ />
357
+ <g
358
+ id="g4057"
359
+ stroke="#000"
360
+ transform="matrix(.97719 .21239 -.21239 .97719 732.9 -65.798)"
361
+ >
362
+ <path
363
+ id="path4053"
364
+ style="color:#000000"
365
+ d="m-1085 873.08 6.4286 7.8571 1.4285-9.2857 28.572-3.5714-29.286 15-25-3.5714z"
366
+ />
367
+ <path
368
+ id="path4055"
369
+ style="color:#000000"
370
+ d="m-1102.9 882.36 32.857 10.714 19.286-23.571z"
371
+ />
372
+ </g
373
+ >
374
+ <path
375
+ id="path4061"
376
+ d="m-519.22 531.12 30.305-2.0203-18.183 16.162z"
377
+ style="color:#000000"
378
+ fill="#916f6f"
379
+ />
380
+ <path
381
+ id="path4063"
382
+ style="color:#000000"
383
+ d="m-531.96 294.84c-170.1-1.1368-121.62 351.44-121.62 351.44h72.812l3.9797-230.3 127.28-4.0516 12.214 234.36h34.25s4.036 4.0356 22.219-99 35.88-223.26-129.28-250.5c-7.6551-1.2627-14.929-1.8913-21.844-1.9375z"
384
+ />
385
+ <path
386
+ id="path4068"
387
+ style="color:#000000"
388
+ d="m-686.65 873.57s-13.637 1.5152-13.637 4.2932c0 2.7779 7.8287 4.7982 7.8287 4.7982z"
389
+ />
390
+ <path
391
+ id="path4076"
392
+ opacity=".68649"
393
+ style="color:#000000"
394
+ d="m-1238.4 26.552a31.82 31.82 0 1 1 -63.64 0 31.82 31.82 0 1 1 63.64 0z"
395
+ transform="matrix(.43037 0 0 .43037 74.478 433.18)"
396
+ fill="#fff"
397
+ />
398
+ <g
399
+ id="g3361"
400
+ transform="matrix(.99361 .11289 -.11289 .99361 68.217 55.943)"
401
+ >
402
+ <path
403
+ id="path4084"
404
+ style="color:#000000"
405
+ d="m-465.07 612.57 90.82 117.16-12.629 14.18-99.023-99.704"
406
+ />
407
+ <path
408
+ id="path4086"
409
+ style="color:#000000"
410
+ d="m-375.36 728.43 51.14 99.304-16.14 8.9106-47.857-95z"
411
+ />
412
+ <g
413
+ id="g4109"
414
+ transform="matrix(1.3651 0 0 1.3651 124.17 -304.98)"
415
+ >
416
+ <path
417
+ id="path4107"
418
+ style="color:#000000"
419
+ d="m-340 843.08-3.5714 23.929 9.6429 7.5s-1.7857-8.2143-3.2143-8.5714c-1.4286-0.35714 2.5-10.714 2.5-10.714l-4.2857-2.5"
420
+ />
421
+ <path
422
+ id="path4088"
423
+ style="color:#000000"
424
+ d="m-340.42 835.93-1.7179 21.786l27.14-14.29-13.4-14.28z"
425
+ />
426
+ <g
427
+ id="g4100"
428
+ transform="matrix(1.0767 0 0 1.0767 25.066 -65.033)"
429
+ >
430
+ <path
431
+ id="path4090"
432
+ style="color:#000000"
433
+ d="m-315.92 843.08 11.988 29.089-1.8929 0.55407-17.036-26.595z"
434
+ />
435
+ <path
436
+ id="path4092"
437
+ style="color:#000000"
438
+ d="m-332.86 852.01 13.571 37.5-2.1429 0.71428-19.286-34.286z"
439
+ />
440
+ <path
441
+ id="path4094"
442
+ style="color:#000000"
443
+ d="m-326.07 849.15 13.571 37.5-2.1429 0.71428-19.286-34.286z"
444
+ />
445
+ <path
446
+ id="path4096"
447
+ style="color:#000000"
448
+ d="m-320.71 846.29 13.571 37.5-2.1429 0.71428-19.286-34.286z"
449
+ />
450
+ <path
451
+ id="path4098"
452
+ style="color:#000000"
453
+ d="m-320.71 846.29 13.571 37.5-2.1429 0.71428-19.286-34.286z"
454
+ />
455
+ </g
456
+ >
457
+ </g
458
+ >
459
+ </g
460
+ >
461
+ </g
462
+ >
463
+ <metadata
464
+ >
465
+ <rdf:RDF
466
+ >
467
+ <cc:Work
468
+ >
469
+ <dc:format
470
+ >image/svg+xml</dc:format
471
+ >
472
+ <dc:type
473
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage"
474
+ />
475
+ <cc:license
476
+ rdf:resource="http://creativecommons.org/licenses/publicdomain/"
477
+ />
478
+ <dc:publisher
479
+ >
480
+ <cc:Agent
481
+ rdf:about="http://openclipart.org/"
482
+ >
483
+ <dc:title
484
+ >Openclipart</dc:title
485
+ >
486
+ </cc:Agent
487
+ >
488
+ </dc:publisher
489
+ >
490
+ <dc:title
491
+ >Pet Spider Girl</dc:title
492
+ >
493
+ <dc:date
494
+ >2013-10-14T17:01:19</dc:date
495
+ >
496
+ <dc:description
497
+ >Creepy girl with pet spider. </dc:description
498
+ >
499
+ <dc:source
500
+ >https://openclipart.org/detail/184904/pet-spider-girl-by-feraliminal-184904</dc:source
501
+ >
502
+ <dc:creator
503
+ >
504
+ <cc:Agent
505
+ >
506
+ <dc:title
507
+ >feraliminal</dc:title
508
+ >
509
+ </cc:Agent
510
+ >
511
+ </dc:creator
512
+ >
513
+ <dc:subject
514
+ >
515
+ <rdf:Bag
516
+ >
517
+ <rdf:li
518
+ >Halloween</rdf:li
519
+ >
520
+ <rdf:li
521
+ >girl</rdf:li
522
+ >
523
+ <rdf:li
524
+ >pet</rdf:li
525
+ >
526
+ <rdf:li
527
+ >spider</rdf:li
528
+ >
529
+ </rdf:Bag
530
+ >
531
+ </dc:subject
532
+ >
533
+ </cc:Work
534
+ >
535
+ <cc:License
536
+ rdf:about="http://creativecommons.org/licenses/publicdomain/"
537
+ >
538
+ <cc:permits
539
+ rdf:resource="http://creativecommons.org/ns#Reproduction"
540
+ />
541
+ <cc:permits
542
+ rdf:resource="http://creativecommons.org/ns#Distribution"
543
+ />
544
+ <cc:permits
545
+ rdf:resource="http://creativecommons.org/ns#DerivativeWorks"
546
+ />
547
+ </cc:License
548
+ >
549
+ </rdf:RDF
550
+ >
551
+ </metadata
552
+ >
553
+ </svg
554
+ >
@@ -1,35 +0,0 @@
1
- name: Publish Package to npmjs
2
- on: push
3
- permissions:
4
- id-token: write # Required for OIDC
5
- contents: read
6
- jobs:
7
- build:
8
- if: github.repository_owner == 'myridia'
9
- runs-on: ubuntu-latest
10
- permissions:
11
- contents: read
12
- id-token: write
13
- steps:
14
- - name: Request OIDC token
15
- id: oidc-token
16
- uses: actions/github-script@v7
17
- with:
18
- script: |
19
- const token = await core.getIDToken();
20
- core.info(`OIDC token: ${token.substring(0,20)}...`);
21
-
22
- - name: checkout
23
- uses: actions/checkout@v4
24
- - name: setup
25
- uses: actions/setup-node@v4
26
- with:
27
- node-version: '24.x' # Your node version
28
- registry-url: 'https://registry.npmjs.org'
29
- always-auth: true
30
-
31
- - run: npm install --package-lock-only
32
- - run: npm ci
33
- - run: npm run build --if-present
34
- - run: npm publish --provenance --access public
35
-