shikeying
2023-03-17 8c1a723d62a6aa5d6266ca613ae4eb77c789db06
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict';
 
var escapeHTML = require('../Utils').escapeHTML;
 
var entryFieldDescription = require('./EntryFieldDescription');
 
 
var textBox = function(options, defaultParameters) {
 
  var resource = defaultParameters,
      label = options.label || resource.id,
      canBeShown = !!options.show && typeof options.show === 'function',
      description = options.description;
 
  resource.html =
    '<label for="activiti-' + escapeHTML(resource.id) + '" ' +
    (canBeShown ? 'data-show="isShown"' : '') +
    '>' + label + '</label>' +
    '<div class="bpp-field-wrapper" ' +
    (canBeShown ? 'data-show="isShown"' : '') +
    '>' +
      '<div contenteditable="true" id="activiti-' + escapeHTML(resource.id) + '" ' +
            'name="' + escapeHTML(options.modelProperty) + '" />' +
    '</div>';
 
  // add description below text box entry field
  if (description) {
    resource.html += entryFieldDescription(description);
  }
 
  if (canBeShown) {
    resource.isShown = function() {
      return options.show.apply(resource, arguments);
    };
  }
 
  resource.cssClasses = ['bpp-textbox'];
 
  return resource;
};
 
module.exports = textBox;