@websy/websy-designs 1.11.3 → 1.11.5

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.
@@ -16,12 +16,13 @@ class MySqlHelper {
16
16
  this.onReadyAuthCallbackFn = null
17
17
  this.onReadyShopCallbackFn = null
18
18
  }
19
- init () {
19
+ init (onError) {
20
20
  return new Promise((resolve, reject) => {
21
21
  const ConnectionConfig = require('mysql/lib/ConnectionConfig')
22
22
  const config = new ConnectionConfig(process.env.DATABASE_URL)
23
23
  config.connectionLimit = process.env.DB_CONNECTION_LIMIT || 5
24
- this.pool = mysql.createPool(config)
24
+ this.pool = mysql.createPool(config)
25
+ this.onError = onError
25
26
  // this.pool.getConnection((err, connection) => {
26
27
  // if (err) {
27
28
  // reject(err)
@@ -38,7 +39,7 @@ class MySqlHelper {
38
39
  // resolve()
39
40
  // }
40
41
  // })
41
- // this.pool.on('connection', function (connection) {
42
+ // this.pool.on('connection', function (connection) {
42
43
  this.pool.on('acquire', function (connection) {
43
44
  // console.log('Connection %d acquired', connection.threadId)
44
45
  })
@@ -149,7 +150,10 @@ class MySqlHelper {
149
150
  // else {
150
151
  this.pool.query(query, (error, results, fields) => {
151
152
  if (error) {
152
- // return this.client.rollback(() => {
153
+ // return this.client.rollback(() => {
154
+ if (this.onError && typeof this.onError === 'function') {
155
+ this.onError(error)
156
+ }
153
157
  reject(error)
154
158
  // })
155
159
  }
@@ -191,7 +191,7 @@ ${
191
191
  </style>
192
192
  </head>
193
193
  <body>
194
- <div id='app' class='pdf-print'>
194
+ <div id="app" class="pdf-print">
195
195
  ${header}
196
196
  ${data.html}
197
197
  ${footer}
@@ -201,7 +201,7 @@ ${
201
201
  `
202
202
  lastHTML = html
203
203
  convertHTMLToPDF(html, data.name || utils.createIdentity(), (err, pdf) => {
204
- console.log('info', `HTML converted to PDF`)
204
+ console.log('info', `HTML converted to PDF`)
205
205
  // setTimeout(() => {
206
206
  // try {
207
207
  // // fs.unlinkSync(`${process.env.APP_ROOT}/pdf/${pdfId}.pdf`)
@@ -67,7 +67,7 @@ module.exports = function (options) {
67
67
  app.use('/pdf', require(`./routes/${version}/pdf`))
68
68
  if (options.useDB === true) {
69
69
  const dbHelper = require(`./helpers/${version}/${options.dbEngine}Helper`)
70
- dbHelper.init(options.dbOptions || {}).then(() => {
70
+ dbHelper.init(options.dbOnError || {}).then(() => {
71
71
  app.set('trust proxy', 1)
72
72
  app.use(cookieParser(process.env.SESSION_SECRET))
73
73
  let cookieConfig = {
@@ -2514,8 +2514,9 @@ class WebsyForm {
2514
2514
  data-user-type="${f.type}"
2515
2515
  data-index="${i}"
2516
2516
  name="${f.field}"
2517
+ ${f.disabled || f.readOnly || this.options.readOnly ? 'disabled' : ''}
2517
2518
  ${(f.attributes || []).join(' ')}
2518
- class="websy-input websy-textarea"
2519
+ class="websy-input websy-textarea ${f.readOnly || this.options.readOnly ? 'websy-input-readonly' : ''}"
2519
2520
  >${f.value || ''}</textarea>
2520
2521
  <span id='${this.elementId}_${f.field}_error' class='websy-form-validation-error'></span>
2521
2522
  </div><!--
@@ -2527,7 +2527,7 @@ var WebsyForm = /*#__PURE__*/function () {
2527
2527
  componentsToProcess.push(f);
2528
2528
  html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', " ").concat(f.component === 'MediaUpload' ? 'media-upload' : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <div id='").concat(_this18.elementId, "_input_").concat(f.field, "_component' class='form-component'></div>\n <span id='").concat(_this18.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2529
2529
  } else if (f.type === 'longtext') {
2530
- html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <textarea\n id=\"").concat(_this18.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n name=\"").concat(f.field, "\" \n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea\"\n >").concat(f.value || '', "</textarea>\n <span id='").concat(_this18.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2530
+ html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <textarea\n id=\"").concat(_this18.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n placeholder=\"").concat(f.placeholder || '', "\"\n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n name=\"").concat(f.field, "\" \n ").concat(f.disabled || f.readOnly || _this18.options.readOnly ? 'disabled' : '', "\n ").concat((f.attributes || []).join(' '), "\n class=\"websy-input websy-textarea ").concat(f.readOnly || _this18.options.readOnly ? 'websy-input-readonly' : '', "\"\n >").concat(f.value || '', "</textarea>\n <span id='").concat(_this18.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2531
2531
  } else {
2532
2532
  html += "\n ".concat(i > 0 ? '-->' : '', "<div id='").concat(_this18.elementId, "_").concat(f.field, "_inputContainer' style='").concat(f.style || '', "' class='websy-input-container ").concat(f.classes ? f.classes.join(' ') : '', "'>\n ").concat(f.label ? "<label for=\"".concat(f.field, "\">").concat(f.label, "</label>") : '').concat(f.required === true ? '<span class="websy-form-required-value">*</span>' : '', "\n <input \n id=\"").concat(_this18.elementId, "_input_").concat(f.field, "\"\n ").concat(f.required === true ? 'required' : '', " \n type=\"").concat((f.type === 'expiry' ? 'text' : f.type === 'cvv' ? 'number' : f.type) || 'text', "\" \n data-user-type=\"").concat(f.type, "\"\n data-index=\"").concat(i, "\"\n class=\"websy-input\" \n ").concat((f.attributes || []).join(' '), "\n name=\"").concat(f.field, "\" \n placeholder=\"").concat(f.placeholder || '', "\"\n value=\"").concat(f.type === 'date' ? '' : f.value || '', "\"\n valueAsDate=\"").concat(f.type === 'date' ? f.value : '', "\"\n oninvalidx=\"this.setCustomValidity('").concat(f.invalidMessage || 'Please fill in this field.', "')\"\n />\n <span id='").concat(_this18.elementId, "_").concat(f.field, "_error' class='websy-form-validation-error'></span>\n </div><!--\n ");
2533
2533
  }