From 9f64166e607043887030095f9ce7b60977400459 Mon Sep 17 00:00:00 2001 From: kurokida Date: Mon, 12 Sep 2022 18:40:07 +0900 Subject: [PATCH] jsPsych 7.3.0 --- .../objectProperties-LAPTOP-BR7JPMUG.md | 218 + docs/_pages/pluginParams-LAPTOP-BR7JPMUG.md | 87 + jspsych-dist/VERSION.md | 110 +- jspsych-dist/dist/extension-mouse-tracking.js | 2 +- jspsych-dist/dist/extension-record-video.js | 141 + jspsych-dist/dist/jspsych.js | 344 +- jspsych-dist/dist/plugin-browser-check.js | 6 +- .../dist/plugin-canvas-slider-response.js | 2 +- .../dist/plugin-html-audio-response.js | 6 + .../dist/plugin-html-video-response.js | 207 + jspsych-dist/dist/plugin-initialize-camera.js | 157 + .../dist/plugin-initialize-microphone.js | 2 +- jspsych-dist/dist/plugin-mirror-camera.js | 71 + jspsych-dist/dist/plugin-survey.js | 122915 ++++++++------- .../examples/extension-record-video.html | 52 + .../examples/jspsych-html-video-response.html | 33 + .../examples/jspsych-initialize-camera.html | 20 + .../examples/jspsych-mirror-camera.html | 26 + jspsych-dist/license.txt | 2 +- ...al_drawFunc_gradation-LAPTOP-BR7JPMUG.html | 60 + 20 files changed, 62963 insertions(+), 61498 deletions(-) create mode 100644 docs/_pages/objectProperties-LAPTOP-BR7JPMUG.md create mode 100644 docs/_pages/pluginParams-LAPTOP-BR7JPMUG.md create mode 100644 jspsych-dist/dist/extension-record-video.js create mode 100644 jspsych-dist/dist/plugin-html-video-response.js create mode 100644 jspsych-dist/dist/plugin-initialize-camera.js create mode 100644 jspsych-dist/dist/plugin-mirror-camera.js create mode 100644 jspsych-dist/examples/extension-record-video.html create mode 100644 jspsych-dist/examples/jspsych-html-video-response.html create mode 100644 jspsych-dist/examples/jspsych-initialize-camera.html create mode 100644 jspsych-dist/examples/jspsych-mirror-camera.html create mode 100644 psychophysics-demos/manual_drawFunc_gradation-LAPTOP-BR7JPMUG.html diff --git a/docs/_pages/objectProperties-LAPTOP-BR7JPMUG.md b/docs/_pages/objectProperties-LAPTOP-BR7JPMUG.md new file mode 100644 index 0000000..41bc527 --- /dev/null +++ b/docs/_pages/objectProperties-LAPTOP-BR7JPMUG.md @@ -0,0 +1,218 @@ +--- +permalink: /objectProperties/ +title: "Stimulus parameters" +--- + +All stimuli used in a program with the jspsych-psychophysics plugin must be specified as JavaScript objects as follows: +```javascript +var rect_object = { + obj_type: 'rect', // means a rectangle + startX: 200, // location in the canvas + startY: 150, + width: 300, // of the rectangle + height: 200, + line_color: '#ffffff', + fill_color: '#ffffff', + show_start_time: 500 // from the trial start (ms) +} +``` + +This code means that a white rectangle is presented at coordinates (200, 150) in a canvas which is a HTML element providing a lots of drawing tools. The origin of the coordinate is the top left of the canvas, and the unit is the pixel. If you want to change the origin to the center of the window, set the `origin_center` property to true. The width and height of the rectangle are 300 and 200 pixels respectively. The line and filled colors can be specified individually using the HTML color names, hexadecimal (HEX) colors, and RGB values that are often used in a general HTML file. Most importantly, the white rectangle is presented 500 ms after beginning this trial. + +# Preloading media files + +The image and sound files must be preloaded manually. [The method has changed since jspsych 6.3.0](https://www.jspsych.org/overview/media-preloading/). + +```javascript +const images = ['img/file1.png', 'img/file2.png']; +const audio = ['audio/file1.mp3', 'audio/file2.mp3']; + +const preload = { + type: 'preload', + images: images, + audio: audio +} + +jsPsych.init({ + timeline: [preload, trial], +}); +``` + +# Common parameters among stimuli + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|obj_type|string|undefined|The type of the object (e.g., rect, image, or sound). Refer to the individual explanation below in detail.| +|startX/startY|numeric|'center'|Horizontal/Vertical position of the object's center. The origin of the coordinate is the top left of the canvas, but the origin can be changed to the center of the window using the `origin_center` property. The unit is the pixel. If the startX/startY is specified as `'center'`, the object is presented at the horizontal/vertical center of the canvas. The startX/startY is also used as the starting position in motion.| +|endX/endY|numeric|null|Horizontal/Vertical end position of the moving object.| +|origin_center|boolean|false|If you want to change the coordinate origin to the center of the window, set this property to true.| +|horiz_pix_frame|numeric|undefined|Horizontal pixels by which the object moves per frame of the display.| +|horiz_pix_sec|numeric|undefined|Horizontal pixels by which the object moves per second.| +|vert_pix_frame|numeric|undefined|Vertical pixels by which the object moves per frame of the display.| +|vert_pix_sec|numeric|undefined|Vertical pixels by which the object moves per second.| +|show_start_time|numeric|0|Time in millisconds to start presenting the object from when the trial begins.| +|show_end_time|numeric|null|Time in millisconds to end presenting the object from when the trial begins.| +|motion_start_time|numeric|show_start_time|Time in millisconds to start moving the object from when the trial begins.| +|motion_end_time|numeric|null|Time in millisconds to end moving the object from when the trial begins.| +|show_start_frame|numeric|0|Time in frames to start presenting the object from when the trial begins.| +|show_end_frame|numeric|null|Time in frames to end presenting the object from when the trial begins. If the `show_start_frame` is 0 and the `show_end_frame` is 10, the duration is 10 frames.| +|motion_start_frame|numeric|show_start_frame|Time in frames to start moving the object from when the trial begins.| +|motion_end_frame|numeric|null|Time in frames to end moving the object from when the trial begins.| +|is_frame|boolean|false|If you specify the show/motion time in frames, the `is_frame` property must be true.| +|line_width|numeric|1| The width of the line.| +|lineJoin|string|'miter'|[The type of the corner when two lines meet](https://www.w3schools.com/tags/canvas_linejoin.asp)| +|miterLimit|numeric|10|[The maximum miter length](https://www.w3schools.com/tags/canvas_miterlimit.asp)| +|change_attr|function|null|You can change [some the attributes of the object](/change_attr/) dynamically. The first argument is the stimulus, the second is the elapsed times in milliseconds, and the third is the elapsed times in frames. See [the demos/change_attributes.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/change_attributes.html). The difference between drawFunc and change_attr is that the drawFunc must specify the code for drawing and setting coordinates of the stimulus.| + +NOTE: The *horiz(vert)_pix_frame(sec)* can be automatically calculated using the *startX(Y)*, *endX(Y)*, *motion_start_time*, and*motion_end_time*. + +# obj_type: 'image' + +See also [Masking and filtering images using the jspsych-psychophysics plugin](/mask_filter/)" + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|file|string|undefined|The file name of the image.| +|scale|numeric|1 (original size)|Image scaling. Note that scaling will not work simultaneously with masking and filtering.| +|image_width|numeric|undefined| The width of the image. You can't specify this property with the scale or image_height property. Note that scaling will not work simultaneously with masking and filtering.| +|image_height|numeric|undefined| The height of the image. You can't specify this property with the scale or image_width property. Note that scaling will not work simultaneously with masking and filtering.| +|filter|string|undefined|Read [this page](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/filter) carefully.| +|mask|string|undefined|'gauss', 'circle', 'rect', or 'manual' See [the demos/mask_filter.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/mask_filter.html).| +|width (gauss)|numeric|undefined| The size (width x width) of the area where the gaussian mask is applied.| +|sc|numeric|20| The standard deviation of the gaussian distribution. | +|width (circle/rect)|numeric|undefined| The width of the masking circle/rect.| +|height (circle/rect)|numeric|undefined| The height of the masking circle/rect.| +|center_x/y|numeric|undefined| The x/y-coordinate of the center of the masking circle/rect.| +|mask_func(canvas)|function|null|You can mask the image manually. Don't forget to specify the mask property as 'manual'. This function must retrun an ImageData object containing the array of pixel values. An argument of the function is the canvas on which the image is drawn. See [the demos/mask_filter.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/mask_filter.html).| + +# obj_type: 'sound' + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|file|string|undefined|The file name of the sound.| +|trial_ends_after_audio|boolean|false|If true, then the trial will end as soon as the audio file finishes playing.| + +# obj_type: 'line' + +For this line object, the startX/Y property means the center position of the line. +There are two ways to define a line. See, `demos/lines.html`. + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|x1, y1|numeric|undefined| The start position of static line drawing. This property can't be used for the moving line. And it can't be used both with the line_length and angle property.| +|x2, y2|numeric|undefined| The end position of static line drawing. This property can't be used for the moving line. And it can't be used both with the line_length and angle property.| +|line_length|numeric|undefined| The length of the line.| +|line_color|string|#000000 (black)|The color of the line.| +|angle|numeric|undefined| The angle of the line. Zero means a horizontal line.| + +# obj_type: 'rect' + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|width|numeric|undefined| The width of the rectangle.| +|height|numeric|undefined| The height of the rectangle.| +|line_color|string|undefined|The color of the contour.| +|fill_color|string|undefined|The filled color of the rectangle.| + +# obj_type: 'circle' + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|radius|numeric|undefined|The radius of the circle.| +|line_color|string|undefined|The color of the contour.| +|fill_color|string|undefined|The filled color of the circle.| + +# obj_type: 'text' + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|content|string|undefined|The content of the text. It can include `\n` to start a new line.| +|font|string|undefined| You can change the size and font. [This is the same as the font property of `` element.](https://www.w3schools.com/tags/canvas_font.asp)| +|text_color|string|#000000 (black)|The color of the text.| +|text_space|numeric|20|The space between lines. Note that this will not work in Pixi mode.| + +# obj_type: 'cross' + +This object would be used as the fixation point. + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|line_length|numeric|undefined| The length of the line.| +|line_color|string|#000000 (black)|The color of the line.| + +# obj_type: 'gabor' + +See also [Presenting gabor patches in online/web experiments](/gabor/). + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|width|numeric|undefined| The size (width x width) of the area where the gabor patch is drawn. | +|tilt|numeric|0| The tilt of the gabor patch. The unit is the degree relative to the horizontal axis.| +|sf|numeric|0.05| The spatial frequency of the gabor patch. The unit is the cycles per pixel.| +|phase|numeric|0| The phase of the sine wave. The unit is the degree.| +|sc|numeric|20| The standard deviation of the gaussian distribution. | +|contrast|numeric|20| The contrast of the gabor patch. | +|drift|numeric|0| The velocity of the drifting gabor patch. The angular velocity per frame. The unit is the degree.| +|method|text|numeric| The method of drawing the gabor patch. 'numeric' or 'math' [The numeric.js](https://github.com/sloisel/numeric) is considerably faster than [the math.js](https://mathjs.org/).| +|disableNorm|boolean|false| Disable normalization of the gaussian function. That is, coefficient: 1/(sqrt(2*pi) * sc) will not be multiplied. If this property is specified as true, the contrast value should be relatively small.| +|contrastPreMultiplicator|numeric|1| This value is multiplied as a scaling factor to the requested contrast value. For the meaning of this variable, see [CreateProceduralGabor](http://psychtoolbox.org/docs/CreateProceduralGabor).| +|modulate_color|array|[1.0, 1.0, 1.0, 1.0]|This is available in [pixi mode](pixijs.md). For the meaning of this variable, see modulateColor in [CreateProceduralGabor](http://psychtoolbox.org/docs/CreateProceduralGabor). Note that the transparency is different from that of Psychtoolbox. Do not specify any number other than 1.| +|offset_color|array|[0.5, 0.5, 0.5, 0.0]|This is available in [pixi mode](pixijs.md). For the meaning of this variable, see backgroundColorOffset in [CreateProceduralGabor](http://psychtoolbox.org/docs/CreateProceduralGabor). Note that the transparency is different from that of Psychtoolbox. Do not specify any number other than 0.| +|min_validModulationRange|numeric|-2|This is available in [pixi mode](pixijs.md). For the meaning of this variable, see validModulationRange in [CreateProceduralGabor](http://psychtoolbox.org/docs/CreateProceduralGabor).| +|max_validModulationRange|numeric|2|This is available in [pixi mode](pixijs.md). For the meaning of this variable, see validModulationRange in [CreateProceduralGabor](http://psychtoolbox.org/docs/CreateProceduralGabor).| + +## Uniforms + +The following values are only available in [pixi mode](pixijs.md). If the first data in the stimuli array is a gabor stimulus, it is possible to use uniforms as follows: `jsPsych.getCurrentTrial().stim_array[0].pixi_obj.filters[0].uniforms;` If the second data is a gabor stimulus, change to `stim_array[1]`, and `filters[0]` need not be changed. + +|Property of the Uniforms|Description| +|Contrast|This is the same as contrast above.| +|Phase|This is the same as phase above.| +|angle_in_degrees| This is equal to 90 + tilt| +|spatial_freq|This is the same as sf above.| +|SpaceConstant|This is the same as sc above.| +|disableNorm|Specify 1 for true or 0 for false.| +|disableGauss|Specify 1 for true or 0 for false.| +|modulateColor_R|Red in modulate color.| +|modulateColor_G|Green in modulate color.| +|modulateColor_B|Blue in modulate color.| +|modulateColor_Alpha|Do not specify any number other than 1.| +|offset_R|Red in offset color.| +|offset_G|Green in offset color.| +|offset_B|Blue in offset color.| +|offset_Alpha||Do not specify any number other than 0.| +|contrastPreMultiplicator|This is the same as contrastPreMultiplicator above.| +|min_validModulationRange|This is the same as min_validModulationRange above.| +|max_validModulationRange|This is the same as max_validModulationRange above.| + +# obj_type: 'manual' + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|drawFunc|function|null|You can draw whatever the `` supports.| + +If you want to draw something that the jspsych-psychophysics does not provide the method, you can draw it using the drawFunc function. + +The first argument is `stimulus` by which you can access the properties of the object. For example, `stimulus.currentX/Y` can be used to refer the current position of the object, updated synchronized with the refresh of the display. You can also define and access new properties using this argument. + +The following code is the sample of the `drawFunc`. This sample draws a rectangle including a gradation from white to black. See, `demos/manual-drawFunc.html`. + +```javascript +drawFunc: function(stimulus){ + context = jsPsych.currentTrial().context; + context.beginPath(); + + const gradLength = 200; + const grad = context.createLinearGradient(0, 0, 0, gradLength); + + grad.addColorStop(0,'rgb(0, 0, 0)'); // black + grad.addColorStop(1,'rgb(255, 255, 255)'); // white + + context.fillStyle = grad; + context.rect(stimulus.currentX, stimulus.currentY, gradLength, gradLength); + context.fill(); + context.closePath(); +} +``` + +You can also use the `drawFunc` with other than 'manual', for example, with 'image'. See, `demos/draw_part_of_image.html`. diff --git a/docs/_pages/pluginParams-LAPTOP-BR7JPMUG.md b/docs/_pages/pluginParams-LAPTOP-BR7JPMUG.md new file mode 100644 index 0000000..18630ff --- /dev/null +++ b/docs/_pages/pluginParams-LAPTOP-BR7JPMUG.md @@ -0,0 +1,87 @@ +--- +permalink: /pluginParams/ +title: "Plugin parameters" +--- + +Only the 'stimuli' parameter is required; Other parameters can be left unspecified if the default value is acceptable. Note that the prameter of *choices*, *prompt*, *trial_duration*, and *response_ends_trial* is the same as that of the plugins included in the jsPsych. + +# Main parameters + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|stimuli|array|undefined|An array of objects, each object represents a stimulus to be presented in the trial. The properties (parameters) of each object are depend on the type of the object. See [Stimulus parameters](objectProperties.md).| +|response_type|string|'key'|How participants will respond. You can specify 'key', 'mouse', or 'button'.| +|response_start_time|numeric|0|The defalut value (0) means that the participant can respond to the stimuli from the start of the trial, and the reaction time is the time from the start of the trial until the participant's response. If the response_start_time is set to 1000, the participant can respond to the stimuli 1000 ms after from the start of the trial, and the reaction time is the time from 1000 ms after the start of the trial until the participant's response.| +|response_ends_trial|boolean|true|If true, then the trial will end whenever the participant makes a response (assuming they make their response before the cutoff specified by the trial_duration parameter). If false, then the trial will continue until the value for trial_duration is reached. You can use this parameter to force the participant to view a stimulus for a fixed amount of time, even if they respond before the time is complete.| +|prompt|string|null|This string can contain HTML markup. Any content here will be displayed below the stimulus. The intention is that it can be used to provide a reminder about the action the participant is supposed to take (e.g., which key(s) to press).| +|trial_duration|numeric|null|How long to wait for the participant to make a response before ending the trial in milliseconds. If the participant fails to make a response before this timer is reached, the participant's response will be recorded as null for the trial and the trial will end. If the value of this parameter is null, the trial will wait for a response indefinitely.| +|~~stepFunc~~|function|null|**This can't be used since v2.0. Please use the raf_func instead.**| +|raf_func|function|null|This function takes three arguments which are, in order, `trial`, `elapsed time in terms of milliseconds`. and `elapsed time in terms of frames`. This function is called by the *requestAnimationFrame* method, and excuted synchronized with the refresh of the display. Wnen you use the *raf_func* called by the requestAnimationFrame method, you have to specify the stimuli as an empty array. If you would like to draw stimuli using the canvas-drawing methods manually, the *raf_func* would be benefit. See, the [raf_func.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/raf_func.html) and [draw two images repeatedly.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/draw_two_images_repeatedly.html).| + +# Parameters related to canvas + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|background_color|string|'grey'|The background color of the canvas.The color can be specified using the HTML color names (e.g., `'black'`), hexadecimal (HEX) colors (e.g., `'#ff0000'`), and RGB values (e.g., `'rgb(0, 255, 0)'`) that are often used in a general HTML file. | +|canvas_width|numeric|window.innerWidth|The width of the canvas in which stimuli are drawn. If it is not specified, the width of the canvas is identical to that of the window.| +|canvas_height|numeric|window.innerHeight|The height of the canvas in which stimuli are drawn. If it is not specified, the height of the canvas is identical to that of the window, but see the canvas_offsetY property.| +|canvas_offsetX|numeric|0|This value is subtracted from the width of the canvas in full-screen mode. However, since the default value is 0, it basically has no effect on the window size.| +|canvas_offsetY|numeric|8|This value is subtracted from the height of the canvas in full-screen mode to prevent the vertical scroll bar from being displayed.| +|clear_canvas|boolean|true|If true, the canvas is cleared every frame. There are not many cases where this should be false, but if you want to draw the trajectory of the mouse, for example, you need to set it false. Note that in that case, the show_end_time property can not be used. See the [mouse drawing.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/mouse_drawing.html)| + +# Parameters related to a key response + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|choices|array of keycodes|"ALL_KEYS"|This array contains the keys that the participant is allowed to press in order to respond to the stimulus. Keys can be specified as their [numeric key code](https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes) or as characters (e.g., 'a', 'q'). The default value of "ALL_KEYS" means that all keys will be accepted as valid responses. Specifying "NO_KEYS" will mean that no responses are allowed.| + +# Parameters related to a button response + +The following parameters are enabled when the `response_type` is 'button'. + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|button_choices|array of strings|['Next']|Labels for the buttons. Each different string in the array will generate a different button.| +|button_html|HTML string|``| A template of HTML for generating the button elements. You can override this to create customized buttons of various kinds. The string %choice% will be changed to the corresponding element of the choices array. You may also specify an array of strings, if you need different HTML to render for each button. If you do specify an array, the choices array and this array must have the same length. The HTML from position 0 in the button_html array will be used to create the button for element 0 in the choices array, and so on.| +|vert_button_margin|string|'0px'|Vertical margin of the button(s).| +|horiz_button_margin|string|'8px'|Horizontal margin of the button(s).| + +# Parameters related to event handlers + +|Parameter|Type|Default Value|Description| +|---|---|---|---| +|mouse_down_func|function|null|This is the event handler of the mousedown on the canvas. See the [mouse_drawing.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/mouse_drawing.html) and [mouse_event.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/mouse_event.html).| +|mouse_up_func|function|null|This is the event handler of the mouseup on the canvas.| +|mouse_move_func|function|null|This is the event handler of the mousemove on the canvas.| +|key_down_func|function|null|This is the event handler of the keydown on the document. See the [keyboard_event.html](https://www.hes.kyushu-u.ac.jp/~kurokid/jspsychophysics/demos/keyboard_event.html).| +|key_up_func|function|null|This is the event handler of the keyup on the canvas.| + +# Data Generated + +In addition to the [default data collected by all plugins](https://www.jspsych.org/plugins/overview/#data-collected-by-plugins), this plugin collects the following data for each trial. + +|Name|Type|Value| +|---|---|---| +|rt|numeric|The response time in milliseconds for the participant to make a response. The start time of the measurement depends on the 'response_start_time'.| +|response_type|string|'key', 'mouse', or 'button'| +|key_press|string|Indicates which key the participant pressed. '-1' means thant the participant respond using a mouse.| +|response|string|Indicates which key the participant pressed. This is the same as the key_press.| +|avg_frame_time|numeric|Averaged interframe interval.| +|click_x/click_y|numeric|Horizontal/Vertical clicked position. The origin of the coordinate is the top left of the canvas, and the unit is the pixel.| +|center_x/center_y|numeric|Horizontal/Vertical position of the center of the window. The origin of the coordinate is the top left of the canvas, and the unit is the pixel.| +|button_pressed|numeric|Indicates which button the subject pressed. The first button in the choices array is 0, the second is 1, and so on.| + +# Read only parameters + +|Parameter|Description| +|---|---| +|canvas|You can access the element of the canvas via the `jsPsych.getCurrentTrial().canvas`.| +|context|You can access the context of the canvas via the `jsPsych.getCurrentTrial().context`.| +|centerX|You can access the horizontal center of the canvas via the `jsPsych.getCurrentTrial().centerX`.| +|centerY|You can access the vertical center of the canvas via the `jsPsych.getCurrentTrial().centerY`.| + +# Stimuli +|Parameter|Description| +|---|---| +|stimuli|You can access the stimuli via the `jsPsych.getCurrentTrial().stimuli`. This is useful if you want to change the stimulus in the on_start function.| +|stim_array|You can access the stimuli via the `jsPsych.getCurrentTrial().stim_array`. This is useful if you want to change the stimulus in the event handlers or the raf_func.| \ No newline at end of file diff --git a/jspsych-dist/VERSION.md b/jspsych-dist/VERSION.md index c8dffeb..5809ce4 100644 --- a/jspsych-dist/VERSION.md +++ b/jspsych-dist/VERSION.md @@ -2,56 +2,60 @@ Included in this release: Package|Version|Documentation --- | --- | --- -jspsych|7.2.1|https://www.jspsych.org/7.2/ -extension-mouse-tracking|1.0.0|https://www.jspsych.org/7.2/extensions/mouse-tracking -extension-webgazer|1.0.0|https://www.jspsych.org/7.2/extensions/webgazer -plugin-animation|1.1.0|https://www.jspsych.org/7.2/plugins/animation -plugin-audio-button-response|1.1.0|https://www.jspsych.org/7.2/plugins/audio-button-response -plugin-audio-keyboard-response|1.1.0|https://www.jspsych.org/7.2/plugins/audio-keyboard-response -plugin-audio-slider-response|1.1.0|https://www.jspsych.org/7.2/plugins/audio-slider-response -plugin-browser-check|1.0.0|https://www.jspsych.org/7.2/plugins/browser-check -plugin-call-function|1.1.0|https://www.jspsych.org/7.2/plugins/call-function -plugin-canvas-button-response|1.1.0|https://www.jspsych.org/7.2/plugins/canvas-button-response -plugin-canvas-keyboard-response|1.1.0|https://www.jspsych.org/7.2/plugins/canvas-keyboard-response -plugin-canvas-slider-response|1.1.0|https://www.jspsych.org/7.2/plugins/canvas-slider-response -plugin-categorize-animation|1.1.0|https://www.jspsych.org/7.2/plugins/categorize-animation -plugin-categorize-html|1.1.0|https://www.jspsych.org/7.2/plugins/categorize-html -plugin-categorize-image|1.1.0|https://www.jspsych.org/7.2/plugins/categorize-image -plugin-cloze|1.1.0|https://www.jspsych.org/7.2/plugins/cloze -plugin-external-html|1.1.0|https://www.jspsych.org/7.2/plugins/external-html -plugin-free-sort|1.0.0|https://www.jspsych.org/7.2/plugins/free-sort -plugin-fullscreen|1.1.0|https://www.jspsych.org/7.2/plugins/fullscreen -plugin-html-audio-response|1.0.0|https://www.jspsych.org/7.2/plugins/html-audio-response -plugin-html-button-response|1.1.0|https://www.jspsych.org/7.2/plugins/html-button-response -plugin-html-keyboard-response|1.1.0|https://www.jspsych.org/7.2/plugins/html-keyboard-response -plugin-html-slider-response|1.1.0|https://www.jspsych.org/7.2/plugins/html-slider-response -plugin-iat-html|1.1.0|https://www.jspsych.org/7.2/plugins/iat-html -plugin-iat-image|1.1.0|https://www.jspsych.org/7.2/plugins/iat-image -plugin-image-button-response|1.1.0|https://www.jspsych.org/7.2/plugins/image-button-response -plugin-image-keyboard-response|1.1.0|https://www.jspsych.org/7.2/plugins/image-keyboard-response -plugin-image-slider-response|1.1.0|https://www.jspsych.org/7.2/plugins/image-slider-response -plugin-initialize-microphone|1.0.0|https://www.jspsych.org/7.2/plugins/initialize-microphone -plugin-instructions|1.1.0|https://www.jspsych.org/7.2/plugins/instructions -plugin-maxdiff|1.1.0|https://www.jspsych.org/7.2/plugins/maxdiff -plugin-preload|1.1.0|https://www.jspsych.org/7.2/plugins/preload -plugin-reconstruction|1.1.0|https://www.jspsych.org/7.2/plugins/reconstruction -plugin-resize|1.0.0|https://www.jspsych.org/7.2/plugins/resize -plugin-same-different-html|1.1.0|https://www.jspsych.org/7.2/plugins/same-different-html -plugin-same-different-image|1.1.0|https://www.jspsych.org/7.2/plugins/same-different-image -plugin-serial-reaction-time-mouse|1.1.0|https://www.jspsych.org/7.2/plugins/serial-reaction-time-mouse -plugin-serial-reaction-time|1.1.0|https://www.jspsych.org/7.2/plugins/serial-reaction-time -plugin-sketchpad|1.0.1|https://www.jspsych.org/7.2/plugins/sketchpad -plugin-survey-html-form|1.0.0|https://www.jspsych.org/7.2/plugins/survey-html-form -plugin-survey-likert|1.1.0|https://www.jspsych.org/7.2/plugins/survey-likert -plugin-survey-multi-choice|1.1.0|https://www.jspsych.org/7.2/plugins/survey-multi-choice -plugin-survey-multi-select|1.1.0|https://www.jspsych.org/7.2/plugins/survey-multi-select -plugin-survey-text|1.1.0|https://www.jspsych.org/7.2/plugins/survey-text -plugin-survey|0.1.1|https://www.jspsych.org/7.2/plugins/survey -plugin-video-button-response|1.1.0|https://www.jspsych.org/7.2/plugins/video-button-response -plugin-video-keyboard-response|1.1.0|https://www.jspsych.org/7.2/plugins/video-keyboard-response -plugin-video-slider-response|1.1.0|https://www.jspsych.org/7.2/plugins/video-slider-response -plugin-virtual-chinrest|2.0.0|https://www.jspsych.org/7.2/plugins/virtual-chinrest -plugin-visual-search-circle|1.1.0|https://www.jspsych.org/7.2/plugins/visual-search-circle -plugin-webgazer-calibrate|1.0.0|https://www.jspsych.org/7.2/plugins/webgazer-calibrate -plugin-webgazer-init-camera|1.0.0|https://www.jspsych.org/7.2/plugins/webgazer-init-camera -plugin-webgazer-validate|1.0.0|https://www.jspsych.org/7.2/plugins/webgazer-validate +jspsych|7.3.0|https://www.jspsych.org/7.3/ +extension-mouse-tracking|1.0.1|https://www.jspsych.org/7.3/extensions/mouse-tracking +extension-record-video|1.0.0|https://www.jspsych.org/7.3/extensions/record-video +extension-webgazer|1.0.1|https://www.jspsych.org/7.3/extensions/webgazer +plugin-animation|1.1.1|https://www.jspsych.org/7.3/plugins/animation +plugin-audio-button-response|1.1.1|https://www.jspsych.org/7.3/plugins/audio-button-response +plugin-audio-keyboard-response|1.1.1|https://www.jspsych.org/7.3/plugins/audio-keyboard-response +plugin-audio-slider-response|1.1.1|https://www.jspsych.org/7.3/plugins/audio-slider-response +plugin-browser-check|1.0.1|https://www.jspsych.org/7.3/plugins/browser-check +plugin-call-function|1.1.1|https://www.jspsych.org/7.3/plugins/call-function +plugin-canvas-button-response|1.1.1|https://www.jspsych.org/7.3/plugins/canvas-button-response +plugin-canvas-keyboard-response|1.1.1|https://www.jspsych.org/7.3/plugins/canvas-keyboard-response +plugin-canvas-slider-response|1.1.1|https://www.jspsych.org/7.3/plugins/canvas-slider-response +plugin-categorize-animation|1.1.1|https://www.jspsych.org/7.3/plugins/categorize-animation +plugin-categorize-html|1.1.1|https://www.jspsych.org/7.3/plugins/categorize-html +plugin-categorize-image|1.1.1|https://www.jspsych.org/7.3/plugins/categorize-image +plugin-cloze|1.1.1|https://www.jspsych.org/7.3/plugins/cloze +plugin-external-html|1.1.1|https://www.jspsych.org/7.3/plugins/external-html +plugin-free-sort|1.0.1|https://www.jspsych.org/7.3/plugins/free-sort +plugin-fullscreen|1.1.1|https://www.jspsych.org/7.3/plugins/fullscreen +plugin-html-audio-response|1.0.1|https://www.jspsych.org/7.3/plugins/html-audio-response +plugin-html-button-response|1.1.1|https://www.jspsych.org/7.3/plugins/html-button-response +plugin-html-keyboard-response|1.1.1|https://www.jspsych.org/7.3/plugins/html-keyboard-response +plugin-html-slider-response|1.1.1|https://www.jspsych.org/7.3/plugins/html-slider-response +plugin-html-video-response|1.0.0|https://www.jspsych.org/7.3/plugins/html-video-response +plugin-iat-html|1.1.1|https://www.jspsych.org/7.3/plugins/iat-html +plugin-iat-image|1.1.1|https://www.jspsych.org/7.3/plugins/iat-image +plugin-image-button-response|1.1.1|https://www.jspsych.org/7.3/plugins/image-button-response +plugin-image-keyboard-response|1.1.1|https://www.jspsych.org/7.3/plugins/image-keyboard-response +plugin-image-slider-response|1.1.1|https://www.jspsych.org/7.3/plugins/image-slider-response +plugin-initialize-camera|1.0.0|https://www.jspsych.org/7.3/plugins/initialize-camera +plugin-initialize-microphone|1.0.1|https://www.jspsych.org/7.3/plugins/initialize-microphone +plugin-instructions|1.1.1|https://www.jspsych.org/7.3/plugins/instructions +plugin-maxdiff|1.1.1|https://www.jspsych.org/7.3/plugins/maxdiff +plugin-mirror-camera|1.0.0|https://www.jspsych.org/7.3/plugins/mirror-camera +plugin-preload|1.1.1|https://www.jspsych.org/7.3/plugins/preload +plugin-reconstruction|1.1.1|https://www.jspsych.org/7.3/plugins/reconstruction +plugin-resize|1.0.1|https://www.jspsych.org/7.3/plugins/resize +plugin-same-different-html|1.1.1|https://www.jspsych.org/7.3/plugins/same-different-html +plugin-same-different-image|1.1.1|https://www.jspsych.org/7.3/plugins/same-different-image +plugin-serial-reaction-time-mouse|1.1.1|https://www.jspsych.org/7.3/plugins/serial-reaction-time-mouse +plugin-serial-reaction-time|1.1.1|https://www.jspsych.org/7.3/plugins/serial-reaction-time +plugin-sketchpad|1.0.2|https://www.jspsych.org/7.3/plugins/sketchpad +plugin-survey-html-form|1.0.1|https://www.jspsych.org/7.3/plugins/survey-html-form +plugin-survey-likert|1.1.1|https://www.jspsych.org/7.3/plugins/survey-likert +plugin-survey-multi-choice|1.1.1|https://www.jspsych.org/7.3/plugins/survey-multi-choice +plugin-survey-multi-select|1.1.1|https://www.jspsych.org/7.3/plugins/survey-multi-select +plugin-survey-text|1.1.1|https://www.jspsych.org/7.3/plugins/survey-text +plugin-survey|0.2.0|https://www.jspsych.org/7.3/plugins/survey +plugin-video-button-response|1.1.1|https://www.jspsych.org/7.3/plugins/video-button-response +plugin-video-keyboard-response|1.1.1|https://www.jspsych.org/7.3/plugins/video-keyboard-response +plugin-video-slider-response|1.1.1|https://www.jspsych.org/7.3/plugins/video-slider-response +plugin-virtual-chinrest|2.0.1|https://www.jspsych.org/7.3/plugins/virtual-chinrest +plugin-visual-search-circle|1.1.1|https://www.jspsych.org/7.3/plugins/visual-search-circle +plugin-webgazer-calibrate|1.0.1|https://www.jspsych.org/7.3/plugins/webgazer-calibrate +plugin-webgazer-init-camera|1.0.1|https://www.jspsych.org/7.3/plugins/webgazer-init-camera +plugin-webgazer-validate|1.0.1|https://www.jspsych.org/7.3/plugins/webgazer-validate diff --git a/jspsych-dist/dist/extension-mouse-tracking.js b/jspsych-dist/dist/extension-mouse-tracking.js index c408639..9bda1d8 100644 --- a/jspsych-dist/dist/extension-mouse-tracking.js +++ b/jspsych-dist/dist/extension-mouse-tracking.js @@ -1,7 +1,7 @@ var jsPsychExtensionMouseTracking = (function () { 'use strict'; - /*! ***************************************************************************** + /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any diff --git a/jspsych-dist/dist/extension-record-video.js b/jspsych-dist/dist/extension-record-video.js new file mode 100644 index 0000000..f7f328e --- /dev/null +++ b/jspsych-dist/dist/extension-record-video.js @@ -0,0 +1,141 @@ +var jsPsychExtensionRecordVideo = (function () { + 'use strict'; + + /****************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + } + + // Gets all non-builtin properties up the prototype chain + const getAllProperties = object => { + const properties = new Set(); + + do { + for (const key of Reflect.ownKeys(object)) { + properties.add([object, key]); + } + } while ((object = Reflect.getPrototypeOf(object)) && object !== Object.prototype); + + return properties; + }; + + var autoBind = (self, {include, exclude} = {}) => { + const filter = key => { + const match = pattern => typeof pattern === 'string' ? key === pattern : pattern.test(key); + + if (include) { + return include.some(match); + } + + if (exclude) { + return !exclude.some(match); + } + + return true; + }; + + for (const [object, key] of getAllProperties(self.constructor.prototype)) { + if (key === 'constructor' || !filter(key)) { + continue; + } + + const descriptor = Reflect.getOwnPropertyDescriptor(object, key); + if (descriptor && typeof descriptor.value === 'function') { + self[key] = self[key].bind(self); + } + } + + return self; + }; + + class RecordVideoExtension { + constructor(jsPsych) { + this.jsPsych = jsPsych; + this.recordedChunks = []; + this.recorder = null; + this.currentTrialData = null; + this.trialComplete = false; + this.onUpdateCallback = null; + // todo: add option to stream data to server with timeslice? + this.initialize = () => __awaiter(this, void 0, void 0, function* () { }); + this.on_start = () => { + this.recorder = this.jsPsych.pluginAPI.getCameraRecorder(); + this.recordedChunks = []; + this.trialComplete = false; + this.currentTrialData = {}; + if (!this.recorder) { + console.warn("The record-video extension is trying to start but the camera is not initialized. Do you need to run the initialize-camera plugin?"); + return; + } + this.recorder.addEventListener("dataavailable", this.handleOnDataAvailable); + }; + this.on_load = () => { + this.recorder.start(); + }; + this.on_finish = () => { + return new Promise((resolve) => { + this.trialComplete = true; + this.recorder.stop(); + if (!this.currentTrialData.record_video_data) { + this.onUpdateCallback = () => { + resolve(this.currentTrialData); + }; + } + else { + resolve(this.currentTrialData); + } + }); + }; + autoBind(this); + } + handleOnDataAvailable(event) { + if (event.data.size > 0) { + console.log("chunks added"); + this.recordedChunks.push(event.data); + if (this.trialComplete) { + this.updateData(); + } + } + } + updateData() { + const data = new Blob(this.recordedChunks, { + type: this.recorder.mimeType, + }); + const reader = new FileReader(); + reader.addEventListener("load", () => { + const base64 = reader.result.split(",")[1]; + this.currentTrialData.record_video_data = base64; + if (this.onUpdateCallback) { + this.onUpdateCallback(); + } + }); + reader.readAsDataURL(data); + } + } + RecordVideoExtension.info = { + name: "record-video", + }; + + return RecordVideoExtension; + +})(); diff --git a/jspsych-dist/dist/jspsych.js b/jspsych-dist/dist/jspsych.js index 77a1ad8..fc8cae2 100644 --- a/jspsych-dist/dist/jspsych.js +++ b/jspsych-dist/dist/jspsych.js @@ -1,7 +1,7 @@ var jsPsychModule = (function (exports) { 'use strict'; - /*! ***************************************************************************** + /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -70,7 +70,7 @@ var jsPsychModule = (function (exports) { return self; }; - var version = "7.2.1"; + var version = "7.3.0"; class MigrationError extends Error { constructor(message = "The global `jsPsych` variable is no longer available in jsPsych v7.") { @@ -842,8 +842,13 @@ var jsPsychModule = (function (exports) { this.img_cache = {}; this.preloadMap = new Map(); this.microphone_recorder = null; + this.camera_stream = null; + this.camera_recorder = null; } getVideoBuffer(videoID) { + if (videoID.startsWith("blob:")) { + this.video_buffers[videoID] = videoID; + } return this.video_buffers[videoID]; } initAudio() { @@ -1085,6 +1090,17 @@ var jsPsychModule = (function (exports) { getMicrophoneRecorder() { return this.microphone_recorder; } + initializeCameraRecorder(stream, opts) { + this.camera_stream = stream; + const recorder = new MediaRecorder(stream, opts); + this.camera_recorder = recorder; + } + getCameraStream() { + return this.camera_stream; + } + getCameraRecorder() { + return this.camera_recorder; + } } class SimulationAPI { @@ -1630,119 +1646,119 @@ var jsPsychModule = (function (exports) { var alea = {exports: {}}; (function (module) { - // A port of an algorithm by Johannes Baagøe , 2010 - // http://baagoe.com/en/RandomMusings/javascript/ - // https://github.com/nquinlan/better-random-numbers-for-javascript-mirror - // Original work is under MIT license - - - // Copyright (C) 2010 by Johannes Baagøe - // - // Permission is hereby granted, free of charge, to any person obtaining a copy - // of this software and associated documentation files (the "Software"), to deal - // in the Software without restriction, including without limitation the rights - // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - // copies of the Software, and to permit persons to whom the Software is - // furnished to do so, subject to the following conditions: - // - // The above copyright notice and this permission notice shall be included in - // all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - // THE SOFTWARE. - - - - (function(global, module, define) { - - function Alea(seed) { - var me = this, mash = Mash(); - - me.next = function() { - var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32 - me.s0 = me.s1; - me.s1 = me.s2; - return me.s2 = t - (me.c = t | 0); - }; - - // Apply the seeding algorithm from Baagoe. - me.c = 1; - me.s0 = mash(' '); - me.s1 = mash(' '); - me.s2 = mash(' '); - me.s0 -= mash(seed); - if (me.s0 < 0) { me.s0 += 1; } - me.s1 -= mash(seed); - if (me.s1 < 0) { me.s1 += 1; } - me.s2 -= mash(seed); - if (me.s2 < 0) { me.s2 += 1; } - mash = null; - } + // A port of an algorithm by Johannes Baagøe , 2010 + // http://baagoe.com/en/RandomMusings/javascript/ + // https://github.com/nquinlan/better-random-numbers-for-javascript-mirror + // Original work is under MIT license - + + // Copyright (C) 2010 by Johannes Baagøe + // + // Permission is hereby granted, free of charge, to any person obtaining a copy + // of this software and associated documentation files (the "Software"), to deal + // in the Software without restriction, including without limitation the rights + // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + // copies of the Software, and to permit persons to whom the Software is + // furnished to do so, subject to the following conditions: + // + // The above copyright notice and this permission notice shall be included in + // all copies or substantial portions of the Software. + // + // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + // THE SOFTWARE. + + + + (function(global, module, define) { + + function Alea(seed) { + var me = this, mash = Mash(); + + me.next = function() { + var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32 + me.s0 = me.s1; + me.s1 = me.s2; + return me.s2 = t - (me.c = t | 0); + }; + + // Apply the seeding algorithm from Baagoe. + me.c = 1; + me.s0 = mash(' '); + me.s1 = mash(' '); + me.s2 = mash(' '); + me.s0 -= mash(seed); + if (me.s0 < 0) { me.s0 += 1; } + me.s1 -= mash(seed); + if (me.s1 < 0) { me.s1 += 1; } + me.s2 -= mash(seed); + if (me.s2 < 0) { me.s2 += 1; } + mash = null; + } - function copy(f, t) { - t.c = f.c; - t.s0 = f.s0; - t.s1 = f.s1; - t.s2 = f.s2; - return t; - } + function copy(f, t) { + t.c = f.c; + t.s0 = f.s0; + t.s1 = f.s1; + t.s2 = f.s2; + return t; + } - function impl(seed, opts) { - var xg = new Alea(seed), - state = opts && opts.state, - prng = xg.next; - prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }; - prng.double = function() { - return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53 - }; - prng.quick = prng; - if (state) { - if (typeof(state) == 'object') copy(state, xg); - prng.state = function() { return copy(xg, {}); }; - } - return prng; - } + function impl(seed, opts) { + var xg = new Alea(seed), + state = opts && opts.state, + prng = xg.next; + prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }; + prng.double = function() { + return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53 + }; + prng.quick = prng; + if (state) { + if (typeof(state) == 'object') copy(state, xg); + prng.state = function() { return copy(xg, {}); }; + } + return prng; + } - function Mash() { - var n = 0xefc8249d; - - var mash = function(data) { - data = String(data); - for (var i = 0; i < data.length; i++) { - n += data.charCodeAt(i); - var h = 0.02519603282416938 * n; - n = h >>> 0; - h -= n; - h *= n; - n = h >>> 0; - h -= n; - n += h * 0x100000000; // 2^32 - } - return (n >>> 0) * 2.3283064365386963e-10; // 2^-32 - }; - - return mash; - } + function Mash() { + var n = 0xefc8249d; + + var mash = function(data) { + data = String(data); + for (var i = 0; i < data.length; i++) { + n += data.charCodeAt(i); + var h = 0.02519603282416938 * n; + n = h >>> 0; + h -= n; + h *= n; + n = h >>> 0; + h -= n; + n += h * 0x100000000; // 2^32 + } + return (n >>> 0) * 2.3283064365386963e-10; // 2^-32 + }; + + return mash; + } - if (module && module.exports) { - module.exports = impl; - } else if (define && define.amd) { - define(function() { return impl; }); - } else { - this.alea = impl; - } + if (module && module.exports) { + module.exports = impl; + } else if (define && define.amd) { + define(function() { return impl; }); + } else { + this.alea = impl; + } - })( - commonjsGlobal, - module, // present in node.js - (typeof undefined) == 'function' // present with an AMD loader - ); - }(alea)); + })( + commonjsGlobal, + module, // present in node.js + (typeof undefined) == 'function' // present with an AMD loader + ); + } (alea)); var seedrandom = alea.exports; @@ -2409,7 +2425,11 @@ var jsPsychModule = (function (exports) { // recursive downward search for active trial to extract timeline variable timelineVariable(variable_name) { if (typeof this.timeline_parameters == "undefined") { - return this.findTimelineVariable(variable_name); + const val = this.findTimelineVariable(variable_name); + if (typeof val === "undefined") { + console.warn("Timeline variable " + variable_name + " not found."); + } + return val; } else { // if progress.current_location is -1, then the timeline variable is being evaluated @@ -2424,7 +2444,11 @@ var jsPsychModule = (function (exports) { loc = loc - 1; } // now find the variable - return this.timeline_parameters.timeline[loc].timelineVariable(variable_name); + const val = this.timeline_parameters.timeline[loc].timelineVariable(variable_name); + if (typeof val === "undefined") { + console.warn("Timeline variable " + variable_name + " not found."); + } + return val; } } // recursively get all the timeline variables for this trial @@ -2702,6 +2726,7 @@ var jsPsychModule = (function (exports) { return this.DOM_container; } finishTrial(data = {}) { + var _a; if (this.current_trial_finished) { return; } @@ -2714,7 +2739,7 @@ var jsPsychModule = (function (exports) { // write the data from the trial this.data.write(data); // get back the data with all of the defaults in - const trial_data = this.data.get().filter({ trial_index: this.global_trial_index }); + const trial_data = this.data.getLastTrialData(); // for trial-level callbacks, we just want to pass in a reference to the values // of the DataCollection, for easy access and editing. const trial_data_values = trial_data.values()[0]; @@ -2742,46 +2767,58 @@ var jsPsychModule = (function (exports) { } } // handle extension callbacks - if (Array.isArray(current_trial.extensions)) { - for (const extension of current_trial.extensions) { - const ext_data_values = this.extensions[extension.type.info.name].on_finish(extension.params); - Object.assign(trial_data_values, ext_data_values); + const extensionCallbackResults = ((_a = current_trial.extensions) !== null && _a !== void 0 ? _a : []).map((extension) => this.extensions[extension.type.info.name].on_finish(extension.params)); + const onExtensionCallbacksFinished = () => { + // about to execute lots of callbacks, so switch context. + this.internal.call_immediate = true; + // handle callback at plugin level + if (typeof current_trial.on_finish === "function") { + current_trial.on_finish(trial_data_values); + } + // handle callback at whole-experiment level + this.opts.on_trial_finish(trial_data_values); + // after the above callbacks are complete, then the data should be finalized + // for this trial. call the on_data_update handler, passing in the same + // data object that just went through the trial's finish handlers. + this.opts.on_data_update(trial_data_values); + // done with callbacks + this.internal.call_immediate = false; + // wait for iti + if (this.simulation_mode === "data-only") { + this.nextTrial(); } - } - // about to execute lots of callbacks, so switch context. - this.internal.call_immediate = true; - // handle callback at plugin level - if (typeof current_trial.on_finish === "function") { - current_trial.on_finish(trial_data_values); - } - // handle callback at whole-experiment level - this.opts.on_trial_finish(trial_data_values); - // after the above callbacks are complete, then the data should be finalized - // for this trial. call the on_data_update handler, passing in the same - // data object that just went through the trial's finish handlers. - this.opts.on_data_update(trial_data_values); - // done with callbacks - this.internal.call_immediate = false; - // wait for iti - if (this.simulation_mode === "data-only") { - this.nextTrial(); - } - else if (typeof current_trial.post_trial_gap === null || - typeof current_trial.post_trial_gap === "undefined") { - if (this.opts.default_iti > 0) { - setTimeout(this.nextTrial, this.opts.default_iti); + else if (typeof current_trial.post_trial_gap === null || + typeof current_trial.post_trial_gap === "undefined") { + if (this.opts.default_iti > 0) { + setTimeout(this.nextTrial, this.opts.default_iti); + } + else { + this.nextTrial(); + } } else { - this.nextTrial(); + if (current_trial.post_trial_gap > 0) { + setTimeout(this.nextTrial, current_trial.post_trial_gap); + } + else { + this.nextTrial(); + } } + }; + // Strictly using Promise.resolve to turn all values into promises would be cleaner here, but it + // would require user test code to make the event loop tick after every simulated key press even + // if there are no async `on_finish` methods. Hence, in order to avoid a breaking change, we + // only rely on the event loop if at least one `on_finish` method returns a promise. + if (extensionCallbackResults.some((result) => typeof result.then === "function")) { + Promise.all(extensionCallbackResults.map((result) => Promise.resolve(result).then((ext_data_values) => { + Object.assign(trial_data_values, ext_data_values); + }))).then(onExtensionCallbacksFinished); } else { - if (current_trial.post_trial_gap > 0) { - setTimeout(this.nextTrial, current_trial.post_trial_gap); - } - else { - this.nextTrial(); + for (const values of extensionCallbackResults) { + Object.assign(trial_data_values, values); } + onExtensionCallbacksFinished(); } } endExperiment(end_message = "", data = {}) { @@ -3069,16 +3106,16 @@ var jsPsychModule = (function (exports) { } evaluateTimelineVariables(trial) { for (const key of Object.keys(trial)) { - // timeline variables on the root level if (typeof trial[key] === "object" && trial[key] !== null && typeof trial[key].timelineVariablePlaceholder !== "undefined") { - /*trial[key].toString().replace(/\s/g, "") == - "function(){returntimeline.timelineVariable(varname);}" - )*/ trial[key] = trial[key].timelineVariableFunction(); + trial[key] = trial[key].timelineVariableFunction(); } // timeline variables that are nested in objects - if (typeof trial[key] === "object" && trial[key] !== null) { + if (typeof trial[key] === "object" && + trial[key] !== null && + key !== "timeline" && + key !== "timeline_variables") { this.evaluateTimelineVariables(trial[key]); } } @@ -3121,9 +3158,11 @@ var jsPsychModule = (function (exports) { else if (typeof obj === "object") { if (info === null || !info.nested) { for (const key of Object.keys(obj)) { - if (key === "type") { + if (key === "type" || key === "timeline" || key === "timeline_variables") { // Ignore the object's `type` field because it contains a plugin and we do not want to - // call plugin functions + // call plugin functions. Also ignore `timeline` and `timeline_variables` because they + // are used in the `trials` parameter of the preload plugin and we don't want to actually + // evaluate those in that context. continue; } obj[key] = this.replaceFunctionsWithValues(obj[key], null); @@ -3253,6 +3292,7 @@ var jsPsychModule = (function (exports) { } } + // __rollup-babel-import-regenerator-runtime__ // temporary patch for Safari if (typeof window !== "undefined" && window.hasOwnProperty("webkitAudioContext") && diff --git a/jspsych-dist/dist/plugin-browser-check.js b/jspsych-dist/dist/plugin-browser-check.js index 8adf904..c3ca740 100644 --- a/jspsych-dist/dist/plugin-browser-check.js +++ b/jspsych-dist/dist/plugin-browser-check.js @@ -1,7 +1,7 @@ var jsPsychBrowserCheck = (function (jspsych) { 'use strict'; - /*! ***************************************************************************** + /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -109,6 +109,9 @@ var jsPsychBrowserCheck = (function (jspsych) { ['opera-mini', /Opera Mini.*Version\/([0-9\.]+)/], ['opera', /Opera\/([0-9\.]+)(?:\s|$)/], ['opera', /OPR\/([0-9\.]+)(:?\s|$)/], + ['pie', /^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/], + ['pie', /^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/], + ['netfront', /^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/], ['ie', /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/], ['ie', /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/], ['ie', /MSIE\s(7\.0)/], @@ -141,6 +144,7 @@ var jsPsychBrowserCheck = (function (jspsych) { ['Windows 8.1', /(Windows NT 6.3)/], ['Windows 10', /(Windows NT 10.0)/], ['Windows ME', /Windows ME/], + ['Windows CE', /Windows CE|WinCE|Microsoft Pocket Internet Explorer/], ['Open BSD', /OpenBSD/], ['Sun OS', /SunOS/], ['Chrome OS', /CrOS/], diff --git a/jspsych-dist/dist/plugin-canvas-slider-response.js b/jspsych-dist/dist/plugin-canvas-slider-response.js index 7c239de..345140f 100644 --- a/jspsych-dist/dist/plugin-canvas-slider-response.js +++ b/jspsych-dist/dist/plugin-canvas-slider-response.js @@ -125,7 +125,7 @@ var jsPsychCanvasSliderResponse = (function (jspsych) { } html += '">'; html += - '${trial.stimulus}`; + if (trial.show_done_button) { + html += `

`; + } + display_element.innerHTML = html; + } + hideStimulus(display_element) { + const el = display_element.querySelector("#jspsych-html-video-response-stimulus"); + if (el) { + el.style.visibility = "hidden"; + } + } + addButtonEvent(display_element, trial) { + const btn = display_element.querySelector("#finish-trial"); + if (btn) { + btn.addEventListener("click", () => { + const end_time = performance.now(); + this.rt = Math.round(end_time - this.stimulus_start_time); + this.stopRecording().then(() => { + if (trial.allow_playback) { + this.showPlaybackControls(display_element, trial); + } + else { + this.endTrial(display_element, trial); + } + }); + }); + } + } + setupRecordingEvents(display_element, trial) { + this.data_available_handler = (e) => { + if (e.data.size > 0) { + this.recorded_data_chunks.push(e.data); + } + }; + this.stop_event_handler = () => { + const data = new Blob(this.recorded_data_chunks, { type: this.recorder.mimeType }); + this.video_url = URL.createObjectURL(data); + const reader = new FileReader(); + reader.addEventListener("load", () => { + const base64 = reader.result.split(",")[1]; + this.response = base64; + this.load_resolver(); + }); + reader.readAsDataURL(data); + }; + this.start_event_handler = (e) => { + // resets the recorded data + this.recorded_data_chunks.length = 0; + this.recorder_start_time = e.timeStamp; + this.showDisplay(display_element, trial); + this.addButtonEvent(display_element, trial); + // setup timer for hiding the stimulus + if (trial.stimulus_duration !== null) { + this.jsPsych.pluginAPI.setTimeout(() => { + this.hideStimulus(display_element); + }, trial.stimulus_duration); + } + // setup timer for ending the trial + if (trial.recording_duration !== null) { + this.jsPsych.pluginAPI.setTimeout(() => { + // this check is necessary for cases where the + // done_button is clicked before the timer expires + if (this.recorder.state !== "inactive") { + this.stopRecording().then(() => { + if (trial.allow_playback) { + this.showPlaybackControls(display_element, trial); + } + else { + this.endTrial(display_element, trial); + } + }); + } + }, trial.recording_duration); + } + }; + this.recorder.addEventListener("dataavailable", this.data_available_handler); + this.recorder.addEventListener("stop", this.stop_event_handler); + this.recorder.addEventListener("start", this.start_event_handler); + } + startRecording() { + this.recorder.start(); + } + stopRecording() { + this.recorder.stop(); + return new Promise((resolve) => { + this.load_resolver = resolve; + }); + } + showPlaybackControls(display_element, trial) { + display_element.innerHTML = ` +

+ + + `; + display_element.querySelector("#record-again").addEventListener("click", () => { + // release object url to save memory + URL.revokeObjectURL(this.video_url); + this.startRecording(); + }); + display_element.querySelector("#continue").addEventListener("click", () => { + this.endTrial(display_element, trial); + }); + // const video = display_element.querySelector('#playback'); + // video.src = + } + endTrial(display_element, trial) { + // clear recordering event handler + this.recorder.removeEventListener("dataavailable", this.data_available_handler); + this.recorder.removeEventListener("start", this.start_event_handler); + this.recorder.removeEventListener("stop", this.stop_event_handler); + // clear any remaining setTimeout handlers + this.jsPsych.pluginAPI.clearAllTimeouts(); + // gather the data to store for the trial + var trial_data = { + rt: this.rt, + stimulus: trial.stimulus, + response: this.response, + }; + if (trial.save_video_url) { + trial_data.video_url = this.video_url; + } + else { + URL.revokeObjectURL(this.video_url); + } + // clear the display + display_element.innerHTML = ""; + // move on to the next trial + this.jsPsych.finishTrial(trial_data); + } + } + HtmlVideoResponsePlugin.info = info; + + return HtmlVideoResponsePlugin; + +})(jsPsychModule); diff --git a/jspsych-dist/dist/plugin-initialize-camera.js b/jspsych-dist/dist/plugin-initialize-camera.js new file mode 100644 index 0000000..c063d26 --- /dev/null +++ b/jspsych-dist/dist/plugin-initialize-camera.js @@ -0,0 +1,157 @@ +var jsPsychInitializeCamera = (function (jspsych) { + 'use strict'; + + /****************************************************************************** + Copyright (c) Microsoft Corporation. + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + ***************************************************************************** */ + + function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + } + + const info = { + name: "initialize-camera", + parameters: { + /** Message to display with the selection box */ + device_select_message: { + type: jspsych.ParameterType.HTML_STRING, + default: `

Please select the camera you would like to use.

`, + }, + /** Label to use for the button that confirms selection */ + button_label: { + type: jspsych.ParameterType.STRING, + default: "Use this camera", + }, + /** Set to `true` to include audio in the recording */ + include_audio: { + type: jspsych.ParameterType.BOOL, + default: false, + }, + /** Desired width of the camera stream */ + width: { + type: jspsych.ParameterType.INT, + default: null, + }, + /** Desired height of the camera stream */ + height: { + type: jspsych.ParameterType.INT, + default: null, + }, + /** MIME type of the recording. Set as a full string, e.g., 'video/webm; codecs="vp8, vorbis"'. */ + mime_type: { + type: jspsych.ParameterType.STRING, + default: null, + }, + }, + }; + /** + * **initialize-camera** + * + * jsPsych plugin for getting permission to initialize a camera and setting properties of the recording. + * + * @author Josh de Leeuw + * @see {@link https://www.jspsych.org/plugins/jspsych-initialize-camera/ initialize-camera plugin documentation on jspsych.org} + */ + class InitializeCameraPlugin { + constructor(jsPsych) { + this.jsPsych = jsPsych; + } + trial(display_element, trial) { + this.run_trial(display_element, trial).then((id) => { + display_element.innerHTML = ""; + this.jsPsych.finishTrial({ + device_id: id, + }); + }); + } + run_trial(display_element, trial) { + return __awaiter(this, void 0, void 0, function* () { + yield this.askForPermission(trial); + this.showCameraSelection(display_element, trial); + this.updateDeviceList(display_element); + navigator.mediaDevices.ondevicechange = (e) => { + this.updateDeviceList(display_element); + }; + const camera_id = yield this.waitForSelection(display_element); + const constraints = { video: { deviceId: camera_id } }; + if (trial.width) { + constraints.video.width = trial.width; + } + if (trial.height) { + constraints.video.height = trial.height; + } + if (trial.include_audio) { + constraints.audio = true; + } + const stream = yield navigator.mediaDevices.getUserMedia(constraints); + const recorder_options = {}; + if (trial.mime_type) { + recorder_options.mimeType = trial.mime_type; + } + this.jsPsych.pluginAPI.initializeCameraRecorder(stream, recorder_options); + return camera_id; + }); + } + askForPermission(trial) { + return __awaiter(this, void 0, void 0, function* () { + const stream = yield navigator.mediaDevices.getUserMedia({ + audio: trial.include_audio, + video: true, + }); + return stream; + }); + } + showCameraSelection(display_element, trial) { + let html = ` + ${trial.device_select_message} + +

`; + display_element.innerHTML = html; + } + waitForSelection(display_element) { + return new Promise((resolve) => { + display_element.querySelector("#btn-select-camera").addEventListener("click", () => { + const camera = display_element.querySelector("#which-camera").value; + resolve(camera); + }); + }); + } + updateDeviceList(display_element) { + navigator.mediaDevices.enumerateDevices().then((devices) => { + const cams = devices.filter((d) => d.kind === "videoinput" && d.deviceId !== "default" && d.deviceId !== "communications"); + // remove entries with duplicate groupID + const unique_cameras = cams.filter((cam, index, arr) => arr.findIndex((v) => v.groupId == cam.groupId) == index); + // reset the list by clearing all current options + display_element.querySelector("#which-camera").innerHTML = ""; + unique_cameras.forEach((d) => { + let el = document.createElement("option"); + el.value = d.deviceId; + el.innerHTML = d.label; + display_element.querySelector("#which-camera").appendChild(el); + }); + }); + } + } + InitializeCameraPlugin.info = info; + + return InitializeCameraPlugin; + +})(jsPsychModule); diff --git a/jspsych-dist/dist/plugin-initialize-microphone.js b/jspsych-dist/dist/plugin-initialize-microphone.js index 29bde55..a0e395e 100644 --- a/jspsych-dist/dist/plugin-initialize-microphone.js +++ b/jspsych-dist/dist/plugin-initialize-microphone.js @@ -1,7 +1,7 @@ var jsPsychInitializeMicrophone = (function (jspsych) { 'use strict'; - /*! ***************************************************************************** + /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any diff --git a/jspsych-dist/dist/plugin-mirror-camera.js b/jspsych-dist/dist/plugin-mirror-camera.js new file mode 100644 index 0000000..bd4d41d --- /dev/null +++ b/jspsych-dist/dist/plugin-mirror-camera.js @@ -0,0 +1,71 @@ +var jsPsychMirrorCamera = (function (jspsych) { + 'use strict'; + + const info = { + name: "mirror-camera", + parameters: { + /** HTML to render below the video */ + prompt: { + type: jspsych.ParameterType.HTML_STRING, + default: null, + }, + /** Label to show on continue button */ + button_label: { + type: jspsych.ParameterType.STRING, + default: "Continue", + }, + /** Height of the video element */ + height: { + type: jspsych.ParameterType.INT, + default: null, + }, + /** Width of the video element */ + width: { + type: jspsych.ParameterType.INT, + default: null, + }, + /** Whether to flip the camera */ + mirror_camera: { + type: jspsych.ParameterType.BOOL, + default: true, + }, + }, + }; + /** + * **mirror-camera** + * + * jsPsych plugin for showing a live stream from a camera + * + * @author Josh de Leeuw + * @see {@link https://www.jspsych.org/plugins/jspsych-mirror-camera/ mirror-camera plugin documentation on jspsych.org} + */ + class MirrorCameraPlugin { + constructor(jsPsych) { + this.jsPsych = jsPsych; + } + trial(display_element, trial) { + this.stream = this.jsPsych.pluginAPI.getCameraStream(); + display_element.innerHTML = ` + + ${trial.prompt ? `
${trial.prompt}
` : ""} +

+ `; + display_element.querySelector("#jspsych-mirror-camera-video").srcObject = + this.stream; + display_element.querySelector("#btn-continue").addEventListener("click", () => { + this.finish(display_element); + }); + this.start_time = performance.now(); + } + finish(display_element) { + display_element.innerHTML = ""; + this.jsPsych.finishTrial({ + rt: performance.now() - this.start_time, + }); + } + } + MirrorCameraPlugin.info = info; + + return MirrorCameraPlugin; + +})(jsPsychModule); diff --git a/jspsych-dist/dist/plugin-survey.js b/jspsych-dist/dist/plugin-survey.js index 7461aee..10f0abb 100644 --- a/jspsych-dist/dist/plugin-survey.js +++ b/jspsych-dist/dist/plugin-survey.js @@ -13,62088 +13,62395 @@ var jsPsychSurvey = (function (jspsych) { * License: MIT (http://www.opensource.org/licenses/mit-license.php) */ - (function (module, exports) { - (function() {(function(n){var A=this||(0, eval)("this"),w=A.document,R=A.navigator,v=A.jQuery,H=A.JSON;v||"undefined"===typeof jQuery||(v=jQuery);(function(n){n(module.exports||exports);})(function(S,T){function K(a,c){return null===a||typeof a in W?a===c:!1}function X(b,c){var d;return function(){d||(d=a.a.setTimeout(function(){d=n;b();},c));}}function Y(b,c){var d;return function(){clearTimeout(d); - d=a.a.setTimeout(b,c);}}function Z(a,c){c&&"change"!==c?"beforeChange"===c?this.pc(a):this.gb(a,c):this.qc(a);}function aa(a,c){null!==c&&c.s&&c.s();}function ba(a,c){var d=this.qd,e=d[r];e.ra||(this.Qb&&this.mb[c]?(d.uc(c,a,this.mb[c]),this.mb[c]=null,--this.Qb):e.I[c]||d.uc(c,a,e.J?{da:a}:d.$c(a)),a.Ja&&a.gd());}var a="undefined"!==typeof S?S:{};a.b=function(b,c){for(var d=b.split("."),e=a,f=0;fa.a.A(c,b)&&c.push(b);});return c},Mb:function(a, - b,c){var d=[];if(a)for(var e=0,l=a.length;ee?d&&b.push(c):d||b.splice(e,1);},Ba:g,extend:c,setPrototypeOf:d,Ab:g?d:c,P:b,Ga:function(a,b,c){if(!a)return a;var d={},e;for(e in a)f.call(a,e)&&(d[e]= - b.call(c,a[e],e,a));return d},Tb:function(b){for(;b.firstChild;)a.removeNode(b.firstChild);},Yb:function(b){b=a.a.la(b);for(var c=(b[0]&&b[0].ownerDocument||w).createElement("div"),d=0,e=b.length;dp?a.setAttribute("selected",b):a.selected=b;},Db:function(a){return null===a||a===n?"":a.trim? - a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ud:function(a,b){a=a||"";return b.length>a.length?!1:a.substring(0,b.length)===b},vd:function(a,b){if(a===b)return !0;if(11===a.nodeType)return !1;if(b.contains)return b.contains(1!==a.nodeType?a.parentNode:a);if(b.compareDocumentPosition)return 16==(b.compareDocumentPosition(a)&16);for(;a&&a!=b;)a=a.parentNode;return !!a},Sb:function(b){return a.a.vd(b,b.ownerDocument.documentElement)},kd:function(b){return !!a.a.Lb(b,a.a.Sb)},R:function(a){return a&& - a.tagName&&a.tagName.toLowerCase()},Ac:function(b){return a.onError?function(){try{return b.apply(this,arguments)}catch(c){throw a.onError&&a.onError(c),c;}}:b},setTimeout:function(b,c){return setTimeout(a.a.Ac(b),c)},Gc:function(b){setTimeout(function(){a.onError&&a.onError(b);throw b;},0);},B:function(b,c,d){var e=a.a.Ac(d);d=l[c];if(a.options.useOnlyNativeEvents||d||!v)if(d||"function"!=typeof b.addEventListener)if("undefined"!=typeof b.attachEvent){var k=function(a){e.call(b,a);},f="on"+c;b.attachEvent(f, - k);a.a.K.za(b,function(){b.detachEvent(f,k);});}else throw Error("Browser doesn't support addEventListener or attachEvent");else b.addEventListener(c,e,!1);else t||(t="function"==typeof v(b).on?"on":"bind"),v(b)[t](c,e);},Fb:function(b,c){if(!b||!b.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var d;"input"===a.a.R(b)&&b.type&&"click"==c.toLowerCase()?(d=b.type,d="checkbox"==d||"radio"==d):d=!1;if(a.options.useOnlyNativeEvents||!v||d)if("function"==typeof w.createEvent)if("function"== - typeof b.dispatchEvent)d=w.createEvent(k[c]||"HTMLEvents"),d.initEvent(c,!0,!0,A,0,0,0,0,0,!1,!1,!1,!1,0,b),b.dispatchEvent(d);else throw Error("The supplied element doesn't support dispatchEvent");else if(d&&b.click)b.click();else if("undefined"!=typeof b.fireEvent)b.fireEvent("on"+c);else throw Error("Browser doesn't support triggering events");else v(b).trigger(c);},f:function(b){return a.O(b)?b():b},bc:function(b){return a.O(b)?b.v():b},Eb:function(b,c,d){var l;c&&("object"===typeof b.classList? - (l=b.classList[d?"add":"remove"],a.a.D(c.match(q),function(a){l.call(b.classList,a);})):"string"===typeof b.className.baseVal?e(b.className,"baseVal",c,d):e(b,"className",c,d));},Bb:function(b,c){var d=a.a.f(c);if(null===d||d===n)d="";var e=a.h.firstChild(b);!e||3!=e.nodeType||a.h.nextSibling(e)?a.h.va(b,[b.ownerDocument.createTextNode(d)]):e.data=d;a.a.Ad(b);},Yc:function(a,b){a.name=b;if(7>=p)try{var c=a.name.replace(/[&<>'"]/g,function(a){return "&#"+a.charCodeAt(0)+";"});a.mergeAttributes(w.createElement(""),!1);}catch(d){}},Ad:function(a){9<=p&&(a=1==a.nodeType?a:a.parentNode,a.style&&(a.style.zoom=a.style.zoom));},wd:function(a){if(p){var b=a.style.width;a.style.width=0;a.style.width=b;}},Pd:function(b,c){b=a.a.f(b);c=a.a.f(c);for(var d=[],e=b;e<=c;e++)d.push(e);return d},la:function(a){for(var b=[],c=0,d=a.length;c",""],d=[3,"","
"],e=[1,""],f={thead:c,tbody:c,tfoot:c,tr:[2,"","
"],td:d,th:d,option:e,optgroup:e},g=8>=a.a.W;a.a.ua=function(c,d){var e;if(v)if(v.parseHTML)e=v.parseHTML(c,d)||[];else {if((e=v.clean([c],d))&&e[0]){for(var l=e[0];l.parentNode&&11!==l.parentNode.nodeType;)l=l.parentNode; - l.parentNode&&l.parentNode.removeChild(l);}}else {(e=d)||(e=w);var l=e.parentWindow||e.defaultView||A,p=a.a.Db(c).toLowerCase(),q=e.createElement("div"),t;t=(p=p.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/))&&f[p[1]]||b;p=t[0];t="ignored
"+t[1]+c+t[2]+"
";"function"==typeof l.innerShiv?q.appendChild(l.innerShiv(t)):(g&&e.body.appendChild(q),q.innerHTML=t,g&&q.parentNode.removeChild(q));for(;p--;)q=q.lastChild;e=a.a.la(q.lastChild.childNodes);}return e};a.a.Md=function(b,c){var d=a.a.ua(b, - c);return d.length&&d[0].parentElement||a.a.Yb(d)};a.a.fc=function(b,c){a.a.Tb(b);c=a.a.f(c);if(null!==c&&c!==n)if("string"!=typeof c&&(c=c.toString()),v)v(b).html(c);else for(var d=a.a.ua(c,b.ownerDocument),e=0;eb){if(5E3<= - ++c){h=f;a.a.Gc(Error("'Too much recursion' after processing "+c+" task groups."));break}b=f;}try{d();}catch(p){a.a.Gc(p);}}}function c(){b();h=f=e.length=0;}var d,e=[],f=0,g=1,h=0;A.MutationObserver?d=function(a){var b=w.createElement("div");(new MutationObserver(a)).observe(b,{attributes:!0});return function(){b.classList.toggle("foo");}}(c):d=w&&"onreadystatechange"in w.createElement("script")?function(a){var b=w.createElement("script");b.onreadystatechange=function(){b.onreadystatechange=null;w.documentElement.removeChild(b); - b=null;a();};w.documentElement.appendChild(b);}:function(a){setTimeout(a,0);};return {scheduler:d,zb:function(b){f||a.na.scheduler(c);e[f++]=b;return g++},cancel:function(a){a=a-(g-f);a>=h&&ad[0]?p+d[0]: - d[0]),p);for(var p=1===g?p:Math.min(c+(d[1]||0),p),g=c+g-2,h=Math.max(p,g),U=[],L=[],n=2;cc;c++)b=b();return b})};a.toJSON=function(b,c,d){b=a.ad(b);return a.a.hc(b,c,d)};d.prototype={constructor:d,save:function(b,c){var d=a.a.A(this.keys, - b);0<=d?this.values[d]=c:(this.keys.push(b),this.values.push(c));},get:function(b){b=a.a.A(this.keys,b);return 0<=b?this.values[b]:n}};})();a.b("toJS",a.ad);a.b("toJSON",a.toJSON);a.Wd=function(b,c,d){function e(c){var e=a.xb(b,d).extend({ma:"always"}),h=e.subscribe(function(a){a&&(h.s(),c(a));});e.notifySubscribers(e.v());return h}return "function"!==typeof Promise||c?e(c.bind(d)):new Promise(e)};a.b("when",a.Wd);(function(){a.w={M:function(b){switch(a.a.R(b)){case "option":return !0===b.__ko__hasDomDataOptionValue__? - a.a.g.get(b,a.c.options.$b):7>=a.a.W?b.getAttributeNode("value")&&b.getAttributeNode("value").specified?b.value:b.text:b.value;case "select":return 0<=b.selectedIndex?a.w.M(b.options[b.selectedIndex]):n;default:return b.value}},cb:function(b,c,d){switch(a.a.R(b)){case "option":"string"===typeof c?(a.a.g.set(b,a.c.options.$b,n),"__ko__hasDomDataOptionValue__"in b&&delete b.__ko__hasDomDataOptionValue__,b.value=c):(a.a.g.set(b,a.c.options.$b,c),b.__ko__hasDomDataOptionValue__=!0,b.value="number"=== - typeof c?c:"");break;case "select":if(""===c||null===c)c=n;for(var e=-1,f=0,g=b.options.length,h;f=h){c.push(p&&q.length?{key:p,value:q.join("")}:{unknown:p||q.join("")});p=h=0;q=[];continue}}else if(58===u){if(!h&&!p&&1===q.length){p=q.pop();continue}}else if(47===u&&1arguments.length){if(b=w.body,!b)throw Error("ko.applyBindings: could not find document.body; has the document been loaded?"); - }else if(!b||1!==b.nodeType&&8!==b.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");k(q(a,c),b);};a.Dc=function(b){return !b||1!==b.nodeType&&8!==b.nodeType?n:a.Td(b)};a.Ec=function(b){return (b=a.Dc(b))?b.$data:n};a.b("bindingHandlers",a.c);a.b("bindingEvent",a.i);a.b("bindingEvent.subscribe",a.i.subscribe);a.b("bindingEvent.startPossiblyAsyncContentBinding",a.i.Cb);a.b("applyBindings",a.vc);a.b("applyBindingsToDescendants",a.Oa); - a.b("applyBindingAccessorsToNode",a.ib);a.b("applyBindingsToNode",a.ld);a.b("contextFor",a.Dc);a.b("dataFor",a.Ec);})();(function(b){function c(c,e){var k=Object.prototype.hasOwnProperty.call(f,c)?f[c]:b,l;k?k.subscribe(e):(k=f[c]=new a.T,k.subscribe(e),d(c,function(b,d){var e=!(!d||!d.synchronous);g[c]={definition:b,Gd:e};delete f[c];l||e?k.notifySubscribers(b):a.na.zb(function(){k.notifySubscribers(b);});}),l=!0);}function d(a,b){e("getConfig",[a],function(c){c?e("loadComponent",[a,c],function(a){b(a, - c);}):b(null,null);});}function e(c,d,f,l){l||(l=a.j.loaders.slice(0));var g=l.shift();if(g){var q=g[c];if(q){var t=!1;if(q.apply(g,d.concat(function(a){t?f(null):null!==a?f(a):e(c,d,f,l);}))!==b&&(t=!0,!g.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");}else e(c,d,f,l);}else f(null);}var f={},g={};a.j={get:function(d,e){var f=Object.prototype.hasOwnProperty.call(g,d)?g[d]:b;f?f.Gd?a.u.G(function(){e(f.definition);}): - a.na.zb(function(){e(f.definition);}):c(d,e);},Bc:function(a){delete g[a];},oc:e};a.j.loaders=[];a.b("components",a.j);a.b("components.get",a.j.get);a.b("components.clearCachedDefinition",a.j.Bc);})();(function(){function b(b,c,d,e){function g(){0===--B&&e(h);}var h={},B=2,u=d.template;d=d.viewModel;u?f(c,u,function(c){a.j.oc("loadTemplate",[b,c],function(a){h.template=a;g();});}):g();d?f(c,d,function(c){a.j.oc("loadViewModel",[b,c],function(a){h[m]=a;g();});}):g();}function c(a,b,d){if("function"===typeof b)d(function(a){return new b(a)}); - else if("function"===typeof b[m])d(b[m]);else if("instance"in b){var e=b.instance;d(function(){return e});}else "viewModel"in b?c(a,b.viewModel,d):a("Unknown viewModel value: "+b);}function d(b){switch(a.a.R(b)){case "script":return a.a.ua(b.text);case "textarea":return a.a.ua(b.value);case "template":if(e(b.content))return a.a.Ca(b.content.childNodes)}return a.a.Ca(b.childNodes)}function e(a){return A.DocumentFragment?a instanceof DocumentFragment:a&&11===a.nodeType}function f(a,b,c){"string"===typeof b.require? - T||A.require?(T||A.require)([b.require],function(a){a&&"object"===typeof a&&a.Xd&&a["default"]&&(a=a["default"]);c(a);}):a("Uses require, but no AMD loader is present"):c(b);}function g(a){return function(b){throw Error("Component '"+a+"': "+b);}}var h={};a.j.register=function(b,c){if(!c)throw Error("Invalid configuration for "+b);if(a.j.tb(b))throw Error("Component "+b+" is already registered");h[b]=c;};a.j.tb=function(a){return Object.prototype.hasOwnProperty.call(h,a)};a.j.unregister=function(b){delete h[b]; - a.j.Bc(b);};a.j.Fc={getConfig:function(b,c){c(a.j.tb(b)?h[b]:null);},loadComponent:function(a,c,d){var e=g(a);f(e,c,function(c){b(a,e,c,d);});},loadTemplate:function(b,c,f){b=g(b);if("string"===typeof c)f(a.a.ua(c));else if(c instanceof Array)f(c);else if(e(c))f(a.a.la(c.childNodes));else if(c.element)if(c=c.element,A.HTMLElement?c instanceof HTMLElement:c&&c.tagName&&1===c.nodeType)f(d(c));else if("string"===typeof c){var h=w.getElementById(c);h?f(d(h)):b("Cannot find element with ID "+c);}else b("Unknown element type: "+ - c);else b("Unknown template value: "+c);},loadViewModel:function(a,b,d){c(g(a),b,d);}};var m="createViewModel";a.b("components.register",a.j.register);a.b("components.isRegistered",a.j.tb);a.b("components.unregister",a.j.unregister);a.b("components.defaultLoader",a.j.Fc);a.j.loaders.push(a.j.Fc);a.j.dd=h;})();(function(){function b(b,e){var f=b.getAttribute("params");if(f){var f=c.parseBindingsString(f,e,b,{valueAccessors:!0,bindingParams:!0}),f=a.a.Ga(f,function(c){return a.o(c,null,{l:b})}),g=a.a.Ga(f, - function(c){var e=c.v();return c.ja()?a.o({read:function(){return a.a.f(c())},write:a.Za(e)&&function(a){c()(a);},l:b}):e});Object.prototype.hasOwnProperty.call(g,"$raw")||(g.$raw=f);return g}return {$raw:{}}}a.j.getComponentNameForNode=function(b){var c=a.a.R(b);if(a.j.tb(c)&&(-1!=c.indexOf("-")||"[object HTMLUnknownElement]"==""+b||8>=a.a.W&&b.tagName===c))return c};a.j.tc=function(c,e,f,g){if(1===e.nodeType){var h=a.j.getComponentNameForNode(e);if(h){c=c||{};if(c.component)throw Error('Cannot use the "component" binding on a custom element matching a component'); - var m={name:h,params:b(e,f)};c.component=g?function(){return m}:m;}}return c};var c=new a.ga;9>a.a.W&&(a.j.register=function(a){return function(b){return a.apply(this,arguments)}}(a.j.register),w.createDocumentFragment=function(b){return function(){var c=b();a.j.dd;return c}}(w.createDocumentFragment));})();(function(){function b(b,c,d){c=c.template;if(!c)throw Error("Component '"+b+"' has no template");b=a.a.Ca(c);a.h.va(d,b);}function c(a,b,c){var d=a.createViewModel;return d?d.call(a, - b,c):b}var d=0;a.c.component={init:function(e,f,g,h,m){function k(){var a=l&&l.dispose;"function"===typeof a&&a.call(l);q&&q.s();p=l=q=null;}var l,p,q,t=a.a.la(a.h.childNodes(e));a.h.Ea(e);a.a.K.za(e,k);a.o(function(){var g=a.a.f(f()),h,u;"string"===typeof g?h=g:(h=a.a.f(g.name),u=a.a.f(g.params));if(!h)throw Error("No component name specified");var n=a.i.Cb(e,m),z=p=++d;a.j.get(h,function(d){if(p===z){k();if(!d)throw Error("Unknown component '"+h+"'");b(h,d,e);var f=c(d,u,{element:e,templateNodes:t}); - d=n.createChildContext(f,{extend:function(a){a.$component=f;a.$componentTemplateNodes=t;}});f&&f.koDescendantsComplete&&(q=a.i.subscribe(e,a.i.pa,f.koDescendantsComplete,f));l=f;a.Oa(d,e);}});},null,{l:e});return {controlsDescendantBindings:!0}}};a.h.ea.component=!0;})();var V={"class":"className","for":"htmlFor"};a.c.attr={update:function(b,c){var d=a.a.f(c())||{};a.a.P(d,function(c,d){d=a.a.f(d);var g=c.indexOf(":"),g="lookupNamespaceURI"in b&&0=a.a.W&&c in V?(c=V[c],h?b.removeAttribute(c):b[c]=d):h||(g?b.setAttributeNS(g,c,d):b.setAttribute(c,d));"name"===c&&a.a.Yc(b,h?"":d);});}};(function(){a.c.checked={after:["value","attr"],init:function(b,c,d){function e(){var e=b.checked,f=g();if(!a.S.Ya()&&(e||!m&&!a.S.qa())){var k=a.u.G(c);if(l){var q=p?k.v():k,z=t;t=f;z!==f?e&&(a.a.Na(q,f,!0),a.a.Na(q,z,!1)):a.a.Na(q,f,e);p&&a.Za(k)&&k(q);}else h&&(f===n?f=e:e||(f=n)),a.m.eb(k, - d,"checked",f,!0);}}function f(){var d=a.a.f(c()),e=g();l?(b.checked=0<=a.a.A(d,e),t=e):b.checked=h&&e===n?!!d:g()===d;}var g=a.xb(function(){if(d.has("checkedValue"))return a.a.f(d.get("checkedValue"));if(q)return d.has("value")?a.a.f(d.get("value")):b.value}),h="checkbox"==b.type,m="radio"==b.type;if(h||m){var k=c(),l=h&&a.a.f(k)instanceof Array,p=!(l&&k.push&&k.splice),q=m||l,t=l?g():n;m&&!b.name&&a.c.uniqueName.init(b,function(){return !0});a.o(e,null,{l:b});a.a.B(b,"click",e);a.o(f,null,{l:b}); - k=n;}}};a.m.wa.checked=!0;a.c.checkedValue={update:function(b,c){b.value=a.a.f(c());}};})();a.c["class"]={update:function(b,c){var d=a.a.Db(a.a.f(c()));a.a.Eb(b,b.__ko__cssValue,!1);b.__ko__cssValue=d;a.a.Eb(b,d,!0);}};a.c.css={update:function(b,c){var d=a.a.f(c());null!==d&&"object"==typeof d?a.a.P(d,function(c,d){d=a.a.f(d);a.a.Eb(b,c,d);}):a.c["class"].update(b,c);}};a.c.enable={update:function(b,c){var d=a.a.f(c());d&&b.disabled?b.removeAttribute("disabled"):d||b.disabled||(b.disabled=!0);}};a.c.disable= - {update:function(b,c){a.c.enable.update(b,function(){return !a.a.f(c())});}};a.c.event={init:function(b,c,d,e,f){var g=c()||{};a.a.P(g,function(g){"string"==typeof g&&a.a.B(b,g,function(b){var k,l=c()[g];if(l){try{var p=a.a.la(arguments);e=f.$data;p.unshift(e);k=l.apply(e,p);}finally{!0!==k&&(b.preventDefault?b.preventDefault():b.returnValue=!1);}!1===d.get(g+"Bubble")&&(b.cancelBubble=!0,b.stopPropagation&&b.stopPropagation());}});});}};a.c.foreach={Rc:function(b){return function(){var c=b(),d=a.a.bc(c); - if(!d||"number"==typeof d.length)return {foreach:c,templateEngine:a.ba.Ma};a.a.f(c);return {foreach:d.data,as:d.as,noChildContext:d.noChildContext,includeDestroyed:d.includeDestroyed,afterAdd:d.afterAdd,beforeRemove:d.beforeRemove,afterRender:d.afterRender,beforeMove:d.beforeMove,afterMove:d.afterMove,templateEngine:a.ba.Ma}}},init:function(b,c){return a.c.template.init(b,a.c.foreach.Rc(c))},update:function(b,c,d,e,f){return a.c.template.update(b,a.c.foreach.Rc(c),d,e,f)}};a.m.Ra.foreach=!1;a.h.ea.foreach= - !0;a.c.hasfocus={init:function(b,c,d){function e(e){b.__ko_hasfocusUpdating=!0;var f=b.ownerDocument;if("activeElement"in f){var g;try{g=f.activeElement;}catch(l){g=f.body;}e=g===b;}f=c();a.m.eb(f,d,"hasfocus",e,!0);b.__ko_hasfocusLastValue=e;b.__ko_hasfocusUpdating=!1;}var f=e.bind(null,!0),g=e.bind(null,!1);a.a.B(b,"focus",f);a.a.B(b,"focusin",f);a.a.B(b,"blur",g);a.a.B(b,"focusout",g);b.__ko_hasfocusLastValue=!1;},update:function(b,c){var d=!!a.a.f(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue=== - d||(d?b.focus():b.blur(),!d&&b.__ko_hasfocusLastValue&&b.ownerDocument.body.focus(),a.u.G(a.a.Fb,null,[b,d?"focusin":"focusout"]));}};a.m.wa.hasfocus=!0;a.c.hasFocus=a.c.hasfocus;a.m.wa.hasFocus="hasfocus";a.c.html={init:function(){return {controlsDescendantBindings:!0}},update:function(b,c){a.a.fc(b,c());}};(function(){function b(b,d,e){a.c[b]={init:function(b,c,h,m,k){var l,p,q={},t,x,n;if(d){m=h.get("as");var u=h.get("noChildContext");n=!(m&&u);q={as:m,noChildContext:u,exportDependencies:n};}x=(t= - "render"==h.get("completeOn"))||h.has(a.i.pa);a.o(function(){var h=a.a.f(c()),m=!e!==!h,u=!p,r;if(n||m!==l){x&&(k=a.i.Cb(b,k));if(m){if(!d||n)q.dataDependency=a.S.o();r=d?k.createChildContext("function"==typeof h?h:c,q):a.S.qa()?k.extend(null,q):k;}u&&a.S.qa()&&(p=a.a.Ca(a.h.childNodes(b),!0));m?(u||a.h.va(b,a.a.Ca(p)),a.Oa(r,b)):(a.h.Ea(b),t||a.i.ma(b,a.i.H));l=m;}},null,{l:b});return {controlsDescendantBindings:!0}}};a.m.Ra[b]=!1;a.h.ea[b]=!0;}b("if");b("ifnot",!1,!0);b("with",!0);})();a.c.let={init:function(b, - c,d,e,f){c=f.extend(c);a.Oa(c,b);return {controlsDescendantBindings:!0}}};a.h.ea.let=!0;var Q={};a.c.options={init:function(b){if("select"!==a.a.R(b))throw Error("options binding applies only to SELECT elements");for(;0g)var m=a.a.g.Z(),k=a.a.g.Z(),l=function(b){var c=this.activeElement;(c=c&&a.a.g.get(c,k))&&c(b);},p=function(b,c){var d=b.ownerDocument;a.a.g.get(d,m)||(a.a.g.set(d,m,!0),a.a.B(d,"selectionchange",l));a.a.g.set(b,k,c);};a.c.textInput={init:function(b,c,k){function l(c,d){a.a.B(b,c,d);}function m(){var d=a.a.f(c());if(null===d||d===n)d="";L!==n&&d===L?a.a.setTimeout(m,4):b.value!==d&&(y=!0,b.value=d,y=!1,v=b.value);}function r(){w||(L=b.value,w=a.a.setTimeout(z, - 4));}function z(){clearTimeout(w);L=w=n;var d=b.value;v!==d&&(v=d,a.m.eb(c(),k,"textInput",d));}var v=b.value,w,L,A=9==a.a.W?r:z,y=!1;g&&l("keypress",z);11>g&&l("propertychange",function(a){y||"value"!==a.propertyName||A();});8==g&&(l("keyup",z),l("keydown",z));p&&(p(b,A),l("dragend",r));(!g||9<=g)&&l("input",A);5>e&&"textarea"===a.a.R(b)?(l("keydown",r),l("paste",r),l("cut",r)):11>d?l("keydown",r):4>f?(l("DOMAutoComplete",z),l("dragdrop",z),l("drop",z)):h&&"number"===b.type&&l("keydown",r);l("change", - z);l("blur",z);a.o(m,null,{l:b});}};a.m.wa.textInput=!0;a.c.textinput={preprocess:function(a,b,c){c("textInput",a);}};})();a.c.uniqueName={init:function(b,c){if(c()){var d="ko_unique_"+ ++a.c.uniqueName.rd;a.a.Yc(b,d);}}};a.c.uniqueName.rd=0;a.c.using={init:function(b,c,d,e,f){var g;d.has("as")&&(g={as:d.get("as"),noChildContext:d.get("noChildContext")});c=f.createChildContext(c,g);a.Oa(c,b);return {controlsDescendantBindings:!0}}};a.h.ea.using=!0;a.c.value={init:function(b,c,d){var e=a.a.R(b),f="input"== - e;if(!f||"checkbox"!=b.type&&"radio"!=b.type){var g=[],h=d.get("valueUpdate"),m=!1,k=null;h&&("string"==typeof h?g=[h]:g=a.a.wc(h),a.a.Pa(g,"change"));var l=function(){k=null;m=!1;var e=c(),f=a.w.M(b);a.m.eb(e,d,"value",f);};!a.a.W||!f||"text"!=b.type||"off"==b.autocomplete||b.form&&"off"==b.form.autocomplete||-1!=a.a.A(g,"propertychange")||(a.a.B(b,"propertychange",function(){m=!0;}),a.a.B(b,"focus",function(){m=!1;}),a.a.B(b,"blur",function(){m&&l();}));a.a.D(g,function(c){var d=l;a.a.Ud(c,"after")&& - (d=function(){k=a.w.M(b);a.a.setTimeout(l,0);},c=c.substring(5));a.a.B(b,c,d);});var p;p=f&&"file"==b.type?function(){var d=a.a.f(c());null===d||d===n||""===d?b.value="":a.u.G(l);}:function(){var f=a.a.f(c()),g=a.w.M(b);if(null!==k&&f===k)a.a.setTimeout(p,0);else if(f!==g||g===n)"select"===e?(g=d.get("valueAllowUnset"),a.w.cb(b,f,g),g||f===a.w.M(b)||a.u.G(l)):a.w.cb(b,f);};if("select"===e){var q;a.i.subscribe(b,a.i.H,function(){q?d.get("valueAllowUnset")?p():l():(a.a.B(b,"change",l),q=a.o(p,null,{l:b}));}, - null,{notifyImmediately:!0});}else a.a.B(b,"change",l),a.o(p,null,{l:b});}else a.ib(b,{checkedValue:c});},update:function(){}};a.m.wa.value=!0;a.c.visible={update:function(b,c){var d=a.a.f(c()),e="none"!=b.style.display;d&&!e?b.style.display="":!d&&e&&(b.style.display="none");}};a.c.hidden={update:function(b,c){a.c.visible.update(b,function(){return !a.a.f(c())});}};(function(b){a.c[b]={init:function(c,d,e,f,g){return a.c.event.init.call(this,c,function(){var a={};a[b]=d();return a},e,f,g)}};})("click"); - a.ca=function(){};a.ca.prototype.renderTemplateSource=function(){throw Error("Override renderTemplateSource");};a.ca.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock");};a.ca.prototype.makeTemplateSource=function(b,c){if("string"==typeof b){c=c||w;var d=c.getElementById(b);if(!d)throw Error("Cannot find template with ID "+b);return new a.C.F(d)}if(1==b.nodeType||8==b.nodeType)return new a.C.ia(b);throw Error("Unknown template type: "+b);};a.ca.prototype.renderTemplate= - function(a,c,d,e){a=this.makeTemplateSource(a,e);return this.renderTemplateSource(a,c,d,e)};a.ca.prototype.isTemplateRewritten=function(a,c){return !1===this.allowTemplateRewriting?!0:this.makeTemplateSource(a,c).data("isRewritten")};a.ca.prototype.rewriteTemplate=function(a,c,d){a=this.makeTemplateSource(a,d);c=c(a.text());a.text(c);a.data("isRewritten",!0);};a.b("templateEngine",a.ca);a.kc=function(){function b(b,c,d,h){b=a.m.ac(b);for(var m=a.m.Ra,k=0;k]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi, - d=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return {xd:function(b,c,d){c.isTemplateRewritten(b,d)||c.rewriteTemplate(b,function(b){return a.kc.Ld(b,c)},d);},Ld:function(a,f){return a.replace(c,function(a,c,d,e,l){return b(l,c,d,f)}).replace(d,function(a,c){return b(c,"\x3c!-- ko --\x3e","#comment",f)})},md:function(b,c){return a.aa.Xb(function(d,h){var m=d.nextSibling;m&&m.nodeName.toLowerCase()===c&&a.ib(m,b,h);})}}}();a.b("__tr_ambtns",a.kc.md);(function(){a.C={};a.C.F=function(b){if(this.F=b){var c= - a.a.R(b);this.ab="script"===c?1:"textarea"===c?2:"template"==c&&b.content&&11===b.content.nodeType?3:4;}};a.C.F.prototype.text=function(){var b=1===this.ab?"text":2===this.ab?"value":"innerHTML";if(0==arguments.length)return this.F[b];var c=arguments[0];"innerHTML"===b?a.a.fc(this.F,c):this.F[b]=c;};var b=a.a.g.Z()+"_";a.C.F.prototype.data=function(c){if(1===arguments.length)return a.a.g.get(this.F,b+c);a.a.g.set(this.F,b+c,arguments[1]);};var c=a.a.g.Z();a.C.F.prototype.nodes=function(){var b=this.F; - if(0==arguments.length){var e=a.a.g.get(b,c)||{},f=e.lb||(3===this.ab?b.content:4===this.ab?b:n);if(!f||e.jd){var g=this.text();g&&g!==e.bb&&(f=a.a.Md(g,b.ownerDocument),a.a.g.set(b,c,{lb:f,bb:g,jd:!0}));}return f}e=arguments[0];this.ab!==n&&this.text("");a.a.g.set(b,c,{lb:e});};a.C.ia=function(a){this.F=a;};a.C.ia.prototype=new a.C.F;a.C.ia.prototype.constructor=a.C.ia;a.C.ia.prototype.text=function(){if(0==arguments.length){var b=a.a.g.get(this.F,c)||{};b.bb===n&&b.lb&&(b.bb=b.lb.innerHTML);return b.bb}a.a.g.set(this.F, - c,{bb:arguments[0]});};a.b("templateSources",a.C);a.b("templateSources.domElement",a.C.F);a.b("templateSources.anonymousTemplate",a.C.ia);})();(function(){function b(b,c,d){var e;for(c=a.h.nextSibling(c);b&&(e=b)!==c;)b=a.h.nextSibling(e),d(e,b);}function c(c,d){if(c.length){var e=c[0],f=c[c.length-1],g=e.parentNode,h=a.ga.instance,m=h.preprocessNode;if(m){b(e,f,function(a,b){var c=a.previousSibling,d=m.call(h,a);d&&(a===e&&(e=d[0]||b),a===f&&(f=d[d.length-1]||c));});c.length=0;if(!e)return;e===f?c.push(e): - (c.push(e,f),a.a.Ua(c,g));}b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.vc(d,b);});b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.aa.cd(b,[d]);});a.a.Ua(c,g);}}function d(a){return a.nodeType?a:0a.a.W?0:b.nodes)?b.nodes():null)return a.a.la(c.cloneNode(!0).childNodes);b=b.text();return a.a.ua(b,e)};a.ba.Ma=new a.ba;a.gc(a.ba.Ma);a.b("nativeTemplateEngine",a.ba);(function(){a.$a=function(){var a=this.Hd=function(){if(!v||!v.tmpl)return 0;try{if(0<=v.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(a){}return 1}(); - this.renderTemplateSource=function(b,e,f,g){g=g||w;f=f||{};if(2>a)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var h=b.data("precompiled");h||(h=b.text()||"",h=v.template(null,"{{ko_with $item.koBindingContext}}"+h+"{{/ko_with}}"),b.data("precompiled",h));b=[e.$data];e=v.extend({koBindingContext:e},f.templateOptions);e=v.tmpl(h,b,e);e.appendTo(g.createElement("div"));v.fragments={};return e};this.createJavaScriptEvaluatorBlock=function(a){return "{{ko_code ((function() { return "+ - a+" })()) }}"};this.addTemplate=function(a,b){w.write(""; - }; - SurveyTemplateText.prototype.replaceText = function (replaceText, id, questionType) { - if (questionType === void 0) { questionType = null; } - var posId = this.getId(id, questionType); - var pos = this.text.indexOf(posId); - if (pos < 0) { - this.addText(replaceText, id, questionType); - return; - } - pos = this.text.indexOf(">", pos); - if (pos < 0) - return; - var startPos = pos + 1; - var endString = ""; - pos = this.text.indexOf(endString, startPos); - if (pos < 0) - return; - this.text = - this.text.substr(0, startPos) + replaceText + this.text.substr(pos); - }; - SurveyTemplateText.prototype.getId = function (id, questionType) { - var result = 'id="survey-' + id; - if (questionType) { - result += "-" + questionType; - } - return result + '"'; - }; - Object.defineProperty(SurveyTemplateText.prototype, "text", { - get: function () { - return koTemplate; - }, - set: function (value) { - koTemplate = value; - }, - enumerable: false, - configurable: true - }); - return SurveyTemplateText; - }()); - - - - /***/ }), - - /***/ "./src/knockout/templates/comment.html": - /*!*********************************************!*\ - !*** ./src/knockout/templates/comment.html ***! - \*********************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = ""; - - /***/ }), - - /***/ "./src/knockout/templates/flowpanel.html": - /*!***********************************************!*\ - !*** ./src/knockout/templates/flowpanel.html ***! - \***********************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n\n"; - - /***/ }), - - /***/ "./src/knockout/templates/header.html": - /*!********************************************!*\ - !*** ./src/knockout/templates/header.html ***! - \********************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = ""; - - /***/ }), - - /***/ "./src/knockout/templates/index.html": - /*!*******************************************!*\ - !*** ./src/knockout/templates/index.html ***! - \*******************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n\n\n"; - - /***/ }), - - /***/ "./src/knockout/templates/page.html": - /*!******************************************!*\ - !*** ./src/knockout/templates/page.html ***! - \******************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/panel.html": - /*!*******************************************!*\ - !*** ./src/knockout/templates/panel.html ***! - \*******************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-boolean.html": - /*!******************************************************!*\ - !*** ./src/knockout/templates/question-boolean.html ***! - \******************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = ""; - - /***/ }), - - /***/ "./src/knockout/templates/question-buttongroup.html": - /*!**********************************************************!*\ - !*** ./src/knockout/templates/question-buttongroup.html ***! - \**********************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-checkbox.html": - /*!*******************************************************!*\ - !*** ./src/knockout/templates/question-checkbox.html ***! - \*******************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-comment.html": - /*!******************************************************!*\ - !*** ./src/knockout/templates/question-comment.html ***! - \******************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = ""; - - /***/ }), - - /***/ "./src/knockout/templates/question-composite.html": - /*!********************************************************!*\ - !*** ./src/knockout/templates/question-composite.html ***! - \********************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-custom.html": - /*!*****************************************************!*\ - !*** ./src/knockout/templates/question-custom.html ***! - \*****************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-dropdown.html": - /*!*******************************************************!*\ - !*** ./src/knockout/templates/question-dropdown.html ***! - \*******************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-empty.html": - /*!****************************************************!*\ - !*** ./src/knockout/templates/question-empty.html ***! - \****************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-errors.html": - /*!*****************************************************!*\ - !*** ./src/knockout/templates/question-errors.html ***! - \*****************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = ""; - - /***/ }), - - /***/ "./src/knockout/templates/question-expression.html": - /*!*********************************************************!*\ - !*** ./src/knockout/templates/question-expression.html ***! - \*********************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-file.html": - /*!***************************************************!*\ - !*** ./src/knockout/templates/question-file.html ***! - \***************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-html.html": - /*!***************************************************!*\ - !*** ./src/knockout/templates/question-html.html ***! - \***************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-image.html": - /*!****************************************************!*\ - !*** ./src/knockout/templates/question-image.html ***! - \****************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-imagepicker.html": - /*!**********************************************************!*\ - !*** ./src/knockout/templates/question-imagepicker.html ***! - \**********************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-matrix.html": - /*!*****************************************************!*\ - !*** ./src/knockout/templates/question-matrix.html ***! - \*****************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-matrixdynamic.html": - /*!************************************************************!*\ - !*** ./src/knockout/templates/question-matrixdynamic.html ***! - \************************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-multipletext.html": - /*!***********************************************************!*\ - !*** ./src/knockout/templates/question-multipletext.html ***! - \***********************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-paneldynamic-navigator.html": - /*!*********************************************************************!*\ - !*** ./src/knockout/templates/question-paneldynamic-navigator.html ***! - \*********************************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = ""; - - /***/ }), - - /***/ "./src/knockout/templates/question-paneldynamic.html": - /*!***********************************************************!*\ - !*** ./src/knockout/templates/question-paneldynamic.html ***! - \***********************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = ""; - - /***/ }), - - /***/ "./src/knockout/templates/question-radiogroup.html": - /*!*********************************************************!*\ - !*** ./src/knockout/templates/question-radiogroup.html ***! - \*********************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-ranking.html": - /*!******************************************************!*\ - !*** ./src/knockout/templates/question-ranking.html ***! - \******************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n\n\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-rating.html": - /*!*****************************************************!*\ - !*** ./src/knockout/templates/question-rating.html ***! - \*****************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question-signaturepad.html": - /*!***********************************************************!*\ - !*** ./src/knockout/templates/question-signaturepad.html ***! - \***********************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = ""; - - /***/ }), - - /***/ "./src/knockout/templates/question-text.html": - /*!***************************************************!*\ - !*** ./src/knockout/templates/question-text.html ***! - \***************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/question.html": - /*!**********************************************!*\ - !*** ./src/knockout/templates/question.html ***! - \**********************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = ""; - - /***/ }), - - /***/ "./src/knockout/templates/questiontitle.html": - /*!***************************************************!*\ - !*** ./src/knockout/templates/questiontitle.html ***! - \***************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = ""; - - /***/ }), - - /***/ "./src/knockout/templates/row.html": - /*!*****************************************!*\ - !*** ./src/knockout/templates/row.html ***! - \*****************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/rows.html": - /*!******************************************!*\ - !*** ./src/knockout/templates/rows.html ***! - \******************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = ""; - - /***/ }), - - /***/ "./src/knockout/templates/string.html": - /*!********************************************!*\ - !*** ./src/knockout/templates/string.html ***! - \********************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/knockout/templates/timerpanel.html": - /*!************************************************!*\ - !*** ./src/knockout/templates/timerpanel.html ***! - \************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = "\n"; - - /***/ }), - - /***/ "./src/list.ts": - /*!*********************!*\ - !*** ./src/list.ts ***! - \*********************/ - /*! exports provided: ListModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ListModel", function() { return ListModel; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - - - - var ListModel = /** @class */ (function (_super) { - __extends(ListModel, _super); - function ListModel(items, onItemSelect, allowSelection, selectedItem, onFilteredTextChange) { - var _this = _super.call(this) || this; - _this.onItemSelect = onItemSelect; - _this.allowSelection = allowSelection; - _this.onFilteredTextChange = onFilteredTextChange; - _this.selectItem = function (itemValue) { - _this.isExpanded = false; - if (_this.allowSelection) { - _this.selectedItem = itemValue; - } - if (!!_this.onItemSelect) { - _this.onItemSelect(itemValue); - } - }; - _this.isItemDisabled = function (itemValue) { - return itemValue.enabled !== undefined && !itemValue.enabled; - }; - _this.isItemSelected = function (itemValue) { - return !!_this.allowSelection && !!_this.selectedItem && _this.selectedItem.id == itemValue.id; - }; - _this.getItemClass = function (itemValue) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_2__["CssClassBuilder"]() - .append("sv-list__item") - .append("sv-list__item--disabled", _this.isItemDisabled(itemValue)) - .append("sv-list__item--selected", _this.isItemSelected(itemValue)) - .toString(); - }; - _this.getItemIndent = function (itemValue) { - var level = itemValue.level || 0; - return (level + 1) * ListModel.INDENT + "px"; - }; - _this.setItems(items); - _this.selectedItem = selectedItem; - return _this; - } - ListModel.prototype.hasText = function (item, filteredTextInLow) { - if (!filteredTextInLow) - return true; - var textInLow = (item.title || "").toLocaleLowerCase(); - return textInLow.indexOf(filteredTextInLow.toLocaleLowerCase()) > -1; - }; - ListModel.prototype.updateItemVisible = function (text) { - var _this = this; - this.actions.forEach(function (item) { - item.visible = _this.hasText(item, text); - }); - }; - ListModel.prototype.filterByText = function (text) { - if (!this.needFilter) - return; - if (!!this.onFilteredTextChange) { - this.onFilteredTextChange(text); - } - else { - this.updateItemVisible(text); - } - }; - ListModel.prototype.onSet = function () { - this.needFilter = (this.actions || []).length > ListModel.MINELEMENTCOUNT; - _super.prototype.onSet.call(this); - }; - Object.defineProperty(ListModel.prototype, "filteredTextPlaceholder", { - get: function () { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("filteredTextPlaceholder"); - }, - enumerable: false, - configurable: true - }); - ListModel.prototype.onKeyDown = function (event) { - var currentElement = event.target; - if (event.key === "ArrowDown" || event.keyCode === 40) { - if (!!currentElement.nextElementSibling) { - currentElement.nextElementSibling.focus(); - } - else { - currentElement.parentElement.firstElementChild && currentElement.parentElement.firstElementChild.focus(); - } - event.preventDefault(); - } - else if (event.key === "ArrowUp" || event.keyCode === 38) { - if (!!currentElement.previousElementSibling) { - currentElement.previousElementSibling.focus(); - } - else { - currentElement.parentElement.lastElementChild && currentElement.parentElement.lastElementChild.focus(); - } - event.preventDefault(); - } - }; - ListModel.prototype.onPointerDown = function (event, item) { }; - ListModel.prototype.refresh = function () { - this.filteredText = ""; - }; - ListModel.INDENT = 16; - ListModel.MINELEMENTCOUNT = 10; - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) - ], ListModel.prototype, "needFilter", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) - ], ListModel.prototype, "isExpanded", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])() - ], ListModel.prototype, "selectedItem", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ - onSet: function (_, target) { - target.filterByText(target.filteredText); - } - }) - ], ListModel.prototype, "filteredText", void 0); - return ListModel; - }(_actions_container__WEBPACK_IMPORTED_MODULE_1__["ActionContainer"])); - - - - /***/ }), - - /***/ "./src/localizablestring.ts": - /*!**********************************!*\ - !*** ./src/localizablestring.ts ***! - \**********************************/ - /*! exports provided: LocalizableString, LocalizableStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizableString", function() { return LocalizableString; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizableStrings", function() { return LocalizableStrings; }); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - - - - /** - * The class represents the string that supports multi-languages and markdown. - * It uses in all objects where support for multi-languages and markdown is required. - */ - var LocalizableString = /** @class */ (function () { - function LocalizableString(owner, useMarkdown, name) { - if (useMarkdown === void 0) { useMarkdown = false; } - this.owner = owner; - this.useMarkdown = useMarkdown; - this.name = name; - this.values = {}; - this.htmlValues = {}; - this.onCreating(); - } - Object.defineProperty(LocalizableString, "defaultLocale", { - get: function () { - return _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; - }, - set: function (val) { - _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName = val; - }, - enumerable: false, - configurable: true - }); - LocalizableString.prototype.getIsMultiple = function () { return false; }; - Object.defineProperty(LocalizableString.prototype, "locale", { - get: function () { - return this.owner && this.owner.getLocale ? this.owner.getLocale() : ""; - }, - enumerable: false, - configurable: true - }); - LocalizableString.prototype.strChanged = function () { - this.searchableText = undefined; - if (this.renderedText === undefined) - return; - this.calculatedTextValue = this.calcText(); - if (this.renderedText !== this.calculatedTextValue) { - this.renderedText = undefined; - this.calculatedTextValue = undefined; - } - this.onChanged(); - }; - Object.defineProperty(LocalizableString.prototype, "text", { - get: function () { - return this.pureText; - }, - set: function (value) { - this.setLocaleText(this.locale, value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LocalizableString.prototype, "calculatedText", { - get: function () { - this.renderedText = - this.calculatedTextValue !== undefined - ? this.calculatedTextValue - : this.calcText(); - this.calculatedTextValue = undefined; - return this.renderedText; - }, - enumerable: false, - configurable: true - }); - LocalizableString.prototype.calcText = function () { - var res = this.pureText; - if (res && - this.owner && - this.owner.getProcessedText && - res.indexOf("{") > -1) { - res = this.owner.getProcessedText(res); - } - if (this.onGetTextCallback) - res = this.onGetTextCallback(res); - return res; - }; - Object.defineProperty(LocalizableString.prototype, "pureText", { - get: function () { - var loc = this.locale; - if (!loc) - loc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; - var res = this.getValue(loc); - if (!res && loc == _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName) { - res = this.getValue(_surveyStrings__WEBPACK_IMPORTED_MODULE_1__["surveyLocalization"].defaultLocale); - } - if (!res && loc !== _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName) { - res = this.getValue(_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName); - } - if (!res && !!this.localizationName) { - res = _surveyStrings__WEBPACK_IMPORTED_MODULE_1__["surveyLocalization"].getString(this.localizationName); - } - if (!res) - res = ""; - return res; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LocalizableString.prototype, "hasHtml", { - get: function () { - return this.hasHtmlValue(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LocalizableString.prototype, "html", { - get: function () { - if (!this.hasHtml) - return ""; - return this.getHtmlValue(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LocalizableString.prototype, "isEmpty", { - get: function () { - return this.getValuesKeys().length == 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LocalizableString.prototype, "textOrHtml", { - get: function () { - return this.hasHtml ? this.getHtmlValue() : this.calculatedText; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LocalizableString.prototype, "renderedHtml", { - get: function () { - return this.textOrHtml; - }, - enumerable: false, - configurable: true - }); - LocalizableString.prototype.getLocaleText = function (loc) { - if (!loc) - loc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; - var res = this.getValue(loc); - return res ? res : ""; - }; - LocalizableString.prototype.getLocaleTextWithDefault = function (loc) { - var res = this.getLocaleText(loc); - if (!res && this.onGetDefaultTextCallback) { - return this.onGetDefaultTextCallback(); - } - return res; - }; - LocalizableString.prototype.setLocaleText = function (loc, value) { - if (value == this.getLocaleTextWithDefault(loc)) - return; - if (value && - loc && - loc != _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName && - !this.getValue(loc) && - value == this.getLocaleText(_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName)) - return; - var curLoc = this.locale; - if (!loc) - loc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; - if (!curLoc) - curLoc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; - var hasOnStrChanged = this.onStrChanged && loc === curLoc; - var oldValue = hasOnStrChanged ? this.pureText : undefined; - delete this.htmlValues[loc]; - if (!value) { - if (this.getValue(loc)) - this.deleteValue(loc); - } - else { - if (typeof value === "string") { - if (loc != _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName && - value == this.getLocaleText(_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName)) { - this.setLocaleText(loc, null); - } - else { - this.setValue(loc, value); - if (loc == _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName) { - this.deleteValuesEqualsToDefault(value); - } - } - } - } - this.strChanged(); - if (hasOnStrChanged) { - this.onStrChanged(oldValue, value); - } - }; - LocalizableString.prototype.hasNonDefaultText = function () { - var keys = this.getValuesKeys(); - if (keys.length == 0) - return false; - return keys.length > 1 || keys[0] != _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; - }; - LocalizableString.prototype.getLocales = function () { - var keys = this.getValuesKeys(); - if (keys.length == 0) - return []; - return keys; - }; - LocalizableString.prototype.getJson = function () { - if (!!this.sharedData) - return this.sharedData.getJson(); - var keys = this.getValuesKeys(); - if (keys.length == 0) - return null; - if (keys.length == 1 && - keys[0] == _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName && - !_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].serializeLocalizableStringAsObject) - return this.values[keys[0]]; - return this.values; - }; - LocalizableString.prototype.setJson = function (value) { - if (!!this.sharedData) { - this.sharedData.setJson(value); - return; - } - this.values = {}; - this.htmlValues = {}; - if (!value) - return; - if (typeof value === "string") { - this.setLocaleText(null, value); - } - else { - for (var key in value) { - this.setLocaleText(key, value[key]); - } - } - this.strChanged(); - }; - Object.defineProperty(LocalizableString.prototype, "renderAs", { - get: function () { - if (!this.owner || typeof this.owner.getRenderer !== "function") { - return LocalizableString.defaultRenderer; - } - return this.owner.getRenderer(this.name) || LocalizableString.defaultRenderer; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LocalizableString.prototype, "renderAsData", { - get: function () { - if (!this.owner || typeof this.owner.getRendererContext !== "function") { - return this; - } - return this.owner.getRendererContext(this) || this; - }, - enumerable: false, - configurable: true - }); - LocalizableString.prototype.equals = function (obj) { - if (!!this.sharedData) - return this.sharedData.equals(obj); - if (!obj || !obj.values) - return false; - return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isTwoValueEquals(this.values, obj.values, false, true, false); - }; - LocalizableString.prototype.setFindText = function (text) { - if (this.searchText == text) - return; - this.searchText = text; - if (!this.searchableText) { - var textOrHtml = this.textOrHtml; - this.searchableText = !!textOrHtml ? textOrHtml.toLowerCase() : ""; - } - var str = this.searchableText; - var index = !!str && !!text ? str.indexOf(text) : undefined; - if (index < 0) - index = undefined; - if (index != undefined || this.searchIndex != index) { - this.searchIndex = index; - if (!!this.onSearchChanged) { - this.onSearchChanged(); - } - } - return this.searchIndex != undefined; - }; - LocalizableString.prototype.onChanged = function () { }; - LocalizableString.prototype.onCreating = function () { }; - LocalizableString.prototype.hasHtmlValue = function () { - if (!this.owner || !this.useMarkdown) - return false; - var renderedText = this.calculatedText; - if (!renderedText) - return false; - var loc = this.locale; - if (!loc) - loc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; - this.htmlValues[loc] = this.owner.getMarkdownHtml(renderedText, this.name); - return this.htmlValues[loc] ? true : false; - }; - LocalizableString.prototype.getHtmlValue = function () { - var loc = this.locale; - if (!loc) - loc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; - return this.htmlValues[loc]; - }; - LocalizableString.prototype.deleteValuesEqualsToDefault = function (defaultValue) { - var keys = this.getValuesKeys(); - for (var i = 0; i < keys.length; i++) { - if (keys[i] == _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName) - continue; - if (this.getValue(keys[i]) == defaultValue) { - this.deleteValue(keys[i]); - } - } - }; - LocalizableString.prototype.getValue = function (loc) { - if (!!this.sharedData) - return this.sharedData.getValue(loc); - return this.values[loc]; - }; - LocalizableString.prototype.setValue = function (loc, value) { - if (!!this.sharedData) - this.sharedData.setValue(loc, value); - else - this.values[loc] = value; - }; - LocalizableString.prototype.deleteValue = function (loc) { - if (!!this.sharedData) - this.sharedData.deleteValue(loc); - else - delete this.values[loc]; - }; - LocalizableString.prototype.getValuesKeys = function () { - if (!!this.sharedData) - return this.sharedData.getValuesKeys(); - return Object.keys(this.values); - }; - LocalizableString.SerializeAsObject = false; - LocalizableString.defaultRenderer = "sv-string-viewer"; - LocalizableString.editableRenderer = "sv-string-editor"; - return LocalizableString; - }()); - - /** - * The class represents the list of strings that supports multi-languages. - */ - var LocalizableStrings = /** @class */ (function () { - function LocalizableStrings(owner) { - this.owner = owner; - this.values = {}; - } - LocalizableStrings.prototype.getIsMultiple = function () { return true; }; - Object.defineProperty(LocalizableStrings.prototype, "locale", { - get: function () { - return this.owner && this.owner.getLocale ? this.owner.getLocale() : ""; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LocalizableStrings.prototype, "value", { - get: function () { - return this.getValue(""); - }, - set: function (val) { - this.setValue("", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(LocalizableStrings.prototype, "text", { - get: function () { - return Array.isArray(this.value) ? this.value.join("\n") : ""; - }, - set: function (val) { - this.value = !!val ? val.split("\n") : []; - }, - enumerable: false, - configurable: true - }); - LocalizableStrings.prototype.getLocaleText = function (loc) { - var res = this.getValueCore(loc, !loc || loc === this.locale); - if (!res || !Array.isArray(res) || res.length == 0) - return ""; - return res.join("\n"); - }; - LocalizableStrings.prototype.setLocaleText = function (loc, newValue) { - var val = !!newValue ? newValue.split("\n") : null; - this.setValue(loc, val); - }; - LocalizableStrings.prototype.getValue = function (loc) { - return this.getValueCore(loc); - }; - LocalizableStrings.prototype.getValueCore = function (loc, useDefault) { - if (useDefault === void 0) { useDefault = true; } - loc = this.getLocale(loc); - if (this.values[loc]) - return this.values[loc]; - if (useDefault) { - var defLoc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; - if (loc !== defLoc && this.values[defLoc]) - return this.values[defLoc]; - } - return []; - }; - LocalizableStrings.prototype.setValue = function (loc, val) { - loc = this.getLocale(loc); - var oldValue = _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].createCopy(this.values); - if (!val || val.length == 0) { - delete this.values[loc]; - } - else { - this.values[loc] = val; - } - if (!!this.onValueChanged) { - this.onValueChanged(oldValue, this.values); - } - }; - LocalizableStrings.prototype.hasValue = function (loc) { - if (loc === void 0) { loc = ""; } - return !this.isEmpty && this.getValue(loc).length > 0; - }; - Object.defineProperty(LocalizableStrings.prototype, "isEmpty", { - get: function () { - return this.getValuesKeys().length == 0; - }, - enumerable: false, - configurable: true - }); - LocalizableStrings.prototype.getLocale = function (loc) { - if (!!loc) - return loc; - loc = this.locale; - return !!loc ? loc : _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; - }; - LocalizableStrings.prototype.getLocales = function () { - var keys = this.getValuesKeys(); - if (keys.length == 0) - return []; - return keys; - }; - LocalizableStrings.prototype.getJson = function () { - var keys = this.getValuesKeys(); - if (keys.length == 0) - return null; - if (keys.length == 1 && - keys[0] == _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName && - !_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].serializeLocalizableStringAsObject) - return this.values[keys[0]]; - return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].createCopy(this.values); - }; - LocalizableStrings.prototype.setJson = function (value) { - this.values = {}; - if (!value) - return; - if (Array.isArray(value)) { - this.setValue(null, value); - } - else { - for (var key in value) { - this.setValue(key, value[key]); - } - } - }; - LocalizableStrings.prototype.getValuesKeys = function () { - return Object.keys(this.values); - }; - return LocalizableStrings; - }()); - - - - /***/ }), - - /***/ "./src/localization/arabic.ts": - /*!************************************!*\ - !*** ./src/localization/arabic.ts ***! - \************************************/ - /*! exports provided: arabicSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "arabicSurveyStrings", function() { return arabicSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var arabicSurveyStrings = { - pagePrevText: "السابق", - pageNextText: "التالي", - completeText: "إرسال البيانات", - previewText: "معاينة", - editText: "تعديل", - startSurveyText: "بداية", - otherItemText: "نص آخر", - noneItemText: "لا شيء", - selectAllItemText: "اختر الكل", - progressText: "{1} صفحة {0} من", - panelDynamicProgressText: "سجل {0} من {1}", - questionsProgressText: "تمت الإجابة على أسئلة {0} / {1}", - emptySurvey: "لا توجد صفحة مرئية أو سؤال في النموذج", - completingSurvey: "شكرا لكم لاستكمال النموذج!", - completingSurveyBefore: "تظهر سجلاتنا أنك قد أكملت هذا الاستطلاع بالفعل.", - loadingSurvey: "...يتم تحميل النموذج", - optionsCaption: "...اختر", - value: "القيمة", - requiredError: ".يرجى الإجابة على السؤال", - requiredErrorInPanel: "الرجاء الإجابة على سؤال واحد على الأقل.", - requiredInAllRowsError: "يرجى الإجابة على الأسئلة في جميع الصفوف", - numericError: "يجب أن تكون القيمة رقمية.", - textMinLength: "الرجاء إدخال ما لا يقل عن {0} حروف", - textMaxLength: "الرجاء إدخال أقل من {0} حروف", - textMinMaxLength: "يرجى إدخال أكثر من {0} وأقل من {1} حروف", - minRowCountError: "يرجى ملء ما لا يقل عن {0} الصفوف", - minSelectError: "يرجى تحديد ما لا يقل عن {0} المتغيرات", - maxSelectError: "يرجى تحديد ما لا يزيد عن {0} المتغيرات", - numericMinMax: "و'{0}' يجب أن تكون مساوية أو أكثر من {1} وتساوي أو أقل من {2}ا", - numericMin: "و'{0}' يجب أن تكون مساوية أو أكثر من {1}ا", - numericMax: "و'{0}' يجب أن تكون مساوية أو أقل من {1}ا", - invalidEmail: "الرجاء إدخال بريد الكتروني صحيح", - invalidExpression: "يجب أن يعرض التعبير: {0} 'صواب'.", - urlRequestError: "طلب إرجاع خطأ '{0}'. {1}ا", - urlGetChoicesError: "عاد طلب البيانات فارغ أو 'المسار' غير صحيح ", - exceedMaxSize: "ينبغي ألا يتجاوز حجم الملف {0}ا", - otherRequiredError: "الرجاء إدخال قيمة أخرى", - uploadingFile: "تحميل الملف الخاص بك. يرجى الانتظار عدة ثوان والمحاولة لاحقًا", - loadingFile: "جار التحميل...", - chooseFile: "اختر الملفات...", - noFileChosen: "لم تقم باختيار ملف", - confirmDelete: "هل تريد حذف السجل؟", - keyDuplicationError: "يجب أن تكون هذه القيمة فريدة.", - addColumn: "أضف العمود", - addRow: "اضافة صف", - removeRow: "إزالة صف", - addPanel: "اضف جديد", - removePanel: "إزالة", - choices_Item: "بند", - matrix_column: "عمود", - matrix_row: "صف", - savingData: "يتم حفظ النتائج على الخادم ...", - savingDataError: "حدث خطأ ولم نتمكن من حفظ النتائج.", - savingDataSuccess: "تم حفظ النتائج بنجاح!", - saveAgainButton: "حاول مجددا", - timerMin: "دقيقة", - timerSec: "ثانية", - timerSpentAll: "لقد أنفقت {0} على هذه الصفحة و {1} إجمالاً.", - timerSpentPage: "لقد أنفقت {0} على هذه الصفحة.", - timerSpentSurvey: "لقد أنفقت {0} إجمالاً.", - timerLimitAll: "لقد أنفقت {0} من {1} في هذه الصفحة و {2} من إجمالي {3}.", - timerLimitPage: "لقد أنفقت {0} من {1} في هذه الصفحة.", - timerLimitSurvey: "لقد أنفقت {0} من إجمالي {1}.", - cleanCaption: "نظيف", - clearCaption: "واضح", - chooseFileCaption: "اختر ملف", - removeFileCaption: "قم بإزالة هذا الملف", - booleanCheckedLabel: "نعم", - booleanUncheckedLabel: "لا", - confirmRemoveFile: "هل أنت متأكد أنك تريد إزالة هذا الملف: {0}؟", - confirmRemoveAllFiles: "هل أنت متأكد أنك تريد إزالة كافة الملفات؟", - questionTitlePatternText: "عنوان السؤال", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ar"] = arabicSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ar"] = "العربية"; - - - /***/ }), - - /***/ "./src/localization/basque.ts": - /*!************************************!*\ - !*** ./src/localization/basque.ts ***! - \************************************/ - /*! exports provided: basqueSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "basqueSurveyStrings", function() { return basqueSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var basqueSurveyStrings = { - pagePrevText: "Aurrekoa", - pageNextText: "Hurrengoa", - completeText: "Bukatu", - previewText: "Aurrebista", - editText: "Editatu", - startSurveyText: "Hasi", - otherItemText: "Beste bat (zehaztu)", - noneItemText: "Bat ere ez", - selectAllItemText: "Guztia hautatu", - progressText: "{1}-(e)tik {0} orrialde", - panelDynamicProgressText: "{0} errigistro {1}-(e)tik", - questionsProgressText: "Erantzundako galderak {0}/{1}", - emptySurvey: "Ez dago orrialde bistaragarririk edo ez dago galderarik.", - completingSurvey: "Eskerrik asko galdetegia erantzuteagatik!", - completingSurveyBefore: "Gure datuek diote dagoeneko galdetegia erantzun duzula.", - loadingSurvey: "Galdetegia kargatzen...", - optionsCaption: "Hautatu...", - value: "balioa", - requiredError: "Mesedez, galdera erantzun.", - requiredErrorInPanel: "Mesedez, gutxienez galdera bat erantzun.", - requiredInAllRowsError: "Mesedez, errenkadako galdera guztiak erantzun.", - numericError: "Estimazioa zenbakizkoa izan behar du.", - minError: "Balioa ez da {0} baino txikiagoa izan behar", - maxError: "Balioa ez da {0} baino handiagoa izan behar", - textMinLength: "Mesedez, gutxienez {0} karaktere erabili behar dira.", - textMaxLength: "Mesedez, gehienez {0} karaktere erabili behar dira.", - textMinMaxLength: "Mesedez, gehienez {0} eta gutxienez {1} karaktere erabili behar dira.", - minRowCountError: "Mesedez, gutxienez {0} errenkada bete.", - minSelectError: "Mesedez, gutxienez {0} aukera hautatu.", - maxSelectError: "Mesedez, {0} aukera baino gehiago ez hautatu.", - numericMinMax: "El '{0}' debe de ser igual o más de {1} y igual o menos de {2}", - numericMin: "'{0}' {1} baino handiagoa edo berdin izan behar da", - numericMax: "'{0}' {1} baino txikiago edo berdin izan behar da", - invalidEmail: "Mesedez, baliozko emaila idatz ezazu.", - invalidExpression: "{0} adierazpenak 'egiazkoa' itzuli beharko luke.", - urlRequestError: "Eskaerak '{0}' errorea itzuli du. {1}", - urlGetChoicesError: "La solicitud regresó vacío de data o la propiedad 'trayectoria' no es correcta", - exceedMaxSize: "Fitxategiaren tamaina ez da {0} baino handiagoa izan behar.", - otherRequiredError: "Mesedez, beste estimazioa gehitu.", - uploadingFile: "Zure fitxategia igotzen ari da. Mesedez, segundo batzuk itxaron eta saiatu berriro.", - loadingFile: "Kargatzen...", - chooseFile: "Fitxategia(k) hautatu...", - noFileChosen: "Ez da inolako fitxategirik hautatu", - confirmDelete: "¿Erregistroa borratu nahi al duzu?", - keyDuplicationError: "Balio hau bakarra izan behar du.", - addColumn: "Zutabe bat gehitu", - addRow: "Errenkada bat gehitu", - removeRow: "Errenkada bat kendu", - emptyRowsText: "Ez dago errenkadarik.", - addPanel: "Berria gehitu", - removePanel: "Kendu", - choices_Item: "artikulua", - matrix_column: "Zutabea", - matrix_row: "Errenkada", - multipletext_itemname: "testua", - savingData: "Erantzunak zerbitzarian gordetzen ari dira...", - savingDataError: "Erroreren bat gertatu eta erantzunak ez dira zerbitzarian gorde ahal izan.", - savingDataSuccess: "Erantzunak egoki gorde dira!", - saveAgainButton: "Berriro saiatu.", - timerMin: "min", - timerSec: "seg", - timerSpentAll: "{0} erabili duzu orrialde honetan eta orotara {1}.", - timerSpentPage: "Zuk {0} erabili duzu.", - timerSpentSurvey: "Orotara gastatu duzu.", - timerLimitAll: "{0} gastatu duzu {1}-(e)tik orrialde honetan eta orotara {2} {3}-(e)tik.", - timerLimitPage: "{0} gastatu duzu orrialde honetan {1}-(e)tik.", - timerLimitSurvey: "Zuk orotara {0} gastatu duzu {1}-(e)tik.", - cleanCaption: "Garbitu", - clearCaption: "Hustu", - signaturePlaceHolder: "Sinatu hemen", - chooseFileCaption: "Fitxategia hautatu", - removeFileCaption: "Fitxategi hau ezabatu", - booleanCheckedLabel: "Bai", - booleanUncheckedLabel: "Ez", - confirmRemoveFile: "Ziur zaude hurrengo fitxategia ezabatu nahi duzula: {0}?", - confirmRemoveAllFiles: "Ziur al zaude fitxategi guztiak ezabatu nahi dituzula?", - questionTitlePatternText: "Galderaren izenburua", - modalCancelButtonText: "Ezeztatu", - modalApplyButtonText: "Ezarri", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["eu"] = basqueSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["eu"] = "Euskara"; - - - /***/ }), - - /***/ "./src/localization/bulgarian.ts": - /*!***************************************!*\ - !*** ./src/localization/bulgarian.ts ***! - \***************************************/ - /*! exports provided: bulgarianStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bulgarianStrings", function() { return bulgarianStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var bulgarianStrings = { - pagePrevText: "Назад", - pageNextText: "Напред", - completeText: "Край", - previewText: "Визуализация", - editText: "редактиране", - startSurveyText: "Начало", - otherItemText: "Друго (опишете)", - noneItemText: "Нито един", - selectAllItemText: "Всички", - progressText: "стр. {0}, общо стр. {1}", - panelDynamicProgressText: "Запис {0} от {1}", - questionsProgressText: "Отговорени на {0} / {1} въпроса", - emptySurvey: "Анкетата не съдържа видими страници или въпроси.", - completingSurvey: "Благодарим ви за участието в анкетата!", - completingSurveyBefore: "Изглежда, че вие вече сте попълнили анкетата.", - loadingSurvey: "Зареждане на анкетата...", - optionsCaption: "Изберете...", - value: "value", - requiredError: "Моля, отговорете на следния въпрос.", - requiredErrorInPanel: "Моля, отговорете поне на един от въпросите.", - requiredInAllRowsError: "Моля, отговорете на въпросите на всички редове.", - numericError: "Стойността следва да бъде число.", - textMinLength: "Моля, използвайте поне {0} символа.", - textMaxLength: "Моля, използвайте не повече от {0} символа.", - textMinMaxLength: "Моля, използвайте повече от {0} и по-малко от {1} символа.", - minRowCountError: "Моля, попълнете поне {0} реда.", - minSelectError: "Моля, изберете поне {0} варианта.", - maxSelectError: "Моля, изберете не повече от {0} варианта.", - numericMinMax: "Стойността '{0}' следва да бъде равна или по-голяма от {1} и равна или по-малка от {2}", - numericMin: "Стойността '{0}' следва да бъде равна или по-голяма от {1}", - numericMax: "Стойността '{0}' следва да бъде равна или по-малка от {1}", - invalidEmail: "Моля, въведете валиден адрес на електронна поща.", - invalidExpression: "Изразът: {0} трябва да дава резултат 'true' (истина).", - urlRequestError: "Заявката води до грешка '{0}'. {1}", - urlGetChoicesError: "Заявката не връща данни или частта 'path' (път до търсения ресурс на сървъра) е неправилно зададена", - exceedMaxSize: "Размерът на файла следва да не превишава {0}.", - otherRequiredError: "Моля, въведете другата стойност.", - uploadingFile: "Вашит файл се зарежда на сървъра. Моля, изчакайте няколко секунди и тогава опитвайте отново.", - loadingFile: "Зареждане...", - chooseFile: "Изберете файл(ове)...", - noFileChosen: "Няма избран файл", - confirmDelete: "Желаете ли да изтриете записа?", - keyDuplicationError: "Стойността следва да бъде уникална.", - addColumn: "Добавяне на колона", - addRow: "Добавяне на ред", - removeRow: "Премахване на ред", - addPanel: "Добавяне на панел", - removePanel: "Премахване на панел", - choices_Item: "елемент", - matrix_column: "Колона", - matrix_row: "Ред", - savingData: "Резултатите се запазват на сървъра...", - savingDataError: "Поради възникнала грешка резултатите не можаха да бъдат запазени.", - savingDataSuccess: "Резултатите бяха запазени успешно!", - saveAgainButton: "Нов опит", - timerMin: "мин", - timerSec: "сек", - timerSpentAll: "Вие използвахте {0} на тази страница и общо {1}.", - timerSpentPage: "Вие използвахте {0} на тази страница.", - timerSpentSurvey: "Вие използвахте общо {0}.", - timerLimitAll: "Вие изпозвахте {0} от {1} на тази страница и общо {2} от {3}.", - timerLimitPage: "Вие използвахте {0} от {1} на тази страница.", - timerLimitSurvey: "Вие използвахте общо {0} от {1}.", - cleanCaption: "Изчистване", - clearCaption: "Начално състояние", - chooseFileCaption: "Изберете файл", - removeFileCaption: "Премахване на файла", - booleanCheckedLabel: "Да", - booleanUncheckedLabel: "Не", - confirmRemoveFile: "Наистина ли искате да премахнете този файл: {0}?", - confirmRemoveAllFiles: "Наистина ли искате да премахнете всички файлове?", - questionTitlePatternText: "Заглавие на въпроса", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["bg"] = bulgarianStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["bg"] = "български"; - - - /***/ }), - - /***/ "./src/localization/catalan.ts": - /*!*************************************!*\ - !*** ./src/localization/catalan.ts ***! - \*************************************/ - /*! exports provided: catalanSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "catalanSurveyStrings", function() { return catalanSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var catalanSurveyStrings = { - pagePrevText: "Anterior", - pageNextText: "Següent", - completeText: "Complet", - otherItemText: "Un altre (descrigui)", - progressText: "Pàgina {0} de {1}", - emptySurvey: "No hi ha cap pàgina visible o pregunta a l'enquesta.", - completingSurvey: "Gràcies per completar l'enquesta!", - loadingSurvey: "L'enquesta s'està carregant ...", - optionsCaption: "Selecciona ...", - requiredError: "Si us plau contesti la pregunta.", - requiredInAllRowsError: "Si us plau contesti les preguntes de cada filera.", - numericError: "L'estimació ha de ser numèrica.", - textMinLength: "Si us plau entre almenys {0} símbols.", - textMaxLength: "Si us plau entre menys de {0} símbols.", - textMinMaxLength: "Si us plau entre més de {0} i menys de {1} símbols.", - minRowCountError: "Si us plau ompli almenys {0} fileres.", - minSelectError: "Si us plau seleccioni almenys {0} variants.", - maxSelectError: "Si us plau seleccioni no més de {0} variants.", - numericMinMax: "El '{0}' deu ser igual o més de {1} i igual o menys de {2}", - numericMin: "El '{0}' ha de ser igual o més de {1}", - numericMax: "El '{0}' ha de ser igual o menys de {1}", - invalidEmail: "Si us plau afegiu un correu electrònic vàlid.", - urlRequestError: "La sol·licitud va tornar error '{0}'. {1}", - urlGetChoicesError: "La sol·licitud va tornar buida de dates o la propietat 'trajectòria' no és correcta", - exceedMaxSize: "La mida de l'arxiu no pot excedir {0}.", - otherRequiredError: "Si us plau afegiu l'altra estimació.", - uploadingFile: "El seu arxiu s'està pujant. Si us plau esperi uns segons i intenteu-ho de nou.", - addRow: "Afegiu una filera", - removeRow: "Eliminar una filera", - choices_firstItem: "primer article", - choices_secondItem: "segon article", - choices_thirdItem: "tercer article", - matrix_column: "Columna", - matrix_row: "Filera" - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ca"] = catalanSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ca"] = "català"; - - - /***/ }), - - /***/ "./src/localization/croatian.ts": - /*!**************************************!*\ - !*** ./src/localization/croatian.ts ***! - \**************************************/ - /*! exports provided: croatianStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "croatianStrings", function() { return croatianStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var croatianStrings = { - pagePrevText: "Prethodni", - pageNextText: "Sljedeći", - completeText: "Kompletan", - previewText: "Pregled", - editText: "Uređivanje", - startSurveyText: "Početak", - otherItemText: "Ostali (opis)", - noneItemText: "Nitko", - selectAllItemText: "Select All", - progressText: "Stranica {0} od {1}", - panelDynamicProgressText: "Zapisa {0} od {1}", - questionsProgressText: "Odgovorio na {0}/{1} pitanja", - emptySurvey: "U anketi nema vidljive stranice ili pitanja.", - completingSurvey: "Hvala vam što ste završili anketu!", - completingSurveyBefore: "Naši zapisi pokazuju da ste već završili ovu anketu.", - loadingSurvey: "Anketa o učitavanje...", - optionsCaption: "Odaberite...", - value: "vrijednost", - requiredError: "Molim vas odgovorite na pitanje.", - requiredErrorInPanel: "Molim vas odgovorite na barem jedno pitanje.", - requiredInAllRowsError: "Odgovorite na pitanja u svim redovima.", - numericError: "Vrijednost bi trebala biti brojčana.", - textMinLength: "Unesite najmanje {0} znak(ova).", - textMaxLength: "Unesite manje od {0} znak(ova).", - textMinMaxLength: "Unesite više od {0} i manje od {1} znakova.", - minRowCountError: "Molimo ispunite najmanje {0} redaka.", - minSelectError: "Odaberite barem {0} varijante.", - maxSelectError: "Odaberite ne više od {0} varijanti.", - numericMinMax: "'{0}'bi trebao biti jednak ili više od {1} i jednak ili manji od {2}.", - numericMin: "'{0}' bi trebao biti jednak ili više od {1}.", - numericMax: "'{0}' bi trebao biti jednak ili manji od {1}", - invalidEmail: "Unesite valjanu e-mail adresu.", - invalidExpression: "Izraz: {0} treba vratiti 'true'.", - urlRequestError: "Zahtjev vratio pogrešku '{0}'. {1}", - urlGetChoicesError: "Zahtjev je vratio prazne podatke ili je 'path' svojstvo netočna.", - exceedMaxSize: "Veličina datoteke ne smije prelaziti {0}.", - otherRequiredError: "Unesite drugu vrijednost.", - uploadingFile: "Vaša datoteka se prenosi. Pričekajte nekoliko sekundi i pokušajte ponovno.", - loadingFile: "Učitavanje...", - chooseFile: "Odaberite datoteku...", - noFileChosen: "Nije odabrana datoteka", - confirmDelete: "Želite li izbrisati zapis?", - keyDuplicationError: "Ta bi vrijednost trebala biti jedinstvena.", - addColumn: "Dodavanje stupca", - addRow: "Dodavanje redaka", - removeRow: "Ukloniti", - addPanel: "Dodavanje novih", - removePanel: "Ukloniti", - choices_Item: "stavku", - matrix_column: "Stupca", - matrix_row: "Redak", - savingData: "Rezultati se spremaju na poslužitelju...", - savingDataError: "Došlo je do pogreške i nismo mogli spremiti rezultate.", - savingDataSuccess: "Rezultati su uspješno spremljeni!", - saveAgainButton: "Pokušaj ponovo", - timerMin: "min", - timerSec: "sec", - timerSpentAll: "Vi ste proveli {0} na ovoj stranici i {1} ukupno.", - timerSpentPage: "Potrošili ste {0} na ovu stranicu.", - timerSpentSurvey: "You have spent {0} in total. {0}.", - timerLimitAll: "Vi ste proveli {0} od {1} na ovoj stranici i {2} od {3} ukupno.", - timerLimitPage: "Potrošio si {0} od {1} na ovoj stranici.", - timerLimitSurvey: "Ukupno ste potrošili {0} od {1}.", - cleanCaption: "Očistiti", - clearCaption: "Očistiti", - chooseFileCaption: "Odaberite datoteku", - removeFileCaption: "Uklonite ovu datoteku", - booleanCheckedLabel: "Da", - booleanUncheckedLabel: "Ne", - confirmRemoveFile: "Jeste li sigurni da želite ukloniti ovu datoteku: {0}?", - confirmRemoveAllFiles: "Jeste li sigurni da želite ukloniti sve datoteke?", - questionTitlePatternText: "Naslov pitanja", - modalCancelButtonText: "Otkazati", - modalApplyButtonText: "Primijeniti", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["hr"] = croatianStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["hr"] = "hrvatski"; - - - /***/ }), - - /***/ "./src/localization/czech.ts": - /*!***********************************!*\ - !*** ./src/localization/czech.ts ***! - \***********************************/ - /*! exports provided: czechSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "czechSurveyStrings", function() { return czechSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var czechSurveyStrings = { - pagePrevText: "Předchozí", - pageNextText: "Další", - completeText: "Hotovo", - previewText: "Náhled", - editText: "Upravit", - startSurveyText: "Start", - otherItemText: "Jiná odpověď (napište)", - noneItemText: "Žádný", - selectAllItemText: "Vybrat vše", - progressText: "Strana {0} z {1}", - panelDynamicProgressText: "Záznam {0} z {1}", - questionsProgressText: "Zodpovězené otázky: {0} / {1}", - emptySurvey: "Průzkumu neobsahuje žádné otázky.", - completingSurvey: "Děkujeme za vyplnění průzkumu!", - completingSurveyBefore: "Naše záznamy ukazují, že jste tento průzkum již dokončili.", - loadingSurvey: "Probíhá načítání průzkumu...", - optionsCaption: "Vyber...", - value: "hodnota", - requiredError: "Odpovězte prosím na otázku.", - requiredErrorInPanel: "Please answer at least one question.", - requiredInAllRowsError: "Odpovězte prosím na všechny otázky.", - numericError: "V tomto poli lze zadat pouze čísla.", - textMinLength: "Zadejte prosím alespoň {0} znaků.", - textMaxLength: "Zadejte prosím méně než {0} znaků.", - textMinMaxLength: "Zadejte prosím více než {0} a méně než {1} znaků.", - minRowCountError: "Vyplňte prosím alespoň {0} řádků.", - minSelectError: "Vyberte prosím alespoň {0} varianty.", - maxSelectError: "Nevybírejte prosím více než {0} variant.", - numericMinMax: "Odpověď '{0}' by mělo být větší nebo rovno {1} a menší nebo rovno {2}", - numericMin: "Odpověď '{0}' by mělo být větší nebo rovno {1}", - numericMax: "Odpověď '{0}' by mělo být menší nebo rovno {1}", - invalidEmail: "Zadejte prosím platnou e-mailovou adresu.", - invalidExpression: "Výraz: {0} by měl vrátit hodnotu „true“.", - urlRequestError: "Požadavek vrátil chybu '{0}'. {1}", - urlGetChoicesError: "Požadavek nevrátil data nebo cesta je neplatná", - exceedMaxSize: "Velikost souboru by neměla být větší než {0}.", - otherRequiredError: "Zadejte prosím jinou hodnotu.", - uploadingFile: "Váš soubor se nahrává. Zkuste to prosím za několik sekund.", - loadingFile: "Načítání...", - chooseFile: "Vyberte soubory ...", - noFileChosen: "Není zvolený žádný soubor", - confirmDelete: "Chcete smazat záznam?", - keyDuplicationError: "Tato hodnota by měla být jedinečná.", - addColumn: "Přidat sloupec", - addRow: "Přidat řádek", - removeRow: "Odstranit", - addPanel: "Přidat nový", - removePanel: "Odstranit", - choices_Item: "položka", - matrix_column: "Sloupec", - matrix_row: "Řádek", - savingData: "Výsledky se ukládají na server ...", - savingDataError: "Došlo k chybě a výsledky jsme nemohli uložit.", - savingDataSuccess: "Výsledky byly úspěšně uloženy!", - saveAgainButton: "Zkus to znovu", - timerMin: "min", - timerSec: "sek", - timerSpentAll: "Na této stránce jste utratili celkem {0} a celkem {1}.", - timerSpentPage: "Na této stránce jste utratili {0}.", - timerSpentSurvey: "Celkem jste utratili {0}.", - timerLimitAll: "Na této stránce jste utratili {0} z {1} a celkem {2} z {3}.", - timerLimitPage: "Na této stránce jste strávili {0} z {1}.", - timerLimitSurvey: "Celkově jste utratili {0} z {1}.", - cleanCaption: "Čistý", - clearCaption: "Průhledná", - chooseFileCaption: "Vyberte soubor", - removeFileCaption: "Odeberte tento soubor", - booleanCheckedLabel: "Ano", - booleanUncheckedLabel: "Ne", - confirmRemoveFile: "Opravdu chcete odebrat tento soubor: {0}?", - confirmRemoveAllFiles: "Opravdu chcete odstranit všechny soubory?", - questionTitlePatternText: "Název otázky", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["cs"] = czechSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["cs"] = "čeština"; - - - /***/ }), - - /***/ "./src/localization/danish.ts": - /*!************************************!*\ - !*** ./src/localization/danish.ts ***! - \************************************/ - /*! exports provided: danishSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "danishSurveyStrings", function() { return danishSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var danishSurveyStrings = { - pagePrevText: "Tilbage", - pageNextText: "Videre", - completeText: "Færdig", - previewText: "Forpremiere", - editText: "Redigér", - startSurveyText: "Start", - otherItemText: "Valgfrit svar...", - noneItemText: "Ingen", - selectAllItemText: "Vælg alle", - progressText: "Side {0} af {1}", - panelDynamicProgressText: "Optag {0} af {1}", - questionsProgressText: "Besvarede {0} / {1} spørgsmål", - emptySurvey: "Der er ingen synlige spørgsmål.", - completingSurvey: "Mange tak for din besvarelse!", - completingSurveyBefore: "Vores data viser at du allerede har gennemført dette spørgeskema.", - loadingSurvey: "Spørgeskemaet hentes fra serveren...", - optionsCaption: "Vælg...", - value: "værdi", - requiredError: "Besvar venligst spørgsmålet.", - requiredErrorInPanel: "Besvar venligst mindst ét spørgsmål.", - requiredInAllRowsError: "Besvar venligst spørgsmål i alle rækker.", - numericError: "Angiv et tal.", - textMinLength: "Angiv mindst {0} tegn.", - textMaxLength: "Please enter less than {0} characters.", - textMinMaxLength: "Angiv mere end {0} og mindre end {1} tegn.", - minRowCountError: "Udfyld mindst {0} rækker.", - minSelectError: "Vælg venligst mindst {0} svarmulighed(er).", - maxSelectError: "Vælg venligst færre {0} svarmuligheder(er).", - numericMinMax: "'{0}' skal være lig med eller større end {1} og lig med eller mindre end {2}", - numericMin: "'{0}' skal være lig med eller større end {1}", - numericMax: "'{0}' skal være lig med eller mindre end {1}", - invalidEmail: "Angiv venligst en gyldig e-mail adresse.", - invalidExpression: "Udtrykket: {0} skal returnere 'true'.", - urlRequestError: "Forespørgslen returnerede fejlen '{0}'. {1}", - urlGetChoicesError: "Forespørgslen returnerede ingen data eller 'path' parameteren er forkert", - exceedMaxSize: "Filstørrelsen må ikke overstige {0}.", - otherRequiredError: "Angiv en værdi for dit valgfrie svar.", - uploadingFile: "Din fil bliver uploadet. Vent nogle sekunder og prøv eventuelt igen.", - loadingFile: "Indlæser...", - chooseFile: "Vælg fil(er)...", - noFileChosen: "Ingen fil er valgt", - confirmDelete: "Vil du fjerne den?", - keyDuplicationError: "Denne værdi skal være unik.", - addColumn: "Tilføj kolonne", - addRow: "Tilføj række", - removeRow: "Fjern", - addPanel: "Tilføj ny", - removePanel: "Fjern", - choices_Item: "valg", - matrix_column: "Kolonne", - matrix_row: "Række", - savingData: "Resultaterne bliver gemt på serveren...", - savingDataError: "Der opstod en fejl og vi kunne ikke gemme resultatet.", - savingDataSuccess: "Resultatet blev gemt!", - saveAgainButton: "Prøv igen", - timerMin: "min", - timerSec: "sek", - timerSpentAll: "Du har brugt {0} på denne side og {1} i alt.", - timerSpentPage: "Du har brugt {0} på denne side.", - timerSpentSurvey: "Du har brugt {0} i alt.", - timerLimitAll: "Du har brugt {0} af {1} på denne side og {2} af {3} i alt.", - timerLimitPage: "Du har brugt {0} af {1} på denne side.", - timerLimitSurvey: "Du har brugt {0} af {1} i alt.", - cleanCaption: "Rens", - clearCaption: "Fjern", - chooseFileCaption: "Vælg fil", - removeFileCaption: "Fjern denne fil", - booleanCheckedLabel: "Ja", - booleanUncheckedLabel: "Ingen", - confirmRemoveFile: "Er du sikker på, at du vil fjerne denne fil: {0}?", - confirmRemoveAllFiles: "Er du sikker på, at du vil fjerne alle filer?", - questionTitlePatternText: "Spørgsmåls titel", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["da"] = danishSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["da"] = "dansk"; - - - /***/ }), - - /***/ "./src/localization/dutch.ts": - /*!***********************************!*\ - !*** ./src/localization/dutch.ts ***! - \***********************************/ - /*! exports provided: dutchSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dutchSurveyStrings", function() { return dutchSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - //Created on behalf https://github.com/Frank13 - //Modified on behalf Roeland Verbakel - - var dutchSurveyStrings = { - pagePrevText: "Vorige", - pageNextText: "Volgende", - completeText: "Verzenden", - previewText: "Voorbeeld", - editText: "Bewerk", - startSurveyText: "Begin met", - otherItemText: "Anders, nl.", - noneItemText: "Geen", - selectAllItemText: "Selecteer Alles", - progressText: "Pagina {0} van {1}", - panelDynamicProgressText: "Record {0} of {1}", - questionsProgressText: "Geantwoord {0}/{1} vragen", - emptySurvey: "Er is geen zichtbare pagina of vraag in deze vragenlijst", - completingSurvey: "Bedankt voor het invullen van de vragenlijst", - completingSurveyBefore: "Onze gegevens tonen aan dat je deze vragenlijst reeds beantwoord hebt.", - loadingSurvey: "De vragenlijst is aan het laden...", - optionsCaption: "Kies...", - value: "waarde", - requiredError: "Dit is een vereiste vraag", - requiredErrorInPanel: "Gelieve ten minste een vraag te beantwoorden.", - requiredInAllRowsError: "Deze vraag vereist één antwoord per rij", - numericError: "Het antwoord moet een getal zijn", - textMinLength: "Vul minstens {0} karakters in", - textMaxLength: "Gelieve minder dan {0} karakters in te vullen.", - textMinMaxLength: "Gelieve meer dan {0} en minder dan {1} karakters in te vullen.", - minRowCountError: "Gelieve ten minste {0} rijen in te vullen.", - minSelectError: "Selecteer minimum {0} antwoorden", - maxSelectError: "Selecteer niet meer dan {0} antwoorden", - numericMinMax: "Uw antwoord '{0}' moet groter of gelijk zijn aan {1} en kleiner of gelijk aan {2}", - numericMin: "Uw antwoord '{0}' moet groter of gelijk zijn aan {1}", - numericMax: "Uw antwoord '{0}' moet groter of gelijk zijn aan {1}", - invalidEmail: "Vul een geldig e-mailadres in", - invalidExpression: "De uitdrukking: {0} moet 'waar' teruggeven.", - urlRequestError: "De vraag keerde een fout terug '{0}'. {1}", - urlGetChoicesError: "De vraag gaf een leeg antwoord terug of de 'pad' eigenschap is niet correct", - exceedMaxSize: "De grootte van het bestand mag niet groter zijn dan {0}", - otherRequiredError: "Vul het veld 'Anders, nl.' in", - uploadingFile: "Uw bestand wordt opgeladen. Gelieve enkele seconden te wachten en opnieuw te proberen.", - loadingFile: "Opladen...", - chooseFile: "Kies uw bestand(en)...", - noFileChosen: "Geen bestand gekozen", - confirmDelete: "Wil je deze gegevens verwijderen?", - keyDuplicationError: "Deze waarde moet uniek zijn.", - addColumn: "Voeg kolom toe", - addRow: "Voeg rij toe", - removeRow: "Verwijder", - addPanel: "Nieuwe toevoegen", - removePanel: "Verwijder", - choices_Item: "onderwerp", - matrix_column: "Kolom", - matrix_row: "Rij", - savingData: "De resultaten worden bewaard op de server...", - savingDataError: "Er was een probleem en we konden de resultaten niet bewaren.", - savingDataSuccess: "De resultaten werden succesvol bewaard!", - saveAgainButton: "Probeer opnieuw", - timerMin: "minimum", - timerSec: "sec", - timerSpentAll: "U heeft {0} gespendeerd op deze pagina en {1} in totaal.", - timerSpentPage: "U heeft {0} op deze pagina gespendeerd.", - timerSpentSurvey: "U heeft in totaal {0} gespendeerd.", - timerLimitAll: "U heeft {0} van {1} op deze pagina gespendeerd en {2} van {3} in totaal.", - timerLimitPage: "U heeft {0} van {1} gespendeerd op deze pagina.", - timerLimitSurvey: "U heeft {0} van {1} in het totaal.", - cleanCaption: "Kuis op", - clearCaption: "Kuis op", - chooseFileCaption: "Gekozen bestand", - removeFileCaption: "Verwijder deze file", - booleanCheckedLabel: "Ja", - booleanUncheckedLabel: "Neen", - confirmRemoveFile: "Bent u zeker dat u deze file wilt verwijderen: {0}?", - confirmRemoveAllFiles: "Bent u zeker dat u al deze files wilt verwijderen?", - questionTitlePatternText: "Titel van de vraag", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["nl"] = dutchSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["nl"] = "nederlands"; - - - /***/ }), - - /***/ "./src/localization/english.ts": - /*!*************************************!*\ - !*** ./src/localization/english.ts ***! - \*************************************/ - /*! exports provided: englishStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "englishStrings", function() { return englishStrings; }); - //Uncomment this line on creating a translation file - //import { surveyLocalization } from "../surveyStrings"; - var englishStrings = { - pagePrevText: "Previous", - pageNextText: "Next", - completeText: "Complete", - previewText: "Preview", - editText: "Edit", - startSurveyText: "Start", - otherItemText: "Other (describe)", - noneItemText: "None", - selectAllItemText: "Select All", - progressText: "Page {0} of {1}", - panelDynamicProgressText: "Record {0} of {1}", - questionsProgressText: "Answered {0}/{1} questions", - emptySurvey: "There is no visible page or question in the survey.", - completingSurvey: "Thank you for completing the survey!", - completingSurveyBefore: "Our records show that you have already completed this survey.", - loadingSurvey: "Loading Survey...", - optionsCaption: "Choose...", - value: "value", - requiredError: "Response required.", - requiredErrorInPanel: "Response required: answer at least one question.", - requiredInAllRowsError: "Response required: answer questions in all rows.", - numericError: "The value should be numeric.", - minError: "The value should not be less than {0}", - maxError: "The value should not be greater than {0}", - textMinLength: "Please enter at least {0} character(s).", - textMaxLength: "Please enter no more than {0} character(s).", - textMinMaxLength: "Please enter at least {0} and no more than {1} characters.", - minRowCountError: "Please fill in at least {0} row(s).", - minSelectError: "Please select at least {0} variant(s).", - maxSelectError: "Please select no more than {0} variant(s).", - numericMinMax: "The '{0}' should be at least {1} and at most {2}", - numericMin: "The '{0}' should be at least {1}", - numericMax: "The '{0}' should be at most {1}", - invalidEmail: "Please enter a valid e-mail address.", - invalidExpression: "The expression: {0} should return 'true'.", - urlRequestError: "The request returned error '{0}'. {1}", - urlGetChoicesError: "The request returned empty data or the 'path' property is incorrect", - exceedMaxSize: "The file size should not exceed {0}.", - otherRequiredError: "Response required: enter another value.", - uploadingFile: "Your file is uploading. Please wait several seconds and try again.", - loadingFile: "Loading...", - chooseFile: "Choose file(s)...", - noFileChosen: "No file chosen", - fileDragAreaPlaceholder: "Drop a file here or click the button below to load the file.", - confirmDelete: "Do you want to delete the record?", - keyDuplicationError: "This value should be unique.", - addColumn: "Add column", - addRow: "Add row", - removeRow: "Remove", - emptyRowsText: "There are no rows.", - addPanel: "Add new", - removePanel: "Remove", - choices_Item: "item", - matrix_column: "Column", - matrix_row: "Row", - multipletext_itemname: "text", - savingData: "The results are being saved on the server...", - savingDataError: "An error occurred and we could not save the results.", - savingDataSuccess: "The results were saved successfully!", - saveAgainButton: "Try again", - timerMin: "min", - timerSec: "sec", - timerSpentAll: "You have spent {0} on this page and {1} in total.", - timerSpentPage: "You have spent {0} on this page.", - timerSpentSurvey: "You have spent {0} in total.", - timerLimitAll: "You have spent {0} of {1} on this page and {2} of {3} in total.", - timerLimitPage: "You have spent {0} of {1} on this page.", - timerLimitSurvey: "You have spent {0} of {1} in total.", - cleanCaption: "Clean", - clearCaption: "Clear", - signaturePlaceHolder: "Sign here", - chooseFileCaption: "Choose file", - removeFileCaption: "Remove this file", - booleanCheckedLabel: "Yes", - booleanUncheckedLabel: "No", - confirmRemoveFile: "Are you sure that you want to remove this file: {0}?", - confirmRemoveAllFiles: "Are you sure that you want to remove all files?", - questionTitlePatternText: "Question Title", - modalCancelButtonText: "Cancel", - modalApplyButtonText: "Apply", - filteredTextPlaceholder: "Type to search...", - }; - //Uncomment these two lines on creating a translation file. You should replace "en" and enStrings with your locale ("fr", "de" and so on) and your variable. - //surveyLocalization.locales["en"] = englishStrings; - //surveyLocalization.localeNames["en"] = "English"; - - - /***/ }), - - /***/ "./src/localization/estonian.ts": - /*!**************************************!*\ - !*** ./src/localization/estonian.ts ***! - \**************************************/ - /*! exports provided: estonianSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "estonianSurveyStrings", function() { return estonianSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var estonianSurveyStrings = { - pagePrevText: "Tagasi", - pageNextText: "Edasi", - completeText: "Lõpeta", - previewText: "Eelvaade", - editText: "Muuda", - startSurveyText: "Alusta", - otherItemText: "Muu (täpsusta)", - noneItemText: "Mitte midagi", - selectAllItemText: "Vali kõik", - progressText: "Lehekülg {0}/{1}", - panelDynamicProgressText: "Kirje {0}/{1}", - questionsProgressText: "Vastatud {0} küsimust {1}-st", - emptySurvey: "Selles uuringus ei ole ühtki nähtavat lehekülge või küsimust.", - completingSurvey: "Aitäh, et vastasid ankeedile!", - completingSurveyBefore: "Meie andmetel oled sa sellele ankeedile juba vastanud.", - loadingSurvey: "Laen ankeeti...", - optionsCaption: "Vali...", - value: "väärtus", - requiredError: "Palun vasta küsimusele.", - requiredErrorInPanel: "Palun vasta vähemalt ühele küsimusele.", - requiredInAllRowsError: "Palun anna vastus igal real.", - numericError: "See peaks olema numbriline väärtus.", - textMinLength: "Palun sisesta vähemalt {0} tähemärki.", - textMaxLength: "Palun ära sisesta rohkem kui {0} tähemärki.", - textMinMaxLength: "Sisesta palun {0} - {1} tähemärki.", - minRowCountError: "Sisesta plaun vähemalt {0} rida.", - minSelectError: "Palun vali vähemalt {0} varianti.", - maxSelectError: "Palun vali kõige rohkem {0} varianti.", - numericMinMax: "'{0}' peaks olema võrdne või suurem kui {1} ja võrdne või väiksem kui {2}", - numericMin: "'{0}' peaks olema võrdne või suurem kui {1}", - numericMax: "'{0}' peaks olema võrnde või väiksem kui {1}", - invalidEmail: "Sisesta palun korrektne e-posti aadress.", - invalidExpression: "Avaldis: {0} peaks tagastama tõese.", - urlRequestError: "Taotlus tagastas vea „{0}”. {1}", - urlGetChoicesError: "Taotlus tagastas tühjad andmed või atribuut 'path' on vale", - exceedMaxSize: "Faili suurus ei tohi ületada {0}.", - otherRequiredError: "Sisesta palun muu vastus.", - uploadingFile: "Sinu fail laeb üles. Palun oota mõned sekundid ning proovi seejärel uuesti.", - loadingFile: "Laen...", - chooseFile: "Vali fail(id)...", - noFileChosen: "Faili pole valitud", - confirmDelete: "Kas tahad kirje kustutada?", - keyDuplicationError: "See väärtus peab olema unikaalne.", - addColumn: "Lisa veerg", - addRow: "Lisa rida", - removeRow: "Eemalda", - addPanel: "Lisa uus", - removePanel: "Eemalda", - choices_Item: "üksus", - matrix_column: "Veerg", - matrix_row: "Rida", - savingData: "Salvestan andmed serveris...", - savingDataError: "Tekkis viga ning me ei saanud vastuseid salvestada.", - savingDataSuccess: "Vastuste salvestamine õnnestus!", - saveAgainButton: "Proovi uuesti", - timerMin: "min", - timerSec: "sek", - timerSpentAll: "Oled veetnud {0} sellel lehel ning kokku {1}.", - timerSpentPage: "Oled veetnud {0} sellel lehel.", - timerSpentSurvey: "Oled veetnud {0} kokku.", - timerLimitAll: "Oled kulutanud {0} võimalikust {1} sellel lehel ning {2} võimalikust {3} kokku.", - timerLimitPage: "Oled kulutanud {0} võimalikust {1} sellel lehel.", - timerLimitSurvey: "Oled kulutanud {0} võimalikust {1} koguajast.", - cleanCaption: "Puhasta", - clearCaption: "Puhasta", - chooseFileCaption: "Vali fail", - removeFileCaption: "Eemalda see fail", - booleanCheckedLabel: "Jah", - booleanUncheckedLabel: "Ei", - confirmRemoveFile: "Oled sa kindel, et soovid selle faili eemaldada: {0}?", - confirmRemoveAllFiles: "Oled sa kindel, et soovid eemaldada kõik failid?", - questionTitlePatternText: "Küsimuse pealkiri", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["et"] = estonianSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["et"] = "eesti keel"; - - - /***/ }), - - /***/ "./src/localization/finnish.ts": - /*!*************************************!*\ - !*** ./src/localization/finnish.ts ***! - \*************************************/ - /*! exports provided: finnishSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "finnishSurveyStrings", function() { return finnishSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var finnishSurveyStrings = { - pagePrevText: "Edellinen", - pageNextText: "Seuraava", - completeText: "Valmis", - previewText: "Esikatselu", - editText: "Muokkaa", - startSurveyText: "Aloita", - otherItemText: "Muu (tarkenna)", - noneItemText: "Ei mitään", - selectAllItemText: "Valitse kaikki", - progressText: "Sivu {0} / {1}", - panelDynamicProgressText: "Osio {0} / {1}", - questionsProgressText: "Olet vastannut {0} / {1} kysymykseen.", - emptySurvey: "Tässä kyselyssä ei ole yhtään näkyvillä olevaa sivua tai kysymystä.", - completingSurvey: "Kiitos kyselyyn vastaamisesta!", - completingSurveyBefore: "Tietojemme mukaan olet jo suorittanut tämän kyselyn.", - loadingSurvey: "Kyselyä ladataan palvelimelta...", - optionsCaption: "Valitse...", - value: "arvo", - requiredError: "Vastaa kysymykseen, kiitos.", - requiredErrorInPanel: "Vastaa ainakin yhteen kysymykseen.", - requiredInAllRowsError: "Vastaa kysymyksiin kaikilla riveillä.", - numericError: "Arvon tulee olla numeerinen.", - textMinLength: "Syötä vähintään {0} merkkiä.", - textMaxLength: "Älä syötä yli {0} merkkiä.", - textMinMaxLength: "Syötä vähintään {0} ja enintään {1} merkkiä.", - minRowCountError: "Täytä vähintään {0} riviä.", - minSelectError: "Valitse vähintään {0} vaihtoehtoa.", - maxSelectError: "Valitse enintään {0} vaihtoehtoa.", - numericMinMax: "Luvun '{0}' tulee olla vähintään {1} ja korkeintaan {2}.", - numericMin: "Luvun '{0}' tulee olla vähintään {1}.", - numericMax: "Luvun '{0}' tulee olla korkeintaan {1}.", - invalidEmail: "Syötä validi sähköpostiosoite.", - invalidExpression: "Lausekkeen: {0} pitäisi palauttaa 'true'.", - urlRequestError: "Pyyntö palautti virheen {0}. {1}", - urlGetChoicesError: "Pyyntö palautti tyhjän tiedoston tai 'path'-asetus on väärä", - exceedMaxSize: "Tiedoston koko ei saa olla suurempi kuin {0}.", - otherRequiredError: "Tarkenna vastaustasi tekstikenttään.", - uploadingFile: "Tiedostoa lähetetään. Odota muutama sekunti ja yritä uudelleen.", - loadingFile: "Ladataan...", - chooseFile: "Valitse tiedosto(t)...", - noFileChosen: "Ei tiedostoa valittuna", - confirmDelete: "Haluatko poistaa osion?", - keyDuplicationError: "Tämä arvo on jo käytössä. Syötä toinen arvo.", - addColumn: "Lisää sarake", - addRow: "Lisää rivi", - removeRow: "Poista", - emptyRowsText: "Ei rivejä", - addPanel: "Lisää uusi", - removePanel: "Poista", - choices_Item: "kohde", - matrix_column: "Sarake", - matrix_row: "Rivi", - savingData: "Tietoja tallennetaan palvelimelle...", - savingDataError: "Tapahtui virhe, emmekä voineet tallentaa kyselyn tietoja.", - savingDataSuccess: "Tiedot tallennettiin onnistuneesti!", - saveAgainButton: "Yritä uudelleen", - timerMin: "min", - timerSec: "sek", - timerSpentAll: "Olet käyttänyt {0} tällä sivulla ja yhteensä {1}.", - timerSpentPage: "Olet käyttänyt {0} tällä sivulla.", - timerSpentSurvey: "Olet käyttänyt yhteensä {0}.", - timerLimitAll: "Olet käyttänyt tällä sivulla {0} / {1} ja yhteensä {2} / {3}.", - timerLimitPage: "Olet käyttänyt {0} / {1} tällä sivulla.", - timerLimitSurvey: "Olet käyttänyt yhteensä {0} / {1}.", - cleanCaption: "Pyyhi", - clearCaption: "Tyhjennä", - chooseFileCaption: "Valitse tiedosto", - removeFileCaption: "Poista tämä tiedosto", - booleanCheckedLabel: "Kyllä", - booleanUncheckedLabel: "Ei", - confirmRemoveFile: "Haluatko varmasti poistaa tämän tiedoston: {0}?", - confirmRemoveAllFiles: "Haluatko varmasti poistaa kaikki tiedostot?", - questionTitlePatternText: "Kysymyksen otsikko", - modalCancelButtonText: "Peruuta", - modalApplyButtonText: "Käytä", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["fi"] = finnishSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["fi"] = "suomi"; - - - /***/ }), - - /***/ "./src/localization/french.ts": - /*!************************************!*\ - !*** ./src/localization/french.ts ***! - \************************************/ - /*! exports provided: frenchSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "frenchSurveyStrings", function() { return frenchSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var frenchSurveyStrings = { - pagePrevText: "Précédent", - pageNextText: "Suivant", - completeText: "Terminer", - previewText: "Aperçu", - editText: "Modifier", - startSurveyText: "Commencer", - otherItemText: "Autre (préciser)", - noneItemText: "Aucun", - selectAllItemText: "Tout sélectionner", - progressText: "Page {0} sur {1}", - panelDynamicProgressText: "Enregistrement {0} sur {1}", - questionsProgressText: "{0}/{1} question(s) répondue(s)", - emptySurvey: "Il n'y a ni page visible ni question visible dans ce questionnaire", - completingSurvey: "Merci d'avoir répondu au questionnaire !", - completingSurveyBefore: "Nos données indiquent que vous avez déjà rempli ce questionnaire.", - loadingSurvey: "Le questionnaire est en cours de chargement...", - optionsCaption: "Choisissez...", - value: "valeur", - requiredError: "La réponse à cette question est obligatoire.", - requiredErrorInPanel: "Merci de répondre au moins à une question.", - requiredInAllRowsError: "Toutes les lignes sont obligatoires", - numericError: "La réponse doit être un nombre.", - textMinLength: "Merci de saisir au moins {0} caractères.", - textMaxLength: "Merci de saisir moins de {0} caractères.", - textMinMaxLength: "Merci de saisir entre {0} et {1} caractères.", - minRowCountError: "Merci de compléter au moins {0} lignes.", - minSelectError: "Merci de sélectionner au minimum {0} réponses.", - maxSelectError: "Merci de sélectionner au maximum {0} réponses.", - numericMinMax: "Votre réponse '{0}' doit être supérieure ou égale à {1} et inférieure ou égale à {2}", - numericMin: "Votre réponse '{0}' doit être supérieure ou égale à {1}", - numericMax: "Votre réponse '{0}' doit être inférieure ou égale à {1}", - invalidEmail: "Merci d'entrer une adresse mail valide.", - invalidExpression: "L'expression: {0} doit retourner 'true'.", - urlRequestError: "La requête a renvoyé une erreur '{0}'. {1}", - urlGetChoicesError: "La requête a renvoyé des données vides ou la propriété 'path' est incorrecte", - exceedMaxSize: "La taille du fichier ne doit pas excéder {0}.", - otherRequiredError: "Merci de préciser le champ 'Autre'.", - uploadingFile: "Votre fichier est en cours de chargement. Merci d'attendre quelques secondes et de réessayer.", - loadingFile: "Chargement...", - chooseFile: "Ajouter des fichiers...", - noFileChosen: "Aucun fichier ajouté", - confirmDelete: "Voulez-vous supprimer cet enregistrement ?", - keyDuplicationError: "Cette valeur doit être unique.", - addColumn: "Ajouter une colonne", - addRow: "Ajouter une ligne", - removeRow: "Supprimer", - addPanel: "Ajouter", - removePanel: "Supprimer", - choices_Item: "item", - matrix_column: "Colonne", - matrix_row: "Ligne", - savingData: "Les résultats sont en cours de sauvegarde sur le serveur...", - savingDataError: "Une erreur est survenue et a empêché la sauvegarde des résultats.", - savingDataSuccess: "Les résultats ont bien été enregistrés !", - saveAgainButton: "Réessayer", - timerMin: "min", - timerSec: "sec", - timerSpentAll: "Vous avez passé {0} sur cette page et {1} au total.", - timerSpentPage: "Vous avez passé {0} sur cette page.", - timerSpentSurvey: "Vous avez passé {0} au total.", - timerLimitAll: "Vous avez passé {0} sur {1} sur cette page et {2} sur {3} au total.", - timerLimitPage: "Vous avez passé {0} sur {1} sur cette page.", - timerLimitSurvey: "Vous avez passé {0} sur {1} au total.", - cleanCaption: "Nettoyer", - clearCaption: "Vider", - chooseFileCaption: "Ajouter un fichier", - removeFileCaption: "Enlever ce fichier", - booleanCheckedLabel: "Oui", - booleanUncheckedLabel: "Non", - confirmRemoveFile: "Êtes-vous certains de vouloir supprimer ce fichier : {0}?", - confirmRemoveAllFiles: "Êtes-vous certains de vouloir supprimer tous les fichiers?", - questionTitlePatternText: "Titre de la question", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["fr"] = frenchSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["fr"] = "français"; - - - /***/ }), - - /***/ "./src/localization/georgian.ts": - /*!**************************************!*\ - !*** ./src/localization/georgian.ts ***! - \**************************************/ - /*! exports provided: georgianSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "georgianSurveyStrings", function() { return georgianSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var georgianSurveyStrings = { - pagePrevText: "უკან", - pageNextText: "შემდეგ", - completeText: "დასრულება", - progressText: "გვერდი {0} / {1}", - emptySurvey: "არცერთი კითხვა არ არის.", - completingSurvey: "გმადლობთ კითხვარის შევსებისთვის!", - loadingSurvey: "ჩატვირთვა სერვერიდან...", - otherItemText: "სხვა (გთხოვთ მიუთითეთ)", - optionsCaption: "არჩევა...", - requiredError: "გთხოვთ უპასუხეთ კითხვას.", - numericError: "პასუხი უნდა იყოს რიცხვი.", - textMinLength: "გთხოვთ შეიყვანეთ არანაკლებ {0} სიმბოლო.", - minSelectError: "გთხოვთ აირჩიეთ არანაკლებ {0} ვარიანტი.", - maxSelectError: "გთხოვთ აირჩიეთ არაუმეტეს {0} ვარიანტი.", - numericMinMax: "'{0}' უნდა იყოს მეტი ან ტოლი, ვიდრე {1}, და ნაკლები ან ტოლი ვიდრე {2}", - numericMin: "'{0}' უნდა იყოს მეტი ან ტოლი ვიდრე {1}", - numericMax: "'{0}' უნდა იყოს ნაკლები ან ტოლი ვიდრე {1}", - invalidEmail: "გთხოვთ შეიყვანოთ ელ. ფოსტის რეალური მისამართი.", - otherRequiredEror: "გთხოვთ შეავსეთ ველი 'სხვა'" - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ka"] = georgianSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ka"] = "ქართული"; - - - /***/ }), - - /***/ "./src/localization/german.ts": - /*!************************************!*\ - !*** ./src/localization/german.ts ***! - \************************************/ - /*! exports provided: germanSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "germanSurveyStrings", function() { return germanSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var germanSurveyStrings = { - pagePrevText: "Zurück", - pageNextText: "Weiter", - completeText: "Abschließen", - previewText: "Vorschau", - editText: "Bearbeiten", - startSurveyText: "Start", - otherItemText: "Sonstiges (Bitte angeben)", - noneItemText: "Nichts trifft zu", - selectAllItemText: "Alles auswählen", - progressText: "Seite {0} von {1}", - panelDynamicProgressText: "Eintrag {0} von {1}", - questionsProgressText: "{0}/{1} Fragen beantwortet", - emptySurvey: "Es sind keine Fragen vorhanden.", - completingSurvey: "Vielen Dank, dass Sie die Umfrage abgeschlossen haben!", - completingSurveyBefore: "Wir haben festgestellt, dass Sie diese Umfrage bereits abgeschlossen haben.", - loadingSurvey: "Umfrage wird geladen...", - optionsCaption: "Bitte auswählen...", - value: "Wert", - requiredError: "Bitte beantworten Sie diese Frage.", - requiredErrorInPanel: "Bitte beantworten Sie mindestens eine Frage.", - requiredInAllRowsError: "Bitte beantworten Sie alle Fragen.", - numericError: "Der Wert muss eine Zahl sein.", - textMinLength: "Bitte geben Sie mindestens {0} Zeichen ein.", - textMaxLength: "Bitte geben Sie nicht mehr als {0} Zeichen ein.", - textMinMaxLength: "Bitte geben Sie mindestens {0} und maximal {1} Zeichen ein.", - minRowCountError: "Bitte machen Sie in mindestens {0} Zeilen eine Eingabe.", - minSelectError: "Bitte wählen Sie mindestens {0} Antwort(en) aus.", - maxSelectError: "Bitte wählen Sie nicht mehr als {0} Antwort(en) aus.", - numericMinMax: "'{0}' muss größer oder gleich {1} und kleiner oder gleich {2} sein", - numericMin: "'{0}' muss größer oder gleich {1} sein", - numericMax: "'{0}' muss kleiner oder gleich {1} sein", - invalidEmail: "Bitte geben Sie eine gültige E-Mail-Adresse ein.", - invalidExpression: "Der Ausdruck: {0} muss den Wert 'wahr' zurückgeben.", - urlRequestError: "Ein Netzwerkdienst hat folgenden Fehler zurückgegeben '{0}'. {1}", - urlGetChoicesError: "Eine Netzwerkdienst hat ungültige Daten zurückgegeben", - exceedMaxSize: "Die Datei darf nicht größer als {0} sein.", - otherRequiredError: "Bitte geben Sie einen Wert an.", - uploadingFile: "Bitte warten Sie bis der Upload Ihrer Dateien abgeschlossen ist.", - loadingFile: "Wird hochgeladen...", - chooseFile: "Datei(en) auswählen...", - noFileChosen: "Keine Datei ausgewählt", - confirmDelete: "Wollen Sie den Eintrag löschen?", - keyDuplicationError: "Dieser Wert muss einmalig sein.", - addColumn: "Spalte hinzufügen", - addRow: "Zeile hinzufügen", - removeRow: "Entfernen", - addPanel: "Neu hinzufügen", - removePanel: "Entfernen", - choices_Item: "Element", - matrix_column: "Spalte", - matrix_row: "Zeile", - savingData: "Die Ergebnisse werden auf dem Server gespeichert...", - savingDataError: "Es ist ein Fehler aufgetreten. Die Ergebnisse konnten nicht gespeichert werden.", - savingDataSuccess: "Die Ergebnisse wurden gespeichert!", - saveAgainButton: "Erneut absenden", - timerMin: "Min.", - timerSec: "Sek.", - timerSpentAll: "Sie waren {0} auf dieser Seite und brauchten insgesamt {1}.", - timerSpentPage: "Sie waren {0} auf dieser Seite.", - timerSpentSurvey: "Sie haben insgesamt {0} gebraucht.", - timerLimitAll: "Sie waren {0} von {1} auf dieser Seite und brauchten insgesamt {2} von {3}.", - timerLimitPage: "Sie waren {0} von {1} auf dieser Seite.", - timerLimitSurvey: "Sie haben insgesamt {0} von {1} gebraucht.", - cleanCaption: "Alles löschen", - clearCaption: "Auswahl entfernen", - chooseFileCaption: "Datei auswählen", - removeFileCaption: "Datei löschen", - booleanCheckedLabel: "Ja", - booleanUncheckedLabel: "Nein", - confirmRemoveFile: "Sind Sie sicher, dass Sie diese Datei löschen möchten: {0}?", - confirmRemoveAllFiles: "Sind Sie sicher, dass Sie alle Dateien löschen möchten?", - questionTitlePatternText: "Fragentitel", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["de"] = germanSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["de"] = "deutsch"; - - - /***/ }), - - /***/ "./src/localization/greek.ts": - /*!***********************************!*\ - !*** ./src/localization/greek.ts ***! - \***********************************/ - /*! exports provided: greekSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "greekSurveyStrings", function() { return greekSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - //Created by https://github.com/agelospanagiotakis - - var greekSurveyStrings = { - pagePrevText: "Προηγούμενο", - pageNextText: "Επόμενο", - completeText: "Ολοκλήρωση", - previewText: "Προεπισκόπηση", - editText: "Επεξεργασία", - startSurveyText: "Αρχή", - otherItemText: "Άλλο (παρακαλώ διευκρινίστε)", - noneItemText: "Κανένας", - selectAllItemText: "Επιλογή όλων", - progressText: "Σελίδα {0} από {1}", - panelDynamicProgressText: "Εγγραφή {0} από {1}", - questionsProgressText: "Απαντήθηκαν {0} / {1} ερωτήσεις", - emptySurvey: "Δεν υπάρχει καμία ορατή σελίδα ή ορατή ερώτηση σε αυτό το ερωτηματολόγιο.", - completingSurvey: "Ευχαριστούμε για την συμπλήρωση αυτού του ερωτηματολογίου!", - completingSurveyBefore: "Τα αρχεία μας δείχνουν ότι έχετε ήδη ολοκληρώσει αυτήν την έρευνα.", - loadingSurvey: "Το ερωτηματολόγιο φορτώνεται απο το διακομιστή...", - optionsCaption: "Επιλέξτε...", - value: "αξία", - requiredError: "Παρακαλώ απαντήστε στην ερώτηση.", - requiredErrorInPanel: "Απαντήστε σε τουλάχιστον μία ερώτηση.", - requiredInAllRowsError: "Παρακαλώ απαντήστε στις ερωτήσεις σε όλες τις γραμμές.", - numericError: "Η τιμή πρέπει να είναι αριθμητική.", - textMinLength: "Παρακαλώ συμπληρώστε τουλάχιστον {0} σύμβολα.", - textMaxLength: "Εισαγάγετε λιγότερους από {0} χαρακτήρες.", - textMinMaxLength: "Εισαγάγετε περισσότερους από {0} και λιγότερους από {1} χαρακτήρες.", - minRowCountError: "Παρακαλώ συμπληρώστε τουλάχιστον {0} γραμμές.", - minSelectError: "Παρακαλώ επιλέξτε τουλάχιστον {0} παραλλαγές.", - maxSelectError: "Παρακαλώ επιλέξτε όχι παραπάνω απο {0} παραλλαγές.", - numericMinMax: "Το '{0}' θα πρέπει να είναι ίσο ή μεγαλύτερο απο το {1} και ίσο ή μικρότερο απο το {2}", - numericMin: "Το '{0}' πρέπει να είναι μεγαλύτερο ή ισο με το {1}", - numericMax: "Το '{0}' πρέπει να είναι μικρότερο ή ίσο απο το {1}", - invalidEmail: "Παρακαλώ δώστε μια αποδεκτή διεύθυνση e-mail.", - invalidExpression: "Η έκφραση: {0} θα πρέπει να επιστρέψει 'true'.", - urlRequestError: "Η αίτηση επέστρεψε σφάλμα '{0}'. {1}", - urlGetChoicesError: "Η αίτηση επέστρεψε κενά δεδομένα ή η ιδιότητα 'μονοπάτι/path' είναι εσφαλμένη", - exceedMaxSize: "Το μέγεθος δεν μπορεί να υπερβαίνει τα {0}.", - otherRequiredError: "Παρακαλώ συμπληρώστε την τιμή για το πεδίο 'άλλο'.", - uploadingFile: "Το αρχείο σας ανεβαίνει. Παρακαλώ περιμένετε καποια δευτερόλεπτα και δοκιμάστε ξανά.", - loadingFile: "Φόρτωση...", - chooseFile: "Επιλογή αρχείων ...", - noFileChosen: "Δεν έχει επιλεγεί αρχείο", - confirmDelete: "Θέλετε να διαγράψετε την εγγραφή;", - keyDuplicationError: "Αυτή η τιμή πρέπει να είναι μοναδική.", - addColumn: "Προσθήκη στήλης", - addRow: "Προσθήκη γραμμής", - removeRow: "Αφαίρεση", - addPanel: "Προσθεσε νεο", - removePanel: "Αφαιρώ", - choices_Item: "είδος", - matrix_column: "Στήλη", - matrix_row: "Σειρά", - savingData: "Τα αποτελέσματα αποθηκεύονται στον διακομιστή ...", - savingDataError: "Παρουσιάστηκε σφάλμα και δεν ήταν δυνατή η αποθήκευση των αποτελεσμάτων.", - savingDataSuccess: "Τα αποτελέσματα αποθηκεύτηκαν με επιτυχία!", - saveAgainButton: "Προσπάθησε ξανά", - timerMin: "ελάχ", - timerSec: "δευτ", - timerSpentAll: "Έχετε δαπανήσει {0} σε αυτήν τη σελίδα και {1} συνολικά.", - timerSpentPage: "Έχετε ξοδέψει {0} σε αυτήν τη σελίδα.", - timerSpentSurvey: "Έχετε ξοδέψει συνολικά {0}.", - timerLimitAll: "Έχετε δαπανήσει {0} από {1} σε αυτήν τη σελίδα και {2} από {3} συνολικά.", - timerLimitPage: "Έχετε ξοδέψει {0} από {1} σε αυτήν τη σελίδα.", - timerLimitSurvey: "Έχετε ξοδέψει {0} από {1} συνολικά.", - cleanCaption: "ΚΑΘΑΡΗ", - clearCaption: "Σαφή", - chooseFileCaption: "Επιλέξτε το αρχείο", - removeFileCaption: "Καταργήστε αυτό το αρχείο", - booleanCheckedLabel: "Ναί", - booleanUncheckedLabel: "Οχι", - confirmRemoveFile: "Είστε βέβαιοι ότι θέλετε να καταργήσετε αυτό το αρχείο: {0};", - confirmRemoveAllFiles: "Είστε βέβαιοι ότι θέλετε να καταργήσετε όλα τα αρχεία;", - questionTitlePatternText: "Τίτλος ερώτησης", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["gr"] = greekSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["gr"] = "ελληνικά"; - - - /***/ }), - - /***/ "./src/localization/hebrew.ts": - /*!************************************!*\ - !*** ./src/localization/hebrew.ts ***! - \************************************/ - /*! exports provided: hebrewSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hebrewSurveyStrings", function() { return hebrewSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var hebrewSurveyStrings = { - pagePrevText: "אחורה", - pageNextText: "קדימה", - completeText: "סיום", - previewText: "תצוגה מקדימה", - editText: "לַעֲרוֹך", - startSurveyText: "הַתחָלָה", - otherItemText: "אחר (נא לתאר)", - noneItemText: "אף אחד", - selectAllItemText: "בחר הכל", - progressText: "דף {1} מתוך {0}", - panelDynamicProgressText: "הקלטה {0} מתוך {1}", - questionsProgressText: "ענה על שאלות", - emptySurvey: "אין שאלות", - completingSurvey: "תודה על מילוי השאלון!", - completingSurveyBefore: "הרשומות שלנו מראות שכבר סיימת את הסקר הזה.", - loadingSurvey: "טעינה מהשרת...", - optionsCaption: "בחר...", - value: "ערך", - requiredError: "אנא השב על השאלה", - requiredErrorInPanel: "אנא ענה לפחות על שאלה אחת.", - requiredInAllRowsError: "אנא ענה על שאלות בכל השורות.", - numericError: "התשובה צריכה להיות מספר.", - textMinLength: "הזן לפחות {0} תווים.", - textMaxLength: "הזן פחות מ- {0} תווים.", - textMinMaxLength: "הזן יותר מ- {0} ופחות מ- {1} תווים.", - minRowCountError: "אנא מלא לפחות {0} שורות.", - minSelectError: "בחר לפחות {0} אפשרויות.", - maxSelectError: "בחר עד {0} אפשרויות.", - numericMinMax: "'{0}' חייב להיות שווה או גדול מ {1}, ושווה ל- {2} או פחות מ- {}}", - numericMin: "'{0}' חייב להיות שווה או גדול מ {1}", - numericMax: "'{0}' חייב להיות שווה או קטן מ {1}", - invalidEmail: 'הזן כתובת דוא"ל חוקית.', - invalidExpression: "הביטוי: {0} צריך להחזיר 'אמת'.", - urlRequestError: "הבקשה החזירה את השגיאה '{0}'. {1}", - urlGetChoicesError: "הבקשה החזירה נתונים ריקים או שהמאפיין 'נתיב' שגוי", - exceedMaxSize: "גודל הקובץ לא יעלה על {0}.", - otherRequiredError: 'נא להזין נתונים בשדה "אחר"', - uploadingFile: "הקובץ שלך נטען. המתן מספר שניות ונסה שוב.", - loadingFile: "טוען...", - chooseFile: "לבחור קבצים...", - noFileChosen: "לא נבחר קובץ", - confirmDelete: "האם אתה רוצה למחוק את הרשומה?", - keyDuplicationError: "ערך זה צריך להיות ייחודי.", - addColumn: "הוסף עמודה", - addRow: "להוסיף שורה", - removeRow: "לְהַסִיר", - addPanel: "הוסף חדש", - removePanel: "לְהַסִיר", - choices_Item: "פריט", - matrix_column: "טור", - matrix_row: "שׁוּרָה", - savingData: "התוצאות נשמרות בשרת ...", - savingDataError: "אירעה שגיאה ולא הצלחנו לשמור את התוצאות.", - savingDataSuccess: "התוצאות נשמרו בהצלחה!", - saveAgainButton: "נסה שוב", - timerMin: "דקה", - timerSec: "שניות", - timerSpentAll: "הוצאת {0} בדף זה ובסך הכל {1}.", - timerSpentPage: "הוצאת {0} בדף זה.", - timerSpentSurvey: "הוצאת סכום כולל של {0}.", - timerLimitAll: "הוצאת {0} מתוך {1} בדף זה ו- {2} מתוך {3} בסך הכל.", - timerLimitPage: "הוצאת {0} מתוך {1} בדף זה.", - timerLimitSurvey: "הוצאת סכום כולל של {0} מתוך {1}.", - cleanCaption: "לְנַקוֹת", - clearCaption: "ברור", - chooseFileCaption: "בחר קובץ", - removeFileCaption: "הסר קובץ זה", - booleanCheckedLabel: "כן", - booleanUncheckedLabel: "לא", - confirmRemoveFile: "האם אתה בטוח שברצונך להסיר קובץ זה: {0}?", - confirmRemoveAllFiles: "האם אתה בטוח שברצונך להסיר את כל הקבצים?", - questionTitlePatternText: "כותרת שאלה", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["he"] = hebrewSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["he"] = "עברית"; - - - /***/ }), - - /***/ "./src/localization/hindi.ts": - /*!***********************************!*\ - !*** ./src/localization/hindi.ts ***! - \***********************************/ - /*! exports provided: hindiStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hindiStrings", function() { return hindiStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var hindiStrings = { - pagePrevText: "पिछला", - pageNextText: "अगला", - completeText: "पूरा", - previewText: "पूर्वसमीक्षा", - editText: "संपादित", - startSurveyText: "शुरू", - otherItemText: "दूसरा (वर्णन करें)", - noneItemTex: "कोई नहीं", - selectAllItemText: "सभी का चयन करें", - progressText: "पृष्ठ 1 में से 0", - panelDynamicProgressText: " दस्तावेज {1} के {0}", - questionsProgressText: "{1} सवालों में से {0} के जवाब दिए", - emptySurvey: "सर्वेक्षण में कोई दृश्यमान पृष्ठ या प्रश्न नहीं है", - completingSurvey: "सर्वेक्षण को पूरा करने के लिए धन्यवाद", - completingSurveyBefore: " हमारे रिकॉर्ड बताते हैं कि आप पहले ही इस सर्वेक्षण को पूरा कर चुके हैं", - loadingSurvey: "सर्वेक्षण खुल रहा है.…", - optionsCaption: "चुनें", - value: "मूल्य", - requiredError: "कृपया प्रश्न का उत्तर दें", - requiredErrorInPanel: "कृपया कम से कम एक प्रश्न का उत्तर दें", - requiredInAllRowsError: "कृपया सभी पंक्तियों में सवालों के जवाब दें", - numericError: "मूल्य संख्यात्मक होना चाहिए", - textMinLength: "कृपया कम से कम {0} वर्ण दर्ज करें", - textMaxLength: "कृपया {0} से कम वर्ण दर्ज करें", - textMinMaxLength: "कृपया {0} से अधिक और {1} से कम पात्रों में प्रवेश करें", - minRowCountError: "कृपया कम से कम {0} पंक्तियों को भरें", - minSelectError: "कृपया कम से कम {0} विकल्प का चयन करें", - maxSelectError: "कृपया {0} विकल्पों से अधिक नहीं चुनें", - numericMinMax: "'{0}' {1} से बराबर या अधिक और {2} से बराबर या कम होना चाहिए", - numericMin: "'{0}' {1} से बराबर या अधिक होना चाहिए", - numericMax: "'{0}' {1} से बराबर या कम होना चाहिए", - invalidEmail: "कृपया एक वैध ईमेल पता दर्ज करें", - invalidExpression: "अभिव्यक्ति: {0} को ' सच ' लौटना चाहिए", - urlRequestError: "अनुरोध लौटाया त्रुटि '{0}' . {1}", - urlGetChoicesError: "अनुरोध ने खाली डेटा वापस कर दिया है ", - exceedMaxSize: "फ़ाइल का आकार {0} से अधिक नहीं होना चाहिए या फिर 'पाथ' प्रॉपर्टी गलत है", - otherRequiredError: "कृपया दूसरा मूल्य दर्ज करें", - uploadingFile: "आपकी फाइल अपलोड हो रही है। कृपया कई सेकंड इंतजार करें और फिर से प्रयास करें।", - loadingFile: "लोडिंग", - chooseFile: "फ़ाइल चुनें", - noFileChosen: "कोई फाइल नहीं चुनी गई", - confirmDelete: "क्या आप रिकॉर्ड हटाना चाहते हैं", - keyDuplicationError: "यह मान अनोखा होना चाहिए", - addColumn: "कॉलम जोड़ें", - addRow: "पंक्ति जोड़ें", - removeRow: "हटाए", - addPanel: "नया जोड़ें", - removePanel: "हटाए", - choices_Item: "मद", - matrix_column: "कॉलम", - matrix_row: "पंक्ति", - savingData: "परिणाम सर्वर पर सेव हो रहे हैं", - savingDataError: "एक त्रुटि हुई और हम परिणामों को नहीं सेव कर सके", - savingDataSuccess: "परिणाम सफलतापूर्वक सेव हो गए", - saveAgainButton: "फिर कोशिश करो", - timerMin: "मिनट", - timerSec: "सेकंड", - timerSpentAll: "आपने इस पृष्ठ पर {0} खर्च किए हैं और कुल {1}", - timerSpentPage: "आपने इस पृष्ठ पर {0} खर्च किया है", - timerSpentSurvey: "आपने कुल {0} खर्च किया है", - timerLimitAll: "आपने इस पृष्ठ पर {1} की {0} और कुल {3} की {2} खर्च की है।", - timerLimitPage: "आपने इस पृष्ठ पर {1} का {0} खर्च किया है", - timerLimitSurvey: "आपने कुल {1} की {0} खर्च की है", - cleanCaption: "साफ", - clearCaption: "स्पष्ट", - chooseFileCaption: "फ़ाइल चुनें", - removeFileCaption: "इस फाइल को निकालें", - booleanCheckedLabel: "हाँ", - booleanUncheckedLabel: "नहीं", - confirmRemoveFile: "क्या आप सुनिश्चित हैं कि आप इस फ़ाइल को हटाना चाहते हैं: {0}", - confirmRemoveAllFiles: "क्या आप सुनिश्चित हैं कि आप सभी फ़ाइलों को हटाना चाहते हैं", - questionTitlePatternText: "प्रश्न का शीर्षक", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["hi"] = hindiStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["hi"] = "hindi"; - - - /***/ }), - - /***/ "./src/localization/hungarian.ts": - /*!***************************************!*\ - !*** ./src/localization/hungarian.ts ***! - \***************************************/ - /*! exports provided: hungarianSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hungarianSurveyStrings", function() { return hungarianSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var hungarianSurveyStrings = { - pagePrevText: "Vissza", - pageNextText: "Tovább", - completeText: "Kész", - previewText: "Előnézet", - editText: "Szerkesztés", - startSurveyText: "Rajt", - otherItemText: "Egyéb (adja meg)", - noneItemText: "Egyik sem", - selectAllItemText: "Mindet kiválaszt", - progressText: "{0}./{1} oldal", - panelDynamicProgressText: "{0} / {1} rekord", - questionsProgressText: "Válaszolt kérdések: {0} / {1}", - emptySurvey: "There is no visible page or question in the survey.", - completingSurvey: "Köszönjük, hogy kitöltötte felmérésünket!", - completingSurveyBefore: "Már kitöltötte a felmérést.", - loadingSurvey: "Felmérés betöltése...", - optionsCaption: "Válasszon...", - value: "érték", - requiredError: "Kérjük, válaszolja meg ezt a kérdést!", - requiredErrorInPanel: "Kérjük, válaszoljon legalább egy kérdésre.", - requiredInAllRowsError: "Kérjük adjon választ minden sorban!", - numericError: "Az érték szám kell, hogy legyen!", - textMinLength: "Adjon meg legalább {0} karaktert!", - textMaxLength: "Legfeljebb {0} karaktert adjon meg!", - textMinMaxLength: "Adjon meg legalább {0}, de legfeljebb {1} karaktert!", - minRowCountError: "Töltsön ki minimum {0} sort!", - minSelectError: "Válasszon ki legalább {0} lehetőséget!", - maxSelectError: "Ne válasszon többet, mint {0} lehetőség!", - numericMinMax: "'{0}' legyen nagyobb, vagy egyenlő, mint {1} és kisebb, vagy egyenlő, mint {2}!", - numericMin: "'{0}' legyen legalább {1}!", - numericMax: "The '{0}' ne legyen nagyobb, mint {1}!", - invalidEmail: "Adjon meg egy valós email címet!", - invalidExpression: "A következő kifejezés: {0} vissza kell adnia az „igaz” értéket.", - urlRequestError: "A lekérdezés hibával tért vissza: '{0}'. {1}", - urlGetChoicesError: "A lekérdezés üres adattal tért vissza, vagy a 'path' paraméter helytelen.", - exceedMaxSize: "A méret nem lehet nagyobb, mint {0}.", - otherRequiredError: "Adja meg az egyéb értéket!", - uploadingFile: "Feltöltés folyamatban. Várjon pár másodpercet, majd próbálja újra.", - loadingFile: "Betöltés...", - chooseFile: "Fájlok kiválasztása ...", - noFileChosen: "Nincs kiválasztva fájl", - confirmDelete: "Törli ezt a rekordot?", - keyDuplicationError: "Az értéknek egyedinek kell lennie.", - addColumn: "Oszlop hozzáadása", - addRow: "Sor hozzáadása", - removeRow: "Eltávolítás", - addPanel: "Új hozzáadása", - removePanel: "Eltávolítás", - choices_Item: "elem", - matrix_column: "Oszlop", - matrix_row: "Sor", - savingData: "Eredmény mentése a szerverre...", - savingDataError: "Egy hiba folytán nem tudtuk elmenteni az eredményt.", - savingDataSuccess: "Eredmény sikeresen mentve!", - saveAgainButton: "Próbálja újra", - timerMin: "min", - timerSec: "sec", - timerSpentAll: "Ön {0} összeget költött ezen az oldalon, és összesen {1}.", - timerSpentPage: "{0} összeget költött ezen az oldalon.", - timerSpentSurvey: "Összesen {0} költött.", - timerLimitAll: "Ön {0} / {1} összeget költött ezen az oldalon, és összesen {2} / {3}.", - timerLimitPage: "Ön {0} / {1} összeget költött ezen az oldalon.", - timerLimitSurvey: "Összesen {0} / {1} összeget költött el.", - cleanCaption: "Tiszta", - clearCaption: "Egyértelmű", - chooseFileCaption: "Válassz fájlt", - removeFileCaption: "Távolítsa el ezt a fájlt", - booleanCheckedLabel: "Igen", - booleanUncheckedLabel: "Nem", - confirmRemoveFile: "Biztosan eltávolítja ezt a fájlt: {0}?", - confirmRemoveAllFiles: "Biztosan el akarja távolítani az összes fájlt?", - questionTitlePatternText: "Kérdés címe", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["hu"] = hungarianSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["hu"] = "magyar"; - - - /***/ }), - - /***/ "./src/localization/icelandic.ts": - /*!***************************************!*\ - !*** ./src/localization/icelandic.ts ***! - \***************************************/ - /*! exports provided: icelandicSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "icelandicSurveyStrings", function() { return icelandicSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var icelandicSurveyStrings = { - pagePrevText: "Tilbaka", - pageNextText: "Áfram", - completeText: "Lokið", - previewText: "Forskoða", - editText: "Breyta", - startSurveyText: "Byrjaðu", - otherItemText: "Hinn (skýring)", - noneItemText: "Enginn", - selectAllItemText: "Velja allt", - progressText: "Síða {0} of {1}", - panelDynamicProgressText: "Taka upp {0} af {1}", - questionsProgressText: "Svarað {0} / {1} spurningum", - emptySurvey: "Það er enginn síða eða spurningar í þessari könnun.", - completingSurvey: "Takk fyrir að fyllja út þessa könnun!", - completingSurveyBefore: "Skrár okkar sýna að þú hefur þegar lokið þessari könnun.", - loadingSurvey: "Könnunin er að hlaða...", - optionsCaption: "Veldu...", - value: "gildi", - requiredError: "Vinsamlegast svarið spurningunni.", - requiredErrorInPanel: "Vinsamlegast svaraðu að minnsta kosti einni spurningu.", - requiredInAllRowsError: "Vinsamlegast svarið spurningum í öllum röðum.", - numericError: "Þetta gildi verður að vera tala.", - textMinLength: "Það ætti að vera minnst {0} tákn.", - textMaxLength: "Það ætti að vera mest {0} tákn.", - textMinMaxLength: "Það ætti að vera fleiri en {0} og færri en {1} tákn.", - minRowCountError: "Vinsamlegast fyllið úr að minnsta kosti {0} raðir.", - minSelectError: "Vinsamlegast veljið að minnsta kosti {0} möguleika.", - maxSelectError: "Vinsamlegast veljið ekki fleiri en {0} möguleika.", - numericMinMax: "'{0}' ætti að vera meira en eða jafnt og {1} minna en eða jafnt og {2}", - numericMin: "{0}' ætti að vera meira en eða jafnt og {1}", - numericMax: "'{0}' ætti að vera minna en eða jafnt og {1}", - invalidEmail: "Vinsamlegast sláið inn gilt netfang.", - invalidExpression: "Tjáningin: {0} ætti að skila 'satt'.", - urlRequestError: "Beiðninn skilaði eftirfaranadi villu '{0}'. {1}", - urlGetChoicesError: "Beiðninng skilaði engum gögnum eða slóðinn var röng", - exceedMaxSize: "Skráinn skal ekki vera stærri en {0}.", - otherRequiredError: "Vinamlegast fyllið út hitt gildið.", - uploadingFile: "Skráinn þín var send. Vinsamlegast bíðið í nokkrar sekúndur og reynið aftur.", - loadingFile: "Hleður ...", - chooseFile: "Veldu skrár ...", - noFileChosen: "Engin skrá valin", - confirmDelete: "Viltu eyða skránni?", - keyDuplicationError: "Þetta gildi ætti að vera einstakt.", - addColumn: "Bæta við dálki", - addRow: "Bæta við röð", - removeRow: "Fjarlægja", - addPanel: "Bæta við nýju", - removePanel: "Fjarlægðu", - choices_Item: "hlutur", - matrix_column: "Dálkur", - matrix_row: "Röð", - savingData: "Niðurstöðurnar eru að spara á netþjóninum ... ", - savingDataError: "Villa kom upp og við gátum ekki vistað niðurstöðurnar.", - savingDataSuccess: "Árangurinn var vistaður með góðum árangri!", - saveAgainButton: "Reyndu aftur", - timerMin: "mín", - timerSec: "sek", - timerSpentAll: "Þú hefur eytt {0} á þessari síðu og {1} samtals.", - timerSpentPage: "Þú hefur eytt {0} á þessari síðu.", - timerSpentSurvey: "Þú hefur eytt {0} samtals.", - timerLimitAll: "Þú hefur eytt {0} af {1} á þessari síðu og {2} af {3} samtals.", - timerLimitPage: "Þú hefur eytt {0} af {1} á þessari síðu.", - timerLimitSurvey: "Þú hefur eytt {0} af {1} samtals.", - cleanCaption: "Hreint", - clearCaption: "Hreinsa", - chooseFileCaption: "Veldu skrá", - removeFileCaption: "Fjarlægðu þessa skrá", - booleanCheckedLabel: "Já", - booleanUncheckedLabel: "Nei", - confirmRemoveFile: "Ertu viss um að þú viljir fjarlægja þessa skrá: {0}?", - confirmRemoveAllFiles: "Ertu viss um að þú viljir fjarlægja allar skrár?", - questionTitlePatternText: "Spurningartitill", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["is"] = icelandicSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["is"] = "íslenska"; - - - /***/ }), - - /***/ "./src/localization/indonesian.ts": - /*!****************************************!*\ - !*** ./src/localization/indonesian.ts ***! - \****************************************/ - /*! exports provided: indonesianStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "indonesianStrings", function() { return indonesianStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var indonesianStrings = { - pagePrevText: "Sebelumnya", - pageNextText: "Selanjutnya", - completeText: "Selesai", - previewText: "Pratinjau", - editText: "Sunting", - startSurveyText: "Mulai", - otherItemText: "Lainnya (jelaskan)", - noneItemText: "Tidak Ada", - selectAllItemText: "Pilih Semua", - progressText: "Halaman {0} dari {1}", - panelDynamicProgressText: "Rekam {0} dari {1}", - questionsProgressText: "Menjawab pertanyaan {0} / {1}", - emptySurvey: "Tidak ada halaman atau pertanyaan dalam survei.", - completingSurvey: "Terima kasih telah menyelesaikan survei!", - completingSurveyBefore: "Catatan kami menunjukkan bahwa Anda telah menyelesaikan survei ini.", - loadingSurvey: "Memuat survei...", - optionsCaption: "Pilih...", - value: "nilai", - requiredError: "Silahkan jawab pertanyaan berikut.", - requiredErrorInPanel: "Silahkan jawab setidaknya satu petanyaan.", - requiredInAllRowsError: "Silahkan jawab pertanyaan pada semua baris.", - numericError: "Nilai harus berupa angka.", - textMinLength: "Silahkan masukkan setidaknya {0} karakter.", - textMaxLength: "Silahkan masukkan kurang {0} karakter.", - textMinMaxLength: "PSilahkan masukkan lebih dari {0} dan kurang dari {1} karakter.", - minRowCountError: "Silahkan isi setidaknya {0} baris.", - minSelectError: "Silahkan pilih setidaknya {0} varian.", - maxSelectError: "Silahkan pilih tidak lebih dari {0} varian.", - numericMinMax: "'{0}' harus sama dengan atau lebih dari {1} dan harus sama dengan atau kurang dari {2}", - numericMin: "'{0}' harus sama dengan atau lebih dari {1}", - numericMax: "'{0}' harus sama dengan atau kurang dari {1}", - invalidEmail: "Silahkan masukkan e-mail yang benar.", - invalidExpression: "Ekspresi: {0} harus mengembalikan 'benar'.", - urlRequestError: "Permintaan mengembalikan kesalahan '{0}'. {1}", - urlGetChoicesError: "Permintaan mengembalikan data kosong atau properti 'path' salah.", - exceedMaxSize: "Ukuran berkas tidak boleh melebihi {0}.", - otherRequiredError: "Silahkan masukkan nilai lainnnya.", - uploadingFile: "Berkas Anda sedang diunggah. Silahkan tunggu beberapa saat atau coba lagi.", - loadingFile: "Memuat...", - chooseFile: "Pilih berkas...", - noFileChosen: "Tidak ada file yang dipilih", - confirmDelete: "Apakah Anda ingin menghapus catatan?", - keyDuplicationError: "Nilai harus unik.", - addColumn: "Tambah kolom", - addRow: "Tambah baris", - removeRow: "Hapus", - addPanel: "Tambah baru", - removePanel: "Hapus", - choices_Item: "item", - matrix_column: "Kolom", - matrix_row: "Baris", - savingData: "Hasil sedang disimpan pada server...", - savingDataError: "Kesalahan terjadi dan kami tidak dapat menyimpan hasil.", - savingDataSuccess: "Hasil telah sukses disimpan!", - saveAgainButton: "Coba lagi", - timerMin: "menit", - timerSec: "detik", - timerSpentAll: "Anda telah menghabiskan {0} pada halaman ini dan {1} secara keseluruhan.", - timerSpentPage: "YAnda telah menghabiskan {0} pada halaman ini.", - timerSpentSurvey: "Anda telah menghabiskan {0} secara keseluruhan.", - timerLimitAll: "Anda telah menghabiskan {0} dari {1} pada halaman ini dan {2} dari {3} secara keseluruhan.", - timerLimitPage: "Anda telah menghabiskan {0} dari {1} pada halaman ini.", - timerLimitSurvey: "Anda telah menghabiskan {0} dari {1} secara keseluruhan.", - cleanCaption: "Bersihkan", - clearCaption: "Bersihkan", - chooseFileCaption: "Pilih File", - removeFileCaption: "Hapus berkas ini", - booleanCheckedLabel: "Iya", - booleanUncheckedLabel: "Tidak", - confirmRemoveFile: "Anda yakin ingin menghapus file ini: {0}?", - confirmRemoveAllFiles: "Anda yakin ingin menghapus semua file?", - questionTitlePatternText: "Judul pertanyaan", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["id"] = indonesianStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["id"] = "bahasa Indonesia"; - - - /***/ }), - - /***/ "./src/localization/italian.ts": - /*!*************************************!*\ - !*** ./src/localization/italian.ts ***! - \*************************************/ - /*! exports provided: italianSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "italianSurveyStrings", function() { return italianSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var italianSurveyStrings = { - pagePrevText: "Precedente", - pageNextText: "Successivo", - completeText: "Salva", - previewText: "Anteprima", - editText: "Modifica", - startSurveyText: "Inizio", - otherItemText: "Altro (descrivi)", - noneItemText: "Nessuno", - selectAllItemText: "Seleziona tutti", - progressText: "Pagina {0} di {1}", - panelDynamicProgressText: "Record di {0} di {1}", - questionsProgressText: "Risposte a {0}/{1} domande", - emptySurvey: "Non ci sono pagine o domande visibili nel questionario.", - completingSurvey: "Grazie per aver completato il questionario!", - completingSurveyBefore: "I nostri records mostrano che hai già completato questo questionario.", - loadingSurvey: "Caricamento del questionario in corso...", - optionsCaption: "Scegli...", - value: "valore", - requiredError: "Campo obbligatorio", - requiredErrorInPanel: "Per Favore, rispondi ad almeno una domanda.", - requiredInAllRowsError: "Completare tutte le righe", - numericError: "Il valore deve essere numerico", - textMinLength: "Inserire almeno {0} caratteri", - textMaxLength: "Lunghezza massima consentita {0} caratteri", - textMinMaxLength: "Inserire una stringa con minimo {0} e massimo {1} caratteri", - minRowCountError: "Completare almeno {0} righe.", - minSelectError: "Selezionare almeno {0} varianti.", - maxSelectError: "Selezionare massimo {0} varianti.", - numericMinMax: "'{0}' deve essere uguale o superiore a {1} e uguale o inferiore a {2}", - numericMin: "'{0}' deve essere uguale o superiore a {1}", - numericMax: "'{0}' deve essere uguale o inferiore a {1}", - invalidEmail: "Inserire indirizzo mail valido", - invalidExpression: "L'espressione: {0} dovrebbe tornare 'vero'.", - urlRequestError: "La richiesta ha risposto con un errore '{0}'. {1}", - urlGetChoicesError: "La richiesta ha risposto null oppure il percorso non è corretto", - exceedMaxSize: "Il file non può eccedere {0}", - otherRequiredError: "Inserire il valore 'altro'", - uploadingFile: "File in caricamento. Attendi alcuni secondi e riprova", - loadingFile: "Caricamento...", - chooseFile: "Selezionare file(s)...", - noFileChosen: "Nessun file selezionato", - confirmDelete: "Sei sicuro di voler elminare il record?", - keyDuplicationError: "Questo valore deve essere univoco.", - addColumn: "Aggiungi colonna", - addRow: "Aggiungi riga", - removeRow: "Rimuovi riga", - addPanel: "Aggiungi riga", - removePanel: "Elimina", - choices_Item: "Elemento", - matrix_column: "Colonna", - matrix_row: "Riga", - savingData: "Salvataggio dati sul server...", - savingDataError: "Si è verificato un errore e non è stato possibile salvare i risultati.", - savingDataSuccess: "I risultati sono stati salvati con successo!", - saveAgainButton: "Riprova", - timerMin: "min", - timerSec: "sec", - timerSpentAll: "Hai impiegato {0} su questa pagina e {1} in totale.", - timerSpentPage: "Hai impiegato {0} su questa pagina.", - timerSpentSurvey: "Hai impiegato {0} in totale.", - timerLimitAll: "Hai impiegato {0} di {1} su questa pagina e {2} di {3} in totale.", - timerLimitPage: "Hai impiegato {0} di {1} su questa pagina.", - timerLimitSurvey: "Hai impiegato {0} di {1} in totale.", - cleanCaption: "Pulisci", - clearCaption: "Cancella", - chooseFileCaption: "Scegliere il file", - removeFileCaption: "Rimuovere questo file", - booleanCheckedLabel: "Sì", - booleanUncheckedLabel: "No", - confirmRemoveFile: "Sei sicuro di voler elminare questo file: {0}?", - confirmRemoveAllFiles: "Sei sicuro di voler elminare tutti i files?", - questionTitlePatternText: "Titolo della domanda", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["it"] = italianSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["it"] = "italiano"; - - - /***/ }), - - /***/ "./src/localization/japanese.ts": - /*!**************************************!*\ - !*** ./src/localization/japanese.ts ***! - \**************************************/ - /*! exports provided: japaneseSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "japaneseSurveyStrings", function() { return japaneseSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var japaneseSurveyStrings = { - pagePrevText: "前へ", - pageNextText: "次へ", - completeText: "完了", - previewText: "プレビュー", - editText: "編集", - startSurveyText: "スタート", - otherItemText: "その他(説明)", - noneItemText: "なし", - selectAllItemText: "すべて選択", - progressText: "{0}/{1}頁", - panelDynamicProgressText: "{1}の{0}を記録する", - questionsProgressText: "{0}/{1}の質問に回答しました。", - emptySurvey: "この調査に表示できるページや質問はありません", - completingSurvey: "調査を完了してくれてありがとうございました", - completingSurveyBefore: "当社の記録によると、この調査はすでに完了しています。", - loadingSurvey: "調査をダウンロード中", - optionsCaption: "選択", - value: "値打ち", - requiredError: "質問にお答え下さい", - requiredErrorInPanel: "最低でも1つの質問に答えてください。", - requiredInAllRowsError: "質問には全列で回答してください。", - numericError: "数字でご記入下さい", - textMinLength: "{0} 文字以上で入力して下さい", - textMaxLength: "{0}文字以下で入力してください。", - textMinMaxLength: "{0}以上{1}未満の文字を入力してください。", - minRowCountError: "{0}行以上で入力して下さい", - minSelectError: "{0}種類以上を選択して下さい", - maxSelectError: "{0}以上のバリアントを選択しないでください。", - numericMinMax: "{0}は{1}以上であり、{2}以下であることが望ましい。", - numericMin: "'{0}' は同等か{1}より大きくなければなりません", - numericMax: "'{0}' は同等か{1}より小さくなければなりません", - invalidEmail: "有効なメールアドレスをご記入下さい", - invalidExpression: "式は {0}は'true'を返すべきです。", - urlRequestError: "リクエストはエラー '{0}' を返しました。{1}", - urlGetChoicesError: "リクエストが空のデータを返したか、'path' プロパティが正しくありません。", - exceedMaxSize: "ファイルのサイズは{0}を超えてはいけません", - otherRequiredError: "その他の値を入力してください。", - uploadingFile: "ファイルをアップロード中です。しばらくしてから再度お試し下さい", - loadingFile: "読み込み中", - chooseFile: "ファイルを選択", - noFileChosen: "選択されたファイルはありません", - confirmDelete: "レコードを削除しますか?", - keyDuplicationError: "この値は一意でなければなりません。", - addColumn: "列の追加", - addRow: "追加行", - removeRow: "除去", - addPanel: "新規追加", - removePanel: "除去", - choices_Item: "品目", - matrix_column: "コラム", - matrix_row: "行", - savingData: "結果はサーバーに保存されています...。", - savingDataError: "エラーが発生し、結果を保存できませんでした。", - savingDataSuccess: "結果は無事に保存されました", - saveAgainButton: "もう一度試してみてください。", - timerMin: "僅少", - timerSec: "セック", - timerSpentAll: "あなたはこのページに{0}を費やし、合計で{1}を費やしました。", - timerSpentPage: "あなたはこのページに{0}を費やしました。", - timerSpentSurvey: "合計で{0}を使ったことになります。", - timerLimitAll: "このページに{1}のうち{0}を費やし、{3}のうち{2}を合計で費やしました。", - timerLimitPage: "このページで{1}の{0}を使ったことがあります。", - timerLimitSurvey: "合計で{1}の{0}を使ったことがあります。", - cleanCaption: "削除", - clearCaption: "空白", - chooseFileCaption: "ファイルを選択", - removeFileCaption: "このファイルを削除", - booleanCheckedLabel: "噫", - booleanUncheckedLabel: "否", - confirmRemoveFile: "このファイルを削除してもよろしいですか?{0}?", - confirmRemoveAllFiles: "すべてのファイルを削除してもよろしいですか?", - questionTitlePatternText: "質問名", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ja"] = japaneseSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ja"] = "日本語"; - - - /***/ }), - - /***/ "./src/localization/kazakh.ts": - /*!************************************!*\ - !*** ./src/localization/kazakh.ts ***! - \************************************/ - /*! exports provided: kazakhStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "kazakhStrings", function() { return kazakhStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var kazakhStrings = { - pagePrevText: "Артқа", - pageNextText: "Келесі", - completeText: "Дайын", - previewText: "Алдын ала қарау", - editText: "Редакциялау", - startSurveyText: "Бастау", - otherItemText: "Басқа (өтінеміз, жазыңыз)", - noneItemText: "Жоқ", - selectAllItemText: "Барлығын таңдау", - progressText: "{0} ден {1} бет ", - panelDynamicProgressText: "{0} ден {1} жазба", - questionsProgressText: "{0}/{1} сұрақтарға жауап", - emptySurvey: "Бір де бір сұрақ жоқ.", - completingSurvey: "Сауалнаманы толтырғаныңыз үшін рахмет!", - completingSurveyBefore: "Сіз бұл сауалнаманы өтіп қойдыңыз.", - loadingSurvey: "Серверден жүктеу...", - optionsCaption: "Таңдау...", - value: "мәні", - requiredError: "Өтінеміз, сұраққа жауап беріңіз.", - requiredErrorInPanel: "Өтінеміз, кем дегенде бір сұраққа жауап беріңіз.", - requiredInAllRowsError: "Өтінеміз, әрбір жолдың сұрағаны жауап беріңіз.", - numericError: "Жауап сан түрінде болуы керек.", - textMinLength: "Өтінеміз, {0} ден көп таңба енгізіңіз.", - textMaxLength: "Өтінеміз, {0} ден аз таңба енгізіңіз.", - textMinMaxLength: "Өтінеміз, {0} аз және {1} көп таңба енгізіңіз.", - minRowCountError: "Өтінеміз, {0} ден кем емес жол толтырыңыз.", - minSelectError: "Өтінеміз, тым болмаса {0} нұсқа таңдаңыз.", - maxSelectError: "Өтінеміз, {0} нұсқадан көп таңдамаңыз.", - numericMinMax: "'{0}' {1} ден кем емес және {2} ден көп емес болу керек", - numericMin: "'{0}' {1} ден кем емес болу керек", - numericMax: "'{0}' {1} ден көп емес болу керек", - invalidEmail: "Өтінеміз, жарамды электрондық поштаңызды енгізіңіз.", - invalidExpression: "{0} өрнегі 'true' қайтару керек.", - urlRequestError: "Сұратым қателікті қайтарды'{0}'. {1}", - urlGetChoicesError: "Сұратымға жауап бос келді немесе 'path' қасиеті қате көрсетілген ", - exceedMaxSize: "Файлдың мөлшері {0} аспау керек.", - otherRequiredError: "Өтінеміз, “Басқа” жолына деректі енгізіңіз", - uploadingFile: "Сіздің файлыңыз жүктеліп жатыр. Бірнеше секунд тосып, қайтадан байқап көріңіз.", - loadingFile: "Жүктеу...", - chooseFile: "Файлдарды таңдаңыз...", - noFileChosen: "Файл таңдалынбады", - confirmDelete: "Сіз жазбаны жоятыныңызға сенімдісіз бе?", - keyDuplicationError: "Бұл мән бірегей болу керек.", - addColumn: "Бағана қосу", - addRow: "Жолды қосу", - removeRow: "Өшіру", - addPanel: "Жаңа қосу", - removePanel: "Өшіру", - choices_Item: "Нұсқа", - matrix_column: "Бағана", - matrix_row: "Жол", - savingData: "Нәтижелер серверде сақталады...", - savingDataError: "Қателік туындады, нәтиже сақталынбады.", - savingDataSuccess: "Нәтиже ойдағыдай сақталды!", - saveAgainButton: "Қайтадан байқап көру", - timerMin: "мин", - timerSec: "сек", - timerSpentAll: "Сіз бұл бетте {0} кетірдіңіз және барлығы {1}.", - timerSpentPage: "Сіз бұл бетте {0} кетірдіңіз.", - timerSpentSurvey: "Сіз сауалнама кезінде {0} кетірдіңіз.", - timerLimitAll: "Сіз бұл бетте {0} ден {1} кетірдіңіз және {2} ден {3} бүкіл сауалнама үшін.", - timerLimitPage: "Сіз бұл бетте {0} ден {1} кетірдіңіз.", - timerLimitSurvey: "Сіз бүкіл сауалнама үшін {0} ден {1} кетірдіңіз ", - cleanCaption: "Тазалау", - clearCaption: "Тазалау", - chooseFileCaption: "Файл таңдаңыз", - removeFileCaption: "Файлды жойыңыз", - booleanCheckedLabel: "Иә", - booleanUncheckedLabel: "Жоқ", - confirmRemoveFile: "Сіз бұл файлды жоятыныңызға сенімдісіз бе: {0}?", - confirmRemoveAllFiles: "Сіз барлық файлдарды жоятыныңызға сенімдісіз бе?", - questionTitlePatternText: "Сұрақтың атауы", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["kk"] = kazakhStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["kk"] = "Kazakh"; - - - /***/ }), - - /***/ "./src/localization/korean.ts": - /*!************************************!*\ - !*** ./src/localization/korean.ts ***! - \************************************/ - /*! exports provided: koreanStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "koreanStrings", function() { return koreanStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var koreanStrings = { - pagePrevText: "이전", - pageNextText: "다음", - completeText: "완료", - previewText: "시사", - editText: "편집하다", - startSurveyText: "시작", - otherItemText: "기타(설명)", - noneItemText: "없음", - selectAllItemText: "모두 선택", - progressText: "페이지 {1} 중 {0}", - panelDynamicProgressText: "{0} / {1} 기록", - questionsProgressText: "{0} / {1} 개의 질문에 답변 함", - emptySurvey: "설문지에 보여지는 페이지나 질문이 없습니다", - completingSurvey: "설문 조사를 완료해 주셔서 감사합니다!", - completingSurveyBefore: "기록에 따르면 이미 설문 조사를 마치셨습니다.", - loadingSurvey: "설문조사가 로드중입니다...", - optionsCaption: "선택하십시오...", - value: "값", - requiredError: "질문에 답하시오.", - requiredErrorInPanel: "하나 이상의 질문에 답하십시오.", - requiredInAllRowsError: "모든 행에 있는 질문에 답하십시오.", - numericError: "값은 숫자여야 합니다.", - textMinLength: "답변의 길이는 최소 {0}자여야 입니다.", - textMaxLength: "답변의 길이는 {0}자를 초과 할 수 없습니다.", - textMinMaxLength: "답변의 길이는 {0} - {1}자 사이여야 합니다.", - minRowCountError: "최소 {0}개의 행을 채우십시오", - minSelectError: "최소 {0}개의 변수를 선택하십시오.", - maxSelectError: "최대 {0}개의 변수를 선택하십시오.", - numericMinMax: "'{0}'은 {1}보다 크거나 같고 {2}보다 작거나 같아야합니다.", - numericMin: "'{0}'은 {1}보다 크거나 같아야합니다.", - numericMax: "'{0}'은 {1}보다 작거나 같아야합니다.", - invalidEmail: "올바른 이메일 주소를 입력하십시오.", - invalidExpression: "표현식: {0}은 '참'이어야 합니다.", - urlRequestError: "'{0}'으로 잘못된 요청입니다. {1}", - urlGetChoicesError: "비어있는 데이터를 요청했거나 잘못된 속성의 경로입니다.", - exceedMaxSize: "파일 크기가 {0}을 초과 할 수 없습니다.", - otherRequiredError: "다른 질문을 작성하십시오.", - uploadingFile: "파일 업로드 중입니다. 잠시 후 다시 시도하십시오.", - loadingFile: "로드 중...", - chooseFile: "파일 선택...", - noFileChosen: "선택된 파일이 없습니다", - confirmDelete: "기록을 삭제하시겠습니까?", - keyDuplicationError: " 이 값은 고유해야합니다.", - addColumn: "열 추가", - addRow: "행 추가", - removeRow: "제거", - addPanel: "새롭게 추가", - removePanel: "제거", - choices_Item: "항목", - matrix_column: "열", - matrix_row: "행", - savingData: "결과가 서버에 저장 중입니다...", - savingDataError: "오류가 발생하여 결과를 저장할 수 없습니다.", - savingDataSuccess: "결과가 성공적으로 저장되었습니다!", - saveAgainButton: "다시 시도하십시오", - timerMin: "분", - timerSec: "초", - timerSpentAll: "현재 페이지에서 {0}을 소요해 총 {1}이 걸렸습니다.", - timerSpentPage: "현재 페이지에서 {0]이 걸렸습니다", - timerSpentSurvey: "총 {0}이 걸렸습니다.", - timerLimitAll: "현재 페이지에서 {0}/{1}을 소요해 총 {2}/{3}이 걸렸습니다.", - timerLimitPage: "현재 페이지에서 {0}/{1}이 걸렸습니다.", - timerLimitSurvey: "총 {0}/{1}이 걸렸습니다.", - cleanCaption: "닦기", - clearCaption: "지우기", - chooseFileCaption: "파일을 선택", - removeFileCaption: "이 파일 제거", - booleanCheckedLabel: "예", - booleanUncheckedLabel: "아니", - confirmRemoveFile: "{0} 파일을 제거 하시겠습니까?", - confirmRemoveAllFiles: "모든 파일을 제거 하시겠습니까?", - questionTitlePatternText: "질문 제목", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ko"] = koreanStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ko"] = "한국어"; - - - /***/ }), - - /***/ "./src/localization/latvian.ts": - /*!*************************************!*\ - !*** ./src/localization/latvian.ts ***! - \*************************************/ - /*! exports provided: latvianSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "latvianSurveyStrings", function() { return latvianSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var latvianSurveyStrings = { - pagePrevText: "Atpakaļ", - pageNextText: "Tālāk", - completeText: "Pabeigt", - previewText: "Priekšskatījums", - editText: "Rediģēt", - startSurveyText: "Sākt", - otherItemText: "Cits (lūdzu, aprakstiet!)", - noneItemText: "Nav", - selectAllItemText: "Izvēlēties visus", - progressText: "Lappuse {0} no {1}", - panelDynamicProgressText: "Ierakstīt {0} no {1}", - questionsProgressText: "Atbildēja uz jautājumiem {0} / {1}", - emptySurvey: "Nav neviena jautājuma.", - completingSurvey: "Pateicamies Jums par anketas aizpildīšanu!", - completingSurveyBefore: "Mūsu ieraksti liecina, ka jūs jau esat aizpildījis šo aptauju.", - loadingSurvey: "Ielāde no servera...", - optionsCaption: "Izvēlēties...", - value: "value", - requiredError: "Lūdzu, atbildiet uz jautājumu!", - requiredErrorInPanel: "Lūdzu, atbildiet uz vismaz vienu jautājumu.", - requiredInAllRowsError: "Lūdzu, atbildiet uz jautājumiem visās rindās.", - numericError: "Atbildei ir jābūt skaitlim.", - textMinLength: "Lūdzu, ievadiet vismaz {0} simbolus.", - textMaxLength: "Lūdzu, ievadiet mazāk nekā {0} rakstzīmes.", - textMinMaxLength: "Lūdzu, ievadiet vairāk nekā {0} rakstzīmes un mazāk nekā {1} rakstzīmes.", - minRowCountError: "Lūdzu, aizpildiet vismaz {0} rindas.", - minSelectError: "Lūdzu, izvēlieties vismaz {0} variantu.", - maxSelectError: "Lūdzu, izvēlieties ne vairak par {0} variantiem.", - numericMinMax: "'{0}' jābūt vienādam vai lielākam nekā {1}, un vienādam vai mazākam, nekā {2}", - numericMin: "'{0}' jābūt vienādam vai lielākam {1}", - numericMax: "'{0}' jābūt vienādam vai lielākam {1}", - invalidEmail: "Lūdzu, ievadiet patiesu e-pasta adresi!", - invalidExpression: "Izteicienam: {0} jāatgriež “true”.", - urlRequestError: "Pieprasījumā tika atgriezta kļūda “{0}”. {1}", - urlGetChoicesError: "Pieprasījums atgrieza tukšus datus vai rekvizīts “path” ir nepareizs", - exceedMaxSize: "Faila lielums nedrīkst pārsniegt {0}.", - otherRequiredError: "Lūdzu, ievadiet datus laukā 'Cits'", - uploadingFile: "Jūsu fails tiek augšupielādēts. Lūdzu, uzgaidiet vairākas sekundes un mēģiniet vēlreiz.", - loadingFile: "Notiek ielāde ...", - chooseFile: "Izvēlieties failus ...", - noFileChosen: "Nav izvēlēts neviens fails", - confirmDelete: "Vai vēlaties izdzēst ierakstu?", - keyDuplicationError: "Šai vērtībai jābūt unikālai.", - addColumn: "Pievienot kolonnu", - addRow: "Pievienot rindu", - removeRow: "Noņemt", - addPanel: "Pievieno jaunu", - removePanel: "Noņemt", - choices_Item: "lieta", - matrix_column: "Sleja", - matrix_row: "Rinda", - savingData: "Rezultāti tiek saglabāti serverī ...", - savingDataError: "Radās kļūda, un mēs nevarējām saglabāt rezultātus.", - savingDataSuccess: "Rezultāti tika veiksmīgi saglabāti!", - saveAgainButton: "Mēģini vēlreiz", - timerMin: "min", - timerSec: "sek", - timerSpentAll: "Šajā lapā esat iztērējis {0} un kopā {1}.", - timerSpentPage: "Šajā lapā esat iztērējis {0}.", - timerSpentSurvey: "Kopā esat iztērējis {0}.", - timerLimitAll: "Šajā lapā esat iztērējis {0} no {1} un kopā {2} no {3}.", - timerLimitPage: "Šajā lapā esat iztērējis {0} no {1}.", - timerLimitSurvey: "Kopā esat iztērējis {0} no {1}.", - cleanCaption: "Tīrs", - clearCaption: "Skaidrs", - chooseFileCaption: "Izvēlēties failu", - removeFileCaption: "Noņemiet šo failu", - booleanCheckedLabel: "Jā", - booleanUncheckedLabel: "Nē", - confirmRemoveFile: "Vai tiešām vēlaties noņemt šo failu: {0}?", - confirmRemoveAllFiles: "Vai tiešām vēlaties noņemt visus failus?", - questionTitlePatternText: "Jautājuma nosaukums", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["lv"] = latvianSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["lv"] = "latviešu"; - - - /***/ }), - - /***/ "./src/localization/lithuanian.ts": - /*!****************************************!*\ - !*** ./src/localization/lithuanian.ts ***! - \****************************************/ - /*! exports provided: lithuaniaSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lithuaniaSurveyStrings", function() { return lithuaniaSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var lithuaniaSurveyStrings = { - pagePrevText: "Atgal", - pageNextText: "Toliau", - completeText: "Baigti", - previewText: "Peržiūra", - editText: "Redaguoti", - startSurveyText: "Pradėti", - otherItemText: "Kita (įvesti)", - noneItemText: "Nėra", - selectAllItemText: "Pasirinkti visus", - progressText: "Puslapis {0} iš {1}", - panelDynamicProgressText: "Įrašyti {0} iš {1}", - questionsProgressText: "Atsakė į {0} / {1} klausimus", - emptySurvey: "Apklausoje nėra matomo puslapio ar klausimo.", - completingSurvey: "Dėkojame už dalyvavimą apklausoje!", - completingSurveyBefore: "Mūsų įrašai rodo, kad jau atlikote šią apklausą.", - loadingSurvey: "Prašome palaukti...", - optionsCaption: "Pasirinkti...", - value: "reikšmė", - requiredError: "Būtina atsakyti į šį klausimą.", - requiredErrorInPanel: "Būtina atsakyti bent į vieną klausimą.", - requiredInAllRowsError: "Prašome atsakyti į klausimus visose eilutėse.", - numericError: "Turi būti skaičiai.", - textMinLength: "Prašome suvesti bent {0} simbolius.", - textMaxLength: "Prašome suvesti mažiau nei {0} simbolių.", - textMinMaxLength: "Prašome suvesti daugiau nei {0} ir mažiau nei {1} simbolių.", - minRowCountError: "Prašome suvesti ne mažiau nei {0} eilučių.", - minSelectError: "Prašome pasirinkti bent {0} variantų.", - maxSelectError: "Pasirinkite ne daugiau kaip {0} variantus.", - numericMinMax: "'{0}' turi būti lygus arba didesnis nei {1} ir lygus arba mažesnis nei {2}", - numericMin: "'{0}' turėtų būti lygus arba didesnis nei {1}", - numericMax: "'{0}' turėtų būti lygus ar mažesnis už {1}", - invalidEmail: "Prašome įvesti galiojantį elektroninio pašto adresą.", - invalidExpression: "Reikšmė: {0} turi grąžinti 'true'.", - urlRequestError: "Užklausa grąžino klaidą'{0}'. {1}", - urlGetChoicesError: "Užklausa grąžino tuščius duomenis arba 'path' savybė yra neteisinga", - exceedMaxSize: "Failo dydis neturi viršyti {0}.", - otherRequiredError: "Įveskite kitą reikšmę.", - uploadingFile: "Jūsų failas yra keliamas. Palaukite keletą sekundžių ir bandykite dar kartą.", - loadingFile: "Prašome palaukti...", - chooseFile: "Pasirinkti failą(us)...", - noFileChosen: "Nepasirinktas joks failas", - confirmDelete: "Ar norite ištrinti įrašą?", - keyDuplicationError: "Ši reikšmė turėtų būti unikali.", - addColumn: "Pridėti stulpelį", - addRow: "Pridėti eilutę", - removeRow: "Ištrinti", - addPanel: "Pridėti naują", - removePanel: "Ištrinti", - choices_Item: "elementas", - matrix_column: "Stulpelis", - matrix_row: "Eilutė", - savingData: "Rezultatai saugomi serveryje...", - savingDataError: "Įvyko klaida ir mes negalėjome išsaugoti rezultatų.", - savingDataSuccess: "Rezultatai buvo išsaugoti sėkmingai!", - saveAgainButton: "Bandyti dar kartą", - timerMin: "min", - timerSec: "sek", - timerSpentAll: "Praleidote {0} šiame puslapyje ir {1} iš viso.", - timerSpentPage: "Praleidote {0} šiame puslapyje.", - timerSpentSurvey: "Praleidote {0} iš viso.", - timerLimitAll: "Praleidote {0} iš {1} šiame puslapyje ir {2} iš {3} iš viso.", - timerLimitPage: "Praleidote {0} iš {1} šiame puslapyje.", - timerLimitSurvey: "Praleidote {0} iš {1} iš viso.", - cleanCaption: "Išvalyti", - clearCaption: "Valyti", - chooseFileCaption: "Pasirinkti failą", - removeFileCaption: "Ištrinti šį failą", - booleanCheckedLabel: "Taip", - booleanUncheckedLabel: "Ne", - confirmRemoveFile: "Ar tikrai norite pašalinti šį failą: {0}?", - confirmRemoveAllFiles: "Ar tikrai norite pašalinti visus failus?", - questionTitlePatternText: "Klausimo pavadinimas", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["lt"] = lithuaniaSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["lt"] = "lietuvių"; - - - /***/ }), - - /***/ "./src/localization/macedonian.ts": - /*!****************************************!*\ - !*** ./src/localization/macedonian.ts ***! - \****************************************/ - /*! exports provided: macedonianSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "macedonianSurveyStrings", function() { return macedonianSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var macedonianSurveyStrings = { - pagePrevText: "Претходна", - pageNextText: "Следно", - completeText: "Заврши", - previewText: "Преглед", - editText: "Уредување", - startSurveyText: "Започнете", - otherItemText: "Друго (опиши)", - noneItemText: "Ништо", - selectAllItemText: "Селектирај се", - progressText: "Страница {0} од {1}", - panelDynamicProgressText: "Сними {0} од {1}", - questionsProgressText: "Одговорени на {0} / {1} прашања", - emptySurvey: "Нема видлива страница или прашање во истражувањето.", - completingSurvey: "Ви благодариме што го завршивте истражувањето!", - completingSurveyBefore: "Нашите записи покажуваат дека веќе сте го завршиле ова истражување.", - loadingSurvey: "Анкетата се вчитува ...", - optionsCaption: "Изберете ...", - value: "вредност", - requiredError: "Ве молам, одговорете на прашањето.", - requiredErrorInPanel: "Ве молам, одговорете барем на едно прашање.", - requiredInAllRowsError: "Ве молиме, одговорете на прашања во сите редови.", - numericError: "Вредноста треба да биде нумеричка.", - minError: "Вредноста не треба да биде помала од {0}", - maxError: "Вредноста не треба да биде поголема од {0}", - textMinLength: "Внесете најмалку {0} знак/ци.", - textMaxLength: "Внесете не повеќе од {0} знак/ци.", - textMinMaxLength: "Внесете најмалку {0} и не повеќе од {1} знаци.", - minRowCountError: "Пополнете најмалку {0} ред(ови).", - minSelectError: "Ве молиме изберете најмалку {0} варијанта(и).", - maxSelectError: "Изберете не повеќе од {0} варијанта(и).", - numericMinMax: "'{0}' треба да биде најмалку {1} и најмногу {2}", - numericMin: "'{0}' треба да биде најмалку {1}", - numericMax: "'{0}' треба да биде најмногу {1}", - invalidEmail: "Ве молиме внесете валидна е-маил адреса.", - invalidExpression: "Изразот: {0} треба да се врати 'true'.", - urlRequestError: "Барањето врати грешка '{0}'. {1} ", - urlGetChoicesError: "Барањето врати празни податоци или својството 'path' е неточно", - exceedMaxSize: "Големината на датотеката не треба да надминува {0}.", - otherRequiredError: "Внесете ја другата вредност.", - uploadingFile: "Вашата датотека се поставува. Ве молиме почекајте неколку секунди и обидете се повторно.", - loadingFile: "Се вчитува ...", - chooseFile: "Изберете датотека (и) ...", - noFileChosen: "Не се избрани датотеки", - confirmDelete: "Дали сакате да го избришете записот?", - keyDuplicationError: "Оваа вредност треба да биде единствена.", - addColumn: "Додај колона", - addRow: "Додади ред", - removeRow: "Отстрани", - emptyRowsText: "Нема редови.", - addPanel: "Додади ново", - removePanel: "Отстрани", - choices_Item: "ставка", - matrix_column: "Колона", - matrix_row: "Ред", - savingData: "Резултатите се зачувуваат на серверот ...", - savingDataError: "Настана грешка и не можевме да ги зачуваме резултатите.", - savingDataSuccess: "Резултатите беа успешно зачувани!", - saveAgainButton: "Обиди се повторно", - timerMin: "мин", - timerSec: "сек", - timerSpentAll: "Поминавте {0} на оваа страница и вкупно {1}.", - timerSpentPage: "Поминавте {0} на оваа страница.", - timerSpentSurvey: "Вие потрошивте вкупно {0}.", - timerLimitAll: "Поминавте {0} од {1} на оваа страница и {2} од {3} вкупно.", - timerLimitPage: "Поминавте {0} од {1} на оваа страница.", - timerLimitSurvey: "Вие потрошивте вкупно {0} од {1}.", - cleanCaption: "Чисти", - clearCaption: "Да расчисти", - chooseFileCaption: "Изберете датотека", - removeFileCaption: "Отстранете ја оваа датотека", - booleanCheckedLabel: "Да", - booleanUncheckedLabel: "Не", - confirmRemoveFile: "Дали сте сигурни дека сакате да ја отстраните оваа датотека: {0}?", - confirmRemoveAllFiles: "Дали сте сигурни дека сакате да ги отстраните сите датотеки?", - questionTitlePatternText: "Наслов на прашањето", - modalCancelButtonText: "Откажи", - modalApplyButtonText: "Аплицирај", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["mk"] = macedonianSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["mk"] = "Македонски"; - - - /***/ }), - - /***/ "./src/localization/norwegian.ts": - /*!***************************************!*\ - !*** ./src/localization/norwegian.ts ***! - \***************************************/ - /*! exports provided: norwegianSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "norwegianSurveyStrings", function() { return norwegianSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var norwegianSurveyStrings = { - pagePrevText: "Forrige", - pageNextText: "Neste", - completeText: "Fullfør", - previewText: "Forhåndsvisning", - editText: "Redigere", - startSurveyText: "Start", - otherItemText: "Annet (beskriv)", - noneItemText: "Ingen", - selectAllItemText: "Velg alle", - progressText: "Side {0} av {1}", - panelDynamicProgressText: "Ta opp {0} av {1}", - questionsProgressText: "Besvarte {0} / {1} spørsmål", - emptySurvey: "Det er ingen synlig side eller spørsmål i undersøkelsen.", - completingSurvey: "Takk for at du fullførte undersøkelsen!", - completingSurveyBefore: "Våre data viser at du allerede har gjennomført denne undersøkelsen.", - loadingSurvey: "Undersøkelsen laster...", - optionsCaption: "Velg...", - value: "verdi", - requiredError: "Vennligst svar på spørsmålet.", - requiredErrorInPanel: "Vennligst svar på minst ett spørsmål.", - requiredInAllRowsError: "Vennligst svar på spørsmål i alle rader.", - numericError: "Verdien skal være numerisk.", - textMinLength: "Vennligst skriv inn minst {0} tegn.", - textMaxLength: "Vennligst skriv inn mindre enn {0} tegn.", - textMinMaxLength: "Vennligst skriv inn mer enn {0} og mindre enn {1} tegn.", - minRowCountError: "Vennligst fyll inn minst {0} rader.", - minSelectError: "Vennligst velg minst {0} varianter.", - maxSelectError: "Vennligst ikke velg mer enn {0} varianter.", - numericMinMax: "'{0}' bør være lik eller mer enn {1} og lik eller mindre enn {2}", - numericMin: "'{0}' bør være lik eller mer enn {1}", - numericMax: "'{0}' bør være lik eller mindre enn {1}", - invalidEmail: "Vennligst skriv inn en gyldig e-post adresse.", - invalidExpression: "Uttrykket: {0} skal returnere 'sant'.", - urlRequestError: "Forespørselen returnerte feilen '{0}'. {1}", - urlGetChoicesError: "Forespørselen returnerte tomme data, eller 'sti' -egenskapen er feil", - exceedMaxSize: "Filstørrelsen bør ikke overstige {0}.", - otherRequiredError: "Vennligst skriv inn den andre verdien.", - uploadingFile: "Filen din lastes opp. Vennligst vent noen sekunder og prøv igjen.", - loadingFile: "Laster inn ...", - chooseFile: "Velg fil (er) ...", - noFileChosen: "Ingen fil valgt", - confirmDelete: "Ønsker du å slette posten?", - keyDuplicationError: "Denne verdien skal være unik.", - addColumn: "Legg til kolonne", - addRow: "Legg til rad", - removeRow: "Fjern", - addPanel: "Legg til ny", - removePanel: "Fjerne", - choices_Item: "element", - matrix_column: "Kolonne", - matrix_row: "Rad", - savingData: "Resultatene lagres på serveren ...", - savingDataError: "Det oppsto en feil, og vi kunne ikke lagre resultatene.", - savingDataSuccess: "Resultatene ble lagret!", - saveAgainButton: "Prøv igjen", - timerMin: "min", - timerSec: "sek", - timerSpentAll: "Du har tilbrakt {0} på denne siden og {1} totalt.", - timerSpentPage: "Du har tilbrakt {0} på denne siden.", - timerSpentSurvey: "Du har tilbrakt {0} totalt.", - timerLimitAll: "Du har tilbrakt {0} av {1} på denne siden og totalt {2} av {3}.", - timerLimitPage: "Du har tilbrakt {0} av {1} på denne siden.", - timerLimitSurvey: "Du har tilbrakt {0} av {1} totalt.", - cleanCaption: "Rens", - clearCaption: "Klar", - chooseFileCaption: "Velg Fil", - removeFileCaption: "Fjern denne filen", - booleanCheckedLabel: "Ja", - booleanUncheckedLabel: "Nei", - confirmRemoveFile: "Er du sikker på at du vil fjerne denne filen: {0}?", - confirmRemoveAllFiles: "Er du sikker på at du vil fjerne alle filene?", - questionTitlePatternText: "Spørsmålstittel", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["no"] = norwegianSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["no"] = "norsk"; - - - /***/ }), - - /***/ "./src/localization/persian.ts": - /*!*************************************!*\ - !*** ./src/localization/persian.ts ***! - \*************************************/ - /*! exports provided: persianSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "persianSurveyStrings", function() { return persianSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var persianSurveyStrings = { - pagePrevText: "قبلی", - pageNextText: "بعدی", - completeText: "تکمیل", - previewText: "پیش نمایش", - editText: "ویرایش", - startSurveyText: "شروع", - otherItemText: "دیگر(توضیح)", - noneItemText: "هیچ", - selectAllItemText: "انتخاب همه", - progressText: "صفحه {0} از {1}", - panelDynamicProgressText: "مورد {0} از {1}", - questionsProgressText: "تعداد پاسخ {0}/{1} سوال", - emptySurvey: "صفحه ای یا گزینه ای برای این پرسشنامه موجود نیست.", - completingSurvey: "از شما بابت تکمیل این پرسشنامه متشکریم", - completingSurveyBefore: "به نظر می رسد هم هم اکنون پرسشنامه را تکمیل کرده اید.", - loadingSurvey: "درحال ایجاد پرسشنامه", - optionsCaption: "انتخاب کنید...", - value: "مقدار", - requiredError: "لطفا به سوال پاسخ دهید", - requiredErrorInPanel: "لطفا حداقل به یک سوال پاسخ دهید.", - requiredInAllRowsError: "لطفا سوالات تمام سطرها را پاسخ دهید.", - numericError: "مقدار باید عددی باشد", - textMinLength: "لطفا حداقل {0} حرف وارد کنید", - textMaxLength: "لطفا کمتر از {0} حرف وارد کنید.", - textMinMaxLength: "لطفا بیشتر از {0} حرف و کمتر از {1} حرف وارد کنید.", - minRowCountError: "لطفا حداقل {0} سطر وارد کنید.", - minSelectError: "حداقل {0} انتخاب کنید.", - maxSelectError: "لطفا بیشتر از {0} انتخاب کنید.", - numericMinMax: "'{0}' باید بین {1} و {2} باشد", - numericMin: "'{0}' بزرگتر مساوی {1} باشد", - numericMax: "'{0}' باید کوچکتر یا مساوی {1} باشد", - invalidEmail: "لطفا ایمیل صحیح درج کنید", - invalidExpression: "عبارت: {0} پاسخ باید 'true' باشد.", - urlRequestError: "درخواست با خطا روبرو شد: '{0}'. {1}", - urlGetChoicesError: "درخواست مسیری خالی بازگشت داده یا مسیر درست تنظیم نشده", - exceedMaxSize: "بیشترین حجم مجاز فایل: {0}", - otherRequiredError: "مقدار 'دیگر' را وارد کنید", - uploadingFile: "فایل در حال آیلود است. لطفا صبر کنید.", - loadingFile: "بارگیری...", - chooseFile: "انتخاب فایل(ها)...", - noFileChosen: "هیچ فایلی انتخاب نشده", - confirmDelete: "آیا مایل به حذف این ردیف هستید؟", - keyDuplicationError: "این مقدار باید غیر تکراری باشد", - addColumn: "ستون جدید", - addRow: "سطر جدید", - removeRow: "حذف", - addPanel: "جدید", - removePanel: "حذف", - choices_Item: "آیتم", - matrix_column: "ستون", - matrix_row: "سطر", - savingData: "نتایج در حال ذخیره سازی در سرور است", - savingDataError: "خطایی در ذخیره سازی نتایج رخ داده است", - savingDataSuccess: "نتایج با موفقیت ذخیره شد", - saveAgainButton: "مجدد تلاش کنید", - timerMin: "دقیقه", - timerSec: "ثانیه", - timerSpentAll: "شما مدت {0} در این صفحه و مدت {1} را در مجموع سپری کرده اید.", - timerSpentPage: "شما مدت {0} را در این صفحه سپری کرده اید.", - timerSpentSurvey: "شما مدت {0} را در مجموع سپری کرده اید.", - timerLimitAll: "شما مدت {0} از {1} در این صفحه و مدت {2} از {3} را در مجموع سپری کرده اید.", - timerLimitPage: "شما مدت {0} از {1} را در این صفحه سپری کرده اید.", - timerLimitSurvey: "شما مدت {0} از {1} را در مجموع سپری کرده اید.", - cleanCaption: "پاکسازی", - clearCaption: "خالی کردن", - chooseFileCaption: "انتخاب فایل", - removeFileCaption: "حذف این فایل", - booleanCheckedLabel: "بله", - booleanUncheckedLabel: "خیر", - confirmRemoveFile: "آیا میخواهید این فایل را پاک کنید: {0}?", - confirmRemoveAllFiles: "آیا میخواهید تمام فایل ها را پاک کنید?", - questionTitlePatternText: "عنوان سوال", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["fa"] = persianSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["fa"] = "فارْسِى"; - - - /***/ }), - - /***/ "./src/localization/polish.ts": - /*!************************************!*\ - !*** ./src/localization/polish.ts ***! - \************************************/ - /*! exports provided: polishSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "polishSurveyStrings", function() { return polishSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var polishSurveyStrings = { - pagePrevText: "Wstecz", - pageNextText: "Dalej", - completeText: "Gotowe", - previewText: "Premiera", - editText: "Edycja", - startSurveyText: "Start", - otherItemText: "Inna odpowiedź (wpisz)", - noneItemText: "Brak", - selectAllItemText: "Wybierz wszystkie", - progressText: "Strona {0} z {1}", - panelDynamicProgressText: "Zapis {0} z {1}", - questionsProgressText: "Odpowiedzi na {0}/{1} pytania", - emptySurvey: "Nie ma widocznych pytań.", - completingSurvey: "Dziękujemy za wypełnienie ankiety!", - completingSurveyBefore: "Z naszych zapisów wynika, że wypełniłeś już tę ankietę.", - loadingSurvey: "Trwa wczytywanie ankiety...", - optionsCaption: "Wybierz...", - value: "Wartość", - requiredError: "Proszę odpowiedzieć na to pytanie.", - requiredErrorInPanel: "Proszę odpowiedzieć na co najmniej jedno pytanie.", - requiredInAllRowsError: "Proszę odpowiedzieć na wszystkie pytania.", - numericError: "W tym polu można wpisać tylko liczby.", - textMinLength: "Proszę wpisać co najmniej {0} znaków.", - textMaxLength: "Proszę wpisać mniej niż {0} znaków.", - textMinMaxLength: "Proszę wpisać więcej niż {0} i mniej niż {1} znaków.", - minRowCountError: "Proszę uzupełnić przynajmniej {0} wierszy.", - minSelectError: "Proszę wybrać co najmniej {0} pozycji.", - maxSelectError: "Proszę wybrać nie więcej niż {0} pozycji.", - numericMinMax: "Odpowiedź '{0}' powinna być większa lub równa {1} oraz mniejsza lub równa {2}", - numericMin: "Odpowiedź '{0}' powinna być większa lub równa {1}", - numericMax: "Odpowiedź '{0}' powinna być mniejsza lub równa {1}", - invalidEmail: "Proszę podać prawidłowy adres email.", - invalidExpression: "Wyrażenie: {0} powinno wracać 'prawdziwe'.", - urlRequestError: "Żądanie zwróciło błąd '{0}'. {1}", - urlGetChoicesError: "Żądanie nie zwróciło danych albo ścieżka jest nieprawidłowa", - exceedMaxSize: "Rozmiar przesłanego pliku nie może przekraczać {0}.", - otherRequiredError: "Proszę podać inną odpowiedź.", - uploadingFile: "Trwa przenoszenie Twojego pliku, proszę spróbować ponownie za kilka sekund.", - loadingFile: "Ładowanie...", - chooseFile: "Wybierz plik(i)...", - noFileChosen: "Nie wybrano żadnego pliku", - confirmDelete: "Chcesz skasować nagranie?", - keyDuplicationError: "Ta wartość powinna być wyjątkowa.", - addColumn: "Dodaj kolumnę", - addRow: "Dodaj wiersz", - removeRow: "Usuń", - addPanel: "Dodaj panel", - removePanel: "Usuń", - choices_Item: "element", - matrix_column: "Kolumna", - matrix_row: "Wiersz", - savingData: "Zapisuję wyniki ankiety na serwerze...", - savingDataError: "Wystąpił błąd i wyniki nie mogły zostać zapisane.", - savingDataSuccess: "Wyniki zostały poprawnie zapisane!", - saveAgainButton: "Spróbuj ponownie", - timerMin: "min", - timerSec: "sek", - timerSpentAll: "Spędziłeś {0} na tej stronie a w sumie {1}.", - timerSpentPage: "Spędziłeś {0} na tej stronie.", - timerSpentSurvey: "Spędziłeś w sumie {0}.", - timerLimitAll: "Spędziłeś {0} z {1} na tej stronie a w sumie {2} z {3}.", - timerLimitPage: "Spędziłeś {0} z {1} na tej stronie", - timerLimitSurvey: "Spędziłeś {0} z {1}.", - cleanCaption: "Wyczyść", - clearCaption: "Jasne", - chooseFileCaption: "Wybierz plik", - removeFileCaption: "Usuń ten plik", - booleanCheckedLabel: "Tak", - booleanUncheckedLabel: "Nie", - confirmRemoveFile: "Jesteś pewien, że chcesz usunąć ten plik: {0}?", - confirmRemoveAllFiles: "Jesteś pewien, że chcesz usunąć wszystkie pliki?", - questionTitlePatternText: "Tytuł pytania", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["pl"] = polishSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["pl"] = "polski"; - - - /***/ }), - - /***/ "./src/localization/portuguese-br.ts": - /*!*******************************************!*\ - !*** ./src/localization/portuguese-br.ts ***! - \*******************************************/ - /*! exports provided: portugueseBrSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "portugueseBrSurveyStrings", function() { return portugueseBrSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var portugueseBrSurveyStrings = { - pagePrevText: "Anterior", - pageNextText: "Próximo", - completeText: "Finalizar", - previewText: "Pré-visualização", - editText: "Editar", - startSurveyText: "Começar", - otherItemText: "Outros (descrever)", - noneItemText: "Nenhum", - selectAllItemText: "Selecionar Todos", - progressText: "Página {0} de {1}", - panelDynamicProgressText: "Registro {0} de {1}", - questionsProgressText: "Respostas {0}/{1} perguntas", - emptySurvey: "Não há página visível ou pergunta na pesquisa.", - completingSurvey: "Obrigado por finalizar a pesquisa!", - completingSurveyBefore: "Nossos registros mostram que você já finalizou a pesquisa.", - loadingSurvey: "A pesquisa está carregando...", - optionsCaption: "Selecione...", - value: "valor", - requiredError: "Por favor, responda a pergunta.", - requiredErrorInPanel: "Por favor, responda pelo menos uma pergunta.", - requiredInAllRowsError: "Por favor, responda as perguntas em todas as linhas.", - numericError: "O valor deve ser numérico.", - textMinLength: "Por favor, insira pelo menos {0} caracteres.", - textMaxLength: "Por favor, insira menos de {0} caracteres.", - textMinMaxLength: "Por favor, insira mais de {0} e menos de {1} caracteres.", - minRowCountError: "Preencha pelo menos {0} linhas.", - minSelectError: "Selecione pelo menos {0} opções.", - maxSelectError: "Por favor, selecione não mais do que {0} opções.", - numericMinMax: "O '{0}' deve ser igual ou superior a {1} e igual ou menor que {2}", - numericMin: "O '{0}' deve ser igual ou superior a {1}", - numericMax: "O '{0}' deve ser igual ou inferior a {1}", - invalidEmail: "Por favor, informe um e-mail válido.", - invalidExpression: "A expressão: {0} deve retornar 'verdadeiro'.", - urlRequestError: "A requisição retornou o erro '{0}'. {1}", - urlGetChoicesError: "A requisição não retornou dados ou o 'caminho' da requisição não está correto", - exceedMaxSize: "O tamanho do arquivo não deve exceder {0}.", - otherRequiredError: "Por favor, informe o outro valor.", - uploadingFile: "Seu arquivo está sendo carregado. Por favor, aguarde alguns segundos e tente novamente.", - loadingFile: "Carregando...", - chooseFile: "Selecione o(s) arquivo(s)...", - noFileChosen: "Nenhum arquivo escolhido", - confirmDelete: "Tem certeza que deseja deletar?", - keyDuplicationError: "Esse valor deve ser único.", - addColumn: "Adicionar coluna", - addRow: "Adicionar linha", - removeRow: "Remover linha", - addPanel: "Adicionar novo", - removePanel: "Remover", - choices_Item: "item", - matrix_column: "Coluna", - matrix_row: "Linha", - savingData: "Os resultados esto sendo salvos no servidor...", - savingDataError: "Ocorreu um erro e não foi possível salvar os resultados.", - savingDataSuccess: "Os resultados foram salvos com sucesso!", - saveAgainButton: "Tente novamente", - timerMin: "min", - timerSec: "seg", - timerSpentAll: "Você gastou {0} nesta página e {1} no total.", - timerSpentPage: "Você gastou {0} nesta página.", - timerSpentSurvey: "Você gastou {0} no total.", - timerLimitAll: "Você gastou {0} de {1} nesta página e {2} de {3} no total.", - timerLimitPage: "Você gastou {0} de {1} nesta página.", - timerLimitSurvey: "Você gastou {0} de {1} no total.", - cleanCaption: "Limpar", - clearCaption: "Limpar", - chooseFileCaption: "Escolher arquivo", - removeFileCaption: "Remover este arquivo", - booleanCheckedLabel: "Sim", - booleanUncheckedLabel: "Não", - confirmRemoveFile: "Tem certeza que deseja remover este arquivo: {0}?", - confirmRemoveAllFiles: "Tem certeza que deseja remover todos os arquivos?", - questionTitlePatternText: "Título da questão", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["pt-br"] = portugueseBrSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["pt-br"] = "português brasileiro"; - - - /***/ }), - - /***/ "./src/localization/portuguese.ts": - /*!****************************************!*\ - !*** ./src/localization/portuguese.ts ***! - \****************************************/ - /*! exports provided: portugueseSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "portugueseSurveyStrings", function() { return portugueseSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var portugueseSurveyStrings = { - pagePrevText: "Anterior", - pageNextText: "Próximo", - completeText: "Finalizar", - previewText: "Pré-visualização", - editText: "Editar", - startSurveyText: "Começar", - otherItemText: "Outros (descrever)", - noneItemText: "Nenhum", - selectAllItemText: "Selecionar Todos", - progressText: "Página {0} de {1}", - panelDynamicProgressText: "Registo {0} de {1}", - questionsProgressText: "Respostas {0}/{1} perguntas", - emptySurvey: "Não há página visível ou pergunta no questionário.", - completingSurvey: "Obrigado por finalizar o questionário!", - completingSurveyBefore: "Os nossos registos mostram que já finalizou o questionário.", - loadingSurvey: "O questionário está a carregar...", - optionsCaption: "Selecione...", - value: "valor", - requiredError: "Por favor, responda à pergunta.", - requiredErrorInPanel: "Por favor, responda pelo menos a uma pergunta.", - requiredInAllRowsError: "Por favor, responda às perguntas em todas as linhas.", - numericError: "O valor deve ser numérico.", - textMinLength: "Por favor, insira pelo menos {0} caracteres.", - textMaxLength: "Por favor, insira menos de {0} caracteres.", - textMinMaxLength: "Por favor, insira mais de {0} e menos de {1} caracteres.", - minRowCountError: "Preencha pelo menos {0} linhas.", - minSelectError: "Selecione pelo menos {0} opções.", - maxSelectError: "Por favor, selecione no máximo {0} opções.", - numericMinMax: "O '{0}' deve ser igual ou superior a {1} e igual ou menor que {2}", - numericMin: "O '{0}' deve ser igual ou superior a {1}", - numericMax: "O '{0}' deve ser igual ou inferior a {1}", - invalidEmail: "Por favor, insira um e-mail válido.", - invalidExpression: "A expressão: {0} deve retornar 'verdadeiro'.", - urlRequestError: "O pedido retornou o erro '{0}'. {1}", - urlGetChoicesError: "O pedido não retornou dados ou o 'caminho' do pedido não está correto", - exceedMaxSize: "O tamanho do arquivo não deve exceder {0}.", - otherRequiredError: "Por favor, insira o outro valor.", - uploadingFile: "O seu ficheiro está a carregar. Por favor, aguarde alguns segundos e tente novamente.", - loadingFile: "A carregar...", - chooseFile: "Selecione o(s) arquivo(s)...", - noFileChosen: "Nenhum ficheiro escolhido", - confirmDelete: "Tem a certeza que deseja apagar?", - keyDuplicationError: "Este valor deve ser único.", - addColumn: "Adicionar coluna", - addRow: "Adicionar linha", - removeRow: "Remover linha", - addPanel: "Adicionar novo", - removePanel: "Remover", - choices_Item: "item", - matrix_column: "Coluna", - matrix_row: "Linha", - savingData: "Os resultados estão a ser guardados no servidor...", - savingDataError: "Ocorreu um erro e não foi possível guardar os resultados.", - savingDataSuccess: "Os resultados foram guardados com sucesso!", - saveAgainButton: "Tente novamente", - timerMin: "min", - timerSec: "seg", - timerSpentAll: "Você gastou {0} nesta página e {1} no total.", - timerSpentPage: "Você gastou {0} nesta página.", - timerSpentSurvey: "Você gastou {0} no total.", - timerLimitAll: "Você gastou {0} de {1} nesta página e {2} de {3} no total.", - timerLimitPage: "Você gastou {0} de {1} nesta página.", - timerLimitSurvey: "Você gastou {0} de {1} no total.", - cleanCaption: "Limpar", - clearCaption: "Limpar", - chooseFileCaption: "Escolher ficheiro", - removeFileCaption: "Remover este ficheiro", - booleanCheckedLabel: "Sim", - booleanUncheckedLabel: "Não", - confirmRemoveFile: "Tem a certeza que deseja remover este ficheiro: {0}?", - confirmRemoveAllFiles: "Tem a certeza que deseja remover todos os ficheiros?", - questionTitlePatternText: "Título da questão", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["pt"] = portugueseSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["pt"] = "português"; - - - /***/ }), - - /***/ "./src/localization/romanian.ts": - /*!**************************************!*\ - !*** ./src/localization/romanian.ts ***! - \**************************************/ - /*! exports provided: romanianSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "romanianSurveyStrings", function() { return romanianSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var romanianSurveyStrings = { - pagePrevText: "Precedent", - pageNextText: "Următor", - completeText: "Finalizare", - previewText: "previzualizare", - editText: "Editați", - startSurveyText: "start", - otherItemText: "Altul(precizaţi)", - noneItemText: "Nici unul", - selectAllItemText: "Selectează tot", - progressText: "Pagina {0} din {1}", - panelDynamicProgressText: "Înregistrare {0} din {1}", - questionsProgressText: "Răspunsuri la {0} / {1} întrebări", - emptySurvey: "Nu sunt întrebări pentru acest chestionar", - completingSurvey: "Vă mulţumim pentru timpul acordat!", - completingSurveyBefore: "Din înregistrările noastre reiese că ați completat deja acest chestionar.", - loadingSurvey: "Chestionarul se încarcă...", - optionsCaption: "Alegeţi...", - value: "valoare", - requiredError: "Răspunsul la această întrebare este obligatoriu.", - requiredErrorInPanel: "Vă rugăm să răspundeți la cel puțin o întrebare.", - requiredInAllRowsError: "Toate răspunsurile sunt obligatorii", - numericError: "Răspunsul trebuie să fie numeric.", - textMinLength: "Trebuie să introduceți minim {0} caractere.", - textMaxLength: "Trebuie să introduceți maxim {0} caractere.", - textMinMaxLength: "Trebuie să introduceți mai mult de {0} și mai puțin de {1} caractere.", - minRowCountError: "Trebuie să completați minim {0} rânduri.", - minSelectError: "Trebuie să selectați minim {0} opţiuni.", - maxSelectError: "Trebuie să selectați maxim {0} opţiuni.", - numericMinMax: "Răspunsul '{0}' trebuie să fie mai mare sau egal ca {1} şî mai mic sau egal cu {2}", - numericMin: "Răspunsul '{0}' trebuie să fie mai mare sau egal ca {1}", - numericMax: "Răspunsul '{0}' trebuie să fie mai mic sau egal ca {1}", - invalidEmail: "Trebuie să introduceţi o adresa de email validă.", - invalidExpression: "Expresia: {0} ar trebui să returneze „adevărat”.", - urlRequestError: "Request-ul a returnat eroarea '{0}'. {1}", - urlGetChoicesError: "Request-ul nu a returnat date sau proprietatea 'path' este incorectă", - exceedMaxSize: "Dimensiunea fişierului nu trebuie să depăşească {0}.", - otherRequiredError: "Trebuie să completați câmpul 'Altul'.", - uploadingFile: "Fișierul dumneavoastră este în curs de încărcare. Vă rugăm așteptați câteva secunde și reveniți apoi.", - loadingFile: "Se încarcă...", - chooseFile: "Alege fisierele...", - noFileChosen: "Niciun fișier ales", - confirmDelete: "Sunteți sigur că doriți să ștergeți înregistrarea?", - keyDuplicationError: "Valoarea trebuie să fie unică.", - addColumn: "Adăugați coloană", - addRow: "Adăugare rând", - removeRow: "Ștergere", - addPanel: "Adăugare", - removePanel: "Ștergere", - choices_Item: "opțiune", - matrix_column: "Coloană", - matrix_row: "Rând", - savingData: "Rezultatele sunt în curs de salvare...", - savingDataError: "A intervenit o eroare, rezultatele nu au putut fi salvate.", - savingDataSuccess: "Rezultatele au fost salvate cu succes!", - saveAgainButton: "Încercați din nou", - timerMin: "min", - timerSec: "sec", - timerSpentAll: "Ați petrecut {0} pe această pagină și {1} în total.", - timerSpentPage: "Ați petrecut {0} pe această pagină.", - timerSpentSurvey: "Ați petrecut {0} în total.", - timerLimitAll: "Ați petrecut {0} din {1} pe această pagină și {2} din {3} în total.", - timerLimitPage: "Ați petrecut {0} din {1} pe această pagină.", - timerLimitSurvey: "Ați petrecut {0} din {1} în total.", - cleanCaption: "Curat", - clearCaption: "clar", - chooseFileCaption: "Alege fișierul", - removeFileCaption: "Eliminați acest fișier", - booleanCheckedLabel: "da", - booleanUncheckedLabel: "Nu", - confirmRemoveFile: "Sigur doriți să eliminați acest fișier: {0}?", - confirmRemoveAllFiles: "Sigur doriți să eliminați toate fișierele?", - questionTitlePatternText: "Titlul intrebarii", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ro"] = romanianSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ro"] = "română"; - - - /***/ }), - - /***/ "./src/localization/russian.ts": - /*!*************************************!*\ - !*** ./src/localization/russian.ts ***! - \*************************************/ - /*! exports provided: russianSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "russianSurveyStrings", function() { return russianSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var russianSurveyStrings = { - pagePrevText: "Назад", - pageNextText: "Далее", - completeText: "Готово", - previewText: "Предварительный просмотр", - editText: "Редактирование", - startSurveyText: "Начать", - otherItemText: "Другое (пожалуйста, опишите)", - noneItemText: "Нет", - selectAllItemText: "Выбрать всё", - progressText: "Страница {0} из {1}", - panelDynamicProgressText: "Запись {0} из {1}", - questionsProgressText: "Ответы на {0}/{1}вопросы", - emptySurvey: "Нет ни одного вопроса.", - completingSurvey: "Благодарим Вас за заполнение анкеты!", - completingSurveyBefore: "Вы уже проходили этот опрос.", - loadingSurvey: "Загрузка с сервера...", - optionsCaption: "Выбрать...", - value: "значение", - requiredError: "Пожалуйста, ответьте на вопрос.", - requiredErrorInPanel: "Пожалуйста, ответьте по крайней мере на один вопрос.", - requiredInAllRowsError: "Пожалуйста, ответьте на вопросы в каждой строке.", - numericError: "Ответ должен быть числом.", - textMinLength: "Пожалуйста введите больше {0} символов.", - textMaxLength: "Пожалуйста введите меньше {0} символов.", - textMinMaxLength: "Пожалуйста введите больше {0} и меньше {1} символов.", - minRowCountError: "Пожалуйста, заполните не меньше {0} строк.", - minSelectError: "Пожалуйста, выберите хотя бы {0} вариантов.", - maxSelectError: "Пожалуйста, выберите не более {0} вариантов.", - numericMinMax: "'{0}' должно быть не меньше чем {1}, и не больше чем {2}", - numericMin: "'{0}' должно быть не меньше чем {1}", - numericMax: "'{0}' должно быть не больше чем {1}", - invalidEmail: "Пожалуйста, введите действительный адрес электронной почты.", - invalidExpression: "Выражение {0} должно возвращать 'true'.", - urlRequestError: "Запрос вернул ошибку '{0}'. {1}", - urlGetChoicesError: "Ответ на запрос пришел пустой или свойство 'path' указано неверно", - exceedMaxSize: "Размер файла не должен превышать {0}.", - otherRequiredError: "Пожалуйста, введите данные в поле 'Другое'", - uploadingFile: "Ваш файл загружается. Подождите несколько секунд и попробуйте снова.", - loadingFile: "Загрузка...", - chooseFile: "Выберите файл(ы)...", - noFileChosen: "Файл не выбран", - confirmDelete: "Вы точно хотите удалить запись?", - keyDuplicationError: "Это значение должно быть уникальным.", - addColumn: "Добавить колонку", - addRow: "Добавить строку", - removeRow: "Удалить", - addPanel: "Добавить новую", - removePanel: "Удалить", - choices_Item: "Вариант", - matrix_column: "Колонка", - matrix_row: "Строка", - savingData: "Результаты сохраняются на сервер...", - savingDataError: "Произошла ошибка, результат не был сохранён.", - savingDataSuccess: "Результат успешно сохранён!", - saveAgainButton: "Попробовать снова", - timerMin: "мин", - timerSec: "сек", - timerSpentAll: "Вы потратили {0} на этой странице и {1} всего.", - timerSpentPage: "Вы потратили {0} на этой странице.", - timerSpentSurvey: "Вы потратили {0} в течение теста.", - timerLimitAll: "Вы потратили {0} из {1} на этой странице и {2} из {3} для всего теста.", - timerLimitPage: "Вы потратили {0} из {1} на этой странице.", - timerLimitSurvey: "Вы потратили {0} из {1} для всего теста.", - cleanCaption: "Очистить", - clearCaption: "Очистить", - chooseFileCaption: "Выберите файл", - removeFileCaption: "Удалить файл", - booleanCheckedLabel: "Да", - booleanUncheckedLabel: "Нет", - confirmRemoveFile: "Вы уверены, что хотите удалить этот файл: {0}?", - confirmRemoveAllFiles: "Вы уверены, что хотите удалить все файлы?", - questionTitlePatternText: "Название вопроса", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ru"] = russianSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ru"] = "русский"; - - - /***/ }), - - /***/ "./src/localization/serbian.ts": - /*!*************************************!*\ - !*** ./src/localization/serbian.ts ***! - \*************************************/ - /*! exports provided: serbianStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serbianStrings", function() { return serbianStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - //Uncomment this line on creating a translation file - - var serbianStrings = { - pagePrevText: "Nazad", - pageNextText: "Dalje", - completeText: "Završi", - previewText: "Pregledaj", - editText: "Izmeni", - startSurveyText: "Započni", - otherItemText: "Drugo (upiši)", - noneItemText: "Ništa", - selectAllItemText: "Izaberi sve", - progressText: "Stranica {0} od {1}", - panelDynamicProgressText: "Upis {0} od {1}", - questionsProgressText: "Odgovoreno na {0}/{1} pitanja", - emptySurvey: "Nema vidljivih stranica ili pitanja u anketi.", - completingSurvey: "Hvala na popunjavanju ankete!", - completingSurveyBefore: "Prema našim podacima, već ste popunili ovu anketu.", - loadingSurvey: "Učitavam anketu...", - optionsCaption: "Izaberi...", - value: "vrednost", - requiredError: "Molimo odgovorite na ovo pitanje.", - requiredErrorInPanel: "Molimo odgovorite na bar jedno pitanje.", - requiredInAllRowsError: "Molimo odgovorite na pitanja u svim redovima.", - numericError: "Vrednost bi trebalo da bude numerička.", - minError: "Vrednost ne bi trebalo da bude manja od {0}", - maxError: "Vrednost ne bi trebalo da bude veća od {0}", - textMinLength: "Molimo unesite bar {0} znak(ov)a.", - textMaxLength: "Molimo unesite najviše {0} znak(ov)a.", - textMinMaxLength: "Molimo unesite najmanje {0} i ne više od {1} znak(ov)a.", - minRowCountError: "Molimo popunite najmanje {0} red(ova).", - minSelectError: "Molimo izaberite najmanje {0} opcija/e.", - maxSelectError: "Molimo izaberite najviše {0} opcija/e.", - numericMinMax: "'{0}' bi trebalo da bude najmanje {1} i najviše {2}", - numericMin: "'{0}' bi trebalo da bude najmanje {1}", - numericMax: "'{0}' bi trebalo da bude najviše {1}", - invalidEmail: "Molimo unesite ispravnu e-mail adresu.", - // vratiti "true" ? - invalidExpression: "Izraz: {0} bi trebalo da bude tačan.", - urlRequestError: "Zahtev je naišao na grešku '{0}'. {1}", - urlGetChoicesError: "Zahtev nije pronašao podatke, ili je putanja netačna", - exceedMaxSize: "Veličina fajla ne bi trebalo da prelazi {0}.", - otherRequiredError: "Molimo unesite drugu vrednost.", - uploadingFile: "Fajl se šalje. Molimo sačekajte neko vreme i pokušajte ponovo.", - loadingFile: "Učitavanje...", - chooseFile: "Izaberite fajlove...", - noFileChosen: "Nije izabran nijedan fajl", - confirmDelete: "Da li želite da izbrišete unos?", - keyDuplicationError: "Ova vrednost treba da bude jedinstvena.", - addColumn: "Dodaj kolonu", - addRow: "Dodaj red", - removeRow: "Ukloni", - emptyRowsText: "Nema redova.", - addPanel: "Dodaj novo", - removePanel: "Ukloni", - choices_Item: "stavka", - matrix_column: "Kolona", - matrix_row: "Red", - multipletext_itemname: "tekst", - savingData: "U toku je čuvanje podataka na serveru...", - savingDataError: "Došlo je do greške i rezultati nisu sačuvani.", - savingDataSuccess: "Rezultati su uspešno sačuvani!", - saveAgainButton: "Pokušajte ponovo", - timerMin: "min", - timerSec: "sek", - timerSpentAll: "Proveli ste {0} na ovoj stranici i {1} ukupno.", - timerSpentPage: "Proveli ste {0} na ovoj stranici.", - timerSpentSurvey: "Proveli ste {0} ukupno.", - timerLimitAll: "Proveli ste {0} od {1} na ovoj stranici i {2} od {3} ukupno.", - timerLimitPage: "Proveli ste {0} od {1} na ovoj stranici.", - timerLimitSurvey: "Proveli ste {0} od {1} ukupno.", - cleanCaption: "Očisti", - clearCaption: "Poništi", - chooseFileCaption: "Izaberi fajl", - removeFileCaption: "Ukloni ovaj fajl", - booleanCheckedLabel: "Da", - booleanUncheckedLabel: "Ne", - confirmRemoveFile: "Da li ste sigurni da želite da uklonite ovaj fajl: {0}?", - confirmRemoveAllFiles: "Da li ste sigurni da želite da uklonite sve fajlove?", - questionTitlePatternText: "Naslov pitanja", - modalCancelButtonText: "Otkaži", - modalApplyButtonText: "Primeni", - }; - //Uncomment these two lines on creating a translation file. You should replace "en" and enStrings with your locale ("fr", "de" and so on) and your variable. - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["rs"] = serbianStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["rs"] = "Srpski"; - - - /***/ }), - - /***/ "./src/localization/simplified-chinese.ts": - /*!************************************************!*\ - !*** ./src/localization/simplified-chinese.ts ***! - \************************************************/ - /*! exports provided: simplifiedChineseSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "simplifiedChineseSurveyStrings", function() { return simplifiedChineseSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var simplifiedChineseSurveyStrings = { - pagePrevText: "上一页", - pageNextText: "下一页", - completeText: "提交问卷", - previewText: "预览", - editText: "编辑", - startSurveyText: "开始问卷", - otherItemText: "填写其他答案", - noneItemText: "无", - selectAllItemText: "选择全部", - progressText: "第 {0} 页, 共 {1} 页", - panelDynamicProgressText: "{0} of {1}", - questionsProgressText: "第 {0}/{1} 题", - emptySurvey: "问卷中没有问题或页面", - completingSurvey: "感谢您的参与!", - completingSurveyBefore: "你已完成问卷.", - loadingSurvey: "问卷正在加载中...", - optionsCaption: "请选择...", - value: "值", - requiredError: "请填写此问题", - requiredErrorInPanel: "至少回答一题.", - requiredInAllRowsError: "请填写所有行中问题", - numericError: "答案必须是个数字", - minError: "该值不能小于 {0}", - maxError: "该值不能大于 {0}", - textMinLength: "答案长度至少 {0} 个字符", - textMaxLength: "答案长度不能超过 {0} 个字符", - textMinMaxLength: "答案长度必须在 {0} - {1} 个字符之间", - minRowCountError: "最少需要填写 {0} 行答案", - minSelectError: "最少需要选择 {0} 项答案", - maxSelectError: "最多只能选择 {0} 项答案", - numericMinMax: "答案 '{0}' 必须大于等于 {1} 且小于等于 {2}", - numericMin: "答案 '{0}' 必须大于等于 {1}", - numericMax: "答案 '{0}' 必须小于等于 {1}", - invalidEmail: "请输入有效的 Email 地址", - invalidExpression: "公式: {0} 无效.", - urlRequestError: "载入选项时发生错误 '{0}': {1}", - urlGetChoicesError: "未能载入有效的选项或请求参数路径有误", - exceedMaxSize: "文件大小不能超过 {0}", - otherRequiredError: "请完成其他问题", - uploadingFile: "文件上传中... 请耐心等待几秒后重试", - loadingFile: "加载...", - chooseFile: "选择文件...", - noFileChosen: "未选择文件", - confirmDelete: "删除记录?", - keyDuplicationError: "主键不能重复", - addColumn: "添加列", - addRow: "添加行", - removeRow: "删除答案", - emptyRowsText: "无内容", - addPanel: "新添", - removePanel: "删除", - choices_Item: "选项", - matrix_column: "列", - matrix_row: "行", - multipletext_itemname: "文本", - savingData: "正在将结果保存到服务器...", - savingDataError: "在保存结果过程中发生了错误,结果未能保存", - savingDataSuccess: "结果保存成功!", - saveAgainButton: "请重试", - timerMin: "分", - timerSec: "秒", - timerSpentAll: "本页用时 {0} 总计用时{1} .", - timerSpentPage: "本页用时{0} .", - timerSpentSurvey: "总计用时 {0} .", - timerLimitAll: "本页用时 {0} 共 {1}, 总计用时 {2} 共 {3} .", - timerLimitPage: "本页用时 {0} 共 {1} .", - timerLimitSurvey: "总计用时 {0} 共 {1}.", - cleanCaption: "清理", - clearCaption: "清除", - chooseFileCaption: "选择文件", - removeFileCaption: "移除文件", - booleanCheckedLabel: "是", - booleanUncheckedLabel: "否", - confirmRemoveFile: "删除文件: {0}?", - confirmRemoveAllFiles: "删除所有文件?", - questionTitlePatternText: "标题", - modalCancelButtonText: "取消", - modalApplyButtonText: "确定", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["zh-cn"] = simplifiedChineseSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["zh-cn"] = "简体中文"; - - - /***/ }), - - /***/ "./src/localization/spanish.ts": - /*!*************************************!*\ - !*** ./src/localization/spanish.ts ***! - \*************************************/ - /*! exports provided: spanishSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spanishSurveyStrings", function() { return spanishSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var spanishSurveyStrings = { - pagePrevText: "Anterior", - pageNextText: "Siguiente", - completeText: "Completar", - previewText: "Vista previa", - editText: "Edita", - startSurveyText: "Comienza", - otherItemText: "Otro (describa)", - noneItemText: "Ninguno", - selectAllItemText: "Seleccionar todo", - progressText: "Página {0} de {1}", - panelDynamicProgressText: "Registro {0} de {1}", - questionsProgressText: "Respondió a {0}/{1} preguntas", - emptySurvey: "No hay página visible o pregunta en la encuesta.", - completingSurvey: "Gracias por completar la encuesta!", - completingSurveyBefore: "Nuestros registros muestran que ya ha completado esta encuesta.", - loadingSurvey: "La encuesta está cargando...", - optionsCaption: "Seleccione...", - value: "valor", - requiredError: "Por favor conteste la pregunta.", - requiredErrorInPanel: "Por favor, responda al menos una pregunta.", - requiredInAllRowsError: "Por favor conteste las preguntas en cada hilera.", - numericError: "La estimación debe ser numérica.", - minError: "La estimación no debe ser menor que {0}", - maxError: "La estimación no debe ser mayor que {0}", - textMinLength: "Por favor entre por lo menos {0} símbolos.", - textMaxLength: "Por favor entre menos de {0} símbolos.", - textMinMaxLength: "Por favor entre más de {0} y menos de {1} símbolos.", - minRowCountError: "Por favor llene por lo menos {0} hileras.", - minSelectError: "Por favor seleccione por lo menos {0} variantes.", - maxSelectError: "Por favor seleccione no más de {0} variantes.", - numericMinMax: "El '{0}' debe de ser igual o más de {1} y igual o menos de {2}", - numericMin: "El '{0}' debe ser igual o más de {1}", - numericMax: "El '{0}' debe ser igual o menos de {1}", - invalidEmail: "Por favor agregue un correo electrónico válido.", - invalidExpression: "La expresión: {0} debería devolver 'verdadero'.", - urlRequestError: "La solicitud regresó error '{0}'. {1}", - urlGetChoicesError: "La solicitud regresó vacío de data o la propiedad 'trayectoria' no es correcta", - exceedMaxSize: "El tamaño del archivo no debe de exceder {0}.", - otherRequiredError: "Por favor agregue la otra estimación.", - uploadingFile: "Su archivo se está subiendo. Por favor espere unos segundos e intente de nuevo.", - loadingFile: "Cargando...", - chooseFile: "Elija archivo(s)...", - noFileChosen: "No se ha elegido ningún archivo", - confirmDelete: "¿Quieres borrar el registro?", - keyDuplicationError: "Este valor debe ser único.", - addColumn: "Añadir columna", - addRow: "Agregue una hilera", - removeRow: "Eliminar una hilera", - emptyRowsText: "No hay hileras.", - addPanel: "Añadir nuevo", - removePanel: "Retire", - choices_Item: "artículo", - matrix_column: "Columna", - matrix_row: "Hilera", - multipletext_itemname: "texto", - savingData: "Los resultados se están guardando en el servidor...", - savingDataError: "Los resultados se están guardando en el servidor...", - savingDataSuccess: "¡Los resultados se guardaron con éxito!", - saveAgainButton: "Inténtalo de nuevo.", - timerMin: "min", - timerSec: "sec", - timerSpentAll: "Has gastado {0} en esta página y {1} en total.", - timerSpentPage: "Usted ha pasado {0} en esta página.", - timerSpentSurvey: "Has gastado en total.", - timerLimitAll: "Has gastado {0} de {1} en esta página y {2} de {3} en total.", - timerLimitPage: "Has gastado {0} de {1} en esta página.", - timerLimitSurvey: "Usted ha gastado {0} de {1} en total.", - cleanCaption: "Limpia", - clearCaption: "Despejen", - signaturePlaceHolder: "Firma aqui", - chooseFileCaption: "Elija el archivo", - removeFileCaption: "Elimina este archivo", - booleanCheckedLabel: "Sí", - booleanUncheckedLabel: "No", - confirmRemoveFile: "¿Estás seguro de que quieres eliminar este archivo: {0}?", - confirmRemoveAllFiles: "¿Estás seguro de que quieres eliminar todos los archivos?", - questionTitlePatternText: "Título de la pregunta", - modalCancelButtonText: "Anular", - modalApplyButtonText: "Aplicar", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["es"] = spanishSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["es"] = "español"; - - - /***/ }), - - /***/ "./src/localization/swahili.ts": - /*!*************************************!*\ - !*** ./src/localization/swahili.ts ***! - \*************************************/ - /*! exports provided: swahiliStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "swahiliStrings", function() { return swahiliStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var swahiliStrings = { - pagePrevText: "Iliyotangulia", - pageNextText: "Ifuatayo", - completeText: "Kamili", - previewText: "Hakiki", - editText: "Hariri", - startSurveyText: "Anza", - otherItemText: "Nyingine (eleza)", - noneItemText: "Hakuna", - selectAllItemText: "Chagua Zote", - progressText: "Ukurasa {0} wa {1}", - panelDynamicProgressText: "Rekodi {0} ya {1}", - questionsProgressText: "Yaliyojibiwa {0}/{1} maswali", - emptySurvey: "Hakuna ukurasa unaoonekana au swali katika utafiti.", - completingSurvey: "Asanti kwa kukamilisha utafiti!", - completingSurveyBefore: "Recodi zetu zinatuonyesha tayari umekamilisha utafiti.", - loadingSurvey: "Tunaandaa utafiti...", - optionsCaption: "Chagua...", - value: "thamani", - requiredError: "Tafadhali jibu hili swali.", - requiredErrorInPanel: "Tafadhali jibu swali angalau moja.", - requiredInAllRowsError: "Tafadhali jibu maswali katika safu zote.", - numericError: "Thamani inapaswa kuwa ya nambari.", - textMinLength: "Tafadhali ingiza angalau{0} husika.", - textMaxLength: "Tafadhali ingiza isiozidi {0} husika.", - textMinMaxLength: "Tafadhali ingiza kiwango zaidi ya {0} na kisichopungua {1} husika.", - minRowCountError: "Tafadhali jaza isiopungua {0} safu.", - minSelectError: "Tafadhali chagua angalau {0} lahaja.", - maxSelectError: "Tafadhali changua isiozidi {0} lahaja.", - numericMinMax: " '{0}' inapaswa kuwa sawa au zaidi ya {1} na sawa au chini ya {2}", - numericMin: " '{0}'inapaswa kuwa sawa au zaidi ya {1}", - numericMax: " '{0}'inapaswa kuwa sawa au chini ya {1}", - invalidEmail: "Tafadhali ingiza anwani halali ya barua-pepe.", - invalidExpression: "Usemi:{0} inapaswa kurudi 'kweli'.", - urlRequestError: "Ombi lina kosa '{0}'. {1}", - urlGetChoicesError: "Ombi lilirudisha data tupu au the 'path' mali ya njia sio sahihi", - exceedMaxSize: "Saizi ya faili haipaswi kuzidi {0}.", - otherRequiredError: "Tafadhali ingiza thamani nyingine.", - uploadingFile: "Faili yako inapakia.Tafadhali subiri sekunde kadhaa na ujaribu tena.", - loadingFile: "Inapakia...", - chooseFile: "Chagua faili...", - noFileChosen: "Hujachagua faili", - confirmDelete: "Je! Unataka kufuta rekodi?", - keyDuplicationError: "Thamani hii inapaswa kuwa ya kipekee.", - addColumn: "Ongeza Kolamu", - addRow: "Ongeza safu", - removeRow: "Toa", - addPanel: "Ongeza mpya", - removePanel: "Toa", - choices_Item: "kitu", - matrix_column: "Kolamu", - matrix_row: "Safu", - savingData: "Matokeo yamehifadhiwa kwa seva...", - savingDataError: "Kosa limetokea na hatukuweza kuhifadhi matokeo.", - savingDataSuccess: "Matokeo yamehifadhiwa!", - saveAgainButton: "Jaribu tena", - timerMin: "dakika", - timerSec: "sekunde", - timerSpentAll: "Umetumia {0} kwenye ukurasa huu na {1} kwa jumla.", - timerSpentPage: "Umetumia {0} kwenye ukurasa huu.", - timerSpentSurvey: "Umetumia {0} kwa jumla.", - timerLimitAll: "Umetumia {0} ya {1} kwenye ukurasa huu {2} wa {3} kwa jumla.", - timerLimitPage: "Umetumia {0} ya {1} kwenye ukurasa huu.", - timerLimitSurvey: "Umetumia {0} ya {1} kwa jumla.", - cleanCaption: "Safisha", - clearCaption: "Ondoa", - chooseFileCaption: "Chagua faili", - removeFileCaption: "Ondoa faili", - booleanCheckedLabel: "Ndio", - booleanUncheckedLabel: "Hapana", - confirmRemoveFile: "Je! Una uhakika kuwa unataka kuondoa faili hii: {0}?", - confirmRemoveAllFiles: "Je! Una uhakika kuwa unataka kuondoa faili zote?", - questionTitlePatternText: "Kichwa cha Swali", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["sw"] = swahiliStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["sw"] = "swahili"; - - - /***/ }), - - /***/ "./src/localization/swedish.ts": - /*!*************************************!*\ - !*** ./src/localization/swedish.ts ***! - \*************************************/ - /*! exports provided: swedishSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "swedishSurveyStrings", function() { return swedishSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - //Create by Mattias Asplund - - var swedishSurveyStrings = { - pagePrevText: "Föregående", - pageNextText: "Nästa", - completeText: "Färdig", - previewText: "Förhandsvisning", - editText: "Redigera", - startSurveyText: "Start", - otherItemText: "Annat (beskriv)", - noneItemText: "Ingen", - selectAllItemText: "Välj alla", - progressText: "Sida {0} av {1}", - panelDynamicProgressText: "Spela in {0} av {1}", - questionsProgressText: "Besvarade {0} / {1} frågor", - emptySurvey: "Det finns ingen synlig sida eller fråga i enkäten.", - completingSurvey: "Tack för att du genomfört enkäten!!", - completingSurveyBefore: "Våra register visar att du redan har slutfört denna undersökning.", - loadingSurvey: "Enkäten laddas...", - optionsCaption: "Välj...", - value: "värde", - requiredError: "Var vänlig besvara frågan.", - requiredErrorInPanel: "Vänligen svara på minst en fråga.", - requiredInAllRowsError: "Var vänlig besvara frågorna på alla rader.", - numericError: "Värdet ska vara numeriskt.", - textMinLength: "Var vänlig ange minst {0} tecken.", - textMaxLength: "Ange färre än {0} tecken.", - textMinMaxLength: "Ange mer än {0} och färre än {1} tecken.", - minRowCountError: "Var vänlig fyll i minst {0} rader.", - minSelectError: "Var vänlig välj åtminstone {0} varianter.", - maxSelectError: "Var vänlig välj inte fler än {0} varianter.", - numericMinMax: "'{0}' ska vara lika med eller mer än {1} samt lika med eller mindre än {2}", - numericMin: "'{0}' ska vara lika med eller mer än {1}", - numericMax: "'{0}' ska vara lika med eller mindre än {1}", - invalidEmail: "Var vänlig ange en korrekt e-postadress.", - invalidExpression: "Uttrycket: {0} ska returnera 'true'.", - urlRequestError: "Förfrågan returnerade felet '{0}'. {1}", - urlGetChoicesError: "Antingen returnerade förfrågan ingen data eller så är egenskapen 'path' inte korrekt", - exceedMaxSize: "Filstorleken får ej överstiga {0}.", - otherRequiredError: "Var vänlig ange det andra värdet.", - uploadingFile: "Din fil laddas upp. Var vänlig vänta några sekunder och försök sedan igen.", - loadingFile: "Läser in...", - chooseFile: "Välj fil (er) ...", - noFileChosen: "Ingen fil vald", - confirmDelete: "Vill du radera posten?", - keyDuplicationError: "Detta värde ska vara unikt.", - addColumn: "Lägg till kolumn", - addRow: "Lägg till rad", - removeRow: "Ta bort", - addPanel: "Lägg till ny", - removePanel: "Ta bort", - choices_Item: "Artikel", - matrix_column: "Kolumn", - matrix_row: "Rad", - savingData: "Resultaten sparas på servern ...", - savingDataError: "Ett fel inträffade och vi kunde inte spara resultaten.", - savingDataSuccess: "Resultaten sparades framgångsrikt!", - saveAgainButton: "Försök igen", - timerMin: "min", - timerSec: "sek", - timerSpentAll: "Du har spenderat {0} på den här sidan och {1} totalt.", - timerSpentPage: "Du har spenderat {0} på den här sidan.", - timerSpentSurvey: "Du har spenderat {0} totalt.", - timerLimitAll: "Du har spenderat {0} av {1} på den här sidan och {2} av {3} totalt.", - timerLimitPage: "Du har spenderat {0} av {1} på den här sidan.", - timerLimitSurvey: "Du har spenderat {0} av {1} totalt.", - cleanCaption: "Rena", - clearCaption: "Klar", - chooseFileCaption: "Välj FIL", - removeFileCaption: "Ta bort den här filen", - booleanCheckedLabel: "Ja", - booleanUncheckedLabel: "Nej", - confirmRemoveFile: "Är du säker på att du vill ta bort den här filen: {0}?", - confirmRemoveAllFiles: "Är du säker på att du vill ta bort alla filer?", - questionTitlePatternText: "Frågetitel", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["sv"] = swedishSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["sv"] = "svenska"; - - - /***/ }), - - /***/ "./src/localization/tajik.ts": - /*!***********************************!*\ - !*** ./src/localization/tajik.ts ***! - \***********************************/ - /*! exports provided: tajikSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tajikSurveyStrings", function() { return tajikSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var tajikSurveyStrings = { - pagePrevText: "Бозгашт", - pageNextText: "Оянда", - completeText: "Иҷро шуд", - startSurveyText: "Оғоз", - otherItemText: "Дигар (лутфан тавсиф кунед)", - noneItemText: "Не", - selectAllItemText: "Ҳамаро интихоб кардан", - progressText: "Саҳифаи {0} аз {1}", - emptySurvey: "Ягон савол вуҷуд надорад.", - completingSurvey: "Ташаккур барои пур кардани саволнома!", - completingSurveyBefore: "Шумо аллакай ин пурсишро анҷом додаед.", - loadingSurvey: "Боргирӣ аз сервер...", - optionsCaption: "Интихоб кардан...", - value: "қиммат", - requiredError: "Илтимос, ба савол ҷавоб диҳед.", - requiredErrorInPanel: "Илтимос, ақалан ба як савол ҷавоб диҳед.", - requiredInAllRowsError: "Илтимос, ба ҳамаи саволҳо дар ҳамаи сатрҳо ҷавоб диҳед.", - numericError: "Ҷавоб бояд рақам бошад.", - textMinLength: "Илтимос, аз {0} зиёдтар рамз ворид кунед.", - textMaxLength: "Илтимос, аз {0} камтар рамз ворид кунед.", - textMinMaxLength: "Илтимос, аз {0} зиёдтар ва аз {1} камтар рамз ворид кунед.", - minRowCountError: "Илтимос, на камтар аз {0} сатр пур кунед.", - minSelectError: "Илтимос, ақалан {0} вариант интихоб кунед.", - maxSelectError: "Илтимос, на зиёдтар аз {0} вариант интихоб кунед.", - numericMinMax: "'{0}' бояд на кам аз {1} ва на бисёр аз {2} бошад", - numericMin: "'{0}' бояд на кам аз {1} бошад", - numericMax: "'{0}' бояд на зиёд аз {1} бошад", - invalidEmail: "Илтимос, почтаи электронии воқеиро ворид кунед.", - invalidExpression: "Ифодаи {0} бояд 'true' баргардонад.", - urlRequestError: "Дархост хатогӣ бозгардонд '{0}'. {1}", - urlGetChoicesError: "Ҷавоб ба дархост холӣ омад ё хосияти 'path' нодуруст муайян карда шудааст", - exceedMaxSize: "Андозаи файл бояд на калон аз {0} бошад.", - otherRequiredError: "Илтимос, ба майдони 'Дигар' додаҳоро ворид кунед", - uploadingFile: "Файли шумо бор шуда истодааст. Якчанд сония интизор шавед ва бори дигар кӯшиш кунед.", - loadingFile: "Боркунӣ...", - chooseFile: "Файл(ҳо)-ро интихоб кунед...", - confirmDelete: "Шумо мутмаин ҳастед, ки мехоҳед воридро тоза кунед?", - keyDuplicationError: "Ин арзиш бояд беназир бошад.", - addColumn: "Иловаи сутун", - addRow: "Иловаи сатр", - removeRow: "Нест кардан", - addPanel: "Илова кардан", - removePanel: "Нест кардан", - choices_Item: "Вариант", - matrix_column: "Сутун", - matrix_row: "Сатр", - savingData: "Натиҷа ба сервер сабт шуда истодаанд...", - savingDataError: "Хатогӣ ба амал омад, натиҷа сабт нашуд.", - savingDataSuccess: "Натиҷа бомуваффакият сабт шуд!", - saveAgainButton: "Бори дигар кӯшиш карданд", - timerMin: "дақ", - timerSec: "сон", - timerSpentAll: "Шумо {0} дар ин саҳифа ва {1} дар умум сарф кардед.", - timerSpentPage: "Шумо {0} дар ин саҳифа сарф кардед.", - timerSpentSurvey: "Шумо {0} дар ин тест сарф намудед.", - timerLimitAll: "Шумо {0} аз {1} дар ин саҳифа ва {2} аз {3} дар умум сарф кардед дар дохили ин тест.", - timerLimitPage: "Шумо {0} аз {1} дар ин саҳифа сарф кардед.", - timerLimitSurvey: "Шумо {0} аз {1} дар ҳамаи тест сарф кардед.", - cleanCaption: "Тоза кардан", - clearCaption: "Тоза кардан", - removeFileCaption: "Файлро нест кардан" - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["tg"] = tajikSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["tg"] = "тоҷикӣ"; - - - /***/ }), - - /***/ "./src/localization/thai.ts": - /*!**********************************!*\ - !*** ./src/localization/thai.ts ***! - \**********************************/ - /*! exports provided: thaiStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "thaiStrings", function() { return thaiStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - //Created by Padet Taweekunkan - - var thaiStrings = { - pagePrevText: "ก่อนหน้า", - pageNextText: "ถัดไป", - completeText: "สำเร็จ", - previewText: "ดูตัวอย่าง", - editText: "แก้ไข", - startSurveyText: "เริ่ม", - otherItemText: "อื่นๆ (โปรดระบุ)", - noneItemText: "ไม่มี", - selectAllItemText: "เลือกทั้งหมด", - progressText: "หน้าที่ {0} จาก {1}", - panelDynamicProgressText: "รายการที่ {0} จาก {1}", - questionsProgressText: "คำตอบที่ {0}/{1} จำนวนคำถาม", - emptySurvey: "ไม่มีหน้าเพจที่มองเห็น หรือ คำถามใน survey นี้", - completingSurvey: "ขอบคุณที่ทำ survey จนเสร็จ", - completingSurveyBefore: "รายการของเราแสดงว่าคุณได้ทำ survey เสร็จเรียบร้อยแล้ว", - loadingSurvey: "กำลังโหลด Survey...", - optionsCaption: "เลือก...", - value: "ข้อมูล", - requiredError: "กรุณาตอบคำถาม", - requiredErrorInPanel: "กรุณาตอบขั้นต่ำหนึ่งคำถาม", - requiredInAllRowsError: "กรุณาตอบคำถามในทุกๆแถว", - numericError: "ข้อมูลที่ใส่ต้องเป็นตัวเลข", - textMinLength: "กรุณาใส่ขั้นต่ำจำนวน {0} ตัวอักษร", - textMaxLength: "กรุณาใส่ไม่เกินจำนวน {0} ตัวอักษร", - textMinMaxLength: "กรุณาใส่ขั้นต่ำจำนวน {0} และไม่เกินจำนวน {1} ตัวอักษร", - minRowCountError: "กรุณาใส่ขั้นต่ำจำนวน {0} แถว", - minSelectError: "กรุณาเลือกอย่างน้อย {0} รายการ", - maxSelectError: "กรุณาเลือกไม่เกิน {0} รายการ", - numericMinMax: "'{0}' ต้องมากกว่าหรือเท่ากับ {1} และน้อยกว่าหรือเท่ากับ {2}", - numericMin: "'{0}' ต้องมากกว่าหรือเท่ากับ {1}", - numericMax: "'{0}' น้อยกว่าหรือเท่ากับ {1}", - invalidEmail: "กรุณาใส่อีเมล์แอดเดรสที่ถูกต้อง", - invalidExpression: "The expression: {0} ต้องรีเทิร์น 'true'.", - urlRequestError: "รีเควสรีเทิร์น error '{0}'. {1}", - urlGetChoicesError: "รีเควสรีเทิร์นข้อมูลว่างเปล่า หรือ 'path' property ไม่ถูกต้อง", - exceedMaxSize: "ขนาดไฟล์ต้องไม่เกิน {0}.", - otherRequiredError: "กรุณาใส่ค่าอื่น", - uploadingFile: "ไฟล์ของคุณกำลังอัพโหลดอยู่. กรุณารอสักครู่แล้วทำการลองอีกครั้ง", - loadingFile: "กำลังโหลด...", - chooseFile: "เลือกไฟล์...", - noFileChosen: "ไม่ไฟล์ที่เลือก", - confirmDelete: "คุณต้องการลบรายการนี้จริงหรือไม่?", - keyDuplicationError: "ข้อมูลนี้ต้องเป็น unique.", - addColumn: "เพิ่มคอลัมน์", - addRow: "เพิ่มแถว", - removeRow: "ลบ", - addPanel: "เพิ่ม", - removePanel: "ลบ", - choices_Item: "ชิ้น", - matrix_column: "คอลัมน์", - matrix_row: "แถว", - savingData: "ผลลัพท์กำลังบันทึกลงที่เซิร์ฟเวอร์...", - savingDataError: "มีความผิดพลาดเกิดขึ้นส่งผลให้ไม่สามารถบันทึกผลได้", - savingDataSuccess: "บันทึกสำเร็จแล้ว", - saveAgainButton: "รบกวนลองอีกครั้ง", - timerMin: "นาที", - timerSec: "วินาที", - timerSpentAll: "คุณใช้เวลา {0} บนหน้านี้และ {1} รวมทั้งหมด", - timerSpentPage: "คุณใช้เวลา {0} บนหน้านี้", - timerSpentSurvey: "คุณใช้เวลา {0} รวมทั้งหมด", - timerLimitAll: "คุณใช้เวลา {0} ของ {1} บนหน้านี้และ {2} ของ {3} รวมทั้งหมด", - timerLimitPage: "คุณใช้เวลา {0} ของ {1} บนหน้านี้", - timerLimitSurvey: "คุณใช้เวลา {0} ของ {1} รวมทั้งหมด", - cleanCaption: "คลีน", - clearCaption: "เคลียร์", - chooseFileCaption: "เลือกไฟล์", - removeFileCaption: "นำไฟล์นี้ออก", - booleanCheckedLabel: "ใช่", - booleanUncheckedLabel: "ไม่ใช่", - confirmRemoveFile: "คุณแน่ใจที่จะนำไฟล์นี้ออกใช่หรือไม่: {0}?", - confirmRemoveAllFiles: "คุณแน่ใจที่จะนำไฟล์ทั้งหมดออกใช่หรือไม่", - questionTitlePatternText: "ชื่อคำถาม", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["th"] = thaiStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["th"] = "ไทย"; - - - /***/ }), - - /***/ "./src/localization/traditional-chinese.ts": - /*!*************************************************!*\ - !*** ./src/localization/traditional-chinese.ts ***! - \*************************************************/ - /*! exports provided: traditionalChineseSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "traditionalChineseSurveyStrings", function() { return traditionalChineseSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var traditionalChineseSurveyStrings = { - pagePrevText: "上一頁", - pageNextText: "下一頁", - completeText: "提交問卷", - otherItemText: "填寫其他答案", - progressText: "第 {0} 頁, 共 {1} 頁", - emptySurvey: "問卷中沒有問題或頁面", - completingSurvey: "感謝您的參與!", - loadingSurvey: "問卷載入中...", - optionsCaption: "請選擇...", - requiredError: "請填寫此問題", - requiredInAllRowsError: "請填寫所有行中問題", - numericError: "答案必須是個數字", - textMinLength: "答案長度至少 {0} 個字元", - textMaxLength: "答案長度不能超過 {0} 個字元", - textMinMaxLength: "答案長度必須在 {0} - {1} 個字元之間", - minRowCountError: "最少需要填寫 {0} 行答案", - minSelectError: "最少需要選擇 {0} 項答案", - maxSelectError: "最多只能選擇 {0} 項答案", - numericMinMax: "答案 '{0}' 必須大於等於 {1} 且小於等於 {2}", - numericMin: "答案 '{0}' 必須大於等於 {1}", - numericMax: "答案 '{0}' 必須小於等於 {1}", - invalidEmail: "請輸入有效的 Email 地址", - urlRequestError: "載入選項時發生錯誤 '{0}': {1}", - urlGetChoicesError: "未能載入有效的選項或請求參數路徑有誤", - exceedMaxSize: "文件大小不能超過 {0}", - otherRequiredError: "請完成其他問題", - uploadingFile: "文件上傳中... 請耐心等待幾秒後重試", - addRow: "添加答案", - removeRow: "刪除答案", - choices_Item: "選項", - matrix_column: "列", - matrix_row: "行", - savingData: "正在將結果保存到服務器...", - savingDataError: "在保存結果過程中發生了錯誤,結果未能保存", - savingDataSuccess: "結果保存成功!", - saveAgainButton: "請重試" - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["zh-tw"] = traditionalChineseSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["zh-tw"] = "繁體中文"; - - - /***/ }), - - /***/ "./src/localization/turkish.ts": - /*!*************************************!*\ - !*** ./src/localization/turkish.ts ***! - \*************************************/ - /*! exports provided: turkishSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "turkishSurveyStrings", function() { return turkishSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var turkishSurveyStrings = { - pagePrevText: "Geri", - pageNextText: "İleri", - completeText: "Anketi Tamamla", - previewText: "Ön izleme", - editText: "Düzenle", - startSurveyText: "Başlat", - otherItemText: "Diğer (açıklayınız)", - noneItemText: "Yok", - selectAllItemText: "Hepsini seç", - progressText: "Sayfa {0} / {1}", - panelDynamicProgressText: "Kayıt {0} / {1}", - questionsProgressText: "Soruları cevapladı {0} / {1}", - emptySurvey: "Ankette görüntülenecek sayfa ya da soru mevcut değil.", - completingSurvey: "Anketimizi tamamladığınız için teşekkür ederiz.", - completingSurveyBefore: "Kayıtlarımız, bu anketi zaten tamamladığınızı gösteriyor.", - loadingSurvey: "Anket sunucudan yükleniyor ...", - optionsCaption: "Seçiniz ...", - value: "değer", - requiredError: "Lütfen soruya cevap veriniz", - requiredErrorInPanel: "Lütfen en az bir soruyu yanıtlayın.", - requiredInAllRowsError: "Lütfen tüm satırlardaki soruları cevaplayınız.", - numericError: "Girilen değer numerik olmalıdır", - textMinLength: "En az {0} sembol giriniz.", - textMaxLength: "Lütfen {0} karakterden az girin.", - textMinMaxLength: "Lütfen {0} ’den fazla ve {1} ’den az karakter girin.", - minRowCountError: "Lütfen en az {0} satırı doldurun.", - minSelectError: "Lütfen en az {0} seçeneği seçiniz.", - maxSelectError: "Lütfen {0} adetten fazla seçmeyiniz.", - numericMinMax: "The '{0}' should be equal or more than {1} and equal or less than {2}", - numericMin: "'{0}' değeri {1} değerine eşit veya büyük olmalıdır", - numericMax: "'{0}' değeri {1} değerine eşit ya da küçük olmalıdır.", - invalidEmail: "Lütfen geçerli bir eposta adresi giriniz.", - invalidExpression: "İfade: {0} 'true' döndürmelidir.", - urlRequestError: "Talebi şu hatayı döndü '{0}'. {1}", - urlGetChoicesError: "Talep herhangi bir veri dönmedi ya da 'path' özelliği hatalı.", - exceedMaxSize: "Dosya boyutu {0} değerini geçemez.", - otherRequiredError: "Lütfen diğer değerleri giriniz.", - uploadingFile: "Dosyanız yükleniyor. LÜtfen birkaç saniye bekleyin ve tekrar deneyin.", - loadingFile: "Yükleniyor...", - chooseFile: "Dosyaları seçin ...", - noFileChosen: "Dosya seçili değil", - confirmDelete: "Kaydı silmek istiyor musunuz?", - keyDuplicationError: "Bu değer benzersiz olmalıdır.", - addColumn: "Sütun ekleyin", - addRow: "Satır Ekle", - removeRow: "Kaldır", - addPanel: "Yeni ekle", - removePanel: "Kaldırmak", - choices_Item: "eşya", - matrix_column: "Sütun", - matrix_row: "Kürek çekmek", - savingData: "Sonuçlar sunucuya kaydediliyor ...", - savingDataError: "Bir hata oluştu ve sonuçları kaydedemedik.", - savingDataSuccess: "Sonuçlar başarıyla kaydedildi!", - saveAgainButton: "Tekrar deneyin", - timerMin: "min", - timerSec: "saniye", - timerSpentAll: "Bu sayfada {0} ve toplamda {1} harcadınız.", - timerSpentPage: "Bu sayfaya {0} harcadınız.", - timerSpentSurvey: "Toplamda {0} harcadınız.", - timerLimitAll: "Bu sayfaya {0} / {1} ve toplamda {2} / {3} harcadınız.", - timerLimitPage: "Bu sayfaya {0} / {1} harcadınız.", - timerLimitSurvey: "Toplamda {0} / {1} harcadınız.", - cleanCaption: "Temiz", - clearCaption: "Açık", - chooseFileCaption: "Dosya seçin", - removeFileCaption: "Bu dosyayı kaldır", - booleanCheckedLabel: "Evet", - booleanUncheckedLabel: "Hayır", - confirmRemoveFile: "Bu dosyayı kaldırmak istediğinizden emin misiniz: {0}?", - confirmRemoveAllFiles: "Tüm dosyaları kaldırmak istediğinizden emin misiniz?", - questionTitlePatternText: "Soru başlığı", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["tr"] = turkishSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["tr"] = "türkçe"; - - - /***/ }), - - /***/ "./src/localization/ukrainian.ts": - /*!***************************************!*\ - !*** ./src/localization/ukrainian.ts ***! - \***************************************/ - /*! exports provided: ukrainianSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ukrainianSurveyStrings", function() { return ukrainianSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var ukrainianSurveyStrings = { - pagePrevText: "Назад", - pageNextText: "Далі", - completeText: "Завершити", - previewText: "Попередній перегляд", - editText: "Редагувати", - startSurveyText: "Почати", - otherItemText: "Інше (будь ласка, опишіть)", - noneItemText: "Жоден", - selectAllItemText: "Вибрати все", - progressText: "Сторінка {0} з {1}", - panelDynamicProgressText: "Запис {0} із {1}", - questionsProgressText: "Відповіли на {0}/{1} питань", - emptySurvey: "Немає жодного питання.", - completingSurvey: "Дякуємо Вам за заповнення анкети!", - completingSurveyBefore: "Ви вже проходили це опитування.", - loadingSurvey: "Завантаження опитування...", - optionsCaption: "Вибрати...", - value: "значення", - requiredError: "Будь ласка, дайте відповідь.", - requiredErrorInPanel: "Будь ласка, дайте відповідь хоча б на одне питання.", - requiredInAllRowsError: "Будь ласка, дайте відповідь на питання в кожному рядку.", - numericError: "Відповідь повинна бути числом.", - textMinLength: "Будь ласка введіть більше {0} символів.", - textMaxLength: "Будь ласка введіть менше {0} символів.", - textMinMaxLength: "Будь ласка введіть більше {0} и менше {1} символів.", - minRowCountError: "Будь ласка, заповніть не менше {0} рядків.", - minSelectError: "Будь ласка, виберіть хоча б {0} варіантів.", - maxSelectError: "Будь ласка, виберіть не більше {0} варіантів.", - numericMinMax: "'{0}' повинно бути не менше ніж {1}, і не більше ніж {2}", - numericMin: "'{0}' повинно бути не менше ніж {1}", - numericMax: "'{0}' повинно бути не більше ніж {1}", - invalidEmail: "Будь ласка, введіть дійсну адресу електронної пошти.", - invalidExpression: "Вираз {0} повинен повертати 'true'.", - urlRequestError: "Запит повернув помилку '{0}'. {1}", - urlGetChoicesError: "Відповідь на запит повернулась порожньою або властивіть 'path' вказано невірно", - exceedMaxSize: "Розмір файлу не повинен перевищувати {0}.", - otherRequiredError: "Будь ласка, введіть дані в поле 'Інше'", - uploadingFile: "Ваш файл завантажується. Зачекайте декілька секунд і спробуйте знову.", - loadingFile: "Завантаження...", - chooseFile: "Виберіть файл(и)...", - noFileChosen: "Файл не вибрано", - confirmDelete: "Ви хочете видалити запис?", - keyDuplicationError: "Це значення повинно бути унікальним.", - addColumn: "Додати колонку", - addRow: "Додати рядок", - removeRow: "Видалити", - addPanel: "Додати нову", - removePanel: "Видалити", - choices_Item: "Варіант", - matrix_column: "Колонка", - matrix_row: "Рядок", - savingData: "Результати зберігаються на сервер...", - savingDataError: "Відбулася помилка, результат не був збережений.", - savingDataSuccess: "Резвультат успішно збережений!", - saveAgainButton: "Спробувати знову", - timerMin: "хв", - timerSec: "сек", - timerSpentAll: "Ви витратили {0} на цій сторінці і {1} загалом.", - timerSpentPage: "Ви витратили {0} на цій сторінці.", - timerSpentSurvey: "Ви витратили {0} протягом тесту.", - timerLimitAll: "Ви витратили {0} з {1} на цій сторінці і {2} з {3} для всього тесту.", - timerLimitPage: "Ви витратили {0} з {1} на цій сторінці.", - timerLimitSurvey: "Ви витратили {0} з {1} для всього тесту.", - cleanCaption: "Очистити", - clearCaption: "Очистити", - chooseFileCaption: "Виберіть файл", - removeFileCaption: "Видалити файл", - booleanCheckedLabel: "Так", - booleanUncheckedLabel: "Ні", - confirmRemoveFile: "Ви впевнені, що хочете видалити цей файл: {0}?", - confirmRemoveAllFiles: "Ви впевнені, що хочете видалити всі файли?", - questionTitlePatternText: "Назва запитання", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ua"] = ukrainianSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ua"] = "українська"; - - - /***/ }), - - /***/ "./src/localization/vietnamese.ts": - /*!****************************************!*\ - !*** ./src/localization/vietnamese.ts ***! - \****************************************/ - /*! exports provided: vietnameseSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "vietnameseSurveyStrings", function() { return vietnameseSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - //Uncomment this line on creating a translation file - - var vietnameseSurveyStrings = { - pagePrevText: "Trở về", - pageNextText: "Tiếp theo", - completeText: "Hoàn thành", - previewText: "Xem trước", - editText: "Chỉnh sửa", - startSurveyText: "Bắt đầu", - otherItemText: "Khác (mô tả)", - noneItemText: "Trống", - selectAllItemText: "Chọn tất cả", - progressText: "Trang {0} / {1}", - panelDynamicProgressText: "Dòng {0} / {1}", - questionsProgressText: "Đã trả lời {0}/{1} câu hỏi", - emptySurvey: "Không có trang hoặc câu hỏi nào được hiển thị trong cuộc khảo sát này.", - completingSurvey: "Cảm ơn đã hoàn thành khảo sát!", - completingSurveyBefore: "Hồ sơ chúng tôi cho thấy rằng bạn đã hoàn thành cuộc khảo sát này.", - loadingSurvey: "Đang tải khảo sát...", - optionsCaption: "Chọn...", - value: "Giá trị", - requiredError: "Vui lòng trả lời câu hỏi.", - requiredErrorInPanel: "Vui lòng trả lời ít nhất một câu hỏi.", - requiredInAllRowsError: "Vui lòng trả lời các câu hỏi trên tất cả các dòng.", - numericError: "Giá trị nên là kiểu số.", - textMinLength: "Vui lòng nhập ít nhất {0} kí tự.", - textMaxLength: "Vui lòng nhập ít hơn {0} kí tự.", - textMinMaxLength: "Vui lòng nhập nhiều hơn {0} hoặc ít hơn {1} kí tự.", - minRowCountError: "Vui lòng nhập ít nhất {0} dòng.", - minSelectError: "Vui lòng chọn ít nhất {0} loại.", - maxSelectError: "Vui lòng không chọn nhiều hơn {0} loại.", - numericMinMax: "Giá trị '{0}' nên bằng hoặc lớn hơn {1} và bằng hoặc nhỏ hơn {2}", - numericMin: "Giá trị '{0}' nên bằng hoặc lớn hơn {1}", - numericMax: "Giá trị '{0}' nên bằng hoặc nhỏ hơn {1}", - invalidEmail: "Vui lòng điền địa chỉ email hợp lệ.", - invalidExpression: "Biểu thức: {0} nên trả về 'true'.", - urlRequestError: "Yêu cầu trả về lỗi '{0}'. {1}", - urlGetChoicesError: "Yêu cầu trả về dữ liệu trống hoặc thuộc tính 'path' không đúng", - exceedMaxSize: "Kích thước tập tin không nên vượt quá {0}.", - otherRequiredError: "Vui lòng điền giá trị khác.", - uploadingFile: "Tập tin đang được tải lên. Vui lòng chờ một lúc và thử lại.", - loadingFile: "Đang tải...", - chooseFile: "Chọn các tập tin...", - noFileChosen: "Không có tập tin nào được chọn", - confirmDelete: "Bạn muốn xóa dòng này?", - keyDuplicationError: "Giá trị này không nên bị trùng lặp.", - addColumn: "Thêm cột", - addRow: "Thêm dòng", - removeRow: "Xóa", - addPanel: "Thêm mới", - removePanel: "Xóa", - choices_Item: "mục", - matrix_column: "Cột", - matrix_row: "Dòng", - savingData: "Kết quả đang lưu lại trên hệ thống...", - savingDataError: "Có lỗi xảy ra và chúng ta không thể lưu kết quả.", - savingDataSuccess: "Kết quả đã được lưu thành công!", - saveAgainButton: "Thử lại", - timerMin: "phút", - timerSec: "giây", - timerSpentAll: "Bạn đã sử dụng {0} trên trang này và {1} trên toàn bộ.", - timerSpentPage: "Bạn đã sử dụng {0} trên trang.", - timerSpentSurvey: "Bạn đã sử dụng {0} trên toàn bộ.", - timerLimitAll: "Bạn đã sử dụng {0} / {1} trên trang này và {2} / {3} trên toàn bộ.", - timerLimitPage: "Bạn đã sử dụng {0} / {1} trên trang này.", - timerLimitSurvey: "Bạn đã sử dụng {0} / {1} trên toàn bộ.", - cleanCaption: "Xóa tất cả", - clearCaption: "Xóa", - chooseFileCaption: "Chọn tập tin", - removeFileCaption: "Xóa tập tin", - booleanCheckedLabel: "Có", - booleanUncheckedLabel: "Không", - confirmRemoveFile: "Bạn có chắc chắn muốn xóa tập tin này: {0}?", - confirmRemoveAllFiles: "Bạn có chắc chắn muốn xóa toàn bộ tập tin?", - questionTitlePatternText: "Tiêu đề câu hỏi", - }; - //Uncomment these two lines on creating a translation file. You should replace "en" and enStrings with your locale ("fr", "de" and so on) and your variable. - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["vi"] = vietnameseSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["vi"] = "Việt Nam"; - - - /***/ }), - - /***/ "./src/localization/welsh.ts": - /*!***********************************!*\ - !*** ./src/localization/welsh.ts ***! - \***********************************/ - /*! exports provided: welshSurveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "welshSurveyStrings", function() { return welshSurveyStrings; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../surveyStrings */ "./src/surveyStrings.ts"); - - var welshSurveyStrings = { - pagePrevText: "Blaenorol", - pageNextText: "Nesaf", - completeText: "Cwblhau", - previewText: "Rhagolwg", - editText: "Golygu", - startSurveyText: "Dechrau", - otherItemText: "Arall (disgrifiwch)", - noneItemText: "Dim", - selectAllItemText: "Dewis y Cyfan ", - progressText: "Tudalen {0} o {1}", - panelDynamicProgressText: "Cofnod {0} o {1}", - questionsProgressText: "Wedi ateb {0}/{1} cwestiwn", - emptySurvey: "Does dim modd gweld tudalen na chwestiwn yn yr arolwg.", - completingSurvey: "Diolch am lenwi’r holiadur!", - completingSurveyBefore: "Rydych chi wedi llenwi’r arolwg hwn yn barod yn ôl ein cofnodion.", - loadingSurvey: "Wrthi’n Llwytho’r Arolwg...", - optionsCaption: "Dewiswch...", - value: "gwerth", - requiredError: "Atebwch y cwestiwn.", - requiredErrorInPanel: "Atebwch o leiaf un cwestiwn.", - requiredInAllRowsError: "Atebwch y cwestiynau ym mhob rhes.", - numericError: "Dylai’r gwerth fod yn rhif.", - textMinLength: "Rhowch o leiaf {0} nod.", - textMaxLength: "Rhowch lai na {0} nod.", - textMinMaxLength: "Rhowch o leiaf {0} nod ond dim mwy na {1}.", - minRowCountError: "Llenwch o leiaf {0} rhes.", - minSelectError: "Dewiswch o leiaf {0} amrywiolyn.", - maxSelectError: "Peidiwch â dewis mwy na {0} amrywiolyn.", - numericMinMax: "Dylai’r '{0}' fod yr un fath â {1} neu’n fwy, a’r fath â {2} neu’n llai", - numericMin: "Dylai’r '{0}' fod yr un fath â {1} neu’n fwy", - numericMax: "Dylai’r '{0}' fod yr un fath â {1} neu’n llai", - invalidEmail: "Rhowch gyfeiriad e-bost dilys.", - invalidExpression: "Dylai’r mynegiad {0} arwain at 'true'.", - urlRequestError: "Roedd y cais wedi arwain at y gwall '{0}'. {1}", - urlGetChoicesError: "Roedd y cais wedi arwain at ddata gwag neu mae priodwedd y ‘path’ yn anghywir ", - exceedMaxSize: "Ddylai’r ffeil ddim bod yn fwy na {0}.", - otherRequiredError: "Rhowch y gwerth arall.", - uploadingFile: "Mae eich ffeil wrthi’n llwytho i fyny. Arhoswch ychydig o eiliadau a rhoi cynnig arall arni.", - loadingFile: "Wrthi’n llwytho...", - chooseFile: "Dewiswch ffeil(iau)...", - noFileChosen: "Heb ddewis ffeil ", - confirmDelete: "Ydych chi am ddileu’r cofnod?", - keyDuplicationError: "Dylai’r gwerth hwn fod yn unigryw.", - addColumn: "Ychwanegu colofn ", - addRow: "Ychwanegu rhes", - removeRow: "Tynnu", - addPanel: "Ychwanegu o’r newydd", - removePanel: "Tynnu", - choices_Item: "eitem", - matrix_column: "Colofn", - matrix_row: "Rhes", - savingData: "Mae’r canlyniadau’n cael eu cadw ar y gweinydd...", - savingDataError: "Roedd gwall a doedd dim modd cadw’r canlyniadau.", - savingDataSuccess: "Wedi llwyddo i gadw’r canlyniadau!", - saveAgainButton: "Rhowch gynnig arall arni", - timerMin: "mun", - timerSec: "eil", - timerSpentAll: "Rydych chi wedi treulio {0} ar y dudalen hon a {1} gyda’i gilydd.", - timerSpentPage: "Rydych chi wedi treulio {0} ar y dudalen hon.", - timerSpentSurvey: "Rydych chi wedi treulio {0} gyda’i gilydd.", - timerLimitAll: "Rydych chi wedi treulio {0} o {1} ar y dudalen hon a {2} o {3} gyda’i gilydd.", - timerLimitPage: "Rydych chi wedi treulio {0} o {1} ar y dudalen hon.", - timerLimitSurvey: "Rydych chi wedi treulio {0} o {1} gyda’i gilydd.", - cleanCaption: "Glanhau", - clearCaption: "Clirio", - chooseFileCaption: "Dewiswch ffeil ", - removeFileCaption: "Tynnu’r ffeil hon ", - booleanCheckedLabel: "Iawn", - booleanUncheckedLabel: "Na", - confirmRemoveFile: "Ydych chi’n siŵr eich bod am dynnu’r ffeil hon: {0}?", - confirmRemoveAllFiles: "Ydych chi’n siŵr eich bod am dynnu pob ffeil?", - questionTitlePatternText: "Teitl y Cwestiwn ", - }; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["cy"] = welshSurveyStrings; - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["cy"] = "cymraeg"; - - - /***/ }), - - /***/ "./src/main.scss": - /*!***********************!*\ - !*** ./src/main.scss ***! - \***********************/ - /*! no static exports found */ - /***/ (function(module, exports, __webpack_require__) { - - // extracted by mini-css-extract-plugin - - /***/ }), - - /***/ "./src/martixBase.ts": - /*!***************************!*\ - !*** ./src/martixBase.ts ***! - \***************************/ - /*! exports provided: QuestionMatrixBaseModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixBaseModel", function() { return QuestionMatrixBaseModel; }); - /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - /** - * A Model for a matrix base question. - */ - var QuestionMatrixBaseModel = /** @class */ (function (_super) { - __extends(QuestionMatrixBaseModel, _super); - function QuestionMatrixBaseModel(name) { - var _this = _super.call(this, name) || this; - _this.generatedVisibleRows = null; - _this.generatedTotalRow = null; - _this.filteredRows = null; - _this.filteredColumns = null; - _this.columns = _this.createColumnValues(); - _this.rows = _this.createItemValues("rows"); - return _this; - } - QuestionMatrixBaseModel.prototype.createColumnValues = function () { - return this.createItemValues("columns"); - }; - QuestionMatrixBaseModel.prototype.getType = function () { - return "matrixbase"; - }; - Object.defineProperty(QuestionMatrixBaseModel.prototype, "isCompositeQuestion", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixBaseModel.prototype, "showHeader", { - /** - * Set this property to false, to hide table header. The default value is true. - */ - get: function () { - return this.getPropertyValue("showHeader"); - }, - set: function (val) { - this.setPropertyValue("showHeader", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixBaseModel.prototype, "columns", { - /** - * The list of columns. A column has a value and an optional text - */ - get: function () { - return this.getPropertyValue("columns"); - }, - set: function (newValue) { - this.setPropertyValue("columns", newValue); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixBaseModel.prototype, "visibleColumns", { - get: function () { - return !!this.filteredColumns ? this.filteredColumns : this.columns; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixBaseModel.prototype, "rows", { - /** - * The list of rows. A row has a value and an optional text - */ - get: function () { - return this.getPropertyValue("rows"); - }, - set: function (newValue) { - var newRows = this.processRowsOnSet(newValue); - this.setPropertyValue("rows", newRows); - this.filterItems(); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixBaseModel.prototype.processRowsOnSet = function (newRows) { - return newRows; - }; - QuestionMatrixBaseModel.prototype.getVisibleRows = function () { - return []; - }; - Object.defineProperty(QuestionMatrixBaseModel.prototype, "visibleRows", { - /** - * Returns the list of visible rows as model objects. - * @see rowsVisibleIf - */ - get: function () { - return this.getVisibleRows(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixBaseModel.prototype, "rowsVisibleIf", { - /** - * An expression that returns true or false. It runs against each row item and if for this item it returns true, then the item is visible otherwise the item becomes invisible. Please use {item} to get the current item value in the expression. - * @see visibleIf - */ - get: function () { - return this.getPropertyValue("rowsVisibleIf", ""); - }, - set: function (val) { - this.setPropertyValue("rowsVisibleIf", val); - this.filterItems(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixBaseModel.prototype, "columnsVisibleIf", { - /** - * An expression that returns true or false. It runs against each column item and if for this item it returns true, then the item is visible otherwise the item becomes invisible. Please use {item} to get the current item value in the expression. - * @see rowsVisibleIf - */ - get: function () { - return this.getPropertyValue("columnsVisibleIf", ""); - }, - set: function (val) { - this.setPropertyValue("columnsVisibleIf", val); - this.filterItems(); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixBaseModel.prototype.runCondition = function (values, properties) { - _super.prototype.runCondition.call(this, values, properties); - this.runItemsCondition(values, properties); - }; - QuestionMatrixBaseModel.prototype.filterItems = function () { - if (this.areInvisibleElementsShowing) { - this.onRowsChanged(); - return false; - } - if (this.isLoadingFromJson || !this.data) - return false; - return this.runItemsCondition(this.getDataFilteredValues(), this.getDataFilteredProperties()); - }; - QuestionMatrixBaseModel.prototype.onColumnsChanged = function () { }; - QuestionMatrixBaseModel.prototype.onRowsChanged = function () { - this.fireCallback(this.visibleRowsChangedCallback); - }; - QuestionMatrixBaseModel.prototype.shouldRunColumnExpression = function () { - return !this.survey || !this.survey.areInvisibleElementsShowing; - }; - QuestionMatrixBaseModel.prototype.hasRowsAsItems = function () { - return true; - }; - QuestionMatrixBaseModel.prototype.runItemsCondition = function (values, properties) { - var oldVisibleRows = null; - if (!!this.filteredRows && !_helpers__WEBPACK_IMPORTED_MODULE_4__["Helpers"].isValueEmpty(this.defaultValue)) { - oldVisibleRows = []; - for (var i = 0; i < this.filteredRows.length; i++) { - oldVisibleRows.push(this.filteredRows[i]); - } - } - var hasChanges = this.hasRowsAsItems() && this.runConditionsForRows(values, properties); - var hasColumnsChanged = this.runConditionsForColumns(values, properties); - hasChanges = hasColumnsChanged || hasChanges; - if (hasChanges) { - if (!!this.survey && - this.survey.isClearValueOnHidden && - (!!this.filteredColumns || !!this.filteredRows)) { - this.clearIncorrectValues(); - } - if (!!oldVisibleRows) { - this.restoreNewVisibleRowsValues(oldVisibleRows); - } - this.clearGeneratedRows(); - if (hasColumnsChanged) { - this.onColumnsChanged(); - } - this.onRowsChanged(); - } - return hasChanges; - }; - QuestionMatrixBaseModel.prototype.clearGeneratedRows = function () { - this.generatedVisibleRows = null; - }; - QuestionMatrixBaseModel.prototype.runConditionsForRows = function (values, properties) { - var showInvisibile = !!this.survey && this.survey.areInvisibleElementsShowing; - var runner = !showInvisibile && !!this.rowsVisibleIf - ? new _conditions__WEBPACK_IMPORTED_MODULE_3__["ConditionRunner"](this.rowsVisibleIf) - : null; - this.filteredRows = []; - var hasChanged = _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].runConditionsForItems(this.rows, this.filteredRows, runner, values, properties, !showInvisibile); - if (this.filteredRows.length === this.rows.length) { - this.filteredRows = null; - } - return hasChanged; - }; - QuestionMatrixBaseModel.prototype.runConditionsForColumns = function (values, properties) { - var useColumnsExpression = !!this.survey && !this.survey.areInvisibleElementsShowing; - var runner = useColumnsExpression && !!this.columnsVisibleIf - ? new _conditions__WEBPACK_IMPORTED_MODULE_3__["ConditionRunner"](this.columnsVisibleIf) - : null; - this.filteredColumns = []; - var hasChanged = _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].runConditionsForItems(this.columns, this.filteredColumns, runner, values, properties, this.shouldRunColumnExpression()); - if (this.filteredColumns.length === this.columns.length) { - this.filteredColumns = null; - } - return hasChanged; - }; - QuestionMatrixBaseModel.prototype.clearIncorrectValues = function () { - var val = this.value; - if (!val) - return; - var newVal = null; - var isChanged = false; - var rows = !!this.filteredRows ? this.filteredRows : this.rows; - var columns = !!this.filteredColumns ? this.filteredColumns : this.columns; - for (var key in val) { - if (_itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getItemByValue(rows, key) && - _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getItemByValue(columns, val[key])) { - if (newVal == null) - newVal = {}; - newVal[key] = val[key]; - } - else { - isChanged = true; - } - } - if (isChanged) { - this.value = newVal; - } - _super.prototype.clearIncorrectValues.call(this); - }; - QuestionMatrixBaseModel.prototype.clearInvisibleValuesInRows = function () { - if (this.isEmpty()) - return; - var newData = this.getUnbindValue(this.value); - var rows = this.rows; - for (var i = 0; i < rows.length; i++) { - var key = rows[i].value; - if (!!newData[key] && !rows[i].isVisible) { - delete newData[key]; - } - } - if (this.isTwoValueEquals(newData, this.value)) - return; - this.value = newData; - }; - QuestionMatrixBaseModel.prototype.restoreNewVisibleRowsValues = function (oldVisibleRows) { - var rows = !!this.filteredRows ? this.filteredRows : this.rows; - var val = this.defaultValue; - var newValue = this.getUnbindValue(this.value); - var isChanged = false; - for (var key in val) { - if (_itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getItemByValue(rows, key) && - !_itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getItemByValue(oldVisibleRows, key)) { - if (newValue == null) - newValue = {}; - newValue[key] = val[key]; - isChanged = true; - } - } - if (isChanged) { - this.value = newValue; - } - }; - QuestionMatrixBaseModel.prototype.needResponsiveWidth = function () { - //TODO: make it mor intelligent - return true; - }; - return QuestionMatrixBaseModel; - }(_question__WEBPACK_IMPORTED_MODULE_1__["Question"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_2__["Serializer"].addClass("matrixbase", [ - "columnsVisibleIf:condition", - "rowsVisibleIf:condition", - { name: "showHeader:boolean", default: true }, - ], undefined, "question"); - - - /***/ }), - - /***/ "./src/page.ts": - /*!*********************!*\ - !*** ./src/page.ts ***! - \*********************/ - /*! exports provided: PageModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PageModel", function() { return PageModel; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _panel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./panel */ "./src/panel.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - /** - * The page object. It has elements collection, that contains questions and panels. - */ - var PageModel = /** @class */ (function (_super) { - __extends(PageModel, _super); - function PageModel(name) { - if (name === void 0) { name = ""; } - var _this = _super.call(this, name) || this; - _this.hasShownValue = false; - /** - * Time in seconds end-user spent on this page - */ - _this.timeSpent = 0; - var self = _this; - _this.locTitle.onGetTextCallback = function (text) { - if (self.num > 0) - return self.num + ". " + text; - return text; - }; - _this.createLocalizableString("navigationTitle", _this, true); - _this.createLocalizableString("navigationDescription", _this, true); - return _this; - } - PageModel.prototype.getType = function () { - return "page"; - }; - PageModel.prototype.toString = function () { - return this.name; - }; - Object.defineProperty(PageModel.prototype, "isPage", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - PageModel.prototype.canShowTitle = function () { - return this.survey.showPageTitles; - }; - Object.defineProperty(PageModel.prototype, "navigationTitle", { - /** - * Use this property to show title in navigation buttons. If the value is empty then page name is used. - * @see survey.progressBarType - */ - get: function () { - return this.getLocalizableStringText("navigationTitle"); - }, - set: function (val) { - this.setLocalizableStringText("navigationTitle", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PageModel.prototype, "locNavigationTitle", { - get: function () { - return this.getLocalizableString("navigationTitle"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PageModel.prototype, "navigationDescription", { - get: function () { - return this.getLocalizableStringText("navigationDescription"); - }, - set: function (val) { - this.setLocalizableStringText("navigationDescription", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PageModel.prototype, "locNavigationDescription", { - get: function () { - return this.getLocalizableString("navigationDescription"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PageModel.prototype, "passed", { - get: function () { - return this.getPropertyValue("passed", false); - }, - set: function (val) { - this.setPropertyValue("passed", val); - }, - enumerable: false, - configurable: true - }); - PageModel.prototype.delete = function () { - if (!!this.survey) { - this.removeSelfFromList(this.survey.pages); - } - }; - PageModel.prototype.onFirstRendering = function () { - if (this.wasShown) - return; - _super.prototype.onFirstRendering.call(this); - }; - Object.defineProperty(PageModel.prototype, "visibleIndex", { - /** - * The visible index of the page. It has values from 0 to visible page count - 1. - * @see SurveyModel.visiblePages - * @see SurveyModel.pages - */ - get: function () { - return this.getPropertyValue("visibleIndex", -1); - }, - set: function (val) { - this.setPropertyValue("visibleIndex", val); - }, - enumerable: false, - configurable: true - }); - PageModel.prototype.canRenderFirstRows = function () { - return !this.isDesignMode || this.visibleIndex == 0; - }; - Object.defineProperty(PageModel.prototype, "isStarted", { - /** - * Returns true, if the page is started page in the survey. It can be shown on the start only and the end-user could not comeback to it after it passed it. - */ - get: function () { - return this.survey && this.survey.isPageStarted(this); - }, - enumerable: false, - configurable: true - }); - PageModel.prototype.calcCssClasses = function (css) { - var classes = { page: {}, pageTitle: "", pageDescription: "", row: "", rowMultiple: "" }; - this.copyCssClasses(classes.page, css.page); - if (!!css.pageTitle) { - classes.pageTitle = css.pageTitle; - } - if (!!css.pageDescription) { - classes.pageDescription = css.pageDescription; - } - if (!!css.row) { - classes.row = css.row; - } - if (!!css.rowMultiple) { - classes.rowMultiple = css.rowMultiple; - } - if (this.survey) { - this.survey.updatePageCssClasses(this, classes); - } - return classes; - }; - Object.defineProperty(PageModel.prototype, "cssTitle", { - get: function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_2__["CssClassBuilder"]() - .append(this.cssClasses.page.title) - .toString(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PageModel.prototype, "num", { - get: function () { - return this.getPropertyValue("num", -1); - }, - set: function (val) { - if (this.num == val) - return; - this.setPropertyValue("num", val); - this.onNumChanged(val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PageModel.prototype, "navigationButtonsVisibility", { - /** - * Set this property to "hide" to make "Prev", "Next" and "Complete" buttons are invisible for this page. Set this property to "show" to make these buttons visible, even if survey showNavigationButtons property is false. - * @see SurveyMode.showNavigationButtons - */ - get: function () { - return this.getPropertyValue("navigationButtonsVisibility"); - }, - set: function (val) { - this.setPropertyValue("navigationButtonsVisibility", val.toLowerCase()); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PageModel.prototype, "wasShown", { - /** - * The property returns true, if the page has been shown to the end-user. - */ - get: function () { - return this.hasShownValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PageModel.prototype, "hasShown", { - get: function () { - return this.wasShown; - }, - enumerable: false, - configurable: true - }); - PageModel.prototype.setWasShown = function (val) { - if (val == this.hasShownValue) - return; - this.hasShownValue = val; - if (this.isDesignMode || val !== true) - return; - var els = this.elements; - for (var i = 0; i < els.length; i++) { - if (els[i].isPanel) { - els[i].randomizeElements(this.areQuestionsRandomized); - } - } - this.randomizeElements(this.areQuestionsRandomized); - }; - Object.defineProperty(PageModel.prototype, "areQuestionsRandomized", { - /** - * The property returns true, if the elements are randomized on the page - * @see hasShown - * @see questionsOrder - * @see SurveyModel.questionsOrder - */ - get: function () { - var order = this.questionsOrder == "default" && this.survey - ? this.survey.questionsOrder - : this.questionsOrder; - return order == "random"; - }, - enumerable: false, - configurable: true - }); - /** - * Call it to scroll to the page top. - */ - PageModel.prototype.scrollToTop = function () { - if (!!this.survey) { - this.survey.scrollElementToTop(this, null, this, this.id); - } - }; - // public get timeSpent(): number { - // return this.getPropertyValue("timeSpent", 0); - // } - // public set timeSpent(val: number) { - // this.setPropertyValue("timeSpent", val); - // } - /** - * Returns the list of all panels in the page - */ - PageModel.prototype.getPanels = function (visibleOnly, includingDesignTime) { - if (visibleOnly === void 0) { visibleOnly = false; } - if (includingDesignTime === void 0) { includingDesignTime = false; } - var result = new Array(); - this.addPanelsIntoList(result, visibleOnly, includingDesignTime); - return result; - }; - Object.defineProperty(PageModel.prototype, "maxTimeToFinish", { - /** - * The maximum time in seconds that end-user has to complete the page. If the value is 0 or less, the end-user has unlimited number of time to finish the page. - * @see startTimer - * @see SurveyModel.maxTimeToFinishPage - */ - get: function () { - return this.getPropertyValue("maxTimeToFinish", 0); - }, - set: function (val) { - this.setPropertyValue("maxTimeToFinish", val); - }, - enumerable: false, - configurable: true - }); - PageModel.prototype.onNumChanged = function (value) { }; - PageModel.prototype.onVisibleChanged = function () { - if (this.isRandomizing) - return; - _super.prototype.onVisibleChanged.call(this); - if (this.survey != null) { - this.survey.pageVisibilityChanged(this, this.isVisible); - } - }; - PageModel.prototype.dragDropStart = function (src, target, nestedPanelDepth) { - if (nestedPanelDepth === void 0) { nestedPanelDepth = -1; } - this.dragDropInfo = new _panel__WEBPACK_IMPORTED_MODULE_1__["DragDropInfo"](src, target, nestedPanelDepth); - }; - PageModel.prototype.dragDropMoveTo = function (destination, isBottom, isEdge) { - if (isBottom === void 0) { isBottom = false; } - if (isEdge === void 0) { isEdge = false; } - if (!this.dragDropInfo) - return false; - this.dragDropInfo.destination = destination; - this.dragDropInfo.isBottom = isBottom; - this.dragDropInfo.isEdge = isEdge; - this.correctDragDropInfo(this.dragDropInfo); - if (!this.dragDropCanDropTagert()) - return false; - if (!this.dragDropCanDropSource() || !this.dragDropAllowFromSurvey()) { - if (!!this.dragDropInfo.source) { - var row = this.dragDropFindRow(this.dragDropInfo.target); - this.updateRowsRemoveElementFromRow(this.dragDropInfo.target, row); - } - return false; - } - this.dragDropAddTarget(this.dragDropInfo); - return true; - }; - PageModel.prototype.correctDragDropInfo = function (dragDropInfo) { - if (!dragDropInfo.destination) - return; - var panel = dragDropInfo.destination.isPanel - ? dragDropInfo.destination - : null; - if (!panel) - return; - if (!dragDropInfo.target.isLayoutTypeSupported(panel.getChildrenLayoutType())) { - dragDropInfo.isEdge = true; - } - }; - PageModel.prototype.dragDropAllowFromSurvey = function () { - var dest = this.dragDropInfo.destination; - if (!dest || !this.survey) - return true; - var insertBefore = null; - var insertAfter = null; - var parent = dest.isPage || (!this.dragDropInfo.isEdge && dest.isPanel) - ? dest - : dest.parent; - if (!dest.isPage) { - var container = dest.parent; - if (!!container) { - var elements = container.elements; - var index = elements.indexOf(dest); - if (index > -1) { - insertBefore = dest; - insertAfter = dest; - if (this.dragDropInfo.isBottom) { - insertBefore = - index < elements.length - 1 ? elements[index + 1] : null; - } - else { - insertAfter = index > 0 ? elements[index - 1] : null; - } - } - } - } - var options = { - target: this.dragDropInfo.target, - source: this.dragDropInfo.source, - parent: parent, - insertAfter: insertAfter, - insertBefore: insertBefore, - }; - return this.survey.dragAndDropAllow(options); - }; - PageModel.prototype.dragDropFinish = function (isCancel) { - if (isCancel === void 0) { isCancel = false; } - if (!this.dragDropInfo) - return; - var target = this.dragDropInfo.target; - var src = this.dragDropInfo.source; - var row = this.dragDropFindRow(target); - var targetIndex = this.dragDropGetElementIndex(target, row); - this.updateRowsRemoveElementFromRow(target, row); - var elementsToSetSWNL = []; - var elementsToResetSWNL = []; - if (!isCancel && !!row) { - var isSamePanel = false; - if (this.isDesignMode && _settings__WEBPACK_IMPORTED_MODULE_3__["settings"].supportCreatorV2) { - var srcRow = src && src.parent && src.parent.dragDropFindRow(src); - if (row.panel.elements[targetIndex] && row.panel.elements[targetIndex].startWithNewLine && row.elements.length > 1) { - elementsToSetSWNL.push(target); - elementsToResetSWNL.push(row.panel.elements[targetIndex]); - } - if (target.startWithNewLine && row.elements.length > 1 && (!row.panel.elements[targetIndex] || !row.panel.elements[targetIndex].startWithNewLine)) { - elementsToResetSWNL.push(target); - } - if (srcRow && srcRow.elements[0] === src && srcRow.elements[1]) { - elementsToSetSWNL.push(srcRow.elements[1]); - } - if (row.elements.length <= 1) { - elementsToSetSWNL.push(target); - } - } - if (!!src && !!src.parent) { - isSamePanel = row.panel == src.parent; - if (isSamePanel) { - row.panel.dragDropMoveElement(src, target, targetIndex); - targetIndex = -1; - } - else { - src.parent.removeElement(src); - } - } - if (targetIndex > -1) { - row.panel.addElement(target, targetIndex); - } - } - elementsToSetSWNL.map(function (e) { e.startWithNewLine = true; }); - elementsToResetSWNL.map(function (e) { e.startWithNewLine = false; }); - this.dragDropInfo = null; - return !isCancel ? target : null; - }; - PageModel.prototype.dragDropGetElementIndex = function (target, row) { - if (!row) - return -1; - var index = row.elements.indexOf(target); - if (row.index == 0) - return index; - var prevRow = row.panel.rows[row.index - 1]; - var prevElement = prevRow.elements[prevRow.elements.length - 1]; - return index + row.panel.elements.indexOf(prevElement) + 1; - }; - PageModel.prototype.dragDropCanDropTagert = function () { - var destination = this.dragDropInfo.destination; - if (!destination || destination.isPage) - return true; - return this.dragDropCanDropCore(this.dragDropInfo.target, destination); - }; - PageModel.prototype.dragDropCanDropSource = function () { - var source = this.dragDropInfo.source; - if (!source) - return true; - var destination = this.dragDropInfo.destination; - if (!this.dragDropCanDropCore(source, destination)) - return false; - if (this.isDesignMode && _settings__WEBPACK_IMPORTED_MODULE_3__["settings"].supportCreatorV2) { - if (!source.startWithNewLine && destination.startWithNewLine) - return true; - var row = this.dragDropFindRow(destination); - if (row && row.elements.length == 1) - return true; - } - return this.dragDropCanDropNotNext(source, destination, this.dragDropInfo.isEdge, this.dragDropInfo.isBottom); - }; - PageModel.prototype.dragDropCanDropCore = function (target, destination) { - if (!destination) - return true; - if (this.dragDropIsSameElement(destination, target)) - return false; - if (target.isPanel) { - var pnl = target; - if (pnl.containsElement(destination) || - !!pnl.getElementByName(destination.name)) - return false; - } - return true; - }; - PageModel.prototype.dragDropCanDropNotNext = function (source, destination, isEdge, isBottom) { - if (!destination || (destination.isPanel && !isEdge)) - return true; - if (typeof source.parent === "undefined" || source.parent !== destination.parent) - return true; - var pnl = source.parent; - var srcIndex = pnl.elements.indexOf(source); - var destIndex = pnl.elements.indexOf(destination); - if (destIndex < srcIndex && !isBottom) - destIndex--; - if (isBottom) - destIndex++; - return srcIndex < destIndex - ? destIndex - srcIndex > 1 - : srcIndex - destIndex > 0; - }; - PageModel.prototype.dragDropIsSameElement = function (el1, el2) { - return el1 == el2 || el1.name == el2.name; - }; - PageModel.prototype.ensureRowsVisibility = function () { - _super.prototype.ensureRowsVisibility.call(this); - this.getPanels().forEach(function (panel) { return panel.ensureRowsVisibility(); }); - }; - return PageModel; - }(_panel__WEBPACK_IMPORTED_MODULE_1__["PanelModelBase"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("page", [ - { - name: "navigationButtonsVisibility", - default: "inherit", - choices: ["inherit", "show", "hide"], - }, - { name: "maxTimeToFinish:number", default: 0, minValue: 0 }, - { - name: "navigationTitle", - visibleIf: function (obj) { - return !!obj.survey && obj.survey.progressBarType === "buttons"; - }, - serializationProperty: "locNavigationTitle", - }, - { - name: "navigationDescription", - visibleIf: function (obj) { - return !!obj.survey && obj.survey.progressBarType === "buttons"; - }, - serializationProperty: "locNavigationDescription", - }, - { name: "title:text", serializationProperty: "locTitle" }, - { name: "description:text", serializationProperty: "locDescription" }, - ], function () { - return new PageModel(); - }, "panelbase"); - - - /***/ }), - - /***/ "./src/panel.ts": - /*!**********************!*\ - !*** ./src/panel.ts ***! - \**********************/ - /*! exports provided: DragDropInfo, QuestionRowModel, PanelModelBase, PanelModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DragDropInfo", function() { return DragDropInfo; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRowModel", function() { return QuestionRowModel; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PanelModelBase", function() { return PanelModelBase; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PanelModel", function() { return PanelModel; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base */ "./src/base.ts"); - /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./error */ "./src/error.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - /* harmony import */ var _actions_adaptive_container__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./actions/adaptive-container */ "./src/actions/adaptive-container.ts"); - /* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - - - - - - - - - var DragDropInfo = /** @class */ (function () { - function DragDropInfo(source, target, nestedPanelDepth) { - if (nestedPanelDepth === void 0) { nestedPanelDepth = -1; } - this.source = source; - this.target = target; - this.nestedPanelDepth = nestedPanelDepth; - } - return DragDropInfo; - }()); - - var QuestionRowModel = /** @class */ (function (_super) { - __extends(QuestionRowModel, _super); - function QuestionRowModel(panel) { - var _this = _super.call(this) || this; - _this.panel = panel; - _this._scrollableParent = undefined; - _this._updateVisibility = undefined; - _this.idValue = QuestionRowModel.getRowId(); - _this.visible = panel.areInvisibleElementsShowing; - _this.createNewArray("elements"); - _this.createNewArray("visibleElements"); - return _this; - } - QuestionRowModel.getRowId = function () { - return "pr_" + QuestionRowModel.rowCounter++; - }; - QuestionRowModel.prototype.startLazyRendering = function (rowContainerDiv, findScrollableContainer) { - var _this = this; - if (findScrollableContainer === void 0) { findScrollableContainer = _utils_utils__WEBPACK_IMPORTED_MODULE_9__["findScrollableParent"]; } - this._scrollableParent = findScrollableContainer(rowContainerDiv); - this.isNeedRender = !(this._scrollableParent.scrollHeight > this._scrollableParent.clientHeight); - // if this._scrollableParent is html the scroll event isn't fired, so we should use window - if (this._scrollableParent === document.documentElement) { - this._scrollableParent = window; - } - if (!this.isNeedRender) { - this._updateVisibility = function () { - var isRowContainerDivVisible = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_9__["isElementVisible"])(rowContainerDiv, 50); - if (!_this.isNeedRender && isRowContainerDivVisible) { - _this.isNeedRender = true; - _this.stopLazyRendering(); - } - }; - setTimeout(function () { - if (!!_this._scrollableParent && - !!_this._scrollableParent.addEventListener) { - _this._scrollableParent.addEventListener("scroll", _this._updateVisibility); - } - _this.ensureVisibility(); - }, 10); - } - }; - QuestionRowModel.prototype.ensureVisibility = function () { - if (!!this._updateVisibility) { - this._updateVisibility(); - } - }; - QuestionRowModel.prototype.stopLazyRendering = function () { - if (!!this._scrollableParent && - !!this._updateVisibility && - !!this._scrollableParent.removeEventListener) { - this._scrollableParent.removeEventListener("scroll", this._updateVisibility); - } - this._scrollableParent = undefined; - this._updateVisibility = undefined; - }; - QuestionRowModel.prototype.setIsLazyRendering = function (val) { - this.isLazyRenderingValue = val; - this.isNeedRender = !val; - }; - QuestionRowModel.prototype.isLazyRendering = function () { - return this.isLazyRenderingValue === true; - }; - Object.defineProperty(QuestionRowModel.prototype, "id", { - get: function () { - return this.idValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRowModel.prototype, "elements", { - get: function () { - return this.getPropertyValue("elements"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRowModel.prototype, "visibleElements", { - get: function () { - return this.getPropertyValue("visibleElements"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRowModel.prototype, "visible", { - get: function () { - return this.getPropertyValue("visible", true); - }, - set: function (val) { - this.setPropertyValue("visible", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRowModel.prototype, "isNeedRender", { - get: function () { - return this.getPropertyValue("isneedrender", true); - }, - set: function (val) { - this.setPropertyValue("isneedrender", val); - }, - enumerable: false, - configurable: true - }); - QuestionRowModel.prototype.updateVisible = function () { - this.visible = this.calcVisible(); - this.setWidth(); - }; - QuestionRowModel.prototype.addElement = function (q) { - this.elements.push(q); - this.updateVisible(); - }; - Object.defineProperty(QuestionRowModel.prototype, "index", { - get: function () { - return this.panel.rows.indexOf(this); - }, - enumerable: false, - configurable: true - }); - QuestionRowModel.prototype.setWidth = function () { - var visCount = this.visibleElements.length; - if (visCount == 0) - return; - var counter = 0; - var preSetWidthElements = []; - for (var i = 0; i < this.elements.length; i++) { - var el = this.elements[i]; - this.setElementMaxMinWidth(el); - if (el.isVisible) { - var width = this.getElementWidth(el); - if (!!width) { - el.renderWidth = this.getRenderedWidthFromWidth(width); - preSetWidthElements.push(el); - } - el.rightIndent = counter < visCount - 1 ? 1 : 0; - counter++; - } - else { - el.renderWidth = ""; - } - } - for (var i = 0; i < this.elements.length; i++) { - var el = this.elements[i]; - if (!el.isVisible || preSetWidthElements.indexOf(el) > -1) - continue; - if (preSetWidthElements.length == 0) { - el.renderWidth = (100 / visCount).toFixed(6) + "%"; - } - else { - el.renderWidth = this.getRenderedCalcWidth(el, preSetWidthElements, visCount); - } - } - }; - QuestionRowModel.prototype.setElementMaxMinWidth = function (el) { - if (el.width && - typeof el.width === "string" && - el.width.indexOf("%") === -1) { - el.minWidth = el.width; - el.maxWidth = el.width; - } - }; - QuestionRowModel.prototype.getRenderedCalcWidth = function (el, preSetWidthElements, visCount) { - var expression = "100%"; - for (var i = 0; i < preSetWidthElements.length; i++) { - expression += " - " + preSetWidthElements[i].renderWidth; - } - var calcWidthEl = visCount - preSetWidthElements.length; - if (calcWidthEl > 1) { - expression = "(" + expression + ")/" + calcWidthEl.toString(); - } - return "calc(" + expression + ")"; - }; - QuestionRowModel.prototype.getElementWidth = function (el) { - var width = el.width; - if (!width || typeof width !== "string") - return ""; - return width.trim(); - }; - QuestionRowModel.prototype.getRenderedWidthFromWidth = function (width) { - return _helpers__WEBPACK_IMPORTED_MODULE_1__["Helpers"].isNumber(width) ? width + "px" : width; - }; - QuestionRowModel.prototype.calcVisible = function () { - var visElements = []; - for (var i = 0; i < this.elements.length; i++) { - if (this.elements[i].isVisible) { - visElements.push(this.elements[i]); - } - } - if (this.needToUpdateVisibleElements(visElements)) { - this.setPropertyValue("visibleElements", visElements); - } - return visElements.length > 0; - }; - QuestionRowModel.prototype.needToUpdateVisibleElements = function (visElements) { - if (visElements.length !== this.visibleElements.length) - return true; - for (var i = 0; i < visElements.length; i++) { - if (visElements[i] !== this.visibleElements[i]) - return true; - } - return false; - }; - QuestionRowModel.prototype.dispose = function () { - _super.prototype.dispose.call(this); - this.stopLazyRendering(); - }; - QuestionRowModel.prototype.getRowCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() - .append(this.panel.cssClasses.row) - .append(this.panel.cssClasses.rowMultiple, this.visibleElements.length > 1) - .toString(); - }; - QuestionRowModel.rowCounter = 100; - return QuestionRowModel; - }(_base__WEBPACK_IMPORTED_MODULE_2__["Base"])); - - /** - * A base class for a Panel and Page objects. - */ - var PanelModelBase = /** @class */ (function (_super) { - __extends(PanelModelBase, _super); - function PanelModelBase(name) { - if (name === void 0) { name = ""; } - var _this = _super.call(this, name) || this; - _this.isQuestionsReady = false; - _this.questionsValue = new Array(); - _this.isRandomizing = false; - _this.createNewArray("rows"); - _this.elementsValue = _this.createNewArray("elements", _this.onAddElement.bind(_this), _this.onRemoveElement.bind(_this)); - _this.id = PanelModelBase.getPanelId(); - _this.createLocalizableString("requiredErrorText", _this); - _this.registerFunctionOnPropertyValueChanged("questionTitleLocation", function () { - _this.onVisibleChanged.bind(_this); - _this.updateElementCss(true); - }); - _this.registerFunctionOnPropertiesValueChanged(["questionStartIndex", "showQuestionNumbers"], function () { - _this.updateVisibleIndexes(); - }); - return _this; - } - PanelModelBase.getPanelId = function () { - return "sp_" + PanelModelBase.panelCounter++; - }; - PanelModelBase.prototype.getType = function () { - return "panelbase"; - }; - PanelModelBase.prototype.setSurveyImpl = function (value, isLight) { - _super.prototype.setSurveyImpl.call(this, value, isLight); - if (this.isDesignMode) - this.onVisibleChanged(); - for (var i = 0; i < this.elements.length; i++) { - this.elements[i].setSurveyImpl(value, isLight); - } - }; - PanelModelBase.prototype.endLoadingFromJson = function () { - _super.prototype.endLoadingFromJson.call(this); - this.markQuestionListDirty(); - this.onRowsChanged(); - }; - Object.defineProperty(PanelModelBase.prototype, "hasTitle", { - get: function () { - return ((this.canShowTitle() && this.title.length > 0) || - (this.isDesignMode && _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].allowShowEmptyTitleInDesignMode)); - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.canShowTitle = function () { return true; }; - Object.defineProperty(PanelModelBase.prototype, "_showDescription", { - get: function () { - return ((this.survey.showPageTitles && this.description.length > 0) || - (this.isDesignMode && - _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].allowShowEmptyTitleInDesignMode && - _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].allowShowEmptyDescriptionInDesignMode)); - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.localeChanged = function () { - _super.prototype.localeChanged.call(this); - for (var i = 0; i < this.elements.length; i++) { - this.elements[i].localeChanged(); - } - }; - PanelModelBase.prototype.locStrsChanged = function () { - _super.prototype.locStrsChanged.call(this); - for (var i = 0; i < this.elements.length; i++) { - this.elements[i].locStrsChanged(); - } - }; - Object.defineProperty(PanelModelBase.prototype, "requiredText", { - /** - * Returns the char/string for a required panel. - * @see SurveyModel.requiredText - */ - get: function () { - return this.survey != null && this.isRequired - ? this.survey.requiredText - : ""; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModelBase.prototype, "titlePattern", { - get: function () { - return !!this.survey ? this.survey.questionTitlePattern : "numTitleRequire"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModelBase.prototype, "isRequireTextOnStart", { - get: function () { - return this.isRequired && this.titlePattern == "requireNumTitle"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModelBase.prototype, "isRequireTextBeforeTitle", { - get: function () { - return this.isRequired && this.titlePattern == "numRequireTitle"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModelBase.prototype, "isRequireTextAfterTitle", { - get: function () { - return this.isRequired && this.titlePattern == "numTitleRequire"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModelBase.prototype, "requiredErrorText", { - /** - * The custom text that will be shown on required error. Use this property, if you do not want to show the default text. - */ - get: function () { - return this.getLocalizableStringText("requiredErrorText"); - }, - set: function (val) { - this.setLocalizableStringText("requiredErrorText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModelBase.prototype, "locRequiredErrorText", { - get: function () { - return this.getLocalizableString("requiredErrorText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModelBase.prototype, "questionsOrder", { - /** - * Use this property to randomize questions. Set it to 'random' to randomize questions, 'initial' to keep them in the same order or 'default' to use the Survey questionsOrder property - * @see SurveyModel.questionsOrder - * @see areQuestionsRandomized - */ - get: function () { - return this.getPropertyValue("questionsOrder"); - }, - set: function (val) { - this.setPropertyValue("questionsOrder", val); - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.canRandomize = function (isRandom) { - return isRandom && (this.questionsOrder !== "initial") || this.questionsOrder === "random"; - }; - PanelModelBase.prototype.randomizeElements = function (isRandom) { - if (!this.canRandomize(isRandom) || this.isRandomizing) - return; - this.isRandomizing = true; - var oldElements = []; - var elements = this.elements; - for (var i = 0; i < elements.length; i++) { - oldElements.push(elements[i]); - } - var newElements = _helpers__WEBPACK_IMPORTED_MODULE_1__["Helpers"].randomizeArray(oldElements); - this.elements.splice(0, this.elements.length); - for (var i = 0; i < newElements.length; i++) { - this.elements.push(newElements[i]); - } - this.isRandomizing = false; - }; - Object.defineProperty(PanelModelBase.prototype, "parent", { - /** - * A parent element. It is always null for the Page object and always not null for the Panel object. Panel object may contain Questions and other Panels. - */ - get: function () { - return this.getPropertyValue("parent", null); - }, - set: function (val) { - this.setPropertyValue("parent", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModelBase.prototype, "depth", { - get: function () { - if (this.parent == null) - return 0; - return this.parent.depth + 1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModelBase.prototype, "visibleIf", { - /** - * An expression that returns true or false. If it returns true the Panel becomes visible and if it returns false the Panel becomes invisible. The library runs the expression on survey start and on changing a question value. If the property is empty then visible property is used. - * @see visible - */ - get: function () { - return this.getPropertyValue("visibleIf", ""); - }, - set: function (val) { - this.setPropertyValue("visibleIf", val); - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.calcCssClasses = function (css) { - var classes = { panel: {}, error: {}, row: "", rowMultiple: "" }; - this.copyCssClasses(classes.panel, css.panel); - this.copyCssClasses(classes.error, css.error); - if (!!css.row) { - classes.row = css.row; - } - if (!!css.rowMultiple) { - classes.rowMultiple = css.rowMultiple; - } - if (this.survey) { - this.survey.updatePanelCssClasses(this, classes); - } - return classes; - }; - Object.defineProperty(PanelModelBase.prototype, "id", { - /** - * A unique element identificator. It is generated automatically. - */ - get: function () { - return this.getPropertyValue("id"); - }, - set: function (val) { - this.setPropertyValue("id", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModelBase.prototype, "isPanel", { - /** - * Returns true if the current object is Panel. Returns false if the current object is Page (a root Panel). - */ - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.getPanel = function () { - return this; - }; - PanelModelBase.prototype.getLayoutType = function () { - return "row"; - }; - PanelModelBase.prototype.isLayoutTypeSupported = function (layoutType) { - return layoutType !== "flow"; - }; - Object.defineProperty(PanelModelBase.prototype, "questions", { - /** - * Returns the list of all questions located in the Panel/Page, including in the nested Panels. - * @see Question - * @see elements - */ - get: function () { - if (!this.isQuestionsReady) { - this.questionsValue = []; - for (var i = 0; i < this.elements.length; i++) { - var el = this.elements[i]; - if (el.isPanel) { - var qs = el.questions; - for (var j = 0; j < qs.length; j++) { - this.questionsValue.push(qs[j]); - } - } - else { - this.questionsValue.push(el); - } - } - this.isQuestionsReady = true; - } - return this.questionsValue; - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.getValidName = function (name) { - if (!!name) - return name.trim(); - return name; - }; - /** - * Returns the question by its name - * @param name the question name - */ - PanelModelBase.prototype.getQuestionByName = function (name) { - var questions = this.questions; - for (var i = 0; i < questions.length; i++) { - if (questions[i].name == name) - return questions[i]; - } - return null; - }; - /** - * Returns the element by its name. It works recursively. - * @param name the element name - */ - PanelModelBase.prototype.getElementByName = function (name) { - var elements = this.elements; - for (var i = 0; i < elements.length; i++) { - var el = elements[i]; - if (el.name == name) - return el; - var pnl = el.getPanel(); - if (!!pnl) { - var res = pnl.getElementByName(name); - if (!!res) - return res; - } - } - return null; - }; - PanelModelBase.prototype.getQuestionByValueName = function (valueName) { - var questions = this.questions; - for (var i = 0; i < questions.length; i++) { - if (questions[i].getValueName() == valueName) - return questions[i]; - } - return null; - }; - /** - * Returns question values on the current page - */ - PanelModelBase.prototype.getValue = function () { - var data = {}; - var questions = this.questions; - for (var i = 0; i < questions.length; i++) { - var q = questions[i]; - if (q.isEmpty()) - continue; - var valueName = q.getValueName(); - data[valueName] = q.value; - if (!!this.data) { - var comment = this.data.getComment(valueName); - if (!!comment) { - data[valueName + _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].commentPrefix] = comment; - } - } - } - return data; - }; - /** - * Return questions values as a JSON object with display text. For example, for dropdown, it would return the item text instead of item value. - * @param keysAsText Set this value to true, to return key (in matrices questions) as display text as well. - */ - PanelModelBase.prototype.getDisplayValue = function (keysAsText) { - var data = {}; - var questions = this.questions; - for (var i = 0; i < questions.length; i++) { - var q = questions[i]; - if (q.isEmpty()) - continue; - var valueName = keysAsText ? q.title : q.getValueName(); - data[valueName] = q.getDisplayValue(keysAsText); - } - return data; - }; - /** - * Returns question comments on the current page - */ - PanelModelBase.prototype.getComments = function () { - var comments = {}; - if (!this.data) - return comments; - var questions = this.questions; - for (var i = 0; i < questions.length; i++) { - var q = questions[i]; - var comment = this.data.getComment(q.getValueName()); - if (!!comment) { - comments[q.getValueName()] = comment; - } - } - return comments; - }; - /** - * Call this function to remove all question values from the current page/panel, that end-user will not be able to enter. - * For example the value that doesn't exists in a radigroup/dropdown/checkbox choices or matrix rows/columns. - * Please note, this function doesn't clear values for invisible questions or values that doesn't associated with questions. - * @see Question.clearIncorrectValues - */ - PanelModelBase.prototype.clearIncorrectValues = function () { - for (var i = 0; i < this.elements.length; i++) { - this.elements[i].clearIncorrectValues(); - } - }; - /** - * Call this function to clear all errors in the panel / page and all its child elements (panels and questions) - */ - PanelModelBase.prototype.clearErrors = function () { - for (var i = 0; i < this.elements.length; i++) { - this.elements[i].clearErrors(); - } - this.errors = []; - }; - PanelModelBase.prototype.markQuestionListDirty = function () { - this.isQuestionsReady = false; - if (this.parent) - this.parent.markQuestionListDirty(); - }; - Object.defineProperty(PanelModelBase.prototype, "elements", { - /** - * Returns the list of the elements in the object, Panel/Page. Elements can be questions or panels. The function doesn't return elements in the nested Panels. - */ - get: function () { - return this.elementsValue; - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.getElementsInDesign = function (includeHidden) { - return this.elements; - }; - /** - * Returns true if the current element belongs to the Panel/Page. It looks in nested Panels as well. - * @param element - * @see PanelModel - */ - PanelModelBase.prototype.containsElement = function (element) { - for (var i = 0; i < this.elements.length; i++) { - var el = this.elements[i]; - if (el == element) - return true; - var pnl = el.getPanel(); - if (!!pnl) { - if (pnl.containsElement(element)) - return true; - } - } - return false; - }; - Object.defineProperty(PanelModelBase.prototype, "isRequired", { - /** - * Set this property to true, to require the answer at least in one question in the panel. - */ - get: function () { - return this.getPropertyValue("isRequired", false); - }, - set: function (val) { - this.setPropertyValue("isRequired", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModelBase.prototype, "requiredIf", { - /** - * An expression that returns true or false. If it returns true the Panel/Page becomes required. - * The library runs the expression on survey start and on changing a question value. If the property is empty then isRequired property is used. - * @see isRequired - */ - get: function () { - return this.getPropertyValue("requiredIf", ""); - }, - set: function (val) { - this.setPropertyValue("requiredIf", val); - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.searchText = function (text, founded) { - _super.prototype.searchText.call(this, text, founded); - for (var i = 0; i < this.elements.length; i++) { - this.elements[i].searchText(text, founded); - } - }; - /** - * Returns true, if there is an error on this Page or inside the current Panel - * @param fireCallback set it to true, to show errors in UI - * @param focusOnFirstError set it to true to focus on the first question that doesn't pass the validation - */ - PanelModelBase.prototype.hasErrors = function (fireCallback, focusOnFirstError, rec) { - if (fireCallback === void 0) { fireCallback = true; } - if (focusOnFirstError === void 0) { focusOnFirstError = false; } - if (rec === void 0) { rec = null; } - rec = !!rec - ? rec - : { - fireCallback: fireCallback, - focuseOnFirstError: focusOnFirstError, - firstErrorQuestion: null, - result: false, - }; - this.hasErrorsCore(rec); - if (rec.firstErrorQuestion) { - rec.firstErrorQuestion.focus(true); - } - return rec.result; - }; - PanelModelBase.prototype.hasErrorsInPanels = function (rec) { - var errors = []; - this.hasRequiredError(rec, errors); - if (this.survey) { - var customError = this.survey.validatePanel(this); - if (customError) { - errors.push(customError); - rec.result = true; - } - } - if (!!rec.fireCallback) { - if (!!this.survey) { - this.survey.beforeSettingPanelErrors(this, errors); - } - this.errors = errors; - } - }; - //ISurveyErrorOwner - PanelModelBase.prototype.getErrorCustomText = function (text, error) { - if (!!this.survey) - return this.survey.getErrorCustomText(text, error); - return text; - }; - PanelModelBase.prototype.hasRequiredError = function (rec, errors) { - if (!this.isRequired) - return; - var visQuestions = []; - this.addQuestionsToList(visQuestions, true); - if (visQuestions.length == 0) - return; - for (var i = 0; i < visQuestions.length; i++) { - if (!visQuestions[i].isEmpty()) - return; - } - rec.result = true; - errors.push(new _error__WEBPACK_IMPORTED_MODULE_7__["OneAnswerRequiredError"](this.requiredErrorText, this)); - if (rec.focuseOnFirstError && !rec.firstErrorQuestion) { - rec.firstErrorQuestion = visQuestions[0]; - } - }; - PanelModelBase.prototype.hasErrorsCore = function (rec) { - var elements = this.elements; - var element = null; - for (var i = 0; i < elements.length; i++) { - element = elements[i]; - if (!element.isVisible) - continue; - if (element.isPanel) { - element.hasErrorsCore(rec); - } - else { - var question = element; - if (question.isReadOnly) - continue; - if (question.hasErrors(rec.fireCallback, rec)) { - if (rec.focuseOnFirstError && rec.firstErrorQuestion == null) { - rec.firstErrorQuestion = question; - } - rec.result = true; - } - } - } - this.hasErrorsInPanels(rec); - this.updateContainsErrors(); - }; - PanelModelBase.prototype.getContainsErrors = function () { - var res = _super.prototype.getContainsErrors.call(this); - if (res) - return res; - var elements = this.elements; - for (var i = 0; i < elements.length; i++) { - if (elements[i].containsErrors) - return true; - } - return false; - }; - PanelModelBase.prototype.updateElementVisibility = function () { - for (var i = 0; i < this.elements.length; i++) { - var el = this.elements[i]; - el.setPropertyValue("isVisible", el.isVisible); - if (el.isPanel) { - el.updateElementVisibility(); - } - } - }; - PanelModelBase.prototype.getFirstQuestionToFocus = function (withError) { - if (withError === void 0) { withError = false; } - var elements = this.elements; - for (var i = 0; i < elements.length; i++) { - var el = elements[i]; - if (!el.isVisible) - continue; - if (el.isPanel) { - var res = el.getFirstQuestionToFocus(withError); - if (!!res) - return res; - } - else { - var q = el; - if (q.hasInput && (!withError || q.currentErrorCount > 0)) - return q; - } - } - return null; - }; - /** - * Call it to focus the input on the first question - */ - PanelModelBase.prototype.focusFirstQuestion = function () { - var q = this.getFirstQuestionToFocus(); - if (!!q) { - q.focus(); - } - }; - /** - * Call it to focus the input of the first question that has an error. - */ - PanelModelBase.prototype.focusFirstErrorQuestion = function () { - var q = this.getFirstQuestionToFocus(true); - if (!!q) { - q.focus(); - } - }; - /** - * Fill list array with the questions. - * @param list - * @param visibleOnly set it to true to get visible questions only - */ - PanelModelBase.prototype.addQuestionsToList = function (list, visibleOnly, includingDesignTime) { - if (visibleOnly === void 0) { visibleOnly = false; } - if (includingDesignTime === void 0) { includingDesignTime = false; } - this.addElementsToList(list, visibleOnly, includingDesignTime, false); - }; - /** - * Fill list array with the panels. - * @param list - */ - PanelModelBase.prototype.addPanelsIntoList = function (list, visibleOnly, includingDesignTime) { - if (visibleOnly === void 0) { visibleOnly = false; } - if (includingDesignTime === void 0) { includingDesignTime = false; } - this.addElementsToList(list, visibleOnly, includingDesignTime, true); - }; - PanelModelBase.prototype.addElementsToList = function (list, visibleOnly, includingDesignTime, isPanel) { - if (visibleOnly && !this.visible) - return; - this.addElementsToListCore(list, this.elements, visibleOnly, includingDesignTime, isPanel); - }; - PanelModelBase.prototype.addElementsToListCore = function (list, elements, visibleOnly, includingDesignTime, isPanel) { - for (var i = 0; i < elements.length; i++) { - var el = elements[i]; - if (visibleOnly && !el.visible) - continue; - if ((isPanel && el.isPanel) || (!isPanel && !el.isPanel)) { - list.push(el); - } - if (el.isPanel) { - el.addElementsToListCore(list, el.elements, visibleOnly, includingDesignTime, isPanel); - } - else { - if (includingDesignTime) { - this.addElementsToListCore(list, el.getElementsInDesign(false), visibleOnly, includingDesignTime, isPanel); - } - } - } - }; - Object.defineProperty(PanelModelBase.prototype, "isActive", { - /** - * Returns true if the current object is Page and it is the current page. - */ - get: function () { - return !this.survey || this.survey.currentPage == this.root; - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.updateCustomWidgets = function () { - for (var i = 0; i < this.elements.length; i++) { - this.elements[i].updateCustomWidgets(); - } - }; - Object.defineProperty(PanelModelBase.prototype, "questionTitleLocation", { - /** - * Set this property different from "default" to set the specific question title location for this panel/page. - * @see SurveyModel.questionTitleLocation - */ - get: function () { - return this.getPropertyValue("questionTitleLocation"); - }, - set: function (value) { - this.setPropertyValue("questionTitleLocation", value.toLowerCase()); - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.getQuestionTitleLocation = function () { - if (this.onGetQuestionTitleLocation) - return this.onGetQuestionTitleLocation(); - if (this.questionTitleLocation != "default") - return this.questionTitleLocation; - if (this.parent) - return this.parent.getQuestionTitleLocation(); - return this.survey ? this.survey.questionTitleLocation : "top"; - }; - PanelModelBase.prototype.getStartIndex = function () { - if (!!this.parent) - return this.parent.getQuestionStartIndex(); - if (!!this.survey) - return this.survey.questionStartIndex; - return ""; - }; - PanelModelBase.prototype.getQuestionStartIndex = function () { - return this.getStartIndex(); - }; - PanelModelBase.prototype.getChildrenLayoutType = function () { - return "row"; - }; - PanelModelBase.prototype.getProgressInfo = function () { - return _survey_element__WEBPACK_IMPORTED_MODULE_3__["SurveyElement"].getProgressInfoByElements(this.elements, this.isRequired); - }; - Object.defineProperty(PanelModelBase.prototype, "root", { - get: function () { - var res = this; - while (res.parent) - res = res.parent; - return res; - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.childVisibilityChanged = function () { - var newIsVisibleValue = this.getIsPageVisible(null); - var oldIsVisibleValue = this.getPropertyValue("isVisible", true); - if (newIsVisibleValue !== oldIsVisibleValue) { - this.onVisibleChanged(); - } - }; - PanelModelBase.prototype.createRowAndSetLazy = function (index) { - var row = this.createRow(); - row.setIsLazyRendering(this.isLazyRenderInRow(index)); - return row; - }; - PanelModelBase.prototype.createRow = function () { - return new QuestionRowModel(this); - }; - PanelModelBase.prototype.onSurveyLoad = function () { - for (var i = 0; i < this.elements.length; i++) { - this.elements[i].onSurveyLoad(); - } - this.onElementVisibilityChanged(this); - }; - PanelModelBase.prototype.onFirstRendering = function () { - _super.prototype.onFirstRendering.call(this); - for (var i = 0; i < this.elements.length; i++) { - this.elements[i].onFirstRendering(); - } - this.onRowsChanged(); - }; - PanelModelBase.prototype.updateRows = function () { - if (this.isLoadingFromJson) - return; - for (var i = 0; i < this.elements.length; i++) { - if (this.elements[i].isPanel) { - this.elements[i].updateRows(); - } - } - this.onRowsChanged(); - }; - Object.defineProperty(PanelModelBase.prototype, "rows", { - get: function () { - return this.getPropertyValue("rows"); - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.ensureRowsVisibility = function () { - this.rows.forEach(function (row) { - row.ensureVisibility(); - }); - }; - PanelModelBase.prototype.onRowsChanged = function () { - if (this.isLoadingFromJson) - return; - this.setArrayPropertyDirectly("rows", this.buildRows()); - }; - PanelModelBase.prototype.onAddElement = function (element, index) { - element.setSurveyImpl(this.surveyImpl); - element.parent = this; - this.markQuestionListDirty(); - this.updateRowsOnElementAdded(element, index); - if (element.isPanel) { - var p = element; - if (this.survey) { - this.survey.panelAdded(p, index, this, this.root); - } - } - else { - if (this.survey) { - var q = element; - this.survey.questionAdded(q, index, this, this.root); - } - } - if (!!this.addElementCallback) - this.addElementCallback(element); - var self = this; - element.registerFunctionOnPropertiesValueChanged(["visible", "isVisible"], function () { - self.onElementVisibilityChanged(element); - }, this.id); - element.registerFunctionOnPropertyValueChanged("startWithNewLine", function () { - self.onElementStartWithNewLineChanged(element); - }, this.id); - this.onElementVisibilityChanged(this); - }; - PanelModelBase.prototype.onRemoveElement = function (element) { - element.parent = null; - this.markQuestionListDirty(); - element.unRegisterFunctionOnPropertiesValueChanged(["visible", "isVisible", "startWithNewLine"], this.id); - this.updateRowsOnElementRemoved(element); - if (this.isRandomizing) - return; - if (!element.isPanel) { - if (this.survey) - this.survey.questionRemoved(element); - } - else { - if (this.survey) - this.survey.panelRemoved(element); - } - if (!!this.removeElementCallback) - this.removeElementCallback(element); - this.onElementVisibilityChanged(this); - }; - PanelModelBase.prototype.onElementVisibilityChanged = function (element) { - if (this.isLoadingFromJson || this.isRandomizing) - return; - this.updateRowsVisibility(element); - this.childVisibilityChanged(); - if (!!this.parent) { - this.parent.onElementVisibilityChanged(this); - } - }; - PanelModelBase.prototype.onElementStartWithNewLineChanged = function (element) { - this.onRowsChanged(); - }; - PanelModelBase.prototype.updateRowsVisibility = function (element) { - var rows = this.rows; - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - if (row.elements.indexOf(element) > -1) { - row.updateVisible(); - if (row.visible && !row.isNeedRender) { - row.isNeedRender = true; - } - break; - } - } - }; - PanelModelBase.prototype.canBuildRows = function () { - return !this.isLoadingFromJson && this.getChildrenLayoutType() == "row"; - }; - PanelModelBase.prototype.buildRows = function () { - if (!this.canBuildRows()) - return []; - var result = new Array(); - for (var i = 0; i < this.elements.length; i++) { - var el = this.elements[i]; - var isNewRow = i == 0 || el.startWithNewLine; - var row = isNewRow ? this.createRowAndSetLazy(result.length) : result[result.length - 1]; - if (isNewRow) - result.push(row); - row.addElement(el); - } - for (var i = 0; i < result.length; i++) { - result[i].updateVisible(); - } - return result; - }; - PanelModelBase.prototype.isLazyRenderInRow = function (rowIndex) { - if (!this.survey || !this.survey.isLazyRendering) - return false; - return (rowIndex >= _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].lazyRowsRenderingStartRow || - !this.canRenderFirstRows()); - }; - PanelModelBase.prototype.canRenderFirstRows = function () { - return this.isPage; - }; - PanelModelBase.prototype.updateRowsOnElementAdded = function (element, index) { - if (!this.canBuildRows()) - return; - var dragDropInfo = new DragDropInfo(null, element); - dragDropInfo.target = element; - dragDropInfo.isEdge = this.elements.length > 1; - if (this.elements.length < 2) { - dragDropInfo.destination = this; - } - else { - dragDropInfo.isBottom = index > 0; - if (index == 0) { - dragDropInfo.destination = this.elements[1]; - } - else { - dragDropInfo.destination = this.elements[index - 1]; - } - } - this.dragDropAddTargetToRow(dragDropInfo, null); - }; - PanelModelBase.prototype.updateRowsOnElementRemoved = function (element) { - if (!this.canBuildRows()) - return; - this.updateRowsRemoveElementFromRow(element, this.findRowByElement(element)); - }; - PanelModelBase.prototype.updateRowsRemoveElementFromRow = function (element, row) { - if (!row || !row.panel) - return; - var elIndex = row.elements.indexOf(element); - if (elIndex < 0) - return; - row.elements.splice(elIndex, 1); - if (row.elements.length > 0) { - row.updateVisible(); - } - else { - if (row.index >= 0) { - row.panel.rows.splice(row.index, 1); - } - } - }; - PanelModelBase.prototype.findRowByElement = function (el) { - var rows = this.rows; - for (var i = 0; i < rows.length; i++) { - if (rows[i].elements.indexOf(el) > -1) - return rows[i]; - } - return null; - }; - PanelModelBase.prototype.elementWidthChanged = function (el) { - if (this.isLoadingFromJson) - return; - var row = this.findRowByElement(el); - if (!!row) { - row.updateVisible(); - } - }; - Object.defineProperty(PanelModelBase.prototype, "processedTitle", { - /** - * Returns rendered title text or html. - */ - get: function () { - return this.getRenderedTitle(this.locTitle.textOrHtml); - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.getRenderedTitle = function (str) { - return this.textProcessor != null - ? this.textProcessor.processText(str, true) - : str; - }; - Object.defineProperty(PanelModelBase.prototype, "visible", { - /** - * Use it to get/set the object visibility. - * @see visibleIf - */ - get: function () { - return this.getPropertyValue("visible", true); - }, - set: function (value) { - if (value === this.visible) - return; - this.setPropertyValue("visible", value); - this.setPropertyValue("isVisible", this.isVisible); - if (!this.isLoadingFromJson) - this.onVisibleChanged(); - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.onVisibleChanged = function () { - if (this.isRandomizing) - return; - this.setPropertyValue("isVisible", this.isVisible); - if (!!this.survey && - this.survey.isClearValueOnHiddenContainer && - !this.isLoadingFromJson) { - var questions = this.questions; - for (var i = 0; i < questions.length; i++) { - if (!this.isVisible) { - questions[i].clearValue(); - } - else { - questions[i].updateValueWithDefaults(); - } - } - } - }; - Object.defineProperty(PanelModelBase.prototype, "isVisible", { - /** - * Returns true if object is visible or survey is in design mode right now. - */ - get: function () { - return this.areInvisibleElementsShowing || this.getIsPageVisible(null); - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.getIsPageVisible = function (exceptionQuestion) { - if (!this.visible) - return false; - for (var i = 0; i < this.elements.length; i++) { - if (this.elements[i] == exceptionQuestion) - continue; - if (this.elements[i].isVisible) - return true; - } - return false; - }; - PanelModelBase.prototype.setVisibleIndex = function (index) { - if (!this.isVisible || index < 0) { - this.resetVisibleIndexes(); - return 0; - } - this.lastVisibleIndex = index; - var startIndex = index; - index += this.beforeSetVisibleIndex(index); - var panelStartIndex = this.getPanelStartIndex(index); - var panelIndex = panelStartIndex; - for (var i = 0; i < this.elements.length; i++) { - panelIndex += this.elements[i].setVisibleIndex(panelIndex); - } - if (this.isContinueNumbering()) { - index += panelIndex - panelStartIndex; - } - return index - startIndex; - }; - PanelModelBase.prototype.updateVisibleIndexes = function () { - if (this.lastVisibleIndex === undefined) - return; - this.resetVisibleIndexes(); - this.setVisibleIndex(this.lastVisibleIndex); - }; - PanelModelBase.prototype.resetVisibleIndexes = function () { - for (var i = 0; i < this.elements.length; i++) { - this.elements[i].setVisibleIndex(-1); - } - }; - PanelModelBase.prototype.beforeSetVisibleIndex = function (index) { - return 0; - }; - PanelModelBase.prototype.getPanelStartIndex = function (index) { - return index; - }; - PanelModelBase.prototype.isContinueNumbering = function () { - return true; - }; - Object.defineProperty(PanelModelBase.prototype, "isReadOnly", { - /** - * Returns true if readOnly property is true or survey is in display mode or parent panel/page is readOnly. - * @see SurveyModel.model - * @see readOnly - */ - get: function () { - var isParentReadOnly = !!this.parent && this.parent.isReadOnly; - var isSurveyReadOnly = !!this.survey && this.survey.isDisplayMode; - return this.readOnly || isParentReadOnly || isSurveyReadOnly; - }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.onReadOnlyChanged = function () { - for (var i = 0; i < this.elements.length; i++) { - var el = this.elements[i]; - el.setPropertyValue("isReadOnly", el.isReadOnly); - } - _super.prototype.onReadOnlyChanged.call(this); - }; - PanelModelBase.prototype.updateElementCss = function (reNew) { - _super.prototype.updateElementCss.call(this, reNew); - for (var i = 0; i < this.elements.length; i++) { - var el = this.elements[i]; - el.updateElementCss(reNew); - } - }; - Object.defineProperty(PanelModelBase.prototype, "enableIf", { - /** - * An expression that returns true or false. If it returns false the Panel/Page becomes read only and an end-user will not able to answer on qustions inside it. - * The library runs the expression on survey start and on changing a question value. If the property is empty then readOnly property is used. - * @see readOnly - * @see isReadOnly - */ - get: function () { - return this.getPropertyValue("enableIf", ""); - }, - set: function (val) { - this.setPropertyValue("enableIf", val); - }, - enumerable: false, - configurable: true - }); - /** - * Add an element into Panel or Page. Returns true if the element added successfully. Otherwise returns false. - * @param element - * @param index element index in the elements array - */ - PanelModelBase.prototype.addElement = function (element, index) { - if (index === void 0) { index = -1; } - if (!this.canAddElement(element)) - return false; - if (index < 0 || index >= this.elements.length) { - this.elements.push(element); - } - else { - this.elements.splice(index, 0, element); - } - return true; - }; - PanelModelBase.prototype.insertElementAfter = function (element, after) { - var index = this.elements.indexOf(after); - if (index >= 0) - this.addElement(element, index + 1); - }; - PanelModelBase.prototype.insertElementBefore = function (element, before) { - var index = this.elements.indexOf(before); - if (index >= 0) - this.addElement(element, index); - }; - PanelModelBase.prototype.canAddElement = function (element) { - return (!!element && element.isLayoutTypeSupported(this.getChildrenLayoutType())); - }; - /** - * Add a question into Panel or Page. Returns true if the question added successfully. Otherwise returns false. - * @param question - * @param index element index in the elements array - */ - PanelModelBase.prototype.addQuestion = function (question, index) { - if (index === void 0) { index = -1; } - return this.addElement(question, index); - }; - /** - * Add a panel into Panel or Page. Returns true if the panel added successfully. Otherwise returns false. - * @param panel - * @param index element index in the elements array - */ - PanelModelBase.prototype.addPanel = function (panel, index) { - if (index === void 0) { index = -1; } - return this.addElement(panel, index); - }; - /** - * Creates a new question and adds it at location of index, by default the end of the elements list. Returns null, if the question could not be created or could not be added into page or panel. - * @param questionType the possible values are: "text", "checkbox", "dropdown", "matrix", "html", "matrixdynamic", "matrixdropdown" and so on. - * @param name a question name - * @param index element index in the elements array - */ - PanelModelBase.prototype.addNewQuestion = function (questionType, name, index) { - if (name === void 0) { name = null; } - if (index === void 0) { index = -1; } - var question = _questionfactory__WEBPACK_IMPORTED_MODULE_6__["QuestionFactory"].Instance.createQuestion(questionType, name); - if (!this.addQuestion(question, index)) - return null; - return question; - }; - /** - * Creates a new panel and adds it into the end of the elements list. Returns null, if the panel could not be created or could not be added into page or panel. - * @param name a panel name - */ - PanelModelBase.prototype.addNewPanel = function (name) { - if (name === void 0) { name = null; } - var panel = this.createNewPanel(name); - if (!this.addPanel(panel)) - return null; - return panel; - }; - /** - * Returns the index of element parameter in the elements list. - * @param element question or panel - */ - PanelModelBase.prototype.indexOf = function (element) { - return this.elements.indexOf(element); - }; - PanelModelBase.prototype.createNewPanel = function (name) { - var res = _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].createClass("panel"); - res.name = name; - return res; - }; - /** - * Remove an element (Panel or Question) from the elements list. - * @param element - * @see elements - */ - PanelModelBase.prototype.removeElement = function (element) { - var index = this.elements.indexOf(element); - if (index < 0) { - for (var i = 0; i < this.elements.length; i++) { - if (this.elements[i].removeElement(element)) - return true; - } - return false; - } - this.elements.splice(index, 1); - return true; - }; - /** - * Remove question from the elements list. - * @param question - * @see elements - * @see removeElement - */ - PanelModelBase.prototype.removeQuestion = function (question) { - this.removeElement(question); - }; - PanelModelBase.prototype.runCondition = function (values, properties) { - if (this.isDesignMode || this.isLoadingFromJson) - return; - var elements = this.elements.slice(); - for (var i = 0; i < elements.length; i++) { - elements[i].runCondition(values, properties); - } - if (!this.areInvisibleElementsShowing) { - this.runVisibleCondition(values, properties); - } - this.runEnableCondition(values, properties); - this.runRequiredCondition(values, properties); - }; - PanelModelBase.prototype.runVisibleCondition = function (values, properties) { - var _this = this; - if (!this.visibleIf) - return; - var conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_5__["ConditionRunner"](this.visibleIf); - conditionRunner.onRunComplete = function (res) { - _this.visible = res; - }; - conditionRunner.run(values, properties); - }; - PanelModelBase.prototype.runEnableCondition = function (values, properties) { - var _this = this; - if (!this.enableIf) - return; - var conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_5__["ConditionRunner"](this.enableIf); - conditionRunner.onRunComplete = function (res) { - _this.readOnly = !res; - }; - conditionRunner.run(values, properties); - }; - PanelModelBase.prototype.runRequiredCondition = function (values, properties) { - var _this = this; - if (!this.requiredIf) - return; - var conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_5__["ConditionRunner"](this.requiredIf); - conditionRunner.onRunComplete = function (res) { - _this.isRequired = res; - }; - conditionRunner.run(values, properties); - }; - PanelModelBase.prototype.onAnyValueChanged = function (name) { - var els = this.elements; - for (var i = 0; i < els.length; i++) { - els[i].onAnyValueChanged(name); - } - }; - PanelModelBase.prototype.checkBindings = function (valueName, value) { - var els = this.elements; - for (var i = 0; i < els.length; i++) { - els[i].checkBindings(valueName, value); - } - }; - PanelModelBase.prototype.dragDropAddTarget = function (dragDropInfo) { - var prevRow = this.dragDropFindRow(dragDropInfo.target); - if (this.dragDropAddTargetToRow(dragDropInfo, prevRow)) { - this.updateRowsRemoveElementFromRow(dragDropInfo.target, prevRow); - } - }; - PanelModelBase.prototype.dragDropFindRow = function (findElement) { - if (!findElement || findElement.isPage) - return null; - var element = findElement; - var rows = this.rows; - for (var i = 0; i < rows.length; i++) { - if (rows[i].elements.indexOf(element) > -1) - return rows[i]; - } - for (var i = 0; i < this.elements.length; i++) { - var pnl = this.elements[i].getPanel(); - if (!pnl) - continue; - var row = pnl.dragDropFindRow(element); - if (!!row) - return row; - } - return null; - }; - PanelModelBase.prototype.dragDropAddTargetToRow = function (dragDropInfo, prevRow) { - if (!dragDropInfo.destination) - return true; - if (this.dragDropAddTargetToEmptyPanel(dragDropInfo)) - return true; - var dest = dragDropInfo.destination; - var destRow = this.dragDropFindRow(dest); - if (!destRow) - return true; - if (_settings__WEBPACK_IMPORTED_MODULE_8__["settings"].supportCreatorV2 && this.isDesignMode) { - if (destRow.elements.length > 1) - return this.dragDropAddTargetToExistingRow(dragDropInfo, destRow, prevRow); - else - return this.dragDropAddTargetToNewRow(dragDropInfo, destRow, prevRow); - } - if (!dragDropInfo.target.startWithNewLine) - return this.dragDropAddTargetToExistingRow(dragDropInfo, destRow, prevRow); - return this.dragDropAddTargetToNewRow(dragDropInfo, destRow, prevRow); - }; - PanelModelBase.prototype.dragDropAddTargetToEmptyPanel = function (dragDropInfo) { - if (dragDropInfo.destination.isPage) { - this.dragDropAddTargetToEmptyPanelCore(this.root, dragDropInfo.target, dragDropInfo.isBottom); - return true; - } - var dest = dragDropInfo.destination; - if (dest.isPanel && !dragDropInfo.isEdge) { - var panel = dest; - if (dragDropInfo.target["template"] === dest) { - return false; - } - if (dragDropInfo.nestedPanelDepth < 0 || - dragDropInfo.nestedPanelDepth >= panel.depth) { - this.dragDropAddTargetToEmptyPanelCore(dest, dragDropInfo.target, dragDropInfo.isBottom); - return true; - } - } - return false; - }; - PanelModelBase.prototype.dragDropAddTargetToExistingRow = function (dragDropInfo, destRow, prevRow) { - var index = destRow.elements.indexOf(dragDropInfo.destination); - if (index == 0 && - !dragDropInfo.isBottom) { - if (this.isDesignMode && _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].supportCreatorV2) ; - else if (destRow.elements[0].startWithNewLine) { - if (destRow.index > 0) { - dragDropInfo.isBottom = true; - destRow = destRow.panel.rows[destRow.index - 1]; - dragDropInfo.destination = - destRow.elements[destRow.elements.length - 1]; - return this.dragDropAddTargetToExistingRow(dragDropInfo, destRow, prevRow); - } - else { - return this.dragDropAddTargetToNewRow(dragDropInfo, destRow, prevRow); - } - } - } - var prevRowIndex = -1; - if (prevRow == destRow) { - prevRowIndex = destRow.elements.indexOf(dragDropInfo.target); - } - if (dragDropInfo.isBottom) - index++; - var srcRow = this.findRowByElement(dragDropInfo.source); - if (srcRow == destRow && - srcRow.elements.indexOf(dragDropInfo.source) == index) - return false; - if (index == prevRowIndex) - return false; - if (prevRowIndex > -1) { - destRow.elements.splice(prevRowIndex, 1); - if (prevRowIndex < index) - index--; - } - destRow.elements.splice(index, 0, dragDropInfo.target); - destRow.updateVisible(); - return prevRowIndex < 0; - }; - PanelModelBase.prototype.dragDropAddTargetToNewRow = function (dragDropInfo, destRow, prevRow) { - var targetRow = destRow.panel.createRowAndSetLazy(destRow.panel.rows.length); - if (this.isDesignMode && _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].supportCreatorV2) { - targetRow.setIsLazyRendering(false); - } - targetRow.addElement(dragDropInfo.target); - var index = destRow.index; - if (dragDropInfo.isBottom) { - index++; - } - //same row - if (!!prevRow && prevRow.panel == targetRow.panel && prevRow.index == index) - return false; - var srcRow = this.findRowByElement(dragDropInfo.source); - if (!!srcRow && - srcRow.panel == targetRow.panel && - srcRow.elements.length == 1 && - srcRow.index == index) - return false; - destRow.panel.rows.splice(index, 0, targetRow); - return true; - }; - PanelModelBase.prototype.dragDropAddTargetToEmptyPanelCore = function (panel, target, isBottom) { - var targetRow = panel.createRow(); - targetRow.addElement(target); - if (panel.elements.length == 0 || isBottom) { - panel.rows.push(targetRow); - } - else { - panel.rows.splice(0, 0, targetRow); - } - }; - PanelModelBase.prototype.dragDropMoveElement = function (src, target, targetIndex) { - var srcIndex = src.parent.elements.indexOf(src); - if (targetIndex > srcIndex) { - targetIndex--; - } - this.removeElement(src); - this.addElement(target, targetIndex); - }; - PanelModelBase.prototype.needResponsiveWidth = function () { - var result = false; - this.elements.forEach(function (e) { - if (e.needResponsiveWidth()) - result = true; - }); - this.rows.forEach(function (r) { - if (r.elements.length > 1) - result = true; - }); - return result; - }; - Object.defineProperty(PanelModelBase.prototype, "no", { - //ITitleOwner - get: function () { return ""; }, - enumerable: false, - configurable: true - }); - PanelModelBase.prototype.dispose = function () { - _super.prototype.dispose.call(this); - if (this.rows) { - for (var i = 0; i < this.rows.length; i++) { - this.rows[i].dispose(); - } - this.rows.splice(0, this.rows.length); - } - for (var i = 0; i < this.elements.length; i++) { - this.elements[i].dispose(); - } - this.elements.splice(0, this.elements.length); - }; - PanelModelBase.panelCounter = 100; - return PanelModelBase; - }(_survey_element__WEBPACK_IMPORTED_MODULE_3__["SurveyElement"])); - - /** - * A container element, similar to the Page objects. However, unlike the Page, Panel can't be a root. - * It may contain questions and other panels. - */ - var PanelModel = /** @class */ (function (_super) { - __extends(PanelModel, _super); - function PanelModel(name) { - if (name === void 0) { name = ""; } - var _this = _super.call(this, name) || this; - _this.focusIn = function () { - _this.survey.whenPanelFocusIn(_this); - }; - var self = _this; - _this.createNewArray("footerActions"); - _this.registerFunctionOnPropertyValueChanged("width", function () { - if (!!self.parent) { - self.parent.elementWidthChanged(self); - } - }); - _this.registerFunctionOnPropertiesValueChanged(["indent", "innerIndent", "rightIndent"], function () { - self.onIndentChanged(); - }); - return _this; - } - PanelModel.prototype.getType = function () { - return "panel"; - }; - Object.defineProperty(PanelModel.prototype, "contentId", { - get: function () { - return this.id + "_content"; - }, - enumerable: false, - configurable: true - }); - PanelModel.prototype.getSurvey = function (live) { - if (live === void 0) { live = false; } - if (live) { - return !!this.parent ? this.parent.getSurvey(live) : null; - } - return _super.prototype.getSurvey.call(this, live); - }; - PanelModel.prototype.onSurveyLoad = function () { - _super.prototype.onSurveyLoad.call(this); - this.onIndentChanged(); - }; - PanelModel.prototype.onSetData = function () { - _super.prototype.onSetData.call(this); - this.onIndentChanged(); - }; - Object.defineProperty(PanelModel.prototype, "isPanel", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "page", { - /** - * Get/set the page where the panel is located. - */ - get: function () { - return this.getPage(this.parent); - }, - set: function (val) { - this.setPage(this.parent, val); - }, - enumerable: false, - configurable: true - }); - PanelModel.prototype.delete = function () { - if (!!this.parent) { - this.removeSelfFromList(this.parent.elements); - } - }; - /** - * Move panel to a new container Page/Panel. Add as a last element if insertBefore parameter is not used or inserted into the given index, - * if insert parameter is number, or before the given element, if the insertBefore parameter is a question or panel - * @param container Page or Panel to where a question is relocated. - * @param insertBefore Use it if you want to set the panel to a specific position. You may use a number (use 0 to insert int the beginning) or element, if you want to insert before this element. - */ - PanelModel.prototype.moveTo = function (container, insertBefore) { - if (insertBefore === void 0) { insertBefore = null; } - return this.moveToBase(this.parent, container, insertBefore); - }; - Object.defineProperty(PanelModel.prototype, "visibleIndex", { - /** - * Returns the visible index of the panel in the survey. Commonly it is -1 and it doesn't show. - * You have to set showNumber to true to show index/numbering for the Panel - * @see showNumber - */ - get: function () { - return this.getPropertyValue("visibleIndex", -1); - }, - enumerable: false, - configurable: true - }); - PanelModel.prototype.getTitleOwner = function () { return this; }; - Object.defineProperty(PanelModel.prototype, "showNumber", { - /** - * Set showNumber to true to start showing the number for this panel. - * @see visibleIndex - */ - get: function () { - return this.getPropertyValue("showNumber", false); - }, - set: function (val) { - this.setPropertyValue("showNumber", val); - this.notifySurveyOnVisibilityChanged(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "showQuestionNumbers", { - /** - * Gets or sets a value that specifies how the elements numbers inside panel are displayed. - * - * The following options are available: - * - * - `default` - display questions numbers as defined in parent panel or survey - * - `onpanel` - display questions numbers, start numbering from beginning of this page - * - `off` - turn off the numbering for questions titles - * @see showNumber - */ - get: function () { - return this.getPropertyValue("showQuestionNumbers"); - }, - set: function (value) { - this.setPropertyValue("showQuestionNumbers", value); - this.notifySurveyOnVisibilityChanged(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "questionStartIndex", { - /** - * Gets or sets the first question index for elements inside the panel. The first question index is '1.' by default and it is taken from survey.questionStartIndex property. - * You may start it from '100' or from 'A', by setting '100' or 'A' to this property. - * You can set the start index to "(1)" or "# A)" or "a)" to render question number as (1), # A) and a) accordingly. - * @see survey.questionStartIndex - */ - get: function () { - return this.getPropertyValue("questionStartIndex", ""); - }, - set: function (val) { - this.setPropertyValue("questionStartIndex", val); - }, - enumerable: false, - configurable: true - }); - PanelModel.prototype.getQuestionStartIndex = function () { - if (!!this.questionStartIndex) - return this.questionStartIndex; - return _super.prototype.getQuestionStartIndex.call(this); - }; - Object.defineProperty(PanelModel.prototype, "no", { - /** - * The property returns the question number. If question is invisible then it returns empty string. - * If visibleIndex is 1, then no is 2, or 'B' if survey.questionStartIndex is 'A'. - * @see SurveyModel.questionStartIndex - */ - get: function () { - return this.getPropertyValue("no", ""); - }, - enumerable: false, - configurable: true - }); - PanelModel.prototype.setNo = function (visibleIndex) { - this.setPropertyValue("no", _helpers__WEBPACK_IMPORTED_MODULE_1__["Helpers"].getNumberByIndex(this.visibleIndex, this.getStartIndex())); - }; - PanelModel.prototype.beforeSetVisibleIndex = function (index) { - var visibleIndex = -1; - if (this.showNumber && (this.isDesignMode || !this.locTitle.isEmpty)) { - visibleIndex = index; - } - this.setPropertyValue("visibleIndex", visibleIndex); - this.setNo(visibleIndex); - return visibleIndex < 0 ? 0 : 1; - }; - PanelModel.prototype.getPanelStartIndex = function (index) { - if (this.showQuestionNumbers == "off") - return -1; - if (this.showQuestionNumbers == "onpanel") - return 0; - return index; - }; - PanelModel.prototype.isContinueNumbering = function () { - return (this.showQuestionNumbers != "off" && this.showQuestionNumbers != "onpanel"); - }; - PanelModel.prototype.notifySurveyOnVisibilityChanged = function () { - if (this.survey != null && !this.isLoadingFromJson) { - this.survey.panelVisibilityChanged(this, this.isVisible); - } - }; - PanelModel.prototype.hasErrorsCore = function (rec) { - _super.prototype.hasErrorsCore.call(this, rec); - if (this.isCollapsed && rec.result && rec.fireCallback) { - this.expand(); - } - }; - PanelModel.prototype.getRenderedTitle = function (str) { - if (!str) { - if (this.isCollapsed || this.isExpanded) - return this.name; - if (this.isDesignMode) - return "[" + this.name + "]"; - } - return _super.prototype.getRenderedTitle.call(this, str); - }; - Object.defineProperty(PanelModel.prototype, "width", { - /** - * The Panel width. - */ - get: function () { - return this.getPropertyValue("width"); - }, - set: function (val) { - this.setPropertyValue("width", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "minWidth", { - /** - * Use it to set the specific minWidth constraint to the panel like css style (%, px, em etc). - */ - get: function () { - return this.getPropertyValue("minWidth"); - }, - set: function (val) { - this.setPropertyValue("minWidth", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "maxWidth", { - /** - * Use it to set the specific maxWidth constraint to the panel like css style (%, px, em etc). - */ - get: function () { - return this.getPropertyValue("maxWidth"); - }, - set: function (val) { - this.setPropertyValue("maxWidth", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "indent", { - /** - * The left indent. Set this property to increase the panel left indent. - */ - get: function () { - return this.getPropertyValue("indent"); - }, - set: function (val) { - this.setPropertyValue("indent", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "innerIndent", { - /** - * The inner indent. Set this property to increase the panel content margin. - */ - get: function () { - return this.getPropertyValue("innerIndent"); - }, - set: function (val) { - this.setPropertyValue("innerIndent", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "renderWidth", { - get: function () { - return this.getPropertyValue("renderWidth"); - }, - set: function (val) { - this.setPropertyValue("renderWidth", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "startWithNewLine", { - /** - * The Panel renders on the new line if the property is true. If the property is false, the panel tries to render on the same line/row with a previous question/panel. - */ - get: function () { - return this.getPropertyValue("startWithNewLine"); - }, - set: function (value) { - this.setPropertyValue("startWithNewLine", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "rightIndent", { - /** - * The right indent of the Panel. - */ - get: function () { - return this.getPropertyValue("rightIndent", 0); - }, - set: function (val) { - this.setPropertyValue("rightIndent", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "allowAdaptiveActions", { - /** - * The Panel toolbar gets adaptive if the property is set to true. - */ - get: function () { - return this.getPropertyValue("allowAdaptiveActions"); - }, - set: function (val) { - this.setPropertyValue("allowAdaptiveActions", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "paddingLeft", { - get: function () { - return this.getPropertyValue("paddingLeft", ""); - }, - set: function (val) { - this.setPropertyValue("paddingLeft", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "innerPaddingLeft", { - get: function () { - return this.getPropertyValue("innerPaddingLeft", ""); - }, - set: function (val) { - this.setPropertyValue("innerPaddingLeft", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "paddingRight", { - get: function () { - return this.getPropertyValue("paddingRight", ""); - }, - set: function (val) { - this.setPropertyValue("paddingRight", val); - }, - enumerable: false, - configurable: true - }); - PanelModel.prototype.onIndentChanged = function () { - if (!this.getSurvey()) - return; - this.innerPaddingLeft = this.getIndentSize(this.innerIndent); - this.paddingLeft = this.getIndentSize(this.indent); - this.paddingRight = this.getIndentSize(this.rightIndent); - }; - PanelModel.prototype.getIndentSize = function (indent) { - if (indent < 1) - return ""; - var css = this.survey["css"]; - if (!css) - return ""; - return indent * css.question.indent + "px"; - }; - PanelModel.prototype.clearOnDeletingContainer = function () { - this.elements.forEach(function (element) { - if (element instanceof _question__WEBPACK_IMPORTED_MODULE_4__["Question"] || element instanceof PanelModel) { - element.clearOnDeletingContainer(); - } - }); - }; - Object.defineProperty(PanelModel.prototype, "footerActions", { - get: function () { - return this.getPropertyValue("footerActions"); - }, - enumerable: false, - configurable: true - }); - PanelModel.prototype.getFooterToolbar = function () { - var _this = this; - if (!this.footerToolbarValue) { - var actions = this.footerActions; - if (this.hasEditButton) { - actions.push({ - id: "cancel-preview", - title: this.survey.editText, - innerCss: this.survey.cssNavigationEdit, - action: function () { _this.cancelPreview(); } - }); - } - this.footerToolbarValue = this.allowAdaptiveActions ? new _actions_adaptive_container__WEBPACK_IMPORTED_MODULE_11__["AdaptiveActionContainer"]() : new _actions_container__WEBPACK_IMPORTED_MODULE_12__["ActionContainer"](); - if (!!this.cssClasses.panel) { - this.footerToolbarValue.containerCss = this.cssClasses.panel.footer; - } - this.footerToolbarValue.setItems(actions); - } - return this.footerToolbarValue; - }; - Object.defineProperty(PanelModel.prototype, "hasEditButton", { - get: function () { - if (this.survey && this.survey.state === "preview") - return this.depth === 1; - return false; - }, - enumerable: false, - configurable: true - }); - PanelModel.prototype.cancelPreview = function () { - if (!this.hasEditButton) - return; - this.survey.cancelPreviewByPage(this); - }; - Object.defineProperty(PanelModel.prototype, "cssTitle", { - get: function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() - .append(this.cssClasses.panel.title) - .append(this.cssClasses.panel.titleExpandable, this.state !== "default") - .append(this.cssClasses.panel.titleOnError, this.containsErrors) - .toString(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PanelModel.prototype, "cssError", { - get: function () { - return this.getCssError(this.cssClasses); - }, - enumerable: false, - configurable: true - }); - PanelModel.prototype.getCssError = function (cssClasses) { - var builder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]().append(this.cssClasses.error.root); - return builder.append("panel-error-root", builder.isEmpty()).toString(); - }; - PanelModel.prototype.onVisibleChanged = function () { - _super.prototype.onVisibleChanged.call(this); - this.notifySurveyOnVisibilityChanged(); - }; - PanelModel.prototype.needResponsiveWidth = function () { - if (this.startWithNewLine) { - return true; - } - else - _super.prototype.needResponsiveWidth.call(this); - return false; - }; - return PanelModel; - }(PanelModelBase)); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("panelbase", [ - "name", - { - name: "elements", - alternativeName: "questions", - baseClassName: "question", - visible: false, - isLightSerializable: false, - }, - { name: "visible:switch", default: true }, - "visibleIf:condition", - "enableIf:condition", - "requiredIf:condition", - "readOnly:boolean", - { - name: "questionTitleLocation", - default: "default", - choices: ["default", "top", "bottom", "left", "hidden"], - }, - { name: "title:text", serializationProperty: "locTitle" }, - { name: "description:text", serializationProperty: "locDescription" }, - { - name: "questionsOrder", - default: "default", - choices: ["default", "initial", "random"], - }, - ], function () { - return new PanelModelBase(); - }); - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("panel", [ - { - name: "state", - default: "default", - choices: ["default", "collapsed", "expanded"], - }, - "isRequired:switch", - { - name: "requiredErrorText:text", - serializationProperty: "locRequiredErrorText", - }, - { name: "startWithNewLine:boolean", default: true }, - "width", - { name: "minWidth", default: _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].minWidth }, - { name: "maxWidth", default: _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].maxWidth }, - { name: "innerIndent:number", default: 0, choices: [0, 1, 2, 3] }, - { name: "indent:number", default: 0, choices: [0, 1, 2, 3] }, - { - name: "page", - isSerializable: false, - visibleIf: function (obj) { - var survey = obj ? obj.survey : null; - return !survey || survey.pages.length > 1; - }, - choices: function (obj) { - var survey = obj ? obj.survey : null; - return survey - ? survey.pages.map(function (p) { - return { value: p.name, text: p.title }; - }) - : []; - }, - }, - "showNumber:boolean", - { - name: "showQuestionNumbers", - default: "default", - choices: ["default", "onpanel", "off"], - }, - "questionStartIndex", - { name: "allowAdaptiveActions:boolean", default: true, visible: false }, - ], function () { - return new PanelModel(); - }, "panelbase"); - _questionfactory__WEBPACK_IMPORTED_MODULE_6__["ElementFactory"].Instance.registerElement("panel", function (name) { - return new PanelModel(name); - }); - - - /***/ }), - - /***/ "./src/popup.ts": - /*!**********************!*\ - !*** ./src/popup.ts ***! - \**********************/ - /*! exports provided: PopupModel, createPopupModalViewModel, PopupBaseViewModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PopupModel", function() { return PopupModel; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPopupModalViewModel", function() { return createPopupModalViewModel; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PopupBaseViewModel", function() { return PopupBaseViewModel; }); - /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _utils_popup__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/popup */ "./src/utils/popup.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - - - - - var PopupModel = /** @class */ (function (_super) { - __extends(PopupModel, _super); - function PopupModel(contentComponentName, contentComponentData, verticalPosition, horizontalPosition, showPointer, isModal, onCancel, onApply, onHide, onShow, cssClass, title) { - if (verticalPosition === void 0) { verticalPosition = "bottom"; } - if (horizontalPosition === void 0) { horizontalPosition = "left"; } - if (showPointer === void 0) { showPointer = true; } - if (isModal === void 0) { isModal = false; } - if (onCancel === void 0) { onCancel = function () { }; } - if (onApply === void 0) { onApply = function () { return true; }; } - if (onHide === void 0) { onHide = function () { }; } - if (onShow === void 0) { onShow = function () { }; } - if (cssClass === void 0) { cssClass = ""; } - if (title === void 0) { title = ""; } - var _this = _super.call(this) || this; - _this.contentComponentName = contentComponentName; - _this.contentComponentData = contentComponentData; - _this.verticalPosition = verticalPosition; - _this.horizontalPosition = horizontalPosition; - _this.showPointer = showPointer; - _this.isModal = isModal; - _this.onCancel = onCancel; - _this.onApply = onApply; - _this.onHide = onHide; - _this.onShow = onShow; - _this.cssClass = cssClass; - _this.title = title; - return _this; - } - Object.defineProperty(PopupModel.prototype, "isVisible", { - get: function () { - return this.getPropertyValue("isVisible", false); - }, - set: function (value) { - if (this.isVisible === value) { - return; - } - this.setPropertyValue("isVisible", value); - this.onVisibilityChanged && this.onVisibilityChanged(value); - if (this.isVisible) { - var innerModel = this.contentComponentData["model"]; - innerModel && innerModel.refresh && innerModel.refresh(); - this.onShow(); - } - else { - this.onHide(); - } - }, - enumerable: false, - configurable: true - }); - PopupModel.prototype.toggleVisibility = function () { - this.isVisible = !this.isVisible; - }; - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() - ], PopupModel.prototype, "contentComponentName", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() - ], PopupModel.prototype, "contentComponentData", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "bottom" }) - ], PopupModel.prototype, "verticalPosition", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "left" }) - ], PopupModel.prototype, "horizontalPosition", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false }) - ], PopupModel.prototype, "showPointer", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false }) - ], PopupModel.prototype, "isModal", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: function () { } }) - ], PopupModel.prototype, "onCancel", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: function () { return true; } }) - ], PopupModel.prototype, "onApply", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: function () { } }) - ], PopupModel.prototype, "onHide", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: function () { } }) - ], PopupModel.prototype, "onShow", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "" }) - ], PopupModel.prototype, "cssClass", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "" }) - ], PopupModel.prototype, "title", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "popup" }) - ], PopupModel.prototype, "displayMode", void 0); - return PopupModel; - }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); - - function createPopupModalViewModel(componentName, data, onApply, onCancel, onHide, onShow, cssClass, title, displayMode) { - if (onHide === void 0) { onHide = function () { }; } - if (onShow === void 0) { onShow = function () { }; } - if (displayMode === void 0) { displayMode = "popup"; } - var popupModel = new PopupModel(componentName, data, "top", "left", false, true, onCancel, onApply, onHide, onShow, cssClass, title); - popupModel.displayMode = displayMode; - var popupViewModel = new PopupBaseViewModel(popupModel, undefined); - popupViewModel.initializePopupContainer(); - return popupViewModel; - } - var FOCUS_INPUT_SELECTOR = "input:not(:disabled):not([readonly]):not([type=hidden]),select:not(:disabled):not([readonly]),textarea:not(:disabled):not([readonly]), button:not(:disabled):not([readonly]), [tabindex]:not([tabindex^=\"-\"])"; - var PopupBaseViewModel = /** @class */ (function (_super) { - __extends(PopupBaseViewModel, _super); - function PopupBaseViewModel(model, targetElement) { - var _this = _super.call(this) || this; - _this.targetElement = targetElement; - _this.scrollEventCallBack = function () { return _this.hidePopup(); }; - _this.model = model; - return _this; - } - PopupBaseViewModel.prototype.hidePopup = function () { - this.model.isVisible = false; - }; - Object.defineProperty(PopupBaseViewModel.prototype, "model", { - get: function () { - return this._model; - }, - set: function (model) { - var _this = this; - if (!!this.model) { - this.model.unRegisterFunctionOnPropertiesValueChanged(["isVisible"], "PopupBaseViewModel"); - } - this._model = model; - var updater = function () { - if (!model.isVisible) { - _this.updateOnHiding(); - } - _this.isVisible = model.isVisible; - }; - model.registerFunctionOnPropertyValueChanged("isVisible", updater, "PopupBaseViewModel"); - updater(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PopupBaseViewModel.prototype, "title", { - get: function () { - return this.model.title; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PopupBaseViewModel.prototype, "contentComponentName", { - get: function () { - return this.model.contentComponentName; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PopupBaseViewModel.prototype, "contentComponentData", { - get: function () { - return this.model.contentComponentData; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PopupBaseViewModel.prototype, "showPointer", { - get: function () { - return this.model.showPointer; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PopupBaseViewModel.prototype, "isModal", { - get: function () { - return this.model.isModal; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PopupBaseViewModel.prototype, "showFooter", { - get: function () { - return this.isModal || this.isOverlay; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PopupBaseViewModel.prototype, "isOverlay", { - get: function () { - return this.model.displayMode === "overlay"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PopupBaseViewModel.prototype, "styleClass", { - get: function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__["CssClassBuilder"]() - .append(this.model.cssClass) - .append("sv-popup--modal", this.isModal && !this.isOverlay) - .append("sv-popup--show-pointer", !this.isModal && !this.isOverlay && this.showPointer) - .append("sv-popup--".concat(this.popupDirection), !this.isModal && !this.isOverlay && this.showPointer) - .append("sv-popup--".concat(this.model.displayMode), this.isOverlay) - .toString(); - }, - enumerable: false, - configurable: true - }); - PopupBaseViewModel.prototype.onKeyDown = function (event) { - if (event.key === "Tab" || event.keyCode === 9) { - this.trapFocus(event); - } - else if (event.key === "Escape" || event.keyCode === 27) { - if (this.isModal) { - this.model.onCancel(); - } - this.hidePopup(); - } - }; - PopupBaseViewModel.prototype.trapFocus = function (event) { - var focusableElements = this.container.querySelectorAll(FOCUS_INPUT_SELECTOR); - var firstFocusableElement = focusableElements[0]; - var lastFocusableElement = focusableElements[focusableElements.length - 1]; - if (event.shiftKey) { - if (document.activeElement === firstFocusableElement) { - lastFocusableElement.focus(); - event.preventDefault(); - } - } - else { - if (document.activeElement === lastFocusableElement) { - firstFocusableElement.focus(); - event.preventDefault(); - } - } - }; - PopupBaseViewModel.prototype.updateOnShowing = function () { - this.prevActiveElement = document.activeElement; - if (!this.isModal || this.isOverlay) { - this.updatePosition(); - } - this.focusFirstInput(); - if (!this.isModal) { - window.addEventListener("scroll", this.scrollEventCallBack); - } - }; - PopupBaseViewModel.prototype.updateOnHiding = function () { - this.prevActiveElement && this.prevActiveElement.focus(); - if (!this.isModal) { - window.removeEventListener("scroll", this.scrollEventCallBack); - } - }; - PopupBaseViewModel.prototype.updatePosition = function () { - if (this.model.displayMode !== "overlay") { - var rect = this.targetElement.getBoundingClientRect(); - var background = this.container.children[0]; - var popupContainer = background.children[0]; - var scrollContent = background.children[0].querySelector(".sv-popup__scrolling-content"); - var height = popupContainer.offsetHeight - - scrollContent.offsetHeight + - scrollContent.scrollHeight; - var width = popupContainer.offsetWidth; - this.height = "auto"; - var verticalPosition = this.model.verticalPosition; - if (!!window) { - height = Math.min(height, window.innerHeight * 0.9); - verticalPosition = _utils_popup__WEBPACK_IMPORTED_MODULE_3__["PopupUtils"].updateVerticalPosition(rect, height, this.model.verticalPosition, this.model.showPointer, window.innerHeight); - } - this.popupDirection = _utils_popup__WEBPACK_IMPORTED_MODULE_3__["PopupUtils"].calculatePopupDirection(verticalPosition, this.model.horizontalPosition); - var pos = _utils_popup__WEBPACK_IMPORTED_MODULE_3__["PopupUtils"].calculatePosition(rect, height, width, verticalPosition, this.model.horizontalPosition, this.showPointer); - if (!!window) { - var newVerticalDimensions = _utils_popup__WEBPACK_IMPORTED_MODULE_3__["PopupUtils"].updateVerticalDimensions(pos.top, height, window.innerHeight); - if (!!newVerticalDimensions) { - this.height = newVerticalDimensions.height + "px"; - pos.top = newVerticalDimensions.top; - } - } - this.left = pos.left + "px"; - this.top = pos.top + "px"; - if (this.showPointer) { - this.pointerTarget = _utils_popup__WEBPACK_IMPORTED_MODULE_3__["PopupUtils"].calculatePointerTarget(rect, pos.top, pos.left, verticalPosition, this.model.horizontalPosition); - } - this.pointerTarget.top += "px"; - this.pointerTarget.left += "px"; - } - else { - this.left = null; - this.top = null; - this.height = null; - } - }; - PopupBaseViewModel.prototype.focusFirstInput = function () { - var _this = this; - setTimeout(function () { - var el = _this.container.querySelector(FOCUS_INPUT_SELECTOR); - if (!!el) - el.focus(); - else - _this.container.children[0].focus(); - }, 100); - }; - PopupBaseViewModel.prototype.clickOutside = function () { - if (this.isModal) { - return; - } - this.hidePopup(); - }; - PopupBaseViewModel.prototype.cancel = function () { - this.model.onCancel(); - this.hidePopup(); - }; - PopupBaseViewModel.prototype.apply = function () { - if (!!this.model.onApply && !this.model.onApply()) - return; - this.hidePopup(); - }; - Object.defineProperty(PopupBaseViewModel.prototype, "cancelButtonText", { - get: function () { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("modalCancelButtonText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(PopupBaseViewModel.prototype, "applyButtonText", { - get: function () { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("modalApplyButtonText"); - }, - enumerable: false, - configurable: true - }); - PopupBaseViewModel.prototype.dispose = function () { - _super.prototype.dispose.call(this); - this.model.onVisibilityChanged = undefined; - }; - PopupBaseViewModel.prototype.createPopupContainer = function () { - var container = document.createElement("div"); - this.container = container; - }; - PopupBaseViewModel.prototype.mountPopupContainer = function () { - document.body.appendChild(this.container); - }; - PopupBaseViewModel.prototype.initializePopupContainer = function () { - this.createPopupContainer(); - this.mountPopupContainer(); - }; - PopupBaseViewModel.prototype.destroyPopupContainer = function () { - this.container.remove(); - this.container = undefined; - }; - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "0px" }) - ], PopupBaseViewModel.prototype, "top", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "0px" }) - ], PopupBaseViewModel.prototype, "left", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "auto" }) - ], PopupBaseViewModel.prototype, "height", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false }) - ], PopupBaseViewModel.prototype, "isVisible", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "left" }) - ], PopupBaseViewModel.prototype, "popupDirection", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: { left: "0px", top: "0px" } }) - ], PopupBaseViewModel.prototype, "pointerTarget", void 0); - return PopupBaseViewModel; - }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); - - - - /***/ }), - - /***/ "./src/question.ts": - /*!*************************!*\ - !*** ./src/question.ts ***! - \*************************/ - /*! exports provided: Question */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Question", function() { return Question; }); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./error */ "./src/error.ts"); - /* harmony import */ var _validator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./validator */ "./src/validator.ts"); - /* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts"); - /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); - /* harmony import */ var _questionCustomWidgets__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./questionCustomWidgets */ "./src/questionCustomWidgets.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - /* harmony import */ var _rendererFactory__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./rendererFactory */ "./src/rendererFactory.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - - - - - - - - - - - - - /** - * A base class for all questions. - */ - var Question = /** @class */ (function (_super) { - __extends(Question, _super); - function Question(name) { - var _this = _super.call(this, name) || this; - _this.conditionRunner = null; - _this.customWidgetData = { isNeedRender: true }; - _this.isReadyValue = true; - /** - * The event is fired when isReady property of question is changed. - *
options.question - the question - *
options.isReady - current value of isReady - *
options.oldIsReady - old value of isReady - */ - _this.onReadyChanged = _this.addEvent(); - _this.parentQuestionValue = null; - _this.focusIn = function () { - _this.survey.whenQuestionFocusIn(_this); - }; - _this.isRunningValidatorsValue = false; - _this.isValueChangedInSurvey = false; - _this.allowNotifyValueChanged = true; - _this.id = Question.getQuestionId(); - _this.onCreating(); - _this.createNewArray("validators", function (validator) { - validator.errorOwner = _this; - }); - var locCommentText = _this.createLocalizableString("commentText", _this, true); - locCommentText.onGetTextCallback = function (text) { - return !!text ? text : _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("otherItemText"); - }; - _this.locTitle.onGetDefaultTextCallback = function () { - return _this.name; - }; - _this.createLocalizableString("requiredErrorText", _this); - _this.registerFunctionOnPropertyValueChanged("width", function () { - _this.updateQuestionCss(); - if (!!_this.parent) { - _this.parent.elementWidthChanged(_this); - } - }); - _this.registerFunctionOnPropertyValueChanged("isRequired", function () { - _this.locTitle.onChanged(); - _this.cssClassesValue = undefined; - }); - _this.registerFunctionOnPropertiesValueChanged(["indent", "rightIndent"], function () { - _this.onIndentChanged(); - }); - _this.registerFunctionOnPropertiesValueChanged(["hasComment", "hasOther"], function () { - _this.initCommentFromSurvey(); - }); - return _this; - } - Question.getQuestionId = function () { - return "sq_" + Question.questionCounter++; - }; - Question.prototype.isReadOnlyRenderDiv = function () { - return this.isReadOnly && _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].readOnlyCommentRenderMode === "div"; - }; - Object.defineProperty(Question.prototype, "isErrorsModeTooltip", { - get: function () { - return this.survey && this.survey.getCss().root == "sd-root-modern"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "hasParent", { - get: function () { - return this.parent && !this.parent.isPage; - }, - enumerable: false, - configurable: true - }); - Question.prototype.createLocTitleProperty = function () { - var _this = this; - var locTitleValue = _super.prototype.createLocTitleProperty.call(this); - locTitleValue.onGetTextCallback = function (text) { - if (!text) { - text = _this.name; - } - if (!_this.survey) - return text; - return _this.survey.getUpdatedQuestionTitle(_this, text); - }; - this.locProcessedTitle = new _localizablestring__WEBPACK_IMPORTED_MODULE_6__["LocalizableString"](this, true); - this.locProcessedTitle.sharedData = locTitleValue; - return locTitleValue; - }; - Question.prototype.getSurvey = function (live) { - if (live === void 0) { live = false; } - if (live) { - return !!this.parent ? this.parent.getSurvey(live) : null; - } - if (!!this.onGetSurvey) - return this.onGetSurvey(); - return _super.prototype.getSurvey.call(this); - }; - Question.prototype.getValueName = function () { - if (!!this.valueName) - return this.valueName.toString(); - return this.name; - }; - Object.defineProperty(Question.prototype, "valueName", { - /** - * Use this property if you want to store the question result in the name different from the question name. - * Question name should be unique in the survey and valueName could be not unique. It allows to share data between several questions with the same valueName. - * The library set the value automatically if the question.name property is not valid. For example, if it contains the period '.' symbol. - * In this case if you set the question.name property to 'x.y' then the valueName becomes 'x y'. - * Please note, this property is hidden for questions without input, for example html question. - * @see name - */ - get: function () { - return this.getPropertyValue("valueName", ""); - }, - set: function (val) { - var oldValueName = this.getValueName(); - this.setPropertyValue("valueName", val); - this.onValueNameChanged(oldValueName); - }, - enumerable: false, - configurable: true - }); - Question.prototype.onValueNameChanged = function (oldValue) { - if (!this.survey) - return; - this.survey.questionRenamed(this, this.name, !!oldValue ? oldValue : this.name); - this.initDataFromSurvey(); - }; - Question.prototype.onNameChanged = function (oldValue) { - this.locTitle.onChanged(); - if (!this.survey) - return; - this.survey.questionRenamed(this, oldValue, this.valueName ? this.valueName : oldValue); - }; - Object.defineProperty(Question.prototype, "isReady", { - get: function () { - return this.isReadyValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "ariaRequired", { - /** - * A11Y properties - */ - get: function () { - return this.isRequired ? "true" : "false"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "ariaLabel", { - get: function () { - return this.locTitle.renderedHtml; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "ariaInvalid", { - get: function () { - return this.errors.length > 0 ? "true" : "false"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "ariaDescribedBy", { - get: function () { - return this.errors.length > 0 ? this.id + "_errors" : null; - }, - enumerable: false, - configurable: true - }); - /** - * Get is question ready to use - */ - Question.prototype.choicesLoaded = function () { }; - Object.defineProperty(Question.prototype, "page", { - /** - * Get/set the page where the question is located. - */ - get: function () { - return this.getPage(this.parent); - }, - set: function (val) { - this.setPage(this.parent, val); - }, - enumerable: false, - configurable: true - }); - Question.prototype.getPanel = function () { - return null; - }; - Question.prototype.delete = function () { - if (!!this.parent) { - this.removeSelfFromList(this.parent.elements); - } - }; - Object.defineProperty(Question.prototype, "isFlowLayout", { - get: function () { - return this.getLayoutType() === "flow"; - }, - enumerable: false, - configurable: true - }); - Question.prototype.getLayoutType = function () { - if (!!this.parent) - return this.parent.getChildrenLayoutType(); - return "row"; - }; - Question.prototype.isLayoutTypeSupported = function (layoutType) { - return layoutType !== "flow"; - }; - Object.defineProperty(Question.prototype, "visible", { - /** - * Use it to get/set the question visibility. - * @see visibleIf - */ - get: function () { - return this.getPropertyValue("visible", true); - }, - set: function (val) { - if (val == this.visible) - return; - this.setPropertyValue("visible", val); - this.onVisibleChanged(); - this.notifySurveyVisibilityChanged(); - }, - enumerable: false, - configurable: true - }); - Question.prototype.onVisibleChanged = function () { - this.setPropertyValue("isVisible", this.isVisible); - if (this.isVisible && this.survey && this.survey.isClearValueOnHidden) { - this.updateValueWithDefaults(); - } - if (!this.isVisible && this.errors && this.errors.length > 0) { - this.errors = []; - } - }; - Object.defineProperty(Question.prototype, "useDisplayValuesInTitle", { - /** - * Use it to choose how other question values will be rendered in title if referenced in {}. - * Please note, this property is hidden for question without input, for example html question. - */ - get: function () { - return this.getPropertyValue("useDisplayValuesInTitle"); - }, - set: function (val) { - this.setPropertyValue("useDisplayValuesInTitle", val); - }, - enumerable: false, - configurable: true - }); - Question.prototype.getUseDisplayValuesInTitle = function () { return this.useDisplayValuesInTitle; }; - Object.defineProperty(Question.prototype, "visibleIf", { - /** - * An expression that returns true or false. If it returns true the Question becomes visible and if it returns false the Question becomes invisible. The library runs the expression on survey start and on changing a question value. If the property is empty then visible property is used. - * @see visible - */ - get: function () { - return this.getPropertyValue("visibleIf", ""); - }, - set: function (val) { - this.setPropertyValue("visibleIf", val); - this.runConditions(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "isVisible", { - /** - * Returns true if the question is visible or survey is in design mode right now. - */ - get: function () { - if (this.survey && this.survey.areEmptyElementsHidden && this.isEmpty()) - return false; - return this.visible || this.areInvisibleElementsShowing; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "visibleIndex", { - /** - * Returns the visible index of the question in the survey. It can be from 0 to all visible questions count - 1 - * The visibleIndex is -1 if the title is 'hidden' or hideNumber is true - * @see titleLocation - * @see hideNumber - */ - get: function () { - return this.getPropertyValue("visibleIndex", -1); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "hideNumber", { - /** - * Set hideNumber to true to stop showing the number for this question. The question will not be counter - * @see visibleIndex - * @see titleLocation - */ - get: function () { - return this.getPropertyValue("hideNumber"); - }, - set: function (val) { - this.setPropertyValue("hideNumber", val); - this.notifySurveyVisibilityChanged(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "isAllowTitleLeft", { - /** - * Returns true if the question may have a title located on the left - */ - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - /** - * Returns the type of the object as a string as it represents in the json. - */ - Question.prototype.getType = function () { - return "question"; - }; - Object.defineProperty(Question.prototype, "isQuestion", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - /** - * Move question to a new container Page/Panel. Add as a last element if insertBefore parameter is not used or inserted into the given index, - * if insert parameter is number, or before the given element, if the insertBefore parameter is a question or panel - * @param container Page or Panel to where a question is relocated. - * @param insertBefore Use it if you want to set the question to a specific position. You may use a number (use 0 to insert int the beginning) or element, if you want to insert before this element. - */ - Question.prototype.moveTo = function (container, insertBefore) { - if (insertBefore === void 0) { insertBefore = null; } - return this.moveToBase(this.parent, container, insertBefore); - }; - Question.prototype.getProgressInfo = function () { - if (!this.hasInput) - return _super.prototype.getProgressInfo.call(this); - return { - questionCount: 1, - answeredQuestionCount: !this.isEmpty() ? 1 : 0, - requiredQuestionCount: this.isRequired ? 1 : 0, - requiredAnsweredQuestionCount: !this.isEmpty() && this.isRequired ? 1 : 0, - }; - }; - Question.prototype.runConditions = function () { - if (this.data && !this.isLoadingFromJson) { - if (!this.isDesignMode) { - this.runCondition(this.getDataFilteredValues(), this.getDataFilteredProperties()); - } - this.locStrsChanged(); - } - }; - Question.prototype.setSurveyImpl = function (value, isLight) { - _super.prototype.setSurveyImpl.call(this, value); - if (!this.survey) - return; - this.survey.questionCreated(this); - if (isLight !== true) { - this.runConditions(); - } - }; - Question.prototype.getDataFilteredValues = function () { - return !!this.data ? this.data.getFilteredValues() : null; - }; - Question.prototype.getDataFilteredProperties = function () { - var props = !!this.data ? this.data.getFilteredProperties() : {}; - props.question = this; - return props; - }; - Object.defineProperty(Question.prototype, "parent", { - /** - * A parent element. It can be panel or page. - */ - get: function () { - return this.getPropertyValue("parent", null); - }, - set: function (val) { - if (this.parent === val) - return; - this.delete(); - this.setPropertyValue("parent", val); - this.updateQuestionCss(); - this.onParentChanged(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "parentQuestion", { - /** - * A parent question. It can be a dynamic panel or dynamic/dropdown matrices. If the value is a matrix, it means that question is a cell question. - * This property is null for a stand alone question. - */ - get: function () { - return this.parentQuestionValue; - }, - enumerable: false, - configurable: true - }); - Question.prototype.setParentQuestion = function (val) { - this.parentQuestionValue = val; - this.onParentQuestionChanged(); - }; - Question.prototype.onParentQuestionChanged = function () { }; - Question.prototype.onParentChanged = function () { }; - Object.defineProperty(Question.prototype, "hasTitle", { - /** - * Returns false if the question doesn't have a title property, for example: QuestionHtmlModel, or titleLocation property equals to "hidden" - * @see titleLocation - */ - get: function () { - return this.getTitleLocation() !== "hidden"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "titleLocation", { - /** - * Set this property different from "default" to set the specific question title location for this panel/page. - * Please note, this property is hidden for questions without input, for example html question. - * @see SurveyModel.questionTitleLocation - */ - get: function () { - return this.getPropertyValue("titleLocation"); - }, - set: function (value) { - var isVisibilityChanged = this.titleLocation == "hidden" || value == "hidden"; - this.setPropertyValue("titleLocation", value.toLowerCase()); - this.updateQuestionCss(); - if (isVisibilityChanged) { - this.notifySurveyVisibilityChanged(); - } - }, - enumerable: false, - configurable: true - }); - Question.prototype.getTitleOwner = function () { return this; }; - Question.prototype.notifySurveyVisibilityChanged = function () { - if (!this.survey || this.isLoadingFromJson) - return; - this.survey.questionVisibilityChanged(this, this.isVisible); - if (this.survey.isClearValueOnHidden && !this.visible) { - this.clearValue(); - } - }; - /** - * Return the title location based on question titleLocation property and QuestionTitleLocation of it's parents - * @see titleLocation - * @see PanelModelBase.QuestionTitleLocation - * @see SurveyModel.QuestionTitleLocation - */ - Question.prototype.getTitleLocation = function () { - if (this.isFlowLayout) - return "hidden"; - var location = this.getTitleLocationCore(); - if (location === "left" && !this.isAllowTitleLeft) - location = "top"; - return location; - }; - Question.prototype.getTitleLocationCore = function () { - if (this.titleLocation !== "default") - return this.titleLocation; - if (!!this.parent) - return this.parent.getQuestionTitleLocation(); - if (!!this.survey) - return this.survey.questionTitleLocation; - return "top"; - }; - Object.defineProperty(Question.prototype, "hasTitleOnLeft", { - get: function () { - return this.hasTitle && this.getTitleLocation() === "left"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "hasTitleOnTop", { - get: function () { - return this.hasTitle && this.getTitleLocation() === "top"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "hasTitleOnBottom", { - get: function () { - return this.hasTitle && this.getTitleLocation() === "bottom"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "hasTitleOnLeftTop", { - get: function () { - if (!this.hasTitle) - return false; - var location = this.getTitleLocation(); - return location === "left" || location === "top"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "errorLocation", { - get: function () { - return this.survey ? this.survey.questionErrorLocation : "top"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "hasInput", { - /** - * Returns false if the question doesn't have an input element, for example: QuestionHtmlModel - * @see hasSingleInput - */ - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "hasSingleInput", { - /** - * Returns false if the question doesn't have an input element or have multiple inputs: matrices or panel dynamic - * @see hasInput - */ - get: function () { - return this.hasInput; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "inputId", { - get: function () { - return this.id + "i"; - }, - enumerable: false, - configurable: true - }); - Question.prototype.getDefaultTitleValue = function () { return this.name; }; - Question.prototype.getDefaultTitleTagName = function () { - return _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].titleTags.question; - }; - Object.defineProperty(Question.prototype, "descriptionLocation", { - /** - * Question description location. By default, value is "default" and it depends on survey questionDescriptionLocation property - * You may change it to "underInput" to render it under question input or "underTitle" to rendered it under title. - * @see description - * @see Survey.questionDescriptionLocation - */ - get: function () { - return this.getPropertyValue("descriptionLocation"); - }, - set: function (val) { - this.setPropertyValue("descriptionLocation", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "hasDescriptionUnderTitle", { - get: function () { - return this.getDescriptionLocation() == "underTitle"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "hasDescriptionUnderInput", { - get: function () { - return this.getDescriptionLocation() == "underInput"; - }, - enumerable: false, - configurable: true - }); - Question.prototype.getDescriptionLocation = function () { - if (this.descriptionLocation !== "default") - return this.descriptionLocation; - return !!this.survey - ? this.survey.questionDescriptionLocation - : "underTitle"; - }; - Object.defineProperty(Question.prototype, "clickTitleFunction", { - get: function () { - if (this.hasInput) { - var self = this; - return function () { - if (self.isCollapsed) - return; - setTimeout(function () { - self.focus(); - }, 1); - return true; - }; - } - return undefined; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "requiredErrorText", { - /** - * The custom text that will be shown on required error. Use this property, if you do not want to show the default text. - * Please note, this property is hidden for question without input, for example html question. - */ - get: function () { - return this.getLocalizableStringText("requiredErrorText"); - }, - set: function (val) { - this.setLocalizableStringText("requiredErrorText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "locRequiredErrorText", { - get: function () { - return this.getLocalizableString("requiredErrorText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "commentText", { - /** - * Use it to get or set the comment value. - */ - get: function () { - return this.getLocalizableStringText("commentText", _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("otherItemText")); - }, - set: function (val) { - this.setLocalizableStringText("commentText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "locCommentText", { - get: function () { - return this.getLocalizableString("commentText"); - }, - enumerable: false, - configurable: true - }); - /** - * Returns a copy of question errors survey. For some questions like matrix and panel dynamic it includes the errors of nested questions. - */ - Question.prototype.getAllErrors = function () { - return this.errors.slice(); - }; - Question.prototype.getErrorByType = function (errorType) { - for (var i = 0; i < this.errors.length; i++) { - if (this.errors[i].getErrorType() === errorType) - return this.errors[i]; - } - return null; - }; - Object.defineProperty(Question.prototype, "customWidget", { - /** - * The link to the custom widget. - */ - get: function () { - if (!this.isCustomWidgetRequested && !this.customWidgetValue) { - this.isCustomWidgetRequested = true; - this.updateCustomWidget(); - } - return this.customWidgetValue; - }, - enumerable: false, - configurable: true - }); - Question.prototype.updateCustomWidget = function () { - this.customWidgetValue = _questionCustomWidgets__WEBPACK_IMPORTED_MODULE_8__["CustomWidgetCollection"].Instance.getCustomWidget(this); - }; - Object.defineProperty(Question.prototype, "isCompositeQuestion", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Question.prototype.updateCommentElement = function () { - if (this.commentElement && this.autoGrowComment) - Object(_utils_utils__WEBPACK_IMPORTED_MODULE_12__["increaseHeightByContent"])(this.commentElement); - }; - Question.prototype.onCommentInput = function (event) { - if (this.isInputTextUpdate) - this.comment = event.target.value; - else - this.updateCommentElement(); - }; - Question.prototype.onCommentChange = function (event) { - this.comment = event.target.value; - if (this.comment !== event.target.value) { - event.target.value = this.comment; - } - }; - Question.prototype.afterRenderQuestionElement = function (el) { - if (!this.survey || !this.hasSingleInput) - return; - this.survey.afterRenderQuestionInput(this, el); - }; - Question.prototype.afterRender = function (el) { - if (!this.survey) - return; - this.survey.afterRenderQuestion(this, el); - if (!!this.afterRenderQuestionCallback) { - this.afterRenderQuestionCallback(this, el); - } - if (this.supportComment() || this.supportOther()) { - this.commentElement = (document.getElementById(this.id) && document.getElementById(this.id).querySelector("textarea")) || null; - this.updateCommentElement(); - } - }; - Question.prototype.beforeDestroyQuestionElement = function (el) { }; - Object.defineProperty(Question.prototype, "processedTitle", { - /** - * Returns the rendred question title. - */ - get: function () { - var res = this.locProcessedTitle.textOrHtml; - return res ? res : this.name; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "fullTitle", { - /** - * Returns the title after processing the question template. - * @see SurveyModel.questionTitleTemplate - */ - get: function () { - return this.locTitle.renderedHtml; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "titlePattern", { - get: function () { - return !!this.survey ? this.survey.questionTitlePattern : "numTitleRequire"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "isRequireTextOnStart", { - get: function () { - return this.isRequired && this.titlePattern == "requireNumTitle"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "isRequireTextBeforeTitle", { - get: function () { - return this.isRequired && this.titlePattern == "numRequireTitle"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "isRequireTextAfterTitle", { - get: function () { - return this.isRequired && this.titlePattern == "numTitleRequire"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "startWithNewLine", { - /** - * The Question renders on the new line if the property is true. If the property is false, the question tries to render on the same line/row with a previous question/panel. - */ - get: function () { - return this.getPropertyValue("startWithNewLine"); - }, - set: function (val) { - if (this.startWithNewLine == val) - return; - this.setPropertyValue("startWithNewLine", val); - }, - enumerable: false, - configurable: true - }); - Question.prototype.calcCssClasses = function (css) { - var classes = { error: {} }; - this.copyCssClasses(classes, css.question); - this.copyCssClasses(classes.error, css.error); - this.updateCssClasses(classes, css); - if (this.survey) { - this.survey.updateQuestionCssClasses(this, classes); - } - return classes; - }; - Object.defineProperty(Question.prototype, "cssRoot", { - get: function () { - this.ensureElementCss(); - return this.getPropertyValue("cssRoot", ""); - }, - enumerable: false, - configurable: true - }); - Question.prototype.setCssRoot = function (val) { - this.setPropertyValue("cssRoot", val); - }; - Question.prototype.getCssRoot = function (cssClasses) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]() - .append(this.isFlowLayout && !this.isDesignMode - ? cssClasses.flowRoot - : cssClasses.mainRoot) - .append(cssClasses.titleLeftRoot, !this.isFlowLayout && this.hasTitleOnLeft) - .append(cssClasses.hasError, this.errors.length > 0) - .append(cssClasses.small, !this.width) - .append(cssClasses.answered, this.isAnswered) - .toString(); - }; - Object.defineProperty(Question.prototype, "cssHeader", { - get: function () { - this.ensureElementCss(); - return this.getPropertyValue("cssHeader", ""); - }, - enumerable: false, - configurable: true - }); - Question.prototype.setCssHeader = function (val) { - this.setPropertyValue("cssHeader", val); - }; - Question.prototype.getCssHeader = function (cssClasses) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]() - .append(cssClasses.header) - .append(cssClasses.headerTop, this.hasTitleOnTop) - .append(cssClasses.headerLeft, this.hasTitleOnLeft) - .append(cssClasses.headerBottom, this.hasTitleOnBottom) - .toString(); - }; - Object.defineProperty(Question.prototype, "cssContent", { - get: function () { - this.ensureElementCss(); - return this.getPropertyValue("cssContent", ""); - }, - enumerable: false, - configurable: true - }); - Question.prototype.setCssContent = function (val) { - this.setPropertyValue("cssContent", val); - }; - Question.prototype.getCssContent = function (cssClasses) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]() - .append(cssClasses.content) - .append(cssClasses.contentLeft, this.hasTitleOnLeft) - .toString(); - }; - Object.defineProperty(Question.prototype, "cssTitle", { - get: function () { - this.ensureElementCss(); - return this.getPropertyValue("cssTitle", ""); - }, - enumerable: false, - configurable: true - }); - Question.prototype.setCssTitle = function (val) { - this.setPropertyValue("cssTitle", val); - }; - Question.prototype.getCssTitle = function (cssClasses) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]() - .append(cssClasses.title) - .append(cssClasses.titleExpandable, this.isCollapsed || this.isExpanded) - .append(cssClasses.titleOnError, this.containsErrors) - .append(cssClasses.titleOnAnswer, !this.containsErrors && this.isAnswered) - .toString(); - }; - Object.defineProperty(Question.prototype, "cssError", { - get: function () { - this.ensureElementCss(); - return this.getPropertyValue("cssError", ""); - }, - enumerable: false, - configurable: true - }); - Question.prototype.setCssError = function (val) { - this.setPropertyValue("cssError", val); - }; - Question.prototype.getCssError = function (cssClasses) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]() - .append(cssClasses.error.root) - .append(cssClasses.error.aboveQuestion, this.isErrorsModeTooltip && !this.hasParent) - .append(cssClasses.error.tooltip, this.isErrorsModeTooltip && this.hasParent) - .append(cssClasses.error.locationTop, !this.isErrorsModeTooltip && this.errorLocation === "top") - .append(cssClasses.error.locationBottom, !this.isErrorsModeTooltip && this.errorLocation === "bottom") - .toString(); - }; - Question.prototype.getRootCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]() - .append(this.cssRoot) - .append(this.cssClasses.disabled, this.isReadOnly) - .toString(); - }; - Question.prototype.updateElementCss = function (reNew) { - this.cssClassesValue = undefined; - if (reNew) { - this.updateQuestionCss(true); - } - }; - Question.prototype.updateQuestionCss = function (reNew) { - if (this.isLoadingFromJson || - !this.survey || - (reNew !== true && !this.cssClassesValue)) - return; - this.updateElementCssCore(this.cssClasses); - }; - Question.prototype.ensureElementCss = function () { - if (!this.cssClassesValue) { - this.updateQuestionCss(true); - } - }; - Question.prototype.updateElementCssCore = function (cssClasses) { - this.setCssRoot(this.getCssRoot(cssClasses)); - this.setCssHeader(this.getCssHeader(cssClasses)); - this.setCssContent(this.getCssContent(cssClasses)); - this.setCssTitle(this.getCssTitle(cssClasses)); - this.setCssError(this.getCssError(cssClasses)); - }; - Question.prototype.updateCssClasses = function (res, css) { - if (!css.question) - return; - var objCss = css[this.getCssType()]; - var titleBuilder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(res.title) - .append(css.question.titleRequired, this.isRequired); - res.title = titleBuilder.toString(); - var rootBuilder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(res.root) - .append(objCss, this.isRequired && !!css.question.required); - if (objCss === undefined || objCss === null) { - res.root = rootBuilder.toString(); - } - else if (typeof objCss === "string" || objCss instanceof String) { - res.root = rootBuilder.append(objCss.toString()).toString(); - } - else { - res.root = rootBuilder.toString(); - for (var key in objCss) { - res[key] = objCss[key]; - } - } - }; - Question.prototype.getCssType = function () { - return this.getType(); - }; - Object.defineProperty(Question.prototype, "width", { - /** - * Use it to set the specific width to the question like css style (%, px, em etc). - */ - get: function () { - return this.getPropertyValue("width", ""); - }, - set: function (val) { - this.setPropertyValue("width", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "minWidth", { - /** - * Use it to set the specific minWidth constraint to the question like css style (%, px, em etc). - */ - get: function () { - return this.getPropertyValue("minWidth"); - }, - set: function (val) { - this.setPropertyValue("minWidth", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "maxWidth", { - /** - * Use it to set the specific maxWidth constraint to the question like css style (%, px, em etc). - */ - get: function () { - return this.getPropertyValue("maxWidth"); - }, - set: function (val) { - this.setPropertyValue("maxWidth", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "renderWidth", { - /** - * The rendered width of the question. - */ - get: function () { - return this.getPropertyValue("renderWidth", ""); - }, - set: function (val) { - this.setPropertyValue("renderWidth", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "renderCssRoot", { - get: function () { - return this.cssClasses.root || undefined; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "indent", { - /** - * Set it different from 0 to increase the left padding. - */ - get: function () { - return this.getPropertyValue("indent"); - }, - set: function (val) { - this.setPropertyValue("indent", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "rightIndent", { - /** - * Set it different from 0 to increase the right padding. - */ - get: function () { - return this.getPropertyValue("rightIndent", 0); - }, - set: function (val) { - this.setPropertyValue("rightIndent", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "paddingLeft", { - get: function () { - return this.getPropertyValue("paddintLeft", ""); - }, - set: function (val) { - this.setPropertyValue("paddintLeft", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "paddingRight", { - get: function () { - return this.getPropertyValue("paddingRight", ""); - }, - set: function (val) { - this.setPropertyValue("paddingRight", val); - }, - enumerable: false, - configurable: true - }); - Question.prototype.onIndentChanged = function () { - this.paddingLeft = this.getIndentSize(this.indent); - this.paddingRight = this.getIndentSize(this.rightIndent); - }; - Question.prototype.getIndentSize = function (indent) { - if (indent < 1 || !this.getSurvey() || !this.cssClasses) - return ""; - return indent * this.cssClasses.indent + "px"; - }; - /** - * Move the focus to the input of this question. - * @param onError set this parameter to true, to focus the input with the first error, other wise the first input will be focused. - */ - Question.prototype.focus = function (onError) { - if (onError === void 0) { onError = false; } - if (this.isDesignMode) - return; - if (!!this.survey) { - this.survey.scrollElementToTop(this, this, null, this.id); - } - var id = !onError - ? this.getFirstInputElementId() - : this.getFirstErrorInputElementId(); - if (_survey_element__WEBPACK_IMPORTED_MODULE_2__["SurveyElement"].FocusElement(id)) { - this.fireCallback(this.focusCallback); - } - }; - Question.prototype.fireCallback = function (callback) { - if (callback) - callback(); - }; - Question.prototype.getOthersMaxLength = function () { - if (!this.survey) - return null; - return this.survey.maxOthersLength > 0 ? this.survey.maxOthersLength : null; - }; - Question.prototype.onCreating = function () { }; - Question.prototype.getFirstInputElementId = function () { - return this.inputId; - }; - Question.prototype.getFirstErrorInputElementId = function () { - return this.getFirstInputElementId(); - }; - Question.prototype.getProcessedTextValue = function (textValue) { - var name = textValue.name.toLocaleLowerCase(); - textValue.isExists = - Object.keys(Question.TextPreprocessorValuesMap).indexOf(name) !== -1 || - this[textValue.name] !== undefined; - textValue.value = this[Question.TextPreprocessorValuesMap[name] || textValue.name]; - }; - Question.prototype.supportComment = function () { - return false; - }; - Question.prototype.supportOther = function () { - return false; - }; - Object.defineProperty(Question.prototype, "isRequired", { - /** - * Set this property to true, to make the question a required. If a user doesn't answer the question then a validation error will be generated. - * Please note, this property is hidden for question without input, for example html question. - */ - get: function () { - return this.getPropertyValue("isRequired"); - }, - set: function (val) { - this.setPropertyValue("isRequired", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "requiredIf", { - /** - * An expression that returns true or false. If it returns true the Question becomes required and an end-user has to answer it. - * If it returns false the Question then an end-user may not answer it the Question maybe empty. - * The library runs the expression on survey start and on changing a question value. If the property is empty then isRequired property is used. - * Please note, this property is hidden for question without input, for example html question. - * @see isRequired - */ - get: function () { - return this.getPropertyValue("requiredIf", ""); - }, - set: function (val) { - this.setPropertyValue("requiredIf", val); - this.runConditions(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "hasComment", { - /** - * Set it to true, to add a comment for the question. - */ - get: function () { - return this.getPropertyValue("hasComment", false); - }, - set: function (val) { - if (!this.supportComment()) - return; - this.setPropertyValue("hasComment", val); - if (this.hasComment) - this.hasOther = false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "id", { - /** - * The unique identificator. It is generated automatically. - */ - get: function () { - return this.getPropertyValue("id"); - }, - set: function (val) { - this.setPropertyValue("id", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "ariaTitleId", { - get: function () { - return this.id + "_ariaTitle"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "ariaRole", { - get: function () { - return null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "hasOther", { - get: function () { - return this.getPropertyValue("hasOther", false); - }, - set: function (val) { - if (!this.supportOther() || this.hasOther == val) - return; - this.setPropertyValue("hasOther", val); - if (this.hasOther) - this.hasComment = false; - this.hasOtherChanged(); - }, - enumerable: false, - configurable: true - }); - Question.prototype.hasOtherChanged = function () { }; - Object.defineProperty(Question.prototype, "requireUpdateCommentValue", { - get: function () { - return this.hasComment || this.hasOther; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "isReadOnly", { - /** - * Returns true if readOnly property is true or survey is in display mode or parent panel/page is readOnly. - * @see SurveyModel.model - * @see readOnly - */ - get: function () { - var isParentReadOnly = !!this.parent && this.parent.isReadOnly; - var isSurveyReadOnly = !!this.survey && this.survey.isDisplayMode; - return this.readOnly || isParentReadOnly || isSurveyReadOnly; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "isInputReadOnly", { - get: function () { - var isDesignModeV2 = _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].supportCreatorV2 && this.isDesignMode; - return this.isReadOnly || isDesignModeV2; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "renderedInputReadOnly", { - get: function () { - return this.isInputReadOnly ? "" : undefined; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "renderedInputDisabled", { - get: function () { - return this.isInputReadOnly ? "" : undefined; - }, - enumerable: false, - configurable: true - }); - Question.prototype.onReadOnlyChanged = function () { - this.setPropertyValue("isInputReadOnly", this.isInputReadOnly); - _super.prototype.onReadOnlyChanged.call(this); - }; - Object.defineProperty(Question.prototype, "enableIf", { - /** - * An expression that returns true or false. If it returns false the Question becomes read only and an end-user will not able to answer on the qustion. The library runs the expression on survey start and on changing a question value. If the property is empty then readOnly property is used. - * Please note, this property is hidden for question without input, for example html question. - * @see readOnly - * @see isReadOnly - */ - get: function () { - return this.getPropertyValue("enableIf", ""); - }, - set: function (val) { - this.setPropertyValue("enableIf", val); - this.runConditions(); - }, - enumerable: false, - configurable: true - }); - /** - * Run visibleIf and enableIf expressions. If visibleIf or/and enabledIf are not empty, then the results of performing the expression (true or false) set to the visible/readOnly properties. - * @param values Typically survey results - * @see visible - * @see visibleIf - * @see readOnly - * @see enableIf - */ - Question.prototype.runCondition = function (values, properties) { - if (this.isDesignMode) - return; - if (!properties) - properties = {}; - properties["question"] = this; - if (!this.areInvisibleElementsShowing) { - this.runVisibleIfCondition(values, properties); - } - this.runEnableIfCondition(values, properties); - this.runRequiredIfCondition(values, properties); - }; - Question.prototype.runVisibleIfCondition = function (values, properties) { - var _this = this; - if (!this.visibleIf) - return; - if (!this.conditionRunner) - this.conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_7__["ConditionRunner"](this.visibleIf); - this.conditionRunner.expression = this.visibleIf; - this.conditionRunner.onRunComplete = function (res) { - _this.visible = res; - }; - this.conditionRunner.run(values, properties); - }; - Question.prototype.runEnableIfCondition = function (values, properties) { - var _this = this; - if (!this.enableIf) - return; - if (!this.conditionEnabelRunner) - this.conditionEnabelRunner = new _conditions__WEBPACK_IMPORTED_MODULE_7__["ConditionRunner"](this.enableIf); - this.conditionEnabelRunner.expression = this.enableIf; - this.conditionEnabelRunner.onRunComplete = function (res) { - _this.readOnly = !res; - }; - this.conditionEnabelRunner.run(values, properties); - }; - Question.prototype.runRequiredIfCondition = function (values, properties) { - var _this = this; - if (!this.requiredIf) - return; - if (!this.conditionRequiredRunner) - this.conditionRequiredRunner = new _conditions__WEBPACK_IMPORTED_MODULE_7__["ConditionRunner"](this.requiredIf); - this.conditionRequiredRunner.expression = this.requiredIf; - this.conditionRequiredRunner.onRunComplete = function (res) { - _this.isRequired = res; - }; - this.conditionRequiredRunner.run(values, properties); - }; - Object.defineProperty(Question.prototype, "no", { - /** - * The property returns the question number. If question is invisible then it returns empty string. - * If visibleIndex is 1, then no is 2, or 'B' if survey.questionStartIndex is 'A'. - * @see SurveyModel.questionStartIndex - */ - get: function () { - return this.getPropertyValue("no"); - }, - enumerable: false, - configurable: true - }); - Question.prototype.calcNo = function () { - if (!this.hasTitle || this.hideNumber) - return ""; - var no = _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].getNumberByIndex(this.visibleIndex, this.getStartIndex()); - if (!!this.survey) { - no = this.survey.getUpdatedQuestionNo(this, no); - } - return no; - }; - Question.prototype.getStartIndex = function () { - if (!!this.parent) - return this.parent.getQuestionStartIndex(); - if (!!this.survey) - return this.survey.questionStartIndex; - return ""; - }; - Question.prototype.onSurveyLoad = function () { - this.fireCallback(this.surveyLoadCallback); - this.updateValueWithDefaults(); - }; - Question.prototype.onSetData = function () { - _super.prototype.onSetData.call(this); - if (!this.survey) - return; - this.initDataFromSurvey(); - this.onSurveyValueChanged(this.value); - this.updateValueWithDefaults(); - this.onIndentChanged(); - this.updateQuestionCss(); - this.updateIsAnswered(); - }; - Question.prototype.initDataFromSurvey = function () { - if (!!this.data) { - var val = this.data.getValue(this.getValueName()); - if (!_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(val) || !this.isLoadingFromJson) { - this.updateValueFromSurvey(val); - } - this.initCommentFromSurvey(); - } - }; - Question.prototype.initCommentFromSurvey = function () { - if (!!this.data && this.requireUpdateCommentValue) { - this.updateCommentFromSurvey(this.data.getComment(this.getValueName())); - } - else { - this.updateCommentFromSurvey(""); - } - }; - Question.prototype.runExpression = function (expression) { - if (!this.survey || !expression) - return undefined; - return this.survey.runExpression(expression); - }; - Object.defineProperty(Question.prototype, "autoGrowComment", { - get: function () { - return this.survey && this.survey.autoGrowComment; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "questionValue", { - get: function () { - return this.getPropertyValue("value"); - }, - set: function (val) { - this.setPropertyValue("value", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "questionComment", { - get: function () { - return this.getPropertyValue("comment"); - }, - set: function (val) { - this.setPropertyValue("comment", val); - this.fireCallback(this.commentChangedCallback); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "value", { - /** - * Get/Set the question value. - * @see SurveyMode.setValue - * @see SurveyMode.getValue - */ - get: function () { - return this.getValueCore(); - }, - set: function (newValue) { - this.setNewValue(newValue); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "valueForSurvey", { - get: function () { - if (!!this.valueToDataCallback) { - return this.valueToDataCallback(this.value); - } - return this.value; - }, - enumerable: false, - configurable: true - }); - /** - * Clear the question value. It clears the question comment as well. - */ - Question.prototype.clearValue = function () { - if (this.value !== undefined) { - this.value = undefined; - } - this.comment = undefined; - }; - Question.prototype.unbindValue = function () { - this.clearValue(); - }; - Question.prototype.createValueCopy = function () { - return this.getUnbindValue(this.value); - }; - Question.prototype.getUnbindValue = function (value) { - if (this.isValueSurveyElement(value)) - return value; - return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].getUnbindValue(value); - }; - Question.prototype.isValueSurveyElement = function (val) { - if (!val) - return false; - if (Array.isArray(val)) - return val.length > 0 ? this.isValueSurveyElement(val[0]) : false; - return !!val.getType && !!val.onPropertyChanged; - }; - Question.prototype.canClearValueAsInvisible = function () { - if (this.isVisible && this.isParentVisible) - return false; - if (!!this.page && this.page.isStarted) - return false; - if (!this.survey || !this.valueName) - return true; - return !this.survey.hasVisibleQuestionByValueName(this.valueName); - }; - Object.defineProperty(Question.prototype, "isParentVisible", { - /** - * Return true if there is a parent (page or panel) and it is visible - */ - get: function () { - var parent = this.parent; - while (parent) { - if (!parent.isVisible) - return false; - parent = parent.parent; - } - return true; - }, - enumerable: false, - configurable: true - }); - Question.prototype.clearValueIfInvisible = function () { - if (this.canClearValueAsInvisible()) { - this.clearValue(); - } - }; - Object.defineProperty(Question.prototype, "displayValue", { - get: function () { - if (this.isLoadingFromJson) - return ""; - return this.getDisplayValue(true); - }, - enumerable: false, - configurable: true - }); - /** - * Return the question value as a display text. For example, for dropdown, it would return the item text instead of item value. - * @param keysAsText Set this value to true, to return key (in matrices questions) as display text as well. - * @param value use this parameter, if you want to get display value for this value and not question.value. It is undefined by default. - */ - Question.prototype.getDisplayValue = function (keysAsText, value) { - if (value === void 0) { value = undefined; } - var res = this.calcDisplayValue(keysAsText, value); - return !!this.displayValueCallback ? this.displayValueCallback(res) : res; - }; - Question.prototype.calcDisplayValue = function (keysAsText, value) { - if (value === void 0) { value = undefined; } - if (this.customWidget) { - var res = this.customWidget.getDisplayValue(this, value); - if (res) - return res; - } - value = value == undefined ? this.createValueCopy() : value; - if (this.isValueEmpty(value)) - return this.getDisplayValueEmpty(); - return this.getDisplayValueCore(keysAsText, value); - }; - Question.prototype.getDisplayValueCore = function (keyAsText, value) { - return value; - }; - Question.prototype.getDisplayValueEmpty = function () { - return ""; - }; - Object.defineProperty(Question.prototype, "defaultValue", { - /** - * Set the default value to the question. It will be assign to the question on loading the survey from JSON or adding a question to the survey or on setting this property of the value is empty. - * Please note, this property is hidden for question without input, for example html question. - */ - get: function () { - return this.getPropertyValue("defaultValue"); - }, - set: function (val) { - if (this.isValueExpression(val)) { - this.defaultValueExpression = val.substr(1); - return; - } - this.setPropertyValue("defaultValue", this.convertDefaultValue(val)); - this.updateValueWithDefaults(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "defaultValueExpression", { - get: function () { - return this.getPropertyValue("defaultValueExpression"); - }, - set: function (val) { - this.setPropertyValue("defaultValueExpression", val); - this.updateValueWithDefaults(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "resizeStyle", { - get: function () { - return this.autoGrowComment ? "none" : "both"; - }, - enumerable: false, - configurable: true - }); - /** - * Returns question answer data as a plain object: with question title, name, value and displayValue. - * For complex questions (like matrix, etc.) isNode flag is set to true and data contains array of nested objects (rows) - * set options.includeEmpty to false if you want to skip empty answers - */ - Question.prototype.getPlainData = function (options) { - var _this = this; - if (!options) { - options = { includeEmpty: true, includeQuestionTypes: false }; - } - if (options.includeEmpty || !this.isEmpty()) { - var questionPlainData = { - name: this.name, - title: this.locTitle.renderedHtml, - value: this.value, - displayValue: this.displayValue, - isNode: false, - getString: function (val) { - return typeof val === "object" ? JSON.stringify(val) : val; - }, - }; - if (options.includeQuestionTypes === true) { - questionPlainData.questionType = this.getType(); - } - (options.calculations || []).forEach(function (calculation) { - questionPlainData[calculation.propertyName] = _this[calculation.propertyName]; - }); - if (this.hasComment) { - questionPlainData.isNode = true; - questionPlainData.data = [ - { - name: 0, - isComment: true, - title: "Comment", - value: _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].commentPrefix, - displayValue: this.comment, - getString: function (val) { - return typeof val === "object" ? JSON.stringify(val) : val; - }, - isNode: false, - }, - ]; - } - return questionPlainData; - } - return undefined; - }; - Object.defineProperty(Question.prototype, "correctAnswer", { - /** - * The correct answer on the question. Set this value if you are doing a quiz. - * Please note, this property is hidden for question without input, for example html question. - * @see SurveyModel.correctAnswers - * @see SurveyModel.inCorrectAnswers - */ - get: function () { - return this.getPropertyValue("correctAnswer"); - }, - set: function (val) { - this.setPropertyValue("correctAnswer", this.convertDefaultValue(val)); - }, - enumerable: false, - configurable: true - }); - Question.prototype.convertDefaultValue = function (val) { - return val; - }; - Object.defineProperty(Question.prototype, "quizQuestionCount", { - /** - * Returns questions count: 1 for the non-matrix questions and all inner visible questions that has input(s) widgets for question of matrix types. - * @see getQuizQuestions - */ - get: function () { - if (this.isVisible && - this.hasInput && - !this.isValueEmpty(this.correctAnswer)) - return this.getQuizQuestionCount(); - return 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "correctAnswerCount", { - get: function () { - if (!this.isEmpty() && !this.isValueEmpty(this.correctAnswer)) - return this.getCorrectAnswerCount(); - return 0; - }, - enumerable: false, - configurable: true - }); - Question.prototype.getQuizQuestionCount = function () { - return 1; - }; - Question.prototype.getCorrectAnswerCount = function () { - return this.isTwoValueEquals(this.value, this.correctAnswer, true, true) - ? 1 - : 0; - }; - Question.prototype.isAnswerCorrect = function () { - return this.correctAnswerCount == this.quizQuestionCount; - }; - Question.prototype.updateValueWithDefaults = function () { - if (this.isLoadingFromJson || (!this.isDesignMode && this.isDefaultValueEmpty())) - return; - if (!this.isDesignMode && !this.isEmpty()) - return; - if (this.isEmpty() && this.isDefaultValueEmpty()) - return; - if (!!this.survey && this.survey.isClearValueOnHidden && !this.isVisible) - return; - this.setDefaultValue(); - }; - Question.prototype.getQuestionFromArray = function (name, index) { - return null; - }; - Question.prototype.getDefaultValue = function () { - return this.defaultValue; - }; - Question.prototype.isDefaultValueEmpty = function () { - return !this.defaultValueExpression && this.isValueEmpty(this.defaultValue); - }; - Question.prototype.setDefaultValue = function () { - var _this = this; - this.setValueAndRunExpression(this.defaultValueExpression, this.getUnbindValue(this.defaultValue), function (val) { - _this.value = val; - }); - }; - Question.prototype.isValueExpression = function (val) { - return !!val && typeof val == "string" && val.length > 0 && val[0] == "="; - }; - Question.prototype.setValueAndRunExpression = function (expression, defaultValue, setFunc, values, properties) { - var _this = this; - if (values === void 0) { values = null; } - if (properties === void 0) { properties = null; } - var func = function (val) { - if (val instanceof Date) { - val = val.toISOString().slice(0, 10); - } - setFunc(val); - }; - if (!!expression && !!this.data) { - if (!values) - values = this.data.getFilteredValues(); - if (!properties) - properties = this.data.getFilteredProperties(); - var runner = new _conditions__WEBPACK_IMPORTED_MODULE_7__["ExpressionRunner"](expression); - if (runner.canRun) { - runner.onRunComplete = function (res) { - if (res == undefined) - res = _this.defaultValue; - func(res); - }; - runner.run(values, properties); - } - } - else { - func(defaultValue); - } - }; - Object.defineProperty(Question.prototype, "comment", { - /** - * The question comment value. - */ - get: function () { - return this.getQuestionComment(); - }, - set: function (newValue) { - if (!!newValue) { - var trimmedValue = newValue.toString().trim(); - if (trimmedValue !== newValue) { - newValue = trimmedValue; - if (newValue === this.comment) { - this.setPropertyValueDirectly("comment", newValue); - } - } - } - if (this.comment == newValue) - return; - this.setQuestionComment(newValue); - this.updateCommentElement(); - }, - enumerable: false, - configurable: true - }); - Question.prototype.getQuestionComment = function () { - return this.questionComment; - }; - Question.prototype.setQuestionComment = function (newValue) { - this.setNewComment(newValue); - }; - /** - * Returns true if the question value is empty - */ - Question.prototype.isEmpty = function () { - return this.isValueEmpty(this.value); - }; - Object.defineProperty(Question.prototype, "isAnswered", { - get: function () { - return this.getPropertyValue("isAnswered"); - }, - set: function (val) { - this.setPropertyValue("isAnswered", val); - }, - enumerable: false, - configurable: true - }); - Question.prototype.updateIsAnswered = function () { - this.setPropertyValue("isAnswered", this.getIsAnswered()); - }; - Question.prototype.getIsAnswered = function () { - return !this.isEmpty(); - }; - Object.defineProperty(Question.prototype, "validators", { - /** - * The list of question validators. - * Please note, this property is hidden for question without input, for example html question. - */ - get: function () { - return this.getPropertyValue("validators"); - }, - set: function (val) { - this.setPropertyValue("validators", val); - }, - enumerable: false, - configurable: true - }); - Question.prototype.getValidators = function () { - return this.validators; - }; - Question.prototype.getSupportedValidators = function () { - var res = []; - var className = this.getType(); - while (!!className) { - var classValidators = _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].supportedValidators[className]; - if (!!classValidators) { - for (var i = classValidators.length - 1; i >= 0; i--) { - res.splice(0, 0, classValidators[i]); - } - } - var classInfo = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].findClass(className); - className = classInfo.parentName; - } - return res; - }; - Question.prototype.addSupportedValidators = function (supportedValidators, classValidators) { }; - Question.prototype.addConditionObjectsByContext = function (objects, context) { - objects.push({ - name: this.getValueName(), - text: this.processedTitle, - question: this, - }); - }; - Question.prototype.getConditionJson = function (operator, path) { - var json = new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"]().toJsonObject(this); - json["type"] = this.getType(); - return json; - }; - /** - * Returns true if there is a validation error(s) in the question. - * @param fireCallback set it to true to show an error in UI. - */ - Question.prototype.hasErrors = function (fireCallback, rec) { - if (fireCallback === void 0) { fireCallback = true; } - if (rec === void 0) { rec = null; } - var oldHasErrors = this.errors.length > 0; - var errors = this.checkForErrors(!!rec && rec.isOnValueChanged === true); - if (fireCallback) { - if (!!this.survey) { - this.survey.beforeSettingQuestionErrors(this, errors); - } - this.errors = errors; - } - this.updateContainsErrors(); - if (oldHasErrors != errors.length > 0) { - this.updateQuestionCss(); - } - if (this.isCollapsed && rec && fireCallback && errors.length > 0) { - this.expand(); - } - return errors.length > 0; - }; - Object.defineProperty(Question.prototype, "currentErrorCount", { - /** - * Returns the validation errors count. - */ - get: function () { - return this.errors.length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Question.prototype, "requiredText", { - /** - * Returns the char/string for a required question. - * @see SurveyModel.requiredText - */ - get: function () { - return this.survey != null && this.isRequired - ? this.survey.requiredText - : ""; - }, - enumerable: false, - configurable: true - }); - /** - * Add error into the question error list. - * @param error - */ - Question.prototype.addError = function (error) { - if (!error) - return; - var newError = null; - if (typeof error === "string" || error instanceof String) { - newError = new _error__WEBPACK_IMPORTED_MODULE_4__["CustomError"](error, this.survey); - } - else { - newError = error; - } - this.errors.push(newError); - }; - /** - * Remove a particular error from the question error list. - * @param error - */ - Question.prototype.removeError = function (error) { - var errors = this.errors; - var index = errors.indexOf(error); - if (index !== -1) - errors.splice(index, 1); - }; - Question.prototype.checkForErrors = function (isOnValueChanged) { - var qErrors = new Array(); - if (this.isVisible && this.canCollectErrors()) { - this.collectErrors(qErrors, isOnValueChanged); - } - return qErrors; - }; - Question.prototype.canCollectErrors = function () { - return !this.isReadOnly; - }; - Question.prototype.collectErrors = function (qErrors, isOnValueChanged) { - this.onCheckForErrors(qErrors, isOnValueChanged); - if (qErrors.length > 0 || !this.canRunValidators(isOnValueChanged)) - return; - var errors = this.runValidators(); - if (errors.length > 0) { - //validators may change the question value. - qErrors.length = 0; - for (var i = 0; i < errors.length; i++) { - qErrors.push(errors[i]); - } - } - if (this.survey && qErrors.length == 0) { - var error = this.fireSurveyValidation(); - if (error) { - qErrors.push(error); - } - } - }; - Question.prototype.canRunValidators = function (isOnValueChanged) { - return true; - }; - Question.prototype.fireSurveyValidation = function () { - if (this.validateValueCallback) - return this.validateValueCallback(); - return this.survey ? this.survey.validateQuestion(this) : null; - }; - Question.prototype.onCheckForErrors = function (errors, isOnValueChanged) { - if (!isOnValueChanged && this.hasRequiredError()) { - errors.push(new _error__WEBPACK_IMPORTED_MODULE_4__["AnswerRequiredError"](this.requiredErrorText, this)); - } - }; - Question.prototype.hasRequiredError = function () { - return this.isRequired && this.isEmpty(); - }; - Object.defineProperty(Question.prototype, "isRunningValidators", { - get: function () { - return this.getIsRunningValidators(); - }, - enumerable: false, - configurable: true - }); - Question.prototype.getIsRunningValidators = function () { - return this.isRunningValidatorsValue; - }; - Question.prototype.runValidators = function () { - var _this = this; - if (!!this.validatorRunner) { - this.validatorRunner.onAsyncCompleted = null; - } - this.validatorRunner = new _validator__WEBPACK_IMPORTED_MODULE_5__["ValidatorRunner"](); - this.isRunningValidatorsValue = true; - this.validatorRunner.onAsyncCompleted = function (errors) { - _this.doOnAsyncCompleted(errors); - }; - return this.validatorRunner.run(this); - }; - Question.prototype.doOnAsyncCompleted = function (errors) { - for (var i = 0; i < errors.length; i++) { - this.errors.push(errors[i]); - } - this.isRunningValidatorsValue = false; - this.raiseOnCompletedAsyncValidators(); - }; - Question.prototype.raiseOnCompletedAsyncValidators = function () { - if (!!this.onCompletedAsyncValidators && !this.isRunningValidators) { - this.onCompletedAsyncValidators(this.getAllErrors().length > 0); - this.onCompletedAsyncValidators = null; - } - }; - Question.prototype.setNewValue = function (newValue) { - var oldAnswered = this.isAnswered; - this.setNewValueInData(newValue); - this.allowNotifyValueChanged && this.onValueChanged(); - if (this.isAnswered != oldAnswered) { - this.updateQuestionCss(); - } - }; - Question.prototype.isTextValue = function () { - return false; - }; - Object.defineProperty(Question.prototype, "isSurveyInputTextUpdate", { - get: function () { - return !!this.survey ? this.survey.isUpdateValueTextOnTyping : false; - }, - enumerable: false, - configurable: true - }); - Question.prototype.getDataLocNotification = function () { - return this.isInputTextUpdate ? "text" : false; - }; - Object.defineProperty(Question.prototype, "isInputTextUpdate", { - get: function () { - return this.isSurveyInputTextUpdate && this.isTextValue(); - }, - enumerable: false, - configurable: true - }); - Question.prototype.setNewValueInData = function (newValue) { - newValue = this.valueToData(newValue); - if (!this.isValueChangedInSurvey) { - this.setValueCore(newValue); - } - }; - Question.prototype.getValueCore = function () { - return this.questionValue; - }; - Question.prototype.setValueCore = function (newValue) { - this.setQuestionValue(newValue); - if (this.data != null && this.canSetValueToSurvey()) { - newValue = this.valueForSurvey; - this.data.setValue(this.getValueName(), newValue, this.getDataLocNotification(), this.allowNotifyValueChanged); - } - }; - Question.prototype.canSetValueToSurvey = function () { - return true; - }; - Question.prototype.valueFromData = function (val) { - return val; - }; - Question.prototype.valueToData = function (val) { - return val; - }; - Question.prototype.onValueChanged = function () { }; - Question.prototype.setNewComment = function (newValue) { - this.questionComment = newValue; - if (this.data != null) { - this.data.setComment(this.getValueName(), newValue, this.isSurveyInputTextUpdate ? "text" : false); - } - }; - Question.prototype.getValidName = function (name) { - if (!name) - return name; - return name.trim().replace(/[\{\}]+/g, ""); - }; - //IQuestion - Question.prototype.updateValueFromSurvey = function (newValue) { - newValue = this.getUnbindValue(newValue); - if (!!this.valueFromDataCallback) { - newValue = this.valueFromDataCallback(newValue); - } - this.setQuestionValue(this.valueFromData(newValue)); - }; - Question.prototype.updateCommentFromSurvey = function (newValue) { - this.questionComment = newValue; - }; - Question.prototype.setQuestionValue = function (newValue, updateIsAnswered) { - if (updateIsAnswered === void 0) { updateIsAnswered = true; } - var isEqual = this.isTwoValueEquals(this.questionValue, newValue); - this.questionValue = newValue; - !isEqual && this.allowNotifyValueChanged && - this.fireCallback(this.valueChangedCallback); - if (updateIsAnswered) - this.updateIsAnswered(); - }; - Question.prototype.onSurveyValueChanged = function (newValue) { }; - Question.prototype.setVisibleIndex = function (val) { - if (!this.isVisible || - (!this.hasTitle && !_settings__WEBPACK_IMPORTED_MODULE_9__["settings"].setQuestionVisibleIndexForHiddenTitle) || - (this.hideNumber && !_settings__WEBPACK_IMPORTED_MODULE_9__["settings"].setQuestionVisibleIndexForHiddenNumber)) { - val = -1; - } - this.setPropertyValue("visibleIndex", val); - this.setPropertyValue("no", this.calcNo()); - return val < 0 ? 0 : 1; - }; - Question.prototype.removeElement = function (element) { - return false; - }; - Question.prototype.supportGoNextPageAutomatic = function () { - return false; - }; - Question.prototype.supportGoNextPageError = function () { - return true; - }; - /** - * Call this function to remove values from the current question, that end-user will not be able to enter. - * For example the value that doesn't exists in a radigroup/dropdown/checkbox choices or matrix rows/columns. - */ - Question.prototype.clearIncorrectValues = function () { }; - Question.prototype.clearOnDeletingContainer = function () { }; - /** - * Call this function to clear all errors in the question - */ - Question.prototype.clearErrors = function () { - this.errors = []; - }; - Question.prototype.clearUnusedValues = function () { }; - Question.prototype.onAnyValueChanged = function (name) { }; - Question.prototype.checkBindings = function (valueName, value) { - if (this.bindings.isEmpty() || !this.data) - return; - var props = this.bindings.getPropertiesByValueName(valueName); - for (var i = 0; i < props.length; i++) { - this[props[i]] = value; - } - }; - Question.prototype.getComponentName = function () { - return _rendererFactory__WEBPACK_IMPORTED_MODULE_10__["RendererFactory"].Instance.getRendererByQuestion(this); - }; - Question.prototype.isDefaultRendering = function () { - return (!!this.customWidget || - this.renderAs === "default" || - this.getComponentName() === "default"); - }; - //ISurveyErrorOwner - Question.prototype.getErrorCustomText = function (text, error) { - if (!!this.survey) - return this.survey.getErrorCustomText(text, error); - return text; - }; - //IValidatorOwner - Question.prototype.getValidatorTitle = function () { - return null; - }; - Object.defineProperty(Question.prototype, "validatedValue", { - get: function () { - return this.value; - }, - set: function (val) { - this.value = val; - }, - enumerable: false, - configurable: true - }); - Question.prototype.getAllValues = function () { - return !!this.data ? this.data.getAllValues() : null; - }; - Question.prototype.needResponsiveWidth = function () { - return false; - }; - Question.TextPreprocessorValuesMap = { - title: "processedTitle", - require: "requiredText", - }; - Question.questionCounter = 100; - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "default" }) - ], Question.prototype, "renderAs", void 0); - return Question; - }(_survey_element__WEBPACK_IMPORTED_MODULE_2__["SurveyElement"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("question", [ - "!name", - { - name: "state", - default: "default", - choices: ["default", "collapsed", "expanded"], - }, - { name: "visible:switch", default: true }, - { name: "useDisplayValuesInTitle:boolean", default: true, layout: "row" }, - "visibleIf:condition", - { name: "width" }, - { name: "minWidth", default: _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].minWidth }, - { name: "maxWidth", default: _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].maxWidth }, - { name: "startWithNewLine:boolean", default: true, layout: "row" }, - { name: "indent:number", default: 0, choices: [0, 1, 2, 3], layout: "row" }, - { - name: "page", - isSerializable: false, - visibleIf: function (obj) { - var survey = obj ? obj.survey : null; - return !survey || survey.pages.length > 1; - }, - choices: function (obj) { - var survey = obj ? obj.survey : null; - return survey - ? survey.pages.map(function (p) { - return { value: p.name, text: p.title }; - }) - : []; - }, - }, - { name: "title:text", serializationProperty: "locTitle", layout: "row" }, - { - name: "titleLocation", - default: "default", - choices: ["default", "top", "bottom", "left", "hidden"], - layout: "row", - }, - { - name: "description:text", - serializationProperty: "locDescription", - layout: "row", - }, - { - name: "descriptionLocation", - default: "default", - choices: ["default", "underInput", "underTitle"], - }, - { - name: "hideNumber:boolean", - dependsOn: "titleLocation", - visibleIf: function (obj) { - if (!obj) { - return true; - } - if (obj.titleLocation === "hidden") { - return false; - } - var parent = obj ? obj.parent : null; - var numberingAllowedByParent = !parent || parent.showQuestionNumbers !== "off"; - if (!numberingAllowedByParent) { - return false; - } - var survey = obj ? obj.survey : null; - return (!survey || - survey.showQuestionNumbers !== "off" || - (!!parent && parent.showQuestionNumbers === "onpanel")); - }, - }, - "valueName", - "enableIf:condition", - "defaultValue:value", - { - name: "defaultValueExpression:expression", - category: "logic", - }, - "correctAnswer:value", - "isRequired:switch", - "requiredIf:condition", - { - name: "requiredErrorText:text", - serializationProperty: "locRequiredErrorText", - }, - "readOnly:switch", - { - name: "validators:validators", - baseClassName: "surveyvalidator", - classNamePart: "validator", - }, - { - name: "bindings:bindings", - serializationProperty: "bindings", - visibleIf: function (obj) { - return obj.bindings.getNames().length > 0; - }, - }, - { name: "renderAs", default: "default", visible: false }, - ]); - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addAlterNativeClassName("question", "questionbase"); - - - /***/ }), - - /***/ "./src/questionCustomWidgets.ts": - /*!**************************************!*\ - !*** ./src/questionCustomWidgets.ts ***! - \**************************************/ - /*! exports provided: QuestionCustomWidget, CustomWidgetCollection */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCustomWidget", function() { return QuestionCustomWidget; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CustomWidgetCollection", function() { return CustomWidgetCollection; }); - /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); - - var QuestionCustomWidget = /** @class */ (function () { - function QuestionCustomWidget(name, widgetJson) { - this.name = name; - this.widgetJson = widgetJson; - this.isFirstRender = true; - this.htmlTemplate = widgetJson.htmlTemplate ? widgetJson.htmlTemplate : ""; - } - QuestionCustomWidget.prototype.afterRender = function (question, el) { - var _this = this; - if (this.isFirstRender) { - this.isFirstRender = false; - question.survey.onLocaleChangedEvent.add(function () { - _this.widgetJson.willUnmount(question, el); - _this.widgetJson.afterRender(question, el); - }); - } - if (this.widgetJson.afterRender) - this.widgetJson.afterRender(question, el); - }; - QuestionCustomWidget.prototype.willUnmount = function (question, el) { - if (this.widgetJson.willUnmount) - this.widgetJson.willUnmount(question, el); - }; - QuestionCustomWidget.prototype.getDisplayValue = function (question, value) { - if (value === void 0) { value = undefined; } - if (this.widgetJson.getDisplayValue) - return this.widgetJson.getDisplayValue(question, value); - return null; - }; - QuestionCustomWidget.prototype.isFit = function (question) { - if (this.isLibraryLoaded() && this.widgetJson.isFit) - return this.widgetJson.isFit(question); - return false; - }; - Object.defineProperty(QuestionCustomWidget.prototype, "canShowInToolbox", { - get: function () { - if (this.widgetJson.showInToolbox === false) - return false; - if (CustomWidgetCollection.Instance.getActivatedBy(this.name) != "customtype") - return false; - return !this.widgetJson.widgetIsLoaded || this.widgetJson.widgetIsLoaded(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionCustomWidget.prototype, "showInToolbox", { - get: function () { - return this.widgetJson.showInToolbox !== false; - }, - set: function (val) { - this.widgetJson.showInToolbox = val; - }, - enumerable: false, - configurable: true - }); - QuestionCustomWidget.prototype.init = function () { - if (this.widgetJson.init) { - this.widgetJson.init(); - } - }; - QuestionCustomWidget.prototype.activatedByChanged = function (activatedBy) { - if (this.isLibraryLoaded() && this.widgetJson.activatedByChanged) { - this.widgetJson.activatedByChanged(activatedBy); - } - }; - QuestionCustomWidget.prototype.isLibraryLoaded = function () { - if (this.widgetJson.widgetIsLoaded) - return this.widgetJson.widgetIsLoaded() == true; - return true; - }; - Object.defineProperty(QuestionCustomWidget.prototype, "isDefaultRender", { - get: function () { - return this.widgetJson.isDefaultRender; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionCustomWidget.prototype, "pdfQuestionType", { - get: function () { - return this.widgetJson.pdfQuestionType; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionCustomWidget.prototype, "pdfRender", { - get: function () { - return this.widgetJson.pdfRender; - }, - enumerable: false, - configurable: true - }); - return QuestionCustomWidget; - }()); - - var CustomWidgetCollection = /** @class */ (function () { - function CustomWidgetCollection() { - this.widgetsValues = []; - this.widgetsActivatedBy = {}; - this.onCustomWidgetAdded = new _base__WEBPACK_IMPORTED_MODULE_0__["Event"](); - } - Object.defineProperty(CustomWidgetCollection.prototype, "widgets", { - get: function () { - return this.widgetsValues; - }, - enumerable: false, - configurable: true - }); - CustomWidgetCollection.prototype.add = function (widgetJson, activatedBy) { - if (activatedBy === void 0) { activatedBy = "property"; } - this.addCustomWidget(widgetJson, activatedBy); - }; - CustomWidgetCollection.prototype.addCustomWidget = function (widgetJson, activatedBy) { - if (activatedBy === void 0) { activatedBy = "property"; } - var name = widgetJson.name; - if (!name) { - name = "widget_" + this.widgets.length + 1; - } - var customWidget = new QuestionCustomWidget(name, widgetJson); - this.widgetsValues.push(customWidget); - customWidget.init(); - this.widgetsActivatedBy[name] = activatedBy; - customWidget.activatedByChanged(activatedBy); - this.onCustomWidgetAdded.fire(customWidget, null); - return customWidget; - }; - /** - * Returns the way the custom wiget is activated. It can be activated by a property ("property"), question type ("type") or by new/custom question type ("customtype"). - * @param widgetName the custom widget name - * @see setActivatedBy - */ - CustomWidgetCollection.prototype.getActivatedBy = function (widgetName) { - var res = this.widgetsActivatedBy[widgetName]; - return res ? res : "property"; - }; - /** - * Sets the way the custom wiget is activated. The activation types are: property ("property"), question type ("type") or new/custom question type ("customtype"). A custom wiget may support all or only some of this activation types. - * @param widgetName - * @param activatedBy there are three possible variants: "property", "type" and "customtype" - */ - CustomWidgetCollection.prototype.setActivatedBy = function (widgetName, activatedBy) { - if (!widgetName || !activatedBy) - return; - var widget = this.getCustomWidgetByName(widgetName); - if (!widget) - return; - this.widgetsActivatedBy[widgetName] = activatedBy; - widget.activatedByChanged(activatedBy); - }; - CustomWidgetCollection.prototype.clear = function () { - this.widgetsValues = []; - }; - CustomWidgetCollection.prototype.getCustomWidgetByName = function (name) { - for (var i = 0; i < this.widgets.length; i++) { - if (this.widgets[i].name == name) - return this.widgets[i]; - } - return null; - }; - CustomWidgetCollection.prototype.getCustomWidget = function (question) { - for (var i = 0; i < this.widgetsValues.length; i++) { - if (this.widgetsValues[i].isFit(question)) - return this.widgetsValues[i]; - } - return null; - }; - CustomWidgetCollection.Instance = new CustomWidgetCollection(); - return CustomWidgetCollection; - }()); - - - - /***/ }), - - /***/ "./src/question_baseselect.ts": - /*!************************************!*\ - !*** ./src/question_baseselect.ts ***! - \************************************/ - /*! exports provided: QuestionSelectBase, QuestionCheckboxBase */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionSelectBase", function() { return QuestionSelectBase; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCheckboxBase", function() { return QuestionCheckboxBase; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _survey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./survey */ "./src/survey.ts"); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./error */ "./src/error.ts"); - /* harmony import */ var _choicesRestful__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./choicesRestful */ "./src/choicesRestful.ts"); - /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - - - - - - - /** - * It is a base class for checkbox, dropdown and radiogroup questions. - */ - var QuestionSelectBase = /** @class */ (function (_super) { - __extends(QuestionSelectBase, _super); - function QuestionSelectBase(name) { - var _this = _super.call(this, name) || this; - _this.otherItemValue = new _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"]("other"); - _this.dependedQuestions = []; - _this.noneItemValue = new _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"]("none"); - _this.isSettingDefaultValue = false; - _this.isSettingComment = false; - _this.isRunningChoices = false; - _this.isFirstLoadChoicesFromUrl = true; - _this.isUpdatingChoicesDependedQuestions = false; - var noneItemText = _this.createLocalizableString("noneText", _this, true); - noneItemText.onGetTextCallback = function (text) { - return !!text ? text : _surveyStrings__WEBPACK_IMPORTED_MODULE_4__["surveyLocalization"].getString("noneItemText"); - }; - _this.noneItemValue.locOwner = _this; - _this.noneItemValue.setLocText(noneItemText); - _this.createItemValues("choices"); - _this.registerFunctionOnPropertyValueChanged("choices", function () { - if (!_this.filterItems()) { - _this.onVisibleChoicesChanged(); - } - }); - _this.registerFunctionOnPropertiesValueChanged(["choicesFromQuestion", "choicesFromQuestionMode", "hasNone"], function () { - _this.onVisibleChoicesChanged(); - }); - _this.registerFunctionOnPropertyValueChanged("hideIfChoicesEmpty", function () { - _this.updateVisibilityBasedOnChoices(); - }); - _this.createNewArray("visibleChoices"); - _this.setNewRestfulProperty(); - var locOtherText = _this.createLocalizableString("otherText", _this, true); - _this.createLocalizableString("otherErrorText", _this, true); - _this.otherItemValue.locOwner = _this; - _this.otherItemValue.setLocText(locOtherText); - locOtherText.onGetTextCallback = function (text) { - return !!text ? text : _surveyStrings__WEBPACK_IMPORTED_MODULE_4__["surveyLocalization"].getString("otherItemText"); - }; - _this.choicesByUrl.createItemValue = function (value) { - return _this.createItemValue(value); - }; - _this.choicesByUrl.beforeSendRequestCallback = function () { - _this.onBeforeSendRequest(); - }; - _this.choicesByUrl.getResultCallback = function (items) { - _this.onLoadChoicesFromUrl(items); - }; - _this.choicesByUrl.updateResultCallback = function (items, serverResult) { - if (_this.survey) { - return _this.survey.updateChoicesFromServer(_this, items, serverResult); - } - return items; - }; - _this.createLocalizableString("otherPlaceHolder", _this); - return _this; - } - QuestionSelectBase.prototype.getType = function () { - return "selectbase"; - }; - QuestionSelectBase.prototype.dispose = function () { - _super.prototype.dispose.call(this); - for (var i = 0; i < this.dependedQuestions.length; i++) { - this.dependedQuestions[i].choicesFromQuestion = ""; - } - this.removeFromDependedQuestion(this.getQuestionWithChoices()); - }; - QuestionSelectBase.prototype.getItemValueType = function () { - return "itemvalue"; - }; - QuestionSelectBase.prototype.createItemValue = function (value) { - return _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].createClass(this.getItemValueType(), value); - }; - QuestionSelectBase.prototype.supportGoNextPageError = function () { - return !this.isOtherSelected || !!this.comment; - }; - QuestionSelectBase.prototype.isLayoutTypeSupported = function (layoutType) { - return true; - }; - QuestionSelectBase.prototype.localeChanged = function () { - _super.prototype.localeChanged.call(this); - if (this.choicesOrder !== "none") { - this.updateVisibleChoices(); - } - }; - QuestionSelectBase.prototype.locStrsChanged = function () { - _super.prototype.locStrsChanged.call(this); - if (!!this.choicesFromUrl) { - _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].locStrsChanged(this.choicesFromUrl); - _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].locStrsChanged(this.visibleChoices); - } - }; - Object.defineProperty(QuestionSelectBase.prototype, "otherItem", { - /** - * Returns the other item. By using this property, you may change programmatically it's value and text. - * @see hasOther - */ - get: function () { - return this.otherItemValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "isOtherSelected", { - /** - * Returns true if a user select the 'other' item. - */ - get: function () { - return this.hasOther && this.getHasOther(this.renderedValue); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "hasNone", { - /** - * Set this property to true, to show the "None" item on the bottom. If end-user checks this item, all other items would be unchecked. - */ - get: function () { - return this.getPropertyValue("hasNone", false); - }, - set: function (val) { - this.setPropertyValue("hasNone", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "noneItem", { - /** - * Returns the none item. By using this property, you may change programmatically it's value and text. - * @see hasNone - */ - get: function () { - return this.noneItemValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "noneText", { - /** - * Use this property to set the different text for none item. - */ - get: function () { - return this.getLocalizableStringText("noneText", _surveyStrings__WEBPACK_IMPORTED_MODULE_4__["surveyLocalization"].getString("noneItemText")); - }, - set: function (val) { - this.setLocalizableStringText("noneText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "locNoneText", { - get: function () { - return this.getLocalizableString("noneText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "choicesVisibleIf", { - /** - * An expression that returns true or false. It runs against each choices item and if for this item it returns true, then the item is visible otherwise the item becomes invisible. Please use {item} to get the current item value in the expression. - * @see visibleIf - * @see choicesEnableIf - */ - get: function () { - return this.getPropertyValue("choicesVisibleIf", ""); - }, - set: function (val) { - this.setPropertyValue("choicesVisibleIf", val); - this.filterItems(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "choicesEnableIf", { - /** - * An expression that returns true or false. It runs against each choices item and if for this item it returns true, then the item is enabled otherwise the item becomes disabled. Please use {item} to get the current item value in the expression. - * @see choicesVisibleIf - */ - get: function () { - return this.getPropertyValue("choicesEnableIf", ""); - }, - set: function (val) { - this.setPropertyValue("choicesEnableIf", val); - this.filterItems(); - }, - enumerable: false, - configurable: true - }); - QuestionSelectBase.prototype.runCondition = function (values, properties) { - _super.prototype.runCondition.call(this, values, properties); - this.runItemsEnableCondition(values, properties); - this.runItemsCondition(values, properties); - }; - QuestionSelectBase.prototype.isTextValue = function () { - return true; //for comments and others - }; - QuestionSelectBase.prototype.setDefaultValue = function () { - this.isSettingDefaultValue = - !this.isValueEmpty(this.defaultValue) && - this.hasUnknownValue(this.defaultValue); - this.prevCommentValue = undefined; - _super.prototype.setDefaultValue.call(this); - this.isSettingDefaultValue = false; - }; - QuestionSelectBase.prototype.getIsMultipleValue = function () { - return false; - }; - QuestionSelectBase.prototype.convertDefaultValue = function (val) { - if (val == null || val == undefined) - return val; - if (this.getIsMultipleValue()) { - if (!Array.isArray(val)) - return [val]; - } - else { - if (Array.isArray(val) && val.length > 0) - return val[0]; - } - return val; - }; - QuestionSelectBase.prototype.filterItems = function () { - if (this.isLoadingFromJson || - !this.data || - this.areInvisibleElementsShowing) - return false; - var values = this.getDataFilteredValues(); - var properties = this.getDataFilteredProperties(); - this.runItemsEnableCondition(values, properties); - return this.runItemsCondition(values, properties); - }; - QuestionSelectBase.prototype.runItemsCondition = function (values, properties) { - this.setConditionalChoicesRunner(); - var hasChanges = this.runConditionsForItems(values, properties); - if (!!this.filteredChoicesValue && - this.filteredChoicesValue.length === this.activeChoices.length) { - this.filteredChoicesValue = undefined; - } - if (hasChanges) { - this.onVisibleChoicesChanged(); - this.clearIncorrectValues(); - } - return hasChanges; - }; - QuestionSelectBase.prototype.runItemsEnableCondition = function (values, properties) { - var _this = this; - this.setConditionalEnableChoicesRunner(); - var hasChanged = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].runEnabledConditionsForItems(this.activeChoices, this.conditionChoicesEnableIfRunner, values, properties, function (item) { - return _this.onEnableItemCallBack(item); - }); - if (hasChanged) { - this.clearDisabledValues(); - } - this.onAfterRunItemsEnableCondition(); - }; - QuestionSelectBase.prototype.onAfterRunItemsEnableCondition = function () { }; - QuestionSelectBase.prototype.onEnableItemCallBack = function (item) { - return true; - }; - QuestionSelectBase.prototype.setConditionalChoicesRunner = function () { - if (this.choicesVisibleIf) { - if (!this.conditionChoicesVisibleIfRunner) { - this.conditionChoicesVisibleIfRunner = new _conditions__WEBPACK_IMPORTED_MODULE_7__["ConditionRunner"](this.choicesVisibleIf); - } - this.conditionChoicesVisibleIfRunner.expression = this.choicesVisibleIf; - } - else { - this.conditionChoicesVisibleIfRunner = null; - } - }; - QuestionSelectBase.prototype.setConditionalEnableChoicesRunner = function () { - if (this.choicesEnableIf) { - if (!this.conditionChoicesEnableIfRunner) { - this.conditionChoicesEnableIfRunner = new _conditions__WEBPACK_IMPORTED_MODULE_7__["ConditionRunner"](this.choicesEnableIf); - } - this.conditionChoicesEnableIfRunner.expression = this.choicesEnableIf; - } - else { - this.conditionChoicesEnableIfRunner = null; - } - }; - QuestionSelectBase.prototype.runConditionsForItems = function (values, properties) { - this.filteredChoicesValue = []; - return _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].runConditionsForItems(this.activeChoices, this.getFilteredChoices(), this.areInvisibleElementsShowing - ? null - : this.conditionChoicesVisibleIfRunner, values, properties, !this.survey || !this.survey.areInvisibleElementsShowing); - }; - QuestionSelectBase.prototype.getHasOther = function (val) { - return val === this.otherItem.value; - }; - Object.defineProperty(QuestionSelectBase.prototype, "validatedValue", { - get: function () { - return this.rendredValueToDataCore(this.value); - }, - enumerable: false, - configurable: true - }); - QuestionSelectBase.prototype.createRestful = function () { - return new _choicesRestful__WEBPACK_IMPORTED_MODULE_6__["ChoicesRestful"](); - }; - QuestionSelectBase.prototype.setNewRestfulProperty = function () { - this.setPropertyValue("choicesByUrl", this.createRestful()); - this.choicesByUrl.owner = this; - this.choicesByUrl.loadingOwner = this; - }; - QuestionSelectBase.prototype.getQuestionComment = function () { - if (!!this.commentValue) - return this.commentValue; - if (this.hasComment || this.getStoreOthersAsComment()) - return _super.prototype.getQuestionComment.call(this); - return this.commentValue; - }; - QuestionSelectBase.prototype.setQuestionComment = function (newValue) { - if (this.hasComment || this.getStoreOthersAsComment()) - _super.prototype.setQuestionComment.call(this, newValue); - else { - if (!this.isSettingComment && newValue != this.commentValue) { - this.isSettingComment = true; - this.commentValue = newValue; - if (this.isOtherSelected && !this.isRenderedValueSetting) { - this.value = this.rendredValueToData(this.renderedValue); - } - this.isSettingComment = false; - } - } - }; - QuestionSelectBase.prototype.clearValue = function () { - _super.prototype.clearValue.call(this); - this.prevCommentValue = undefined; - }; - QuestionSelectBase.prototype.updateCommentFromSurvey = function (newValue) { - _super.prototype.updateCommentFromSurvey.call(this, newValue); - this.prevCommentValue = undefined; - }; - Object.defineProperty(QuestionSelectBase.prototype, "renderedValue", { - get: function () { - return this.getPropertyValue("renderedValue", null); - }, - set: function (val) { - this.setPropertyValue("renderedValue", val); - var val = this.rendredValueToData(val); - if (!this.isTwoValueEquals(val, this.value)) { - this.value = val; - } - }, - enumerable: false, - configurable: true - }); - QuestionSelectBase.prototype.setQuestionValue = function (newValue, updateIsAnswered, updateComment) { - if (updateIsAnswered === void 0) { updateIsAnswered = true; } - if (updateComment === void 0) { updateComment = true; } - if (this.isLoadingFromJson || - this.isTwoValueEquals(this.value, newValue)) - return; - _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); - this.setPropertyValue("renderedValue", this.rendredValueFromData(newValue)); - if (this.hasComment || !updateComment) - return; - var isOtherSel = this.isOtherSelected; - if (isOtherSel && !!this.prevCommentValue) { - var oldComment = this.prevCommentValue; - this.prevCommentValue = undefined; - this.comment = oldComment; - } - if (!isOtherSel && !!this.comment) { - if (this.getStoreOthersAsComment()) { - this.prevCommentValue = this.comment; - } - this.comment = ""; - } - }; - QuestionSelectBase.prototype.setNewValue = function (newValue) { - newValue = this.valueFromData(newValue); - if ((!this.choicesByUrl.isRunning && - !this.choicesByUrl.isWaitingForParameters) || - !this.isValueEmpty(newValue)) { - this.cachedValueForUrlRequests = newValue; - } - _super.prototype.setNewValue.call(this, newValue); - }; - QuestionSelectBase.prototype.valueFromData = function (val) { - var choiceitem = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(this.activeChoices, val); - if (!!choiceitem) { - return choiceitem.value; - } - return _super.prototype.valueFromData.call(this, val); - }; - QuestionSelectBase.prototype.rendredValueFromData = function (val) { - if (this.getStoreOthersAsComment()) - return val; - return this.renderedValueFromDataCore(val); - }; - QuestionSelectBase.prototype.rendredValueToData = function (val) { - if (this.getStoreOthersAsComment()) - return val; - return this.rendredValueToDataCore(val); - }; - QuestionSelectBase.prototype.renderedValueFromDataCore = function (val) { - if (!this.hasUnknownValue(val, true, false)) - return this.valueFromData(val); - this.comment = val; - return this.otherItem.value; - }; - QuestionSelectBase.prototype.rendredValueToDataCore = function (val) { - if (val == this.otherItem.value && this.getQuestionComment()) { - val = this.getQuestionComment(); - } - return val; - }; - QuestionSelectBase.prototype.hasUnknownValue = function (val, includeOther, isFilteredChoices, checkEmptyValue) { - if (includeOther === void 0) { includeOther = false; } - if (isFilteredChoices === void 0) { isFilteredChoices = true; } - if (checkEmptyValue === void 0) { checkEmptyValue = false; } - if (!checkEmptyValue && this.isValueEmpty(val)) - return false; - if (includeOther && val == this.otherItem.value) - return false; - if (this.hasNone && val == this.noneItem.value) - return false; - var choices = isFilteredChoices - ? this.getFilteredChoices() - : this.activeChoices; - return _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(choices, val) == null; - }; - QuestionSelectBase.prototype.isValueDisabled = function (val) { - var itemValue = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(this.getFilteredChoices(), val); - return !!itemValue && !itemValue.isEnabled; - }; - Object.defineProperty(QuestionSelectBase.prototype, "choicesByUrl", { - /** - * Use this property to fill the choices from a RESTful service. - * @see choices - * @see ChoicesRestful - * @see [Example: RESTful Dropdown](https://surveyjs.io/Examples/Library/?id=questiontype-dropdownrestfull) - * @see [Docs: Fill Choices from a RESTful Service](https://surveyjs.io/Documentation/Library/?id=LibraryOverview#fill-the-choices-from-a-restful-service) - */ - get: function () { - return this.getPropertyValue("choicesByUrl"); - }, - set: function (val) { - if (!val) - return; - this.setNewRestfulProperty(); - this.choicesByUrl.fromJSON(val.toJSON()); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "choices", { - /** - * The list of items. Every item has value and text. If text is empty, the value is rendered. The item text supports markdown. - * @see choicesByUrl - * @see choicesFromQuestion - */ - get: function () { - return this.getPropertyValue("choices"); - }, - set: function (newValue) { - this.setPropertyValue("choices", newValue); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "choicesFromQuestion", { - /** - * Set this property to get choices from the specified question instead of defining them in the current question. This avoids duplication of choices declaration in your survey definition. - * By setting this property, the "choices", "choicesVisibleIf", "choicesEnableIf" and "choicesOrder" properties become invisible, because these question characteristics depend on actions in another (specified) question. - * Use the `choicesFromQuestionMode` property to filter choices obtained from the specified question. - * @see choices - * @see choicesFromQuestionMode - */ - get: function () { - return this.getPropertyValue("choicesFromQuestion"); - }, - set: function (val) { - var question = this.getQuestionWithChoices(); - if (!!question) { - question.removeFromDependedQuestion(this); - } - this.setPropertyValue("choicesFromQuestion", val); - }, - enumerable: false, - configurable: true - }); - QuestionSelectBase.prototype.addIntoDependedQuestion = function (question) { - if (!question || question.dependedQuestions.indexOf(this) > -1) - return; - question.dependedQuestions.push(this); - }; - QuestionSelectBase.prototype.removeFromDependedQuestion = function (question) { - if (!question) - return; - var index = question.dependedQuestions.indexOf(this); - if (index > -1) { - question.dependedQuestions.splice(index, 1); - } - }; - Object.defineProperty(QuestionSelectBase.prototype, "choicesFromQuestionMode", { - /** - * This property becomes visible when the `choicesFromQuestion` property is selected. The default value is "all" (all visible choices from another question are displayed as they are). - * You can set this property to "selected" or "unselected" to display only selected or unselected choices from the specified question. - * @see choicesFromQuestion - */ - get: function () { - return this.getPropertyValue("choicesFromQuestionMode"); - }, - set: function (val) { - this.setPropertyValue("choicesFromQuestionMode", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "hideIfChoicesEmpty", { - /** - * Set this property to true to hide the question if there is no visible choices. - */ - get: function () { - return this.getPropertyValue("hideIfChoicesEmpty", false); - }, - set: function (val) { - this.setPropertyValue("hideIfChoicesEmpty", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "keepIncorrectValues", { - get: function () { - return this.getPropertyValue("keepIncorrectValues", false); - }, - set: function (val) { - this.setPropertyValue("keepIncorrectValues", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "storeOthersAsComment", { - /** - * Please use survey.storeOthersAsComment to change the behavior on the survey level. This property is depricated and invisible in Survey Creator. - * By default the entered text in the others input in the checkbox/radiogroup/dropdown are stored as "question name " + "-Comment". The value itself is "question name": "others". Set this property to false, to store the entered text directly in the "question name" key. - * Possible values are: "default", true, false - * @see SurveyModel.storeOthersAsComment - */ - get: function () { - return this.getPropertyValue("storeOthersAsComment"); - }, - set: function (val) { - this.setPropertyValue("storeOthersAsComment", val); - }, - enumerable: false, - configurable: true - }); - QuestionSelectBase.prototype.hasOtherChanged = function () { - this.onVisibleChoicesChanged(); - }; - Object.defineProperty(QuestionSelectBase.prototype, "choicesOrder", { - /** - * Use this property to render items in a specific order: "asc", "desc", "random". Default value is "none". - */ - get: function () { - return this.getPropertyValue("choicesOrder"); - }, - set: function (val) { - val = val.toLowerCase(); - if (val == this.choicesOrder) - return; - this.setPropertyValue("choicesOrder", val); - this.onVisibleChoicesChanged(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "otherText", { - /** - * Use this property to set the different text for other item. - */ - get: function () { - return this.getLocalizableStringText("otherText", _surveyStrings__WEBPACK_IMPORTED_MODULE_4__["surveyLocalization"].getString("otherItemText")); - }, - set: function (val) { - this.setLocalizableStringText("otherText", val); - this.onVisibleChoicesChanged(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "locOtherText", { - get: function () { - return this.getLocalizableString("otherText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "otherPlaceHolder", { - /** - * Use this property to set the place holder text for other or comment field . - */ - get: function () { - return this.getLocalizableStringText("otherPlaceHolder"); - }, - set: function (val) { - this.setLocalizableStringText("otherPlaceHolder", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "locOtherPlaceHolder", { - get: function () { - return this.getLocalizableString("otherPlaceHolder"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "otherErrorText", { - /** - * The text that shows when the other item is choosed by the other input is empty. - */ - get: function () { - return this.getLocalizableStringText("otherErrorText", _surveyStrings__WEBPACK_IMPORTED_MODULE_4__["surveyLocalization"].getString("otherRequiredError")); - }, - set: function (val) { - this.setLocalizableStringText("otherErrorText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "locOtherErrorText", { - get: function () { - return this.getLocalizableString("otherErrorText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "visibleChoices", { - /** - * The list of items as they will be rendered. If needed items are sorted and the other item is added. - * @see hasOther - * @see choicesOrder - * @see enabledChoices - */ - get: function () { - return this.getPropertyValue("visibleChoices"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "enabledChoices", { - /** - * The list of enabled items as they will be rendered. The disabled items are not included - * @see hasOther - * @see choicesOrder - * @see visibleChoices - */ - get: function () { - var res = []; - var items = this.visibleChoices; - for (var i = 0; i < items.length; i++) { - if (items[i].isEnabled) - res.push(items[i]); - } - return res; - }, - enumerable: false, - configurable: true - }); - QuestionSelectBase.prototype.updateVisibleChoices = function () { - if (this.isLoadingFromJson) - return; - var newValue = new Array(); - var calcValue = this.calcVisibleChoices(); - if (!calcValue) - calcValue = []; - for (var i = 0; i < calcValue.length; i++) { - newValue.push(calcValue[i]); - } - this.setPropertyValue("visibleChoices", newValue); - }; - QuestionSelectBase.prototype.calcVisibleChoices = function () { - if (this.canUseFilteredChoices()) - return this.getFilteredChoices(); - var res = this.sortVisibleChoices(this.getFilteredChoices().slice()); - this.addToVisibleChoices(res, this.isAddDefaultItems); - return res; - }; - QuestionSelectBase.prototype.canUseFilteredChoices = function () { - return (!this.isAddDefaultItems && - !this.hasNone && - !this.hasOther && - this.choicesOrder == "none"); - }; - QuestionSelectBase.prototype.setCanShowOptionItemCallback = function (func) { - this.canShowOptionItemCallback = func; - if (!!func) { - this.onVisibleChoicesChanged(); - } - }; - QuestionSelectBase.prototype.addToVisibleChoices = function (items, isAddAll) { - if (isAddAll) { - if (!this.newItemValue) { - this.newItemValue = new _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"]("newitem"); //TODO - } - if (this.canShowOptionItem(this.newItemValue)) { - items.push(this.newItemValue); - } - } - if (this.supportOther() && - ((isAddAll && this.canShowOptionItem(this.otherItem)) || this.hasOther)) { - items.push(this.otherItem); - } - if (this.supportNone() && - ((isAddAll && this.canShowOptionItem(this.noneItem)) || this.hasNone)) { - items.push(this.noneItem); - } - }; - QuestionSelectBase.prototype.canShowOptionItem = function (item) { - if (!this.canShowOptionItemCallback) - return true; - return this.canShowOptionItemCallback(item); - }; - /** - * For internal use in SurveyJS Creator V2. - */ - QuestionSelectBase.prototype.isItemInList = function (item) { - if (item === this.otherItem) - return this.hasOther; - if (item === this.noneItem) - return this.hasNone; - if (item === this.newItemValue) - return false; - return true; - }; - Object.defineProperty(QuestionSelectBase.prototype, "isAddDefaultItems", { - get: function () { - return (_settings__WEBPACK_IMPORTED_MODULE_9__["settings"].supportCreatorV2 && this.isDesignMode && !this.isContentElement); - }, - enumerable: false, - configurable: true - }); - QuestionSelectBase.prototype.getPlainData = function (options) { - var _this = this; - if (options === void 0) { options = { - includeEmpty: true, - includeQuestionTypes: false, - }; } - var questionPlainData = _super.prototype.getPlainData.call(this, options); - if (!!questionPlainData) { - var values = Array.isArray(this.value) ? this.value : [this.value]; - questionPlainData.isNode = true; - questionPlainData.data = (questionPlainData.data || []).concat(values.map(function (dataValue, index) { - var choice = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(_this.visibleChoices, dataValue); - var choiceDataItem = { - name: index, - title: "Choice", - value: dataValue, - displayValue: _this.getChoicesDisplayValue(_this.visibleChoices, dataValue), - getString: function (val) { - return typeof val === "object" ? JSON.stringify(val) : val; - }, - isNode: false, - }; - if (!!choice) { - (options.calculations || []).forEach(function (calculation) { - choiceDataItem[calculation.propertyName] = - choice[calculation.propertyName]; - }); - } - if (_this.isOtherSelected && _this.otherItemValue === choice) { - choiceDataItem.isOther = true; - choiceDataItem.displayValue = _this.comment; - } - return choiceDataItem; - })); - } - return questionPlainData; - }; - /** - * Returns the text for the current value. If the value is null then returns empty string. If 'other' is selected then returns the text for other value. - */ - QuestionSelectBase.prototype.getDisplayValueCore = function (keysAsText, value) { - return this.getChoicesDisplayValue(this.visibleChoices, value); - }; - QuestionSelectBase.prototype.getDisplayValueEmpty = function () { - return _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getTextOrHtmlByValue(this.visibleChoices, undefined); - }; - QuestionSelectBase.prototype.getChoicesDisplayValue = function (items, val) { - if (val == this.otherItemValue.value) - return this.comment ? this.comment : this.locOtherText.textOrHtml; - var str = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getTextOrHtmlByValue(items, val); - return str == "" && val ? val : str; - }; - QuestionSelectBase.prototype.getFilteredChoices = function () { - return this.filteredChoicesValue - ? this.filteredChoicesValue - : this.activeChoices; - }; - Object.defineProperty(QuestionSelectBase.prototype, "activeChoices", { - get: function () { - var question = this.getQuestionWithChoices(); - if (!!question) { - this.addIntoDependedQuestion(question); - return this.getChoicesFromQuestion(question); - } - return this.choicesFromUrl ? this.choicesFromUrl : this.getChoices(); - }, - enumerable: false, - configurable: true - }); - QuestionSelectBase.prototype.getQuestionWithChoices = function () { - if (!this.choicesFromQuestion || !this.survey) - return null; - var res = this.survey.getQuestionByName(this.choicesFromQuestion); - return !!res && !!res.visibleChoices && res !== this ? res : null; - }; - QuestionSelectBase.prototype.getChoicesFromQuestion = function (question) { - var res = []; - var isSelected = this.choicesFromQuestionMode == "selected" - ? true - : this.choicesFromQuestionMode == "unselected" - ? false - : undefined; - var choices = question.visibleChoices; - for (var i = 0; i < choices.length; i++) { - if (this.isBuiltInChoice(choices[i], question)) - continue; - if (isSelected === undefined) { - res.push(choices[i]); - continue; - } - var itemsSelected = question.isItemSelected(choices[i]); - if ((itemsSelected && isSelected) || (!itemsSelected && !isSelected)) { - res.push(choices[i]); - } - } - return res; - }; - Object.defineProperty(QuestionSelectBase.prototype, "hasActiveChoices", { - get: function () { - var choices = this.visibleChoices; - if (!choices || choices.length == 0) { - this.onVisibleChoicesChanged(); - choices = this.visibleChoices; - } - for (var i = 0; i < choices.length; i++) { - if (!this.isBuiltInChoice(choices[i], this)) - return true; - } - return false; - }, - enumerable: false, - configurable: true - }); - QuestionSelectBase.prototype.isBuiltInChoice = function (item, question) { - return (item === question.noneItem || - item === question.otherItem || - item === question.newItemValue); - }; - QuestionSelectBase.prototype.getChoices = function () { - return this.choices; - }; - QuestionSelectBase.prototype.supportComment = function () { - return true; - }; - QuestionSelectBase.prototype.supportOther = function () { - return this.isSupportProperty("hasOther"); - }; - QuestionSelectBase.prototype.supportNone = function () { - return this.isSupportProperty("hasNone"); - }; - QuestionSelectBase.prototype.isSupportProperty = function (propName) { - return (!this.isDesignMode || - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].findProperty(this.getType(), propName).visible); - }; - QuestionSelectBase.prototype.onCheckForErrors = function (errors, isOnValueChanged) { - _super.prototype.onCheckForErrors.call(this, errors, isOnValueChanged); - if (!this.hasOther || !this.isOtherSelected || this.comment) - return; - errors.push(new _error__WEBPACK_IMPORTED_MODULE_5__["OtherEmptyError"](this.otherErrorText, this)); - }; - QuestionSelectBase.prototype.setSurveyImpl = function (value, isLight) { - _super.prototype.setSurveyImpl.call(this, value, isLight); - this.runChoicesByUrl(); - if (this.isAddDefaultItems) { - this.updateVisibleChoices(); - } - }; - QuestionSelectBase.prototype.setSurveyCore = function (value) { - _super.prototype.setSurveyCore.call(this, value); - if (!!value && !!this.choicesFromQuestion) { - this.onVisibleChoicesChanged(); - } - }; - QuestionSelectBase.prototype.getStoreOthersAsComment = function () { - if (this.isSettingDefaultValue) - return false; - return (this.storeOthersAsComment === true || - (this.storeOthersAsComment == "default" && - (this.survey != null ? this.survey.storeOthersAsComment : true)) || - (!this.choicesByUrl.isEmpty && !this.choicesFromUrl)); - }; - QuestionSelectBase.prototype.onSurveyLoad = function () { - this.runChoicesByUrl(); - this.onVisibleChoicesChanged(); - _super.prototype.onSurveyLoad.call(this); - }; - QuestionSelectBase.prototype.onAnyValueChanged = function (name) { - _super.prototype.onAnyValueChanged.call(this, name); - if (name != this.getValueName()) { - this.runChoicesByUrl(); - } - if (!!name && name == this.choicesFromQuestion) { - this.onVisibleChoicesChanged(); - } - }; - QuestionSelectBase.prototype.updateValueFromSurvey = function (newValue) { - var newComment = ""; - if (this.hasOther && - !this.isRunningChoices && - !this.choicesByUrl.isRunning && - this.getStoreOthersAsComment()) { - if (this.hasUnknownValue(newValue) && !this.getHasOther(newValue)) { - newComment = this.getCommentFromValue(newValue); - newValue = this.setOtherValueIntoValue(newValue); - } - else { - newComment = this.data.getComment(this.getValueName()); - } - } - _super.prototype.updateValueFromSurvey.call(this, newValue); - if (!!newComment) { - this.setNewComment(newComment); - } - }; - QuestionSelectBase.prototype.getCommentFromValue = function (newValue) { - return newValue; - }; - QuestionSelectBase.prototype.setOtherValueIntoValue = function (newValue) { - return this.otherItem.value; - }; - QuestionSelectBase.prototype.runChoicesByUrl = function () { - if (!this.choicesByUrl || this.isLoadingFromJson || this.isRunningChoices) - return; - var processor = this.surveyImpl - ? this.surveyImpl.getTextProcessor() - : this.textProcessor; - if (!processor) - processor = this.survey; - if (!processor) - return; - this.isReadyValue = this.isChoicesLoaded || this.choicesByUrl.isEmpty; - this.isRunningChoices = true; - this.choicesByUrl.run(processor); - this.isRunningChoices = false; - }; - QuestionSelectBase.prototype.onBeforeSendRequest = function () { - if (_settings__WEBPACK_IMPORTED_MODULE_9__["settings"].disableOnGettingChoicesFromWeb === true && !this.isReadOnly) { - this.enableOnLoadingChoices = true; - this.readOnly = true; - } - }; - QuestionSelectBase.prototype.onLoadChoicesFromUrl = function (array) { - if (this.enableOnLoadingChoices) { - this.readOnly = false; - } - if (!this.isReadOnly) { - var errors = []; - if (this.choicesByUrl && this.choicesByUrl.error) { - errors.push(this.choicesByUrl.error); - } - this.errors = errors; - } - var newChoices = null; - var checkCachedValuesOnExisting = true; - if (this.isFirstLoadChoicesFromUrl && - !this.cachedValueForUrlRequests && - this.defaultValue) { - this.cachedValueForUrlRequests = this.defaultValue; - checkCachedValuesOnExisting = false; - } - if (this.isValueEmpty(this.cachedValueForUrlRequests)) { - this.cachedValueForUrlRequests = this.value; - } - this.isFirstLoadChoicesFromUrl = false; - var cachedValues = this.createCachedValueForUrlRequests(this.cachedValueForUrlRequests, checkCachedValuesOnExisting); - if (array && (array.length > 0 || this.choicesByUrl.allowEmptyResponse)) { - newChoices = new Array(); - _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].setData(newChoices, array); - } - if (!!newChoices) { - for (var i = 0; i < newChoices.length; i++) { - newChoices[i].locOwner = this; - } - } - this.choicesFromUrl = newChoices; - this.filterItems(); - this.onVisibleChoicesChanged(); - if (newChoices) { - var newValue = this.updateCachedValueForUrlRequests(cachedValues, newChoices); - if (!!newValue && !this.isReadOnly) { - var hasChanged = !this.isTwoValueEquals(this.value, newValue.value); - try { - if (!this.isValueEmpty(newValue.value)) { - this.allowNotifyValueChanged = false; - this.setQuestionValue(undefined, true, false); - } - this.allowNotifyValueChanged = hasChanged; - if (hasChanged) { - this.value = newValue.value; - } - else { - this.setQuestionValue(newValue.value); - } - } - finally { - this.allowNotifyValueChanged = true; - } - } - } - this.choicesLoaded(); - }; - QuestionSelectBase.prototype.createCachedValueForUrlRequests = function (val, checkOnExisting) { - if (this.isValueEmpty(val)) - return null; - if (Array.isArray(val)) { - var res = []; - for (var i = 0; i < val.length; i++) { - res.push(this.createCachedValueForUrlRequests(val[i], true)); - } - return res; - } - var isExists = checkOnExisting ? !this.hasUnknownValue(val) : true; - return { value: val, isExists: isExists }; - }; - QuestionSelectBase.prototype.updateCachedValueForUrlRequests = function (val, newChoices) { - if (this.isValueEmpty(val)) - return null; - if (Array.isArray(val)) { - var res = []; - for (var i = 0; i < val.length; i++) { - var updatedValue = this.updateCachedValueForUrlRequests(val[i], newChoices); - if (updatedValue && !this.isValueEmpty(updatedValue.value)) { - var newValue = updatedValue.value; - var item = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(newChoices, updatedValue.value); - if (!!item) { - newValue = item.value; - } - res.push(newValue); - } - } - return { value: res }; - } - var value = val.isExists && this.hasUnknownValue(val.value) ? null : val.value; - var item = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(newChoices, value); - if (!!item) { - value = item.value; - } - return { value: value }; - }; - QuestionSelectBase.prototype.updateChoicesDependedQuestions = function () { - if (this.isUpdatingChoicesDependedQuestions) - return; - this.isUpdatingChoicesDependedQuestions = true; - for (var i = 0; i < this.dependedQuestions.length; i++) { - this.dependedQuestions[i].onVisibleChoicesChanged(); - this.dependedQuestions[i].updateChoicesDependedQuestions(); - } - this.isUpdatingChoicesDependedQuestions = false; - }; - QuestionSelectBase.prototype.onSurveyValueChanged = function (newValue) { - _super.prototype.onSurveyValueChanged.call(this, newValue); - if (this.isLoadingFromJson) - return; - this.updateChoicesDependedQuestions(); - }; - QuestionSelectBase.prototype.onVisibleChoicesChanged = function () { - if (this.isLoadingFromJson) - return; - this.updateVisibleChoices(); - this.updateVisibilityBasedOnChoices(); - if (!!this.visibleChoicesChangedCallback) { - this.visibleChoicesChangedCallback(); - } - this.updateChoicesDependedQuestions(); - }; - QuestionSelectBase.prototype.updateVisibilityBasedOnChoices = function () { - if (this.hideIfChoicesEmpty) { - var filteredChoices = this.getFilteredChoices(); - this.visible = !filteredChoices || filteredChoices.length > 0; - } - }; - QuestionSelectBase.prototype.sortVisibleChoices = function (array) { - var order = this.choicesOrder.toLowerCase(); - if (order == "asc") - return this.sortArray(array, 1); - if (order == "desc") - return this.sortArray(array, -1); - if (order == "random") - return this.randomizeArray(array); - return array; - }; - QuestionSelectBase.prototype.sortArray = function (array, mult) { - return array.sort(function (a, b) { - if (a.calculatedText < b.calculatedText) - return -1 * mult; - if (a.calculatedText > b.calculatedText) - return 1 * mult; - return 0; - }); - }; - QuestionSelectBase.prototype.randomizeArray = function (array) { - return _helpers__WEBPACK_IMPORTED_MODULE_8__["Helpers"].randomizeArray(array); - }; - QuestionSelectBase.prototype.clearIncorrectValues = function () { - if (this.keepIncorrectValues || this.isEmpty()) - return; - if (!!this.survey && - this.survey.questionCountByValueName(this.getValueName()) > 1) - return; - if (!!this.choicesByUrl && - !this.choicesByUrl.isEmpty && - (!this.choicesFromUrl || this.choicesFromUrl.length == 0)) - return; - if (this.clearIncorrectValuesCallback) { - this.clearIncorrectValuesCallback(); - } - else { - this.clearIncorrectValuesCore(); - } - }; - QuestionSelectBase.prototype.clearValueIfInvisible = function () { - _super.prototype.clearValueIfInvisible.call(this); - this.clearIncorrectValues(); - }; - /** - * Returns true if item is selected - * @param item checkbox or radio item value - */ - QuestionSelectBase.prototype.isItemSelected = function (item) { - return item.value === this.value; - }; - QuestionSelectBase.prototype.clearDisabledValues = function () { - if (!this.survey || !this.survey.clearValueOnDisableItems) - return; - this.clearDisabledValuesCore(); - }; - QuestionSelectBase.prototype.clearIncorrectValuesCore = function () { - var val = this.value; - if (this.canClearValueAnUnknow(val)) { - this.clearValue(); - } - }; - QuestionSelectBase.prototype.canClearValueAnUnknow = function (val) { - if (!this.getStoreOthersAsComment() && this.isOtherSelected) - return false; - return this.hasUnknownValue(val, true, true, true); - }; - QuestionSelectBase.prototype.clearDisabledValuesCore = function () { - if (this.isValueDisabled(this.value)) { - this.clearValue(); - } - }; - QuestionSelectBase.prototype.clearUnusedValues = function () { - _super.prototype.clearUnusedValues.call(this); - if (!this.isOtherSelected && !this.hasComment) { - this.comment = ""; - } - }; - QuestionSelectBase.prototype.getColumnClass = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() - .append(this.cssClasses.column) - .append("sv-q-column-" + this.colCount, this.hasColumns) - .toString(); - }; - QuestionSelectBase.prototype.getItemIndex = function (item) { - return this.visibleChoices.indexOf(item); - }; - QuestionSelectBase.prototype.getItemClass = function (item) { - var options = { item: item }; - var res = this.getItemClassCore(item, options); - options.css = res; - if (!!this.survey) { - this.survey.updateChoiceItemCss(this, options); - } - return options.css; - }; - QuestionSelectBase.prototype.getItemClassCore = function (item, options) { - var builder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() - .append(this.cssClasses.item) - .append(this.cssClasses.itemInline, !this.hasColumns && this.colCount === 0) - .append("sv-q-col-" + this.colCount, !this.hasColumns && this.colCount !== 0) - .append(this.cssClasses.itemOnError, this.errors.length > 0); - var isDisabled = this.isReadOnly || !item.isEnabled; - var isChecked = this.isItemSelected(item) || - (this.isOtherSelected && this.otherItem.value === item.value); - var allowHover = !isDisabled && !isChecked && !(!!this.survey && this.survey.isDesignMode); - var isNone = item === this.noneItem; - options.isDisabled = isDisabled; - options.isChecked = isChecked; - options.isNone = isNone; - return builder.append(this.cssClasses.itemDisabled, isDisabled) - .append(this.cssClasses.itemChecked, isChecked) - .append(this.cssClasses.itemHover, allowHover) - .append(this.cssClasses.itemNone, isNone) - .toString(); - }; - QuestionSelectBase.prototype.getLabelClass = function (item) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() - .append(this.cssClasses.label) - .append(this.cssClasses.labelChecked, this.isItemSelected(item)) - .toString(); - }; - QuestionSelectBase.prototype.getControlLabelClass = function (item) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() - .append(this.cssClasses.controlLabel) - .append(this.cssClasses.controlLabelChecked, this.isItemSelected(item)) - .toString() || undefined; - }; - Object.defineProperty(QuestionSelectBase.prototype, "columns", { - get: function () { - var columns = []; - var colCount = this.colCount; - if (this.hasColumns && this.visibleChoices.length > 0) { - if (_settings__WEBPACK_IMPORTED_MODULE_9__["settings"].showItemsInOrder == "column") { - var prevIndex = 0; - var leftElementsCount = this.visibleChoices.length % colCount; - for (var i = 0; i < colCount; i++) { - var column = []; - for (var j = prevIndex; j < prevIndex + Math.floor(this.visibleChoices.length / colCount); j++) { - column.push(this.visibleChoices[j]); - } - if (leftElementsCount > 0) { - leftElementsCount--; - column.push(this.visibleChoices[j]); - j++; - } - prevIndex = j; - columns.push(column); - } - } - else { - for (var i = 0; i < colCount; i++) { - var column = []; - for (var j = i; j < this.visibleChoices.length; j += colCount) { - column.push(this.visibleChoices[j]); - } - columns.push(column); - } - } - } - return columns; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSelectBase.prototype, "hasColumns", { - get: function () { - return this.colCount > 1; - }, - enumerable: false, - configurable: true - }); - QuestionSelectBase.prototype.choicesLoaded = function () { - this.isChoicesLoaded = true; - var oldIsReady = this.isReadyValue; - this.isReadyValue = true; - this.onReadyChanged && - this.onReadyChanged.fire(this, { - question: this, - isReady: true, - oldIsReady: oldIsReady, - }); - if (this.survey) { - this.survey.loadedChoicesFromServer(this); - } - }; - QuestionSelectBase.prototype.getItemValueWrapperComponentName = function (item) { - var survey = this.survey; - if (survey) { - return survey.getItemValueWrapperComponentName(item, this); - } - return _survey__WEBPACK_IMPORTED_MODULE_1__["SurveyModel"].TemplateRendererComponentName; - }; - QuestionSelectBase.prototype.getItemValueWrapperComponentData = function (item) { - var survey = this.survey; - if (survey) { - return survey.getItemValueWrapperComponentData(item, this); - } - return item; - }; - QuestionSelectBase.prototype.ariaItemChecked = function (item) { - return this.renderedValue === item.value ? "true" : "false"; - }; - QuestionSelectBase.prototype.isOtherItem = function (item) { - return this.hasOther && item.value == this.otherItem.value; - }; - Object.defineProperty(QuestionSelectBase.prototype, "itemSvgIcon", { - get: function () { - return this.survey.getCss().radiogroup.itemSvgIconId; - }, - enumerable: false, - configurable: true - }); - QuestionSelectBase.prototype.ariaItemLabel = function (item) { - return item.locText.renderedHtml; - }; - QuestionSelectBase.prototype.getItemId = function (item) { - return this.inputId + "_" + this.getItemIndex(item); - }; - Object.defineProperty(QuestionSelectBase.prototype, "questionName", { - get: function () { - return this.name + "_" + this.id; - }, - enumerable: false, - configurable: true - }); - QuestionSelectBase.prototype.getItemEnabled = function (item) { - return !this.isInputReadOnly && item.isEnabled; - }; - return QuestionSelectBase; - }(_question__WEBPACK_IMPORTED_MODULE_2__["Question"])); - - /** - * A base class for checkbox and radiogroup questions. It introduced a colCount property. - */ - var QuestionCheckboxBase = /** @class */ (function (_super) { - __extends(QuestionCheckboxBase, _super); - function QuestionCheckboxBase(name) { - return _super.call(this, name) || this; - } - Object.defineProperty(QuestionCheckboxBase.prototype, "colCount", { - /** - * The number of columns for radiogroup and checkbox questions. Items are rendred in one line if the value is 0. - */ - get: function () { - return this.getPropertyValue("colCount", this.isFlowLayout ? 0 : 1); - }, - set: function (value) { - if (value < 0 || value > 5 || this.isFlowLayout) - return; - this.setPropertyValue("colCount", value); - this.fireCallback(this.colCountChangedCallback); - }, - enumerable: false, - configurable: true - }); - QuestionCheckboxBase.prototype.onParentChanged = function () { - _super.prototype.onParentChanged.call(this); - if (this.isFlowLayout) { - this.setPropertyValue("colCount", null); - } - }; - QuestionCheckboxBase.prototype.onParentQuestionChanged = function () { - this.onVisibleChoicesChanged(); - }; - QuestionCheckboxBase.prototype.getSearchableItemValueKeys = function (keys) { - keys.push("choices"); - }; - return QuestionCheckboxBase; - }(QuestionSelectBase)); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("selectbase", [ - { name: "hasComment:switch", layout: "row" }, - { - name: "commentText", - dependsOn: "hasComment", - visibleIf: function (obj) { - return obj.hasComment; - }, - serializationProperty: "locCommentText", - layout: "row", - }, - "choicesFromQuestion:question_selectbase", - { - name: "choices:itemvalue[]", - baseValue: function () { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_4__["surveyLocalization"].getString("choices_Item"); - }, - dependsOn: "choicesFromQuestion", - visibleIf: function (obj) { - return !obj.choicesFromQuestion; - }, - }, - { - name: "choicesFromQuestionMode", - default: "all", - choices: ["all", "selected", "unselected"], - dependsOn: "choicesFromQuestion", - visibleIf: function (obj) { - return !!obj.choicesFromQuestion; - }, - }, - { - name: "choicesOrder", - default: "none", - choices: ["none", "asc", "desc", "random"], - dependsOn: "choicesFromQuestion", - visibleIf: function (obj) { - return !obj.choicesFromQuestion; - }, - }, - { - name: "choicesByUrl:restfull", - className: "ChoicesRestful", - onGetValue: function (obj) { - return obj.choicesByUrl.getData(); - }, - onSetValue: function (obj, value) { - obj.choicesByUrl.setData(value); - }, - }, - "hideIfChoicesEmpty:boolean", - { - name: "choicesVisibleIf:condition", - dependsOn: "choicesFromQuestion", - visibleIf: function (obj) { - return !obj.choicesFromQuestion; - }, - }, - { - name: "choicesEnableIf:condition", - dependsOn: "choicesFromQuestion", - visibleIf: function (obj) { - return !obj.choicesFromQuestion; - }, - }, - "hasOther:boolean", - "hasNone:boolean", - { - name: "otherPlaceHolder", - serializationProperty: "locOtherPlaceHolder", - dependsOn: "hasOther", - visibleIf: function (obj) { - return obj.hasOther; - }, - }, - { - name: "noneText", - serializationProperty: "locNoneText", - dependsOn: "hasNone", - visibleIf: function (obj) { - return obj.hasNone; - }, - }, - { - name: "otherText", - serializationProperty: "locOtherText", - dependsOn: "hasOther", - visibleIf: function (obj) { - return obj.hasOther; - }, - }, - { - name: "otherErrorText", - serializationProperty: "locOtherErrorText", - dependsOn: "hasOther", - visibleIf: function (obj) { - return obj.hasOther; - }, - }, - { - name: "storeOthersAsComment", - default: "default", - choices: ["default", true, false], - visible: false, - }, - ], null, "question"); - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("checkboxbase", [ - { - name: "colCount:number", - default: 1, - choices: [0, 1, 2, 3, 4, 5], - layout: "row", - }, - ], null, "selectbase"); - - - /***/ }), - - /***/ "./src/question_boolean.ts": - /*!*********************************!*\ - !*** ./src/question_boolean.ts ***! - \*********************************/ - /*! exports provided: QuestionBooleanModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionBooleanModel", function() { return QuestionBooleanModel; }); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - - - - - - /** - * A Model for a boolean question. - */ - var QuestionBooleanModel = /** @class */ (function (_super) { - __extends(QuestionBooleanModel, _super); - function QuestionBooleanModel(name) { - var _this = _super.call(this, name) || this; - _this.createLocalizableString("labelFalse", _this, true); - _this.createLocalizableString("labelTrue", _this, true); - _this.locLabelFalse.onGetTextCallback = function (text) { - return !!text - ? text - : _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("booleanUncheckedLabel"); - }; - _this.locLabelTrue.onGetTextCallback = function (text) { - return !!text - ? text - : _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("booleanCheckedLabel"); - }; - return _this; - } - QuestionBooleanModel.prototype.getType = function () { - return "boolean"; - }; - QuestionBooleanModel.prototype.isLayoutTypeSupported = function (layoutType) { - return true; - }; - QuestionBooleanModel.prototype.supportGoNextPageAutomatic = function () { - return this.renderAs !== "checkbox"; - }; - Object.defineProperty(QuestionBooleanModel.prototype, "isIndeterminate", { - /** - * Returns true if the question check will be rendered in indeterminate mode. value is empty. - */ - get: function () { - return this.isEmpty(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionBooleanModel.prototype, "hasTitle", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionBooleanModel.prototype, "checkedValue", { - /** - * Get/set question value in 3 modes: indeterminate (value is empty), true (check is set) and false (check is unset). - * @see valueTrue - * @see valueFalse - */ - get: function () { - if (this.isEmpty()) - return null; - return this.value == this.getValueTrue(); - }, - set: function (val) { - if (this.isReadOnly) { - return; - } - this.setCheckedValue(val); - }, - enumerable: false, - configurable: true - }); - QuestionBooleanModel.prototype.setCheckedValue = function (val) { - if (this.isValueEmpty(val)) { - this.value = null; - } - else { - this.value = val == true ? this.getValueTrue() : this.getValueFalse(); - } - }; - Object.defineProperty(QuestionBooleanModel.prototype, "defaultValue", { - /** - * Set the default state of the check: "indeterminate" - default (value is empty/null), "true" - value equals valueTrue or true, "false" - value equals valueFalse or false. - */ - get: function () { - return this.getPropertyValue("defaultValue"); - }, - set: function (val) { - if (val === true) - val = "true"; - if (val === false) - val = "false"; - this.setPropertyValue("defaultValue", val); - this.updateValueWithDefaults(); - }, - enumerable: false, - configurable: true - }); - QuestionBooleanModel.prototype.getDefaultValue = function () { - if (this.defaultValue == "indeterminate") - return null; - if (this.defaultValue === undefined) - return null; - return this.defaultValue == "true" - ? this.getValueTrue() - : this.getValueFalse(); - }; - Object.defineProperty(QuestionBooleanModel.prototype, "locTitle", { - get: function () { - return this.showTitle || this.isValueEmpty(this.locLabel.text) - ? this.getLocalizableString("title") - : this.locLabel; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionBooleanModel.prototype, "locDisplayLabel", { - get: function () { - if (this.locLabel.text) - return this.locLabel; - return this.showTitle ? this.locLabel : this.locTitle; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionBooleanModel.prototype, "labelTrue", { - /** - * Set this property, if you want to have a different label for state when check is set. - */ - get: function () { - return this.getLocalizableStringText("labelTrue"); - }, - set: function (val) { - this.setLocalizableStringText("labelTrue", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionBooleanModel.prototype, "locLabelTrue", { - get: function () { - return this.getLocalizableString("labelTrue"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionBooleanModel.prototype, "labelFalse", { - /** - * Set this property, if you want to have a different label for state when check is unset. - */ - get: function () { - return this.getLocalizableStringText("labelFalse"); - }, - set: function (val) { - this.setLocalizableStringText("labelFalse", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionBooleanModel.prototype, "locLabelFalse", { - get: function () { - return this.getLocalizableString("labelFalse"); - }, - enumerable: false, - configurable: true - }); - QuestionBooleanModel.prototype.getValueTrue = function () { - return this.valueTrue ? this.valueTrue : true; - }; - QuestionBooleanModel.prototype.getValueFalse = function () { - return this.valueFalse ? this.valueFalse : false; - }; - QuestionBooleanModel.prototype.setDefaultValue = function () { - if (this.defaultValue == "true" || this.defaultValue === this.valueTrue) - this.setCheckedValue(true); - if (this.defaultValue == "false" || this.defaultValue === this.valueFalse) - this.setCheckedValue(false); - if (this.defaultValue == "indeterminate") - this.setCheckedValue(null); - }; - QuestionBooleanModel.prototype.getDisplayValueCore = function (keysAsText, value) { - if (value == this.getValueTrue()) - return this.locLabelTrue.textOrHtml; - return this.locLabelFalse.textOrHtml; - }; - QuestionBooleanModel.prototype.getItemCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__["CssClassBuilder"]() - .append(this.cssClasses.item) - .append(this.cssClasses.itemOnError, this.errors.length > 0) - .append(this.cssClasses.itemDisabled, this.isReadOnly) - .append(this.cssClasses.itemChecked, !!this.checkedValue) - .append(this.cssClasses.itemIndeterminate, this.checkedValue === null) - .toString(); - }; - QuestionBooleanModel.prototype.getLabelCss = function (checked) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__["CssClassBuilder"]() - .append(this.cssClasses.label) - .append(this.cssClasses.disabledLabel, this.checkedValue === !checked || this.isReadOnly) - .toString(); - }; - Object.defineProperty(QuestionBooleanModel.prototype, "allowClick", { - get: function () { - return this.isIndeterminate && !this.isInputReadOnly; - }, - enumerable: false, - configurable: true - }); - QuestionBooleanModel.prototype.getCheckedLabel = function () { - if (this.checkedValue === true) { - return this.locLabelTrue; - } - else if (this.checkedValue === false) { - return this.locLabelFalse; - } - }; - /* #region web-based methods */ - QuestionBooleanModel.prototype.onLabelClick = function (event, value) { - if (this.allowClick) { - Object(_utils_utils__WEBPACK_IMPORTED_MODULE_5__["preventDefaults"])(event); - this.checkedValue = value; - } - return true; - }; - QuestionBooleanModel.prototype.onSwitchClickModel = function (event) { - if (this.allowClick) { - Object(_utils_utils__WEBPACK_IMPORTED_MODULE_5__["preventDefaults"])(event); - var isRightClick = event.offsetX / event.target.offsetWidth > 0.5; - var isRtl = document.defaultView.getComputedStyle(event.target).direction == "rtl"; - this.checkedValue = isRtl ? !isRightClick : isRightClick; - return; - } - return true; - }; - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: true }) - ], QuestionBooleanModel.prototype, "label", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() - ], QuestionBooleanModel.prototype, "showTitle", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() - ], QuestionBooleanModel.prototype, "valueTrue", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() - ], QuestionBooleanModel.prototype, "valueFalse", void 0); - return QuestionBooleanModel; - }(_question__WEBPACK_IMPORTED_MODULE_2__["Question"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("boolean", [ - { name: "label:text", serializationProperty: "locLabel" }, - { - name: "labelTrue:text", - serializationProperty: "locLabelTrue", - }, - { - name: "labelFalse:text", - serializationProperty: "locLabelFalse", - }, - "showTitle:boolean", - "valueTrue", - "valueFalse", - { name: "renderAs", default: "default", visible: false }, - ], function () { - return new QuestionBooleanModel(""); - }, "question"); - _questionfactory__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("boolean", function (name) { - return new QuestionBooleanModel(name); - }); - - - /***/ }), - - /***/ "./src/question_buttongroup.ts": - /*!*************************************!*\ - !*** ./src/question_buttongroup.ts ***! - \*************************************/ - /*! exports provided: ButtonGroupItemValue, QuestionButtonGroupModel, ButtonGroupItemModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ButtonGroupItemValue", function() { return ButtonGroupItemValue; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionButtonGroupModel", function() { return QuestionButtonGroupModel; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ButtonGroupItemModel", function() { return ButtonGroupItemModel; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); - /* harmony import */ var _question_baseselect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_baseselect */ "./src/question_baseselect.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - - - - var ButtonGroupItemValue = /** @class */ (function (_super) { - __extends(ButtonGroupItemValue, _super); - function ButtonGroupItemValue(value, text, typeName) { - if (text === void 0) { text = null; } - if (typeName === void 0) { typeName = "buttongroupitemvalue"; } - var _this = _super.call(this, value, text, typeName) || this; - _this.typeName = typeName; - return _this; - } - ButtonGroupItemValue.prototype.getType = function () { - return !!this.typeName ? this.typeName : "buttongroupitemvalue"; - }; - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])() - ], ButtonGroupItemValue.prototype, "iconName", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])() - ], ButtonGroupItemValue.prototype, "iconSize", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])() - ], ButtonGroupItemValue.prototype, "showCaption", void 0); - return ButtonGroupItemValue; - }(_itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"])); - - /** - * A Model for a button group question. - */ - var QuestionButtonGroupModel = /** @class */ (function (_super) { - __extends(QuestionButtonGroupModel, _super); - function QuestionButtonGroupModel(name) { - return _super.call(this, name) || this; - } - QuestionButtonGroupModel.prototype.getType = function () { - return "buttongroup"; - }; - QuestionButtonGroupModel.prototype.getItemValueType = function () { - return "buttongroupitemvalue"; - }; - QuestionButtonGroupModel.prototype.supportOther = function () { - return false; - }; - return QuestionButtonGroupModel; - }(_question_baseselect__WEBPACK_IMPORTED_MODULE_2__["QuestionCheckboxBase"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("buttongroup", [ - { - name: "choices:buttongroupitemvalue[]", - }, - ], function () { - return new QuestionButtonGroupModel(""); - }, "checkboxbase"); - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("buttongroupitemvalue", [ - { name: "showCaption:boolean", default: true }, - { name: "iconName:text" }, - { name: "iconSize:number" }, - ], function (value) { return new ButtonGroupItemValue(value); }, "itemvalue"); - // QuestionFactory.Instance.registerQuestion("buttongroup", name => { - // var q = new QuestionButtonGroupModel(name); - // q.choices = QuestionFactory.DefaultChoices; - // return q; - // }); - var ButtonGroupItemModel = /** @class */ (function () { - function ButtonGroupItemModel(question, item, index) { - this.question = question; - this.item = item; - this.index = index; - } - Object.defineProperty(ButtonGroupItemModel.prototype, "value", { - get: function () { - return this.item.value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "iconName", { - get: function () { - return this.item.iconName; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "iconSize", { - get: function () { - return this.item.iconSize || 24; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "caption", { - get: function () { - return this.item.locText; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "showCaption", { - get: function () { - return this.item.showCaption || this.item.showCaption === undefined; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "isRequired", { - get: function () { - return this.question.isRequired; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "selected", { - get: function () { - return this.question.isItemSelected(this.item); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "readOnly", { - get: function () { - return this.question.isInputReadOnly || !this.item.isEnabled; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "name", { - get: function () { - return this.question.name + "_" + this.question.id; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "id", { - get: function () { - return this.question.inputId + "_" + this.index; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "hasErrors", { - get: function () { - return this.question.errors.length > 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "describedBy", { - get: function () { - return this.question.errors.length > 0 - ? this.question.id + "_errors" - : null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "labelClass", { - get: function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__["CssClassBuilder"]() - .append(this.question.cssClasses.item) - .append(this.question.cssClasses.itemSelected, this.selected) - .append(this.question.cssClasses.itemHover, !this.readOnly && !this.selected) - .append(this.question.cssClasses.itemDisabled, this.question.isReadOnly || !this.item.isEnabled) - .toString(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ButtonGroupItemModel.prototype, "css", { - get: function () { - return { - label: this.labelClass, - icon: this.question.cssClasses.itemIcon, - control: this.question.cssClasses.itemControl, - caption: this.question.cssClasses.itemCaption, - decorator: this.question.cssClasses.itemDecorator, - }; - }, - enumerable: false, - configurable: true - }); - ButtonGroupItemModel.prototype.onChange = function () { - this.question.renderedValue = this.item.value; - }; - return ButtonGroupItemModel; - }()); - - - - /***/ }), - - /***/ "./src/question_checkbox.ts": - /*!**********************************!*\ - !*** ./src/question_checkbox.ts ***! - \**********************************/ - /*! exports provided: QuestionCheckboxModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCheckboxModel", function() { return QuestionCheckboxModel; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _question_baseselect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_baseselect */ "./src/question_baseselect.ts"); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - - - /** - * A Model for a checkbox question - */ - var QuestionCheckboxModel = /** @class */ (function (_super) { - __extends(QuestionCheckboxModel, _super); - function QuestionCheckboxModel(name) { - var _this = _super.call(this, name) || this; - _this.selectAllItemValue = new _itemvalue__WEBPACK_IMPORTED_MODULE_4__["ItemValue"]("selectall"); - _this.invisibleOldValues = {}; - _this.isChangingValueOnClearIncorrect = false; - var selectAllItemText = _this.createLocalizableString("selectAllText", _this, true); - selectAllItemText.onGetTextCallback = function (text) { - return !!text ? text : _surveyStrings__WEBPACK_IMPORTED_MODULE_5__["surveyLocalization"].getString("selectAllItemText"); - }; - _this.selectAllItem.locOwner = _this; - _this.selectAllItem.setLocText(selectAllItemText); - _this.registerFunctionOnPropertiesValueChanged(["hasSelectAll", "selectAllText"], function () { - _this.onVisibleChoicesChanged(); - }); - return _this; - } - Object.defineProperty(QuestionCheckboxModel.prototype, "ariaRole", { - get: function () { - return "group"; - }, - enumerable: false, - configurable: true - }); - QuestionCheckboxModel.prototype.getType = function () { - return "checkbox"; - }; - QuestionCheckboxModel.prototype.onCreating = function () { - _super.prototype.onCreating.call(this); - this.createNewArray("renderedValue"); - this.createNewArray("value"); - }; - QuestionCheckboxModel.prototype.getFirstInputElementId = function () { - return this.inputId + "_0"; - }; - Object.defineProperty(QuestionCheckboxModel.prototype, "selectAllItem", { - /** - * Returns the select all item. By using this property, you may change programmatically it's value and text. - * @see hasSelectAll - */ - get: function () { - return this.selectAllItemValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionCheckboxModel.prototype, "selectAllText", { - /** - * Use this property to set the different text for Select All item. - */ - get: function () { - return this.getLocalizableStringText("selectAllText", _surveyStrings__WEBPACK_IMPORTED_MODULE_5__["surveyLocalization"].getString("selectAllItemText")); - }, - set: function (val) { - this.setLocalizableStringText("selectAllText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionCheckboxModel.prototype, "locSelectAllText", { - get: function () { - return this.getLocalizableString("selectAllText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionCheckboxModel.prototype, "hasSelectAll", { - /** - * Set this property to true, to show the "Select All" item on the top. If end-user checks this item, then all items are checked. - */ - get: function () { - return this.getPropertyValue("hasSelectAll", false); - }, - set: function (val) { - this.setPropertyValue("hasSelectAll", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionCheckboxModel.prototype, "isAllSelected", { - /** - * Returns true if all items are selected - * @see toggleSelectAll - */ - get: function () { - var val = this.value; - if (!val || !Array.isArray(val)) - return false; - if (this.isItemSelected(this.noneItem)) - return false; - var allItemCount = this.visibleChoices.length; - if (this.hasOther) - allItemCount--; - if (this.hasNone) - allItemCount--; - if (this.hasSelectAll) - allItemCount--; - var selectedCount = val.length; - if (this.isItemSelected(this.otherItem)) - selectedCount--; - return selectedCount === allItemCount; - }, - set: function (val) { - if (val) { - this.selectAll(); - } - else { - this.clearValue(); - } - }, - enumerable: false, - configurable: true - }); - /** - * It will select all items, except other and none. If all items have been already selected then it will clear the value - * @see isAllSelected - * @see selectAll - */ - QuestionCheckboxModel.prototype.toggleSelectAll = function () { - this.isAllSelected = !this.isAllSelected; - }; - /** - * Select all items, except other and none. - */ - QuestionCheckboxModel.prototype.selectAll = function () { - var val = []; - for (var i = 0; i < this.visibleChoices.length; i++) { - var item = this.visibleChoices[i]; - if (item === this.noneItem || - item === this.otherItem || - item === this.selectAllItem) - continue; - val.push(item.value); - } - this.value = val; - }; - /** - * Returns true if item is checked - * @param item checkbox item value - */ - QuestionCheckboxModel.prototype.isItemSelected = function (item) { - if (item === this.selectAllItem) - return this.isAllSelected; - var val = this.renderedValue; - if (!val || !Array.isArray(val)) - return false; - for (var i = 0; i < val.length; i++) { - if (this.isTwoValueEquals(val[i], item.value)) - return true; - } - return false; - }; - Object.defineProperty(QuestionCheckboxModel.prototype, "maxSelectedChoices", { - /** - * Set this property different to 0 to limit the number of selected choices in the checkbox. - */ - get: function () { - return this.getPropertyValue("maxSelectedChoices"); - }, - set: function (val) { - if (val < 0) - val = 0; - this.setPropertyValue("maxSelectedChoices", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionCheckboxModel.prototype, "selectedItems", { - /** - * Return the selected items in the checkbox. Returns empty array if the value is empty - */ - get: function () { - if (this.isEmpty()) - return []; - var val = this.value; - var res = []; - for (var i = 0; i < val.length; i++) { - res.push(_itemvalue__WEBPACK_IMPORTED_MODULE_4__["ItemValue"].getItemByValue(this.visibleChoices, val[i])); - } - return res; - }, - enumerable: false, - configurable: true - }); - QuestionCheckboxModel.prototype.onEnableItemCallBack = function (item) { - if (!this.shouldCheckMaxSelectedChoices()) - return true; - return this.isItemSelected(item); - }; - QuestionCheckboxModel.prototype.onAfterRunItemsEnableCondition = function () { - if (this.maxSelectedChoices < 1) - return; - if (this.hasSelectAll) { - this.selectAllItem.setIsEnabled(this.maxSelectedChoices >= this.activeChoices.length); - } - if (this.hasOther) { - this.otherItem.setIsEnabled(!this.shouldCheckMaxSelectedChoices() || this.isOtherSelected); - } - }; - QuestionCheckboxModel.prototype.shouldCheckMaxSelectedChoices = function () { - if (this.maxSelectedChoices < 1) - return false; - var val = this.value; - var len = !Array.isArray(val) ? 0 : val.length; - return len >= this.maxSelectedChoices; - }; - QuestionCheckboxModel.prototype.getItemClassCore = function (item, options) { - this.value; //trigger dependencies from koValue for knockout - options.isSelectAllItem = item === this.selectAllItem; - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]() - .append(_super.prototype.getItemClassCore.call(this, item, options)) - .append(this.cssClasses.itemSelectAll, options.isSelectAllItem) - .toString(); - }; - QuestionCheckboxModel.prototype.updateValueFromSurvey = function (newValue) { - _super.prototype.updateValueFromSurvey.call(this, newValue); - this.invisibleOldValues = []; - }; - QuestionCheckboxModel.prototype.setNewValue = function (newValue) { - if (!this.isChangingValueOnClearIncorrect) { - this.invisibleOldValues = []; - } - newValue = this.valueFromData(newValue); - var value = this.value; - if (!newValue) - newValue = []; - if (!value) - value = []; - if (this.isTwoValueEquals(value, newValue)) - return; - if (this.hasNone) { - var prevNoneIndex = this.noneIndexInArray(value); - var newNoneIndex = this.noneIndexInArray(newValue); - if (prevNoneIndex > -1) { - if (newNoneIndex > -1 && newValue.length > 1) { - newValue.splice(newNoneIndex, 1); - } - } - else { - if (newNoneIndex > -1) { - newValue.splice(0, newValue.length); - newValue.push(this.noneItem.value); - } - } - } - _super.prototype.setNewValue.call(this, this.rendredValueToData(newValue)); - }; - QuestionCheckboxModel.prototype.getIsMultipleValue = function () { - return true; - }; - QuestionCheckboxModel.prototype.getCommentFromValue = function (newValue) { - var ind = this.getFirstUnknownIndex(newValue); - if (ind < 0) - return ""; - return newValue[ind]; - }; - QuestionCheckboxModel.prototype.setOtherValueIntoValue = function (newValue) { - var ind = this.getFirstUnknownIndex(newValue); - if (ind < 0) - return newValue; - newValue.splice(ind, 1, this.otherItem.value); - return newValue; - }; - QuestionCheckboxModel.prototype.getFirstUnknownIndex = function (newValue) { - if (!Array.isArray(newValue)) - return -1; - for (var i = 0; i < newValue.length; i++) { - if (this.hasUnknownValue(newValue[i])) - return i; - } - return -1; - }; - QuestionCheckboxModel.prototype.noneIndexInArray = function (val) { - if (!val || !Array.isArray(val)) - return -1; - var noneValue = this.noneItem.value; - for (var i = 0; i < val.length; i++) { - if (val[i] == noneValue) - return i; - } - return -1; - }; - QuestionCheckboxModel.prototype.canUseFilteredChoices = function () { - return !this.hasSelectAll && _super.prototype.canUseFilteredChoices.call(this); - }; - QuestionCheckboxModel.prototype.supportSelectAll = function () { - return this.isSupportProperty("hasSelectAll"); - }; - QuestionCheckboxModel.prototype.addToVisibleChoices = function (items, isAddAll) { - if (this.supportSelectAll() && - ((isAddAll && this.canShowOptionItem(this.selectAllItem)) || - this.hasSelectAll)) { - items.unshift(this.selectAllItem); - } - _super.prototype.addToVisibleChoices.call(this, items, isAddAll); - }; - QuestionCheckboxModel.prototype.isBuiltInChoice = function (item, question) { - return (item === question.selectAllItem || - _super.prototype.isBuiltInChoice.call(this, item, question)); - }; - /** - * For internal use in SurveyJS Creator V2. - */ - QuestionCheckboxModel.prototype.isItemInList = function (item) { - if (item == this.selectAllItem) - return this.hasSelectAll; - return _super.prototype.isItemInList.call(this, item); - }; - QuestionCheckboxModel.prototype.getDisplayValueCore = function (keysAsText, value) { - if (!Array.isArray(value)) - return _super.prototype.getDisplayValueCore.call(this, keysAsText, value); - var items = this.visibleChoices; - var str = ""; - for (var i = 0; i < value.length; i++) { - var valStr = this.getChoicesDisplayValue(items, value[i]); - if (valStr) { - if (str) - str += ", "; - str += valStr; - } - } - return str; - }; - QuestionCheckboxModel.prototype.clearIncorrectValuesCore = function () { - this.clearIncorrectAndDisabledValues(false); - }; - QuestionCheckboxModel.prototype.clearDisabledValuesCore = function () { - this.clearIncorrectAndDisabledValues(true); - }; - QuestionCheckboxModel.prototype.clearIncorrectAndDisabledValues = function (clearDisabled) { - var val = this.value; - var hasChanged = false; - var restoredValues = this.restoreValuesFromInvisible(); - if (!val && restoredValues.length == 0) - return; - if (!Array.isArray(val) || val.length == 0) { - this.isChangingValueOnClearIncorrect = true; - if (!clearDisabled) { - if (this.hasComment) { - this.value = null; - } - else { - this.clearValue(); - } - } - this.isChangingValueOnClearIncorrect = false; - if (restoredValues.length == 0) - return; - val = []; - } - var newValue = []; - for (var i = 0; i < val.length; i++) { - var isUnkown = this.canClearValueAnUnknow(val[i]); - if ((!clearDisabled && !isUnkown) || - (clearDisabled && !this.isValueDisabled(val[i]))) { - newValue.push(val[i]); - } - else { - hasChanged = true; - if (isUnkown) { - this.invisibleOldValues[val[i]] = true; - } - } - } - for (var i = 0; i < restoredValues.length; i++) { - newValue.push(restoredValues[i]); - hasChanged = true; - } - if (!hasChanged) - return; - this.isChangingValueOnClearIncorrect = true; - if (newValue.length == 0) { - this.clearValue(); - } - else { - this.value = newValue; - } - this.isChangingValueOnClearIncorrect = false; - }; - QuestionCheckboxModel.prototype.restoreValuesFromInvisible = function () { - var res = []; - var visItems = this.visibleChoices; - for (var i = 0; i < visItems.length; i++) { - var val = visItems[i].value; - if (this.invisibleOldValues[val]) { - res.push(val); - delete this.invisibleOldValues[val]; - } - } - return res; - }; - QuestionCheckboxModel.prototype.getConditionJson = function (operator, path) { - if (operator === void 0) { operator = null; } - var json = _super.prototype.getConditionJson.call(this); - if (operator == "contains" || operator == "notcontains") { - json["type"] = "radiogroup"; - } - return json; - }; - QuestionCheckboxModel.prototype.isAnswerCorrect = function () { - return _helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].isArrayContainsEqual(this.value, this.correctAnswer); - }; - QuestionCheckboxModel.prototype.setDefaultValueWithOthers = function () { - this.value = this.renderedValueFromDataCore(this.defaultValue); - }; - QuestionCheckboxModel.prototype.getHasOther = function (val) { - if (!val || !Array.isArray(val)) - return false; - return val.indexOf(this.otherItem.value) >= 0; - }; - QuestionCheckboxModel.prototype.valueFromData = function (val) { - if (!val) - return val; - if (!Array.isArray(val)) - return [_super.prototype.valueFromData.call(this, val)]; - var value = []; - for (var i = 0; i < val.length; i++) { - var choiceitem = _itemvalue__WEBPACK_IMPORTED_MODULE_4__["ItemValue"].getItemByValue(this.activeChoices, val[i]); - if (!!choiceitem) { - value.push(choiceitem.value); - } - else { - value.push(val[i]); - } - } - return value; - }; - QuestionCheckboxModel.prototype.renderedValueFromDataCore = function (val) { - if (!val || !Array.isArray(val)) - val = []; - if (!this.hasActiveChoices) - return val; - for (var i = 0; i < val.length; i++) { - if (val[i] == this.otherItem.value) - return val; - if (this.hasUnknownValue(val[i], true, false)) { - this.comment = val[i]; - var newVal = val.slice(); - newVal[i] = this.otherItem.value; - return newVal; - } - } - return val; - }; - QuestionCheckboxModel.prototype.rendredValueToDataCore = function (val) { - if (!val || !val.length) - return val; - for (var i = 0; i < val.length; i++) { - if (val[i] == this.otherItem.value) { - if (this.getQuestionComment()) { - var newVal = val.slice(); - newVal[i] = this.getQuestionComment(); - return newVal; - } - } - } - return val; - }; - Object.defineProperty(QuestionCheckboxModel.prototype, "checkBoxSvgPath", { - get: function () { - return "M5,13l2-2l3,3l7-7l2,2l-9,9L5,13z"; - }, - enumerable: false, - configurable: true - }); - return QuestionCheckboxModel; - }(_question_baseselect__WEBPACK_IMPORTED_MODULE_2__["QuestionCheckboxBase"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("checkbox", [ - "hasSelectAll:boolean", - { name: "maxSelectedChoices:number", default: 0 }, - { - name: "selectAllText", - serializationProperty: "locSelectAllText", - dependsOn: "hasSelectAll", - visibleIf: function (obj) { - return obj.hasSelectAll; - } - } - ], function () { - return new QuestionCheckboxModel(""); - }, "checkboxbase"); - _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("checkbox", function (name) { - var q = new QuestionCheckboxModel(name); - q.choices = _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].DefaultChoices; - return q; - }); - - - /***/ }), - - /***/ "./src/question_comment.ts": - /*!*********************************!*\ - !*** ./src/question_comment.ts ***! - \*********************************/ - /*! exports provided: QuestionCommentModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCommentModel", function() { return QuestionCommentModel; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _question_textbase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_textbase */ "./src/question_textbase.ts"); - /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - /** - * A Model for a comment question - */ - var QuestionCommentModel = /** @class */ (function (_super) { - __extends(QuestionCommentModel, _super); - function QuestionCommentModel() { - return _super !== null && _super.apply(this, arguments) || this; - } - Object.defineProperty(QuestionCommentModel.prototype, "rows", { - /** - * The html rows attribute. - */ - get: function () { - return this.getPropertyValue("rows"); - }, - set: function (val) { - this.setPropertyValue("rows", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionCommentModel.prototype, "cols", { - /** - * The html cols attribute. - */ - get: function () { - return this.getPropertyValue("cols"); - }, - set: function (val) { - this.setPropertyValue("cols", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionCommentModel.prototype, "acceptCarriageReturn", { - /** - * Accepts pressing the Enter key by end-users and accepts carriage return symbols - \n - in the question value assigned. - */ - get: function () { - return this.getPropertyValue("acceptCarriageReturn"); - }, - set: function (val) { - this.setPropertyValue("acceptCarriageReturn", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionCommentModel.prototype, "autoGrow", { - /** - * Specifies whether the question's text area automatically expands its height to avoid the vertical scrollbar and to display the entire multi-line contents entered by respondents. - * Default value is false. - * @see SurveyModel.autoGrowComment - */ - get: function () { - return this.getPropertyValue("autoGrow") || (this.survey && this.survey.autoGrowComment); - }, - set: function (val) { - this.setPropertyValue("autoGrow", val); - }, - enumerable: false, - configurable: true - }); - QuestionCommentModel.prototype.getType = function () { - return "comment"; - }; - QuestionCommentModel.prototype.afterRenderQuestionElement = function (el) { - this.element = document.getElementById(this.inputId) || el; - this.updateElement(); - _super.prototype.afterRenderQuestionElement.call(this, el); - }; - QuestionCommentModel.prototype.updateElement = function () { - var _this = this; - if (this.element && this.autoGrow) { - setTimeout(function () { return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["increaseHeightByContent"])(_this.element); }, 1); - } - }; - QuestionCommentModel.prototype.onInput = function (event) { - if (this.isInputTextUpdate) - this.value = event.target.value; - else - this.updateElement(); - }; - QuestionCommentModel.prototype.onKeyDown = function (event) { - if (!this.acceptCarriageReturn && (event.key === "Enter" || event.keyCode === 13)) { - event.preventDefault(); - event.stopPropagation(); - } - }; - QuestionCommentModel.prototype.onValueChanged = function () { - _super.prototype.onValueChanged.call(this); - this.updateElement(); - }; - QuestionCommentModel.prototype.setNewValue = function (newValue) { - if (!this.acceptCarriageReturn && !!newValue) { - // eslint-disable-next-line no-control-regex - newValue = newValue.replace(new RegExp("(\r\n|\n|\r)", "gm"), ""); - } - _super.prototype.setNewValue.call(this, newValue); - }; - Object.defineProperty(QuestionCommentModel.prototype, "className", { - get: function () { - return (this.cssClasses ? this.getControlClass() : "panel-comment-root") || undefined; - }, - enumerable: false, - configurable: true - }); - return QuestionCommentModel; - }(_question_textbase__WEBPACK_IMPORTED_MODULE_2__["QuestionTextBase"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("comment", [ - { name: "maxLength:number", default: -1 }, - { name: "cols:number", default: 50 }, - { name: "rows:number", default: 4 }, - { name: "placeHolder", serializationProperty: "locPlaceHolder" }, - { - name: "textUpdateMode", - default: "default", - choices: ["default", "onBlur", "onTyping"], - }, - { name: "autoGrow:boolean" }, - { name: "acceptCarriageReturn:boolean", default: true, visible: false } - ], function () { - return new QuestionCommentModel(""); - }, "textbase"); - _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("comment", function (name) { - return new QuestionCommentModel(name); - }); - - - /***/ }), - - /***/ "./src/question_custom.ts": - /*!********************************!*\ - !*** ./src/question_custom.ts ***! - \********************************/ - /*! exports provided: ComponentQuestionJSON, ComponentCollection, QuestionCustomModelBase, QuestionCustomModel, QuestionCompositeModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentQuestionJSON", function() { return ComponentQuestionJSON; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentCollection", function() { return ComponentCollection; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCustomModelBase", function() { return QuestionCustomModelBase; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCustomModel", function() { return QuestionCustomModel; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCompositeModel", function() { return QuestionCompositeModel; }); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _textPreProcessor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./textPreProcessor */ "./src/textPreProcessor.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - var ComponentQuestionJSON = /** @class */ (function () { - function ComponentQuestionJSON(name, json) { - this.name = name; - this.json = json; - var self = this; - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass(name, [], function (json) { - return ComponentCollection.Instance.createQuestion(!!json ? json.name : "", self); - }, "question"); - this.onInit(); - } - ComponentQuestionJSON.prototype.onInit = function () { - if (!this.json.onInit) - return; - this.json.onInit(); - }; - ComponentQuestionJSON.prototype.onCreated = function (question) { - if (!this.json.onCreated) - return; - this.json.onCreated(question); - }; - ComponentQuestionJSON.prototype.onLoaded = function (question) { - if (!this.json.onLoaded) - return; - this.json.onLoaded(question); - }; - ComponentQuestionJSON.prototype.onAfterRender = function (question, htmlElement) { - if (!this.json.onAfterRender) - return; - this.json.onAfterRender(question, htmlElement); - }; - ComponentQuestionJSON.prototype.onAfterRenderContentElement = function (question, element, htmlElement) { - if (!this.json.onAfterRenderContentElement) - return; - this.json.onAfterRenderContentElement(question, element, htmlElement); - }; - ComponentQuestionJSON.prototype.onPropertyChanged = function (question, propertyName, newValue) { - if (!this.json.onPropertyChanged) - return; - this.json.onPropertyChanged(question, propertyName, newValue); - }; - ComponentQuestionJSON.prototype.onValueChanged = function (question, name, newValue) { - if (!this.json.onValueChanged) - return; - this.json.onValueChanged(question, name, newValue); - }; - ComponentQuestionJSON.prototype.onItemValuePropertyChanged = function (question, item, propertyName, name, newValue) { - if (!this.json.onItemValuePropertyChanged) - return; - this.json.onItemValuePropertyChanged(question, { - obj: item, - propertyName: propertyName, - name: name, - newValue: newValue, - }); - }; - ComponentQuestionJSON.prototype.getDisplayValue = function (keyAsText, value, question) { - if (!this.json.getDisplayValue) - return question.getDisplayValue(keyAsText, value); - return this.json.getDisplayValue(question); - }; - Object.defineProperty(ComponentQuestionJSON.prototype, "isComposite", { - get: function () { - return !!this.json.elementsJSON || !!this.json.createElements; - }, - enumerable: false, - configurable: true - }); - return ComponentQuestionJSON; - }()); - - var ComponentCollection = /** @class */ (function () { - function ComponentCollection() { - this.customQuestionValues = []; - } - ComponentCollection.prototype.add = function (json) { - if (!json) - return; - var name = json.name; - if (!name) { - throw "Attribute name is missed"; - } - name = name.toLowerCase(); - if (!!this.getCustomQuestionByName(name)) { - throw "There is already registered custom question with name '" + - name + - "'"; - } - if (!!_jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].findClass(name)) { - throw "There is already class with name '" + name + "'"; - } - var customQuestion = new ComponentQuestionJSON(name, json); - if (!!this.onAddingJson) - this.onAddingJson(name, customQuestion.isComposite); - this.customQuestionValues.push(customQuestion); - }; - Object.defineProperty(ComponentCollection.prototype, "items", { - get: function () { - return this.customQuestionValues; - }, - enumerable: false, - configurable: true - }); - ComponentCollection.prototype.getCustomQuestionByName = function (name) { - for (var i = 0; i < this.customQuestionValues.length; i++) { - if (this.customQuestionValues[i].name == name) - return this.customQuestionValues[i]; - } - return null; - }; - ComponentCollection.prototype.clear = function () { - for (var i = 0; i < this.customQuestionValues.length; i++) { - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].removeClass(this.customQuestionValues[i].name); - } - this.customQuestionValues = []; - }; - ComponentCollection.prototype.createQuestion = function (name, questionJSON) { - if (!!questionJSON.isComposite) - return this.createCompositeModel(name, questionJSON); - return this.createCustomModel(name, questionJSON); - }; - ComponentCollection.prototype.createCompositeModel = function (name, questionJSON) { - if (!!this.onCreateComposite) - return this.onCreateComposite(name, questionJSON); - return new QuestionCompositeModel(name, questionJSON); - }; - ComponentCollection.prototype.createCustomModel = function (name, questionJSON) { - if (!!this.onCreateCustom) - return this.onCreateCustom(name, questionJSON); - return new QuestionCustomModel(name, questionJSON); - }; - ComponentCollection.Instance = new ComponentCollection(); - return ComponentCollection; - }()); - - var QuestionCustomModelBase = /** @class */ (function (_super) { - __extends(QuestionCustomModelBase, _super); - function QuestionCustomModelBase(name, customQuestion) { - var _this = _super.call(this, name) || this; - _this.customQuestion = customQuestion; - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["CustomPropertiesCollection"].createProperties(_this); - _survey_element__WEBPACK_IMPORTED_MODULE_2__["SurveyElement"].CreateDisabledDesignElements = true; - _this.createWrapper(); - _survey_element__WEBPACK_IMPORTED_MODULE_2__["SurveyElement"].CreateDisabledDesignElements = false; - if (!!_this.customQuestion) { - _this.customQuestion.onCreated(_this); - } - return _this; - } - QuestionCustomModelBase.prototype.getType = function () { - return !!this.customQuestion ? this.customQuestion.name : "custom"; - }; - QuestionCustomModelBase.prototype.locStrsChanged = function () { - _super.prototype.locStrsChanged.call(this); - if (!!this.getElement()) { - this.getElement().locStrsChanged(); - } - }; - QuestionCustomModelBase.prototype.createWrapper = function () { }; - QuestionCustomModelBase.prototype.onPropertyValueChanged = function (name, oldValue, newValue) { - _super.prototype.onPropertyValueChanged.call(this, name, oldValue, newValue); - if (!!this.customQuestion && !this.isLoadingFromJson) { - this.customQuestion.onPropertyChanged(this, name, newValue); - } - }; - QuestionCustomModelBase.prototype.itemValuePropertyChanged = function (item, name, oldValue, newValue) { - _super.prototype.itemValuePropertyChanged.call(this, item, name, oldValue, newValue); - if (!!this.customQuestion && !this.isLoadingFromJson) { - this.customQuestion.onItemValuePropertyChanged(this, item, item.ownerPropertyName, name, newValue); - } - }; - QuestionCustomModelBase.prototype.onFirstRendering = function () { - var el = this.getElement(); - if (!!el) { - el.onFirstRendering(); - } - _super.prototype.onFirstRendering.call(this); - }; - QuestionCustomModelBase.prototype.initElement = function (el) { - if (!el) - return; - el.setSurveyImpl(this); - el.disableDesignActions = true; - }; - QuestionCustomModelBase.prototype.setSurveyImpl = function (value, isLight) { - _super.prototype.setSurveyImpl.call(this, value, isLight); - this.initElement(this.getElement()); - }; - QuestionCustomModelBase.prototype.onSurveyLoad = function () { - _super.prototype.onSurveyLoad.call(this); - if (!!this.getElement()) { - this.getElement().onSurveyLoad(); - this.customQuestion.onLoaded(this); - } - }; - QuestionCustomModelBase.prototype.afterRenderQuestionElement = function (el) { - //Do nothing - }; - QuestionCustomModelBase.prototype.afterRender = function (el) { - _super.prototype.afterRender.call(this, el); - if (!!this.customQuestion) { - this.customQuestion.onAfterRender(this, el); - } - }; - QuestionCustomModelBase.prototype.setQuestionValue = function (newValue, updateIsAnswered) { - if (updateIsAnswered === void 0) { updateIsAnswered = true; } - _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); - this.updateElementCss(); - }; - QuestionCustomModelBase.prototype.setNewValue = function (newValue) { - _super.prototype.setNewValue.call(this, newValue); - this.updateElementCss(); - }; - //ISurveyImpl - QuestionCustomModelBase.prototype.getSurveyData = function () { - return this; - }; - // getSurvey(): ISurvey { - // return this.survey; - // } - QuestionCustomModelBase.prototype.getTextProcessor = function () { - return this.textProcessor; - }; - //ISurveyData - QuestionCustomModelBase.prototype.getValue = function (name) { - return this.value; - }; - QuestionCustomModelBase.prototype.setValue = function (name, newValue, locNotification, allowNotifyValueChanged) { - if (!this.data) - return; - var newName = this.convertDataName(name); - this.data.setValue(newName, this.convertDataValue(name, newValue), locNotification, allowNotifyValueChanged); - this.updateIsAnswered(); - this.updateElementCss(); - if (!!this.customQuestion) { - this.customQuestion.onValueChanged(this, name, newValue); - } - }; - QuestionCustomModelBase.prototype.convertDataName = function (name) { - return this.getValueName(); - }; - QuestionCustomModelBase.prototype.convertDataValue = function (name, newValue) { - return newValue; - }; - QuestionCustomModelBase.prototype.getVariable = function (name) { - return !!this.data ? this.data.getVariable(name) : null; - }; - QuestionCustomModelBase.prototype.setVariable = function (name, newValue) { - if (!this.data) - return; - this.data.setVariable(name, newValue); - }; - QuestionCustomModelBase.prototype.getComment = function (name) { - return !!this.data ? this.data.getComment(this.getValueName()) : ""; - }; - QuestionCustomModelBase.prototype.setComment = function (name, newValue, locNotification) { - if (!this.data) - return; - this.data.setComment(this.getValueName(), newValue, locNotification); - }; - QuestionCustomModelBase.prototype.getAllValues = function () { - return !!this.data ? this.data.getAllValues() : {}; - }; - QuestionCustomModelBase.prototype.getFilteredValues = function () { - return !!this.data ? this.data.getFilteredValues() : {}; - }; - QuestionCustomModelBase.prototype.getFilteredProperties = function () { - return !!this.data ? this.data.getFilteredProperties() : {}; - }; - //IPanel - QuestionCustomModelBase.prototype.addElement = function (element, index) { }; - QuestionCustomModelBase.prototype.removeElement = function (element) { - return false; - }; - QuestionCustomModelBase.prototype.getQuestionTitleLocation = function () { - return "left"; - }; - QuestionCustomModelBase.prototype.getQuestionStartIndex = function () { - return this.getStartIndex(); - }; - QuestionCustomModelBase.prototype.getChildrenLayoutType = function () { - return "row"; - }; - QuestionCustomModelBase.prototype.elementWidthChanged = function (el) { }; - Object.defineProperty(QuestionCustomModelBase.prototype, "elements", { - get: function () { - return []; - }, - enumerable: false, - configurable: true - }); - QuestionCustomModelBase.prototype.indexOf = function (el) { - return -1; - }; - QuestionCustomModelBase.prototype.ensureRowsVisibility = function () { - // do nothing - }; - QuestionCustomModelBase.prototype.getContentDisplayValueCore = function (keyAsText, value, question) { - if (!question) - return _super.prototype.getDisplayValueCore.call(this, keyAsText, value); - return this.customQuestion.getDisplayValue(keyAsText, value, question); - }; - return QuestionCustomModelBase; - }(_question__WEBPACK_IMPORTED_MODULE_0__["Question"])); - - var QuestionCustomModel = /** @class */ (function (_super) { - __extends(QuestionCustomModel, _super); - function QuestionCustomModel() { - return _super !== null && _super.apply(this, arguments) || this; - } - QuestionCustomModel.prototype.getTemplate = function () { - return "custom"; - }; - QuestionCustomModel.prototype.createWrapper = function () { - this.questionWrapper = this.createQuestion(); - }; - QuestionCustomModel.prototype.getElement = function () { - return this.contentQuestion; - }; - QuestionCustomModel.prototype.onAnyValueChanged = function (name) { - _super.prototype.onAnyValueChanged.call(this, name); - if (!!this.contentQuestion) { - this.contentQuestion.onAnyValueChanged(name); - } - }; - QuestionCustomModel.prototype.hasErrors = function (fireCallback, rec) { - if (fireCallback === void 0) { fireCallback = true; } - if (rec === void 0) { rec = null; } - if (!this.contentQuestion) - return false; - var res = this.contentQuestion.hasErrors(fireCallback, rec); - this.errors = []; - for (var i = 0; i < this.contentQuestion.errors.length; i++) { - this.errors.push(this.contentQuestion.errors[i]); - } - if (!res) { - res = _super.prototype.hasErrors.call(this, fireCallback, rec); - } - this.updateElementCss(); - return res; - }; - QuestionCustomModel.prototype.focus = function (onError) { - if (onError === void 0) { onError = false; } - if (!!this.contentQuestion) { - this.contentQuestion.focus(onError); - } - else { - _super.prototype.focus.call(this, onError); - } - }; - Object.defineProperty(QuestionCustomModel.prototype, "contentQuestion", { - get: function () { - return this.questionWrapper; - }, - enumerable: false, - configurable: true - }); - QuestionCustomModel.prototype.createQuestion = function () { - var json = this.customQuestion.json; - var res = null; - if (!!json.questionJSON) { - var qType = json.questionJSON.type; - if (!qType || !_jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].findClass(qType)) - throw "type attribute in questionJSON is empty or incorrect"; - res = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass(qType); - this.initElement(res); - res.fromJSON(json.questionJSON); - } - else { - if (!!json.createQuestion) { - res = json.createQuestion(); - this.initElement(res); - } - } - if (!!res && !res.name) { - res.name = "question"; - } - return res; - }; - QuestionCustomModel.prototype.onSurveyLoad = function () { - _super.prototype.onSurveyLoad.call(this); - if (!this.contentQuestion) - return; - if (this.isEmpty() && !this.contentQuestion.isEmpty()) { - this.value = this.contentQuestion.value; - } - }; - QuestionCustomModel.prototype.runCondition = function (values, properties) { - _super.prototype.runCondition.call(this, values, properties); - if (!!this.contentQuestion) { - this.contentQuestion.runCondition(values, properties); - } - }; - QuestionCustomModel.prototype.convertDataName = function (name) { - if (!this.contentQuestion) - return _super.prototype.convertDataName.call(this, name); - var newName = name.replace(this.contentQuestion.getValueName(), this.getValueName()); - return newName.indexOf(this.getValueName()) == 0 - ? newName - : _super.prototype.convertDataName.call(this, name); - }; - QuestionCustomModel.prototype.convertDataValue = function (name, newValue) { - return this.convertDataName(name) == _super.prototype.convertDataName.call(this, name) - ? this.contentQuestion.value - : newValue; - }; - QuestionCustomModel.prototype.setQuestionValue = function (newValue, updateIsAnswered) { - if (updateIsAnswered === void 0) { updateIsAnswered = true; } - _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); - if (!!this.contentQuestion && - !this.isTwoValueEquals(this.contentQuestion.value, newValue)) { - this.contentQuestion.value = this.getUnbindValue(newValue); - } - }; - QuestionCustomModel.prototype.onSurveyValueChanged = function (newValue) { - _super.prototype.onSurveyValueChanged.call(this, newValue); - if (!!this.contentQuestion) { - this.contentQuestion.onSurveyValueChanged(newValue); - } - }; - QuestionCustomModel.prototype.getValueCore = function () { - if (!!this.contentQuestion) - return this.contentQuestion.value; - return _super.prototype.getValueCore.call(this); - }; - QuestionCustomModel.prototype.initElement = function (el) { - var _this = this; - _super.prototype.initElement.call(this, el); - if (!!el) { - el.parent = this; - el.afterRenderQuestionCallback = function (question, element) { - if (!!_this.customQuestion) { - _this.customQuestion.onAfterRenderContentElement(_this, question, element); - } - }; - } - }; - QuestionCustomModel.prototype.updateElementCssCore = function (cssClasses) { - if (!!this.contentQuestion) { - cssClasses = this.contentQuestion.cssClasses; - } - _super.prototype.updateElementCssCore.call(this, cssClasses); - }; - QuestionCustomModel.prototype.getDisplayValueCore = function (keyAsText, value) { - return _super.prototype.getContentDisplayValueCore.call(this, keyAsText, value, this.contentQuestion); - }; - return QuestionCustomModel; - }(QuestionCustomModelBase)); - - var QuestionCompositeTextProcessor = /** @class */ (function (_super) { - __extends(QuestionCompositeTextProcessor, _super); - function QuestionCompositeTextProcessor(composite, variableName) { - var _this = _super.call(this, variableName) || this; - _this.composite = composite; - _this.variableName = variableName; - return _this; - } - Object.defineProperty(QuestionCompositeTextProcessor.prototype, "survey", { - get: function () { - return this.composite.survey; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionCompositeTextProcessor.prototype, "panel", { - get: function () { - return this.composite.contentPanel; - }, - enumerable: false, - configurable: true - }); - return QuestionCompositeTextProcessor; - }(_textPreProcessor__WEBPACK_IMPORTED_MODULE_4__["QuestionTextProcessor"])); - var QuestionCompositeModel = /** @class */ (function (_super) { - __extends(QuestionCompositeModel, _super); - function QuestionCompositeModel(name, customQuestion) { - var _this = _super.call(this, name, customQuestion) || this; - _this.customQuestion = customQuestion; - _this.settingNewValue = false; - _this.textProcessing = new QuestionCompositeTextProcessor(_this, QuestionCompositeModel.ItemVariableName); - return _this; - } - QuestionCompositeModel.prototype.createWrapper = function () { - this.panelWrapper = this.createPanel(); - }; - QuestionCompositeModel.prototype.getTemplate = function () { - return "composite"; - }; - QuestionCompositeModel.prototype.getCssType = function () { - return "composite"; - }; - QuestionCompositeModel.prototype.getElement = function () { - return this.contentPanel; - }; - Object.defineProperty(QuestionCompositeModel.prototype, "contentPanel", { - get: function () { - return this.panelWrapper; - }, - enumerable: false, - configurable: true - }); - QuestionCompositeModel.prototype.hasErrors = function (fireCallback, rec) { - if (fireCallback === void 0) { fireCallback = true; } - if (rec === void 0) { rec = null; } - var res = _super.prototype.hasErrors.call(this, fireCallback, rec); - if (!this.contentPanel) - return res; - return this.contentPanel.hasErrors(fireCallback, false, rec) || res; - }; - QuestionCompositeModel.prototype.updateElementCss = function (reNew) { - _super.prototype.updateElementCss.call(this, reNew); - if (this.contentPanel) { - this.contentPanel.updateElementCss(reNew); - } - }; - QuestionCompositeModel.prototype.getTextProcessor = function () { - return this.textProcessing; - }; - QuestionCompositeModel.prototype.clearValueIfInvisible = function () { - _super.prototype.clearValueIfInvisible.call(this); - var questions = this.contentPanel.questions; - for (var i = 0; i < questions.length; i++) { - questions[i].clearValueIfInvisible(); - } - }; - QuestionCompositeModel.prototype.onAnyValueChanged = function (name) { - _super.prototype.onAnyValueChanged.call(this, name); - var questions = this.contentPanel.questions; - for (var i = 0; i < questions.length; i++) { - questions[i].onAnyValueChanged(name); - } - }; - QuestionCompositeModel.prototype.createPanel = function () { - var res = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass("panel"); - res.showQuestionNumbers = "off"; - res.renderWidth = "100%"; - var json = this.customQuestion.json; - if (!!json.elementsJSON) { - res.fromJSON({ elements: json.elementsJSON }); - } - if (!!json.createElements) { - json.createElements(res, this); - } - this.initElement(res); - res.readOnly = this.isReadOnly; - this.setAfterRenderCallbacks(res); - return res; - }; - QuestionCompositeModel.prototype.onReadOnlyChanged = function () { - if (!!this.contentPanel) { - this.contentPanel.readOnly = this.isReadOnly; - } - _super.prototype.onReadOnlyChanged.call(this); - }; - QuestionCompositeModel.prototype.onSurveyLoad = function () { - if (!!this.contentPanel) { - this.contentPanel.readOnly = this.isReadOnly; - this.setIsContentElement(this.contentPanel); - } - _super.prototype.onSurveyLoad.call(this); - if (!!this.contentPanel) { - var val = this.contentPanel.getValue(); - if (!_helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].isValueEmpty(val)) { - this.value = val; - } - } - }; - QuestionCompositeModel.prototype.setIsContentElement = function (panel) { - panel.isContentElement = true; - var elements = panel.elements; - for (var i = 0; i < elements.length; i++) { - var el = elements[i]; - if (el.isPanel) { - this.setIsContentElement(el); - } - else { - el.isContentElement = true; - } - } - }; - QuestionCompositeModel.prototype.setVisibleIndex = function (val) { - var res = _super.prototype.setVisibleIndex.call(this, val); - if (this.isVisible && !!this.contentPanel) { - res += this.contentPanel.setVisibleIndex(val); - } - return res; - }; - QuestionCompositeModel.prototype.runCondition = function (values, properties) { - _super.prototype.runCondition.call(this, values, properties); - if (!!this.contentPanel) { - var oldComposite = values[QuestionCompositeModel.ItemVariableName]; - values[QuestionCompositeModel.ItemVariableName] = this.contentPanel.getValue(); - this.contentPanel.runCondition(values, properties); - delete values[QuestionCompositeModel.ItemVariableName]; - if (!!oldComposite) { - values[QuestionCompositeModel.ItemVariableName] = oldComposite; - } - } - }; - QuestionCompositeModel.prototype.getValue = function (name) { - var val = this.value; - return !!val ? val[name] : null; - }; - QuestionCompositeModel.prototype.setValue = function (name, newValue, locNotification, allowNotifyValueChanged) { - if (this.settingNewValue) - return; - _super.prototype.setValue.call(this, name, newValue, locNotification, allowNotifyValueChanged); - if (!this.contentPanel) - return; - var q = this.contentPanel.getQuestionByName(name); - if (!!q && !this.isTwoValueEquals(newValue, q.value)) { - this.settingNewValue = true; - q.value = newValue; - this.settingNewValue = false; - } - }; - QuestionCompositeModel.prototype.addConditionObjectsByContext = function (objects, context) { - if (!this.contentPanel) - return; - var questions = this.contentPanel.questions; - var prefixName = this.name; - var prefixText = this.title; - for (var i = 0; i < questions.length; i++) { - objects.push({ - name: prefixName + "." + questions[i].name, - text: prefixText + "." + questions[i].title, - question: questions[i], - }); - } - }; - QuestionCompositeModel.prototype.convertDataValue = function (name, newValue) { - var val = this.value; - if (!val) - val = {}; - if (this.isValueEmpty(newValue) && !this.isEditingSurveyElement) { - delete val[name]; - } - else { - val[name] = newValue; - } - return val; - }; - QuestionCompositeModel.prototype.setQuestionValue = function (newValue, updateIsAnswered) { - if (updateIsAnswered === void 0) { updateIsAnswered = true; } - _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); - this.settingNewValue = true; - var questions = this.contentPanel.questions; - for (var i = 0; i < questions.length; i++) { - var key = questions[i].getValueName(); - questions[i].value = !!newValue ? newValue[key] : undefined; - } - this.settingNewValue = false; - }; - QuestionCompositeModel.prototype.getDisplayValueCore = function (keyAsText, value) { - return _super.prototype.getContentDisplayValueCore.call(this, keyAsText, value, this.contentPanel); - }; - QuestionCompositeModel.prototype.setAfterRenderCallbacks = function (panel) { - var _this = this; - if (!panel || !this.customQuestion) - return; - var questions = panel.questions; - for (var i = 0; i < questions.length; i++) { - questions[i].afterRenderQuestionCallback = function (question, element) { - _this.customQuestion.onAfterRenderContentElement(_this, question, element); - }; - } - }; - QuestionCompositeModel.ItemVariableName = "composite"; - return QuestionCompositeModel; - }(QuestionCustomModelBase)); - - - - /***/ }), - - /***/ "./src/question_dropdown.ts": - /*!**********************************!*\ - !*** ./src/question_dropdown.ts ***! - \**********************************/ - /*! exports provided: QuestionDropdownModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionDropdownModel", function() { return QuestionDropdownModel; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _question_baseselect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_baseselect */ "./src/question_baseselect.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - - /** - * A Model for a dropdown question - */ - var QuestionDropdownModel = /** @class */ (function (_super) { - __extends(QuestionDropdownModel, _super); - function QuestionDropdownModel(name) { - var _this = _super.call(this, name) || this; - _this.minMaxChoices = []; - _this.createLocalizableString("optionsCaption", _this); - var self = _this; - _this.registerFunctionOnPropertiesValueChanged(["choicesMin", "choicesMax", "choicesStep"], function () { - self.onVisibleChoicesChanged(); - }); - return _this; - } - Object.defineProperty(QuestionDropdownModel.prototype, "showOptionsCaption", { - /** - * This flag controls whether to show options caption item ('Choose...'). - */ - get: function () { - return this.getPropertyValue("showOptionsCaption"); - }, - set: function (val) { - this.setPropertyValue("showOptionsCaption", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionDropdownModel.prototype, "optionsCaption", { - /** - * Use this property to set the options caption different from the default value. The default value is taken from localization strings. - */ - get: function () { - return this.getLocalizableStringText("optionsCaption", _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("optionsCaption")); - }, - set: function (val) { - this.setLocalizableStringText("optionsCaption", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionDropdownModel.prototype, "locOptionsCaption", { - get: function () { - return this.getLocalizableString("optionsCaption"); - }, - enumerable: false, - configurable: true - }); - QuestionDropdownModel.prototype.getType = function () { - return "dropdown"; - }; - Object.defineProperty(QuestionDropdownModel.prototype, "selectedItem", { - get: function () { - if (this.isEmpty()) - return null; - return _itemvalue__WEBPACK_IMPORTED_MODULE_4__["ItemValue"].getItemByValue(this.visibleChoices, this.value); - }, - enumerable: false, - configurable: true - }); - QuestionDropdownModel.prototype.supportGoNextPageAutomatic = function () { - return true; - }; - QuestionDropdownModel.prototype.getChoices = function () { - var items = _super.prototype.getChoices.call(this); - if (this.choicesMax <= this.choicesMin) - return items; - var res = []; - for (var i = 0; i < items.length; i++) { - res.push(items[i]); - } - if (this.minMaxChoices.length === 0 || - this.minMaxChoices.length !== - (this.choicesMax - this.choicesMin) / this.choicesStep + 1) { - this.minMaxChoices = []; - for (var i = this.choicesMin; i <= this.choicesMax; i += this.choicesStep) { - this.minMaxChoices.push(new _itemvalue__WEBPACK_IMPORTED_MODULE_4__["ItemValue"](i)); - } - } - res = res.concat(this.minMaxChoices); - return res; - }; - Object.defineProperty(QuestionDropdownModel.prototype, "choicesMin", { - /** - * Use this and choicesMax property to automatically add choices. For example choicesMin = 1 and choicesMax = 10 will generate ten additional choices from 1 to 10. - * @see choicesMax - * @see choicesStep - */ - get: function () { - return this.getPropertyValue("choicesMin"); - }, - set: function (val) { - this.setPropertyValue("choicesMin", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionDropdownModel.prototype, "choicesMax", { - /** - * Use this and choicesMax property to automatically add choices. For example choicesMin = 1 and choicesMax = 10 will generate ten additional choices from 1 to 10. - * @see choicesMin - * @see choicesStep - */ - get: function () { - return this.getPropertyValue("choicesMax"); - }, - set: function (val) { - this.setPropertyValue("choicesMax", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionDropdownModel.prototype, "choicesStep", { - /** - * The default value is 1. It tells the value of the iterator between choicesMin and choicesMax properties. - * If choicesMin = 10, choicesMax = 30 and choicesStep = 10 then you will have only three additional choices: [10, 20, 30]. - * @see choicesMin - * @see choicesMax - */ - get: function () { - return this.getPropertyValue("choicesStep"); - }, - set: function (val) { - if (val < 1) - val = 1; - this.setPropertyValue("choicesStep", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionDropdownModel.prototype, "autoComplete", { - /** - * Dropdown auto complete - */ - get: function () { - return this.getPropertyValue("autoComplete", ""); - }, - set: function (val) { - this.setPropertyValue("autoComplete", val); - }, - enumerable: false, - configurable: true - }); - QuestionDropdownModel.prototype.getControlClass = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() - .append(this.cssClasses.control) - .append(this.cssClasses.onError, this.errors.length > 0) - .append(this.cssClasses.controlDisabled, this.isReadOnly) - .toString(); - }; - Object.defineProperty(QuestionDropdownModel.prototype, "readOnlyText", { - get: function () { - return this.hasOther && this.isOtherSelected ? this.otherText : (this.displayValue || this.showOptionsCaption && this.optionsCaption); - }, - enumerable: false, - configurable: true - }); - return QuestionDropdownModel; - }(_question_baseselect__WEBPACK_IMPORTED_MODULE_2__["QuestionSelectBase"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("dropdown", [ - { name: "optionsCaption", serializationProperty: "locOptionsCaption" }, - { name: "showOptionsCaption:boolean", default: true }, - { name: "choicesMin:number", default: 0 }, - { name: "choicesMax:number", default: 0 }, - { name: "choicesStep:number", default: 1, minValue: 1 }, - { - name: "autoComplete", - dataList: [ - "name", - "honorific-prefix", - "given-name", - "additional-name", - "family-name", - "honorific-suffix", - "nickname", - "organization-title", - "username", - "new-password", - "current-password", - "organization", - "street-address", - "address-line1", - "address-line2", - "address-line3", - "address-level4", - "address-level3", - "address-level2", - "address-level1", - "country", - "country-name", - "postal-code", - "cc-name", - "cc-given-name", - "cc-additional-name", - "cc-family-name", - "cc-number", - "cc-exp", - "cc-exp-month", - "cc-exp-year", - "cc-csc", - "cc-type", - "transaction-currency", - "transaction-amount", - "language", - "bday", - "bday-day", - "bday-month", - "bday-year", - "sex", - "url", - "photo", - "tel", - "tel-country-code", - "tel-national", - "tel-area-code", - "tel-local", - "tel-local-prefix", - "tel-local-suffix", - "tel-extension", - "email", - "impp", - ], - }, - ], function () { - return new QuestionDropdownModel(""); - }, "selectbase"); - _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("dropdown", function (name) { - var q = new QuestionDropdownModel(name); - q.choices = _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].DefaultChoices; - return q; - }); - - - /***/ }), - - /***/ "./src/question_empty.ts": - /*!*******************************!*\ - !*** ./src/question_empty.ts ***! - \*******************************/ - /*! exports provided: QuestionEmptyModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionEmptyModel", function() { return QuestionEmptyModel; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - /** - * A Model for an question that renders empty "div" tag. It used as a base class for some custom widgets - */ - var QuestionEmptyModel = /** @class */ (function (_super) { - __extends(QuestionEmptyModel, _super); - function QuestionEmptyModel(name) { - return _super.call(this, name) || this; - } - QuestionEmptyModel.prototype.getType = function () { - return "empty"; - }; - return QuestionEmptyModel; - }(_question__WEBPACK_IMPORTED_MODULE_1__["Question"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("empty", [], function () { - return new QuestionEmptyModel(""); - }, "question"); - - - /***/ }), - - /***/ "./src/question_expression.ts": - /*!************************************!*\ - !*** ./src/question_expression.ts ***! - \************************************/ - /*! exports provided: QuestionExpressionModel, getCurrecyCodes */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionExpressionModel", function() { return QuestionExpressionModel; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCurrecyCodes", function() { return getCurrecyCodes; }); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - /** - * A Model for expression question. It is a read-only question. It calculates value based on epxression property. - */ - var QuestionExpressionModel = /** @class */ (function (_super) { - __extends(QuestionExpressionModel, _super); - function QuestionExpressionModel(name) { - var _this = _super.call(this, name) || this; - _this.createLocalizableString("format", _this); - _this.registerFunctionOnPropertyValueChanged("expression", function () { - if (_this.expressionRunner) { - _this.expressionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_4__["ExpressionRunner"](_this.expression); - } - }); - _this.registerFunctionOnPropertiesValueChanged(["format", "currency", "displayStyle"], function () { - _this.updateFormatedValue(); - }); - return _this; - } - QuestionExpressionModel.prototype.getType = function () { - return "expression"; - }; - Object.defineProperty(QuestionExpressionModel.prototype, "hasInput", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionExpressionModel.prototype, "format", { - /** - * Use this property to display the value in your own format. Make sure you have "{0}" substring in your string, to display the actual value. - */ - get: function () { - return this.getLocalizableStringText("format", ""); - }, - set: function (val) { - this.setLocalizableStringText("format", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionExpressionModel.prototype, "locFormat", { - get: function () { - return this.getLocalizableString("format"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionExpressionModel.prototype, "expression", { - /** - * The Expression that used to calculate the question value. You may use standard operators like +, -, * and /, squares (). Here is the example of accessing the question value {questionname}. - *
Example: "({quantity} * {price}) * (100 - {discount}) / 100" - */ - get: function () { - return this.getPropertyValue("expression", ""); - }, - set: function (val) { - this.setPropertyValue("expression", val); - }, - enumerable: false, - configurable: true - }); - QuestionExpressionModel.prototype.locCalculation = function () { - this.expressionIsRunning = true; - }; - QuestionExpressionModel.prototype.unlocCalculation = function () { - this.expressionIsRunning = false; - }; - QuestionExpressionModel.prototype.runCondition = function (values, properties) { - var _this = this; - _super.prototype.runCondition.call(this, values, properties); - if (!this.expression || - this.expressionIsRunning || - (!this.runIfReadOnly && this.isReadOnly)) - return; - this.locCalculation(); - if (!this.expressionRunner) { - this.expressionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_4__["ExpressionRunner"](this.expression); - } - this.expressionRunner.onRunComplete = function (newValue) { - if (!_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isTwoValueEquals(newValue, _this.value)) { - _this.value = newValue; - } - _this.unlocCalculation(); - }; - this.expressionRunner.run(values, properties); - }; - QuestionExpressionModel.prototype.canCollectErrors = function () { - return true; - }; - QuestionExpressionModel.prototype.hasRequiredError = function () { - return false; - }; - Object.defineProperty(QuestionExpressionModel.prototype, "maximumFractionDigits", { - /** - * The maximum number of fraction digits to use if displayStyle is not "none". Possible values are from 0 to 20. The default value is -1 and it means that this property is not used. - */ - get: function () { - return this.getPropertyValue("maximumFractionDigits"); - }, - set: function (val) { - if (val < -1 || val > 20) - return; - this.setPropertyValue("maximumFractionDigits", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionExpressionModel.prototype, "minimumFractionDigits", { - /** - * The minimum number of fraction digits to use if displayStyle is not "none". Possible values are from 0 to 20. The default value is -1 and it means that this property is not used. - */ - get: function () { - return this.getPropertyValue("minimumFractionDigits"); - }, - set: function (val) { - if (val < -1 || val > 20) - return; - this.setPropertyValue("minimumFractionDigits", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionExpressionModel.prototype, "runIfReadOnly", { - get: function () { - return this.runIfReadOnlyValue === true; - }, - set: function (val) { - this.runIfReadOnlyValue = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionExpressionModel.prototype, "formatedValue", { - get: function () { - return this.getPropertyValue("formatedValue", ""); - }, - enumerable: false, - configurable: true - }); - QuestionExpressionModel.prototype.updateFormatedValue = function () { - this.setPropertyValue("formatedValue", this.getDisplayValueCore(false, this.value)); - }; - QuestionExpressionModel.prototype.onValueChanged = function () { - this.updateFormatedValue(); - }; - QuestionExpressionModel.prototype.updateValueFromSurvey = function (newValue) { - _super.prototype.updateValueFromSurvey.call(this, newValue); - this.updateFormatedValue(); - }; - QuestionExpressionModel.prototype.getDisplayValueCore = function (keysAsText, value) { - var val = this.isValueEmpty(value) ? this.defaultValue : value; - var res = ""; - if (!this.isValueEmpty(val)) { - var str = this.getValueAsStr(val); - res = !this.format ? str : this.format["format"](str); - } - if (!!this.survey) { - res = this.survey.getExpressionDisplayValue(this, val, res); - } - return res; - }; - Object.defineProperty(QuestionExpressionModel.prototype, "displayStyle", { - /** - * You may set this property to "decimal", "currency", "percent" or "date". If you set it to "currency", you may use the currency property to display the value in currency different from USD. - * @see currency - */ - get: function () { - return this.getPropertyValue("displayStyle"); - }, - set: function (val) { - this.setPropertyValue("displayStyle", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionExpressionModel.prototype, "currency", { - /** - * Use it to display the value in the currency differen from USD. The displayStype should be set to "currency". - * @see displayStyle - */ - get: function () { - return this.getPropertyValue("currency"); - }, - set: function (val) { - if (getCurrecyCodes().indexOf(val) < 0) - return; - this.setPropertyValue("currency", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionExpressionModel.prototype, "useGrouping", { - /** - * Determines whether to display grouping separators. The default value is true. - */ - get: function () { - return this.getPropertyValue("useGrouping"); - }, - set: function (val) { - this.setPropertyValue("useGrouping", val); - }, - enumerable: false, - configurable: true - }); - QuestionExpressionModel.prototype.getValueAsStr = function (val) { - if (this.displayStyle == "date") { - var d = new Date(val); - if (!!d && !!d.toLocaleDateString) - return d.toLocaleDateString(); - } - if (this.displayStyle != "none" && _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(val)) { - var locale = this.getLocale(); - if (!locale) - locale = "en"; - var options = { - style: this.displayStyle, - currency: this.currency, - useGrouping: this.useGrouping, - }; - if (this.maximumFractionDigits > -1) { - options["maximumFractionDigits"] = this.maximumFractionDigits; - } - if (this.minimumFractionDigits > -1) { - options["minimumFractionDigits"] = this.minimumFractionDigits; - } - return val.toLocaleString(locale, options); - } - return val.toString(); - }; - return QuestionExpressionModel; - }(_question__WEBPACK_IMPORTED_MODULE_1__["Question"])); - - function getCurrecyCodes() { - return [ - "AED", - "AFN", - "ALL", - "AMD", - "ANG", - "AOA", - "ARS", - "AUD", - "AWG", - "AZN", - "BAM", - "BBD", - "BDT", - "BGN", - "BHD", - "BIF", - "BMD", - "BND", - "BOB", - "BOV", - "BRL", - "BSD", - "BTN", - "BWP", - "BYN", - "BZD", - "CAD", - "CDF", - "CHE", - "CHF", - "CHW", - "CLF", - "CLP", - "CNY", - "COP", - "COU", - "CRC", - "CUC", - "CUP", - "CVE", - "CZK", - "DJF", - "DKK", - "DOP", - "DZD", - "EGP", - "ERN", - "ETB", - "EUR", - "FJD", - "FKP", - "GBP", - "GEL", - "GHS", - "GIP", - "GMD", - "GNF", - "GTQ", - "GYD", - "HKD", - "HNL", - "HRK", - "HTG", - "HUF", - "IDR", - "ILS", - "INR", - "IQD", - "IRR", - "ISK", - "JMD", - "JOD", - "JPY", - "KES", - "KGS", - "KHR", - "KMF", - "KPW", - "KRW", - "KWD", - "KYD", - "KZT", - "LAK", - "LBP", - "LKR", - "LRD", - "LSL", - "LYD", - "MAD", - "MDL", - "MGA", - "MKD", - "MMK", - "MNT", - "MOP", - "MRO", - "MUR", - "MVR", - "MWK", - "MXN", - "MXV", - "MYR", - "MZN", - "NAD", - "NGN", - "NIO", - "NOK", - "NPR", - "NZD", - "OMR", - "PAB", - "PEN", - "PGK", - "PHP", - "PKR", - "PLN", - "PYG", - "QAR", - "RON", - "RSD", - "RUB", - "RWF", - "SAR", - "SBD", - "SCR", - "SDG", - "SEK", - "SGD", - "SHP", - "SLL", - "SOS", - "SRD", - "SSP", - "STD", - "SVC", - "SYP", - "SZL", - "THB", - "TJS", - "TMT", - "TND", - "TOP", - "TRY", - "TTD", - "TWD", - "TZS", - "UAH", - "UGX", - "USD", - "USN", - "UYI", - "UYU", - "UZS", - "VEF", - "VND", - "VUV", - "WST", - "XAF", - "XAG", - "XAU", - "XBA", - "XBB", - "XBC", - "XBD", - "XCD", - "XDR", - "XOF", - "XPD", - "XPF", - "XPT", - "XSU", - "XTS", - "XUA", - "XXX", - "YER", - "ZAR", - "ZMW", - "ZWL", - ]; - } - _jsonobject__WEBPACK_IMPORTED_MODULE_2__["Serializer"].addClass("expression", [ - "expression:expression", - { name: "format", serializationProperty: "locFormat" }, - { - name: "displayStyle", - default: "none", - choices: ["none", "decimal", "currency", "percent", "date"], - }, - { - name: "currency", - choices: function () { - return getCurrecyCodes(); - }, - default: "USD", - }, - { name: "maximumFractionDigits:number", default: -1 }, - { name: "minimumFractionDigits:number", default: -1 }, - { name: "useGrouping:boolean", default: true }, - { name: "enableIf", visible: false }, - { name: "isRequired", visible: false }, - { name: "readOnly", visible: false }, - { name: "requiredErrorText", visible: false }, - { name: "defaultValueExpression", visible: false }, - { name: "defaultValue", visible: false }, - { name: "correctAnswer", visible: false }, - { name: "requiredIf", visible: false }, - ], function () { - return new QuestionExpressionModel(""); - }, "question"); - _questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].Instance.registerQuestion("expression", function (name) { - return new QuestionExpressionModel(name); - }); - - - /***/ }), - - /***/ "./src/question_file.ts": - /*!******************************!*\ - !*** ./src/question_file.ts ***! - \******************************/ - /*! exports provided: QuestionFileModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionFileModel", function() { return QuestionFileModel; }); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./error */ "./src/error.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - - - - - - - /** - * A Model for a file question - */ - var QuestionFileModel = /** @class */ (function (_super) { - __extends(QuestionFileModel, _super); - function QuestionFileModel(name) { - var _this = _super.call(this, name) || this; - _this.isUploading = false; - _this.isDragging = false; - /** - * The event is fired after question state has been changed. - *
sender the question object that fires the event - *
options.state new question state value. - */ - _this.onStateChanged = _this.addEvent(); - _this.previewValue = []; - //#region - // web-based methods - _this.onDragOver = function (event) { - if (_this.isInputReadOnly) { - event.returnValue = false; - return false; - } - _this.isDragging = true; - event.dataTransfer.dropEffect = "copy"; - event.preventDefault(); - }; - _this.onDrop = function (event) { - if (!_this.isInputReadOnly) { - _this.isDragging = false; - event.preventDefault(); - var src = event.dataTransfer; - _this.onChange(src); - } - }; - _this.onDragLeave = function (event) { - if (!_this.isInputReadOnly) { - _this.isDragging = false; - } - }; - _this.doChange = function (event) { - var src = event.target || event.srcElement; - _this.onChange(src); - }; - _this.doClean = function (event) { - var src = event.target || event.srcElement; - if (_this.needConfirmRemoveFile) { - var isConfirmed = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["confirmAction"])(_this.confirmRemoveAllMessage); - if (!isConfirmed) - return; - } - src.parentElement.querySelectorAll("input")[0].value = ""; - _this.clear(); - }; - _this.doDownloadFile = function (event, data) { - if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["detectIEOrEdge"])()) { - event.preventDefault(); - Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["loadFileFromBase64"])(data.content, data.name); - } - }; - return _this; - } - QuestionFileModel.prototype.getType = function () { - return "file"; - }; - QuestionFileModel.prototype.clearOnDeletingContainer = function () { - if (!this.survey) - return; - this.survey.clearFiles(this, this.name, this.value, null, function () { }); - }; - Object.defineProperty(QuestionFileModel.prototype, "showPreview", { - /** - * Set it to true, to show the preview for the image files. - */ - get: function () { - return this.getPropertyValue("showPreview"); - }, - set: function (val) { - this.setPropertyValue("showPreview", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionFileModel.prototype, "allowMultiple", { - /** - * Set it to true, to allow select multiple files. - */ - get: function () { - return this.getPropertyValue("allowMultiple", false); - }, - set: function (val) { - this.setPropertyValue("allowMultiple", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionFileModel.prototype, "imageHeight", { - /** - * The image height. - */ - get: function () { - return this.getPropertyValue("imageHeight"); - }, - set: function (val) { - this.setPropertyValue("imageHeight", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionFileModel.prototype, "imageWidth", { - /** - * The image width. - */ - get: function () { - return this.getPropertyValue("imageWidth"); - }, - set: function (val) { - this.setPropertyValue("imageWidth", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionFileModel.prototype, "acceptedTypes", { - /** - * Accepted file types. Passed to the 'accept' attribute of the file input tag. See https://www.w3schools.com/tags/att_input_accept.asp for more details. - */ - get: function () { - return this.getPropertyValue("acceptedTypes"); - }, - set: function (val) { - this.setPropertyValue("acceptedTypes", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionFileModel.prototype, "storeDataAsText", { - /** - * Set it to false if you do not want to serialize file content as text in the survey.data. - * In this case, you have to write the code onUploadFiles event to store the file content. - * @see SurveyModel.onUploadFiles - */ - get: function () { - return this.getPropertyValue("storeDataAsText"); - }, - set: function (val) { - this.setPropertyValue("storeDataAsText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionFileModel.prototype, "waitForUpload", { - /** - * Set it to true if you want to wait until files will be uploaded to your server. - */ - get: function () { - return this.getPropertyValue("waitForUpload"); - }, - set: function (val) { - this.setPropertyValue("waitForUpload", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionFileModel.prototype, "allowImagesPreview", { - /** - * Set it to false if you want to disable images preview. - */ - get: function () { - return this.getPropertyValue("allowImagesPreview"); - }, - set: function (val) { - this.setPropertyValue("allowImagesPreview", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionFileModel.prototype, "maxSize", { - /** - * Use this property to setup the maximum allowed file size. - */ - get: function () { - return this.getPropertyValue("maxSize"); - }, - set: function (val) { - this.setPropertyValue("maxSize", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionFileModel.prototype, "needConfirmRemoveFile", { - /** - * Use this property to setup confirmation to remove file. - */ - get: function () { - return this.getPropertyValue("needConfirmRemoveFile"); - }, - set: function (val) { - this.setPropertyValue("needConfirmRemoveFile", val); - }, - enumerable: false, - configurable: true - }); - /** - * The remove file confirmation message. - */ - QuestionFileModel.prototype.getConfirmRemoveMessage = function (fileName) { - return this.confirmRemoveMessage.format(fileName); - }; - Object.defineProperty(QuestionFileModel.prototype, "inputTitle", { - /** - * The input title value. - */ - get: function () { - if (this.isUploading) - return this.loadingFileTitle; - if (this.isEmpty()) - return this.chooseFileTitle; - return " "; - }, - enumerable: false, - configurable: true - }); - /** - * Clear value programmatically. - */ - QuestionFileModel.prototype.clear = function (doneCallback) { - var _this = this; - if (!this.survey) - return; - this.survey.clearFiles(this, this.name, this.value, null, function (status, data) { - if (status === "success") { - _this.value = undefined; - _this.errors = []; - !!doneCallback && doneCallback(); - } - }); - }; - /** - * Remove file item programmatically. - */ - QuestionFileModel.prototype.removeFile = function (content) { - var _this = this; - if (!this.survey) - return; - this.survey.clearFiles(this, this.name, this.value, content.name, function (status, data) { - if (status === "success") { - var oldValue = _this.value; - if (Array.isArray(oldValue)) { - _this.value = oldValue.filter(function (f) { return f.name !== content.name; }); - } - else { - _this.value = undefined; - } - } - }); - }; - /** - * Load multiple files programmatically. - * @param files - */ - QuestionFileModel.prototype.loadFiles = function (files) { - var _this = this; - if (!this.survey) { - return; - } - this.errors = []; - if (!this.allFilesOk(files)) { - return; - } - this.stateChanged("loading"); - var loadFilesProc = function () { - var content = []; - if (_this.storeDataAsText) { - files.forEach(function (file) { - var fileReader = new FileReader(); - fileReader.onload = function (e) { - content = content.concat([ - { name: file.name, type: file.type, content: fileReader.result }, - ]); - if (content.length === files.length) { - _this.value = (_this.value || []).concat(content); - } - }; - fileReader.readAsDataURL(file); - }); - } - else { - if (_this.survey) { - _this.survey.uploadFiles(_this, _this.name, files, function (status, data) { - if (status === "error") { - _this.stateChanged("error"); - } - if (status === "success") { - _this.value = (_this.value || []).concat(data.map(function (r) { - return { - name: r.file.name, - type: r.file.type, - content: r.content, - }; - })); - } - }); - } - } - }; - if (this.allowMultiple) { - loadFilesProc(); - } - else { - this.clear(loadFilesProc); - } - }; - QuestionFileModel.prototype.canPreviewImage = function (fileItem) { - return this.allowImagesPreview && !!fileItem && this.isFileImage(fileItem); - }; - QuestionFileModel.prototype.setQuestionValue = function (newValue, updateIsAnswered) { - var _this = this; - if (updateIsAnswered === void 0) { updateIsAnswered = true; } - _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); - this.previewValue = []; - var state = (!Array.isArray(newValue) && !!newValue) || - (Array.isArray(newValue) && newValue.length > 0) - ? this.showPreview - ? "loading" - : "loaded" - : "empty"; - this.stateChanged(state); - if (!this.showPreview || !newValue) - return; - var newValues = Array.isArray(newValue) - ? newValue - : !!newValue - ? [newValue] - : []; - if (this.storeDataAsText) { - newValues.forEach(function (value) { - var content = value.content || value; - _this.previewValue = _this.previewValue.concat([ - { - name: value.name, - type: value.type, - content: content, - }, - ]); - }); - if (state === "loading") - this.stateChanged("loaded"); - } - else { - newValues.forEach(function (value) { - value.content || value; - if (_this.survey) { - _this.survey.downloadFile(_this.name, value, function (status, data) { - if (status === "success") { - _this.previewValue = _this.previewValue.concat([ - { - content: data, - name: value.name, - type: value.type, - }, - ]); - if (_this.previewValue.length === newValues.length) { - _this.stateChanged("loaded"); - } - } - else { - _this.stateChanged("error"); - } - }); - } - }); - } - }; - QuestionFileModel.prototype.onCheckForErrors = function (errors, isOnValueChanged) { - _super.prototype.onCheckForErrors.call(this, errors, isOnValueChanged); - if (this.isUploading && this.waitForUpload) { - errors.push(new _error__WEBPACK_IMPORTED_MODULE_3__["UploadingFileError"](_surveyStrings__WEBPACK_IMPORTED_MODULE_4__["surveyLocalization"].getString("uploadingFile"), this)); - } - }; - QuestionFileModel.prototype.stateChanged = function (state) { - if (state === "loading") { - this.isUploading = true; - } - if (state === "loaded") { - this.isUploading = false; - } - if (state === "error") { - this.isUploading = false; - } - this.currentState = state; - this.onStateChanged.fire(this, { state: state }); - }; - QuestionFileModel.prototype.allFilesOk = function (files) { - var _this = this; - var errorLength = this.errors ? this.errors.length : 0; - (files || []).forEach(function (file) { - if (_this.maxSize > 0 && file.size > _this.maxSize) { - _this.errors.push(new _error__WEBPACK_IMPORTED_MODULE_3__["ExceedSizeError"](_this.maxSize, _this)); - } - }); - return errorLength === this.errors.length; - }; - QuestionFileModel.prototype.isFileImage = function (file) { - if (!file) - return false; - var imagePrefix = "data:image"; - var subStr = file.content && file.content.substr(0, imagePrefix.length); - subStr = subStr && subStr.toLowerCase(); - var result = subStr === imagePrefix || - (!!file.type && file.type.toLowerCase().indexOf("image/") === 0); - return result; - }; - QuestionFileModel.prototype.getPlainData = function (options) { - if (options === void 0) { options = { - includeEmpty: true, - }; } - var questionPlainData = _super.prototype.getPlainData.call(this, options); - if (!!questionPlainData && !this.isEmpty()) { - questionPlainData.isNode = false; - var values = Array.isArray(this.value) ? this.value : [this.value]; - questionPlainData.data = values.map(function (dataValue, index) { - return { - name: index, - title: "File", - value: (dataValue.content && dataValue.content) || dataValue, - displayValue: (dataValue.name && dataValue.name) || dataValue, - getString: function (val) { - return typeof val === "object" ? JSON.stringify(val) : val; - }, - isNode: false, - }; - }); - } - return questionPlainData; - }; - QuestionFileModel.prototype.supportComment = function () { - return true; - }; - QuestionFileModel.prototype.getChooseFileCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() - .append(this.cssClasses.chooseFile) - .append(this.cssClasses.controlDisabled, this.isReadOnly) - .toString(); - }; - QuestionFileModel.prototype.getReadOnlyFileCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() - .append("form-control") - .append(this.cssClasses.placeholderInput) - .toString(); - }; - QuestionFileModel.prototype.getFileDecoratorCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() - .append(this.cssClasses.fileDecorator) - .append(this.cssClasses.onError, this.errors.length > 0) - .append(this.cssClasses.fileDecoratorDrag, this.isDragging) - .toString(); - }; - QuestionFileModel.prototype.onChange = function (src) { - if (!window["FileReader"]) - return; - if (!src || !src.files || src.files.length < 1) - return; - var files = []; - var allowCount = this.allowMultiple ? src.files.length : 1; - for (var i = 0; i < allowCount; i++) { - files.push(src.files[i]); - } - src.value = ""; - this.loadFiles(files); - }; - QuestionFileModel.prototype.doRemoveFile = function (data) { - if (this.needConfirmRemoveFile) { - var isConfirmed = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["confirmAction"])(this.getConfirmRemoveMessage(data.name)); - if (!isConfirmed) - return; - } - this.removeFile(data); - }; - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() - ], QuestionFileModel.prototype, "isDragging", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "empty" }) - ], QuestionFileModel.prototype, "currentState", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "confirmRemoveFile" } }) - ], QuestionFileModel.prototype, "confirmRemoveMessage", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "confirmRemoveAllFiles" } }) - ], QuestionFileModel.prototype, "confirmRemoveAllMessage", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "noFileChosen" } }) - ], QuestionFileModel.prototype, "noFileChosenCaption", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "chooseFileCaption" } }) - ], QuestionFileModel.prototype, "chooseButtonCaption", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "cleanCaption" } }) - ], QuestionFileModel.prototype, "cleanButtonCaption", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "removeFileCaption" } }) - ], QuestionFileModel.prototype, "removeFileCaption", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "loadingFile" } }) - ], QuestionFileModel.prototype, "loadingFileTitle", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "chooseFile" } }) - ], QuestionFileModel.prototype, "chooseFileTitle", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "fileDragAreaPlaceholder" } }) - ], QuestionFileModel.prototype, "dragAreaPlaceholder", void 0); - return QuestionFileModel; - }(_question__WEBPACK_IMPORTED_MODULE_0__["Question"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("file", [ - { name: "hasComment:switch", layout: "row" }, - { - name: "commentText", - dependsOn: "hasComment", - visibleIf: function (obj) { - return obj.hasComment; - }, - serializationProperty: "locCommentText", - layout: "row", - }, - { name: "showPreview:boolean", default: true }, - "allowMultiple:boolean", - { name: "allowImagesPreview:boolean", default: true }, - "imageHeight", - "imageWidth", - "acceptedTypes", - { name: "storeDataAsText:boolean", default: true }, - { name: "waitForUpload:boolean", default: false }, - { name: "maxSize:number", default: 0 }, - { name: "defaultValue", visible: false }, - { name: "correctAnswer", visible: false }, - { name: "validators", visible: false }, - { name: "needConfirmRemoveFile:boolean" }, - ], function () { - return new QuestionFileModel(""); - }, "question"); - _questionfactory__WEBPACK_IMPORTED_MODULE_2__["QuestionFactory"].Instance.registerQuestion("file", function (name) { - return new QuestionFileModel(name); - }); - - - /***/ }), - - /***/ "./src/question_html.ts": - /*!******************************!*\ - !*** ./src/question_html.ts ***! - \******************************/ - /*! exports provided: QuestionHtmlModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionHtmlModel", function() { return QuestionHtmlModel; }); - /* harmony import */ var _questionnonvalue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./questionnonvalue */ "./src/questionnonvalue.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - /** - * A Model for html question. Unlike other questions it doesn't have value and title. - */ - var QuestionHtmlModel = /** @class */ (function (_super) { - __extends(QuestionHtmlModel, _super); - function QuestionHtmlModel(name) { - var _this = _super.call(this, name) || this; - var locHtml = _this.createLocalizableString("html", _this); - locHtml.onGetTextCallback = function (str) { - return !!_this.survey && !_this.ignoreHtmlProgressing - ? _this.survey.processHtml(str) - : str; - }; - return _this; - } - QuestionHtmlModel.prototype.getType = function () { - return "html"; - }; - Object.defineProperty(QuestionHtmlModel.prototype, "isCompositeQuestion", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - QuestionHtmlModel.prototype.getProcessedText = function (text) { - if (this.ignoreHtmlProgressing) - return text; - return _super.prototype.getProcessedText.call(this, text); - }; - Object.defineProperty(QuestionHtmlModel.prototype, "html", { - /** - * Set html to display it - */ - get: function () { - return this.getLocalizableStringText("html", ""); - }, - set: function (val) { - this.setLocalizableStringText("html", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionHtmlModel.prototype, "locHtml", { - get: function () { - return this.getLocalizableString("html"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionHtmlModel.prototype, "processedHtml", { - get: function () { - return this.survey ? this.survey.processHtml(this.html) : this.html; - }, - enumerable: false, - configurable: true - }); - return QuestionHtmlModel; - }(_questionnonvalue__WEBPACK_IMPORTED_MODULE_0__["QuestionNonValue"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("html", [{ name: "html:html", serializationProperty: "locHtml" }], function () { - return new QuestionHtmlModel(""); - }, "nonvalue"); - _questionfactory__WEBPACK_IMPORTED_MODULE_2__["QuestionFactory"].Instance.registerQuestion("html", function (name) { - return new QuestionHtmlModel(name); - }); - - - /***/ }), - - /***/ "./src/question_image.ts": - /*!*******************************!*\ - !*** ./src/question_image.ts ***! - \*******************************/ - /*! exports provided: QuestionImageModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionImageModel", function() { return QuestionImageModel; }); - /* harmony import */ var _questionnonvalue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./questionnonvalue */ "./src/questionnonvalue.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - /** - * A Model for image question. This question hasn't any functionality and can be used to improve the appearance of the survey. - */ - var QuestionImageModel = /** @class */ (function (_super) { - __extends(QuestionImageModel, _super); - function QuestionImageModel(name) { - var _this = _super.call(this, name) || this; - _this.createLocalizableString("imageLink", _this, false); - _this.createLocalizableString("text", _this, false); - return _this; - } - QuestionImageModel.prototype.getType = function () { - return "image"; - }; - Object.defineProperty(QuestionImageModel.prototype, "isCompositeQuestion", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionImageModel.prototype, "imageLink", { - /** - * The image URL. - */ - get: function () { - return this.getLocalizableStringText("imageLink"); - }, - set: function (val) { - this.setLocalizableStringText("imageLink", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionImageModel.prototype, "locImageLink", { - get: function () { - return this.getLocalizableString("imageLink"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionImageModel.prototype, "text", { - /** - * The image alt text. - */ - get: function () { - return this.getLocalizableStringText("text"); - }, - set: function (val) { - this.setLocalizableStringText("text", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionImageModel.prototype, "locText", { - get: function () { - return this.getLocalizableString("text"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionImageModel.prototype, "imageHeight", { - /** - * The image height. - */ - get: function () { - return this.getPropertyValue("imageHeight"); - }, - set: function (val) { - this.setPropertyValue("imageHeight", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionImageModel.prototype, "imageWidth", { - /** - * The image width. - */ - get: function () { - return this.getPropertyValue("imageWidth"); - }, - set: function (val) { - this.setPropertyValue("imageWidth", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionImageModel.prototype, "imageFit", { - /** - * The image fit mode. - */ - get: function () { - return this.getPropertyValue("imageFit"); - }, - set: function (val) { - this.setPropertyValue("imageFit", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionImageModel.prototype, "contentMode", { - /** - * The content mode. - */ - get: function () { - return this.getPropertyValue("contentMode"); - }, - set: function (val) { - this.setPropertyValue("contentMode", val); - if (val === "video") { - this.showLabel = true; - } - }, - enumerable: false, - configurable: true - }); - return QuestionImageModel; - }(_questionnonvalue__WEBPACK_IMPORTED_MODULE_0__["QuestionNonValue"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("image", [ - { name: "imageLink", serializationProperty: "locImageLink" }, - { name: "text", serializationProperty: "locText" }, - { - name: "contentMode", - default: "image", - choices: ["image", "video"], - }, - { - name: "imageFit", - default: "contain", - choices: ["none", "contain", "cover", "fill"], - }, - { name: "imageHeight:number", default: 150, minValue: 0 }, - { name: "imageWidth:number", default: 200, minValue: 0 }, - ], function () { - return new QuestionImageModel(""); - }, "nonvalue"); - _questionfactory__WEBPACK_IMPORTED_MODULE_2__["QuestionFactory"].Instance.registerQuestion("image", function (name) { - return new QuestionImageModel(name); - }); - - - /***/ }), - - /***/ "./src/question_imagepicker.ts": - /*!*************************************!*\ - !*** ./src/question_imagepicker.ts ***! - \*************************************/ - /*! exports provided: ImageItemValue, QuestionImagePickerModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ImageItemValue", function() { return ImageItemValue; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionImagePickerModel", function() { return QuestionImagePickerModel; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _question_baseselect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_baseselect */ "./src/question_baseselect.ts"); - /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - var ImageItemValue = /** @class */ (function (_super) { - __extends(ImageItemValue, _super); - function ImageItemValue(value, text, typeName) { - if (text === void 0) { text = null; } - if (typeName === void 0) { typeName = "imageitemvalue"; } - var _this = _super.call(this, value, text, typeName) || this; - _this.typeName = typeName; - _this.createLocalizableString("imageLink", _this, false); - return _this; - } - ImageItemValue.prototype.getType = function () { - return !!this.typeName ? this.typeName : "itemvalue"; - }; - Object.defineProperty(ImageItemValue.prototype, "imageLink", { - /** - * The image or video link property. - */ - get: function () { - return this.getLocalizableStringText("imageLink"); - }, - set: function (val) { - this.setLocalizableStringText("imageLink", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ImageItemValue.prototype, "locImageLink", { - get: function () { - return this.getLocalizableString("imageLink"); - }, - enumerable: false, - configurable: true - }); - ImageItemValue.prototype.getLocale = function () { - return !!this.locOwner ? this.locOwner.getLocale() : ""; - }; - ImageItemValue.prototype.getMarkdownHtml = function (text, name) { - return !!this.locOwner ? this.locOwner.getMarkdownHtml(text, name) : text; - }; - ImageItemValue.prototype.getRenderer = function (name) { - return !!this.locOwner ? this.locOwner.getRenderer(name) : null; - }; - ImageItemValue.prototype.getRendererContext = function (locStr) { - return !!this.locOwner ? this.locOwner.getRendererContext(locStr) : locStr; - }; - ImageItemValue.prototype.getProcessedText = function (text) { - return !!this.locOwner ? this.locOwner.getProcessedText(text) : text; - }; - return ImageItemValue; - }(_itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"])); - - /** - * A Model for a select image question. - */ - var QuestionImagePickerModel = /** @class */ (function (_super) { - __extends(QuestionImagePickerModel, _super); - function QuestionImagePickerModel(name) { - var _this = _super.call(this, name) || this; - _this.colCount = 0; - return _this; - } - QuestionImagePickerModel.prototype.getType = function () { - return "imagepicker"; - }; - QuestionImagePickerModel.prototype.supportGoNextPageAutomatic = function () { - return true; - }; - Object.defineProperty(QuestionImagePickerModel.prototype, "hasSingleInput", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - QuestionImagePickerModel.prototype.getItemValueType = function () { - return "imageitemvalue"; - }; - Object.defineProperty(QuestionImagePickerModel.prototype, "isCompositeQuestion", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - QuestionImagePickerModel.prototype.supportOther = function () { - return false; - }; - QuestionImagePickerModel.prototype.supportNone = function () { - return false; - }; - Object.defineProperty(QuestionImagePickerModel.prototype, "multiSelect", { - /** - * Multi select option. If set to true, then allows to select multiple images. - */ - get: function () { - return this.getPropertyValue("multiSelect"); - }, - set: function (newValue) { - this.setPropertyValue("multiSelect", newValue); - }, - enumerable: false, - configurable: true - }); - /** - * Returns true if item is checked - * @param item image picker item value - */ - QuestionImagePickerModel.prototype.isItemSelected = function (item) { - var val = this.value; - if (this.isValueEmpty(val)) - return false; - if (!this.multiSelect) - return this.isTwoValueEquals(val, item.value); - if (!Array.isArray(val)) - return false; - for (var i = 0; i < val.length; i++) { - if (this.isTwoValueEquals(val[i], item.value)) - return true; - } - return false; - }; - QuestionImagePickerModel.prototype.clearIncorrectValues = function () { - if (this.multiSelect) { - var val = this.value; - if (!val) - return; - if (!Array.isArray(val) || val.length == 0) { - this.clearValue(); - return; - } - var newValue = []; - for (var i = 0; i < val.length; i++) { - if (!this.hasUnknownValue(val[i], true)) { - newValue.push(val[i]); - } - } - if (newValue.length == val.length) - return; - if (newValue.length == 0) { - this.clearValue(); - } - else { - this.value = newValue; - } - } - else { - _super.prototype.clearIncorrectValues.call(this); - } - }; - Object.defineProperty(QuestionImagePickerModel.prototype, "showLabel", { - /** - * Show label under the image. - */ - get: function () { - return this.getPropertyValue("showLabel"); - }, - set: function (newValue) { - this.setPropertyValue("showLabel", newValue); - }, - enumerable: false, - configurable: true - }); - QuestionImagePickerModel.prototype.endLoadingFromJson = function () { - _super.prototype.endLoadingFromJson.call(this); - if (!this.isDesignMode && this.multiSelect) { - this.createNewArray("renderedValue"); - this.createNewArray("value"); - } - }; - QuestionImagePickerModel.prototype.getValueCore = function () { - var value = _super.prototype.getValueCore.call(this); - if (value !== undefined) { - return value; - } - if (this.multiSelect) { - return []; - } - return value; - }; - QuestionImagePickerModel.prototype.convertValToArrayForMultSelect = function (val) { - if (!this.multiSelect) - return val; - if (this.isValueEmpty(val) || Array.isArray(val)) - return val; - return [val]; - }; - QuestionImagePickerModel.prototype.renderedValueFromDataCore = function (val) { - return this.convertValToArrayForMultSelect(val); - }; - QuestionImagePickerModel.prototype.rendredValueToDataCore = function (val) { - return this.convertValToArrayForMultSelect(val); - }; - Object.defineProperty(QuestionImagePickerModel.prototype, "imageHeight", { - /** - * The image height. - */ - get: function () { - return this.getPropertyValue("imageHeight"); - }, - set: function (val) { - this.setPropertyValue("imageHeight", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionImagePickerModel.prototype, "imageWidth", { - /** - * The image width. - */ - get: function () { - return this.getPropertyValue("imageWidth"); - }, - set: function (val) { - this.setPropertyValue("imageWidth", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionImagePickerModel.prototype, "imageFit", { - /** - * The image fit mode. - */ - get: function () { - return this.getPropertyValue("imageFit"); - }, - set: function (val) { - this.setPropertyValue("imageFit", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionImagePickerModel.prototype, "contentMode", { - /** - * The content mode. - */ - get: function () { - return this.getPropertyValue("contentMode"); - }, - set: function (val) { - this.setPropertyValue("contentMode", val); - if (val === "video") { - this.showLabel = true; - } - }, - enumerable: false, - configurable: true - }); - QuestionImagePickerModel.prototype.convertDefaultValue = function (val) { - return val; - }; - Object.defineProperty(QuestionImagePickerModel.prototype, "hasColumns", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - return QuestionImagePickerModel; - }(_question_baseselect__WEBPACK_IMPORTED_MODULE_2__["QuestionCheckboxBase"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("imageitemvalue", [], function (value) { return new ImageItemValue(value); }, "itemvalue"); - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addProperty("imageitemvalue", { - name: "imageLink", - serializationProperty: "locImageLink", - }); - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("imagepicker", [ - { name: "hasOther", visible: false }, - { name: "otherText", visible: false }, - { name: "hasNone", visible: false }, - { name: "noneText", visible: false }, - { name: "optionsCaption", visible: false }, - { name: "otherErrorText", visible: false }, - { name: "storeOthersAsComment", visible: false }, - { - name: "contentMode", - default: "image", - choices: ["image", "video"], - }, - { - name: "imageFit", - default: "contain", - choices: ["none", "contain", "cover", "fill"], - }, - { name: "imageHeight:number", default: 150, minValue: 0 }, - { name: "imageWidth:number", default: 200, minValue: 0 }, - ], function () { - return new QuestionImagePickerModel(""); - }, "checkboxbase"); - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addProperty("imagepicker", { - name: "showLabel:boolean", - default: false, - }); - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addProperty("imagepicker", { - name: "colCount:number", - default: 0, - choices: [0, 1, 2, 3, 4, 5], - }); - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addProperty("imagepicker", { - name: "multiSelect:boolean", - default: false, - }); - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addProperty("imagepicker", { - name: "choices:imageitemvalue[]", - }); - _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("imagepicker", function (name) { - var q = new QuestionImagePickerModel(name); - //q.choices = QuestionFactory.DefaultChoices; - return q; - }); - - - /***/ }), - - /***/ "./src/question_matrix.ts": - /*!********************************!*\ - !*** ./src/question_matrix.ts ***! - \********************************/ - /*! exports provided: MatrixRowModel, MatrixCells, QuestionMatrixModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixRowModel", function() { return MatrixRowModel; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixCells", function() { return MatrixCells; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixModel", function() { return QuestionMatrixModel; }); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); - /* harmony import */ var _martixBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./martixBase */ "./src/martixBase.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./base */ "./src/base.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./error */ "./src/error.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts"); - /* harmony import */ var _question_dropdown__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./question_dropdown */ "./src/question_dropdown.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - - - - - - - - var MatrixRowModel = /** @class */ (function (_super) { - __extends(MatrixRowModel, _super); - function MatrixRowModel(item, fullName, data, value) { - var _this = _super.call(this) || this; - _this.fullName = fullName; - _this.item = item; - _this.data = data; - _this.value = value; - _this.cellClick = function (column) { - _this.value = column.value; - }; - _this.registerFunctionOnPropertyValueChanged("value", function () { - if (_this.data) - _this.data.onMatrixRowChanged(_this); - }); - return _this; - } - Object.defineProperty(MatrixRowModel.prototype, "name", { - get: function () { - return this.item.value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixRowModel.prototype, "text", { - get: function () { - return this.item.text; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixRowModel.prototype, "locText", { - get: function () { - return this.item.locText; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixRowModel.prototype, "value", { - get: function () { - return this.getPropertyValue("value"); - }, - set: function (newValue) { - newValue = this.data.getCorrectedRowValue(newValue); - this.setPropertyValue("value", newValue); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixRowModel.prototype, "rowClasses", { - get: function () { - var cssClasses = this.data.cssClasses; - var hasError = !!this.data.getErrorByType("requiredinallrowserror"); - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(cssClasses.row) - .append(cssClasses.rowError, hasError && this.isValueEmpty(this.value)) - .toString(); - }, - enumerable: false, - configurable: true - }); - return MatrixRowModel; - }(_base__WEBPACK_IMPORTED_MODULE_4__["Base"])); - - var MatrixCells = /** @class */ (function () { - function MatrixCells(cellsOwner) { - this.cellsOwner = cellsOwner; - this.values = {}; - } - Object.defineProperty(MatrixCells.prototype, "isEmpty", { - get: function () { - return Object.keys(this.values).length == 0; - }, - enumerable: false, - configurable: true - }); - MatrixCells.prototype.setCellText = function (row, column, val) { - row = this.getCellRowColumnValue(row, this.rows); - column = this.getCellRowColumnValue(column, this.columns); - if (!row || !column) - return; - if (val) { - if (!this.values[row]) - this.values[row] = {}; - if (!this.values[row][column]) - this.values[row][column] = this.createString(); - this.values[row][column].text = val; - } - else { - if (this.values[row] && this.values[row][column]) { - var loc = this.values[row][column]; - loc.text = ""; - if (loc.isEmpty) { - delete this.values[row][column]; - if (Object.keys(this.values[row]).length == 0) { - delete this.values[row]; - } - } - } - } - }; - MatrixCells.prototype.setDefaultCellText = function (column, val) { - this.setCellText(_settings__WEBPACK_IMPORTED_MODULE_10__["settings"].matrixDefaultRowName, column, val); - }; - MatrixCells.prototype.getCellLocText = function (row, column) { - row = this.getCellRowColumnValue(row, this.rows); - column = this.getCellRowColumnValue(column, this.columns); - if (!row || !column) - return null; - if (!this.values[row]) - return null; - if (!this.values[row][column]) - return null; - return this.values[row][column]; - }; - MatrixCells.prototype.getDefaultCellLocText = function (column, val) { - return this.getCellLocText(_settings__WEBPACK_IMPORTED_MODULE_10__["settings"].matrixDefaultRowName, column); - }; - MatrixCells.prototype.getCellDisplayLocText = function (row, column) { - var cellText = this.getCellLocText(row, column); - if (cellText && !cellText.isEmpty) - return cellText; - cellText = this.getCellLocText(_settings__WEBPACK_IMPORTED_MODULE_10__["settings"].matrixDefaultRowName, column); - if (cellText && !cellText.isEmpty) - return cellText; - if (typeof column == "number") { - column = - column >= 0 && column < this.columns.length - ? this.columns[column] - : null; - } - if (column && column.locText) - return column.locText; - return null; - }; - MatrixCells.prototype.getCellText = function (row, column) { - var loc = this.getCellLocText(row, column); - return loc ? loc.calculatedText : null; - }; - MatrixCells.prototype.getDefaultCellText = function (column) { - var loc = this.getCellLocText(_settings__WEBPACK_IMPORTED_MODULE_10__["settings"].matrixDefaultRowName, column); - return loc ? loc.calculatedText : null; - }; - MatrixCells.prototype.getCellDisplayText = function (row, column) { - var loc = this.getCellDisplayLocText(row, column); - return loc ? loc.calculatedText : null; - }; - Object.defineProperty(MatrixCells.prototype, "rows", { - get: function () { - return this.cellsOwner ? this.cellsOwner.getRows() : []; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixCells.prototype, "columns", { - get: function () { - return this.cellsOwner ? this.cellsOwner.getColumns() : []; - }, - enumerable: false, - configurable: true - }); - MatrixCells.prototype.getCellRowColumnValue = function (val, values) { - if (val === null || val === undefined) - return null; - if (typeof val == "number") { - if (val < 0 || val >= values.length) - return null; - val = values[val].value; - } - if (val.value) - return val.value; - return val; - }; - MatrixCells.prototype.getJson = function () { - if (this.isEmpty) - return null; - var res = {}; - for (var row in this.values) { - var resRow = {}; - var rowValues = this.values[row]; - for (var col in rowValues) { - resRow[col] = rowValues[col].getJson(); - } - res[row] = resRow; - } - return res; - }; - MatrixCells.prototype.setJson = function (value) { - this.values = {}; - if (!value) - return; - for (var row in value) { - if (row == "pos") - continue; - var rowValues = value[row]; - this.values[row] = {}; - for (var col in rowValues) { - if (col == "pos") - continue; - var loc = this.createString(); - loc.setJson(rowValues[col]); - this.values[row][col] = loc; - } - } - }; - MatrixCells.prototype.createString = function () { - return new _localizablestring__WEBPACK_IMPORTED_MODULE_8__["LocalizableString"](this.cellsOwner, true); - }; - return MatrixCells; - }()); - - /** - * A Model for a simple matrix question. - */ - var QuestionMatrixModel = /** @class */ (function (_super) { - __extends(QuestionMatrixModel, _super); - function QuestionMatrixModel(name) { - var _this = _super.call(this, name) || this; - _this.isRowChanging = false; - _this.emptyLocalizableString = new _localizablestring__WEBPACK_IMPORTED_MODULE_8__["LocalizableString"](_this); - _this.cellsValue = new MatrixCells(_this); - var self = _this; - _this.registerFunctionOnPropertyValueChanged("columns", function () { - self.onColumnsChanged(); - }); - _this.registerFunctionOnPropertyValueChanged("rows", function () { - if (!self.filterItems()) { - self.onRowsChanged(); - } - }); - _this.registerFunctionOnPropertyValueChanged("hideIfRowsEmpty", function () { - self.updateVisibilityBasedOnRows(); - }); - return _this; - } - QuestionMatrixModel.prototype.getType = function () { - return "matrix"; - }; - Object.defineProperty(QuestionMatrixModel.prototype, "hasSingleInput", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixModel.prototype, "isAllRowRequired", { - /** - * Set this property to true, if you want a user to answer all rows. - */ - get: function () { - return this.getPropertyValue("isAllRowRequired", false); - }, - set: function (val) { - this.setPropertyValue("isAllRowRequired", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixModel.prototype, "hasRows", { - /** - * Returns true, if there is at least one row. - */ - get: function () { - return this.rows.length > 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixModel.prototype, "rowsOrder", { - /** - * Use this property to render items in a specific order: "random" or "initial". Default is "initial". - */ - get: function () { - return this.getPropertyValue("rowsOrder"); - }, - set: function (val) { - val = val.toLowerCase(); - if (val == this.rowsOrder) - return; - this.setPropertyValue("rowsOrder", val); - this.onRowsChanged(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixModel.prototype, "hideIfRowsEmpty", { - /** - * Set this property to true to hide the question if there is no visible rows in the matrix. - */ - get: function () { - return this.getPropertyValue("hideIfRowsEmpty", false); - }, - set: function (val) { - this.setPropertyValue("hideIfRowsEmpty", val); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixModel.prototype.getRows = function () { - return this.rows; - }; - QuestionMatrixModel.prototype.getColumns = function () { - return this.visibleColumns; - }; - QuestionMatrixModel.prototype.addColumn = function (value, text) { - var col = new _itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"](value, text); - this.columns.push(col); - return col; - }; - QuestionMatrixModel.prototype.getItemClass = function (row, column) { - var isChecked = row.value == column.value; - var isDisabled = this.isReadOnly; - var allowHover = !isChecked && !isDisabled; - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]() - .append(this.cssClasses.cell, this.hasCellText) - .append(this.hasCellText ? this.cssClasses.cellText : this.cssClasses.label) - .append(this.cssClasses.itemOnError, !this.hasCellText && this.errors.length > 0) - .append(this.hasCellText ? this.cssClasses.cellTextSelected : this.cssClasses.itemChecked, isChecked) - .append(this.hasCellText ? this.cssClasses.cellTextDisabled : this.cssClasses.itemDisabled, isDisabled) - .append(this.cssClasses.itemHover, allowHover && !this.hasCellText) - .toString(); - }; - QuestionMatrixModel.prototype.getQuizQuestionCount = function () { - var res = 0; - for (var i = 0; i < this.rows.length; i++) { - if (!this.isValueEmpty(this.correctAnswer[this.rows[i].value])) - res++; - } - return res; - }; - QuestionMatrixModel.prototype.getCorrectAnswerCount = function () { - var res = 0; - var value = this.value; - for (var i = 0; i < this.rows.length; i++) { - var row = this.rows[i].value; - if (!this.isValueEmpty(value[row]) && - this.isTwoValueEquals(this.correctAnswer[row], value[row])) - res++; - } - return res; - }; - QuestionMatrixModel.prototype.getVisibleRows = function () { - var result = new Array(); - var val = this.value; - if (!val) - val = {}; - var rows = !!this.filteredRows ? this.filteredRows : this.rows; - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - if (this.isValueEmpty(row.value)) - continue; - result.push(this.createMatrixRow(row, this.id + "_" + row.value.toString().replace(/\s/g, "_"), val[row.value])); - } - if (result.length == 0 && !this.filteredRows) { - result.push(this.createMatrixRow(new _itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"](null), this.name.replace(/\s/g, "_"), val)); - } - this.generatedVisibleRows = result; - return result; - }; - QuestionMatrixModel.prototype.sortVisibleRows = function (array) { - var order = this.rowsOrder.toLowerCase(); - if (order === "random") - return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].randomizeArray(array); - return array; - }; - QuestionMatrixModel.prototype.endLoadingFromJson = function () { - _super.prototype.endLoadingFromJson.call(this); - this.rows = this.sortVisibleRows(this.rows); - this.updateVisibilityBasedOnRows(); - }; - QuestionMatrixModel.prototype.processRowsOnSet = function (newRows) { - return this.sortVisibleRows(newRows); - }; - Object.defineProperty(QuestionMatrixModel.prototype, "visibleRows", { - /** - * Returns the list of visible rows as model objects. - * @see rowsVisibleIf - */ - get: function () { - return this.getVisibleRows(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixModel.prototype, "cells", { - get: function () { - return this.cellsValue; - }, - set: function (value) { - this.cells.setJson(value && value.getJson ? value.getJson() : null); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixModel.prototype, "hasCellText", { - get: function () { - return !this.cells.isEmpty; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixModel.prototype.setCellText = function (row, column, val) { - this.cells.setCellText(row, column, val); - }; - QuestionMatrixModel.prototype.getCellText = function (row, column) { - return this.cells.getCellText(row, column); - }; - QuestionMatrixModel.prototype.setDefaultCellText = function (column, val) { - this.cells.setDefaultCellText(column, val); - }; - QuestionMatrixModel.prototype.getDefaultCellText = function (column) { - return this.cells.getDefaultCellText(column); - }; - QuestionMatrixModel.prototype.getCellDisplayText = function (row, column) { - return this.cells.getCellDisplayText(row, column); - }; - QuestionMatrixModel.prototype.getCellDisplayLocText = function (row, column) { - var loc = this.cells.getCellDisplayLocText(row, column); - return loc ? loc : this.emptyLocalizableString; - }; - QuestionMatrixModel.prototype.supportGoNextPageAutomatic = function () { - return this.hasValuesInAllRows(); - }; - QuestionMatrixModel.prototype.onCheckForErrors = function (errors, isOnValueChanged) { - _super.prototype.onCheckForErrors.call(this, errors, isOnValueChanged); - if ((!isOnValueChanged || this.errors.length > 0) && - this.hasErrorInRows()) { - errors.push(new _error__WEBPACK_IMPORTED_MODULE_6__["RequiredInAllRowsError"](null, this)); - } - }; - QuestionMatrixModel.prototype.hasErrorInRows = function () { - if (!this.isAllRowRequired) - return false; - return !this.hasValuesInAllRows(); - }; - QuestionMatrixModel.prototype.hasValuesInAllRows = function () { - var rows = this.generatedVisibleRows; - if (!rows) - rows = this.visibleRows; - if (!rows) - return true; - for (var i = 0; i < rows.length; i++) { - if (this.isValueEmpty(rows[i].value)) - return false; - } - return true; - }; - QuestionMatrixModel.prototype.getIsAnswered = function () { - return _super.prototype.getIsAnswered.call(this) && this.hasValuesInAllRows(); - }; - QuestionMatrixModel.prototype.createMatrixRow = function (item, fullName, value) { - var row = new MatrixRowModel(item, fullName, this, value); - this.onMatrixRowCreated(row); - return row; - }; - QuestionMatrixModel.prototype.onMatrixRowCreated = function (row) { }; - QuestionMatrixModel.prototype.setQuestionValue = function (newValue, updateIsAnswered) { - if (updateIsAnswered === void 0) { updateIsAnswered = true; } - _super.prototype.setQuestionValue.call(this, newValue, this.isRowChanging || updateIsAnswered); - if (!this.generatedVisibleRows || this.generatedVisibleRows.length == 0) - return; - this.isRowChanging = true; - var val = this.value; - if (!val) - val = {}; - if (this.rows.length == 0) { - this.generatedVisibleRows[0].value = val; - } - else { - for (var i = 0; i < this.generatedVisibleRows.length; i++) { - var row = this.generatedVisibleRows[i]; - var rowVal = val[row.name]; - if (this.isValueEmpty(rowVal)) - rowVal = null; - this.generatedVisibleRows[i].value = rowVal; - } - } - this.updateIsAnswered(); - this.isRowChanging = false; - }; - QuestionMatrixModel.prototype.getDisplayValueCore = function (keysAsText, value) { - var res = {}; - for (var key in value) { - var newKey = keysAsText - ? _itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"].getTextOrHtmlByValue(this.rows, key) - : key; - if (!newKey) - newKey = key; - var newValue = _itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"].getTextOrHtmlByValue(this.columns, value[key]); - if (!newValue) - newValue = value[key]; - res[newKey] = newValue; - } - return res; - }; - QuestionMatrixModel.prototype.getPlainData = function (options) { - var _this = this; - if (options === void 0) { options = { - includeEmpty: true, - }; } - var questionPlainData = _super.prototype.getPlainData.call(this, options); - if (!!questionPlainData) { - var values = this.createValueCopy(); - questionPlainData.isNode = true; - questionPlainData.data = Object.keys(values || {}).map(function (rowName) { - var row = _this.rows.filter(function (r) { return r.value === rowName; })[0]; - var rowDataItem = { - name: rowName, - title: !!row ? row.text : "row", - value: values[rowName], - displayValue: _itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"].getTextOrHtmlByValue(_this.visibleColumns, values[rowName]), - getString: function (val) { - return typeof val === "object" ? JSON.stringify(val) : val; - }, - isNode: false, - }; - var item = _itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"].getItemByValue(_this.visibleColumns, values[rowName]); - if (!!item) { - (options.calculations || []).forEach(function (calculation) { - rowDataItem[calculation.propertyName] = - item[calculation.propertyName]; - }); - } - return rowDataItem; - }); - } - return questionPlainData; - }; - QuestionMatrixModel.prototype.addConditionObjectsByContext = function (objects, context) { - for (var i = 0; i < this.rows.length; i++) { - var row = this.rows[i]; - if (!!row.value) { - objects.push({ - name: this.getValueName() + "." + row.value, - text: this.processedTitle + "." + row.calculatedText, - question: this, - }); - } - } - }; - QuestionMatrixModel.prototype.getConditionJson = function (operator, path) { - if (path === void 0) { path = null; } - if (!path) - return _super.prototype.getConditionJson.call(this); - var question = new _question_dropdown__WEBPACK_IMPORTED_MODULE_9__["QuestionDropdownModel"](path); - question.choices = this.columns; - var json = new _jsonobject__WEBPACK_IMPORTED_MODULE_3__["JsonObject"]().toJsonObject(question); - json["type"] = question.getType(); - return json; - }; - QuestionMatrixModel.prototype.clearValueIfInvisible = function () { - _super.prototype.clearValueIfInvisible.call(this); - if (this.hasRows) { - this.clearInvisibleValuesInRows(); - } - }; - QuestionMatrixModel.prototype.getFirstInputElementId = function () { - var rows = this.generatedVisibleRows; - if (!rows) - rows = this.visibleRows; - if (rows.length > 0 && this.visibleColumns.length > 0) { - return this.inputId + "_" + rows[0].name + "_" + 0; - } - return _super.prototype.getFirstInputElementId.call(this); - }; - QuestionMatrixModel.prototype.onRowsChanged = function () { - this.updateVisibilityBasedOnRows(); - _super.prototype.onRowsChanged.call(this); - }; - QuestionMatrixModel.prototype.updateVisibilityBasedOnRows = function () { - if (this.hideIfRowsEmpty) { - this.visible = - this.rows.length > 0 && - (!this.filteredRows || this.filteredRows.length > 0); - } - }; - //IMatrixData - QuestionMatrixModel.prototype.onMatrixRowChanged = function (row) { - if (this.isRowChanging) - return; - this.isRowChanging = true; - if (!this.hasRows) { - this.setNewValue(row.value); - } - else { - var newValue = this.value; - if (!newValue) { - newValue = {}; - } - newValue[row.name] = row.value; - this.setNewValue(newValue); - } - this.isRowChanging = false; - }; - QuestionMatrixModel.prototype.getCorrectedRowValue = function (value) { - for (var i = 0; i < this.columns.length; i++) { - if (value === this.columns[i].value) - return value; - } - for (var i = 0; i < this.columns.length; i++) { - if (this.isTwoValueEquals(value, this.columns[i].value)) - return this.columns[i].value; - } - return value; - }; - QuestionMatrixModel.prototype.getSearchableItemValueKeys = function (keys) { - keys.push("columns"); - keys.push("rows"); - }; - Object.defineProperty(QuestionMatrixModel.prototype, "SurveyModel", { - get: function () { - return this.survey; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixModel.prototype.getColumnHeaderWrapperComponentName = function (cell) { - return this.SurveyModel.getElementWrapperComponentName({ column: cell }, "column-header"); - }; - QuestionMatrixModel.prototype.getColumnHeaderWrapperComponentData = function (cell) { - return this.SurveyModel.getElementWrapperComponentData({ column: cell }, "column-header"); - }; - QuestionMatrixModel.prototype.getRowHeaderWrapperComponentName = function (cell) { - return this.SurveyModel.getElementWrapperComponentName({ row: cell }, "row-header"); - }; - QuestionMatrixModel.prototype.getRowHeaderWrapperComponentData = function (cell) { - return this.SurveyModel.getElementWrapperComponentData({ row: cell }, "row-header"); - }; - return QuestionMatrixModel; - }(_martixBase__WEBPACK_IMPORTED_MODULE_2__["QuestionMatrixBaseModel"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("matrix", [ - { - name: "columns:itemvalue[]", - baseValue: function () { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_5__["surveyLocalization"].getString("matrix_column"); - }, - }, - { - name: "rows:itemvalue[]", - baseValue: function () { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_5__["surveyLocalization"].getString("matrix_row"); - }, - }, - { name: "cells:cells", serializationProperty: "cells" }, - { - name: "rowsOrder", - default: "initial", - choices: ["initial", "random"], - }, - "isAllRowRequired:boolean", - "hideIfRowsEmpty:boolean", - ], function () { - return new QuestionMatrixModel(""); - }, "matrixbase"); - _questionfactory__WEBPACK_IMPORTED_MODULE_7__["QuestionFactory"].Instance.registerQuestion("matrix", function (name) { - var q = new QuestionMatrixModel(name); - q.rows = _questionfactory__WEBPACK_IMPORTED_MODULE_7__["QuestionFactory"].DefaultRows; - q.columns = _questionfactory__WEBPACK_IMPORTED_MODULE_7__["QuestionFactory"].DefaultColums; - return q; - }); - - - /***/ }), - - /***/ "./src/question_matrixdropdown.ts": - /*!****************************************!*\ - !*** ./src/question_matrixdropdown.ts ***! - \****************************************/ - /*! exports provided: MatrixDropdownRowModel, QuestionMatrixDropdownModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDropdownRowModel", function() { return MatrixDropdownRowModel; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDropdownModel", function() { return QuestionMatrixDropdownModel; }); - /* harmony import */ var _question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question_matrixdropdownbase */ "./src/question_matrixdropdownbase.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - var MatrixDropdownRowModel = /** @class */ (function (_super) { - __extends(MatrixDropdownRowModel, _super); - function MatrixDropdownRowModel(name, item, data, value) { - var _this = _super.call(this, data, value) || this; - _this.name = name; - _this.item = item; - _this.buildCells(value); - return _this; - } - Object.defineProperty(MatrixDropdownRowModel.prototype, "rowName", { - get: function () { - return this.name; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownRowModel.prototype, "text", { - get: function () { - return this.item.text; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownRowModel.prototype, "locText", { - get: function () { - return this.item.locText; - }, - enumerable: false, - configurable: true - }); - return MatrixDropdownRowModel; - }(_question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_0__["MatrixDropdownRowModelBase"])); - - /** - * A Model for a matrix dropdown question. You may use a dropdown, checkbox, radiogroup, text and comment questions as a cell editors. - */ - var QuestionMatrixDropdownModel = /** @class */ (function (_super) { - __extends(QuestionMatrixDropdownModel, _super); - function QuestionMatrixDropdownModel(name) { - var _this = _super.call(this, name) || this; - _this.createLocalizableString("totalText", _this, true); - var self = _this; - _this.registerFunctionOnPropertyValueChanged("rows", function () { - self.clearGeneratedRows(); - self.resetRenderedTable(); - self.filterItems(); - }); - return _this; - } - QuestionMatrixDropdownModel.prototype.getType = function () { - return "matrixdropdown"; - }; - Object.defineProperty(QuestionMatrixDropdownModel.prototype, "totalText", { - /** - * Set this property to show it on the first column for the total row. - */ - get: function () { - return this.getLocalizableStringText("totalText", ""); - }, - set: function (val) { - this.setLocalizableStringText("totalText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModel.prototype, "locTotalText", { - get: function () { - return this.getLocalizableString("totalText"); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModel.prototype.getFooterText = function () { - return this.locTotalText; - }; - Object.defineProperty(QuestionMatrixDropdownModel.prototype, "rowTitleWidth", { - /** - * The column width for the first column, row title column. - */ - get: function () { - return this.getPropertyValue("rowTitleWidth", ""); - }, - set: function (val) { - this.setPropertyValue("rowTitleWidth", val); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModel.prototype.getRowTitleWidth = function () { - return this.rowTitleWidth; - }; - QuestionMatrixDropdownModel.prototype.getDisplayValueCore = function (keysAsText, value) { - if (!value) - return value; - var rows = this.visibleRows; - var res = {}; - if (!rows) - return res; - for (var i = 0; i < rows.length; i++) { - var rowValue = rows[i].rowName; - var val = value[rowValue]; - if (!val) - continue; - if (keysAsText) { - var displayRowValue = _itemvalue__WEBPACK_IMPORTED_MODULE_2__["ItemValue"].getTextOrHtmlByValue(this.rows, rowValue); - if (!!displayRowValue) { - rowValue = displayRowValue; - } - } - res[rowValue] = this.getRowDisplayValue(keysAsText, rows[i], val); - } - return res; - }; - QuestionMatrixDropdownModel.prototype.addConditionObjectsByContext = function (objects, context) { - var hasContext = !!context ? this.columns.indexOf(context) > -1 : false; - for (var i = 0; i < this.rows.length; i++) { - var row = this.rows[i]; - if (!row.value) - continue; - var prefixName = this.getValueName() + "." + row.value + "."; - var prefixTitle = this.processedTitle + "." + row.calculatedText + "."; - for (var j = 0; j < this.columns.length; j++) { - var column = this.columns[j]; - objects.push({ - name: prefixName + column.name, - text: prefixTitle + column.fullTitle, - question: this, - }); - } - } - if (hasContext) { - for (var i = 0; i < this.columns.length; i++) { - var column = this.columns[i]; - if (column == context) - continue; - objects.push({ - name: "row." + column.name, - text: "row." + column.fullTitle, - question: this, - }); - } - } - }; - QuestionMatrixDropdownModel.prototype.clearIncorrectValues = function () { - var val = this.value; - if (!val) - return; - var newVal = null; - var isChanged = false; - var rows = !!this.filteredRows ? this.filteredRows : this.rows; - for (var key in val) { - if (_itemvalue__WEBPACK_IMPORTED_MODULE_2__["ItemValue"].getItemByValue(rows, key)) { - if (newVal == null) - newVal = {}; - newVal[key] = val[key]; - } - else { - isChanged = true; - } - } - if (isChanged) { - this.value = newVal; - } - _super.prototype.clearIncorrectValues.call(this); - }; - QuestionMatrixDropdownModel.prototype.clearValueIfInvisible = function () { - _super.prototype.clearValueIfInvisible.call(this); - this.clearInvisibleValuesInRows(); - }; - QuestionMatrixDropdownModel.prototype.generateRows = function () { - var result = new Array(); - var rows = !!this.filteredRows ? this.filteredRows : this.rows; - if (!rows || rows.length === 0) - return result; - var val = this.value; - if (!val) - val = {}; - for (var i = 0; i < rows.length; i++) { - if (!rows[i].value) - continue; - result.push(this.createMatrixRow(rows[i], val[rows[i].value])); - } - return result; - }; - QuestionMatrixDropdownModel.prototype.createMatrixRow = function (item, value) { - return new MatrixDropdownRowModel(item.value, item, this, value); - }; - QuestionMatrixDropdownModel.prototype.getSearchableItemValueKeys = function (keys) { - keys.push("rows"); - }; - return QuestionMatrixDropdownModel; - }(_question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_0__["QuestionMatrixDropdownModelBase"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("matrixdropdown", [ - { - name: "rows:itemvalue[]", - }, - "rowsVisibleIf:condition", - "rowTitleWidth", - { name: "totalText", serializationProperty: "locTotalText" }, - ], function () { - return new QuestionMatrixDropdownModel(""); - }, "matrixdropdownbase"); - _questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].Instance.registerQuestion("matrixdropdown", function (name) { - var q = new QuestionMatrixDropdownModel(name); - q.choices = [1, 2, 3, 4, 5]; - q.rows = _questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].DefaultRows; - _question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_0__["QuestionMatrixDropdownModelBase"].addDefaultColumns(q); - return q; - }); - - - /***/ }), - - /***/ "./src/question_matrixdropdownbase.ts": - /*!********************************************!*\ - !*** ./src/question_matrixdropdownbase.ts ***! - \********************************************/ - /*! exports provided: MatrixDropdownCell, MatrixDropdownTotalCell, MatrixDropdownRowModelBase, MatrixDropdownTotalRowModel, QuestionMatrixDropdownModelBase */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDropdownCell", function() { return MatrixDropdownCell; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDropdownTotalCell", function() { return MatrixDropdownTotalCell; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDropdownRowModelBase", function() { return MatrixDropdownRowModelBase; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDropdownTotalRowModel", function() { return MatrixDropdownTotalRowModel; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDropdownModelBase", function() { return QuestionMatrixDropdownModelBase; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _martixBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./martixBase */ "./src/martixBase.ts"); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); - /* harmony import */ var _textPreProcessor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./textPreProcessor */ "./src/textPreProcessor.ts"); - /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _functionsfactory__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./functionsfactory */ "./src/functionsfactory.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./error */ "./src/error.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - /* harmony import */ var _question_matrixdropdowncolumn__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./question_matrixdropdowncolumn */ "./src/question_matrixdropdowncolumn.ts"); - /* harmony import */ var _question_matrixdropdownrendered__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./question_matrixdropdownrendered */ "./src/question_matrixdropdownrendered.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - - - - - - - - - - var MatrixDropdownCell = /** @class */ (function () { - function MatrixDropdownCell(column, row, data) { - this.column = column; - this.row = row; - this.data = data; - this.questionValue = this.createQuestion(column, row, data); - this.questionValue.updateCustomWidget(); - } - MatrixDropdownCell.prototype.locStrsChanged = function () { - this.question.locStrsChanged(); - }; - MatrixDropdownCell.prototype.createQuestion = function (column, row, data) { - var res = data.createQuestion(this.row, this.column); - res.validateValueCallback = function () { - return data.validateCell(row, column.name, row.value); - }; - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["CustomPropertiesCollection"].getProperties(column.getType()).forEach(function (property) { - var propertyName = property.name; - if (column[propertyName] !== undefined) { - res[propertyName] = column[propertyName]; - } - }); - return res; - }; - Object.defineProperty(MatrixDropdownCell.prototype, "question", { - get: function () { - return this.questionValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownCell.prototype, "value", { - get: function () { - return this.question.value; - }, - set: function (value) { - this.question.value = value; - }, - enumerable: false, - configurable: true - }); - MatrixDropdownCell.prototype.runCondition = function (values, properties) { - this.question.runCondition(values, properties); - }; - return MatrixDropdownCell; - }()); - - var MatrixDropdownTotalCell = /** @class */ (function (_super) { - __extends(MatrixDropdownTotalCell, _super); - function MatrixDropdownTotalCell(column, row, data) { - var _this = _super.call(this, column, row, data) || this; - _this.column = column; - _this.row = row; - _this.data = data; - _this.updateCellQuestion(); - return _this; - } - MatrixDropdownTotalCell.prototype.createQuestion = function (column, row, data) { - var res = _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].createClass("expression"); - res.setSurveyImpl(row); - return res; - }; - MatrixDropdownTotalCell.prototype.locStrsChanged = function () { - this.updateCellQuestion(); - _super.prototype.locStrsChanged.call(this); - }; - MatrixDropdownTotalCell.prototype.updateCellQuestion = function () { - this.question.locCalculation(); - this.column.updateCellQuestion(this.question, null, function (json) { - delete json["defaultValue"]; - }); - this.question.expression = this.getTotalExpression(); - this.question.format = this.column.totalFormat; - this.question.currency = this.column.totalCurrency; - this.question.displayStyle = this.column.totalDisplayStyle; - this.question.maximumFractionDigits = this.column.totalMaximumFractionDigits; - this.question.minimumFractionDigits = this.column.totalMinimumFractionDigits; - this.question.unlocCalculation(); - this.question.runIfReadOnly = true; - }; - MatrixDropdownTotalCell.prototype.getTotalExpression = function () { - if (!!this.column.totalExpression) - return this.column.totalExpression; - if (this.column.totalType == "none") - return ""; - var funName = this.column.totalType + "InArray"; - if (!_functionsfactory__WEBPACK_IMPORTED_MODULE_8__["FunctionFactory"].Instance.hasFunction(funName)) - return ""; - return funName + "({self}, '" + this.column.name + "')"; - }; - return MatrixDropdownTotalCell; - }(MatrixDropdownCell)); - - var MatrixDropdownRowTextProcessor = /** @class */ (function (_super) { - __extends(MatrixDropdownRowTextProcessor, _super); - function MatrixDropdownRowTextProcessor(row, variableName) { - var _this = _super.call(this, variableName) || this; - _this.row = row; - _this.variableName = variableName; - return _this; - } - Object.defineProperty(MatrixDropdownRowTextProcessor.prototype, "survey", { - get: function () { - return this.row.getSurvey(); - }, - enumerable: false, - configurable: true - }); - MatrixDropdownRowTextProcessor.prototype.getValues = function () { - return this.row.value; - }; - MatrixDropdownRowTextProcessor.prototype.getQuestionByName = function (name) { - return this.row.getQuestionByName(name); - }; - MatrixDropdownRowTextProcessor.prototype.onCustomProcessText = function (textValue) { - if (textValue.name == MatrixDropdownRowModelBase.IndexVariableName) { - textValue.isExists = true; - textValue.value = this.row.rowIndex; - return true; - } - if (textValue.name == MatrixDropdownRowModelBase.RowValueVariableName) { - textValue.isExists = true; - textValue.value = this.row.rowName; - return true; - } - return false; - }; - return MatrixDropdownRowTextProcessor; - }(_textPreProcessor__WEBPACK_IMPORTED_MODULE_4__["QuestionTextProcessor"])); - var MatrixDropdownRowModelBase = /** @class */ (function () { - function MatrixDropdownRowModelBase(data, value) { - var _this = this; - this.isSettingValue = false; - this.detailPanelValue = null; - this.cells = []; - this.isCreatingDetailPanel = false; - this.data = data; - this.subscribeToChanges(value); - this.textPreProcessor = new MatrixDropdownRowTextProcessor(this, MatrixDropdownRowModelBase.RowVariableName); - this.showHideDetailPanelClick = function () { - _this.showHideDetailPanel(); - }; - this.idValue = MatrixDropdownRowModelBase.getId(); - } - MatrixDropdownRowModelBase.getId = function () { - return "srow_" + MatrixDropdownRowModelBase.idCounter++; - }; - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "id", { - get: function () { - return this.idValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "rowName", { - get: function () { - return null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "text", { - get: function () { - return this.rowName; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "value", { - get: function () { - var result = {}; - var questions = this.questions; - for (var i = 0; i < questions.length; i++) { - var question = questions[i]; - if (!question.isEmpty()) { - result[question.getValueName()] = question.value; - } - if (!!question.comment && - !!this.getSurvey() && - this.getSurvey().storeOthersAsComment) { - result[question.getValueName() + _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].commentPrefix] = - question.comment; - } - } - return result; - }, - set: function (value) { - this.isSettingValue = true; - this.subscribeToChanges(value); - var questions = this.questions; - for (var i = 0; i < questions.length; i++) { - var question = questions[i]; - var val = this.getCellValue(value, question.getValueName()); - var oldComment = question.comment; - var comment = !!value - ? value[question.getValueName() + _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].commentPrefix] - : ""; - if (comment == undefined) - comment = ""; - question.updateValueFromSurvey(val); - if (!!comment || this.isTwoValueEquals(oldComment, question.comment)) { - question.updateCommentFromSurvey(comment); - } - question.onSurveyValueChanged(val); - } - this.isSettingValue = false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "locText", { - get: function () { - return null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "hasPanel", { - get: function () { - if (!this.data) - return false; - return this.data.hasDetailPanel(this); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "detailPanel", { - get: function () { - return this.detailPanelValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "detailPanelId", { - get: function () { - return !!this.detailPanel ? this.detailPanel.id : ""; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "isDetailPanelShowing", { - get: function () { - return !!this.data ? this.data.getIsDetailPanelShowing(this) : false; - }, - enumerable: false, - configurable: true - }); - MatrixDropdownRowModelBase.prototype.setIsDetailPanelShowing = function (val) { - if (!!this.data) { - this.data.setIsDetailPanelShowing(this, val); - } - if (!!this.onDetailPanelShowingChanged) { - this.onDetailPanelShowingChanged(); - } - }; - MatrixDropdownRowModelBase.prototype.showHideDetailPanel = function () { - if (this.isDetailPanelShowing) { - this.hideDetailPanel(); - } - else { - this.showDetailPanel(); - } - }; - MatrixDropdownRowModelBase.prototype.showDetailPanel = function () { - this.ensureDetailPanel(); - if (!this.detailPanelValue) - return; - this.setIsDetailPanelShowing(true); - }; - MatrixDropdownRowModelBase.prototype.hideDetailPanel = function (destroyPanel) { - if (destroyPanel === void 0) { destroyPanel = false; } - this.setIsDetailPanelShowing(false); - if (destroyPanel) { - this.detailPanelValue = null; - } - }; - MatrixDropdownRowModelBase.prototype.ensureDetailPanel = function () { - if (this.isCreatingDetailPanel) - return; - if (!!this.detailPanelValue || !this.hasPanel || !this.data) - return; - this.isCreatingDetailPanel = true; - this.detailPanelValue = this.data.createRowDetailPanel(this); - var questions = this.detailPanelValue.questions; - var value = this.data.getRowValue(this.data.getRowIndex(this)); - if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(value)) { - for (var i = 0; i < questions.length; i++) { - var key = questions[i].getValueName(); - if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(value[key])) { - questions[i].value = value[key]; - } - } - } - this.detailPanelValue.setSurveyImpl(this); - this.isCreatingDetailPanel = false; - }; - MatrixDropdownRowModelBase.prototype.getAllValues = function () { - return this.value; - }; - MatrixDropdownRowModelBase.prototype.getFilteredValues = function () { - var allValues = this.getAllValues(); - var values = { row: allValues }; - for (var key in allValues) { - values[key] = allValues[key]; - } - return values; - }; - MatrixDropdownRowModelBase.prototype.getFilteredProperties = function () { - return { survey: this.getSurvey(), row: this }; - }; - MatrixDropdownRowModelBase.prototype.runCondition = function (values, properties) { - if (!!this.data) { - values[MatrixDropdownRowModelBase.OwnerVariableName] = this.data.value; - } - values[MatrixDropdownRowModelBase.IndexVariableName] = this.rowIndex; - values[MatrixDropdownRowModelBase.RowValueVariableName] = this.rowName; - if (!properties) - properties = {}; - properties[MatrixDropdownRowModelBase.RowVariableName] = this; - for (var i = 0; i < this.cells.length; i++) { - values[MatrixDropdownRowModelBase.RowVariableName] = this.value; - this.cells[i].runCondition(values, properties); - } - if (!!this.detailPanel) { - this.detailPanel.runCondition(values, properties); - } - }; - MatrixDropdownRowModelBase.prototype.clearValue = function () { - var questions = this.questions; - for (var i = 0; i < questions.length; i++) { - questions[i].clearValue(); - } - }; - MatrixDropdownRowModelBase.prototype.onAnyValueChanged = function (name) { - var questions = this.questions; - for (var i = 0; i < questions.length; i++) { - questions[i].onAnyValueChanged(name); - } - }; - MatrixDropdownRowModelBase.prototype.getDataValueCore = function (valuesHash, key) { - var survey = this.getSurvey(); - if (!!survey) { - return survey.getDataValueCore(valuesHash, key); - } - else { - return valuesHash[key]; - } - }; - MatrixDropdownRowModelBase.prototype.getValue = function (name) { - var question = this.getQuestionByName(name); - return !!question ? question.value : null; - }; - MatrixDropdownRowModelBase.prototype.setValue = function (name, newColumnValue) { - this.setValueCore(name, newColumnValue, false); - }; - MatrixDropdownRowModelBase.prototype.getVariable = function (name) { - return undefined; - }; - MatrixDropdownRowModelBase.prototype.setVariable = function (name, newValue) { }; - MatrixDropdownRowModelBase.prototype.getComment = function (name) { - var question = this.getQuestionByName(name); - return !!question ? question.comment : ""; - }; - MatrixDropdownRowModelBase.prototype.setComment = function (name, newValue, locNotification) { - this.setValueCore(name, newValue, true); - }; - MatrixDropdownRowModelBase.prototype.setValueCore = function (name, newColumnValue, isComment) { - if (this.isSettingValue) - return; - this.updateQuestionsValue(name, newColumnValue, isComment); - var newValue = this.value; - var changedName = isComment ? name + _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].commentPrefix : name; - var changedValue = isComment ? this.getComment(name) : this.getValue(name); - var changedQuestion = this.getQuestionByName(name); - var changingValue = this.data.onRowChanging(this, changedName, newValue); - if (!!changedQuestion && - !this.isTwoValueEquals(changingValue, changedValue)) { - if (isComment) { - changedQuestion.comment = changingValue; - } - else { - changedQuestion.value = changingValue; - } - } - else { - if (this.data.isValidateOnValueChanging && - this.hasQuestonError(changedQuestion)) - return; - this.data.onRowChanged(this, changedName, newValue, newColumnValue == null && !changedQuestion); - this.onAnyValueChanged(MatrixDropdownRowModelBase.RowVariableName); - } - }; - MatrixDropdownRowModelBase.prototype.updateQuestionsValue = function (name, newColumnValue, isComment) { - if (!this.detailPanel) - return; - var colQuestion = this.getQuestionByColumnName(name); - var detailQuestion = this.detailPanel.getQuestionByName(name); - if (!colQuestion || !detailQuestion) - return; - var isColQuestion = this.isTwoValueEquals(newColumnValue, isComment ? colQuestion.comment : colQuestion.value); - var question = isColQuestion ? detailQuestion : colQuestion; - this.isSettingValue = true; - if (!isComment) { - question.value = newColumnValue; - } - else { - question.comment = newColumnValue; - } - this.isSettingValue = false; - }; - MatrixDropdownRowModelBase.prototype.hasQuestonError = function (question) { - if (!question) - return false; - if (question.hasErrors(true, { - isOnValueChanged: !this.data.isValidateOnValueChanging, - })) - return true; - if (question.isEmpty()) - return false; - var cell = this.getCellByColumnName(question.name); - if (!cell || !cell.column || !cell.column.isUnique) - return false; - return this.data.checkIfValueInRowDuplicated(this, question); - }; - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "isEmpty", { - get: function () { - var val = this.value; - if (_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(val)) - return true; - for (var key in val) { - if (val[key] !== undefined && val[key] !== null) - return false; - } - return true; - }, - enumerable: false, - configurable: true - }); - MatrixDropdownRowModelBase.prototype.getQuestionByColumn = function (column) { - var cell = this.getCellByColumn(column); - return !!cell ? cell.question : null; - }; - MatrixDropdownRowModelBase.prototype.getCellByColumn = function (column) { - for (var i = 0; i < this.cells.length; i++) { - if (this.cells[i].column == column) - return this.cells[i]; - } - return null; - }; - MatrixDropdownRowModelBase.prototype.getCellByColumnName = function (columnName) { - for (var i = 0; i < this.cells.length; i++) { - if (this.cells[i].column.name == columnName) - return this.cells[i]; - } - return null; - }; - MatrixDropdownRowModelBase.prototype.getQuestionByColumnName = function (columnName) { - var cell = this.getCellByColumnName(columnName); - return !!cell ? cell.question : null; - }; - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "questions", { - get: function () { - var res = []; - for (var i = 0; i < this.cells.length; i++) { - res.push(this.cells[i].question); - } - var detailQuestions = !!this.detailPanel ? this.detailPanel.questions : []; - for (var i = 0; i < detailQuestions.length; i++) { - res.push(detailQuestions[i]); - } - return res; - }, - enumerable: false, - configurable: true - }); - MatrixDropdownRowModelBase.prototype.getQuestionByName = function (name) { - var res = this.getQuestionByColumnName(name); - if (!!res) - return res; - return !!this.detailPanel ? this.detailPanel.getQuestionByName(name) : null; - }; - MatrixDropdownRowModelBase.prototype.getQuestionsByName = function (name) { - var res = []; - var q = this.getQuestionByColumnName(name); - if (!!q) - res.push(q); - if (!!this.detailPanel) { - q = this.detailPanel.getQuestionByName(name); - if (!!q) - res.push(q); - } - return res; - }; - MatrixDropdownRowModelBase.prototype.getSharedQuestionByName = function (columnName) { - return !!this.data - ? this.data.getSharedQuestionByName(columnName, this) - : null; - }; - MatrixDropdownRowModelBase.prototype.clearIncorrectValues = function (val) { - for (var key in val) { - var question = this.getQuestionByName(key); - if (question) { - var qVal = question.value; - question.clearIncorrectValues(); - if (!this.isTwoValueEquals(qVal, question.value)) { - this.setValue(key, question.value); - } - } - else { - if (!this.getSharedQuestionByName(key) && - key.indexOf(_settings__WEBPACK_IMPORTED_MODULE_9__["settings"].matrixTotalValuePostFix) < 0) { - this.setValue(key, null); - } - } - } - }; - MatrixDropdownRowModelBase.prototype.getLocale = function () { - return this.data ? this.data.getLocale() : ""; - }; - MatrixDropdownRowModelBase.prototype.getMarkdownHtml = function (text, name) { - return this.data ? this.data.getMarkdownHtml(text, name) : null; - }; - MatrixDropdownRowModelBase.prototype.getRenderer = function (name) { - return this.data ? this.data.getRenderer(name) : null; - }; - MatrixDropdownRowModelBase.prototype.getRendererContext = function (locStr) { - return this.data ? this.data.getRendererContext(locStr) : locStr; - }; - MatrixDropdownRowModelBase.prototype.getProcessedText = function (text) { - return this.data ? this.data.getProcessedText(text) : text; - }; - MatrixDropdownRowModelBase.prototype.locStrsChanged = function () { - for (var i = 0; i < this.cells.length; i++) { - this.cells[i].locStrsChanged(); - } - if (!!this.detailPanel) { - this.detailPanel.locStrsChanged(); - } - }; - MatrixDropdownRowModelBase.prototype.updateCellQuestionOnColumnChanged = function (column, name, newValue) { - var cell = this.getCellByColumn(column); - if (!cell) - return; - this.updateCellOnColumnChanged(cell, name, newValue); - }; - MatrixDropdownRowModelBase.prototype.updateCellQuestionOnColumnItemValueChanged = function (column, propertyName, obj, name, newValue, oldValue) { - var cell = this.getCellByColumn(column); - if (!cell) - return; - this.updateCellOnColumnItemValueChanged(cell, propertyName, obj, name, newValue, oldValue); - }; - MatrixDropdownRowModelBase.prototype.onQuestionReadOnlyChanged = function (parentIsReadOnly) { - var questions = this.questions; - for (var i = 0; i < questions.length; i++) { - questions[i].readOnly = parentIsReadOnly; - } - if (!!this.detailPanel) { - this.detailPanel.readOnly = parentIsReadOnly; - } - }; - MatrixDropdownRowModelBase.prototype.hasErrors = function (fireCallback, rec, raiseOnCompletedAsyncValidators) { - var res = false; - var cells = this.cells; - if (!cells) - return res; - for (var colIndex = 0; colIndex < cells.length; colIndex++) { - if (!cells[colIndex]) - continue; - var question = cells[colIndex].question; - if (!question || !question.visible) - continue; - question.onCompletedAsyncValidators = function (hasErrors) { - raiseOnCompletedAsyncValidators(); - }; - if (!!rec && rec.isOnValueChanged === true && question.isEmpty()) - continue; - res = question.hasErrors(fireCallback, rec) || res; - } - if (this.hasPanel) { - this.ensureDetailPanel(); - var panelHasError = this.detailPanel.hasErrors(fireCallback, false, rec); - if (!rec.hideErroredPanel && panelHasError && fireCallback) { - if (rec.isSingleDetailPanel) { - rec.hideErroredPanel = true; - } - this.showDetailPanel(); - } - res = panelHasError || res; - } - return res; - }; - MatrixDropdownRowModelBase.prototype.updateCellOnColumnChanged = function (cell, name, newValue) { - cell.question[name] = newValue; - }; - MatrixDropdownRowModelBase.prototype.updateCellOnColumnItemValueChanged = function (cell, propertyName, obj, name, newValue, oldValue) { - var items = cell.question[propertyName]; - if (!Array.isArray(items)) - return; - var val = name === "value" ? oldValue : obj["value"]; - var item = _itemvalue__WEBPACK_IMPORTED_MODULE_5__["ItemValue"].getItemByValue(items, val); - if (!item) - return; - item[name] = newValue; - }; - MatrixDropdownRowModelBase.prototype.buildCells = function (value) { - this.isSettingValue = true; - var columns = this.data.columns; - for (var i = 0; i < columns.length; i++) { - var column = columns[i]; - if (!column.isVisible) - continue; - var cell = this.createCell(column); - this.cells.push(cell); - var cellValue = this.getCellValue(value, column.name); - if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(cellValue)) { - cell.question.value = cellValue; - var commentKey = column.name + _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].commentPrefix; - if (!!value && !_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(value[commentKey])) { - cell.question.comment = value[commentKey]; - } - } - } - this.isSettingValue = false; - }; - MatrixDropdownRowModelBase.prototype.isTwoValueEquals = function (val1, val2) { - return _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isTwoValueEquals(val1, val2, false, true, false); - }; - MatrixDropdownRowModelBase.prototype.getCellValue = function (value, name) { - if (!!this.editingObj) - return _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].getObjPropertyValue(this.editingObj, name); - return !!value ? value[name] : undefined; - }; - MatrixDropdownRowModelBase.prototype.createCell = function (column) { - return new MatrixDropdownCell(column, this, this.data); - }; - MatrixDropdownRowModelBase.prototype.getSurveyData = function () { - return this; - }; - MatrixDropdownRowModelBase.prototype.getSurvey = function () { - return this.data ? this.data.getSurvey() : null; - }; - MatrixDropdownRowModelBase.prototype.getTextProcessor = function () { - return this.textPreProcessor; - }; - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "rowIndex", { - get: function () { - return !!this.data ? this.data.getRowIndex(this) + 1 : -1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownRowModelBase.prototype, "editingObj", { - get: function () { - return this.editingObjValue; - }, - enumerable: false, - configurable: true - }); - MatrixDropdownRowModelBase.prototype.dispose = function () { - if (!!this.editingObj) { - this.editingObj.onPropertyChanged.remove(this.onEditingObjPropertyChanged); - this.editingObjValue = null; - } - }; - MatrixDropdownRowModelBase.prototype.subscribeToChanges = function (value) { - var _this = this; - if (!value || !value.getType || !value.onPropertyChanged) - return; - if (value === this.editingObj) - return; - this.editingObjValue = value; - this.onEditingObjPropertyChanged = function (sender, options) { - _this.updateOnSetValue(options.name, options.newValue); - }; - this.editingObj.onPropertyChanged.add(this.onEditingObjPropertyChanged); - }; - MatrixDropdownRowModelBase.prototype.updateOnSetValue = function (name, newValue) { - this.isSettingValue = true; - var questions = this.getQuestionsByName(name); - for (var i = 0; i < questions.length; i++) { - questions[i].value = newValue; - } - this.isSettingValue = false; - }; - MatrixDropdownRowModelBase.RowVariableName = "row"; - MatrixDropdownRowModelBase.OwnerVariableName = "self"; - MatrixDropdownRowModelBase.IndexVariableName = "rowIndex"; - MatrixDropdownRowModelBase.RowValueVariableName = "rowValue"; - MatrixDropdownRowModelBase.idCounter = 1; - return MatrixDropdownRowModelBase; - }()); - - var MatrixDropdownTotalRowModel = /** @class */ (function (_super) { - __extends(MatrixDropdownTotalRowModel, _super); - function MatrixDropdownTotalRowModel(data) { - var _this = _super.call(this, data, null) || this; - _this.buildCells(null); - return _this; - } - MatrixDropdownTotalRowModel.prototype.createCell = function (column) { - return new MatrixDropdownTotalCell(column, this, this.data); - }; - MatrixDropdownTotalRowModel.prototype.setValue = function (name, newValue) { - if (!!this.data && !this.isSettingValue) { - this.data.onTotalValueChanged(); - } - }; - MatrixDropdownTotalRowModel.prototype.runCondition = function (values, properties) { - var counter = 0; - var prevValue; - do { - prevValue = _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].getUnbindValue(this.value); - _super.prototype.runCondition.call(this, values, properties); - counter++; - } while (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isTwoValueEquals(prevValue, this.value) && counter < 3); - }; - MatrixDropdownTotalRowModel.prototype.updateCellOnColumnChanged = function (cell, name, newValue) { - cell.updateCellQuestion(); - }; - return MatrixDropdownTotalRowModel; - }(MatrixDropdownRowModelBase)); - - /** - * A base class for matrix dropdown and matrix dynamic questions. - */ - var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) { - __extends(QuestionMatrixDropdownModelBase, _super); - function QuestionMatrixDropdownModelBase(name) { - var _this = _super.call(this, name) || this; - _this.isRowChanging = false; - _this.lockResetRenderedTable = false; - _this.isDoingonAnyValueChanged = false; - _this.createItemValues("choices"); - _this.createLocalizableString("optionsCaption", _this); - _this.createLocalizableString("keyDuplicationError", _this); - _this.detailPanelValue = _this.createNewDetailPanel(); - _this.detailPanel.selectedElementInDesign = _this; - _this.detailPanel.renderWidth = "100%"; - _this.registerFunctionOnPropertyValueChanged("columns", function (newColumns) { - _this.updateColumnsAndRows(); - }); - _this.registerFunctionOnPropertyValueChanged("cellType", function () { - _this.updateColumnsAndRows(); - }); - _this.registerFunctionOnPropertiesValueChanged(["optionsCaption", "columnColCount", "rowTitleWidth", "choices"], function () { - _this.clearRowsAndResetRenderedTable(); - }); - _this.registerFunctionOnPropertiesValueChanged([ - "columnLayout", - "addRowLocation", - "hideColumnsIfEmpty", - "showHeader", - "minRowCount", - "isReadOnly", - "rowCount", - "hasFooter", - "detailPanelMode", - ], function () { - _this.resetRenderedTable(); - }); - return _this; - } - Object.defineProperty(QuestionMatrixDropdownModelBase, "defaultCellType", { - get: function () { - return _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].matrixDefaultCellType; - }, - set: function (val) { - _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].matrixDefaultCellType = val; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.addDefaultColumns = function (matrix) { - var colNames = _questionfactory__WEBPACK_IMPORTED_MODULE_7__["QuestionFactory"].DefaultColums; - for (var i = 0; i < colNames.length; i++) - matrix.addColumn(colNames[i]); - }; - QuestionMatrixDropdownModelBase.prototype.createColumnValues = function () { - var _this = this; - return this.createNewArray("columns", function (item) { - item.colOwner = _this; - }, function (item) { - item.colOwner = null; - }); - }; - QuestionMatrixDropdownModelBase.prototype.getType = function () { - return "matrixdropdownbase"; - }; - QuestionMatrixDropdownModelBase.prototype.dispose = function () { - _super.prototype.dispose.call(this); - this.clearGeneratedRows(); - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "hasSingleInput", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "isRowsDynamic", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "isUpdateLocked", { - get: function () { - return this.isLoadingFromJson || this.isUpdating; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.beginUpdate = function () { - this.isUpdating = true; - }; - QuestionMatrixDropdownModelBase.prototype.endUpdate = function () { - this.isUpdating = false; - this.updateColumnsAndRows(); - }; - QuestionMatrixDropdownModelBase.prototype.updateColumnsAndRows = function () { - this.updateColumnsIndexes(this.columns); - this.updateColumnsCellType(); - this.generatedTotalRow = null; - this.clearRowsAndResetRenderedTable(); - }; - QuestionMatrixDropdownModelBase.prototype.itemValuePropertyChanged = function (item, name, oldValue, newValue) { - _super.prototype.itemValuePropertyChanged.call(this, item, name, oldValue, newValue); - if (item.ownerPropertyName === "choices") { - this.clearRowsAndResetRenderedTable(); - } - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "columnLayout", { - /** - * Set columnLayout to 'vertical' to place columns vertically and rows horizontally. It makes sense when we have many columns and few rows. - * @see columns - * @see rowCount - */ - get: function () { - return this.getPropertyValue("columnLayout"); - }, - set: function (val) { - this.setPropertyValue("columnLayout", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "columnsLocation", { - get: function () { - return this.columnLayout; - }, - set: function (val) { - this.columnLayout = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "isColumnLayoutHorizontal", { - /** - * Returns true if columns are located horizontally - * @see columnLayout - */ - get: function () { - return this.columnLayout != "vertical"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "detailPanelMode", { - /** - * Set the value to "underRow" to show the detailPanel under the row. - */ - get: function () { - return this.getPropertyValue("detailPanelMode"); - }, - set: function (val) { - this.setPropertyValue("detailPanelMode", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "detailPanel", { - /** - * The detail template Panel. This panel is used as a template on creating detail panel for a row. - * @see detailElements - * @see detailPanelMode - */ - get: function () { - return this.detailPanelValue; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.getPanel = function () { - return this.detailPanel; - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "detailElements", { - /** - * The template Panel elements, questions and panels. - * @see detailPanel - * @see detailPanelMode - */ - get: function () { - return this.detailPanel.elements; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.createNewDetailPanel = function () { - return _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].createClass("panel"); - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "hasRowText", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.getFooterText = function () { - return null; - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "canAddRow", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "canRemoveRows", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.canRemoveRow = function (row) { - return true; - }; - QuestionMatrixDropdownModelBase.prototype.onRowsChanged = function () { - this.resetRenderedTable(); - _super.prototype.onRowsChanged.call(this); - }; - QuestionMatrixDropdownModelBase.prototype.onStartRowAddingRemoving = function () { - this.lockResetRenderedTable = true; - }; - QuestionMatrixDropdownModelBase.prototype.onEndRowAdding = function () { - this.lockResetRenderedTable = false; - if (!this.renderedTable) - return; - if (this.renderedTable.isRequireReset()) { - this.resetRenderedTable(); - } - else { - this.renderedTable.onAddedRow(); - } - }; - QuestionMatrixDropdownModelBase.prototype.onEndRowRemoving = function (row) { - this.lockResetRenderedTable = false; - if (this.renderedTable.isRequireReset()) { - this.resetRenderedTable(); - } - else { - if (!!row) { - this.renderedTable.onRemovedRow(row); - } - } - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "renderedTableValue", { - get: function () { - return this.getPropertyValue("renderedTable", null); - }, - set: function (val) { - this.setPropertyValue("renderedTable", val); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.clearRowsAndResetRenderedTable = function () { - this.clearGeneratedRows(); - this.resetRenderedTable(); - this.fireCallback(this.columnsChangedCallback); - }; - QuestionMatrixDropdownModelBase.prototype.resetRenderedTable = function () { - if (this.lockResetRenderedTable || this.isUpdateLocked) - return; - this.renderedTableValue = null; - this.fireCallback(this.onRenderedTableResetCallback); - }; - QuestionMatrixDropdownModelBase.prototype.clearGeneratedRows = function () { - if (!this.generatedVisibleRows) - return; - for (var i = 0; i < this.generatedVisibleRows.length; i++) { - this.generatedVisibleRows[i].dispose(); - } - _super.prototype.clearGeneratedRows.call(this); - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "renderedTable", { - get: function () { - if (!this.renderedTableValue) { - this.renderedTableValue = this.createRenderedTable(); - if (!!this.onRenderedTableCreatedCallback) { - this.onRenderedTableCreatedCallback(this.renderedTableValue); - } - } - return this.renderedTableValue; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.createRenderedTable = function () { - return new _question_matrixdropdownrendered__WEBPACK_IMPORTED_MODULE_13__["QuestionMatrixDropdownRenderedTable"](this); - }; - QuestionMatrixDropdownModelBase.prototype.onMatrixRowCreated = function (row) { - if (!this.survey) - return; - var options = { - rowValue: row.value, - row: row, - column: null, - columnName: null, - cell: null, - cellQuestion: null, - value: null, - }; - for (var i = 0; i < this.visibleColumns.length; i++) { - options.column = this.visibleColumns[i]; - options.columnName = options.column.name; - var cell = row.cells[i]; - options.cell = cell; - options.cellQuestion = cell.question; - options.value = cell.value; - if (!!this.onCellCreatedCallback) { - this.onCellCreatedCallback(options); - } - this.survey.matrixCellCreated(this, options); - } - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "cellType", { - /** - * Use this property to change the default cell type. - */ - get: function () { - return this.getPropertyValue("cellType", _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].matrixDefaultCellType); - }, - set: function (val) { - val = val.toLowerCase(); - this.setPropertyValue("cellType", val); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.updateColumnsCellType = function () { - for (var i = 0; i < this.columns.length; i++) { - this.columns[i].defaultCellTypeChanged(); - } - }; - QuestionMatrixDropdownModelBase.prototype.updateColumnsIndexes = function (cols) { - for (var i = 0; i < cols.length; i++) { - cols[i].setIndex(i); - } - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "columnColCount", { - /** - * The default column count for radiogroup and checkbox cell types. - */ - get: function () { - return this.getPropertyValue("columnColCount"); - }, - set: function (value) { - if (value < 0 || value > 4) - return; - this.setPropertyValue("columnColCount", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "columnMinWidth", { - /** - * Use this property to set the minimum column width. - */ - get: function () { - return this.getPropertyValue("columnMinWidth", ""); - }, - set: function (val) { - this.setPropertyValue("columnMinWidth", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "horizontalScroll", { - /** - * Set this property to true to show the horizontal scroll. - */ - get: function () { - return this.getPropertyValue("horizontalScroll", false); - }, - set: function (val) { - this.setPropertyValue("horizontalScroll", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "allowAdaptiveActions", { - /** - * The Matrix toolbar and inner panel toolbars get adaptive if the property is set to true. - */ - get: function () { - return this.getPropertyValue("allowAdaptiveActions"); - }, - set: function (val) { - this.setPropertyValue("allowAdaptiveActions", val); - if (!!this.detailPanel) { - this.detailPanel.allowAdaptiveActions = val; - } - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.getRequiredText = function () { - return this.survey ? this.survey.requiredText : ""; - }; - QuestionMatrixDropdownModelBase.prototype.onColumnPropertyChanged = function (column, name, newValue) { - this.updateHasFooter(); - if (!this.generatedVisibleRows) - return; - for (var i = 0; i < this.generatedVisibleRows.length; i++) { - this.generatedVisibleRows[i].updateCellQuestionOnColumnChanged(column, name, newValue); - } - if (!!this.generatedTotalRow) { - this.generatedTotalRow.updateCellQuestionOnColumnChanged(column, name, newValue); - } - this.onColumnsChanged(); - if (name == "isRequired") { - this.resetRenderedTable(); - } - if (column.isShowInMultipleColumns) { - this.onShowInMultipleColumnsChanged(column); - } - }; - QuestionMatrixDropdownModelBase.prototype.onColumnItemValuePropertyChanged = function (column, propertyName, obj, name, newValue, oldValue) { - if (!this.generatedVisibleRows) - return; - for (var i = 0; i < this.generatedVisibleRows.length; i++) { - this.generatedVisibleRows[i].updateCellQuestionOnColumnItemValueChanged(column, propertyName, obj, name, newValue, oldValue); - } - }; - QuestionMatrixDropdownModelBase.prototype.onShowInMultipleColumnsChanged = function (column) { - this.clearGeneratedRows(); - this.resetRenderedTable(); - }; - QuestionMatrixDropdownModelBase.prototype.onColumnCellTypeChanged = function (column) { - this.clearGeneratedRows(); - this.resetRenderedTable(); - }; - QuestionMatrixDropdownModelBase.prototype.getRowTitleWidth = function () { - return ""; - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "hasFooter", { - get: function () { - return this.getPropertyValue("hasFooter", false); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.getAddRowLocation = function () { - return "default"; - }; - QuestionMatrixDropdownModelBase.prototype.getShowColumnsIfEmpty = function () { - return false; - }; - QuestionMatrixDropdownModelBase.prototype.updateShowTableAndAddRow = function () { - if (!!this.renderedTable) { - this.renderedTable.updateShowTableAndAddRow(); - } - }; - QuestionMatrixDropdownModelBase.prototype.updateHasFooter = function () { - this.setPropertyValue("hasFooter", this.hasTotal); - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "hasTotal", { - get: function () { - for (var i = 0; i < this.columns.length; i++) { - if (this.columns[i].hasTotal) - return true; - } - return false; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.getCellType = function () { - return this.cellType; - }; - QuestionMatrixDropdownModelBase.prototype.getCustomCellType = function (column, row, cellType) { - if (!this.survey) - return cellType; - var options = { - rowValue: row.value, - row: row, - column: column, - columnName: column.name, - cellType: cellType - }; - this.survey.matrixCellCreating(this, options); - return options.cellType; - }; - QuestionMatrixDropdownModelBase.prototype.getConditionJson = function (operator, path) { - if (operator === void 0) { operator = null; } - if (path === void 0) { path = null; } - if (!path) - return _super.prototype.getConditionJson.call(this); - var columnName = ""; - for (var i = path.length - 1; i >= 0; i--) { - if (path[i] == ".") - break; - columnName = path[i] + columnName; - } - var column = this.getColumnByName(columnName); - if (!column) - return null; - var question = column.createCellQuestion(null); - if (!question) - return null; - return question.getConditionJson(operator); - }; - QuestionMatrixDropdownModelBase.prototype.clearIncorrectValues = function () { - var rows = this.visibleRows; - if (!rows) - return; - for (var i = 0; i < rows.length; i++) { - rows[i].clearIncorrectValues(this.getRowValue(i)); - } - }; - QuestionMatrixDropdownModelBase.prototype.clearErrors = function () { - _super.prototype.clearErrors.call(this); - if (!!this.generatedVisibleRows) { - for (var i = 0; i < this.generatedVisibleRows.length; i++) { - var row = this.generatedVisibleRows[i]; - for (var j = 0; j < row.cells.length; j++) { - row.cells[j].question.clearErrors(); - } - } - } - }; - QuestionMatrixDropdownModelBase.prototype.runCondition = function (values, properties) { - _super.prototype.runCondition.call(this, values, properties); - var counter = 0; - var prevTotalValue; - do { - prevTotalValue = _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].getUnbindValue(this.totalValue); - this.runCellsCondition(values, properties); - this.runTotalsCondition(values, properties); - counter++; - } while (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isTwoValueEquals(prevTotalValue, this.totalValue) && - counter < 3); - }; - QuestionMatrixDropdownModelBase.prototype.shouldRunColumnExpression = function () { - return false; - }; - QuestionMatrixDropdownModelBase.prototype.runCellsCondition = function (values, properties) { - if (!this.generatedVisibleRows) - return; - var newValues = this.getRowConditionValues(values); - var rows = this.generatedVisibleRows; - for (var i = 0; i < rows.length; i++) { - rows[i].runCondition(newValues, properties); - } - this.checkColumnsVisibility(); - }; - QuestionMatrixDropdownModelBase.prototype.checkColumnsVisibility = function () { - var hasChanged = false; - for (var i = 0; i < this.visibleColumns.length; i++) { - if (!this.visibleColumns[i].visibleIf) - continue; - hasChanged = - this.isColumnVisibilityChanged(this.visibleColumns[i]) || hasChanged; - } - if (hasChanged) { - this.resetRenderedTable(); - } - }; - QuestionMatrixDropdownModelBase.prototype.isColumnVisibilityChanged = function (column) { - var curVis = column.hasVisibleCell; - var hasVisCell = false; - var rows = this.generatedVisibleRows; - for (var i = 0; i < rows.length; i++) { - var cell = rows[i].cells[column.index]; - if (!!cell && !!cell.question && cell.question.isVisible) { - hasVisCell = true; - break; - } - } - if (curVis != hasVisCell) { - column.hasVisibleCell = hasVisCell; - } - return curVis != hasVisCell; - }; - QuestionMatrixDropdownModelBase.prototype.runTotalsCondition = function (values, properties) { - if (!this.generatedTotalRow) - return; - this.generatedTotalRow.runCondition(this.getRowConditionValues(values), properties); - }; - QuestionMatrixDropdownModelBase.prototype.getRowConditionValues = function (values) { - var newValues = values; - if (!newValues) - newValues = {}; - /* - var newValues: { [index: string]: any } = {}; - if (values && values instanceof Object) { - newValues = JSON.parse(JSON.stringify(values)); - } - */ - var totalRow = {}; - if (!this.isValueEmpty(this.totalValue)) { - totalRow = JSON.parse(JSON.stringify(this.totalValue)); - } - newValues["row"] = {}; - newValues["totalRow"] = totalRow; - return newValues; - }; - QuestionMatrixDropdownModelBase.prototype.locStrsChanged = function () { - _super.prototype.locStrsChanged.call(this); - var columns = this.columns; - for (var i = 0; i < columns.length; i++) { - columns[i].locStrsChanged(); - } - var rows = this.generatedVisibleRows; - if (!rows) - return; - for (var i = 0; i < rows.length; i++) { - rows[i].locStrsChanged(); - } - if (!!this.generatedTotalRow) { - this.generatedTotalRow.locStrsChanged(); - } - }; - /** - * Returns the column by it's name. Returns null if a column with this name doesn't exist. - * @param column - */ - QuestionMatrixDropdownModelBase.prototype.getColumnByName = function (columnName) { - for (var i = 0; i < this.columns.length; i++) { - if (this.columns[i].name == columnName) - return this.columns[i]; - } - return null; - }; - QuestionMatrixDropdownModelBase.prototype.getColumnName = function (columnName) { - return this.getColumnByName(columnName); - }; - /** - * Returns the column width. - * @param column - */ - QuestionMatrixDropdownModelBase.prototype.getColumnWidth = function (column) { - return column.minWidth ? column.minWidth : this.columnMinWidth; - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "choices", { - /** - * The default choices for dropdown, checkbox and radiogroup cell types. - */ - get: function () { - return this.getPropertyValue("choices"); - }, - set: function (val) { - this.setPropertyValue("choices", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "optionsCaption", { - /** - * The default options caption for dropdown cell type. - */ - get: function () { - return this.getLocalizableStringText("optionsCaption", _surveyStrings__WEBPACK_IMPORTED_MODULE_6__["surveyLocalization"].getString("optionsCaption")); - }, - set: function (val) { - this.setLocalizableStringText("optionsCaption", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "locOptionsCaption", { - get: function () { - return this.getLocalizableString("optionsCaption"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "keyDuplicationError", { - /** - * The duplication value error text. Set it to show the text different from the default. - * @see MatrixDropdownColumn.isUnique - */ - get: function () { - return this.getLocalizableStringText("keyDuplicationError", _surveyStrings__WEBPACK_IMPORTED_MODULE_6__["surveyLocalization"].getString("keyDuplicationError")); - }, - set: function (val) { - this.setLocalizableStringText("keyDuplicationError", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "locKeyDuplicationError", { - get: function () { - return this.getLocalizableString("keyDuplicationError"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "storeOthersAsComment", { - get: function () { - return !!this.survey ? this.survey.storeOthersAsComment : false; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.addColumn = function (name, title) { - if (title === void 0) { title = null; } - var column = new _question_matrixdropdowncolumn__WEBPACK_IMPORTED_MODULE_12__["MatrixDropdownColumn"](name, title); - this.columns.push(column); - return column; - }; - QuestionMatrixDropdownModelBase.prototype.getVisibleRows = function () { - var _this = this; - if (this.isUpdateLocked) - return null; - if (!this.generatedVisibleRows) { - this.generatedVisibleRows = this.generateRows(); - this.generatedVisibleRows.forEach(function (row) { return _this.onMatrixRowCreated(row); }); - if (this.data) { - this.runCellsCondition(this.data.getFilteredValues(), this.data.getFilteredProperties()); - } - this.updateValueOnRowsGeneration(this.generatedVisibleRows); - this.updateIsAnswered(); - } - return this.generatedVisibleRows; - }; - QuestionMatrixDropdownModelBase.prototype.updateValueOnRowsGeneration = function (rows) { - var oldValue = this.createNewValue(true); - var newValue = this.createNewValue(); - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - if (!!row.editingObj) - continue; - var rowValue = this.getRowValue(i); - var rValue = row.value; - if (this.isTwoValueEquals(rowValue, rValue)) - continue; - newValue = this.getNewValueOnRowChanged(row, "", rValue, false, newValue) - .value; - } - if (this.isTwoValueEquals(oldValue, newValue)) - return; - this.isRowChanging = true; - this.setNewValue(newValue); - this.isRowChanging = false; - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "totalValue", { - get: function () { - if (!this.hasTotal || !this.visibleTotalRow) - return {}; - return this.visibleTotalRow.value; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.getVisibleTotalRow = function () { - if (this.isUpdateLocked) - return null; - if (this.hasTotal) { - if (!this.generatedTotalRow) { - this.generatedTotalRow = this.generateTotalRow(); - if (this.data) { - var properties = { survey: this.survey }; - this.runTotalsCondition(this.data.getAllValues(), properties); - } - } - } - else { - this.generatedTotalRow = null; - } - return this.generatedTotalRow; - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "visibleTotalRow", { - get: function () { - return this.getVisibleTotalRow(); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.onSurveyLoad = function () { - _super.prototype.onSurveyLoad.call(this); - this.updateColumnsIndexes(this.columns); - this.clearGeneratedRows(); - this.generatedTotalRow = null; - this.updateHasFooter(); - }; - /** - * Returns the row value. If the row value is empty, the object is empty: {}. - * @param rowIndex row index from 0 to visible row count - 1. - */ - QuestionMatrixDropdownModelBase.prototype.getRowValue = function (rowIndex) { - if (rowIndex < 0) - return null; - var visRows = this.visibleRows; - if (rowIndex >= visRows.length) - return null; - var newValue = this.createNewValue(); - return this.getRowValueCore(visRows[rowIndex], newValue); - }; - QuestionMatrixDropdownModelBase.prototype.checkIfValueInRowDuplicated = function (checkedRow, cellQuestion) { - if (!this.generatedVisibleRows) - return false; - var res = false; - for (var i = 0; i < this.generatedVisibleRows.length; i++) { - var row = this.generatedVisibleRows[i]; - if (checkedRow === row) - continue; - if (row.getValue(cellQuestion.name) == cellQuestion.value) { - res = true; - break; - } - } - if (res) { - this.addDuplicationError(cellQuestion); - } - else { - cellQuestion.clearErrors(); - } - return res; - }; - /** - * Set the row value. - * @param rowIndex row index from 0 to visible row count - 1. - * @param rowValue an object {"column name": columnValue,... } - */ - QuestionMatrixDropdownModelBase.prototype.setRowValue = function (rowIndex, rowValue) { - if (rowIndex < 0) - return null; - var visRows = this.visibleRows; - if (rowIndex >= visRows.length) - return null; - visRows[rowIndex].value = rowValue; - this.onRowChanged(visRows[rowIndex], "", rowValue, false); - }; - QuestionMatrixDropdownModelBase.prototype.generateRows = function () { - return null; - }; - QuestionMatrixDropdownModelBase.prototype.generateTotalRow = function () { - return new MatrixDropdownTotalRowModel(this); - }; - QuestionMatrixDropdownModelBase.prototype.createNewValue = function (nullOnEmpty) { - if (nullOnEmpty === void 0) { nullOnEmpty = false; } - var res = !this.value ? {} : this.createValueCopy(); - if (nullOnEmpty && this.isMatrixValueEmpty(res)) - return null; - return res; - }; - QuestionMatrixDropdownModelBase.prototype.getRowValueCore = function (row, questionValue, create) { - if (create === void 0) { create = false; } - var result = !!questionValue && !!questionValue[row.rowName] - ? questionValue[row.rowName] - : null; - if (!result && create) { - result = {}; - if (!!questionValue) { - questionValue[row.rowName] = result; - } - } - return result; - }; - QuestionMatrixDropdownModelBase.prototype.getRowObj = function (row) { - var obj = this.getRowValueCore(row, this.value); - return !!obj && !!obj.getType ? obj : null; - }; - QuestionMatrixDropdownModelBase.prototype.getRowDisplayValue = function (keysAsText, row, rowValue) { - if (!rowValue) - return rowValue; - if (!!row.editingObj) - return rowValue; - var keys = Object.keys(rowValue); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var question = row.getQuestionByName(key); - if (!question) { - question = this.getSharedQuestionByName(key, row); - } - if (!!question) { - var displayvalue = question.getDisplayValue(keysAsText, rowValue[key]); - if (keysAsText && !!question.title && question.title !== key) { - rowValue[question.title] = displayvalue; - delete rowValue[key]; - } - else { - rowValue[key] = displayvalue; - } - } - } - return rowValue; - }; - QuestionMatrixDropdownModelBase.prototype.getPlainData = function (options) { - var _this = this; - if (options === void 0) { options = { - includeEmpty: true, - }; } - var questionPlainData = _super.prototype.getPlainData.call(this, options); - if (!!questionPlainData) { - questionPlainData.isNode = true; - questionPlainData.data = this.visibleRows.map(function (row) { - var rowDataItem = { - name: row.rowName, - title: row.text, - value: row.value, - displayValue: _this.getRowDisplayValue(false, row, row.value), - getString: function (val) { - return typeof val === "object" ? JSON.stringify(val) : val; - }, - isNode: true, - data: row.cells - .map(function (cell) { - return cell.question.getPlainData(options); - }) - .filter(function (d) { return !!d; }), - }; - (options.calculations || []).forEach(function (calculation) { - rowDataItem[calculation.propertyName] = row[calculation.propertyName]; - }); - return rowDataItem; - }); - } - return questionPlainData; - }; - QuestionMatrixDropdownModelBase.prototype.getProgressInfo = function () { - return _survey_element__WEBPACK_IMPORTED_MODULE_3__["SurveyElement"].getProgressInfoByElements(this.getCellQuestions(), this.isRequired); - }; - QuestionMatrixDropdownModelBase.prototype.getCellQuestions = function () { - var rows = this.visibleRows; - if (!rows) - return []; - var questions = []; - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - for (var j = 0; j < row.cells.length; j++) { - questions.push(row.cells[j].question); - } - } - return questions; - }; - QuestionMatrixDropdownModelBase.prototype.onBeforeValueChanged = function (val) { }; - QuestionMatrixDropdownModelBase.prototype.onSetQuestionValue = function () { - if (this.isRowChanging) - return; - this.onBeforeValueChanged(this.value); - if (!this.generatedVisibleRows || this.generatedVisibleRows.length == 0) - return; - this.isRowChanging = true; - var val = this.createNewValue(); - for (var i = 0; i < this.generatedVisibleRows.length; i++) { - var row = this.generatedVisibleRows[i]; - this.generatedVisibleRows[i].value = this.getRowValueCore(row, val); - } - this.isRowChanging = false; - }; - QuestionMatrixDropdownModelBase.prototype.setQuestionValue = function (newValue) { - _super.prototype.setQuestionValue.call(this, newValue, false); - this.onSetQuestionValue(); - this.updateIsAnswered(); - }; - QuestionMatrixDropdownModelBase.prototype.supportGoNextPageAutomatic = function () { - var rows = this.generatedVisibleRows; - if (!rows) - rows = this.visibleRows; - if (!rows) - return true; - for (var i = 0; i < rows.length; i++) { - var cells = this.generatedVisibleRows[i].cells; - if (!cells) - continue; - for (var colIndex = 0; colIndex < cells.length; colIndex++) { - var question = cells[colIndex].question; - if (question && - (!question.supportGoNextPageAutomatic() || !question.value)) - return false; - } - } - return true; - }; - QuestionMatrixDropdownModelBase.prototype.getContainsErrors = function () { - return (_super.prototype.getContainsErrors.call(this) || - this.checkForAnswersOrErrors(function (question) { return question.containsErrors; }, false)); - }; - QuestionMatrixDropdownModelBase.prototype.getIsAnswered = function () { - return (_super.prototype.getIsAnswered.call(this) && - this.checkForAnswersOrErrors(function (question) { return question.isAnswered; }, true)); - }; - QuestionMatrixDropdownModelBase.prototype.checkForAnswersOrErrors = function (predicate, every) { - if (every === void 0) { every = false; } - var rows = this.generatedVisibleRows; - if (!rows) - return false; - for (var i = 0; i < rows.length; i++) { - var cells = rows[i].cells; - if (!cells) - continue; - for (var colIndex = 0; colIndex < cells.length; colIndex++) { - if (!cells[colIndex]) - continue; - var question = cells[colIndex].question; - if (question && question.isVisible) - if (predicate(question)) { - if (!every) - return true; - } - else { - if (every) - return false; - } - } - } - return every ? true : false; - }; - QuestionMatrixDropdownModelBase.prototype.hasErrors = function (fireCallback, rec) { - if (fireCallback === void 0) { fireCallback = true; } - if (rec === void 0) { rec = null; } - var errosInRows = this.hasErrorInRows(fireCallback, rec); - var isDuplicated = this.isValueDuplicated(); - return _super.prototype.hasErrors.call(this, fireCallback, rec) || errosInRows || isDuplicated; - }; - QuestionMatrixDropdownModelBase.prototype.getIsRunningValidators = function () { - if (_super.prototype.getIsRunningValidators.call(this)) - return true; - if (!this.generatedVisibleRows) - return false; - for (var i = 0; i < this.generatedVisibleRows.length; i++) { - var cells = this.generatedVisibleRows[i].cells; - if (!cells) - continue; - for (var colIndex = 0; colIndex < cells.length; colIndex++) { - if (!cells[colIndex]) - continue; - var question = cells[colIndex].question; - if (!!question && question.isRunningValidators) - return true; - } - } - return false; - }; - QuestionMatrixDropdownModelBase.prototype.getAllErrors = function () { - var result = _super.prototype.getAllErrors.call(this); - var rows = this.generatedVisibleRows; - if (rows === null) - return result; - for (var i = 0; i < rows.length; i++) { - var row = rows[i]; - for (var j = 0; j < row.cells.length; j++) { - var errors = row.cells[j].question.getAllErrors(); - if (errors && errors.length > 0) { - result = result.concat(errors); - } - } - } - return result; - }; - QuestionMatrixDropdownModelBase.prototype.hasErrorInRows = function (fireCallback, rec) { - var _this = this; - if (!this.generatedVisibleRows) { - this.visibleRows; - } - var res = false; - if (!rec) - rec = {}; - rec.isSingleDetailPanel = this.detailPanelMode === "underRowSingle"; - for (var i = 0; i < this.generatedVisibleRows.length; i++) { - res = - this.generatedVisibleRows[i].hasErrors(fireCallback, rec, function () { - _this.raiseOnCompletedAsyncValidators(); - }) || res; - } - return res; - }; - QuestionMatrixDropdownModelBase.prototype.isValueDuplicated = function () { - if (!this.generatedVisibleRows) - return false; - var columns = this.getUniqueColumns(); - var res = false; - for (var i = 0; i < columns.length; i++) { - res = this.isValueInColumnDuplicated(columns[i]) || res; - } - return res; - }; - QuestionMatrixDropdownModelBase.prototype.isValueInColumnDuplicated = function (column) { - var keyValues = []; - var res = false; - for (var i = 0; i < this.generatedVisibleRows.length; i++) { - res = - this.isValueDuplicatedInRow(this.generatedVisibleRows[i], column, keyValues) || res; - } - return res; - }; - QuestionMatrixDropdownModelBase.prototype.getUniqueColumns = function () { - var res = new Array(); - for (var i = 0; i < this.columns.length; i++) { - if (this.columns[i].isUnique) { - res.push(this.columns[i]); - } - } - return res; - }; - QuestionMatrixDropdownModelBase.prototype.isValueDuplicatedInRow = function (row, column, keyValues) { - var question = row.getQuestionByColumn(column); - if (!question || question.isEmpty()) - return false; - var value = question.value; - for (var i = 0; i < keyValues.length; i++) { - if (value == keyValues[i]) { - this.addDuplicationError(question); - return true; - } - } - keyValues.push(value); - return false; - }; - QuestionMatrixDropdownModelBase.prototype.addDuplicationError = function (question) { - question.addError(new _error__WEBPACK_IMPORTED_MODULE_10__["KeyDuplicationError"](this.keyDuplicationError, this)); - }; - QuestionMatrixDropdownModelBase.prototype.getFirstInputElementId = function () { - var question = this.getFirstCellQuestion(false); - return question ? question.inputId : _super.prototype.getFirstInputElementId.call(this); - }; - QuestionMatrixDropdownModelBase.prototype.getFirstErrorInputElementId = function () { - var question = this.getFirstCellQuestion(true); - return question ? question.inputId : _super.prototype.getFirstErrorInputElementId.call(this); - }; - QuestionMatrixDropdownModelBase.prototype.getFirstCellQuestion = function (onError) { - if (!this.generatedVisibleRows) - return null; - for (var i = 0; i < this.generatedVisibleRows.length; i++) { - var cells = this.generatedVisibleRows[i].cells; - for (var colIndex = 0; colIndex < cells.length; colIndex++) { - if (!onError) - return cells[colIndex].question; - if (cells[colIndex].question.currentErrorCount > 0) - return cells[colIndex].question; - } - } - return null; - }; - QuestionMatrixDropdownModelBase.prototype.onReadOnlyChanged = function () { - _super.prototype.onReadOnlyChanged.call(this); - if (!this.generateRows) - return; - for (var i = 0; i < this.visibleRows.length; i++) { - this.visibleRows[i].onQuestionReadOnlyChanged(this.isReadOnly); - } - }; - //IMatrixDropdownData - QuestionMatrixDropdownModelBase.prototype.createQuestion = function (row, column) { - return this.createQuestionCore(row, column); - }; - QuestionMatrixDropdownModelBase.prototype.createQuestionCore = function (row, column) { - var question = column.createCellQuestion(row); - if (this.isReadOnly) { - question.readOnly = true; - } - question.setSurveyImpl(row); - question.setParentQuestion(this); - return question; - }; - QuestionMatrixDropdownModelBase.prototype.deleteRowValue = function (newValue, row) { - if (!newValue) - return newValue; - delete newValue[row.rowName]; - return this.isObject(newValue) && Object.keys(newValue).length == 0 - ? null - : newValue; - }; - QuestionMatrixDropdownModelBase.prototype.onAnyValueChanged = function (name) { - if (this.isUpdateLocked || - this.isDoingonAnyValueChanged || - !this.generatedVisibleRows) - return; - this.isDoingonAnyValueChanged = true; - var rows = this.visibleRows; - for (var i = 0; i < rows.length; i++) { - rows[i].onAnyValueChanged(name); - } - var totalRow = this.visibleTotalRow; - if (!!totalRow) { - totalRow.onAnyValueChanged(name); - } - this.isDoingonAnyValueChanged = false; - }; - QuestionMatrixDropdownModelBase.prototype.isObject = function (value) { - return value !== null && typeof value === "object"; - }; - QuestionMatrixDropdownModelBase.prototype.getOnCellValueChangedOptions = function (row, columnName, rowValue) { - var getQuestion = function (colName) { - for (var i = 0; i < row.cells.length; i++) { - var col = row.cells[i].column; - if (!!col && col.name === colName) { - return row.cells[i].question; - } - } - return null; - }; - return { - row: row, - columnName: columnName, - rowValue: rowValue, - value: !!rowValue ? rowValue[columnName] : null, - getCellQuestion: getQuestion, - }; - }; - QuestionMatrixDropdownModelBase.prototype.onCellValueChanged = function (row, columnName, rowValue) { - if (!this.survey) - return; - var options = this.getOnCellValueChangedOptions(row, columnName, rowValue); - if (!!this.onCellValueChangedCallback) { - this.onCellValueChangedCallback(options); - } - this.survey.matrixCellValueChanged(this, options); - }; - QuestionMatrixDropdownModelBase.prototype.validateCell = function (row, columnName, rowValue) { - if (!this.survey) - return; - var options = this.getOnCellValueChangedOptions(row, columnName, rowValue); - return this.survey.matrixCellValidate(this, options); - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "isValidateOnValueChanging", { - get: function () { - return !!this.survey ? this.survey.isValidateOnValueChanging : false; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.onRowChanging = function (row, columnName, rowValue) { - if (!this.survey) - return !!rowValue ? rowValue[columnName] : null; - var options = this.getOnCellValueChangedOptions(row, columnName, rowValue); - var oldRowValue = this.getRowValueCore(row, this.createNewValue(), true); - options.oldValue = !!oldRowValue ? oldRowValue[columnName] : null; - this.survey.matrixCellValueChanging(this, options); - return options.value; - }; - QuestionMatrixDropdownModelBase.prototype.onRowChanged = function (row, columnName, newRowValue, isDeletingValue) { - var rowObj = !!columnName ? this.getRowObj(row) : null; - if (!!rowObj) { - var columnValue = null; - if (!!newRowValue && !isDeletingValue) { - columnValue = newRowValue[columnName]; - } - this.isRowChanging = true; - rowObj[columnName] = columnValue; - this.isRowChanging = false; - this.onCellValueChanged(row, columnName, rowObj); - } - else { - var oldValue = this.createNewValue(true); - var combine = this.getNewValueOnRowChanged(row, columnName, newRowValue, isDeletingValue, this.createNewValue()); - if (this.isTwoValueEquals(oldValue, combine.value)) - return; - this.isRowChanging = true; - this.setNewValue(combine.value); - this.isRowChanging = false; - if (columnName) { - this.onCellValueChanged(row, columnName, combine.rowValue); - } - } - }; - QuestionMatrixDropdownModelBase.prototype.getNewValueOnRowChanged = function (row, columnName, newRowValue, isDeletingValue, newValue) { - var rowValue = this.getRowValueCore(row, newValue, true); - if (isDeletingValue) { - delete rowValue[columnName]; - } - for (var i = 0; i < row.cells.length; i++) { - var key = row.cells[i].question.getValueName(); - delete rowValue[key]; - } - if (newRowValue) { - newRowValue = JSON.parse(JSON.stringify(newRowValue)); - for (var key in newRowValue) { - if (!this.isValueEmpty(newRowValue[key])) { - rowValue[key] = newRowValue[key]; - } - } - } - if (this.isObject(rowValue) && Object.keys(rowValue).length === 0) { - newValue = this.deleteRowValue(newValue, row); - } - return { value: newValue, rowValue: rowValue }; - }; - QuestionMatrixDropdownModelBase.prototype.getRowIndex = function (row) { - if (!this.generatedVisibleRows) - return -1; - return this.visibleRows.indexOf(row); - }; - QuestionMatrixDropdownModelBase.prototype.getElementsInDesign = function (includeHidden) { - if (includeHidden === void 0) { includeHidden = false; } - if (this.detailPanelMode == "none") - return _super.prototype.getElementsInDesign.call(this, includeHidden); - return includeHidden ? [this.detailPanel] : this.detailElements; - }; - QuestionMatrixDropdownModelBase.prototype.hasDetailPanel = function (row) { - if (this.detailPanelMode == "none") - return false; - if (this.isDesignMode) - return true; - if (!!this.onHasDetailPanelCallback) - return this.onHasDetailPanelCallback(row); - return this.detailElements.length > 0; - }; - QuestionMatrixDropdownModelBase.prototype.getIsDetailPanelShowing = function (row) { - if (this.detailPanelMode == "none") - return false; - if (this.isDesignMode) { - var res = this.visibleRows.indexOf(row) == 0; - if (res) { - if (!row.detailPanel) { - row.showDetailPanel(); - } - } - return res; - } - return this.getPropertyValue("isRowShowing" + row.id, false); - }; - QuestionMatrixDropdownModelBase.prototype.setIsDetailPanelShowing = function (row, val) { - if (val == this.getIsDetailPanelShowing(row)) - return; - this.setPropertyValue("isRowShowing" + row.id, val); - this.updateDetailPanelButtonCss(row); - if (!!this.renderedTable) { - this.renderedTable.onDetailPanelChangeVisibility(row, val); - } - if (val && this.detailPanelMode === "underRowSingle") { - var rows = this.visibleRows; - for (var i = 0; i < rows.length; i++) { - if (rows[i].id !== row.id && rows[i].isDetailPanelShowing) { - rows[i].hideDetailPanel(); - } - } - } - }; - QuestionMatrixDropdownModelBase.prototype.getDetailPanelButtonCss = function (row) { - var builder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(this.getPropertyValue("detailButtonCss" + row.id)); - return builder.append(this.cssClasses.detailButton, builder.toString() === "").toString(); - }; - QuestionMatrixDropdownModelBase.prototype.getDetailPanelIconCss = function (row) { - var builder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(this.getPropertyValue("detailIconCss" + row.id)); - return builder.append(this.cssClasses.detailIcon, builder.toString() === "").toString(); - }; - QuestionMatrixDropdownModelBase.prototype.updateDetailPanelButtonCss = function (row) { - var classes = this.cssClasses; - var isPanelShowing = this.getIsDetailPanelShowing(row); - var iconBuilder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(classes.detailIcon) - .append(classes.detailIconExpanded, isPanelShowing); - this.setPropertyValue("detailIconCss" + row.id, iconBuilder.toString()); - var buttonBuilder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(classes.detailButton) - .append(classes.detailButtonExpanded, isPanelShowing); - this.setPropertyValue("detailButtonCss" + row.id, buttonBuilder.toString()); - }; - QuestionMatrixDropdownModelBase.prototype.createRowDetailPanel = function (row) { - if (this.isDesignMode) - return this.detailPanel; - var panel = this.createNewDetailPanel(); - panel.readOnly = this.isReadOnly; - var json = this.detailPanel.toJSON(); - new _jsonobject__WEBPACK_IMPORTED_MODULE_0__["JsonObject"]().toObject(json, panel); - panel.renderWidth = "100%"; - panel.updateCustomWidgets(); - if (!!this.onCreateDetailPanelCallback) { - this.onCreateDetailPanelCallback(row, panel); - } - return panel; - }; - QuestionMatrixDropdownModelBase.prototype.getSharedQuestionByName = function (columnName, row) { - if (!this.survey || !this.valueName) - return null; - var index = this.getRowIndex(row); - if (index < 0) - return null; - return (this.survey.getQuestionByValueNameFromArray(this.valueName, columnName, index)); - }; - QuestionMatrixDropdownModelBase.prototype.onTotalValueChanged = function () { - if (!!this.data && - !!this.visibleTotalRow && - !this.isUpdateLocked && - !this.isSett && - !this.isReadOnly) { - this.data.setValue(this.getValueName() + _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].matrixTotalValuePostFix, this.totalValue, false); - } - }; - QuestionMatrixDropdownModelBase.prototype.getQuestionFromArray = function (name, index) { - if (index >= this.visibleRows.length) - return null; - return this.visibleRows[index].getQuestionByName(name); - }; - QuestionMatrixDropdownModelBase.prototype.isMatrixValueEmpty = function (val) { - if (!val) - return; - if (Array.isArray(val)) { - for (var i = 0; i < val.length; i++) { - if (this.isObject(val[i]) && Object.keys(val[i]).length > 0) - return false; - } - return true; - } - return Object.keys(val).length == 0; - }; - Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "SurveyModel", { - get: function () { - return this.survey; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownModelBase.prototype.getCellTemplateData = function (cell) { - // return cell.cell.column.templateQuestion; - return this.SurveyModel.getMatrixCellTemplateData(cell); - }; - QuestionMatrixDropdownModelBase.prototype.getCellWrapperComponentName = function (cell) { - return this.SurveyModel.getElementWrapperComponentName(cell, "cell"); - }; - QuestionMatrixDropdownModelBase.prototype.getCellWrapperComponentData = function (cell) { - return this.SurveyModel.getElementWrapperComponentData(cell, "cell"); - }; - QuestionMatrixDropdownModelBase.prototype.getColumnHeaderWrapperComponentName = function (cell) { - return this.SurveyModel.getElementWrapperComponentName(cell, "column-header"); - }; - QuestionMatrixDropdownModelBase.prototype.getColumnHeaderWrapperComponentData = function (cell) { - return this.SurveyModel.getElementWrapperComponentData(cell, "column-header"); - }; - QuestionMatrixDropdownModelBase.prototype.getRowHeaderWrapperComponentName = function (cell) { - return this.SurveyModel.getElementWrapperComponentName(cell, "row-header"); - }; - QuestionMatrixDropdownModelBase.prototype.getRowHeaderWrapperComponentData = function (cell) { - return this.SurveyModel.getElementWrapperComponentData(cell, "row-header"); - }; - return QuestionMatrixDropdownModelBase; - }(_martixBase__WEBPACK_IMPORTED_MODULE_1__["QuestionMatrixBaseModel"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("matrixdropdownbase", [ - { - name: "columns:matrixdropdowncolumns", - className: "matrixdropdowncolumn", - }, - { - name: "columnLayout", - alternativeName: "columnsLocation", - default: "horizontal", - choices: ["horizontal", "vertical"], - }, - { - name: "detailElements", - visible: false, - isLightSerializable: false, - }, - { - name: "detailPanelMode", - choices: ["none", "underRow", "underRowSingle"], - default: "none", - }, - "horizontalScroll:boolean", - { - name: "choices:itemvalue[]", - }, - { name: "optionsCaption", serializationProperty: "locOptionsCaption" }, - { - name: "keyDuplicationError", - serializationProperty: "locKeyDuplicationError", - }, - { - name: "cellType", - default: "dropdown", - choices: function () { - return _question_matrixdropdowncolumn__WEBPACK_IMPORTED_MODULE_12__["MatrixDropdownColumn"].getColumnTypes(); - }, - }, - { name: "columnColCount", default: 0, choices: [0, 1, 2, 3, 4] }, - "columnMinWidth", - { name: "allowAdaptiveActions:boolean", default: false, visible: false }, - ], function () { - return new QuestionMatrixDropdownModelBase(""); - }, "matrixbase"); - - - /***/ }), - - /***/ "./src/question_matrixdropdowncolumn.ts": - /*!**********************************************!*\ - !*** ./src/question_matrixdropdowncolumn.ts ***! - \**********************************************/ - /*! exports provided: matrixDropdownColumnTypes, MatrixDropdownColumn */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "matrixDropdownColumnTypes", function() { return matrixDropdownColumnTypes; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDropdownColumn", function() { return MatrixDropdownColumn; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base */ "./src/base.ts"); - /* harmony import */ var _question_expression__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_expression */ "./src/question_expression.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - function onUpdateSelectBaseCellQuestion(cellQuestion, column, question, data) { - cellQuestion.storeOthersAsComment = !!question - ? question.storeOthersAsComment - : false; - if ((!cellQuestion.choices || cellQuestion.choices.length == 0) && - cellQuestion.choicesByUrl.isEmpty) { - cellQuestion.choices = question.choices; - } - if (!cellQuestion.choicesByUrl.isEmpty) { - cellQuestion.choicesByUrl.run(data.getTextProcessor()); - } - } - var matrixDropdownColumnTypes = { - dropdown: { - properties: [ - "choices", - "choicesOrder", - "choicesByUrl", - "optionsCaption", - "otherText", - "choicesVisibleIf", - ], - onCellQuestionUpdate: function (cellQuestion, column, question, data) { - onUpdateSelectBaseCellQuestion(cellQuestion, column, question, data); - if (!!cellQuestion.locOptionsCaption && - cellQuestion.locOptionsCaption.isEmpty && - !question.locOptionsCaption.isEmpty) { - cellQuestion.optionsCaption = question.optionsCaption; - } - }, - }, - checkbox: { - properties: [ - "choices", - "choicesOrder", - "choicesByUrl", - "otherText", - "choicesVisibleIf", - "hasSelectAll", - "hasNone", - ], - onCellQuestionUpdate: function (cellQuestion, column, question, data) { - onUpdateSelectBaseCellQuestion(cellQuestion, column, question, data); - cellQuestion.colCount = - column.colCount > -1 ? column.colCount : question.columnColCount; - }, - }, - radiogroup: { - properties: [ - "choices", - "choicesOrder", - "choicesByUrl", - "otherText", - "choicesVisibleIf", - ], - onCellQuestionUpdate: function (cellQuestion, column, question, data) { - onUpdateSelectBaseCellQuestion(cellQuestion, column, question, data); - cellQuestion.colCount = - column.colCount > -1 ? column.colCount : question.columnColCount; - }, - }, - text: { - properties: ["placeHolder", "inputType", "maxLength", "min", "max", "step"], - onCellQuestionUpdate: function (cellQuestion, column, question, data) { }, - }, - comment: { - properties: ["placeHolder", "rows", "maxLength"], - onCellQuestionUpdate: function (cellQuestion, column, question, data) { }, - }, - boolean: { - properties: ["renderAs", "defaultValue"], - onCellQuestionUpdate: function (cellQuestion, column, question, data) { - cellQuestion.showTitle = true; - cellQuestion.renderAs = column.renderAs; - }, - }, - expression: { - properties: ["expression", "displayStyle", "currency"], - onCellQuestionUpdate: function (cellQuestion, column, question, data) { }, - }, - rating: { - properties: ["rateValues"], - }, - }; - var MatrixDropdownColumn = /** @class */ (function (_super) { - __extends(MatrixDropdownColumn, _super); - function MatrixDropdownColumn(name, title) { - if (title === void 0) { title = null; } - var _this = _super.call(this) || this; - _this.colOwnerValue = null; - _this.indexValue = -1; - _this._isVisible = true; - _this._hasVisibleCell = true; - var self = _this; - _this.createLocalizableString("totalFormat", _this); - _this.registerFunctionOnPropertyValueChanged("showInMultipleColumns", function () { - self.doShowInMultipleColumnsChanged(); - }); - _this.updateTemplateQuestion(); - _this.name = name; - if (title) { - _this.title = title; - } - else { - _this.templateQuestion.locTitle.strChanged(); - } - return _this; - } - MatrixDropdownColumn.getColumnTypes = function () { - var res = []; - for (var key in matrixDropdownColumnTypes) { - res.push(key); - } - return res; - }; - MatrixDropdownColumn.prototype.getOriginalObj = function () { - return this.templateQuestion; - }; - MatrixDropdownColumn.prototype.getClassNameProperty = function () { - return "cellType"; - }; - MatrixDropdownColumn.prototype.getSurvey = function (live) { - return !!this.colOwner ? this.colOwner.survey : null; - }; - MatrixDropdownColumn.prototype.endLoadingFromJson = function () { - var _this = this; - _super.prototype.endLoadingFromJson.call(this); - this.templateQuestion.endLoadingFromJson(); - this.templateQuestion.onGetSurvey = function () { - return _this.getSurvey(); - }; - }; - MatrixDropdownColumn.prototype.getDynamicPropertyName = function () { - return "cellType"; - }; - MatrixDropdownColumn.prototype.getDynamicType = function () { - return this.calcCellQuestionType(null); - }; - Object.defineProperty(MatrixDropdownColumn.prototype, "colOwner", { - get: function () { - return this.colOwnerValue; - }, - set: function (value) { - this.colOwnerValue = value; - if (!!value) { - this.updateTemplateQuestion(); - } - }, - enumerable: false, - configurable: true - }); - MatrixDropdownColumn.prototype.locStrsChanged = function () { - _super.prototype.locStrsChanged.call(this); - this.locTitle.strChanged(); - }; - MatrixDropdownColumn.prototype.addUsedLocales = function (locales) { - _super.prototype.addUsedLocales.call(this, locales); - this.templateQuestion.addUsedLocales(locales); - }; - Object.defineProperty(MatrixDropdownColumn.prototype, "index", { - get: function () { - return this.indexValue; - }, - enumerable: false, - configurable: true - }); - MatrixDropdownColumn.prototype.setIndex = function (val) { - this.indexValue = val; - }; - MatrixDropdownColumn.prototype.getType = function () { - return "matrixdropdowncolumn"; - }; - Object.defineProperty(MatrixDropdownColumn.prototype, "cellType", { - get: function () { - return this.getPropertyValue("cellType"); - }, - set: function (val) { - val = val.toLocaleLowerCase(); - this.setPropertyValue("cellType", val); - this.updateTemplateQuestion(); - if (!!this.colOwner) { - this.colOwner.onColumnCellTypeChanged(this); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "templateQuestion", { - get: function () { - return this.templateQuestionValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "value", { - get: function () { - return this.templateQuestion.name; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "isVisible", { - get: function () { - return this._isVisible; - }, - enumerable: false, - configurable: true - }); - MatrixDropdownColumn.prototype.setIsVisible = function (newVal) { - this._isVisible = newVal; - }; - Object.defineProperty(MatrixDropdownColumn.prototype, "hasVisibleCell", { - get: function () { - return this._hasVisibleCell; - }, - set: function (newVal) { - this._hasVisibleCell = newVal; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "name", { - get: function () { - return this.templateQuestion.name; - }, - set: function (val) { - this.templateQuestion.name = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "title", { - get: function () { - return this.templateQuestion.title; - }, - set: function (val) { - this.templateQuestion.title = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "locTitle", { - get: function () { - return this.templateQuestion.locTitle; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "fullTitle", { - get: function () { - return this.locTitle.textOrHtml; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "isRequired", { - get: function () { - return this.templateQuestion.isRequired; - }, - set: function (val) { - this.templateQuestion.isRequired = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "requiredText", { - get: function () { - return this.templateQuestion.requiredText; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "requiredErrorText", { - get: function () { - return this.templateQuestion.requiredErrorText; - }, - set: function (val) { - this.templateQuestion.requiredErrorText = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "locRequiredErrorText", { - get: function () { - return this.templateQuestion.locRequiredErrorText; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "readOnly", { - get: function () { - return this.templateQuestion.readOnly; - }, - set: function (val) { - this.templateQuestion.readOnly = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "hasOther", { - get: function () { - return this.templateQuestion.hasOther; - }, - set: function (val) { - this.templateQuestion.hasOther = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "visibleIf", { - get: function () { - return this.templateQuestion.visibleIf; - }, - set: function (val) { - this.templateQuestion.visibleIf = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "enableIf", { - get: function () { - return this.templateQuestion.enableIf; - }, - set: function (val) { - this.templateQuestion.enableIf = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "requiredIf", { - get: function () { - return this.templateQuestion.requiredIf; - }, - set: function (val) { - this.templateQuestion.requiredIf = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "isUnique", { - get: function () { - return this.getPropertyValue("isUnique"); - }, - set: function (val) { - this.setPropertyValue("isUnique", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "showInMultipleColumns", { - get: function () { - return this.getPropertyValue("showInMultipleColumns", false); - }, - set: function (val) { - this.setPropertyValue("showInMultipleColumns", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "isSupportMultipleColumns", { - get: function () { - return ["checkbox", "radiogroup"].indexOf(this.cellType) > -1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "isShowInMultipleColumns", { - get: function () { - return this.showInMultipleColumns && this.isSupportMultipleColumns; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "validators", { - get: function () { - return this.templateQuestion.validators; - }, - set: function (val) { - this.templateQuestion.validators = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "totalType", { - get: function () { - return this.getPropertyValue("totalType"); - }, - set: function (val) { - this.setPropertyValue("totalType", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "totalExpression", { - get: function () { - return this.getPropertyValue("totalExpression"); - }, - set: function (val) { - this.setPropertyValue("totalExpression", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "hasTotal", { - get: function () { - return this.totalType != "none" || !!this.totalExpression; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "totalFormat", { - get: function () { - return this.getLocalizableStringText("totalFormat", ""); - }, - set: function (val) { - this.setLocalizableStringText("totalFormat", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "locTotalFormat", { - get: function () { - return this.getLocalizableString("totalFormat"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "renderAs", { - get: function () { - return this.getPropertyValue("renderAs"); - }, - set: function (val) { - this.setPropertyValue("renderAs", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "totalMaximumFractionDigits", { - get: function () { - return this.getPropertyValue("totalMaximumFractionDigits"); - }, - set: function (val) { - if (val < -1 || val > 20) - return; - this.setPropertyValue("totalMaximumFractionDigits", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "totalMinimumFractionDigits", { - get: function () { - return this.getPropertyValue("totalMinimumFractionDigits"); - }, - set: function (val) { - if (val < -1 || val > 20) - return; - this.setPropertyValue("totalMinimumFractionDigits", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "totalDisplayStyle", { - get: function () { - return this.getPropertyValue("totalDisplayStyle"); - }, - set: function (val) { - this.setPropertyValue("totalDisplayStyle", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "totalCurrency", { - get: function () { - return this.getPropertyValue("totalCurrency"); - }, - set: function (val) { - if (Object(_question_expression__WEBPACK_IMPORTED_MODULE_2__["getCurrecyCodes"])().indexOf(val) < 0) - return; - this.setPropertyValue("totalCurrency", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "minWidth", { - get: function () { - return this.getPropertyValue("minWidth", ""); - }, - set: function (val) { - this.setPropertyValue("minWidth", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "width", { - get: function () { - return this.getPropertyValue("width", ""); - }, - set: function (val) { - this.setPropertyValue("width", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDropdownColumn.prototype, "colCount", { - get: function () { - return this.getPropertyValue("colCount"); - }, - set: function (val) { - if (val < -1 || val > 4) - return; - this.setPropertyValue("colCount", val); - }, - enumerable: false, - configurable: true - }); - MatrixDropdownColumn.prototype.getLocale = function () { - return this.colOwner ? this.colOwner.getLocale() : ""; - }; - MatrixDropdownColumn.prototype.getMarkdownHtml = function (text, name) { - return this.colOwner ? this.colOwner.getMarkdownHtml(text, name) : null; - }; - MatrixDropdownColumn.prototype.getRenderer = function (name) { - return !!this.colOwner ? this.colOwner.getRenderer(name) : null; - }; - MatrixDropdownColumn.prototype.getRendererContext = function (locStr) { - return !!this.colOwner ? this.colOwner.getRendererContext(locStr) : locStr; - }; - MatrixDropdownColumn.prototype.getProcessedText = function (text) { - return this.colOwner ? this.colOwner.getProcessedText(text) : text; - }; - MatrixDropdownColumn.prototype.createCellQuestion = function (row) { - var qType = this.calcCellQuestionType(row); - var cellQuestion = this.createNewQuestion(qType); - this.callOnCellQuestionUpdate(cellQuestion, row); - return cellQuestion; - }; - MatrixDropdownColumn.prototype.updateCellQuestion = function (cellQuestion, data, onUpdateJson) { - if (onUpdateJson === void 0) { onUpdateJson = null; } - this.setQuestionProperties(cellQuestion, onUpdateJson); - this.callOnCellQuestionUpdate(cellQuestion, data); - }; - MatrixDropdownColumn.prototype.callOnCellQuestionUpdate = function (cellQuestion, data) { - var qType = cellQuestion.getType(); - var qDefinition = matrixDropdownColumnTypes[qType]; - if (qDefinition && qDefinition["onCellQuestionUpdate"]) { - qDefinition["onCellQuestionUpdate"](cellQuestion, this, this.colOwner, data); - } - }; - MatrixDropdownColumn.prototype.defaultCellTypeChanged = function () { - this.updateTemplateQuestion(); - }; - MatrixDropdownColumn.prototype.calcCellQuestionType = function (row) { - var cellType = this.getDefaultCellQuestionType(); - if (!!row && !!this.colOwner) { - cellType = this.colOwner.getCustomCellType(this, row, cellType); - } - return cellType; - }; - MatrixDropdownColumn.prototype.getDefaultCellQuestionType = function () { - if (this.cellType !== "default") - return this.cellType; - if (this.colOwner) - return this.colOwner.getCellType(); - return _settings__WEBPACK_IMPORTED_MODULE_3__["settings"].matrixDefaultCellType; - }; - MatrixDropdownColumn.prototype.updateTemplateQuestion = function () { - var _this = this; - var prevCellType = this.templateQuestion - ? this.templateQuestion.getType() - : ""; - var curCellType = this.calcCellQuestionType(null); - if (curCellType === prevCellType) - return; - if (this.templateQuestion) { - this.removeProperties(prevCellType); - } - this.templateQuestionValue = this.createNewQuestion(curCellType); - this.templateQuestion.locOwner = this; - this.addProperties(curCellType); - this.templateQuestion.onPropertyChanged.add(function (sender, options) { - _this.propertyValueChanged(options.name, options.oldValue, options.newValue); - }); - this.templateQuestion.onItemValuePropertyChanged.add(function (sender, options) { - _this.doItemValuePropertyChanged(options.propertyName, options.obj, options.name, options.newValue, options.oldValue); - }); - this.templateQuestion.isContentElement = true; - if (!this.isLoadingFromJson) { - this.templateQuestion.onGetSurvey = function () { - return _this.getSurvey(); - }; - } - this.templateQuestion.locTitle.strChanged(); - }; - MatrixDropdownColumn.prototype.createNewQuestion = function (cellType) { - var question = _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].createClass(cellType); - if (!question) { - question = _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].createClass("text"); - } - question.loadingOwner = this; - question.isEditableTemplateElement = true; - this.setQuestionProperties(question); - return question; - }; - MatrixDropdownColumn.prototype.setQuestionProperties = function (question, onUpdateJson) { - if (onUpdateJson === void 0) { onUpdateJson = null; } - if (this.templateQuestion) { - var json = new _jsonobject__WEBPACK_IMPORTED_MODULE_0__["JsonObject"]().toJsonObject(this.templateQuestion, true); - if (onUpdateJson) { - onUpdateJson(json); - } - json.type = question.getType(); - new _jsonobject__WEBPACK_IMPORTED_MODULE_0__["JsonObject"]().toObject(json, question); - question.isContentElement = this.templateQuestion.isContentElement; - } - }; - MatrixDropdownColumn.prototype.propertyValueChanged = function (name, oldValue, newValue) { - _super.prototype.propertyValueChanged.call(this, name, oldValue, newValue); - if (!_jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].hasOriginalProperty(this, name)) - return; - if (this.colOwner != null && !this.isLoadingFromJson) { - this.colOwner.onColumnPropertyChanged(this, name, newValue); - } - }; - MatrixDropdownColumn.prototype.doItemValuePropertyChanged = function (propertyName, obj, name, newValue, oldValue) { - if (!_jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].hasOriginalProperty(obj, name)) - return; - if (this.colOwner != null && !this.isLoadingFromJson) { - this.colOwner.onColumnItemValuePropertyChanged(this, propertyName, obj, name, newValue, oldValue); - } - }; - MatrixDropdownColumn.prototype.doShowInMultipleColumnsChanged = function () { - if (this.colOwner != null && !this.isLoadingFromJson) { - this.colOwner.onShowInMultipleColumnsChanged(this); - } - }; - MatrixDropdownColumn.prototype.getProperties = function (curCellType) { - return _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].getDynamicPropertiesByObj(this, curCellType); - }; - MatrixDropdownColumn.prototype.removeProperties = function (curCellType) { - var properties = this.getProperties(curCellType); - for (var i = 0; i < properties.length; i++) { - var prop = properties[i]; - delete this[prop.name]; - if (prop.serializationProperty) { - delete this[prop.serializationProperty]; - } - } - }; - MatrixDropdownColumn.prototype.addProperties = function (curCellType) { - var question = this.templateQuestion; - var properties = this.getProperties(curCellType); - for (var i = 0; i < properties.length; i++) { - var prop = properties[i]; - this.addProperty(question, prop.name, false); - if (prop.serializationProperty) { - this.addProperty(question, prop.serializationProperty, true); - } - } - }; - MatrixDropdownColumn.prototype.addProperty = function (question, propName, isReadOnly) { - var desc = { - configurable: true, - get: function () { - return question[propName]; - }, - }; - if (!isReadOnly) { - desc["set"] = function (v) { - question[propName] = v; - }; - } - Object.defineProperty(this, propName, desc); - }; - return MatrixDropdownColumn; - }(_base__WEBPACK_IMPORTED_MODULE_1__["Base"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("matrixdropdowncolumn", [ - { name: "!name", isUnique: true }, - { name: "title", serializationProperty: "locTitle" }, - { - name: "cellType", - default: "default", - choices: function () { - var res = MatrixDropdownColumn.getColumnTypes(); - res.splice(0, 0, "default"); - return res; - }, - }, - { name: "colCount", default: -1, choices: [-1, 0, 1, 2, 3, 4] }, - "isRequired:boolean", - "isUnique:boolean", - { - name: "requiredErrorText:text", - serializationProperty: "locRequiredErrorText", - }, - "readOnly:boolean", - "minWidth", - "width", - "visibleIf:condition", - "enableIf:condition", - "requiredIf:condition", - { - name: "showInMultipleColumns:boolean", - dependsOn: "cellType", - visibleIf: function (obj) { - if (!obj) - return false; - return obj.isSupportMultipleColumns; - }, - }, - { - name: "validators:validators", - baseClassName: "surveyvalidator", - classNamePart: "validator", - }, - { - name: "totalType", - default: "none", - choices: ["none", "sum", "count", "min", "max", "avg"], - }, - "totalExpression:expression", - { name: "totalFormat", serializationProperty: "locTotalFormat" }, - { - name: "totalDisplayStyle", - default: "none", - choices: ["none", "decimal", "currency", "percent"], - }, - { - name: "totalCurrency", - choices: function () { - return Object(_question_expression__WEBPACK_IMPORTED_MODULE_2__["getCurrecyCodes"])(); - }, - default: "USD", - }, - { name: "totalMaximumFractionDigits:number", default: -1 }, - { name: "totalMinimumFractionDigits:number", default: -1 }, - { name: "renderAs", default: "default", visible: false }, - ], function () { - return new MatrixDropdownColumn(""); - }); - - - /***/ }), - - /***/ "./src/question_matrixdropdownrendered.ts": - /*!************************************************!*\ - !*** ./src/question_matrixdropdownrendered.ts ***! - \************************************************/ - /*! exports provided: QuestionMatrixDropdownRenderedCell, QuestionMatrixDropdownRenderedRow, QuestionMatrixDropdownRenderedTable */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDropdownRenderedCell", function() { return QuestionMatrixDropdownRenderedCell; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDropdownRenderedRow", function() { return QuestionMatrixDropdownRenderedRow; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDropdownRenderedTable", function() { return QuestionMatrixDropdownRenderedTable; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base */ "./src/base.ts"); - /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _actions_action__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./actions/action */ "./src/actions/action.ts"); - /* harmony import */ var _actions_adaptive_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./actions/adaptive-container */ "./src/actions/adaptive-container.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - /* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - - - - - - - - var QuestionMatrixDropdownRenderedCell = /** @class */ (function () { - function QuestionMatrixDropdownRenderedCell() { - this.minWidth = ""; - this.width = ""; - this.colSpans = 1; - this.isActionsCell = false; - this.isDragHandlerCell = false; - this.classNameValue = ""; - this.idValue = QuestionMatrixDropdownRenderedCell.counter++; - } - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "hasQuestion", { - get: function () { - return !!this.question; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "hasTitle", { - get: function () { - return !!this.locTitle; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "hasPanel", { - get: function () { - return !!this.panel; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "id", { - get: function () { - return this.idValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "showErrorOnTop", { - get: function () { - return this.showErrorOnCore("top"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "showErrorOnBottom", { - get: function () { - return this.showErrorOnCore("bottom"); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownRenderedCell.prototype.showErrorOnCore = function (location) { - return (this.getShowErrorLocation() == location && - (!this.isChoice || this.isFirstChoice)); - }; - QuestionMatrixDropdownRenderedCell.prototype.getShowErrorLocation = function () { - return this.hasQuestion ? this.question.survey.questionErrorLocation : ""; - }; - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "item", { - get: function () { - return this.itemValue; - }, - set: function (val) { - this.itemValue = val; - if (!!val) { - val.hideCaption = true; - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "isChoice", { - get: function () { - return !!this.item; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "choiceValue", { - get: function () { - return this.isChoice ? this.item.value : null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "isCheckbox", { - get: function () { - return this.isChoice && this.question.getType() == "checkbox"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "isFirstChoice", { - get: function () { - return this.choiceIndex === 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "className", { - get: function () { - var builder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]().append(this.classNameValue); - if (this.hasQuestion) { - builder - .append(this.question.cssClasses.hasError, this.question.errors.length > 0) - .append(this.question.cssClasses.answered, this.question.isAnswered); - } - return builder.toString(); - }, - set: function (val) { - this.classNameValue = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "headers", { - get: function () { - if (this.cell && - this.cell.column && - this.cell.column.isShowInMultipleColumns) { - return this.item.locText.renderedHtml; - } - if (this.question && this.question.isVisible) { - return this.question.locTitle.renderedHtml; - } - if (this.hasTitle) { - return this.locTitle.renderedHtml || ""; - } - return ""; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownRenderedCell.prototype.calculateFinalClassName = function (matrixCssClasses) { - var questionCss = this.cell.question.cssClasses; - // 'text-align': $data.isChoice ? 'center': - var builder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]() - .append(questionCss.itemValue, !!questionCss) - .append(questionCss.asCell, !!questionCss); - return builder.append(matrixCssClasses.cell, builder.isEmpty() && !!matrixCssClasses) - .append(matrixCssClasses.choiceCell, this.isChoice) - .toString(); - }; - QuestionMatrixDropdownRenderedCell.counter = 1; - return QuestionMatrixDropdownRenderedCell; - }()); - - var QuestionMatrixDropdownRenderedRow = /** @class */ (function (_super) { - __extends(QuestionMatrixDropdownRenderedRow, _super); - function QuestionMatrixDropdownRenderedRow(cssClasses, isDetailRow) { - if (isDetailRow === void 0) { isDetailRow = false; } - var _this = _super.call(this) || this; - _this.cssClasses = cssClasses; - _this.isDetailRow = isDetailRow; - _this.cells = []; - _this.onCreating(); - _this.idValue = QuestionMatrixDropdownRenderedRow.counter++; - return _this; - } - QuestionMatrixDropdownRenderedRow.prototype.onCreating = function () { }; // need for knockout binding see QuestionMatrixDropdownRenderedRow.prototype["onCreating"] - Object.defineProperty(QuestionMatrixDropdownRenderedRow.prototype, "id", { - get: function () { - return this.idValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedRow.prototype, "attributes", { - get: function () { - if (!this.row) - return {}; - return { "data-sv-drop-target-matrix-row": this.row.id }; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedRow.prototype, "className", { - get: function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]() - .append(this.cssClasses.row) - .append(this.cssClasses.detailRow, this.isDetailRow) - .append(this.cssClasses.dragDropGhostPositionTop, this.ghostPosition === "top") - .append(this.cssClasses.dragDropGhostPositionBottom, this.ghostPosition === "bottom") - .append(this.cssClasses.rowAdditional, this.isAdditionalClasses) - .toString(); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownRenderedRow.counter = 1; - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: null }) - ], QuestionMatrixDropdownRenderedRow.prototype, "ghostPosition", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) - ], QuestionMatrixDropdownRenderedRow.prototype, "isAdditionalClasses", void 0); - return QuestionMatrixDropdownRenderedRow; - }(_base__WEBPACK_IMPORTED_MODULE_1__["Base"])); - - var QuestionMatrixDropdownRenderedTable = /** @class */ (function (_super) { - __extends(QuestionMatrixDropdownRenderedTable, _super); - function QuestionMatrixDropdownRenderedTable(matrix) { - var _this = _super.call(this) || this; - _this.matrix = matrix; - _this.hasActionCellInRowsValues = {}; - _this.createNewArray("rows"); - _this.build(); - return _this; - } - Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "showTable", { - get: function () { - return this.getPropertyValue("showTable", true); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "showHeader", { - get: function () { - return this.getPropertyValue("showHeader"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "showAddRowOnTop", { - get: function () { - return this.getPropertyValue("showAddRowOnTop", false); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "showAddRowOnBottom", { - get: function () { - return this.getPropertyValue("showAddRowOnBottom", false); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "showFooter", { - get: function () { - return this.matrix.hasFooter && this.matrix.isColumnLayoutHorizontal; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "hasFooter", { - get: function () { - return !!this.footerRow; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "hasRemoveRows", { - get: function () { - return this.hasRemoveRowsValue; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownRenderedTable.prototype.isRequireReset = function () { - return (this.hasRemoveRows != this.matrix.canRemoveRows || - !this.matrix.isColumnLayoutHorizontal); - }; - Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "headerRow", { - get: function () { - return this.headerRowValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "footerRow", { - get: function () { - return this.footerRowValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "rows", { - get: function () { - return this.getPropertyValue("rows"); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownRenderedTable.prototype.build = function () { - this.hasRemoveRowsValue = this.matrix.canRemoveRows; - //build rows now - this.matrix.visibleRows; - this.cssClasses = this.matrix.cssClasses; - this.buildRowsActions(); - this.buildHeader(); - this.buildRows(); - this.buildFooter(); - this.updateShowTableAndAddRow(); - }; - QuestionMatrixDropdownRenderedTable.prototype.updateShowTableAndAddRow = function () { - var showTable = this.rows.length > 0 || - this.matrix.isDesignMode || - !this.matrix.getShowColumnsIfEmpty(); - this.setPropertyValue("showTable", showTable); - var showAddRow = this.matrix.canAddRow && showTable; - var showAddRowOnTop = showAddRow; - var showAddRowOnBottom = showAddRow; - if (showAddRowOnTop) { - if (this.matrix.getAddRowLocation() === "default") { - showAddRowOnTop = this.matrix.columnLayout === "vertical"; - } - else { - showAddRowOnTop = this.matrix.getAddRowLocation() !== "bottom"; - } - } - if (showAddRowOnBottom && this.matrix.getAddRowLocation() !== "topBottom") { - showAddRowOnBottom = !showAddRowOnTop; - } - this.setPropertyValue("showAddRowOnTop", showAddRowOnTop); - this.setPropertyValue("showAddRowOnBottom", showAddRowOnBottom); - }; - QuestionMatrixDropdownRenderedTable.prototype.onAddedRow = function () { - if (this.getRenderedDataRowCount() >= this.matrix.visibleRows.length) - return; - var row = this.matrix.visibleRows[this.matrix.visibleRows.length - 1]; - this.rowsActions.push(this.buildRowActions(row)); - this.addHorizontalRow(this.rows, row, this.matrix.visibleRows.length == 1 && !this.matrix.showHeader); - this.updateShowTableAndAddRow(); - }; - QuestionMatrixDropdownRenderedTable.prototype.getRenderedDataRowCount = function () { - var res = 0; - for (var i = 0; i < this.rows.length; i++) { - if (!this.rows[i].isDetailRow) - res++; - } - return res; - }; - QuestionMatrixDropdownRenderedTable.prototype.onRemovedRow = function (row) { - var rowIndex = this.getRenderedRowIndex(row); - if (rowIndex < 0) - return; - this.rowsActions.splice(rowIndex, 1); - var removeCount = 1; - if (rowIndex < this.rows.length - 1 && - this.rows[rowIndex + 1].isDetailRow) { - removeCount++; - } - this.rows.splice(rowIndex, removeCount); - this.updateShowTableAndAddRow(); - }; - QuestionMatrixDropdownRenderedTable.prototype.onDetailPanelChangeVisibility = function (row, isShowing) { - var rowIndex = this.getRenderedRowIndex(row); - if (rowIndex < 0) - return; - var panelRowIndex = rowIndex < this.rows.length - 1 && this.rows[rowIndex + 1].isDetailRow - ? rowIndex + 1 - : -1; - if ((isShowing && panelRowIndex > -1) || (!isShowing && panelRowIndex < 0)) - return; - if (isShowing) { - var detailRow = this.createDetailPanelRow(row, this.rows[rowIndex]); - this.rows.splice(rowIndex + 1, 0, detailRow); - } - else { - this.rows.splice(panelRowIndex, 1); - } - }; - QuestionMatrixDropdownRenderedTable.prototype.getRenderedRowIndex = function (row) { - for (var i = 0; i < this.rows.length; i++) { - if (this.rows[i].row == row) - return i; - } - return -1; - }; - QuestionMatrixDropdownRenderedTable.prototype.buildRowsActions = function () { - this.rowsActions = []; - var rows = this.matrix.visibleRows; - for (var i = 0; i < rows.length; i++) { - this.rowsActions.push(this.buildRowActions(rows[i])); - } - }; - QuestionMatrixDropdownRenderedTable.prototype.buildHeader = function () { - var colHeaders = this.matrix.isColumnLayoutHorizontal && this.matrix.showHeader; - var isShown = colHeaders || - (this.matrix.hasRowText && !this.matrix.isColumnLayoutHorizontal); - this.setPropertyValue("showHeader", isShown); - if (!isShown) - return; - this.headerRowValue = new QuestionMatrixDropdownRenderedRow(this.cssClasses); - if (this.matrix.allowRowsDragAndDrop) { - this.headerRow.cells.push(this.createHeaderCell(null)); - } - if (this.hasActionCellInRows("start")) { - this.headerRow.cells.push(this.createHeaderCell(null)); - } - if (this.matrix.hasRowText && this.matrix.showHeader) { - this.headerRow.cells.push(this.createHeaderCell(null)); - } - if (this.matrix.isColumnLayoutHorizontal) { - for (var i = 0; i < this.matrix.visibleColumns.length; i++) { - var column = this.matrix.visibleColumns[i]; - if (!column.hasVisibleCell) - continue; - if (column.isShowInMultipleColumns) { - this.createMutlipleColumnsHeader(column); - } - else { - this.headerRow.cells.push(this.createHeaderCell(column)); - } - } - } - else { - var rows = this.matrix.visibleRows; - for (var i = 0; i < rows.length; i++) { - this.headerRow.cells.push(this.createTextCell(rows[i].locText)); - } - if (this.matrix.hasFooter) { - this.headerRow.cells.push(this.createTextCell(this.matrix.getFooterText())); - } - } - if (this.hasActionCellInRows("end")) { - this.headerRow.cells.push(this.createHeaderCell(null)); - } - }; - QuestionMatrixDropdownRenderedTable.prototype.buildFooter = function () { - if (!this.showFooter) - return; - this.footerRowValue = new QuestionMatrixDropdownRenderedRow(this.cssClasses); - if (this.matrix.allowRowsDragAndDrop) { - this.footerRow.cells.push(this.createHeaderCell(null)); - } - if (this.hasActionCellInRows("start")) { - this.footerRow.cells.push(this.createHeaderCell(null)); - } - if (this.matrix.hasRowText) { - this.footerRow.cells.push(this.createTextCell(this.matrix.getFooterText())); - } - var cells = this.matrix.visibleTotalRow.cells; - for (var i = 0; i < cells.length; i++) { - var cell = cells[i]; - if (!cell.column.hasVisibleCell) - continue; - if (cell.column.isShowInMultipleColumns) { - this.createMutlipleColumnsFooter(this.footerRow, cell); - } - else { - var editCell = this.createEditCell(cell); - if (cell.column) { - this.setHeaderCellWidth(cell.column, editCell); - } - this.footerRow.cells.push(editCell); - } - } - if (this.hasActionCellInRows("end")) { - this.footerRow.cells.push(this.createHeaderCell(null)); - } - }; - QuestionMatrixDropdownRenderedTable.prototype.buildRows = function () { - var rows = this.matrix.isColumnLayoutHorizontal - ? this.buildHorizontalRows() - : this.buildVerticalRows(); - this.setPropertyValue("rows", rows); - }; - QuestionMatrixDropdownRenderedTable.prototype.hasActionCellInRows = function (location) { - if (this.hasActionCellInRowsValues[location] === undefined) { - var rows = this.matrix.visibleRows; - this.hasActionCellInRowsValues[location] = false; - for (var i = 0; i < rows.length; i++) { - if (!this.isValueEmpty(this.getRowActions(i, location))) { - this.hasActionCellInRowsValues[location] = true; - break; - } - } - } - return this.hasActionCellInRowsValues[location]; - }; - QuestionMatrixDropdownRenderedTable.prototype.canRemoveRow = function (row) { - return this.matrix.canRemoveRow(row); - }; - QuestionMatrixDropdownRenderedTable.prototype.buildHorizontalRows = function () { - var rows = this.matrix.visibleRows; - var renderedRows = []; - for (var i = 0; i < rows.length; i++) { - this.addHorizontalRow(renderedRows, rows[i], i == 0 && !this.matrix.showHeader); - } - return renderedRows; - }; - QuestionMatrixDropdownRenderedTable.prototype.addHorizontalRow = function (renderedRows, row, useAsHeader) { - var renderedRow = this.createHorizontalRow(row, useAsHeader); - renderedRow.row = row; - renderedRows.push(renderedRow); - if (row.isDetailPanelShowing) { - renderedRows.push(this.createDetailPanelRow(row, renderedRow)); - } - }; - QuestionMatrixDropdownRenderedTable.prototype.getRowDragCell = function (rowIndex) { - var cell = new QuestionMatrixDropdownRenderedCell(); - cell.isDragHandlerCell = true; - cell.className = this.cssClasses.actionsCell; - cell.row = this.matrix.visibleRows[rowIndex]; - return cell; - }; - QuestionMatrixDropdownRenderedTable.prototype.getRowActionsCell = function (rowIndex, location) { - var rowActions = this.getRowActions(rowIndex, location); - if (!this.isValueEmpty(rowActions)) { - var cell = new QuestionMatrixDropdownRenderedCell(); - var actionContainer = this.matrix.allowAdaptiveActions ? new _actions_adaptive_container__WEBPACK_IMPORTED_MODULE_5__["AdaptiveActionContainer"]() : new _actions_container__WEBPACK_IMPORTED_MODULE_7__["ActionContainer"](); - actionContainer.setItems(rowActions); - var itemValue = new _itemvalue__WEBPACK_IMPORTED_MODULE_2__["ItemValue"](actionContainer); - cell.item = itemValue; - cell.isActionsCell = true; - cell.className = this.cssClasses.actionsCell; - cell.row = this.matrix.visibleRows[rowIndex]; - return cell; - } - return null; - }; - QuestionMatrixDropdownRenderedTable.prototype.getRowActions = function (rowIndex, location) { - var actions = this.rowsActions[rowIndex]; - if (!Array.isArray(actions)) - return []; - return actions.filter(function (action) { - if (!action.location) { - action.location = "start"; - } - return action.location === location; - }); - }; - QuestionMatrixDropdownRenderedTable.prototype.buildRowActions = function (row) { - var actions = []; - this.setDefaultRowActions(row, actions); - if (!!this.matrix.survey) { - actions = this.matrix.survey.getUpdatedMatrixRowActions(this.matrix, row, actions); - } - return actions; - }; - Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "showRemoveButtonAsIcon", { - get: function () { - return (this.matrix.survey && this.matrix.survey.css.root === "sd-root-modern"); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDropdownRenderedTable.prototype.setDefaultRowActions = function (row, actions) { - var matrix = this.matrix; - if (this.hasRemoveRows && this.canRemoveRow(row)) { - if (!this.showRemoveButtonAsIcon) { - actions.push(new _actions_action__WEBPACK_IMPORTED_MODULE_4__["Action"]({ - id: "remove-row", - location: "end", - enabled: !this.matrix.isInputReadOnly, - component: "sv-matrix-remove-button", - data: { row: row, question: this.matrix }, - })); - } - else { - actions.push(new _actions_action__WEBPACK_IMPORTED_MODULE_4__["Action"]({ - id: "remove-row", - iconName: "icon-delete", - component: "sv-action-bar-item", - location: "end", - showTitle: false, - title: matrix.removeRowText, - enabled: !matrix.isInputReadOnly, - data: { row: row, question: matrix }, - action: function () { - matrix.removeRowUI(row); - }, - })); - } - } - if (row.hasPanel) { - actions.push(new _actions_action__WEBPACK_IMPORTED_MODULE_4__["Action"]({ - id: "show-detail", - title: _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("editText"), - showTitle: false, - location: "start", - component: "sv-matrix-detail-button", - data: { row: row, question: this.matrix }, - })); - } - }; - QuestionMatrixDropdownRenderedTable.prototype.createHorizontalRow = function (row, useAsHeader) { - var res = new QuestionMatrixDropdownRenderedRow(this.cssClasses); - if (this.matrix.allowRowsDragAndDrop) { - var rowIndex = this.matrix.visibleRows.indexOf(row); - res.cells.push(this.getRowDragCell(rowIndex)); - } - this.addRowActionsCell(row, res, "start"); - if (this.matrix.hasRowText) { - var renderedCell = this.createTextCell(row.locText); - renderedCell.row = row; - res.cells.push(renderedCell); - if (useAsHeader) { - this.setHeaderCellWidth(null, renderedCell); - } - renderedCell.className = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]() - .append(renderedCell.className) - .append(this.cssClasses.rowTextCell) - .append(this.cssClasses.detailRowText, row.hasPanel) - .toString(); - } - for (var i = 0; i < row.cells.length; i++) { - var cell = row.cells[i]; - if (!cell.column.hasVisibleCell) - continue; - if (cell.column.isShowInMultipleColumns) { - this.createMutlipleEditCells(res, cell); - } - else { - var renderedCell = this.createEditCell(cell); - res.cells.push(renderedCell); - if (useAsHeader) { - this.setHeaderCellWidth(cell.column, renderedCell); - } - } - } - this.addRowActionsCell(row, res, "end"); - return res; - }; - QuestionMatrixDropdownRenderedTable.prototype.addRowActionsCell = function (row, renderedRow, location) { - var rowIndex = this.matrix.visibleRows.indexOf(row); - if (this.hasActionCellInRows(location)) { - var actions = this.getRowActionsCell(rowIndex, location); - if (!!actions) { - renderedRow.cells.push(actions); - } - else { - var cell = new QuestionMatrixDropdownRenderedCell(); - cell.isEmpty = true; - renderedRow.cells.push(cell); - } - } - }; - QuestionMatrixDropdownRenderedTable.prototype.createDetailPanelRow = function (row, renderedRow) { - var res = new QuestionMatrixDropdownRenderedRow(this.cssClasses, true); - res.row = row; - var buttonCell = new QuestionMatrixDropdownRenderedCell(); - if (this.matrix.hasRowText) { - buttonCell.colSpans = 2; - } - buttonCell.isEmpty = true; - res.cells.push(buttonCell); - var actionsCell = null; - if (this.hasActionCellInRows("end")) { - actionsCell = new QuestionMatrixDropdownRenderedCell(); - actionsCell.isEmpty = true; - } - var cell = new QuestionMatrixDropdownRenderedCell(); - cell.panel = row.detailPanel; - cell.colSpans = - renderedRow.cells.length - - buttonCell.colSpans - - (!!actionsCell ? actionsCell.colSpans : 0); - cell.className = this.cssClasses.detailPanelCell; - res.cells.push(cell); - if (!!actionsCell) { - res.cells.push(actionsCell); - } - if (typeof this.matrix.onCreateDetailPanelRenderedRowCallback === "function") { - this.matrix.onCreateDetailPanelRenderedRowCallback(res); - } - return res; - }; - QuestionMatrixDropdownRenderedTable.prototype.buildVerticalRows = function () { - var columns = this.matrix.columns; - var renderedRows = []; - for (var i = 0; i < columns.length; i++) { - var col = columns[i]; - if (col.isVisible && col.hasVisibleCell) { - if (col.isShowInMultipleColumns) { - this.createMutlipleVerticalRows(renderedRows, col, i); - } - else { - renderedRows.push(this.createVerticalRow(col, i)); - } - } - } - if (this.hasActionCellInRows("end")) { - renderedRows.push(this.createEndVerticalActionRow()); - } - return renderedRows; - }; - QuestionMatrixDropdownRenderedTable.prototype.createMutlipleVerticalRows = function (renderedRows, column, index) { - var choices = this.getMultipleColumnChoices(column); - if (!choices) - return; - for (var i = 0; i < choices.length; i++) { - renderedRows.push(this.createVerticalRow(column, index, choices[i], i)); - } - }; - QuestionMatrixDropdownRenderedTable.prototype.createVerticalRow = function (column, index, choice, choiceIndex) { - if (choice === void 0) { choice = null; } - if (choiceIndex === void 0) { choiceIndex = -1; } - var res = new QuestionMatrixDropdownRenderedRow(this.cssClasses); - if (this.matrix.showHeader) { - var lTitle = !!choice ? choice.locText : column.locTitle; - var hCell = this.createTextCell(lTitle); - hCell.column = column; - hCell.className = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]() - .append(hCell.className) - .append(this.cssClasses.rowTextCell).toString(); - if (!choice) { - this.setRequriedToHeaderCell(column, hCell); - } - res.cells.push(hCell); - } - var rows = this.matrix.visibleRows; - for (var i = 0; i < rows.length; i++) { - var rChoice = choice; - var rChoiceIndex = choiceIndex >= 0 ? choiceIndex : i; - var cell = rows[i].cells[index]; - var visChoices = !!choice ? cell.question.visibleChoices : undefined; - if (!!visChoices && rChoiceIndex < visChoices.length) { - rChoice = visChoices[rChoiceIndex]; - } - var rCell = this.createEditCell(cell, rChoice); - rCell.item = rChoice; - rCell.choiceIndex = rChoiceIndex; - res.cells.push(rCell); - } - if (this.matrix.hasTotal) { - res.cells.push(this.createEditCell(this.matrix.visibleTotalRow.cells[index])); - } - return res; - }; - QuestionMatrixDropdownRenderedTable.prototype.createEndVerticalActionRow = function () { - var res = new QuestionMatrixDropdownRenderedRow(this.cssClasses); - if (this.matrix.showHeader) { - res.cells.push(this.createEmptyCell()); - } - var rows = this.matrix.visibleRows; - for (var i = 0; i < rows.length; i++) { - res.cells.push(this.getRowActionsCell(i, "end")); - } - if (this.matrix.hasTotal) { - res.cells.push(this.createEmptyCell()); - } - return res; - }; - QuestionMatrixDropdownRenderedTable.prototype.createMutlipleEditCells = function (rRow, cell, isFooter) { - if (isFooter === void 0) { isFooter = false; } - var choices = isFooter - ? this.getMultipleColumnChoices(cell.column) - : cell.question.visibleChoices; - if (!choices) - return; - for (var i = 0; i < choices.length; i++) { - var rCell = this.createEditCell(cell, !isFooter ? choices[i] : undefined); - if (!isFooter) { - //rCell.item = choices[i]; - rCell.choiceIndex = i; - } - rRow.cells.push(rCell); - } - }; - QuestionMatrixDropdownRenderedTable.prototype.createEditCell = function (cell, choiceItem) { - if (choiceItem === void 0) { choiceItem = undefined; } - var res = new QuestionMatrixDropdownRenderedCell(); - res.cell = cell; - res.row = cell.row; - res.question = cell.question; - res.matrix = this.matrix; - res.item = choiceItem; - res.className = res.calculateFinalClassName(this.cssClasses); - //res.css = res.calcCss(this.cssClasses.cell); - // var questionCss = cell.question.cssClasses; - // var className = ""; - // if (!!questionCss) { - // className = ""; - // if (!!questionCss.itemValue) { - // className += " " + questionCss.itemValue; - // } - // if (!!questionCss.asCell) { - // if (!!className) className += ""; - // className += questionCss.asCell; - // } - // } - // if (!className && !!this.cssClasses.cell) { - // className = this.cssClasses.cell; - // } - //res.className = className; - return res; - }; - QuestionMatrixDropdownRenderedTable.prototype.createMutlipleColumnsFooter = function (rRow, cell) { - this.createMutlipleEditCells(rRow, cell, true); - }; - QuestionMatrixDropdownRenderedTable.prototype.createMutlipleColumnsHeader = function (column) { - var choices = this.getMultipleColumnChoices(column); - if (!choices) - return; - for (var i = 0; i < choices.length; i++) { - var cell = this.createTextCell(choices[i].locText); - this.setHeaderCell(column, cell); - this.headerRow.cells.push(cell); - } - }; - QuestionMatrixDropdownRenderedTable.prototype.getMultipleColumnChoices = function (column) { - var choices = column.templateQuestion.choices; - if (!!choices && Array.isArray(choices) && choices.length == 0) - return this.matrix.choices; - choices = column.templateQuestion.visibleChoices; - if (!choices || !Array.isArray(choices)) - return null; - return choices; - }; - QuestionMatrixDropdownRenderedTable.prototype.createHeaderCell = function (column) { - var cell = this.createTextCell(!!column ? column.locTitle : null); - cell.column = column; - this.setHeaderCell(column, cell); - if (this.cssClasses.headerCell) { - cell.className = this.cssClasses.headerCell; - } - return cell; - }; - QuestionMatrixDropdownRenderedTable.prototype.setHeaderCell = function (column, cell) { - this.setHeaderCellWidth(column, cell); - this.setRequriedToHeaderCell(column, cell); - }; - QuestionMatrixDropdownRenderedTable.prototype.setHeaderCellWidth = function (column, cell) { - cell.minWidth = column != null ? this.matrix.getColumnWidth(column) : ""; - cell.width = column != null ? column.width : this.matrix.getRowTitleWidth(); - }; - QuestionMatrixDropdownRenderedTable.prototype.setRequriedToHeaderCell = function (column, cell) { - if (!!column && column.isRequired && this.matrix.survey) { - cell.requiredText = this.matrix.survey.requiredText; - } - }; - QuestionMatrixDropdownRenderedTable.prototype.createRemoveRowCell = function (row) { - var res = new QuestionMatrixDropdownRenderedCell(); - res.row = row; - res.isRemoveRow = this.canRemoveRow(row); - if (!!this.cssClasses.cell) { - res.className = this.cssClasses.cell; - } - return res; - }; - QuestionMatrixDropdownRenderedTable.prototype.createTextCell = function (locTitle) { - var cell = new QuestionMatrixDropdownRenderedCell(); - cell.locTitle = locTitle; - if (!!this.cssClasses.cell) { - cell.className = this.cssClasses.cell; - } - return cell; - }; - QuestionMatrixDropdownRenderedTable.prototype.createEmptyCell = function () { - var res = this.createTextCell(null); - res.isEmpty = true; - return res; - }; - return QuestionMatrixDropdownRenderedTable; - }(_base__WEBPACK_IMPORTED_MODULE_1__["Base"])); - - - - /***/ }), - - /***/ "./src/question_matrixdynamic.ts": - /*!***************************************!*\ - !*** ./src/question_matrixdynamic.ts ***! - \***************************************/ - /*! exports provided: MatrixDynamicRowModel, QuestionMatrixDynamicModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDynamicRowModel", function() { return MatrixDynamicRowModel; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDynamicModel", function() { return QuestionMatrixDynamicModel; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_matrixdropdownbase */ "./src/question_matrixdropdownbase.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./error */ "./src/error.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); - /* harmony import */ var _dragdrop_matrix_rows__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./dragdrop/matrix-rows */ "./src/dragdrop/matrix-rows.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - /* harmony import */ var _question_matrixdropdownrendered__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./question_matrixdropdownrendered */ "./src/question_matrixdropdownrendered.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - - - - - - var MatrixDynamicRowModel = /** @class */ (function (_super) { - __extends(MatrixDynamicRowModel, _super); - function MatrixDynamicRowModel(index, data, value) { - var _this = _super.call(this, data, value) || this; - _this.index = index; - _this.buildCells(value); - return _this; - } - Object.defineProperty(MatrixDynamicRowModel.prototype, "rowName", { - get: function () { - return this.id; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MatrixDynamicRowModel.prototype, "shortcutText", { - get: function () { - var matrix = this.data; - var index = matrix.visibleRows.indexOf(this) + 1; - var questionValue1 = this.cells.length > 1 ? this.cells[1]["questionValue"] : undefined; - var questionValue0 = this.cells.length > 0 ? this.cells[0]["questionValue"] : undefined; - return (questionValue1 && questionValue1.value || - questionValue0 && questionValue0.value || - "" + index); - }, - enumerable: false, - configurable: true - }); - return MatrixDynamicRowModel; - }(_question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_2__["MatrixDropdownRowModelBase"])); - - /** - * A Model for a matrix dymanic question. You may use a dropdown, checkbox, radiogroup, text and comment questions as a cell editors. - * An end-user may dynamically add/remove rows, unlike in matrix dropdown question. - */ - var QuestionMatrixDynamicModel = /** @class */ (function (_super) { - __extends(QuestionMatrixDynamicModel, _super); - function QuestionMatrixDynamicModel(name) { - var _this = _super.call(this, name) || this; - _this.rowCounter = 0; - _this.initialRowCount = 2; - _this.setRowCountValueFromData = false; - _this.moveRowByIndex = function (fromIndex, toIndex) { - var value = _this.createNewValue(); - if (!value) - return; - var movableRow = value[fromIndex]; - if (!movableRow) - return; - value.splice(fromIndex, 1); - value.splice(toIndex, 0, movableRow); - _this.value = value; - }; - void (_this.createLocalizableString("confirmDeleteText", _this)); - var locAddRowText = _this.createLocalizableString("addRowText", _this); - locAddRowText.onGetTextCallback = function (text) { - return !!text ? text : _this.defaultAddRowText; - }; - var locRemoveRowText = _this.createLocalizableString("removeRowText", _this); - locRemoveRowText.onGetTextCallback = function (text) { - return !!text ? text : _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("removeRow"); - }; - var locEmptyRowsText = (_this.createLocalizableString("emptyRowsText", _this)); - locEmptyRowsText.onGetTextCallback = function (text) { - return !!text ? text : _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("emptyRowsText"); - }; - _this.registerFunctionOnPropertiesValueChanged(["hideColumnsIfEmpty", "allowAddRows"], function () { - _this.updateShowTableAndAddRow(); - }); - _this.registerFunctionOnPropertyValueChanged("allowRowsDragAndDrop", function () { - _this.clearRowsAndResetRenderedTable(); - }); - return _this; - } - QuestionMatrixDynamicModel.prototype.setSurveyImpl = function (value, isLight) { - _super.prototype.setSurveyImpl.call(this, value, isLight); - this.dragDropMatrixRows = new _dragdrop_matrix_rows__WEBPACK_IMPORTED_MODULE_7__["DragDropMatrixRows"](this.survey); - }; - QuestionMatrixDynamicModel.prototype.startDragMatrixRow = function (event, row) { - this.dragDropMatrixRows.startDrag(event, row, this); - }; - QuestionMatrixDynamicModel.prototype.getType = function () { - return "matrixdynamic"; - }; - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "isRowsDynamic", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "confirmDelete", { - /** - * Set it to true, to show a confirmation dialog on removing a row - * @see ConfirmDeleteText - */ - get: function () { - return this.getPropertyValue("confirmDelete", false); - }, - set: function (val) { - this.setPropertyValue("confirmDelete", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "keyName", { - /** - * Set it to a column name and the library shows duplication error, if there are same values in different rows in the column. - * @see keyDuplicationError - */ - get: function () { - return this.getPropertyValue("keyName", ""); - }, - set: function (val) { - this.setPropertyValue("keyName", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "defaultRowValue", { - /** - * If it is not empty, then this value is set to every new row, including rows created initially, unless the defaultValue is not empty - * @see defaultValue - * @see defaultValueFromLastRow - */ - get: function () { - return this.getPropertyValue("defaultRowValue"); - }, - set: function (val) { - this.setPropertyValue("defaultRowValue", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "defaultValueFromLastRow", { - /** - * Set it to true to copy the value into new added row from the last row. If defaultRowValue is set and this property equals to true, - * then the value for new added row is merging. - * @see defaultValue - * @see defaultRowValue - */ - get: function () { - return this.getPropertyValue("defaultValueFromLastRow", false); - }, - set: function (val) { - this.setPropertyValue("defaultValueFromLastRow", val); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDynamicModel.prototype.isDefaultValueEmpty = function () { - return (_super.prototype.isDefaultValueEmpty.call(this) && this.isValueEmpty(this.defaultRowValue)); - }; - QuestionMatrixDynamicModel.prototype.valueFromData = function (val) { - if (this.minRowCount < 1) - return _super.prototype.valueFromData.call(this, val); - if (!Array.isArray(val)) - val = []; - for (var i = val.length; i < this.minRowCount; i++) - val.push({}); - return val; - }; - QuestionMatrixDynamicModel.prototype.setDefaultValue = function () { - if (this.isValueEmpty(this.defaultRowValue) || - !this.isValueEmpty(this.defaultValue)) { - _super.prototype.setDefaultValue.call(this); - return; - } - if (!this.isEmpty() || this.rowCount == 0) - return; - var newValue = []; - for (var i = 0; i < this.rowCount; i++) { - newValue.push(this.defaultRowValue); - } - this.value = newValue; - }; - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "rowCount", { - /** - * The number of rows in the matrix. - * @see minRowCount - * @see maxRowCount - */ - get: function () { - return this.rowCountValue; - }, - set: function (val) { - if (val < 0 || val > _settings__WEBPACK_IMPORTED_MODULE_5__["settings"].matrixMaximumRowCount) - return; - this.setRowCountValueFromData = false; - var prevValue = this.rowCountValue; - this.rowCountValue = val; - if (this.value && this.value.length > val) { - var qVal = this.value; - qVal.splice(val); - this.value = qVal; - } - if (this.isUpdateLocked) { - this.initialRowCount = val; - return; - } - if (this.generatedVisibleRows || prevValue == 0) { - if (!this.generatedVisibleRows) { - this.generatedVisibleRows = []; - } - this.generatedVisibleRows.splice(val); - for (var i = prevValue; i < val; i++) { - var newRow = this.createMatrixRow(this.getValueForNewRow()); - this.generatedVisibleRows.push(newRow); - this.onMatrixRowCreated(newRow); - } - } - this.onRowsChanged(); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDynamicModel.prototype.getValueForNewRow = function () { - var res = null; - if (!!this.onGetValueForNewRowCallBack) { - res = this.onGetValueForNewRowCallBack(this); - } - return res; - }; - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "allowRowsDragAndDrop", { - /** - * Set this property to true, to allow rows drag and drop. - */ - get: function () { - return this.getPropertyValue("allowRowsDragAndDrop"); - }, - set: function (val) { - this.setPropertyValue("allowRowsDragAndDrop", val); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDynamicModel.prototype.createRenderedTable = function () { - return new QuestionMatrixDynamicRenderedTable(this); - }; - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "rowCountValue", { - get: function () { - return this.getPropertyValue("rowCount"); - }, - set: function (val) { - this.setPropertyValue("rowCount", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "minRowCount", { - /** - * The minimum row count. A user could not delete a row if the rowCount equals to minRowCount - * @see rowCount - * @see maxRowCount - * @see allowAddRows - */ - get: function () { - return this.getPropertyValue("minRowCount"); - }, - set: function (val) { - if (val < 0) - val = 0; - this.setPropertyValue("minRowCount", val); - if (val > this.maxRowCount) - this.maxRowCount = val; - if (this.rowCount < val) - this.rowCount = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "maxRowCount", { - /** - * The maximum row count. A user could not add a row if the rowCount equals to maxRowCount - * @see rowCount - * @see minRowCount - * @see allowAddRows - */ - get: function () { - return this.getPropertyValue("maxRowCount"); - }, - set: function (val) { - if (val <= 0) - return; - if (val > _settings__WEBPACK_IMPORTED_MODULE_5__["settings"].matrixMaximumRowCount) - val = _settings__WEBPACK_IMPORTED_MODULE_5__["settings"].matrixMaximumRowCount; - if (val == this.maxRowCount) - return; - this.setPropertyValue("maxRowCount", val); - if (val < this.minRowCount) - this.minRowCount = val; - if (this.rowCount > val) - this.rowCount = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "allowAddRows", { - /** - * Set this property to false to disable ability to add new rows. "Add new Row" button becomes invsible in UI - * @see canAddRow - * @see allowRemoveRows - */ - get: function () { - return this.getPropertyValue("allowAddRows"); - }, - set: function (val) { - this.setPropertyValue("allowAddRows", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "allowRemoveRows", { - /** - * Set this property to false to disable ability to remove rows. "Remove" row buttons become invsible in UI - * @see canRemoveRows - * @see allowAddRows - */ - get: function () { - return this.getPropertyValue("allowRemoveRows"); - }, - set: function (val) { - this.setPropertyValue("allowRemoveRows", val); - if (!this.isUpdateLocked) { - this.resetRenderedTable(); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "canAddRow", { - /** - * Returns true, if a new row can be added. - * @see allowAddRows - * @see maxRowCount - * @see canRemoveRows - * @see rowCount - */ - get: function () { - return (this.allowAddRows && !this.isReadOnly && this.rowCount < this.maxRowCount); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "canRemoveRows", { - /** - * Returns true, if row can be removed. - * @see minRowCount - * @see canAddRow - * @see rowCount - */ - get: function () { - var res = this.allowRemoveRows && - !this.isReadOnly && - this.rowCount > this.minRowCount; - return !!this.canRemoveRowsCallback ? this.canRemoveRowsCallback(res) : res; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDynamicModel.prototype.canRemoveRow = function (row) { - if (!this.survey) - return true; - return this.survey.matrixAllowRemoveRow(this, row.index, row); - }; - /** - * Creates and add a new row and focus the cell in the first column. - */ - QuestionMatrixDynamicModel.prototype.addRowUI = function () { - var oldRowCount = this.rowCount; - this.addRow(); - if (oldRowCount === this.rowCount) - return; - var q = this.getQuestionToFocusOnAddingRow(); - if (!!q) { - q.focus(); - } - }; - QuestionMatrixDynamicModel.prototype.getQuestionToFocusOnAddingRow = function () { - var row = this.visibleRows[this.visibleRows.length - 1]; - for (var i = 0; i < row.cells.length; i++) { - var q = row.cells[i].question; - if (!!q && q.isVisible && !q.isReadOnly) { - return q; - } - } - return null; - }; - /** - * Creates and add a new row. - */ - QuestionMatrixDynamicModel.prototype.addRow = function () { - var options = { question: this, canAddRow: this.canAddRow }; - if (!!this.survey) { - this.survey.matrixBeforeRowAdded(options); - } - if (!options.canAddRow) - return; - this.onStartRowAddingRemoving(); - this.addRowCore(); - this.onEndRowAdding(); - if (this.detailPanelShowOnAdding && this.visibleRows.length > 0) { - this.visibleRows[this.visibleRows.length - 1].showDetailPanel(); - } - }; - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "detailPanelShowOnAdding", { - /** - * Set this property to true to show detail panel immediately on adding a new row. - * @see detailPanelMode - */ - get: function () { - return this.getPropertyValue("detailPanelShowOnAdding"); - }, - set: function (val) { - this.setPropertyValue("detailPanelShowOnAdding", val); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDynamicModel.prototype.hasRowsAsItems = function () { - return false; - }; - QuestionMatrixDynamicModel.prototype.unbindValue = function () { - this.clearGeneratedRows(); - this.clearPropertyValue("value"); - this.rowCountValue = 0; - _super.prototype.unbindValue.call(this); - }; - QuestionMatrixDynamicModel.prototype.isValueSurveyElement = function (val) { - return this.isEditingSurveyElement || _super.prototype.isValueSurveyElement.call(this, val); - }; - QuestionMatrixDynamicModel.prototype.addRowCore = function () { - var prevRowCount = this.rowCount; - this.rowCount = this.rowCount + 1; - var defaultValue = this.getDefaultRowValue(true); - var newValue = null; - if (!this.isValueEmpty(defaultValue)) { - newValue = this.createNewValue(); - if (newValue.length == this.rowCount) { - newValue[newValue.length - 1] = defaultValue; - this.value = newValue; - } - } - if (this.data) { - this.runCellsCondition(this.getDataFilteredValues(), this.getDataFilteredProperties()); - var row = this.visibleRows[this.rowCount - 1]; - if (!this.isValueEmpty(row.value)) { - if (!newValue) { - newValue = this.createNewValue(); - } - if (!this.isValueSurveyElement(newValue) && - !this.isTwoValueEquals(newValue[newValue.length - 1], row.value)) { - newValue[newValue.length - 1] = row.value; - this.value = newValue; - } - } - } - if (this.survey) { - if (prevRowCount + 1 == this.rowCount) { - this.survey.matrixRowAdded(this, this.visibleRows[this.visibleRows.length - 1]); - this.onRowsChanged(); - } - } - }; - QuestionMatrixDynamicModel.prototype.getDefaultRowValue = function (isRowAdded) { - var res = null; - for (var i = 0; i < this.columns.length; i++) { - var q = this.columns[i].templateQuestion; - if (!!q && !this.isValueEmpty(q.getDefaultValue())) { - res = res || {}; - res[this.columns[i].name] = q.getDefaultValue(); - } - } - if (!this.isValueEmpty(this.defaultRowValue)) { - for (var key in this.defaultRowValue) { - res = res || {}; - res[key] = this.defaultRowValue[key]; - } - } - if (isRowAdded && this.defaultValueFromLastRow) { - var val = this.value; - if (!!val && Array.isArray(val) && val.length >= this.rowCount - 1) { - var rowValue = val[this.rowCount - 2]; - for (var key in rowValue) { - res = res || {}; - res[key] = rowValue[key]; - } - } - } - return res; - }; - /** - * Removes a row by it's index. If confirmDelete is true, show a confirmation dialog - * @param index a row index, from 0 to rowCount - 1 - * @see removeRow - * @see confirmDelete - */ - QuestionMatrixDynamicModel.prototype.removeRowUI = function (value) { - if (!!value && !!value.rowName) { - var index = this.visibleRows.indexOf(value); - if (index < 0) - return; - value = index; - } - if (!this.isRequireConfirmOnRowDelete(value) || - Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["confirmAction"])(this.confirmDeleteText)) { - this.removeRow(value); - } - }; - QuestionMatrixDynamicModel.prototype.isRequireConfirmOnRowDelete = function (index) { - if (!this.confirmDelete) - return false; - if (index < 0 || index >= this.rowCount) - return false; - var value = this.createNewValue(); - if (this.isValueEmpty(value) || !Array.isArray(value)) - return false; - if (index >= value.length) - return false; - return !this.isValueEmpty(value[index]); - }; - /** - * Removes a row by it's index. - * @param index a row index, from 0 to rowCount - 1 - */ - QuestionMatrixDynamicModel.prototype.removeRow = function (index) { - if (!this.canRemoveRows) - return; - if (index < 0 || index >= this.rowCount) - return; - var row = !!this.visibleRows && index < this.visibleRows.length - ? this.visibleRows[index] - : null; - if (!!row && - !!this.survey && - !this.survey.matrixRowRemoving(this, index, row)) - return; - this.onStartRowAddingRemoving(); - this.removeRowCore(index); - this.onEndRowRemoving(row); - }; - QuestionMatrixDynamicModel.prototype.removeRowCore = function (index) { - var row = this.generatedVisibleRows - ? this.generatedVisibleRows[index] - : null; - if (this.generatedVisibleRows && index < this.generatedVisibleRows.length) { - this.generatedVisibleRows.splice(index, 1); - } - this.rowCountValue--; - if (this.value) { - var val = []; - if (Array.isArray(this.value) && index < this.value.length) { - val = this.createValueCopy(); - } - else { - val = this.createNewValue(); - } - val.splice(index, 1); - val = this.deleteRowValue(val, null); - this.isRowChanging = true; - this.value = val; - this.isRowChanging = false; - } - this.onRowsChanged(); - if (this.survey) { - this.survey.matrixRowRemoved(this, index, row); - } - }; - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "confirmDeleteText", { - /** - * Use this property to change the default text showing in the confirmation delete dialog on removing a row. - */ - get: function () { - return this.getLocalizableStringText("confirmDeleteText", _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("confirmDelete")); - }, - set: function (val) { - this.setLocalizableStringText("confirmDeleteText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "locConfirmDeleteText", { - get: function () { - return this.getLocalizableString("confirmDeleteText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "addRowText", { - /** - * Use this property to change the default value of add row button text. - */ - get: function () { - return this.getLocalizableStringText("addRowText", this.defaultAddRowText); - }, - set: function (val) { - this.setLocalizableStringText("addRowText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "locAddRowText", { - get: function () { - return this.getLocalizableString("addRowText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "defaultAddRowText", { - get: function () { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString(this.isColumnLayoutHorizontal ? "addRow" : "addColumn"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "addRowLocation", { - /** - * By default the 'Add Row' button is shown on bottom if columnLayout is horizontal and on top if columnLayout is vertical.
- * You may set it to "top", "bottom" or "topBottom" (to show on top and bottom). - * @see columnLayout - */ - get: function () { - return this.getPropertyValue("addRowLocation"); - }, - set: function (val) { - this.setPropertyValue("addRowLocation", val); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDynamicModel.prototype.getAddRowLocation = function () { - return this.addRowLocation; - }; - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "hideColumnsIfEmpty", { - /** - * Set this property to true to hide matrix columns when there is no any row. - */ - get: function () { - return this.getPropertyValue("hideColumnsIfEmpty"); - }, - set: function (val) { - this.setPropertyValue("hideColumnsIfEmpty", val); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDynamicModel.prototype.getShowColumnsIfEmpty = function () { - return this.hideColumnsIfEmpty; - }; - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "removeRowText", { - /** - * Use this property to change the default value of remove row button text. - */ - get: function () { - return this.getLocalizableStringText("removeRowText", _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("removeRow")); - }, - set: function (val) { - this.setLocalizableStringText("removeRowText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "locRemoveRowText", { - get: function () { - return this.getLocalizableString("removeRowText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "emptyRowsText", { - /** - * Use this property to change the default value of remove row button text. - */ - get: function () { - return this.getLocalizableStringText("emptyRowsText", _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("emptyRowsText")); - }, - set: function (val) { - this.setLocalizableStringText("emptyRowsText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "locEmptyRowsText", { - get: function () { - return this.getLocalizableString("emptyRowsText"); - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDynamicModel.prototype.getDisplayValueCore = function (keysAsText, value) { - if (!value || !Array.isArray(value)) - return value; - var values = this.getUnbindValue(value); - var rows = this.visibleRows; - for (var i = 0; i < rows.length && i < values.length; i++) { - var val = values[i]; - if (!val) - continue; - values[i] = this.getRowDisplayValue(keysAsText, rows[i], val); - } - return values; - }; - QuestionMatrixDynamicModel.prototype.addConditionObjectsByContext = function (objects, context) { - var hasContext = !!context ? this.columns.indexOf(context) > -1 : false; - for (var i = 0; i < this.columns.length; i++) { - var column = this.columns[i]; - this.addColumnIntoaddConditionObjectsByContext(objects, 0, column); - if (hasContext && column != context) { - this.addColumnIntoaddConditionObjectsByContext(objects, -1, column); - } - for (var j = 1; j < Math.min(_settings__WEBPACK_IMPORTED_MODULE_5__["settings"].matrixMaxRowCountInCondition, this.rowCount); j++) { - this.addColumnIntoaddConditionObjectsByContext(objects, j, column); - } - } - }; - QuestionMatrixDynamicModel.prototype.addColumnIntoaddConditionObjectsByContext = function (objects, rowIndex, column) { - var rowName = rowIndex > -1 ? "[" + rowIndex.toString() + "]." : "row."; - objects.push({ - name: (rowIndex > -1 ? this.getValueName() + rowName : rowName) + column.name, - text: (rowIndex > -1 ? this.processedTitle + rowName : rowName) + - column.fullTitle, - question: this, - }); - }; - QuestionMatrixDynamicModel.prototype.supportGoNextPageAutomatic = function () { - return false; - }; - Object.defineProperty(QuestionMatrixDynamicModel.prototype, "hasRowText", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - QuestionMatrixDynamicModel.prototype.onCheckForErrors = function (errors, isOnValueChanged) { - _super.prototype.onCheckForErrors.call(this, errors, isOnValueChanged); - if (!isOnValueChanged && this.hasErrorInMinRows()) { - errors.push(new _error__WEBPACK_IMPORTED_MODULE_4__["MinRowCountError"](this.minRowCount, this)); - } - }; - QuestionMatrixDynamicModel.prototype.hasErrorInMinRows = function () { - if (this.minRowCount <= 0 || !this.isRequired || !this.generatedVisibleRows) - return false; - var setRowCount = 0; - for (var rowIndex = 0; rowIndex < this.generatedVisibleRows.length; rowIndex++) { - var row = this.generatedVisibleRows[rowIndex]; - if (!row.isEmpty) - setRowCount++; - } - return setRowCount < this.minRowCount; - }; - QuestionMatrixDynamicModel.prototype.getUniqueColumns = function () { - var res = _super.prototype.getUniqueColumns.call(this); - if (!!this.keyName) { - var column = this.getColumnByName(this.keyName); - if (!!column && res.indexOf(column) < 0) { - res.push(column); - } - } - return res; - }; - QuestionMatrixDynamicModel.prototype.generateRows = function () { - var result = new Array(); - if (this.rowCount === 0) - return result; - var val = this.createNewValue(); - for (var i = 0; i < this.rowCount; i++) { - result.push(this.createMatrixRow(this.getRowValueByIndex(val, i))); - } - if (!this.isValueEmpty(this.getDefaultRowValue(false))) { - this.value = val; - } - return result; - }; - QuestionMatrixDynamicModel.prototype.createMatrixRow = function (value) { - return new MatrixDynamicRowModel(this.rowCounter++, this, value); - }; - QuestionMatrixDynamicModel.prototype.onBeforeValueChanged = function (val) { - if (!val || !Array.isArray(val)) - return; - var newRowCount = val.length; - if (newRowCount == this.rowCount) - return; - if (!this.setRowCountValueFromData && newRowCount < this.initialRowCount) - return; - this.setRowCountValueFromData = true; - this.rowCountValue = newRowCount; - if (this.generatedVisibleRows) { - this.clearGeneratedRows(); - this.generatedVisibleRows = this.visibleRows; - this.onRowsChanged(); - } - }; - QuestionMatrixDynamicModel.prototype.createNewValue = function () { - var result = this.createValueCopy(); - if (!result || !Array.isArray(result)) - result = []; - if (result.length > this.rowCount) - result.splice(this.rowCount); - var rowValue = this.getDefaultRowValue(false); - rowValue = rowValue || {}; - for (var i = result.length; i < this.rowCount; i++) { - result.push(this.getUnbindValue(rowValue)); - } - return result; - }; - QuestionMatrixDynamicModel.prototype.deleteRowValue = function (newValue, row) { - var isEmpty = true; - for (var i = 0; i < newValue.length; i++) { - if (this.isObject(newValue[i]) && Object.keys(newValue[i]).length > 0) { - isEmpty = false; - break; - } - } - return isEmpty ? null : newValue; - }; - QuestionMatrixDynamicModel.prototype.getRowValueByIndex = function (questionValue, index) { - return Array.isArray(questionValue) && - index >= 0 && - index < questionValue.length - ? questionValue[index] - : null; - }; - QuestionMatrixDynamicModel.prototype.getRowValueCore = function (row, questionValue, create) { - if (create === void 0) { create = false; } - if (!this.generatedVisibleRows) - return {}; - var res = this.getRowValueByIndex(questionValue, this.generatedVisibleRows.indexOf(row)); - if (!res && create) - res = {}; - return res; - }; - QuestionMatrixDynamicModel.prototype.getAddRowButtonCss = function (isEmptySection) { - if (isEmptySection === void 0) { isEmptySection = false; } - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_8__["CssClassBuilder"]() - .append(this.cssClasses.button) - .append(this.cssClasses.buttonAdd) - .append(this.cssClasses.emptyRowsButton, isEmptySection) - .toString(); - }; - QuestionMatrixDynamicModel.prototype.getRemoveRowButtonCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_8__["CssClassBuilder"]() - .append(this.cssClasses.button) - .append(this.cssClasses.buttonRemove) - .toString(); - }; - return QuestionMatrixDynamicModel; - }(_question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_2__["QuestionMatrixDropdownModelBase"])); - - var QuestionMatrixDynamicRenderedTable = /** @class */ (function (_super) { - __extends(QuestionMatrixDynamicRenderedTable, _super); - function QuestionMatrixDynamicRenderedTable() { - return _super !== null && _super.apply(this, arguments) || this; - } - QuestionMatrixDynamicRenderedTable.prototype.setDefaultRowActions = function (row, actions) { - _super.prototype.setDefaultRowActions.call(this, row, actions); - }; - return QuestionMatrixDynamicRenderedTable; - }(_question_matrixdropdownrendered__WEBPACK_IMPORTED_MODULE_9__["QuestionMatrixDropdownRenderedTable"])); - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("matrixdynamic", [ - { name: "rowsVisibleIf:condition", visible: false }, - { name: "allowAddRows:boolean", default: true }, - { name: "allowRemoveRows:boolean", default: true }, - { name: "rowCount:number", default: 2, minValue: 0, isBindable: true }, - { name: "minRowCount:number", default: 0, minValue: 0 }, - { - name: "maxRowCount:number", - default: _settings__WEBPACK_IMPORTED_MODULE_5__["settings"].matrixMaximumRowCount, - }, - { name: "keyName" }, - "defaultRowValue:rowvalue", - "defaultValueFromLastRow:boolean", - { name: "confirmDelete:boolean" }, - { - name: "confirmDeleteText", - dependsOn: "confirmDelete", - visibleIf: function (obj) { - return !obj || obj.confirmDelete; - }, - serializationProperty: "locConfirmDeleteText", - }, - { - name: "addRowLocation", - default: "default", - choices: ["default", "top", "bottom", "topBottom"], - }, - { name: "addRowText", serializationProperty: "locAddRowText" }, - { name: "removeRowText", serializationProperty: "locRemoveRowText" }, - "hideColumnsIfEmpty:boolean", - { - name: "emptyRowsText:text", - serializationProperty: "locEmptyRowsText", - dependsOn: "hideColumnsIfEmpty", - visibleIf: function (obj) { - return !obj || obj.hideColumnsIfEmpty; - }, - }, - { - name: "detailPanelShowOnAdding:boolean", - dependsOn: "detailPanelMode", - visibleIf: function (obj) { - return obj.detailPanelMode !== "none"; - }, - }, - "allowRowsDragAndDrop:switch" - ], function () { - return new QuestionMatrixDynamicModel(""); - }, "matrixdropdownbase"); - _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("matrixdynamic", function (name) { - var q = new QuestionMatrixDynamicModel(name); - q.choices = [1, 2, 3, 4, 5]; - _question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_2__["QuestionMatrixDropdownModelBase"].addDefaultColumns(q); - return q; - }); - - - /***/ }), - - /***/ "./src/question_multipletext.ts": - /*!**************************************!*\ - !*** ./src/question_multipletext.ts ***! - \**************************************/ - /*! exports provided: MultipleTextItemModel, QuestionMultipleTextModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MultipleTextItemModel", function() { return MultipleTextItemModel; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMultipleTextModel", function() { return QuestionMultipleTextModel; }); - /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); - /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var _question_text__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./question_text */ "./src/question_text.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - - - - var MultipleTextItemModel = /** @class */ (function (_super) { - __extends(MultipleTextItemModel, _super); - function MultipleTextItemModel(name, title) { - if (name === void 0) { name = null; } - if (title === void 0) { title = null; } - var _this = _super.call(this) || this; - _this.editorValue = _this.createEditor(name); - _this.editor.questionTitleTemplateCallback = function () { - return ""; - }; - _this.editor.titleLocation = "left"; - if (title) { - _this.title = title; - } - return _this; - } - MultipleTextItemModel.prototype.getType = function () { - return "multipletextitem"; - }; - Object.defineProperty(MultipleTextItemModel.prototype, "id", { - get: function () { - return this.editor.id; - }, - enumerable: false, - configurable: true - }); - MultipleTextItemModel.prototype.getOriginalObj = function () { - return this.editor; - }; - Object.defineProperty(MultipleTextItemModel.prototype, "name", { - /** - * The item name. - */ - get: function () { - return this.editor.name; - }, - set: function (val) { - this.editor.name = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MultipleTextItemModel.prototype, "question", { - get: function () { - return this.data; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MultipleTextItemModel.prototype, "editor", { - get: function () { - return this.editorValue; - }, - enumerable: false, - configurable: true - }); - MultipleTextItemModel.prototype.createEditor = function (name) { - return new _question_text__WEBPACK_IMPORTED_MODULE_3__["QuestionTextModel"](name); - }; - MultipleTextItemModel.prototype.addUsedLocales = function (locales) { - _super.prototype.addUsedLocales.call(this, locales); - this.editor.addUsedLocales(locales); - }; - MultipleTextItemModel.prototype.locStrsChanged = function () { - _super.prototype.locStrsChanged.call(this); - this.editor.locStrsChanged(); - }; - MultipleTextItemModel.prototype.setData = function (data) { - this.data = data; - if (!!data) { - this.editor.defaultValue = data.getItemDefaultValue(this.name); - this.editor.setSurveyImpl(this); - this.editor.parent = data; - } - }; - Object.defineProperty(MultipleTextItemModel.prototype, "isRequired", { - /** - * Set this property to true, to make the item a required. If a user doesn't fill the item then a validation error will be generated. - */ - get: function () { - return this.editor.isRequired; - }, - set: function (val) { - this.editor.isRequired = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MultipleTextItemModel.prototype, "inputType", { - /** - * Use this property to change the default input type. - */ - get: function () { - return this.editor.inputType; - }, - set: function (val) { - this.editor.inputType = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MultipleTextItemModel.prototype, "title", { - /** - * Item title. If it is empty, the item name is rendered as title. This property supports markdown. - * @see name - */ - get: function () { - return this.editor.title; - }, - set: function (val) { - this.editor.title = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MultipleTextItemModel.prototype, "locTitle", { - get: function () { - return this.editor.locTitle; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MultipleTextItemModel.prototype, "fullTitle", { - /** - * Returns the text or html for rendering the title. - */ - get: function () { - return this.editor.fullTitle; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MultipleTextItemModel.prototype, "maxLength", { - /** - * The maximum text length. If it is -1, defaul value, then the survey maxTextLength property will be used. - * If it is 0, then the value is unlimited - * @see SurveyModel.maxTextLength - */ - get: function () { - return this.editor.maxLength; - }, - set: function (val) { - this.editor.maxLength = val; - }, - enumerable: false, - configurable: true - }); - MultipleTextItemModel.prototype.getMaxLength = function () { - var survey = this.getSurvey(); - return _helpers__WEBPACK_IMPORTED_MODULE_6__["Helpers"].getMaxLength(this.maxLength, survey ? survey.maxTextLength : -1); - }; - Object.defineProperty(MultipleTextItemModel.prototype, "placeHolder", { - /** - * The input place holder. - */ - get: function () { - return this.editor.placeHolder; - }, - set: function (val) { - this.editor.placeHolder = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MultipleTextItemModel.prototype, "locPlaceHolder", { - get: function () { - return this.editor.locPlaceHolder; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MultipleTextItemModel.prototype, "requiredErrorText", { - /** - * The custom text that will be shown on required error. Use this property, if you do not want to show the default text. - */ - get: function () { - return this.editor.requiredErrorText; - }, - set: function (val) { - this.editor.requiredErrorText = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MultipleTextItemModel.prototype, "locRequiredErrorText", { - get: function () { - return this.editor.locRequiredErrorText; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MultipleTextItemModel.prototype, "size", { - /** - * The input size. - */ - get: function () { - return this.editor.size; - }, - set: function (val) { - this.editor.size = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(MultipleTextItemModel.prototype, "validators", { - /** - * The list of question validators. - */ - get: function () { - return this.editor.validators; - }, - set: function (val) { - this.editor.validators = val; - }, - enumerable: false, - configurable: true - }); - MultipleTextItemModel.prototype.getValidators = function () { - return this.validators; - }; - Object.defineProperty(MultipleTextItemModel.prototype, "value", { - /** - * The item value. - */ - get: function () { - return this.data ? this.data.getMultipleTextValue(this.name) : null; - }, - set: function (value) { - if (this.data != null) { - this.data.setMultipleTextValue(this.name, value); - } - }, - enumerable: false, - configurable: true - }); - MultipleTextItemModel.prototype.isEmpty = function () { - return this.editor.isEmpty(); - }; - MultipleTextItemModel.prototype.onValueChanged = function (newValue) { - if (this.valueChangedCallback) - this.valueChangedCallback(newValue); - }; - //ISurveyImpl - MultipleTextItemModel.prototype.getSurveyData = function () { - return this; - }; - MultipleTextItemModel.prototype.getSurvey = function () { - return this.data ? this.data.getSurvey() : null; - }; - MultipleTextItemModel.prototype.getTextProcessor = function () { - return this.data ? this.data.getTextProcessor() : null; - }; - //ISurveyData - MultipleTextItemModel.prototype.getValue = function (name) { - if (!this.data) - return null; - return this.data.getMultipleTextValue(name); - }; - MultipleTextItemModel.prototype.setValue = function (name, value) { - if (this.data) { - this.data.setMultipleTextValue(name, value); - } - }; - MultipleTextItemModel.prototype.getVariable = function (name) { - return undefined; - }; - MultipleTextItemModel.prototype.setVariable = function (name, newValue) { }; - MultipleTextItemModel.prototype.getComment = function (name) { - return null; - }; - MultipleTextItemModel.prototype.setComment = function (name, newValue) { }; - MultipleTextItemModel.prototype.getAllValues = function () { - if (this.data) - return this.data.getAllValues(); - return this.value; - }; - MultipleTextItemModel.prototype.getFilteredValues = function () { - return this.getAllValues(); - }; - MultipleTextItemModel.prototype.getFilteredProperties = function () { - return { survey: this.getSurvey() }; - }; - //IValidatorOwner - MultipleTextItemModel.prototype.getValidatorTitle = function () { - return this.title; - }; - Object.defineProperty(MultipleTextItemModel.prototype, "validatedValue", { - get: function () { - return this.value; - }, - set: function (val) { - this.value = val; - }, - enumerable: false, - configurable: true - }); - MultipleTextItemModel.prototype.getDataFilteredValues = function () { - return this.getFilteredValues(); - }; - MultipleTextItemModel.prototype.getDataFilteredProperties = function () { - return this.getFilteredProperties(); - }; - return MultipleTextItemModel; - }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); - - /** - * A Model for a multiple text question. - */ - var QuestionMultipleTextModel = /** @class */ (function (_super) { - __extends(QuestionMultipleTextModel, _super); - function QuestionMultipleTextModel(name) { - var _this = _super.call(this, name) || this; - _this.isMultipleItemValueChanging = false; - _this.createNewArray("items", function (item) { - item.setData(_this); - }); - _this.registerFunctionOnPropertyValueChanged("items", function () { - _this.fireCallback(_this.colCountChangedCallback); - }); - _this.registerFunctionOnPropertyValueChanged("colCount", function () { - _this.fireCallback(_this.colCountChangedCallback); - }); - _this.registerFunctionOnPropertyValueChanged("itemSize", function () { - _this.updateItemsSize(); - }); - return _this; - } - QuestionMultipleTextModel.addDefaultItems = function (question) { - var names = _questionfactory__WEBPACK_IMPORTED_MODULE_5__["QuestionFactory"].DefaultMutlipleTextItems; - for (var i = 0; i < names.length; i++) - question.addItem(names[i]); - }; - QuestionMultipleTextModel.prototype.getType = function () { - return "multipletext"; - }; - QuestionMultipleTextModel.prototype.setSurveyImpl = function (value, isLight) { - _super.prototype.setSurveyImpl.call(this, value, isLight); - for (var i = 0; i < this.items.length; i++) { - this.items[i].setData(this); - } - }; - Object.defineProperty(QuestionMultipleTextModel.prototype, "isAllowTitleLeft", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMultipleTextModel.prototype, "hasSingleInput", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - QuestionMultipleTextModel.prototype.onSurveyLoad = function () { - this.editorsOnSurveyLoad(); - _super.prototype.onSurveyLoad.call(this); - this.fireCallback(this.colCountChangedCallback); - }; - QuestionMultipleTextModel.prototype.setQuestionValue = function (newValue, updateIsAnswered) { - if (updateIsAnswered === void 0) { updateIsAnswered = true; } - _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); - this.performForEveryEditor(function (item) { - item.editor.updateValueFromSurvey(item.value); - }); - this.updateIsAnswered(); - }; - QuestionMultipleTextModel.prototype.onSurveyValueChanged = function (newValue) { - _super.prototype.onSurveyValueChanged.call(this, newValue); - this.performForEveryEditor(function (item) { - item.editor.onSurveyValueChanged(item.value); - }); - }; - QuestionMultipleTextModel.prototype.updateItemsSize = function () { - this.performForEveryEditor(function (item) { - item.editor.updateInputSize(); - }); - }; - QuestionMultipleTextModel.prototype.editorsOnSurveyLoad = function () { - this.performForEveryEditor(function (item) { - item.editor.onSurveyLoad(); - }); - }; - QuestionMultipleTextModel.prototype.performForEveryEditor = function (func) { - for (var i = 0; i < this.items.length; i++) { - var item = this.items[i]; - if (item.editor) { - func(item); - } - } - }; - Object.defineProperty(QuestionMultipleTextModel.prototype, "items", { - /** - * The list of input items. - */ - get: function () { - return this.getPropertyValue("items"); - }, - set: function (val) { - this.setPropertyValue("items", val); - }, - enumerable: false, - configurable: true - }); - /** - * Add a new text item. - * @param name a item name - * @param title a item title (optional) - */ - QuestionMultipleTextModel.prototype.addItem = function (name, title) { - if (title === void 0) { title = null; } - var item = this.createTextItem(name, title); - this.items.push(item); - return item; - }; - QuestionMultipleTextModel.prototype.getItemByName = function (name) { - for (var i = 0; i < this.items.length; i++) { - if (this.items[i].name == name) - return this.items[i]; - } - return null; - }; - QuestionMultipleTextModel.prototype.addConditionObjectsByContext = function (objects, context) { - for (var i = 0; i < this.items.length; i++) { - var item = this.items[i]; - objects.push({ - name: this.getValueName() + "." + item.name, - text: this.processedTitle + "." + item.fullTitle, - question: this, - }); - } - }; - QuestionMultipleTextModel.prototype.getConditionJson = function (operator, path) { - if (path === void 0) { path = null; } - if (!path) - return _super.prototype.getConditionJson.call(this); - var item = this.getItemByName(path); - if (!item) - return null; - var json = new _jsonobject__WEBPACK_IMPORTED_MODULE_4__["JsonObject"]().toJsonObject(item); - json["type"] = "text"; - return json; - }; - QuestionMultipleTextModel.prototype.locStrsChanged = function () { - _super.prototype.locStrsChanged.call(this); - for (var i = 0; i < this.items.length; i++) { - this.items[i].locStrsChanged(); - } - }; - QuestionMultipleTextModel.prototype.supportGoNextPageAutomatic = function () { - for (var i = 0; i < this.items.length; i++) { - if (this.items[i].isEmpty()) - return false; - } - return true; - }; - Object.defineProperty(QuestionMultipleTextModel.prototype, "colCount", { - /** - * The number of columns. Items are rendred in one line if the value is 0. - */ - get: function () { - return this.getPropertyValue("colCount"); - }, - set: function (val) { - if (val < 1 || val > 5) - return; - this.setPropertyValue("colCount", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionMultipleTextModel.prototype, "itemSize", { - /** - * The default text input size. - */ - get: function () { - return this.getPropertyValue("itemSize"); - }, - set: function (val) { - this.setPropertyValue("itemSize", val); - }, - enumerable: false, - configurable: true - }); - /** - * Returns the list of rendered rows. - */ - QuestionMultipleTextModel.prototype.getRows = function () { - var colCount = this.colCount; - var items = this.items; - var rows = []; - var index = 0; - for (var i = 0; i < items.length; i++) { - if (index == 0) { - rows.push([]); - } - rows[rows.length - 1].push(items[i]); - index++; - if (index >= colCount) { - index = 0; - } - } - return rows; - }; - QuestionMultipleTextModel.prototype.onValueChanged = function () { - _super.prototype.onValueChanged.call(this); - this.onItemValueChanged(); - }; - QuestionMultipleTextModel.prototype.createTextItem = function (name, title) { - return new MultipleTextItemModel(name, title); - }; - QuestionMultipleTextModel.prototype.onItemValueChanged = function () { - if (this.isMultipleItemValueChanging) - return; - for (var i = 0; i < this.items.length; i++) { - var itemValue = null; - if (this.value && this.items[i].name in this.value) { - itemValue = this.value[this.items[i].name]; - } - this.items[i].onValueChanged(itemValue); - } - }; - QuestionMultipleTextModel.prototype.getIsRunningValidators = function () { - if (_super.prototype.getIsRunningValidators.call(this)) - return true; - for (var i = 0; i < this.items.length; i++) { - if (this.items[i].editor.isRunningValidators) - return true; - } - return false; - }; - QuestionMultipleTextModel.prototype.hasErrors = function (fireCallback, rec) { - var _this = this; - if (fireCallback === void 0) { fireCallback = true; } - if (rec === void 0) { rec = null; } - var res = false; - for (var i = 0; i < this.items.length; i++) { - this.items[i].editor.onCompletedAsyncValidators = function (hasErrors) { - _this.raiseOnCompletedAsyncValidators(); - }; - if (!!rec && - rec.isOnValueChanged === true && - this.items[i].editor.isEmpty()) - continue; - res = this.items[i].editor.hasErrors(fireCallback, rec) || res; - } - return _super.prototype.hasErrors.call(this, fireCallback) || res; - }; - QuestionMultipleTextModel.prototype.getAllErrors = function () { - var result = _super.prototype.getAllErrors.call(this); - for (var i = 0; i < this.items.length; i++) { - var errors = this.items[i].editor.getAllErrors(); - if (errors && errors.length > 0) { - result = result.concat(errors); - } - } - return result; - }; - QuestionMultipleTextModel.prototype.clearErrors = function () { - _super.prototype.clearErrors.call(this); - for (var i = 0; i < this.items.length; i++) { - this.items[i].editor.clearErrors(); - } - }; - QuestionMultipleTextModel.prototype.getContainsErrors = function () { - var res = _super.prototype.getContainsErrors.call(this); - if (res) - return res; - var items = this.items; - for (var i = 0; i < items.length; i++) { - if (items[i].editor.containsErrors) - return true; - } - return false; - }; - QuestionMultipleTextModel.prototype.getIsAnswered = function () { - if (!_super.prototype.getIsAnswered.call(this)) - return false; - for (var i = 0; i < this.items.length; i++) { - var editor = this.items[i].editor; - if (editor.isVisible && !editor.isAnswered) - return false; - } - return true; - }; - QuestionMultipleTextModel.prototype.getProgressInfo = function () { - var elements = []; - for (var i = 0; i < this.items.length; i++) { - elements.push(this.items[i].editor); - } - return _survey_element__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].getProgressInfoByElements(elements, this.isRequired); - }; - QuestionMultipleTextModel.prototype.getDisplayValueCore = function (keysAsText, value) { - if (!value) - return value; - var res = {}; - for (var i = 0; i < this.items.length; i++) { - var item = this.items[i]; - var val = value[item.name]; - if (_helpers__WEBPACK_IMPORTED_MODULE_6__["Helpers"].isValueEmpty(val)) - continue; - var itemName = item.name; - if (keysAsText && !!item.title) { - itemName = item.title; - } - res[itemName] = item.editor.getDisplayValue(keysAsText, val); - } - return res; - }; - //IMultipleTextData - QuestionMultipleTextModel.prototype.getMultipleTextValue = function (name) { - if (!this.value) - return null; - return this.value[name]; - }; - QuestionMultipleTextModel.prototype.setMultipleTextValue = function (name, value) { - this.isMultipleItemValueChanging = true; - if (this.isValueEmpty(value)) { - value = undefined; - } - var newValue = this.value; - if (!newValue) { - newValue = {}; - } - newValue[name] = value; - this.setNewValue(newValue); - this.isMultipleItemValueChanging = false; - }; - QuestionMultipleTextModel.prototype.getItemDefaultValue = function (name) { - return !!this.defaultValue ? this.defaultValue[name] : null; - }; - QuestionMultipleTextModel.prototype.getTextProcessor = function () { - return this.textProcessor; - }; - QuestionMultipleTextModel.prototype.getAllValues = function () { - return this.data ? this.data.getAllValues() : null; - }; - QuestionMultipleTextModel.prototype.getIsRequiredText = function () { - return this.survey ? this.survey.requiredText : ""; - }; - //IPanel - QuestionMultipleTextModel.prototype.addElement = function (element, index) { }; - QuestionMultipleTextModel.prototype.removeElement = function (element) { - return false; - }; - QuestionMultipleTextModel.prototype.getQuestionTitleLocation = function () { - return "left"; - }; - QuestionMultipleTextModel.prototype.getQuestionStartIndex = function () { - return this.getStartIndex(); - }; - QuestionMultipleTextModel.prototype.getChildrenLayoutType = function () { - return "row"; - }; - QuestionMultipleTextModel.prototype.elementWidthChanged = function (el) { }; - Object.defineProperty(QuestionMultipleTextModel.prototype, "elements", { - get: function () { - return []; - }, - enumerable: false, - configurable: true - }); - QuestionMultipleTextModel.prototype.indexOf = function (el) { - return -1; - }; - QuestionMultipleTextModel.prototype.ensureRowsVisibility = function () { - // do nothing - }; - QuestionMultipleTextModel.prototype.getItemLabelCss = function (item) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_7__["CssClassBuilder"]().append(this.cssClasses.itemLabel).append(this.cssClasses.itemLabelOnError, item.editor.errors.length > 0).toString(); - }; - QuestionMultipleTextModel.prototype.getItemCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_7__["CssClassBuilder"]().append(this.cssClasses.item).toString(); - }; - QuestionMultipleTextModel.prototype.getItemTitleCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_7__["CssClassBuilder"]().append(this.cssClasses.itemTitle).toString(); - }; - return QuestionMultipleTextModel; - }(_question__WEBPACK_IMPORTED_MODULE_2__["Question"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_4__["Serializer"].addClass("multipletextitem", [ - "name", - "isRequired:boolean", - { name: "placeHolder", serializationProperty: "locPlaceHolder" }, - { - name: "inputType", - default: "text", - choices: [ - "color", - "date", - "datetime", - "datetime-local", - "email", - "month", - "number", - "password", - "range", - "tel", - "text", - "time", - "url", - "week", - ], - }, - { name: "title", serializationProperty: "locTitle" }, - { name: "maxLength:number", default: -1 }, - { name: "size:number", minValue: 0 }, - { - name: "requiredErrorText:text", - serializationProperty: "locRequiredErrorText", - }, - { - name: "validators:validators", - baseClassName: "surveyvalidator", - classNamePart: "validator", - }, - ], function () { - return new MultipleTextItemModel(""); - }); - _jsonobject__WEBPACK_IMPORTED_MODULE_4__["Serializer"].addClass("multipletext", [ - { name: "!items:textitems", className: "multipletextitem" }, - { name: "itemSize:number", minValue: 0 }, - { name: "colCount:number", default: 1, choices: [1, 2, 3, 4, 5] }, - ], function () { - return new QuestionMultipleTextModel(""); - }, "question"); - _questionfactory__WEBPACK_IMPORTED_MODULE_5__["QuestionFactory"].Instance.registerQuestion("multipletext", function (name) { - var q = new QuestionMultipleTextModel(name); - QuestionMultipleTextModel.addDefaultItems(q); - return q; - }); - - - /***/ }), - - /***/ "./src/question_paneldynamic.ts": - /*!**************************************!*\ - !*** ./src/question_paneldynamic.ts ***! - \**************************************/ - /*! exports provided: QuestionPanelDynamicItem, QuestionPanelDynamicTemplateSurveyImpl, QuestionPanelDynamicModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionPanelDynamicItem", function() { return QuestionPanelDynamicItem; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionPanelDynamicTemplateSurveyImpl", function() { return QuestionPanelDynamicTemplateSurveyImpl; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionPanelDynamicModel", function() { return QuestionPanelDynamicModel; }); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _textPreProcessor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./textPreProcessor */ "./src/textPreProcessor.ts"); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./error */ "./src/error.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); - }; - - - - - - - - - - - - var QuestionPanelDynamicItemTextProcessor = /** @class */ (function (_super) { - __extends(QuestionPanelDynamicItemTextProcessor, _super); - function QuestionPanelDynamicItemTextProcessor(data, panelItem, variableName) { - var _this = _super.call(this, variableName) || this; - _this.data = data; - _this.panelItem = panelItem; - _this.variableName = variableName; - return _this; - } - Object.defineProperty(QuestionPanelDynamicItemTextProcessor.prototype, "survey", { - get: function () { - return this.panelItem.getSurvey(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicItemTextProcessor.prototype, "panel", { - get: function () { - return this.panelItem.panel; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicItemTextProcessor.prototype, "panelIndex", { - get: function () { - return !!this.data ? this.data.getItemIndex(this.panelItem) : -1; - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicItemTextProcessor.prototype.getValues = function () { - return this.panelItem.getAllValues(); - }; - QuestionPanelDynamicItemTextProcessor.prototype.getQuestionByName = function (name) { - var res = _super.prototype.getQuestionByName.call(this, name); - if (!!res) - return res; - var index = this.panelIndex; - return index > -1 - ? this.data.getSharedQuestionFromArray(name, index) - : null; - }; - QuestionPanelDynamicItemTextProcessor.prototype.onCustomProcessText = function (textValue) { - if (textValue.name == QuestionPanelDynamicItem.IndexVariableName) { - var index = this.panelIndex; - if (index > -1) { - textValue.isExists = true; - textValue.value = index + 1; - return true; - } - } - if (textValue.name.toLowerCase().indexOf(QuestionPanelDynamicItem.ParentItemVariableName + ".") == 0) { - var q = this.data; - if (!!q && !!q.parentQuestion && !!q.parent && !!q.parent.data) { - var processor = new QuestionPanelDynamicItemTextProcessor(q.parentQuestion, q.parent.data, QuestionPanelDynamicItem.ItemVariableName); - var text = QuestionPanelDynamicItem.ItemVariableName + - textValue.name.substring(QuestionPanelDynamicItem.ParentItemVariableName.length); - var res = processor.processValue(text, textValue.returnDisplayValue); - textValue.isExists = res.isExists; - textValue.value = res.value; - } - return true; - } - return false; - }; - return QuestionPanelDynamicItemTextProcessor; - }(_textPreProcessor__WEBPACK_IMPORTED_MODULE_3__["QuestionTextProcessor"])); - var QuestionPanelDynamicItem = /** @class */ (function () { - function QuestionPanelDynamicItem(data, panel) { - this.data = data; - this.panelValue = panel; - this.textPreProcessor = new QuestionPanelDynamicItemTextProcessor(data, this, QuestionPanelDynamicItem.ItemVariableName); - this.setSurveyImpl(); - } - Object.defineProperty(QuestionPanelDynamicItem.prototype, "panel", { - get: function () { - return this.panelValue; - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicItem.prototype.setSurveyImpl = function () { - this.panel.setSurveyImpl(this); - }; - QuestionPanelDynamicItem.prototype.getValue = function (name) { - var values = this.getAllValues(); - return values[name]; - }; - QuestionPanelDynamicItem.prototype.setValue = function (name, newValue) { - this.data.setPanelItemData(this, name, newValue); - }; - QuestionPanelDynamicItem.prototype.getVariable = function (name) { - return undefined; - }; - QuestionPanelDynamicItem.prototype.setVariable = function (name, newValue) { }; - QuestionPanelDynamicItem.prototype.getComment = function (name) { - var result = this.getValue(name + _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].commentPrefix); - return result ? result : ""; - }; - QuestionPanelDynamicItem.prototype.setComment = function (name, newValue, locNotification) { - this.setValue(name + _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].commentPrefix, newValue); - }; - QuestionPanelDynamicItem.prototype.getAllValues = function () { - return this.data.getPanelItemData(this); - }; - QuestionPanelDynamicItem.prototype.getFilteredValues = function () { - var values = {}; - var surveyValues = !!this.data && !!this.data.getRootData() - ? this.data.getRootData().getFilteredValues() - : {}; - for (var key in surveyValues) { - values[key] = surveyValues[key]; - } - values[QuestionPanelDynamicItem.ItemVariableName] = this.getAllValues(); - if (!!this.data) { - values[QuestionPanelDynamicItem.IndexVariableName.toLowerCase()] = this.data.getItemIndex(this); - var q = this.data; - if (!!q && !!q.parentQuestion && !!q.parent) { - values[QuestionPanelDynamicItem.ParentItemVariableName] = q.parent.getValue(); - } - } - return values; - }; - QuestionPanelDynamicItem.prototype.getFilteredProperties = function () { - if (!!this.data && !!this.data.getRootData()) - return this.data.getRootData().getFilteredProperties(); - return { survey: this.getSurvey() }; - }; - QuestionPanelDynamicItem.prototype.getSurveyData = function () { - return this; - }; - QuestionPanelDynamicItem.prototype.getSurvey = function () { - return this.data ? this.data.getSurvey() : null; - }; - QuestionPanelDynamicItem.prototype.getTextProcessor = function () { - return this.textPreProcessor; - }; - QuestionPanelDynamicItem.ItemVariableName = "panel"; - QuestionPanelDynamicItem.ParentItemVariableName = "parentpanel"; - QuestionPanelDynamicItem.IndexVariableName = "panelIndex"; - return QuestionPanelDynamicItem; - }()); - - var QuestionPanelDynamicTemplateSurveyImpl = /** @class */ (function () { - function QuestionPanelDynamicTemplateSurveyImpl(data) { - this.data = data; - } - QuestionPanelDynamicTemplateSurveyImpl.prototype.getSurveyData = function () { - return null; - }; - QuestionPanelDynamicTemplateSurveyImpl.prototype.getSurvey = function () { - return this.data.getSurvey(); - }; - QuestionPanelDynamicTemplateSurveyImpl.prototype.getTextProcessor = function () { - return null; - }; - return QuestionPanelDynamicTemplateSurveyImpl; - }()); - - /** - * A Model for a panel dymanic question. You setup the template panel, but adding elements (any question or a panel) and assign a text to it's title, and this panel will be used as a template on creating dynamic panels. The number of panels is defined by panelCount property. - * An end-user may dynamically add/remove panels, unless you forbidden this. - */ - var QuestionPanelDynamicModel = /** @class */ (function (_super) { - __extends(QuestionPanelDynamicModel, _super); - function QuestionPanelDynamicModel(name) { - var _this = _super.call(this, name) || this; - _this.loadingPanelCount = 0; - _this.currentIndexValue = -1; - _this.isAddingNewPanels = false; - _this.createNewArray("panels"); - _this.templateValue = _this.createAndSetupNewPanelObject(); - _this.template.renderWidth = "100%"; - _this.template.selectedElementInDesign = _this; - _this.template.addElementCallback = function (element) { - _this.addOnPropertyChangedCallback(element); - _this.rebuildPanels(); - }; - _this.template.removeElementCallback = function () { - _this.rebuildPanels(); - }; - _this.createLocalizableString("confirmDeleteText", _this); - _this.createLocalizableString("keyDuplicationError", _this); - _this.createLocalizableString("panelAddText", _this); - _this.createLocalizableString("panelRemoveText", _this); - _this.createLocalizableString("panelPrevText", _this); - _this.createLocalizableString("panelNextText", _this); - _this.registerFunctionOnPropertyValueChanged("panelsState", function () { - _this.setPanelsState(); - }); - return _this; - } - Object.defineProperty(QuestionPanelDynamicModel.prototype, "hasSingleInput", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicModel.prototype.setSurveyImpl = function (value, isLight) { - _super.prototype.setSurveyImpl.call(this, value, isLight); - this.setTemplatePanelSurveyImpl(); - this.setPanelsSurveyImpl(); - }; - QuestionPanelDynamicModel.prototype.assignOnPropertyChangedToTemplate = function () { - var elements = this.template.elements; - for (var i = 0; i < elements.length; i++) { - this.addOnPropertyChangedCallback(elements[i]); - } - }; - QuestionPanelDynamicModel.prototype.addOnPropertyChangedCallback = function (element) { - var _this = this; - if (element.isQuestion) { - element.setParentQuestion(this); - } - element.onPropertyChanged.add(function (element, options) { - _this.onTemplateElementPropertyChanged(element, options); - }); - if (element.isPanel) { - element.addElementCallback = function (element) { - _this.addOnPropertyChangedCallback(element); - }; - } - }; - QuestionPanelDynamicModel.prototype.onTemplateElementPropertyChanged = function (element, options) { - if (this.isLoadingFromJson || this.useTemplatePanel || this.panels.length == 0) - return; - var property = _jsonobject__WEBPACK_IMPORTED_MODULE_5__["Serializer"].findProperty(element.getType(), options.name); - if (!property) - return; - var panels = this.panels; - for (var i = 0; i < panels.length; i++) { - var question = panels[i].getQuestionByName(element.name); - if (!!question && question[options.name] !== options.newValue) { - question[options.name] = options.newValue; - } - } - }; - Object.defineProperty(QuestionPanelDynamicModel.prototype, "useTemplatePanel", { - get: function () { - return this.isDesignMode && !this.isContentElement; - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicModel.prototype.getType = function () { - return "paneldynamic"; - }; - Object.defineProperty(QuestionPanelDynamicModel.prototype, "isCompositeQuestion", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicModel.prototype.clearOnDeletingContainer = function () { - this.panels.forEach(function (panel) { - panel.clearOnDeletingContainer(); - }); - }; - Object.defineProperty(QuestionPanelDynamicModel.prototype, "isAllowTitleLeft", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicModel.prototype.removeElement = function (element) { - return this.template.removeElement(element); - }; - Object.defineProperty(QuestionPanelDynamicModel.prototype, "template", { - /** - * The template Panel. This panel is used as a template on creatign dynamic panels - * @see templateElements - * @see templateTitle - * @see panelCount - */ - get: function () { - return this.templateValue; - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicModel.prototype.getPanel = function () { - return this.template; - }; - Object.defineProperty(QuestionPanelDynamicModel.prototype, "templateElements", { - /** - * The template Panel elements, questions and panels. - * @see templateElements - * @see template - * @see panelCount - */ - get: function () { - return this.template.elements; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "templateTitle", { - /** - * The template Panel title property. - * @see templateElements - * @see template - * @see panelCount - */ - get: function () { - return this.template.title; - }, - set: function (newValue) { - this.template.title = newValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "locTemplateTitle", { - get: function () { - return this.template.locTitle; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "templateDescription", { - /** - * The template Panel description property. - * @see templateElements - * @see template - * @see panelCount - * @see templateTitle - */ - get: function () { - return this.template.description; - }, - set: function (newValue) { - this.template.description = newValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "locTemplateDescription", { - get: function () { - return this.template.locDescription; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "items", { - get: function () { - var res = []; - for (var i = 0; i < this.panels.length; i++) { - res.push(this.panels[i].data); - } - return res; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "panels", { - /** - * The array of dynamic panels created based on panel template - * @see template - * @see panelCount - */ - get: function () { - return this.getPropertyValue("panels"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "currentIndex", { - /** - * The index of current active dynamical panel when the renderMode is not "list". If there is no dymamic panel (panelCount = 0) or renderMode equals "list" it returns -1, otherwise it returns a value from 0 to panelCount - 1. - * @see currentPanel - * @see panels - * @see panelCount - * @see renderMode - */ - get: function () { - if (this.isRenderModeList) - return -1; - if (this.useTemplatePanel) - return 0; - if (this.currentIndexValue < 0 && this.panelCount > 0) { - this.currentIndexValue = 0; - } - if (this.currentIndexValue >= this.panelCount) { - this.currentIndexValue = this.panelCount - 1; - } - return this.currentIndexValue; - }, - set: function (val) { - if (this.currentIndexValue !== val) { - if (val >= this.panelCount) - val = this.panelCount - 1; - this.currentIndexValue = val; - this.fireCallback(this.currentIndexChangedCallback); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "currentPanel", { - /** - * The current active dynamical panel when the renderMode is not "list". If there is no dymamic panel (panelCount = 0) or renderMode equals "list" it returns null. - * @see currenIndex - * @see panels - * @see panelCount - * @see renderMode - */ - get: function () { - var index = this.currentIndex; - if (index < 0 || index >= this.panels.length) - return null; - return this.panels[index]; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "confirmDelete", { - /** - * Set it to true, to show a confirmation dialog on removing a panel - * @see ConfirmDeleteText - */ - get: function () { - return this.getPropertyValue("confirmDelete", false); - }, - set: function (val) { - this.setPropertyValue("confirmDelete", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "keyName", { - /** - * Set it to a question name used in the template panel and the library shows duplication error, if there are same values in different panels of this question. - * @see keyDuplicationError - */ - get: function () { - return this.getPropertyValue("keyName", ""); - }, - set: function (val) { - this.setPropertyValue("keyName", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "confirmDeleteText", { - /** - * Use this property to change the default text showing in the confirmation delete dialog on removing a panel. - */ - get: function () { - return this.getLocalizableStringText("confirmDeleteText", _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("confirmDelete")); - }, - set: function (val) { - this.setLocalizableStringText("confirmDeleteText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "locConfirmDeleteText", { - get: function () { - return this.getLocalizableString("confirmDeleteText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "keyDuplicationError", { - /** - * The duplication value error text. Set it to show the text different from the default. - * @see keyName - */ - get: function () { - return this.getLocalizableStringText("keyDuplicationError", _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("keyDuplicationError")); - }, - set: function (val) { - this.setLocalizableStringText("keyDuplicationError", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "locKeyDuplicationError", { - get: function () { - return this.getLocalizableString("keyDuplicationError"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelPrevText", { - /** - * Use this property to change the default previous button text. Previous button shows the previous panel, change the currentPanel, when the renderMode doesn't equal to "list". - * @see currentPanel - * @see currentIndex - * @see renderMode - */ - get: function () { - return this.getLocalizableStringText("panelPrevText", _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("pagePrevText")); - }, - set: function (val) { - this.setLocalizableStringText("panelPrevText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "locPanelPrevText", { - get: function () { - return this.getLocalizableString("panelPrevText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelNextText", { - /** - * Use this property to change the default next button text. Next button shows the next panel, change the currentPanel, when the renderMode doesn't equal to "list". - * @see currentPanel - * @see currentIndex - * @see renderMode - */ - get: function () { - return this.getLocalizableStringText("panelNextText", _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("pageNextText")); - }, - set: function (val) { - this.setLocalizableStringText("panelNextText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "locPanelNextText", { - get: function () { - return this.getLocalizableString("panelNextText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelAddText", { - /** - * Use this property to change the default value of add panel button text. - */ - get: function () { - return this.getLocalizableStringText("panelAddText", _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("addPanel")); - }, - set: function (value) { - this.setLocalizableStringText("panelAddText", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "locPanelAddText", { - get: function () { - return this.getLocalizableString("panelAddText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelRemoveText", { - /** - * Use this property to change the default value of remove panel button text. - */ - get: function () { - return this.getLocalizableStringText("panelRemoveText", _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("removePanel")); - }, - set: function (val) { - this.setLocalizableStringText("panelRemoveText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "locPanelRemoveText", { - get: function () { - return this.getLocalizableString("panelRemoveText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "isProgressTopShowing", { - /** - * Returns true when the renderMode equals to "progressTop" or "progressTopBottom" - */ - get: function () { - return this.renderMode === "progressTop" || this.renderMode === "progressTopBottom"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "isProgressBottomShowing", { - /** - * Returns true when the renderMode equals to "progressBottom" or "progressTopBottom" - */ - get: function () { - return this.renderMode === "progressBottom" || this.renderMode === "progressTopBottom"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "isPrevButtonShowing", { - /** - * Returns true when currentIndex is more than 0. - * @see currenIndex - * @see currenPanel - */ - get: function () { - return this.currentIndex > 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "isNextButtonShowing", { - /** - * Returns true when currentIndex is more than or equal 0 and less than panelCount - 1. - * @see currenIndex - * @see currenPanel - * @see panelCount - */ - get: function () { - return this.currentIndex >= 0 && this.currentIndex < this.panelCount - 1; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "isRangeShowing", { - /** - * Returns true when showRangeInProgress equals to true, renderMode doesn't equal to "list" and panelCount is >= 2. - */ - get: function () { - return (this.showRangeInProgress && this.currentIndex >= 0 && this.panelCount > 1); - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicModel.prototype.getElementsInDesign = function (includeHidden) { - if (includeHidden === void 0) { includeHidden = false; } - return includeHidden ? [this.template] : this.templateElements; - }; - QuestionPanelDynamicModel.prototype.prepareValueForPanelCreating = function () { - this.addingNewPanelsValue = this.value; - this.isAddingNewPanels = true; - this.isNewPanelsValueChanged = false; - }; - QuestionPanelDynamicModel.prototype.setValueAfterPanelsCreating = function () { - this.isAddingNewPanels = false; - if (this.isNewPanelsValueChanged) { - this.isValueChangingInternally = true; - this.value = this.addingNewPanelsValue; - this.isValueChangingInternally = false; - } - }; - QuestionPanelDynamicModel.prototype.getValueCore = function () { - return this.isAddingNewPanels - ? this.addingNewPanelsValue - : _super.prototype.getValueCore.call(this); - }; - QuestionPanelDynamicModel.prototype.setValueCore = function (newValue) { - if (this.isAddingNewPanels) { - this.isNewPanelsValueChanged = true; - this.addingNewPanelsValue = newValue; - } - else { - _super.prototype.setValueCore.call(this, newValue); - } - }; - Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelCount", { - /** - * Use this property to get/set the number of dynamic panels. - * @see template - * @see minPanelCount - * @see maxPanelCount - * @see addPanel - * @see removePanel - * @see removePanelUI - */ - get: function () { - return this.isLoadingFromJson || this.useTemplatePanel - ? this.loadingPanelCount - : this.panels.length; - }, - set: function (val) { - if (val < 0) - return; - if (this.isLoadingFromJson || this.useTemplatePanel) { - this.loadingPanelCount = val; - return; - } - if (val == this.panels.length || this.useTemplatePanel) - return; - this.updateBindings("panelCount", val); - this.prepareValueForPanelCreating(); - for (var i = this.panelCount; i < val; i++) { - var panel = this.createNewPanel(); - this.panels.push(panel); - if (this.renderMode == "list" && this.panelsState != "default") { - if (this.panelsState === "expand") { - panel.expand(); - } - else { - if (!!panel.title) { - panel.collapse(); - } - } - } - } - if (val < this.panelCount) - this.panels.splice(val, this.panelCount - val); - this.setValueAfterPanelsCreating(); - this.setValueBasedOnPanelCount(); - this.reRunCondition(); - this.fireCallback(this.panelCountChangedCallback); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelsState", { - /** - * Use this property to allow the end-user to collapse/expand the panels. It works only if the renderMode property equals to "list" and templateTitle property is not empty. The following values are available: - *
default - the default value. User can't collapse/expand panels - *
expanded - User can collapse/expand panels and all panels are expanded by default - *
collapsed - User can collapse/expand panels and all panels are collapsed by default - *
firstExpanded - User can collapse/expand panels. The first panel is expanded and others are collapsed - * @see renderMode - * @see templateTitle - */ - get: function () { - return this.getPropertyValue("panelsState"); - }, - set: function (val) { - this.setPropertyValue("panelsState", val); - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicModel.prototype.setTemplatePanelSurveyImpl = function () { - this.template.setSurveyImpl(this.useTemplatePanel - ? this.surveyImpl - : new QuestionPanelDynamicTemplateSurveyImpl(this)); - }; - QuestionPanelDynamicModel.prototype.setPanelsSurveyImpl = function () { - for (var i = 0; i < this.panels.length; i++) { - var panel = this.panels[i]; - if (panel == this.template) - continue; - panel.setSurveyImpl(panel.data); - } - }; - QuestionPanelDynamicModel.prototype.setPanelsState = function () { - if (this.useTemplatePanel || this.renderMode != "list" || !this.templateTitle) - return; - for (var i = 0; i < this.panels.length; i++) { - var state = this.panelsState; - if (state === "firstExpanded") { - state = i === 0 ? "expanded" : "collapsed"; - } - this.panels[i].state = state; - } - }; - QuestionPanelDynamicModel.prototype.setValueBasedOnPanelCount = function () { - var value = this.value; - if (!value || !Array.isArray(value)) - value = []; - if (value.length == this.panelCount) - return; - for (var i = value.length; i < this.panelCount; i++) - value.push({}); - if (value.length > this.panelCount) { - value.splice(this.panelCount, value.length - this.panelCount); - } - this.isValueChangingInternally = true; - this.value = value; - this.isValueChangingInternally = false; - }; - Object.defineProperty(QuestionPanelDynamicModel.prototype, "minPanelCount", { - /** - * The minimum panel count. A user could not delete a panel if the panelCount equals to minPanelCount - * @see panelCount - * @see maxPanelCount - */ - get: function () { - return this.getPropertyValue("minPanelCount"); - }, - set: function (val) { - if (val < 0) - val = 0; - if (val == this.minPanelCount) - return; - this.setPropertyValue("minPanelCount", val); - if (val > this.maxPanelCount) - this.maxPanelCount = val; - if (this.panelCount < val) - this.panelCount = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "maxPanelCount", { - /** - * The maximum panel count. A user could not add a panel if the panelCount equals to maxPanelCount - * @see panelCount - * @see minPanelCount - */ - get: function () { - return this.getPropertyValue("maxPanelCount"); - }, - set: function (val) { - if (val <= 0) - return; - if (val > _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].panelMaximumPanelCount) - val = _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].panelMaximumPanelCount; - if (val == this.maxPanelCount) - return; - this.setPropertyValue("maxPanelCount", val); - if (val < this.minPanelCount) - this.minPanelCount = val; - if (this.panelCount > val) - this.panelCount = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "allowAddPanel", { - /** - * Set this property to false to hide the 'Add New' button - * @see allowRemovePanel - */ - get: function () { - return this.getPropertyValue("allowAddPanel"); - }, - set: function (val) { - this.setPropertyValue("allowAddPanel", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "allowRemovePanel", { - /** - * Set this property to false to hide the 'Remove' button - * @see allowAddPanel - */ - get: function () { - return this.getPropertyValue("allowRemovePanel"); - }, - set: function (val) { - this.setPropertyValue("allowRemovePanel", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "templateTitleLocation", { - /** - * Set this property different from "default" to set the specific question title location for the template questions. - * @see SurveyModel.questionTitleLocation - * @see PanelModelBase.questionTitleLocation - */ - get: function () { - return this.getPropertyValue("templateTitleLocation"); - }, - set: function (value) { - this.setPropertyValue("templateTitleLocation", value.toLowerCase()); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "showQuestionNumbers", { - /** - * Use this property to show/hide the numbers in titles in questions inside a dynamic panel. - * By default the value is "off". You may set it to "onPanel" and the first question inside a dynamic panel will start with 1 or "onSurvey" to include nested questions in dymamic panels into global survey question numbering. - */ - get: function () { - return this.getPropertyValue("showQuestionNumbers"); - }, - set: function (val) { - this.setPropertyValue("showQuestionNumbers", val); - if (!this.isLoadingFromJson && this.survey) { - this.survey.questionVisibilityChanged(this, this.visible); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelRemoveButtonLocation", { - /** - * Use this property to change the location of the remove button relative to the panel. - * By default the value is "bottom". You may set it to "right" and remove button will appear to the right of the panel. - */ - get: function () { - return this.getPropertyValue("panelRemoveButtonLocation"); - }, - set: function (val) { - this.setPropertyValue("panelRemoveButtonLocation", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "showRangeInProgress", { - /** - * Shows the range from 1 to panelCount when renderMode doesn't equal to "list". Set to false to hide this element. - * @see panelCount - * @see renderMode - */ - get: function () { - return this.getPropertyValue("showRangeInProgress"); - }, - set: function (val) { - this.setPropertyValue("showRangeInProgress", val); - this.fireCallback(this.currentIndexChangedCallback); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "renderMode", { - /** - * By default the property equals to "list" and all dynamic panels are rendered one by one on the page. You may change it to: "progressTop", "progressBottom" or "progressTopBottom" to render only one dynamic panel at once. The progress and navigation elements can be rendred on top, bottom or both. - */ - get: function () { - return this.getPropertyValue("renderMode"); - }, - set: function (val) { - this.setPropertyValue("renderMode", val); - this.fireCallback(this.renderModeChangedCallback); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "isRenderModeList", { - /** - * Returns true when renderMode equals to "list". - * @see renderMode - */ - get: function () { - return this.renderMode === "list"; - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicModel.prototype.setVisibleIndex = function (value) { - if (!this.isVisible) - return 0; - var startIndex = this.showQuestionNumbers == "onSurvey" ? value : 0; - for (var i = 0; i < this.panels.length; i++) { - var counter = this.setPanelVisibleIndex(this.panels[i], startIndex, this.showQuestionNumbers != "off"); - if (this.showQuestionNumbers == "onSurvey") { - startIndex += counter; - } - } - _super.prototype.setVisibleIndex.call(this, this.showQuestionNumbers != "onSurvey" ? value : -1); - return this.showQuestionNumbers != "onSurvey" ? 1 : startIndex - value; - }; - QuestionPanelDynamicModel.prototype.setPanelVisibleIndex = function (panel, index, showIndex) { - if (!showIndex) { - panel.setVisibleIndex(-1); - return 0; - } - return panel.setVisibleIndex(index); - }; - Object.defineProperty(QuestionPanelDynamicModel.prototype, "canAddPanel", { - /** - * Returns true when an end user may add a new panel. The question is not read only and panelCount less than maxPanelCount - * @see isReadOnly - * @see panelCount - * @see maxPanelCount - */ - get: function () { - if (this.isDesignMode) - return false; - return (this.allowAddPanel && - !this.isReadOnly && - this.panelCount < this.maxPanelCount); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "canRemovePanel", { - /** - * Returns true when an end user may remove a panel. The question is not read only and panelCount is more than minPanelCount - * @see isReadOnly - * @see panelCount - * @see minPanelCount - */ - get: function () { - if (this.isDesignMode) - return false; - return (this.allowRemovePanel && - !this.isReadOnly && - this.panelCount > this.minPanelCount); - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicModel.prototype.rebuildPanels = function () { - var _a; - if (this.isLoadingFromJson) - return; - this.prepareValueForPanelCreating(); - var panels = []; - if (this.useTemplatePanel) { - new QuestionPanelDynamicItem(this, this.template); - panels.push(this.template); - } - else { - for (var i = 0; i < this.panelCount; i++) { - panels.push(this.createNewPanel()); - } - } - (_a = this.panels).splice.apply(_a, __spreadArray([0, this.panels.length], panels, false)); - this.setValueAfterPanelsCreating(); - this.setPanelsState(); - this.reRunCondition(); - this.fireCallback(this.panelCountChangedCallback); - }; - Object.defineProperty(QuestionPanelDynamicModel.prototype, "defaultPanelValue", { - /** - * If it is not empty, then this value is set to every new panel, including panels created initially, unless the defaultValue is not empty - * @see defaultValue - * @see defaultValueFromLastRow - */ - get: function () { - return this.getPropertyValue("defaultPanelValue"); - }, - set: function (val) { - this.setPropertyValue("defaultPanelValue", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionPanelDynamicModel.prototype, "defaultValueFromLastPanel", { - /** - * Set it to true to copy the value into new added panel from the last panel. If defaultPanelValue is set and this property equals to true, - * then the value for new added panel is merging. - * @see defaultValue - * @see defaultPanelValue - */ - get: function () { - return this.getPropertyValue("defaultValueFromLastPanel", false); - }, - set: function (val) { - this.setPropertyValue("defaultValueFromLastPanel", val); - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicModel.prototype.isDefaultValueEmpty = function () { - return (_super.prototype.isDefaultValueEmpty.call(this) && this.isValueEmpty(this.defaultPanelValue)); - }; - QuestionPanelDynamicModel.prototype.setDefaultValue = function () { - if (this.isValueEmpty(this.defaultPanelValue) || - !this.isValueEmpty(this.defaultValue)) { - _super.prototype.setDefaultValue.call(this); - return; - } - if (!this.isEmpty() || this.panelCount == 0) - return; - var newValue = []; - for (var i = 0; i < this.panelCount; i++) { - newValue.push(this.defaultPanelValue); - } - this.value = newValue; - }; - QuestionPanelDynamicModel.prototype.isEmpty = function () { - var val = this.value; - if (!val || !Array.isArray(val)) - return true; - for (var i = 0; i < val.length; i++) { - if (!this.isRowEmpty(val[i])) - return false; - } - return true; - }; - QuestionPanelDynamicModel.prototype.getProgressInfo = function () { - return _survey_element__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].getProgressInfoByElements(this.panels, this.isRequired); - }; - QuestionPanelDynamicModel.prototype.isRowEmpty = function (val) { - for (var prop in val) { - if (val.hasOwnProperty(prop)) - return false; - } - return true; - }; - /** - * Add a new dynamic panel based on the template Panel. It checks if canAddPanel returns true and then calls addPanel method. - * @see template - * @see panelCount - * @see panels - * @see canAddPanel - */ - QuestionPanelDynamicModel.prototype.addPanelUI = function () { - if (!this.canAddPanel) - return null; - var newPanel = this.addPanel(); - if (this.renderMode === "list" && this.panelsState !== "default") { - newPanel.expand(); - } - return newPanel; - }; - /** - * Add a new dynamic panel based on the template Panel. - * @see template - * @see panelCount - * @see panels - */ - QuestionPanelDynamicModel.prototype.addPanel = function () { - this.panelCount++; - if (!this.isRenderModeList) { - this.currentIndex = this.panelCount - 1; - } - var newValue = this.value; - var hasModified = false; - if (!this.isValueEmpty(this.defaultPanelValue)) { - if (!!newValue && - Array.isArray(newValue) && - newValue.length == this.panelCount) { - hasModified = true; - this.copyValue(newValue[newValue.length - 1], this.defaultPanelValue); - } - } - if (this.defaultValueFromLastPanel && - !!newValue && - Array.isArray(newValue) && - newValue.length > 1 && - newValue.length == this.panelCount) { - hasModified = true; - this.copyValue(newValue[newValue.length - 1], newValue[newValue.length - 2]); - } - if (hasModified) { - this.value = newValue; - } - if (this.survey) - this.survey.dynamicPanelAdded(this); - return this.panels[this.panelCount - 1]; - }; - QuestionPanelDynamicModel.prototype.copyValue = function (src, dest) { - for (var key in dest) { - src[key] = dest[key]; - } - }; - /** - * Call removePanel function. Do nothing is canRemovePanel returns false. If confirmDelete set to true, it shows the confirmation dialog first. - * @param value a panel or panel index - * @see removePanel - * @see confirmDelete - * @see confirmDeleteText - * @see canRemovePanel - * - */ - QuestionPanelDynamicModel.prototype.removePanelUI = function (value) { - if (!this.canRemovePanel) - return; - if (!this.confirmDelete || Object(_utils_utils__WEBPACK_IMPORTED_MODULE_9__["confirmAction"])(this.confirmDeleteText)) { - this.removePanel(value); - } - }; - /** - * Goes to the next panel in the PanelDynamic - * - */ - QuestionPanelDynamicModel.prototype.goToNextPanel = function () { - if (this.renderMode !== "list" && this.currentPanel.hasErrors()) - return; - this.currentIndex++; - }; - /** - * Goes to the previous panel in the PanelDynamic - * - */ - QuestionPanelDynamicModel.prototype.goToPrevPanel = function () { - this.currentIndex--; - }; - /** - * Removes a dynamic panel from the panels array. - * @param value a panel or panel index - * @see panels - * @see template - */ - QuestionPanelDynamicModel.prototype.removePanel = function (value) { - var index = this.getPanelIndex(value); - if (index < 0 || index >= this.panelCount) - return; - var panel = this.panels[index]; - this.panels.splice(index, 1); - this.updateBindings("panelCount", this.panelCount); - var value = this.value; - if (!value || !Array.isArray(value) || index >= value.length) - return; - this.isValueChangingInternally = true; - value.splice(index, 1); - this.value = value; - this.fireCallback(this.panelCountChangedCallback); - if (this.survey) - this.survey.dynamicPanelRemoved(this, index, panel); - this.isValueChangingInternally = false; - }; - QuestionPanelDynamicModel.prototype.getPanelIndex = function (val) { - if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(val)) - return val; - var items = this.items; - for (var i = 0; i < this.panels.length; i++) { - if (this.panels[i] === val || items[i] === val) - return i; - } - return -1; - }; - QuestionPanelDynamicModel.prototype.locStrsChanged = function () { - _super.prototype.locStrsChanged.call(this); - var panels = this.panels; - for (var i = 0; i < panels.length; i++) { - panels[i].locStrsChanged(); - } - }; - QuestionPanelDynamicModel.prototype.clearIncorrectValues = function () { - for (var i = 0; i < this.panels.length; i++) { - this.clearIncorrectValuesInPanel(i); - } - }; - QuestionPanelDynamicModel.prototype.clearErrors = function () { - _super.prototype.clearErrors.call(this); - for (var i = 0; i < this.panels.length; i++) { - this.panels[i].clearErrors(); - } - }; - QuestionPanelDynamicModel.prototype.getQuestionFromArray = function (name, index) { - if (index >= this.panelCount) - return null; - return this.panels[index].getQuestionByName(name); - }; - QuestionPanelDynamicModel.prototype.clearIncorrectValuesInPanel = function (index) { - var panel = this.panels[index]; - panel.clearIncorrectValues(); - var val = this.value; - var values = !!val && index < val.length ? val[index] : null; - if (!values) - return; - var isChanged = false; - for (var key in values) { - if (this.getSharedQuestionFromArray(key, index)) - continue; - var q = panel.getQuestionByName(key); - if (!!q) - continue; - if (this.iscorrectValueWithPostPrefix(panel, key, _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].commentPrefix) || - this.iscorrectValueWithPostPrefix(panel, key, _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].matrixTotalValuePostFix)) - continue; - delete values[key]; - isChanged = true; - } - if (isChanged) { - val[index] = values; - this.value = val; - } - }; - QuestionPanelDynamicModel.prototype.iscorrectValueWithPostPrefix = function (panel, key, postPrefix) { - if (key.indexOf(postPrefix) !== key.length - postPrefix.length) - return false; - return !!panel.getQuestionByName(key.substr(0, key.indexOf(postPrefix))); - }; - QuestionPanelDynamicModel.prototype.getSharedQuestionFromArray = function (name, panelIndex) { - return !!this.survey && !!this.valueName - ? (this.survey.getQuestionByValueNameFromArray(this.valueName, name, panelIndex)) - : null; - }; - QuestionPanelDynamicModel.prototype.addConditionObjectsByContext = function (objects, context) { - var hasContext = !!context - ? this.template.questions.indexOf(context) > -1 - : false; - var prefixName = this.getValueName() + "[0]."; - var prefixText = this.processedTitle + "[0]."; - var panelObjs = new Array(); - var questions = this.template.questions; - for (var i = 0; i < questions.length; i++) { - questions[i].addConditionObjectsByContext(panelObjs, context); - } - for (var i = 0; i < panelObjs.length; i++) { - objects.push({ - name: prefixName + panelObjs[i].name, - text: prefixText + panelObjs[i].text, - question: panelObjs[i].question, - }); - } - if (hasContext) { - for (var i = 0; i < panelObjs.length; i++) { - if (panelObjs[i].question == context) - continue; - objects.push({ - name: "panel." + panelObjs[i].name, - text: "panel." + panelObjs[i].text, - question: panelObjs[i].question, - }); - } - } - }; - QuestionPanelDynamicModel.prototype.getConditionJson = function (operator, path) { - if (operator === void 0) { operator = null; } - if (path === void 0) { path = null; } - if (!path) - return _super.prototype.getConditionJson.call(this, operator, path); - var questionName = path; - var pos = path.indexOf("."); - if (pos > -1) { - questionName = path.substr(0, pos); - path = path.substr(pos + 1); - } - var question = this.template.getQuestionByName(questionName); - if (!question) - return null; - return question.getConditionJson(operator, path); - }; - QuestionPanelDynamicModel.prototype.onReadOnlyChanged = function () { - var readOnly = this.isReadOnly; - this.template.readOnly = readOnly; - for (var i = 0; i < this.panels.length; i++) { - this.panels[i].readOnly = readOnly; - } - _super.prototype.onReadOnlyChanged.call(this); - }; - QuestionPanelDynamicModel.prototype.onSurveyLoad = function () { - this.template.readOnly = this.isReadOnly; - this.template.onSurveyLoad(); - if (this.loadingPanelCount > 0) { - this.panelCount = this.loadingPanelCount; - } - if (this.useTemplatePanel) { - this.rebuildPanels(); - } - this.setPanelsSurveyImpl(); - this.setPanelsState(); - this.assignOnPropertyChangedToTemplate(); - _super.prototype.onSurveyLoad.call(this); - }; - QuestionPanelDynamicModel.prototype.onFirstRendering = function () { - this.template.onFirstRendering(); - for (var i = 0; i < this.panels.length; i++) { - this.panels[i].onFirstRendering(); - } - _super.prototype.onFirstRendering.call(this); - }; - QuestionPanelDynamicModel.prototype.runCondition = function (values, properties) { - _super.prototype.runCondition.call(this, values, properties); - this.runPanelsCondition(values, properties); - }; - QuestionPanelDynamicModel.prototype.reRunCondition = function () { - if (!this.data) - return; - this.runCondition(this.getDataFilteredValues(), this.getDataFilteredProperties()); - }; - QuestionPanelDynamicModel.prototype.runPanelsCondition = function (values, properties) { - var cachedValues = {}; - if (values && values instanceof Object) { - cachedValues = JSON.parse(JSON.stringify(values)); - } - if (!!this.parentQuestion && !!this.parent) { - cachedValues[QuestionPanelDynamicItem.ParentItemVariableName] = this.parent.getValue(); - } - for (var i = 0; i < this.panels.length; i++) { - var panelValues = this.getPanelItemData(this.panels[i].data); - //Should be unique for every panel due async expression support - var newValues = _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].createCopy(cachedValues); - newValues[QuestionPanelDynamicItem.ItemVariableName.toLowerCase()] = panelValues; - newValues[QuestionPanelDynamicItem.IndexVariableName.toLowerCase()] = i; - this.panels[i].runCondition(newValues, properties); - } - }; - QuestionPanelDynamicModel.prototype.onAnyValueChanged = function (name) { - _super.prototype.onAnyValueChanged.call(this, name); - for (var i = 0; i < this.panels.length; i++) { - this.panels[i].onAnyValueChanged(name); - this.panels[i].onAnyValueChanged(QuestionPanelDynamicItem.ItemVariableName); - } - }; - QuestionPanelDynamicModel.prototype.hasKeysDuplicated = function (fireCallback, rec) { - if (rec === void 0) { rec = null; } - var keyValues = []; - var res; - for (var i = 0; i < this.panels.length; i++) { - res = - this.isValueDuplicated(this.panels[i], keyValues, rec, fireCallback) || - res; - } - return res; - }; - QuestionPanelDynamicModel.prototype.updatePanelsContainsErrors = function () { - var question = this.changingValueQuestion; - var parent = question.parent; - while (!!parent) { - parent.updateContainsErrors(); - parent = parent.parent; - } - this.updateContainsErrors(); - }; - QuestionPanelDynamicModel.prototype.hasErrors = function (fireCallback, rec) { - if (fireCallback === void 0) { fireCallback = true; } - if (rec === void 0) { rec = null; } - if (this.isValueChangingInternally) - return false; - var res = false; - if (!!this.changingValueQuestion) { - var res = this.changingValueQuestion.hasErrors(fireCallback, rec); - res = this.hasKeysDuplicated(fireCallback, rec) || res; - this.updatePanelsContainsErrors(); - return res; - } - else { - var errosInPanels = this.hasErrorInPanels(fireCallback, rec); - return _super.prototype.hasErrors.call(this, fireCallback) || errosInPanels; - } - }; - QuestionPanelDynamicModel.prototype.getContainsErrors = function () { - var res = _super.prototype.getContainsErrors.call(this); - if (res) - return res; - var panels = this.panels; - for (var i = 0; i < panels.length; i++) { - if (panels[i].containsErrors) - return true; - } - return false; - }; - QuestionPanelDynamicModel.prototype.getIsAnswered = function () { - if (!_super.prototype.getIsAnswered.call(this)) - return false; - var panels = this.panels; - for (var i = 0; i < panels.length; i++) { - var visibleQuestions = []; - panels[i].addQuestionsToList(visibleQuestions, true); - for (var j = 0; j < visibleQuestions.length; j++) { - if (!visibleQuestions[j].isAnswered) - return false; - } - } - return true; - }; - QuestionPanelDynamicModel.prototype.clearValueIfInvisible = function () { - for (var i = 0; i < this.panels.length; i++) { - var questions = this.panels[i].questions; - for (var j = 0; j < questions.length; j++) { - questions[j].clearValueIfInvisible(); - } - } - _super.prototype.clearValueIfInvisible.call(this); - }; - QuestionPanelDynamicModel.prototype.getIsRunningValidators = function () { - if (_super.prototype.getIsRunningValidators.call(this)) - return true; - for (var i = 0; i < this.panels.length; i++) { - var questions = this.panels[i].questions; - for (var j = 0; j < questions.length; j++) { - if (questions[j].isRunningValidators) - return true; - } - } - return false; - }; - QuestionPanelDynamicModel.prototype.getAllErrors = function () { - var result = _super.prototype.getAllErrors.call(this); - for (var i = 0; i < this.panels.length; i++) { - var questions = this.panels[i].questions; - for (var j = 0; j < questions.length; j++) { - var errors = questions[j].getAllErrors(); - if (errors && errors.length > 0) { - result = result.concat(errors); - } - } - } - return result; - }; - QuestionPanelDynamicModel.prototype.getDisplayValueCore = function (keysAsText, value) { - var values = this.getUnbindValue(value); - if (!values || !Array.isArray(values)) - return values; - for (var i = 0; i < this.panels.length && i < values.length; i++) { - var val = values[i]; - if (!val) - continue; - values[i] = this.getPanelDisplayValue(i, val, keysAsText); - } - return values; - }; - QuestionPanelDynamicModel.prototype.getPanelDisplayValue = function (panelIndex, val, keysAsText) { - if (!val) - return val; - var panel = this.panels[panelIndex]; - var keys = Object.keys(val); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var question = panel.getQuestionByValueName(key); - if (!question) { - question = this.getSharedQuestionFromArray(key, panelIndex); - } - if (!!question) { - var qValue = question.getDisplayValue(keysAsText, val[key]); - val[key] = qValue; - if (keysAsText && !!question.title && question.title !== key) { - val[question.title] = qValue; - delete val[key]; - } - } - } - return val; - }; - QuestionPanelDynamicModel.prototype.hasErrorInPanels = function (fireCallback, rec) { - var res = false; - var panels = this.panels; - var keyValues = []; - for (var i = 0; i < panels.length; i++) { - this.setOnCompleteAsyncInPanel(panels[i]); - } - for (var i = 0; i < panels.length; i++) { - var pnlError = panels[i].hasErrors(fireCallback, !!rec && rec.focuseOnFirstError, rec); - pnlError = this.isValueDuplicated(panels[i], keyValues, rec) || pnlError; - if (!this.isRenderModeList && pnlError && !res) { - this.currentIndex = i; - } - res = pnlError || res; - } - return res; - }; - QuestionPanelDynamicModel.prototype.setOnCompleteAsyncInPanel = function (panel) { - var _this = this; - var questions = panel.questions; - for (var i = 0; i < questions.length; i++) { - questions[i].onCompletedAsyncValidators = function (hasErrors) { - _this.raiseOnCompletedAsyncValidators(); - }; - } - }; - QuestionPanelDynamicModel.prototype.isValueDuplicated = function (panel, keyValues, rec, fireCallback) { - if (!this.keyName) - return false; - var question = panel.getQuestionByValueName(this.keyName); - if (!question || question.isEmpty()) - return false; - var value = question.value; - if (!!this.changingValueQuestion && - question != this.changingValueQuestion) { - question.hasErrors(fireCallback, rec); - } - for (var i = 0; i < keyValues.length; i++) { - if (value == keyValues[i]) { - question.addError(new _error__WEBPACK_IMPORTED_MODULE_7__["KeyDuplicationError"](this.keyDuplicationError, this)); - if (!!rec && !rec.firstErrorQuestion) { - rec.firstErrorQuestion = question; - } - return true; - } - } - keyValues.push(value); - return false; - }; - QuestionPanelDynamicModel.prototype.createNewPanel = function () { - var panel = this.createAndSetupNewPanelObject(); - var json = this.template.toJSON(); - new _jsonobject__WEBPACK_IMPORTED_MODULE_5__["JsonObject"]().toObject(json, panel); - panel.renderWidth = "100%"; - panel.updateCustomWidgets(); - new QuestionPanelDynamicItem(this, panel); - panel.onFirstRendering(); - var questions = panel.questions; - for (var i = 0; i < questions.length; i++) { - questions[i].setParentQuestion(this); - } - panel.locStrsChanged(); - return panel; - }; - QuestionPanelDynamicModel.prototype.createAndSetupNewPanelObject = function () { - var panel = this.createNewPanelObject(); - panel.isInteractiveDesignElement = false; - var self = this; - panel.onGetQuestionTitleLocation = function () { - return self.getTemplateQuestionTitleLocation(); - }; - return panel; - }; - QuestionPanelDynamicModel.prototype.getTemplateQuestionTitleLocation = function () { - return this.templateTitleLocation != "default" - ? this.templateTitleLocation - : this.getTitleLocationCore(); - }; - QuestionPanelDynamicModel.prototype.createNewPanelObject = function () { - return _jsonobject__WEBPACK_IMPORTED_MODULE_5__["Serializer"].createClass("panel"); - }; - QuestionPanelDynamicModel.prototype.setPanelCountBasedOnValue = function () { - if (this.isValueChangingInternally || this.useTemplatePanel) - return; - var val = this.value; - var newPanelCount = val && Array.isArray(val) ? val.length : 0; - if (newPanelCount == 0 && this.loadingPanelCount > 0) { - newPanelCount = this.loadingPanelCount; - } - this.panelCount = newPanelCount; - }; - QuestionPanelDynamicModel.prototype.setQuestionValue = function (newValue) { - _super.prototype.setQuestionValue.call(this, newValue, false); - this.setPanelCountBasedOnValue(); - for (var i = 0; i < this.panels.length; i++) { - this.panelUpdateValueFromSurvey(this.panels[i]); - } - this.updateIsAnswered(); - }; - QuestionPanelDynamicModel.prototype.onSurveyValueChanged = function (newValue) { - _super.prototype.onSurveyValueChanged.call(this, newValue); - for (var i = 0; i < this.panels.length; i++) { - this.panelSurveyValueChanged(this.panels[i]); - } - if (newValue === undefined) { - this.setValueBasedOnPanelCount(); - } - }; - QuestionPanelDynamicModel.prototype.panelUpdateValueFromSurvey = function (panel) { - var questions = panel.questions; - var values = this.getPanelItemData(panel.data); - for (var i = 0; i < questions.length; i++) { - var q = questions[i]; - q.updateValueFromSurvey(values[q.getValueName()]); - q.updateCommentFromSurvey(values[q.getValueName() + _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].commentPrefix]); - } - }; - QuestionPanelDynamicModel.prototype.panelSurveyValueChanged = function (panel) { - var questions = panel.questions; - var values = this.getPanelItemData(panel.data); - for (var i = 0; i < questions.length; i++) { - var q = questions[i]; - q.onSurveyValueChanged(values[q.getValueName()]); - } - }; - QuestionPanelDynamicModel.prototype.onSetData = function () { - _super.prototype.onSetData.call(this); - if (this.useTemplatePanel) { - this.setTemplatePanelSurveyImpl(); - this.rebuildPanels(); - } - }; - //IQuestionPanelDynamicData - QuestionPanelDynamicModel.prototype.getItemIndex = function (item) { - var res = this.items.indexOf(item); - return res > -1 ? res : this.items.length; - }; - QuestionPanelDynamicModel.prototype.getPanelItemData = function (item) { - var items = this.items; - var index = items.indexOf(item); - var qValue = this.value; - if (index < 0 && Array.isArray(qValue) && qValue.length > items.length) { - index = items.length; - } - if (index < 0) - return {}; - if (!qValue || !Array.isArray(qValue) || qValue.length <= index) - return {}; - return qValue[index]; - }; - QuestionPanelDynamicModel.prototype.setPanelItemData = function (item, name, val) { - if (this.isSetPanelItemData && this.isSetPanelItemData.indexOf(name) > -1) - return; - if (!this.isSetPanelItemData) - this.isSetPanelItemData = []; - this.isSetPanelItemData.push(name); - var items = this.items; - var index = items.indexOf(item); - if (index < 0) - index = items.length; - var qValue = this.getUnbindValue(this.value); - if (!qValue || !Array.isArray(qValue)) { - qValue = []; - } - if (qValue.length <= index) { - for (var i = qValue.length; i <= index; i++) { - qValue.push({}); - } - } - if (!qValue[index]) - qValue[index] = {}; - if (!this.isValueEmpty(val)) { - qValue[index][name] = val; - } - else { - delete qValue[index][name]; - } - if (index >= 0 && index < this.panels.length) { - this.changingValueQuestion = this.panels[index].getQuestionByValueName(name); - } - this.value = qValue; - this.changingValueQuestion = null; - if (this.survey) { - var options = { - question: this, - panel: item.panel, - name: name, - itemIndex: index, - itemValue: qValue[index], - value: val, - }; - this.survey.dynamicPanelItemValueChanged(this, options); - } - var index = this.isSetPanelItemData.indexOf(name); - if (index > -1) { - this.isSetPanelItemData.splice(index, 1); - } - }; - QuestionPanelDynamicModel.prototype.getRootData = function () { - return this.data; - }; - QuestionPanelDynamicModel.prototype.getPlainData = function (options) { - if (options === void 0) { options = { - includeEmpty: true, - }; } - var questionPlainData = _super.prototype.getPlainData.call(this, options); - if (!!questionPlainData) { - questionPlainData.isNode = true; - questionPlainData.data = this.panels.map(function (panel, index) { - var panelDataItem = { - name: panel.name || index, - title: panel.title || "Panel", - value: panel.getValue(), - displayValue: panel.getValue(), - getString: function (val) { - return typeof val === "object" ? JSON.stringify(val) : val; - }, - isNode: true, - data: panel.questions - .map(function (question) { return question.getPlainData(options); }) - .filter(function (d) { return !!d; }), - }; - (options.calculations || []).forEach(function (calculation) { - panelDataItem[calculation.propertyName] = panel[calculation.propertyName]; - }); - return panelDataItem; - }); - } - return questionPlainData; - }; - QuestionPanelDynamicModel.prototype.updateElementCss = function (reNew) { - _super.prototype.updateElementCss.call(this, reNew); - for (var i = 0; i < this.panels.length; i++) { - var el = this.panels[i]; - el.updateElementCss(reNew); - } - }; - Object.defineProperty(QuestionPanelDynamicModel.prototype, "progressText", { - get: function () { - var rangeMax = this.panelCount; - return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] - .getString("panelDynamicProgressText")["format"](this.currentIndex + 1, rangeMax); - }, - enumerable: false, - configurable: true - }); - QuestionPanelDynamicModel.prototype.getPanelWrapperCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() - .append(this.cssClasses.panelWrapper) - .append(this.cssClasses.panelWrapperInRow, this.panelRemoveButtonLocation === "right") - .toString(); - }; - QuestionPanelDynamicModel.prototype.getPanelRemoveButtonCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() - .append(this.cssClasses.button) - .append(this.cssClasses.buttonRemove) - .append(this.cssClasses.buttonRemoveRight, this.panelRemoveButtonLocation === "right") - .toString(); - }; - QuestionPanelDynamicModel.prototype.getAddButtonCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() - .append(this.cssClasses.button) - .append(this.cssClasses.buttonAdd) - .append(this.cssClasses.buttonAdd + "--list-mode", this.renderMode === "list") - .toString(); - }; - QuestionPanelDynamicModel.prototype.getPrevButtonCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() - .append(this.cssClasses.buttonPrev) - .append(this.cssClasses.buttonPrev + "--disabled", !this.isPrevButtonShowing) - .toString(); - }; - QuestionPanelDynamicModel.prototype.getNextButtonCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() - .append(this.cssClasses.buttonNext) - .append(this.cssClasses.buttonNext + "--disabled", !this.isNextButtonShowing) - .toString(); - }; - return QuestionPanelDynamicModel; - }(_question__WEBPACK_IMPORTED_MODULE_4__["Question"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_5__["Serializer"].addClass("paneldynamic", [ - { - name: "templateElements", - alternativeName: "questions", - visible: false, - isLightSerializable: false, - }, - { name: "templateTitle:text", serializationProperty: "locTemplateTitle" }, - { - name: "templateDescription:text", - serializationProperty: "locTemplateDescription", - }, - { name: "allowAddPanel:boolean", default: true }, - { name: "allowRemovePanel:boolean", default: true }, - { - name: "panelCount:number", - isBindable: true, - default: 0, - choices: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], - }, - { name: "minPanelCount:number", default: 0, minValue: 0 }, - { - name: "maxPanelCount:number", - default: _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].panelMaximumPanelCount, - }, - "defaultPanelValue:panelvalue", - "defaultValueFromLastPanel:boolean", - { - name: "panelsState", - default: "default", - choices: ["default", "collapsed", "expanded", "firstExpanded"], - }, - { name: "keyName" }, - { - name: "keyDuplicationError", - serializationProperty: "locKeyDuplicationError", - }, - { name: "confirmDelete:boolean" }, - { - name: "confirmDeleteText", - serializationProperty: "locConfirmDeleteText", - }, - { name: "panelAddText", serializationProperty: "locPanelAddText" }, - { name: "panelRemoveText", serializationProperty: "locPanelRemoveText" }, - { name: "panelPrevText", serializationProperty: "locPanelPrevText" }, - { name: "panelNextText", serializationProperty: "locPanelNextText" }, - { - name: "showQuestionNumbers", - default: "off", - choices: ["off", "onPanel", "onSurvey"], - }, - { name: "showRangeInProgress:boolean", default: true }, - { - name: "renderMode", - default: "list", - choices: ["list", "progressTop", "progressBottom", "progressTopBottom"], - }, - { - name: "templateTitleLocation", - default: "default", - choices: ["default", "top", "bottom", "left"], - }, - { - name: "panelRemoveButtonLocation", - default: "bottom", - choices: ["bottom", "right"], - }, - ], function () { - return new QuestionPanelDynamicModel(""); - }, "question"); - _questionfactory__WEBPACK_IMPORTED_MODULE_6__["QuestionFactory"].Instance.registerQuestion("paneldynamic", function (name) { - return new QuestionPanelDynamicModel(name); - }); - - - /***/ }), - - /***/ "./src/question_radiogroup.ts": - /*!************************************!*\ - !*** ./src/question_radiogroup.ts ***! - \************************************/ - /*! exports provided: QuestionRadiogroupModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRadiogroupModel", function() { return QuestionRadiogroupModel; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _question_baseselect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_baseselect */ "./src/question_baseselect.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - /** - * A Model for a radiogroup question. - */ - var QuestionRadiogroupModel = /** @class */ (function (_super) { - __extends(QuestionRadiogroupModel, _super); - function QuestionRadiogroupModel(name) { - return _super.call(this, name) || this; - } - QuestionRadiogroupModel.prototype.getType = function () { - return "radiogroup"; - }; - QuestionRadiogroupModel.prototype.getFirstInputElementId = function () { - return this.inputId + "_0"; - }; - Object.defineProperty(QuestionRadiogroupModel.prototype, "selectedItem", { - /** - * Return the selected item in the radio group. Returns null if the value is empty - */ - get: function () { - if (this.isEmpty()) - return null; - return _itemvalue__WEBPACK_IMPORTED_MODULE_4__["ItemValue"].getItemByValue(this.visibleChoices, this.value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRadiogroupModel.prototype, "showClearButton", { - /** - * Show "clear button" flag. - */ - get: function () { - return this.getPropertyValue("showClearButton"); - }, - set: function (val) { - this.setPropertyValue("showClearButton", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRadiogroupModel.prototype, "canShowClearButton", { - get: function () { - return this.showClearButton && !this.isReadOnly; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRadiogroupModel.prototype, "clearButtonCaption", { - get: function () { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("clearCaption"); - }, - enumerable: false, - configurable: true - }); - QuestionRadiogroupModel.prototype.supportGoNextPageAutomatic = function () { - return true; - }; - return QuestionRadiogroupModel; - }(_question_baseselect__WEBPACK_IMPORTED_MODULE_2__["QuestionCheckboxBase"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("radiogroup", [{ name: "showClearButton:boolean", default: false }], function () { - return new QuestionRadiogroupModel(""); - }, "checkboxbase"); - _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("radiogroup", function (name) { - var q = new QuestionRadiogroupModel(name); - q.choices = _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].DefaultChoices; - return q; - }); - - - /***/ }), - - /***/ "./src/question_ranking.ts": - /*!*********************************!*\ - !*** ./src/question_ranking.ts ***! - \*********************************/ - /*! exports provided: QuestionRankingModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRankingModel", function() { return QuestionRankingModel; }); - /* harmony import */ var sortablejs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! sortablejs */ "./node_modules/sortablejs/modular/sortable.esm.js"); - /* harmony import */ var _dragdrop_ranking_choices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dragdrop/ranking-choices */ "./src/dragdrop/ranking-choices.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _question_checkbox__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./question_checkbox */ "./src/question_checkbox.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - /* harmony import */ var _utils_is_mobile__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/is-mobile */ "./src/utils/is-mobile.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - - - - - - - var Sortable = sortablejs__WEBPACK_IMPORTED_MODULE_0__["default"]; - /** - * A Model for a ranking question - */ - var QuestionRankingModel = /** @class */ (function (_super) { - __extends(QuestionRankingModel, _super); - function QuestionRankingModel(name) { - var _this = _super.call(this, name) || this; - _this.domNode = null; - _this.sortableInst = null; - _this.onVisibleChoicesChanged = function () { - _super.prototype.onVisibleChoicesChanged.call(_this); - // ranking question with only one choice doesn't make sense - if (_this.visibleChoices.length === 1) { - _this.value = []; - _this.updateRankingChoices(); - return; - } - if (_this.isEmpty()) { - _this.updateRankingChoices(); - return; - } - if (_this.visibleChoices.length > _this.value.length) - _this.addToValueByVisibleChoices(); - if (_this.visibleChoices.length < _this.value.length) - _this.removeFromValueByVisibleChoices(); - _this.updateRankingChoices(); - }; - _this.localeChanged = function () { - _super.prototype.localeChanged.call(_this); - _this.updateRankingChoices(); - }; - _this.handlePointerDown = function (event, choice, node) { - if (!_this.fallbackToSortableJS && !_this.survey.isDesignMode) { - _this.dragDropRankingChoices.startDrag(event, choice, _this, node); - } - }; - _this.handleKeydown = function (event, choice) { - var key = event.key; - var index = _this.rankingChoices.indexOf(choice); - if (key === "ArrowUp" && index) { - _this.handleArrowUp(index, choice); - } - if (key === "ArrowDown" && index !== _this.rankingChoices.length - 1) { - _this.handleArrowDown(index, choice); - } - }; - _this.handleArrowUp = function (index, choice) { - var choices = _this.rankingChoices; - choices.splice(index, 1); - choices.splice(index - 1, 0, choice); - _this.setValue(); - setTimeout(function () { - _this.focusItem(index - 1); - }, 1); - }; - _this.handleArrowDown = function (index, choice) { - var choices = _this.rankingChoices; - choices.splice(index, 1); - choices.splice(index + 1, 0, choice); - _this.setValue(); - setTimeout(function () { - _this.focusItem(index + 1); - }, 1); - }; - _this.focusItem = function (index) { - var itemsNodes = _this.domNode.querySelectorAll("." + _this.cssClasses.item); - itemsNodes[index].focus(); - }; - _this.setValue = function () { - var value = []; - _this.rankingChoices.forEach(function (choice) { - value.push(choice.value); - }); - _this.value = value; - }; - _this.setValueFromUI = function () { - var value = []; - var textNodes = _this.domNode.querySelectorAll("." + _this.cssClasses.controlLabel); - textNodes.forEach(function (textNode, index) { - var innerText = textNode.innerText; - _this.visibleChoices.forEach(function (visibleChoice) { - if (innerText === visibleChoice.text) { - value.push(visibleChoice.value); - } - }); - }); - _this.value = value; - }; - _this.syncNumbers = function () { - if (!_this.domNode) - return; - var selector = "." + - _this.cssClasses.item + - ":not(." + - _this.cssClasses.itemDragMod + - ")" + - " ." + - _this.cssClasses.itemIndex; - var indexNodes = _this.domNode.querySelectorAll(selector); - indexNodes.forEach(function (indexNode, index) { - indexNode.innerText = _this.getNumberByIndex(index); - }); - }; - _this.setGhostText = function (text) { - var indexNodes = _this.domNode.querySelectorAll("." + _this.cssClasses.itemIndex); - var ghostNode = indexNodes[indexNodes.length - 1]; - ghostNode.innerText = text; - }; - _this.createNewArray("rankingChoices"); - return _this; - } - QuestionRankingModel.prototype.getType = function () { - return "ranking"; - }; - Object.defineProperty(QuestionRankingModel.prototype, "rootClass", { - get: function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() - .append(this.cssClasses.root) - .append(this.cssClasses.rootMobileMod, _utils_is_mobile__WEBPACK_IMPORTED_MODULE_6__["IsMobile"]) - .toString(); - }, - enumerable: false, - configurable: true - }); - QuestionRankingModel.prototype.getItemClassCore = function (item, options) { - var itemIndex = this.rankingChoices.indexOf(item); - var dropTargetIndex = this.rankingChoices.indexOf(this.currentDropTarget); - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() - .append(_super.prototype.getItemClassCore.call(this, item, options)) - .append(this.cssClasses.itemGhostMod, this.currentDropTarget === item) - .append("sv-dragdrop-movedown", itemIndex === dropTargetIndex + 1 && this.dropTargetNodeMove === "down") - .append("sv-dragdrop-moveup", itemIndex === dropTargetIndex - 1 && this.dropTargetNodeMove === "up") - .toString(); - }; - QuestionRankingModel.prototype.isItemCurrentDropTarget = function (item) { - if (this.fallbackToSortableJS) - return false; - return this.dragDropRankingChoices.dropTarget === item; - }; - Object.defineProperty(QuestionRankingModel.prototype, "ghostPositionCssClass", { - get: function () { - if (this.ghostPosition === "top") - return this.cssClasses.dragDropGhostPositionTop; - if (this.ghostPosition === "bottom") - return this.cssClasses.dragDropGhostPositionBottom; - return ""; - }, - enumerable: false, - configurable: true - }); - QuestionRankingModel.prototype.getNumberByIndex = function (index) { - return this.isEmpty() ? "\u2013" : index + 1 + ""; - }; - QuestionRankingModel.prototype.setSurveyImpl = function (value, isLight) { - _super.prototype.setSurveyImpl.call(this, value, isLight); - this.updateRankingChoices(); - }; - QuestionRankingModel.prototype.onSurveyValueChanged = function (newValue) { - _super.prototype.onSurveyValueChanged.call(this, newValue); - if (this.isLoadingFromJson) - return; - this.updateRankingChoices(); - }; - QuestionRankingModel.prototype.addToValueByVisibleChoices = function () { - var newValue = this.value.slice(); - this.visibleChoices.forEach(function (choice) { - if (newValue.indexOf(choice.value) === -1) { - newValue.push(choice.value); - } - }); - this.value = newValue; - }; - QuestionRankingModel.prototype.removeFromValueByVisibleChoices = function () { - var _this = this; - var newValue = this.value.slice(); - this.value.forEach(function (valueItem, index) { - var isValueItemToRemove = true; - _this.visibleChoices.forEach(function (choice) { - if (choice.value === valueItem) - isValueItemToRemove = false; - }); - isValueItemToRemove && newValue.splice(index, 1); - }); - this.value = newValue; - }; - Object.defineProperty(QuestionRankingModel.prototype, "rankingChoices", { - get: function () { - return this.getPropertyValue("rankingChoices", []); - }, - enumerable: false, - configurable: true - }); - QuestionRankingModel.prototype.updateRankingChoices = function () { - var _this = this; - var newRankingChoices = []; - // ranking question with only one choice doesn't make sense - if (this.visibleChoices.length === 1) { - this.setPropertyValue("rankingChoices", newRankingChoices); - return; - } - if (this.isEmpty()) { - this.setPropertyValue("rankingChoices", this.visibleChoices); - return; - } - this.value.forEach(function (valueItem) { - _this.visibleChoices.forEach(function (choice) { - if (choice.value === valueItem) - newRankingChoices.push(choice); - }); - }); - this.setPropertyValue("rankingChoices", newRankingChoices); - }; - QuestionRankingModel.prototype.endLoadingFromJson = function () { - _super.prototype.endLoadingFromJson.call(this); - if (!this.fallbackToSortableJS) { - this.dragDropRankingChoices = new _dragdrop_ranking_choices__WEBPACK_IMPORTED_MODULE_1__["DragDropRankingChoices"](this.survey); - } - }; - //cross framework initialization - QuestionRankingModel.prototype.afterRenderQuestionElement = function (el) { - this.domNode = el; - if (!!el && this.fallbackToSortableJS) { - this.initSortable(el); - } - _super.prototype.afterRenderQuestionElement.call(this, el); - }; - //cross framework destroy - QuestionRankingModel.prototype.beforeDestroyQuestionElement = function (el) { - if (this.sortableInst) - this.sortableInst.destroy(); - _super.prototype.beforeDestroyQuestionElement.call(this, el); - }; - QuestionRankingModel.prototype.supportSelectAll = function () { - return false; - }; - QuestionRankingModel.prototype.supportOther = function () { - return false; - }; - QuestionRankingModel.prototype.supportNone = function () { - return false; - }; - QuestionRankingModel.prototype.initSortable = function (domNode) { - if (!domNode) - return; - var self = this; - if (this.isReadOnly) - return; - if (this.isDesignMode) - return; - self.sortableInst = new Sortable(domNode, { - animation: 100, - forceFallback: true, - delay: 200, - delayOnTouchOnly: true, - handle: _utils_is_mobile__WEBPACK_IMPORTED_MODULE_6__["IsMobile"] - ? "." + self.cssClasses.itemIconContainer - : "." + self.cssClasses.itemContent, - ghostClass: self.cssClasses.itemGhostMod, - dragClass: self.cssClasses.itemDragMod, - onStart: function (evt) { - Sortable.ghost.style.opacity = 1; - domNode.className += " " + self.cssClasses.rootDragMod; - if (self.isEmpty()) { - self.setGhostText(evt.oldIndex + 1); - } - }, - onEnd: function () { - domNode.className = domNode.className.replace(" " + self.cssClasses.rootDragMod, ""); - self.setValueFromUI(); - }, - onChange: function (evt) { - if (!self.isEmpty()) - self.syncNumbers(); - self.setGhostText(evt.newIndex + 1); - }, - }); - }; - Object.defineProperty(QuestionRankingModel.prototype, "fallbackToSortableJS", { - get: function () { - return this.getPropertyValue("fallbackToSortableJS"); - }, - set: function (val) { - this.setPropertyValue("fallbackToSortableJS", val); - }, - enumerable: false, - configurable: true - }); - QuestionRankingModel.prototype.getIconHoverCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() - .append(this.cssClasses.itemIcon) - .append(this.cssClasses.itemIconHoverMod) - .toString(); - }; - QuestionRankingModel.prototype.getIconFocusCss = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() - .append(this.cssClasses.itemIcon) - .append(this.cssClasses.itemIconFocusMod) - .toString(); - }; - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: null }) - ], QuestionRankingModel.prototype, "currentDropTarget", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: null }) - ], QuestionRankingModel.prototype, "dropTargetNodeMove", void 0); - return QuestionRankingModel; - }(_question_checkbox__WEBPACK_IMPORTED_MODULE_4__["QuestionCheckboxModel"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_2__["Serializer"].addClass("ranking", [ - { name: "hasOther", visible: false, isSerializable: false }, - { name: "otherText", visible: false, isSerializable: false }, - { name: "otherErrorText", visible: false, isSerializable: false }, - { name: "storeOthersAsComment", visible: false, isSerializable: false }, - { name: "hasNone", visible: false, isSerializable: false }, - { name: "noneText", visible: false, isSerializable: false }, - { name: "hasSelectAll", visible: false, isSerializable: false }, - { name: "selectAllText", visible: false, isSerializable: false }, - { name: "colCount:number", visible: false, isSerializable: false }, - { name: "maxSelectedChoices", visible: false, isSerializable: false }, - { - name: "fallbackToSortableJS", - default: false, - visible: false, - isSerializable: false, - }, - ], function () { - return new QuestionRankingModel(""); - }, "checkbox"); - _questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].Instance.registerQuestion("ranking", function (name) { - var q = new QuestionRankingModel(name); - q.choices = _questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].DefaultChoices; - return q; - }); - - - /***/ }), - - /***/ "./src/question_rating.ts": - /*!********************************!*\ - !*** ./src/question_rating.ts ***! - \********************************/ - /*! exports provided: QuestionRatingModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRatingModel", function() { return QuestionRatingModel; }); - /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - - - /** - * A Model for a rating question. - */ - var QuestionRatingModel = /** @class */ (function (_super) { - __extends(QuestionRatingModel, _super); - function QuestionRatingModel(name) { - var _this = _super.call(this, name) || this; - _this.createItemValues("rateValues"); - var self = _this; - _this.registerFunctionOnPropertyValueChanged("rateValues", function () { - self.fireCallback(self.rateValuesChangedCallback); - }); - _this.onPropertyChanged.add(function (sender, options) { - if (options.name == "rateMin" || - options.name == "rateMax" || - options.name == "rateStep") { - self.fireCallback(self.rateValuesChangedCallback); - } - }); - var locMinRateDescriptionValue = _this.createLocalizableString("minRateDescription", _this, true); - var locMaxRateDescriptionValue = _this.createLocalizableString("maxRateDescription", _this, true); - locMinRateDescriptionValue.onGetTextCallback = function (text) { - return text ? text + " " : text; - }; - locMaxRateDescriptionValue.onGetTextCallback = function (text) { - return text ? " " + text : text; - }; - return _this; - } - QuestionRatingModel.prototype.onSurveyLoad = function () { - _super.prototype.onSurveyLoad.call(this); - this.fireCallback(this.rateValuesChangedCallback); - }; - Object.defineProperty(QuestionRatingModel.prototype, "rateValues", { - /** - * The list of rate items. Every item has value and text. If text is empty, the value is rendered. The item text supports markdown. If it is empty the array is generated by using rateMin, rateMax and rateStep properties. - * @see rateMin - * @see rateMax - * @see rateStep - */ - get: function () { - return this.getPropertyValue("rateValues"); - }, - set: function (val) { - this.setPropertyValue("rateValues", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRatingModel.prototype, "rateMin", { - /** - * This property is used to generate rate values if rateValues array is empty. It is the first value in the rating. The default value is 1. - * @see rateValues - * @see rateMax - * @see rateStep - */ - get: function () { - return this.getPropertyValue("rateMin"); - }, - set: function (val) { - if (!this.isLoadingFromJson && val > this.rateMax - this.rateStep) - val = this.rateMax - this.rateStep; - this.setPropertyValue("rateMin", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRatingModel.prototype, "rateMax", { - /** - * This property is used to generate rate values if rateValues array is empty. It is the last value in the rating. The default value is 5. - * @see rateValues - * @see rateMin - * @see rateStep - */ - get: function () { - return this.getPropertyValue("rateMax"); - }, - set: function (val) { - if (!this.isLoadingFromJson && val < this.rateMin + this.rateStep) - val = this.rateMin + this.rateStep; - this.setPropertyValue("rateMax", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRatingModel.prototype, "rateStep", { - /** - * This property is used to generate rate values if rateValues array is empty. It is the step value. The number of rate values are (rateMax - rateMin) / rateStep. The default value is 1. - * @see rateValues - * @see rateMin - * @see rateMax - */ - get: function () { - return this.getPropertyValue("rateStep"); - }, - set: function (val) { - if (val <= 0) - val = 1; - if (!this.isLoadingFromJson && val > this.rateMax - this.rateMin) - val = this.rateMax - this.rateMin; - this.setPropertyValue("rateStep", val); - }, - enumerable: false, - configurable: true - }); - QuestionRatingModel.prototype.getDisplayValueCore = function (keysAsText, value) { - var res = _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getTextOrHtmlByValue(this.visibleRateValues, value); - return !!res ? res : value; - }; - Object.defineProperty(QuestionRatingModel.prototype, "visibleRateValues", { - get: function () { - if (this.rateValues.length > 0) - return this.rateValues; - var res = []; - var value = this.rateMin; - var step = this.rateStep; - while (value <= this.rateMax && - res.length < _settings__WEBPACK_IMPORTED_MODULE_4__["settings"].ratingMaximumRateValueCount) { - res.push(new _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"](value)); - value = this.correctValue(value + step, step); - } - return res; - }, - enumerable: false, - configurable: true - }); - QuestionRatingModel.prototype.correctValue = function (value, step) { - if (!value) - return value; - if (Math.round(value) == value) - return value; - var fr = 0; - while (Math.round(step) != step) { - step *= 10; - fr++; - } - return parseFloat(value.toFixed(fr)); - }; - QuestionRatingModel.prototype.getType = function () { - return "rating"; - }; - QuestionRatingModel.prototype.getFirstInputElementId = function () { - return this.inputId + "_0"; - }; - QuestionRatingModel.prototype.supportGoNextPageAutomatic = function () { - return true; - }; - QuestionRatingModel.prototype.supportComment = function () { - return true; - }; - QuestionRatingModel.prototype.supportOther = function () { - return true; - }; - Object.defineProperty(QuestionRatingModel.prototype, "minRateDescription", { - /** - * The description of minimum (first) item. - */ - get: function () { - return this.getLocalizableStringText("minRateDescription"); - }, - set: function (val) { - this.setLocalizableStringText("minRateDescription", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRatingModel.prototype, "locMinRateDescription", { - get: function () { - return this.getLocalizableString("minRateDescription"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRatingModel.prototype, "maxRateDescription", { - /** - * The description of maximum (last) item. - */ - get: function () { - return this.getLocalizableStringText("maxRateDescription"); - }, - set: function (val) { - this.setLocalizableStringText("maxRateDescription", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionRatingModel.prototype, "locMaxRateDescription", { - get: function () { - return this.getLocalizableString("maxRateDescription"); - }, - enumerable: false, - configurable: true - }); - QuestionRatingModel.prototype.valueToData = function (val) { - if (this.rateValues.length > 0) { - var item = _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getItemByValue(this.rateValues, val); - return !!item ? item.value : val; - } - return !isNaN(val) ? parseFloat(val) : val; - }; - /** - * Click value again to clear. - */ - QuestionRatingModel.prototype.setValueFromClick = function (value) { - if (this.value === parseFloat(value)) { - this.clearValue(); - } - else { - this.value = value; - } - }; - QuestionRatingModel.prototype.getItemClass = function (item) { - var isSelected = this.value == item.value; - var isDisabled = this.isReadOnly && !item.isEnabled; - var allowHover = !isDisabled && !isSelected && !(!!this.survey && this.survey.isDesignMode); - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]() - .append(this.cssClasses.item) - .append(this.cssClasses.selected, this.value == item.value) - .append(this.cssClasses.itemDisabled, this.isReadOnly) - .append(this.cssClasses.itemHover, allowHover) - .append(this.cssClasses.itemOnError, this.errors.length > 0) - .toString(); - }; - return QuestionRatingModel; - }(_question__WEBPACK_IMPORTED_MODULE_1__["Question"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_2__["Serializer"].addClass("rating", [ - { name: "hasComment:switch", layout: "row" }, - { - name: "commentText", - dependsOn: "hasComment", - visibleIf: function (obj) { - return obj.hasComment; - }, - serializationProperty: "locCommentText", - layout: "row", - }, - { - name: "rateValues:itemvalue[]", - baseValue: function () { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_5__["surveyLocalization"].getString("choices_Item"); - }, - }, - { name: "rateMin:number", default: 1 }, - { name: "rateMax:number", default: 5 }, - { name: "rateStep:number", default: 1, minValue: 0.1 }, - { - name: "minRateDescription", - alternativeName: "mininumRateDescription", - serializationProperty: "locMinRateDescription", - }, - { - name: "maxRateDescription", - alternativeName: "maximumRateDescription", - serializationProperty: "locMaxRateDescription", - }, - ], function () { - return new QuestionRatingModel(""); - }, "question"); - _questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].Instance.registerQuestion("rating", function (name) { - return new QuestionRatingModel(name); - }); - - - /***/ }), - - /***/ "./src/question_signaturepad.ts": - /*!**************************************!*\ - !*** ./src/question_signaturepad.ts ***! - \**************************************/ - /*! exports provided: QuestionSignaturePadModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionSignaturePadModel", function() { return QuestionSignaturePadModel; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var signature_pad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! signature_pad */ "./node_modules/signature_pad/dist/signature_pad.mjs"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - - - - - - var defaultWidth = 300; - var defaultHeight = 200; - function resizeCanvas(canvas) { - var context = canvas.getContext("2d"); - var devicePixelRatio = window.devicePixelRatio || 1; - var backingStoreRatio = context.webkitBackingStorePixelRatio || - context.mozBackingStorePixelRatio || - context.msBackingStorePixelRatio || - context.oBackingStorePixelRatio || - context.backingStorePixelRatio || - 1; - var ratio = devicePixelRatio / backingStoreRatio; - var oldWidth = canvas.width; - var oldHeight = canvas.height; - canvas.width = oldWidth * ratio; - canvas.height = oldHeight * ratio; - canvas.style.width = oldWidth + "px"; - canvas.style.height = oldHeight + "px"; - context.scale(ratio, ratio); - } - /** - * A Model for signature pad question. - */ - var QuestionSignaturePadModel = /** @class */ (function (_super) { - __extends(QuestionSignaturePadModel, _super); - function QuestionSignaturePadModel(name) { - return _super.call(this, name) || this; - } - QuestionSignaturePadModel.prototype.getCssRoot = function (cssClasses) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() - .append(_super.prototype.getCssRoot.call(this, cssClasses)) - .append(cssClasses.small, this.width.toString() === "300") - .toString(); - }; - QuestionSignaturePadModel.prototype.updateValue = function () { - if (this.signaturePad) { - var data = this.signaturePad.toDataURL(this.dataFormat); - this.value = data; - } - }; - QuestionSignaturePadModel.prototype.getType = function () { - return "signaturepad"; - }; - QuestionSignaturePadModel.prototype.afterRenderQuestionElement = function (el) { - if (!!el) { - this.initSignaturePad(el); - } - _super.prototype.afterRenderQuestionElement.call(this, el); - }; - QuestionSignaturePadModel.prototype.beforeDestroyQuestionElement = function (el) { - if (!!el) { - this.destroySignaturePad(el); - } - }; - QuestionSignaturePadModel.prototype.initSignaturePad = function (el) { - var _this = this; - var canvas = el.getElementsByTagName("canvas")[0]; - var buttonEl = el.getElementsByTagName("button")[0]; - var signaturePad = new signature_pad__WEBPACK_IMPORTED_MODULE_4__["default"](canvas, { backgroundColor: "#ffffff" }); - if (this.isInputReadOnly) { - signaturePad.off(); - } - buttonEl.onclick = function () { - _this.value = undefined; - }; - this.readOnlyChangedCallback = function () { - if (!_this.allowClear || _this.isInputReadOnly) { - signaturePad.off(); - buttonEl.style.display = "none"; - } - else { - signaturePad.on(); - buttonEl.style.display = "block"; - } - }; - signaturePad.penColor = this.penColor; - signaturePad.backgroundColor = this.backgroundColor; - signaturePad.onBegin = function () { - _this.isDrawingValue = true; - canvas.focus(); - }; - signaturePad.onEnd = function () { - _this.isDrawingValue = false; - _this.updateValue(); - }; - var updateValueHandler = function () { - var data = _this.value; - canvas.width = _this.width || defaultWidth; - canvas.height = _this.height || defaultHeight; - resizeCanvas(canvas); - if (!data) { - signaturePad.clear(); - } - else { - signaturePad.fromDataURL(data); - } - }; - updateValueHandler(); - this.readOnlyChangedCallback(); - this.signaturePad = signaturePad; - var propertyChangedHandler = function (sender, options) { - if (options.name === "width" || options.name === "height") { - updateValueHandler(); - } - if (options.name === "value") { - updateValueHandler(); - } - }; - this.onPropertyChanged.add(propertyChangedHandler); - this.signaturePad.propertyChangedHandler = propertyChangedHandler; - }; - QuestionSignaturePadModel.prototype.destroySignaturePad = function (el) { - if (this.signaturePad) { - this.onPropertyChanged.remove(this.signaturePad.propertyChangedHandler); - this.signaturePad.off(); - } - this.readOnlyChangedCallback = null; - this.signaturePad = null; - }; - Object.defineProperty(QuestionSignaturePadModel.prototype, "width", { - /** - * Use it to set the specific width for the signature pad. - */ - get: function () { - return this.getPropertyValue("width"); - }, - set: function (val) { - this.setPropertyValue("width", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSignaturePadModel.prototype, "height", { - /** - * Use it to set the specific height for the signature pad. - */ - get: function () { - return this.getPropertyValue("height"); - }, - set: function (val) { - this.setPropertyValue("height", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSignaturePadModel.prototype, "allowClear", { - /** - * Use it to clear content of the signature pad. - */ - get: function () { - return this.getPropertyValue("allowClear"); - }, - set: function (val) { - this.setPropertyValue("allowClear", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSignaturePadModel.prototype, "penColor", { - /** - * Use it to set pen color for the signature pad. - */ - get: function () { - return this.getPropertyValue("penColor"); - }, - set: function (val) { - this.setPropertyValue("penColor", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSignaturePadModel.prototype, "backgroundColor", { - /** - * Use it to set background color for the signature pad. - */ - get: function () { - return this.getPropertyValue("backgroundColor"); - }, - set: function (val) { - this.setPropertyValue("backgroundColor", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionSignaturePadModel.prototype, "clearButtonCaption", { - /** - * The clear signature button caption. - */ - get: function () { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_1__["surveyLocalization"].getString("clearCaption"); - }, - enumerable: false, - configurable: true - }); - QuestionSignaturePadModel.prototype.needShowPlaceholder = function () { - return !this.isDrawingValue && this.isEmpty(); - }; - Object.defineProperty(QuestionSignaturePadModel.prototype, "placeHolderText", { - get: function () { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_1__["surveyLocalization"].getString("signaturePlaceHolder"); - }, - enumerable: false, - configurable: true - }); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) - ], QuestionSignaturePadModel.prototype, "isDrawingValue", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: "" }) - ], QuestionSignaturePadModel.prototype, "dataFormat", void 0); - return QuestionSignaturePadModel; - }(_question__WEBPACK_IMPORTED_MODULE_3__["Question"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("signaturepad", [ - { - name: "width:number", - category: "general", - default: 300, - }, - { - name: "height:number", - category: "general", - default: 200, - }, - { - name: "allowClear:boolean", - category: "general", - default: true, - }, - { - name: "penColor:color", - category: "general", - default: "#1ab394", - }, - { - name: "backgroundColor:color", - category: "general", - default: "#ffffff", - }, - { - name: "dataFormat", - category: "general", - default: "", - choices: [ - { value: "", text: "PNG" }, - { value: "image/jpeg", text: "JPEG" }, - { value: "image/svg+xml", text: "SVG" }, - ], - }, - { name: "defaultValue", visible: false }, - { name: "correctAnswer", visible: false }, - ], function () { - return new QuestionSignaturePadModel(""); - }, "question"); - _questionfactory__WEBPACK_IMPORTED_MODULE_2__["QuestionFactory"].Instance.registerQuestion("signaturepad", function (name) { - return new QuestionSignaturePadModel(name); - }); - - - /***/ }), - - /***/ "./src/question_text.ts": - /*!******************************!*\ - !*** ./src/question_text.ts ***! - \******************************/ - /*! exports provided: QuestionTextModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionTextModel", function() { return QuestionTextModel; }); - /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts"); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _validator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./validator */ "./src/validator.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./error */ "./src/error.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - /* harmony import */ var _question_textbase__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./question_textbase */ "./src/question_textbase.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - - - - - /** - * A Model for an input text question. - */ - var QuestionTextModel = /** @class */ (function (_super) { - __extends(QuestionTextModel, _super); - function QuestionTextModel(name) { - var _this = _super.call(this, name) || this; - _this.createLocalizableString("minErrorText", _this, true); - _this.createLocalizableString("maxErrorText", _this, true); - _this.locDataListValue = new _localizablestring__WEBPACK_IMPORTED_MODULE_2__["LocalizableStrings"](_this); - _this.locDataListValue.onValueChanged = function (oldValue, newValue) { - _this.propertyValueChanged("dataList", oldValue, newValue); - }; - _this.registerFunctionOnPropertiesValueChanged(["min", "max", "inputType", "minValueExpression", "maxValueExpression"], function () { - _this.setRenderedMinMax(); - }); - _this.registerFunctionOnPropertiesValueChanged(["inputType", "size"], function () { - _this.updateInputSize(); - _this.calcRenderedPlaceHolder(); - }); - return _this; - } - QuestionTextModel.prototype.isTextValue = function () { - return ["text", "number", "password"].indexOf(this.inputType) > -1; - }; - QuestionTextModel.prototype.getType = function () { - return "text"; - }; - QuestionTextModel.prototype.onSurveyLoad = function () { - _super.prototype.onSurveyLoad.call(this); - this.setRenderedMinMax(); - this.updateInputSize(); - }; - Object.defineProperty(QuestionTextModel.prototype, "inputType", { - /** - * Use this property to change the default input type. - */ - get: function () { - return this.getPropertyValue("inputType"); - }, - set: function (val) { - val = val.toLowerCase(); - if (val == "datetime_local") - val = "datetime-local"; - this.setPropertyValue("inputType", val.toLowerCase()); - if (!this.isLoadingFromJson) { - this.min = undefined; - this.max = undefined; - this.step = undefined; - } - }, - enumerable: false, - configurable: true - }); - QuestionTextModel.prototype.runCondition = function (values, properties) { - _super.prototype.runCondition.call(this, values, properties); - if (!!this.minValueExpression || !!this.maxValueExpression) { - this.setRenderedMinMax(values, properties); - } - }; - QuestionTextModel.prototype.getValidators = function () { - var validators = _super.prototype.getValidators.call(this); - if (this.inputType === "email" && - !this.validators.some(function (v) { return v.getType() === "emailvalidator"; })) { - validators.push(new _validator__WEBPACK_IMPORTED_MODULE_4__["EmailValidator"]()); - } - return validators; - }; - QuestionTextModel.prototype.isLayoutTypeSupported = function (layoutType) { - return true; - }; - Object.defineProperty(QuestionTextModel.prototype, "size", { - /** - * The text input size - */ - get: function () { - return this.getPropertyValue("size"); - }, - set: function (val) { - this.setPropertyValue("size", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "isTextInput", { - get: function () { - return (["text", "search", "tel", "url", "email", "password"].indexOf(this.inputType) > -1); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "inputSize", { - get: function () { - return this.getPropertyValue("inputSize", 0); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "renderedInputSize", { - get: function () { - return this.getPropertyValue("inputSize") || null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "inputWidth", { - get: function () { - return this.getPropertyValue("inputWidth"); - }, - enumerable: false, - configurable: true - }); - QuestionTextModel.prototype.updateInputSize = function () { - var size = this.isTextInput && this.size > 0 ? this.size : 0; - if (this.isTextInput && - size < 1 && - this.parent && - !!this.parent["itemSize"]) { - size = this.parent["itemSize"]; - } - this.setPropertyValue("inputSize", size); - this.setPropertyValue("inputWidth", size > 0 ? "auto" : ""); - }; - Object.defineProperty(QuestionTextModel.prototype, "autoComplete", { - /** - * Text auto complete - */ - get: function () { - return this.getPropertyValue("autoComplete", ""); - }, - set: function (val) { - this.setPropertyValue("autoComplete", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "min", { - /** - * The minimum value - */ - get: function () { - return this.getPropertyValue("min"); - }, - set: function (val) { - if (this.isValueExpression(val)) { - this.minValueExpression = val.substr(1); - return; - } - this.setPropertyValue("min", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "max", { - /** - * The maximum value - */ - get: function () { - return this.getPropertyValue("max"); - }, - set: function (val) { - if (this.isValueExpression(val)) { - this.maxValueExpression = val.substr(1); - return; - } - this.setPropertyValue("max", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "minValueExpression", { - /** - * The minimum value that you can setup as expression, for example today(-1) = yesterday; - */ - get: function () { - return this.getPropertyValue("minValueExpression", ""); - }, - set: function (val) { - this.setPropertyValue("minValueExpression", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "maxValueExpression", { - /** - * The maximum value that you can setup as expression, for example today(1) = tomorrow; - */ - get: function () { - return this.getPropertyValue("maxValueExpression", ""); - }, - set: function (val) { - this.setPropertyValue("maxValueExpression", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "renderedMin", { - get: function () { - return this.getPropertyValue("renderedMin"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "renderedMax", { - get: function () { - return this.getPropertyValue("renderedMax"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "minErrorText", { - /** - * The text that shows when value is less than min property. - * @see min - * @see maxErrorText - */ - get: function () { - return this.getLocalizableStringText("minErrorText", _surveyStrings__WEBPACK_IMPORTED_MODULE_5__["surveyLocalization"].getString("minError")); - }, - set: function (val) { - this.setLocalizableStringText("minErrorText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "locMinErrorText", { - get: function () { - return this.getLocalizableString("minErrorText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "maxErrorText", { - /** - * The text that shows when value is greater than man property. - * @see max - * @see minErrorText - */ - get: function () { - return this.getLocalizableStringText("maxErrorText", _surveyStrings__WEBPACK_IMPORTED_MODULE_5__["surveyLocalization"].getString("maxError")); - }, - set: function (val) { - this.setLocalizableStringText("maxErrorText", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "locMaxErrorText", { - get: function () { - return this.getLocalizableString("maxErrorText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "isMinMaxType", { - /** - * Readonly property that returns true if the current inputType allows to set min and max properties - * @see inputType - * @see min - * @see max - */ - get: function () { - return minMaxTypes.indexOf(this.inputType) > -1; - }, - enumerable: false, - configurable: true - }); - QuestionTextModel.prototype.onCheckForErrors = function (errors, isOnValueChanged) { - _super.prototype.onCheckForErrors.call(this, errors, isOnValueChanged); - if (isOnValueChanged || this.canSetValueToSurvey()) - return; - if (this.isValueLessMin) { - errors.push(new _error__WEBPACK_IMPORTED_MODULE_6__["CustomError"](this.getMinMaxErrorText(this.minErrorText, this.getCalculatedMinMax(this.renderedMin)), this)); - } - if (this.isValueGreaterMax) { - errors.push(new _error__WEBPACK_IMPORTED_MODULE_6__["CustomError"](this.getMinMaxErrorText(this.maxErrorText, this.getCalculatedMinMax(this.renderedMax)), this)); - } - }; - QuestionTextModel.prototype.canSetValueToSurvey = function () { - if (!this.isMinMaxType) - return true; - if (this.isValueLessMin) - return false; - if (this.isValueGreaterMax) - return false; - return true; - }; - QuestionTextModel.prototype.getMinMaxErrorText = function (errorText, value) { - if (!value) - return errorText; - return errorText.replace("{0}", value.toString()); - }; - Object.defineProperty(QuestionTextModel.prototype, "isValueLessMin", { - get: function () { - return (!this.isValueEmpty(this.renderedMin) && - this.getCalculatedMinMax(this.value) < - this.getCalculatedMinMax(this.renderedMin)); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "isValueGreaterMax", { - get: function () { - return (!this.isValueEmpty(this.renderedMax) && - this.getCalculatedMinMax(this.value) > - this.getCalculatedMinMax(this.renderedMax)); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "isDateInputType", { - get: function () { - return this.inputType === "date" || this.inputType === "datetime-local"; - }, - enumerable: false, - configurable: true - }); - QuestionTextModel.prototype.getCalculatedMinMax = function (minMax) { - if (this.isValueEmpty(minMax)) - return minMax; - return this.isDateInputType ? new Date(minMax) : minMax; - }; - QuestionTextModel.prototype.setRenderedMinMax = function (values, properties) { - var _this = this; - if (values === void 0) { values = null; } - if (properties === void 0) { properties = null; } - this.setValueAndRunExpression(this.minValueExpression, this.min, function (val) { - if (!val && _this.isDateInputType && !!_settings__WEBPACK_IMPORTED_MODULE_7__["settings"].minDate) { - val = _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].minDate; - } - _this.setPropertyValue("renderedMin", val); - }, values, properties); - this.setValueAndRunExpression(this.maxValueExpression, this.max, function (val) { - if (!val && _this.isDateInputType) { - val = !!_settings__WEBPACK_IMPORTED_MODULE_7__["settings"].maxDate ? _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].maxDate : "2999-12-31"; - } - _this.setPropertyValue("renderedMax", val); - }, values, properties); - }; - Object.defineProperty(QuestionTextModel.prototype, "step", { - /** - * The step value - */ - get: function () { - return this.getPropertyValue("step"); - }, - set: function (val) { - this.setPropertyValue("step", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "renderedStep", { - get: function () { - return this.isValueEmpty(this.step) ? "any" : this.step; - }, - enumerable: false, - configurable: true - }); - QuestionTextModel.prototype.supportGoNextPageAutomatic = function () { - return ["date", "datetime", "datetime-local"].indexOf(this.inputType) < 0; - }; - QuestionTextModel.prototype.supportGoNextPageError = function () { - return ["date", "datetime", "datetime-local"].indexOf(this.inputType) < 0; - }; - Object.defineProperty(QuestionTextModel.prototype, "dataList", { - /** - * The list of recommended options available to choose. - */ - get: function () { - return this.locDataList.value; - }, - set: function (val) { - this.locDataList.value = val; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "locDataList", { - get: function () { - return this.locDataListValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextModel.prototype, "dataListId", { - get: function () { - return this.locDataList.hasValue() ? this.id + "_datalist" : ""; - }, - enumerable: false, - configurable: true - }); - QuestionTextModel.prototype.canRunValidators = function (isOnValueChanged) { - return (this.errors.length > 0 || - !isOnValueChanged || - this.supportGoNextPageError()); - }; - QuestionTextModel.prototype.setNewValue = function (newValue) { - newValue = this.correctValueType(newValue); - _super.prototype.setNewValue.call(this, newValue); - }; - QuestionTextModel.prototype.correctValueType = function (newValue) { - if (!newValue) - return newValue; - if (this.inputType == "number" || this.inputType == "range") { - return _helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].isNumber(newValue) ? parseFloat(newValue) : ""; - } - return newValue; - }; - QuestionTextModel.prototype.hasPlaceHolder = function () { - return !this.isReadOnly && this.inputType !== "range"; - }; - QuestionTextModel.prototype.isReadOnlyRenderDiv = function () { - return this.isReadOnly && _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].readOnlyTextRenderMode === "div"; - }; - Object.defineProperty(QuestionTextModel.prototype, "inputStyle", { - get: function () { - var style = {}; - if (!!this.inputWidth) { - style.width = this.inputWidth; - } - return style; - }, - enumerable: false, - configurable: true - }); - return QuestionTextModel; - }(_question_textbase__WEBPACK_IMPORTED_MODULE_8__["QuestionTextBase"])); - - var minMaxTypes = [ - "number", - "range", - "date", - "datetime-local", - "month", - "time", - "week", - ]; - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("text", [ - { - name: "inputType", - default: "text", - choices: [ - "color", - "date", - "datetime", - "datetime-local", - "email", - "month", - "number", - "password", - "range", - "tel", - "text", - "time", - "url", - "week", - ], - }, - { - name: "size:number", - minValue: 0, - dependsOn: "inputType", - visibleIf: function (obj) { - if (!obj) - return false; - return obj.isTextInput; - }, - }, - { - name: "textUpdateMode", - default: "default", - choices: ["default", "onBlur", "onTyping"], - dependsOn: "inputType", - visibleIf: function (obj) { - if (!obj) - return false; - return obj.isTextInput; - }, - }, - { - name: "autoComplete", - dataList: [ - "name", - "honorific-prefix", - "given-name", - "additional-name", - "family-name", - "honorific-suffix", - "nickname", - "organization-title", - "username", - "new-password", - "current-password", - "organization", - "street-address", - "address-line1", - "address-line2", - "address-line3", - "address-level4", - "address-level3", - "address-level2", - "address-level1", - "country", - "country-name", - "postal-code", - "cc-name", - "cc-given-name", - "cc-additional-name", - "cc-family-name", - "cc-number", - "cc-exp", - "cc-exp-month", - "cc-exp-year", - "cc-csc", - "cc-type", - "transaction-currency", - "transaction-amount", - "language", - "bday", - "bday-day", - "bday-month", - "bday-year", - "sex", - "url", - "photo", - "tel", - "tel-country-code", - "tel-national", - "tel-area-code", - "tel-local", - "tel-local-prefix", - "tel-local-suffix", - "tel-extension", - "email", - "impp", - ], - }, - { - name: "min", - dependsOn: "inputType", - visibleIf: function (obj) { - return !!obj && obj.isMinMaxType; - }, - onPropertyEditorUpdate: function (obj, propertyEditor) { - propertyEditor.inputType = obj.inputType; - }, - }, - { - name: "max", - dependsOn: "inputType", - visibleIf: function (obj) { - return !!obj && obj.isMinMaxType; - }, - onPropertyEditorUpdate: function (obj, propertyEditor) { - propertyEditor.inputType = obj.inputType; - }, - }, - { - name: "minValueExpression:expression", - category: "logic", - dependsOn: "inputType", - visibleIf: function (obj) { - return !!obj && obj.isMinMaxType; - }, - }, - { - name: "maxValueExpression:expression", - category: "logic", - dependsOn: "inputType", - visibleIf: function (obj) { - return !!obj && obj.isMinMaxType; - }, - }, - { - name: "minErrorText", - serializationProperty: "locMinErrorText", - dependsOn: "inputType", - visibleIf: function (obj) { - return !!obj && obj.isMinMaxType; - }, - }, - { - name: "maxErrorText", - serializationProperty: "locMaxErrorText", - dependsOn: "inputType", - visibleIf: function (obj) { - return !!obj && obj.isMinMaxType; - }, - }, - { - name: "step:number", - dependsOn: "inputType", - visibleIf: function (obj) { - if (!obj) - return false; - return obj.inputType === "number"; - }, - }, - { - name: "maxLength:number", - default: -1, - dependsOn: "inputType", - visibleIf: function (obj) { - if (!obj) - return false; - return obj.isTextInput; - }, - }, - { - name: "placeHolder", - serializationProperty: "locPlaceHolder", - dependsOn: "inputType", - visibleIf: function (obj) { - if (!obj) - return false; - return obj.isTextInput; - }, - }, - { - name: "dataList:string[]", - serializationProperty: "locDataList", - dependsOn: "inputType", - visibleIf: function (obj) { - if (!obj) - return false; - return obj.inputType === "text"; - }, - }, - ], function () { - return new QuestionTextModel(""); - }, "textbase"); - _questionfactory__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("text", function (name) { - return new QuestionTextModel(name); - }); - - - /***/ }), - - /***/ "./src/question_textbase.ts": - /*!**********************************!*\ - !*** ./src/question_textbase.ts ***! - \**********************************/ - /*! exports provided: QuestionTextBase */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionTextBase", function() { return QuestionTextBase; }); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - /** - * A Base Model for a comment and text questions - */ - var QuestionTextBase = /** @class */ (function (_super) { - __extends(QuestionTextBase, _super); - function QuestionTextBase(name) { - var _this = _super.call(this, name) || this; - _this.createLocalizableString("placeHolder", _this); - return _this; - } - QuestionTextBase.prototype.isTextValue = function () { - return true; - }; - Object.defineProperty(QuestionTextBase.prototype, "maxLength", { - /** - * The maximum text length. If it is -1, defaul value, then the survey maxTextLength property will be used. - * If it is 0, then the value is unlimited - * @see SurveyModel.maxTextLength - */ - get: function () { - return this.getPropertyValue("maxLength"); - }, - set: function (val) { - this.setPropertyValue("maxLength", val); - }, - enumerable: false, - configurable: true - }); - QuestionTextBase.prototype.getMaxLength = function () { - return _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].getMaxLength(this.maxLength, this.survey ? this.survey.maxTextLength : -1); - }; - Object.defineProperty(QuestionTextBase.prototype, "placeHolder", { - /** - * Use this property to set the input place holder. - */ - get: function () { - return this.getLocalizableStringText("placeHolder"); - }, - set: function (val) { - this.setLocalizableStringText("placeHolder", val); - this.calcRenderedPlaceHolder(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextBase.prototype, "locPlaceHolder", { - get: function () { - return this.getLocalizableString("placeHolder"); - }, - enumerable: false, - configurable: true - }); - QuestionTextBase.prototype.getType = function () { - return "textbase"; - }; - QuestionTextBase.prototype.isEmpty = function () { - return _super.prototype.isEmpty.call(this) || this.value === ""; - }; - Object.defineProperty(QuestionTextBase.prototype, "textUpdateMode", { - /** - * Gets or sets a value that specifies how the question updates it's value. - * - * The following options are available: - * - `default` - get the value from survey.textUpdateMode - * - `onBlur` - the value is updated after an input loses the focus. - * - `onTyping` - update the value of text questions, "text" and "comment", on every key press. - * - * Note, that setting to "onTyping" may lead to a performance degradation, in case you have many expressions in the survey. - * @see survey.textUpdateMode - */ - get: function () { - return this.getPropertyValue("textUpdateMode"); - }, - set: function (val) { - this.setPropertyValue("textUpdateMode", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextBase.prototype, "isSurveyInputTextUpdate", { - get: function () { - if (this.textUpdateMode == "default") - return !!this.survey ? this.survey.isUpdateValueTextOnTyping : false; - return this.textUpdateMode == "onTyping"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextBase.prototype, "renderedPlaceHolder", { - get: function () { - return this.getPropertyValue("renderedPlaceHolder"); - }, - enumerable: false, - configurable: true - }); - QuestionTextBase.prototype.setRenderedPlaceHolder = function (val) { - this.setPropertyValue("renderedPlaceHolder", val); - }; - QuestionTextBase.prototype.onReadOnlyChanged = function () { - _super.prototype.onReadOnlyChanged.call(this); - this.calcRenderedPlaceHolder(); - }; - QuestionTextBase.prototype.onSurveyLoad = function () { - this.calcRenderedPlaceHolder(); - _super.prototype.onSurveyLoad.call(this); - }; - QuestionTextBase.prototype.localeChanged = function () { - _super.prototype.localeChanged.call(this); - this.calcRenderedPlaceHolder(); - }; - QuestionTextBase.prototype.calcRenderedPlaceHolder = function () { - var res = this.placeHolder; - if (!!res && !this.hasPlaceHolder()) { - res = undefined; - } - this.setRenderedPlaceHolder(res); - }; - QuestionTextBase.prototype.hasPlaceHolder = function () { - return !this.isReadOnly; - }; - QuestionTextBase.prototype.getControlClass = function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__["CssClassBuilder"]() - .append(this.cssClasses.root) - .append(this.cssClasses.onError, this.errors.length > 0) - .append(this.cssClasses.controlDisabled, this.isReadOnly) - .toString(); - }; - return QuestionTextBase; - }(_question__WEBPACK_IMPORTED_MODULE_0__["Question"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("textbase", [], function () { - return new QuestionTextBase(""); - }, "question"); - - - /***/ }), - - /***/ "./src/questionfactory.ts": - /*!********************************!*\ - !*** ./src/questionfactory.ts ***! - \********************************/ - /*! exports provided: QuestionFactory, ElementFactory */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionFactory", function() { return QuestionFactory; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ElementFactory", function() { return ElementFactory; }); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - - - //TODO replace completely with ElementFactory - var QuestionFactory = /** @class */ (function () { - function QuestionFactory() { - this.creatorHash = {}; - } - Object.defineProperty(QuestionFactory, "DefaultChoices", { - get: function () { - return [ - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("choices_Item") + "1", - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("choices_Item") + "2", - _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("choices_Item") + "3", - ]; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionFactory, "DefaultColums", { - get: function () { - var colName = _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("matrix_column") + " "; - return [colName + "1", colName + "2", colName + "3"]; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionFactory, "DefaultRows", { - get: function () { - var rowName = _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("matrix_row") + " "; - return [rowName + "1", rowName + "2"]; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionFactory, "DefaultMutlipleTextItems", { - get: function () { - var itemName = _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("multipletext_itemname"); - return [itemName + "1", itemName + "2"]; - }, - enumerable: false, - configurable: true - }); - QuestionFactory.prototype.registerQuestion = function (questionType, questionCreator) { - this.creatorHash[questionType] = questionCreator; - }; - QuestionFactory.prototype.unregisterElement = function (elementType) { - delete this.creatorHash[elementType]; - }; - QuestionFactory.prototype.clear = function () { - this.creatorHash = {}; - }; - QuestionFactory.prototype.getAllTypes = function () { - var result = new Array(); - for (var key in this.creatorHash) { - result.push(key); - } - return result.sort(); - }; - QuestionFactory.prototype.createQuestion = function (questionType, name) { - var creator = this.creatorHash[questionType]; - if (creator == null) - return null; - return creator(name); - }; - QuestionFactory.Instance = new QuestionFactory(); - return QuestionFactory; - }()); - - var ElementFactory = /** @class */ (function () { - function ElementFactory() { - this.creatorHash = {}; - } - ElementFactory.prototype.registerElement = function (elementType, elementCreator) { - this.creatorHash[elementType] = elementCreator; - }; - ElementFactory.prototype.clear = function () { - this.creatorHash = {}; - }; - ElementFactory.prototype.unregisterElement = function (elementType, removeFromSerializer) { - if (removeFromSerializer === void 0) { removeFromSerializer = false; } - delete this.creatorHash[elementType]; - QuestionFactory.Instance.unregisterElement(elementType); - if (removeFromSerializer) { - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].removeClass(elementType); - } - }; - ElementFactory.prototype.getAllTypes = function () { - var result = QuestionFactory.Instance.getAllTypes(); - for (var key in this.creatorHash) { - result.push(key); - } - return result.sort(); - }; - ElementFactory.prototype.createElement = function (elementType, name) { - var creator = this.creatorHash[elementType]; - if (creator == null) - return QuestionFactory.Instance.createQuestion(elementType, name); - return creator(name); - }; - ElementFactory.Instance = new ElementFactory(); - return ElementFactory; - }()); - - - - /***/ }), - - /***/ "./src/questionnonvalue.ts": - /*!*********************************!*\ - !*** ./src/questionnonvalue.ts ***! - \*********************************/ - /*! exports provided: QuestionNonValue */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionNonValue", function() { return QuestionNonValue; }); - /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question */ "./src/question.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - /** - * A Model for non value question. This question doesn't add any new functionality. It hides some properties, including the value. - */ - var QuestionNonValue = /** @class */ (function (_super) { - __extends(QuestionNonValue, _super); - function QuestionNonValue(name) { - return _super.call(this, name) || this; - } - QuestionNonValue.prototype.getType = function () { - return "nonvalue"; - }; - Object.defineProperty(QuestionNonValue.prototype, "hasInput", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionNonValue.prototype, "hasTitle", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - QuestionNonValue.prototype.getTitleLocation = function () { - return ""; - }; - Object.defineProperty(QuestionNonValue.prototype, "hasComment", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - QuestionNonValue.prototype.hasErrors = function (fireCallback, rec) { - return false; - }; - QuestionNonValue.prototype.getAllErrors = function () { - return []; - }; - QuestionNonValue.prototype.supportGoNextPageAutomatic = function () { - return false; - }; - QuestionNonValue.prototype.addConditionObjectsByContext = function (objects, context) { }; - QuestionNonValue.prototype.getConditionJson = function (operator, path) { - return null; - }; - return QuestionNonValue; - }(_question__WEBPACK_IMPORTED_MODULE_0__["Question"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("nonvalue", [ - { name: "title", visible: false }, - { name: "description", visible: false }, - { name: "valueName", visible: false }, - { name: "enableIf", visible: false }, - { name: "defaultValue", visible: false }, - { name: "correctAnswer", visible: false }, - { name: "isRequired", visible: false, isSerializable: false }, - { name: "requiredErrorText", visible: false }, - { name: "readOnly", visible: false }, - { name: "requiredIf", visible: false }, - { name: "validators", visible: false }, - { name: "titleLocation", visible: false }, - { name: "useDisplayValuesInTitle", visible: false }, - ], function () { - return new QuestionNonValue(""); - }, "question"); - - - /***/ }), - - /***/ "./src/rendererFactory.ts": - /*!********************************!*\ - !*** ./src/rendererFactory.ts ***! - \********************************/ - /*! exports provided: RendererFactory */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RendererFactory", function() { return RendererFactory; }); - var RendererFactory = /** @class */ (function () { - function RendererFactory() { - this.renderersHash = {}; - } - RendererFactory.prototype.unregisterRenderer = function (questionType, rendererAs) { - delete this.renderersHash[questionType][rendererAs]; - }; - RendererFactory.prototype.registerRenderer = function (questionType, renderAs, renderer) { - if (!this.renderersHash[questionType]) { - this.renderersHash[questionType] = {}; - } - this.renderersHash[questionType][renderAs] = renderer; - }; - RendererFactory.prototype.getRenderer = function (questionType, renderAs) { - return ((this.renderersHash[questionType] && - this.renderersHash[questionType][renderAs]) || - "default"); - }; - RendererFactory.prototype.getRendererByQuestion = function (question) { - return this.getRenderer(question.getType(), question.renderAs); - }; - RendererFactory.prototype.clear = function () { - this.renderersHash = {}; - }; - RendererFactory.Instance = new RendererFactory(); - return RendererFactory; - }()); - - - - /***/ }), - - /***/ "./src/settings.ts": - /*!*************************!*\ - !*** ./src/settings.ts ***! - \*************************/ - /*! exports provided: settings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; }); - /** - * Global survey settings - */ - var settings = { - /** - * Options for SurveyJS comparator. By default we trim strings and compare them as case insensitive. To change the behavior you can use following code: - * settings.comparator.trimStrings = false; //"abc " will not equal to "abc". They are equal by default. - * settings.comparator.caseSensitive = true; //"abc " will not equal to "Abc". They are equal by default. - */ - comparator: { - trimStrings: true, - caseSensitive: false - }, - /** - * The prefix that uses to store the question comment, as {questionName} + {commentPrefix}. - * The default - */ - commentPrefix: "-Comment", - /** - * Encode parameter on calling restful web API - */ - webserviceEncodeParameters: true, - /** - * Cache the result for choices getting from web services. Set this property to false, to disable the caching. - */ - useCachingForChoicesRestful: true, - get useCachingForChoicesRestfull() { - return settings.useCachingForChoicesRestful; - }, - set useCachingForChoicesRestfull(val) { - settings.useCachingForChoicesRestful = val; - }, - /** - * SurveyJS web service API url - */ - surveyServiceUrl: "https://api.surveyjs.io/public/v1/Survey", - /** - * separator that can allow to set value and text of ItemValue object in one string as: "value|text" - */ - itemValueSeparator: "|", - /** - * Set it to true to serialize itemvalue instance always as object even if text property is empty - * const item = new Survey.ItemValue(5); - * item.toJSON(); //will return {value: 5}, instead of 5 by default. - */ - itemValueAlwaysSerializeAsObject: false, - /** - * default locale name for localizable strings that uses during serialization, {"default": "My text", "de": "Mein Text"} - */ - defaultLocaleName: "default", - /** - * Default row name for matrix (single choice) - */ - matrixDefaultRowName: "default", - /** - * Default cell type for dropdown and dynamic matrices - */ - matrixDefaultCellType: "dropdown", - /** - * Total value postfix for dropdown and dynamic matrices. The total value stores as: {matrixName} + {postfix} - */ - matrixTotalValuePostFix: "-total", - /** - * Maximum row count in dynamic matrix - */ - matrixMaximumRowCount: 1000, - /** - * Maximum rowCount that returns in addConditionObjectsByContext function - */ - matrixMaxRowCountInCondition: 1, - /** - * Maximum panel count in dynamic panel - */ - panelMaximumPanelCount: 100, - /** - * Maximum rate value count in rating question - */ - ratingMaximumRateValueCount: 20, - /** - * Disable the question while choices are getting from the web service - */ - disableOnGettingChoicesFromWeb: false, - /** - * Set to true to always serialize the localization string as object even if there is only one value for default locale. Instead of string "MyStr" serialize as {default: "MyStr"} - */ - serializeLocalizableStringAsObject: false, - /** - * Set to false to hide empty page title and description in design mode - */ - allowShowEmptyTitleInDesignMode: true, - /** - * Set to false to hide empty page description in design mode - */ - allowShowEmptyDescriptionInDesignMode: true, - /** - * Set this property to true to execute the complete trigger on value change instead of on next page. - */ - executeCompleteTriggerOnValueChanged: false, - /** - * Set this property to false to execute the skip trigger on next page instead of on value change. - */ - executeSkipTriggerOnValueChanged: true, - /** - * Specifies how the input field of [Comment](https://surveyjs.io/Documentation/Library?id=questioncommentmodel) questions is rendered in the read-only mode. - * Available values: - * "textarea" (default) - A 'textarea' element is used to render a Comment question's input field. - * "div" - A 'div' element is used to render a Comment question's input field. - */ - readOnlyCommentRenderMode: "textarea", - /** - * Specifies how the input field of [Text](https://surveyjs.io/Documentation/Library?id=questiontextmodel) questions is rendered in the read-only mode. - * Available values: - * "input" (default) - An 'input' element is used to render a Text question's input field. - * "div" - A 'div' element is used to render a Text question's input field. - */ - readOnlyTextRenderMode: "input", - /** - * Override this function, set your function, if you want to show your own dialog confirm window instead of standard browser window. - * @param message - */ - confirmActionFunc: function (message) { - return confirm(message); - }, - /** - * Set this property to change the default value of the minWidth constraint - */ - minWidth: "300px", - /** - * Set this property to change the default value of the minWidth constraint - */ - maxWidth: "initial", - /** - * This property tells how many times survey re-run expressions on value changes during condition running. We need it to avoid recursions in the expressions - */ - maximumConditionRunCountOnValueChanged: 10, - /** - * By default visibleIndex for question with titleLocation = "hidden" is -1, and survey doesn't count these questions when set questions numbers. - * Set it true, and a question next to a question with hidden title will increase it's number. - */ - setQuestionVisibleIndexForHiddenTitle: false, - /** - * By default visibleIndex for question with hideNumber = true is -1, and survey doesn't count these questions when set questions numbers. - * Set it true, and a question next to a question with hidden title number will increase it's number. - */ - setQuestionVisibleIndexForHiddenNumber: false, - /** - * By default all rows are rendered no matters whwther they are visible. - * Set it true, and survey markup rows will be rendered only if they are visible in viewport. - * This feature is experimantal and might do not support all the use cases. - */ - lazyRowsRendering: false, - lazyRowsRenderingStartRow: 3, - /** - * By default checkbox and radiogroup items are ordered in rows. - * Set it "column", and items will be ordered in columns. - */ - showItemsInOrder: "default", - /** - * Supported validators by question types. You can modify this variable to add validators for new question types or add/remove for existing question types. - */ - supportedValidators: { - question: ["expression"], - comment: ["text", "regex"], - text: ["numeric", "text", "regex", "email"], - checkbox: ["answercount"], - }, - /** - * Set the value as string "yyyy-mm-dd". text questions with inputType "date" will not allow to set to survey date that less than this value - */ - minDate: "", - /** - * Set the value as string "yyyy-mm-dd". text questions with inputType "date" will not allow to set to survey date that greater than this value - */ - maxDate: "", - showModal: undefined, - supportCreatorV2: false, - /** - * Specifies a list of custom icons. - * Use this property to replace SurveyJS default icons (displayed in UI elements of SurveyJS Library or Creator) with your custom icons. - * For every default icon to replace, add a key/value object with the default icon's name as a key and the name of your custom icon as a value. - * For example: Survey.settings.customIcons["icon-redo"] = "my-own-redo-icon" - */ - customIcons: {}, - titleTags: { - survey: "h3", - page: "h4", - panel: "h4", - question: "h5", - } - }; - - - /***/ }), - - /***/ "./src/stylesmanager.ts": - /*!******************************!*\ - !*** ./src/stylesmanager.ts ***! - \******************************/ - /*! exports provided: StylesManager */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StylesManager", function() { return StylesManager; }); - /* harmony import */ var _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaultCss/cssstandard */ "./src/defaultCss/cssstandard.ts"); - - var StylesManager = /** @class */ (function () { - function StylesManager() { - this.sheet = null; - if (StylesManager.Enabled) { - this.sheet = StylesManager.findSheet(StylesManager.SurveyJSStylesSheetId); - if (!this.sheet) { - this.sheet = StylesManager.createSheet(StylesManager.SurveyJSStylesSheetId); - this.initializeStyles(this.sheet); - } - } - } - StylesManager.findSheet = function (styleSheetId) { - if (typeof document === "undefined") - return null; - for (var i = 0; i < document.styleSheets.length; i++) { - if (!!document.styleSheets[i].ownerNode && - document.styleSheets[i].ownerNode["id"] === styleSheetId) { - return document.styleSheets[i]; - } - } - return null; - }; - StylesManager.createSheet = function (styleSheetId) { - var style = document.createElement("style"); - style.id = styleSheetId; - // Add a media (and/or media query) here if you'd like! - // style.setAttribute("media", "screen") - // style.setAttribute("media", "only screen and (max-width : 1024px)") - style.appendChild(document.createTextNode("")); - document.head.appendChild(style); - return style.sheet; - }; - StylesManager.applyTheme = function (themeName, themeSelector) { - if (themeName === void 0) { themeName = "default"; } - if (themeSelector === void 0) { themeSelector = ".sv_main"; } - var ThemeCss; - if (themeName === "modern") - themeSelector = ".sv-root-modern "; - if (themeName === "defaultV2") { - _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_0__["surveyCss"].currentType = themeName; - return; - } - if (["bootstrap", "bootstrapmaterial", "modern"].indexOf(themeName) !== -1) { - ThemeCss = StylesManager[themeName + "ThemeCss"]; - _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_0__["surveyCss"].currentType = themeName; - } - else { - ThemeCss = StylesManager.ThemeCss; - _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_0__["surveyCss"].currentType = "standard"; - } - if (StylesManager.Enabled) { - var styleSheetId = (themeName + themeSelector).trim(); - var sheet_1 = StylesManager.findSheet(styleSheetId); - if (!sheet_1) { - sheet_1 = StylesManager.createSheet(styleSheetId); - var theme_1 = StylesManager.ThemeColors[themeName] || - StylesManager.ThemeColors["default"]; - Object.keys(ThemeCss).forEach(function (selector) { - var cssRuleText = ThemeCss[selector]; - Object.keys(theme_1).forEach(function (colorVariableName) { - return (cssRuleText = cssRuleText.replace(new RegExp("\\" + colorVariableName, "g"), theme_1[colorVariableName])); - }); - try { - sheet_1.insertRule(themeSelector + selector + " { " + cssRuleText + " }", 0); - } - catch (e) { } - }); - } - } - }; - StylesManager.prototype.initializeStyles = function (sheet) { - if (StylesManager.Enabled) { - Object.keys(StylesManager.Styles).forEach(function (selector) { - try { - sheet.insertRule(selector + " { " + StylesManager.Styles[selector] + " }", 0); - } - catch (e) { } - }); - Object.keys(StylesManager.Media).forEach(function (selector) { - try { - sheet.insertRule(StylesManager.Media[selector].media + - " { " + - selector + - " { " + - StylesManager.Media[selector].style + - " } }", 0); - } - catch (e) { } - }); - } - }; - StylesManager.SurveyJSStylesSheetId = "surveyjs-styles"; - StylesManager.Styles = { - // ".sv_bootstrap_css": - // "position: relative; width: 100%; background-color: #f4f4f4", - // ".sv_bootstrap_css .sv_custom_header": - // "position: absolute; width: 100%; height: 275px; background-color: #e7e7e7;", - // ".sv_bootstrap_css .sv_container": - // "max-width: 80%; margin: auto; position: relative; color: #6d7072; padding: 0 1em;", - // ".sv_bootstrap_css .panel-body": - // "background-color: white; padding: 1em 1em 5em 1em; border-top: 2px solid lightgray;", - ".sv_main span": "word-break: break-word;", - ".sv_main legend": "border: none; margin: 0;", - ".sv_bootstrap_css .sv_qstn": "padding: 0.5em 1em 1.5em 1em;", - ".sv_bootstrap_css .sv_qcbc input[type=checkbox], .sv_bootstrap_css .sv_qcbc input[type=radio]": "vertical-align: middle; margin-top: -1px", - ".sv_bootstrap_css .sv_qstn fieldset": "display: block;", - ".sv_bootstrap_css .sv_qstn .sv_q_checkbox_inline, .sv_bootstrap_css .sv_qstn .sv_q_radiogroup_inline": "display: inline-block;", - ".sv_bootstrap_css .sv-paneldynamic__progress-container ": "position: relative; margin-right: 250px; margin-left: 40px; margin-top: 10px;", - ".sv_main.sv_bootstrapmaterial_css .sv_q_radiogroup_control_label": "display: inline; position: static;", - ".sv_main.sv_bootstrapmaterial_css .checkbox": "margin-top:10px;margin-bottom:10px;", - ".sv_row": "clear: both; min-width:300px;", - ".sv_row .sv_qstn": "float: left", - ".sv_row .sv_qstn:last-child": "float: none", - ".sv_qstn": "display: vertical-align: top; overflow: auto; min-width:300px;", - ".sv_p_container": "display: vertical-align: top; min-width:300px;", - ".sv_q_title .sv_question_icon": "float: right; margin-right: 1em;", - ".sv_q_title .sv_question_icon::before": "content: ''; background-repeat: no-repeat; background-position: center; padding: 0.5em; display: inline-block; background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMi4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAxMCAxMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTAgMTA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOiM2RDcwNzI7fQ0KPC9zdHlsZT4NCjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMiwyIDAsNCA1LDkgMTAsNCA4LDIgNSw1ICIvPg0KPC9zdmc+DQo=);", - ".sv_q_title .sv_question_icon.sv_expanded::before": "transform: rotate(180deg);", - ".sv_qbln .checkbox-material": "margin-right: 3px;", - ".sv_qcbx .checkbox-material": "margin-right: 5px;", - ".sv_qcbx .checkbox label": "justify-content: left; display: inline-block;", - ".sv_qstn .radio label": "justify-content: left; display: inline-block;", - ".sv_qstn .sv_q_imgsel > label img": "pointer-events: none;", - ".sv_qstn .sv_q_imgsel.sv_q_imagepicker_inline": "display: inline-block;", - ".sv_qstn label.sv_q_m_label": "position: absolute; margin: 0; display: block; width: 100%;", - ".sv_qstn td": "position: relative;", - ".sv_q_mt": "table-layout: fixed;", - ".sv_q_mt_label": "display: flex; align-items: center; font-weight: inherit;", - ".sv_q_mt_title": "margin-right: 0.5em; width: 33%;", - ".sv_q_mt_item": "flex: 1;", - ".sv_q_mt_item_value": "float: left;", - '[dir="rtl"] .sv_q_mt_item_value': "float: right;", - ".sv_qstn.sv_qstn_left": "margin-top: 0.75em;", - ".sv_qstn .title-left": "float: left; margin-right: 1em; max-width: 50%", - '[dir="rtl"] .sv_qstn .title-left': "float: right; margin-left: 1em;", - ".sv_qstn .content-left": "overflow: hidden", - ".sv_q_radiogroup_inline .sv_q_radiogroup_other": "display: inline-block;", - ".sv_q_checkbox_inline .sv_q_checkbox_other": "display: inline-block;", - ".sv_q_checkbox_inline, .sv_q_radiogroup_inline, .sv_q_imagepicker_inline": "line-height: 2.5em;", - ".form-inline .sv_q_checkbox_inline:not(:last-child)": "margin-right: 1em;", - ".form-inline .sv_q_radiogroup_inline:not(:last-child)": "margin-right: 1em;", - ".sv_imgsel .sv_q_imagepicker_inline:not(:last-child)": "margin-right: 1em;", - ".sv_qstn fieldset": "border: none; margin: 0; padding: 0;", - ".sv_qstn .sv_q_file_placeholder": "display:none", - ".sv_p_title": "padding-left: 1em; padding-bottom: 0.3em;", - ".sv_p_title_expandable": "cursor: pointer;", - ".sv_q_title_expandable": "cursor: pointer;", - ".sv_p_title .sv_panel_icon": "float: right; margin-right: 1em;", - ".sv_p_title .sv_panel_icon::before": "content: ''; background-repeat: no-repeat; background-position: center; padding: 0.5em; display: inline-block; background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMi4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAxMCAxMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTAgMTA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOiM2RDcwNzI7fQ0KPC9zdHlsZT4NCjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMiwyIDAsNCA1LDkgMTAsNCA4LDIgNSw1ICIvPg0KPC9zdmc+DQo=);", - ".sv_p_title .sv_panel_icon.sv_expanded::before": "transform: rotate(180deg);", - ".sv_p_footer": "padding-left: 1em; padding-bottom: 1em;padding-top: 1em;", - ".sv_matrix_cell_detail_button": "position: relative", - ".sv_detail_panel_icon": "display: block; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 14px; height: 14px;", - ".sv_detail_panel_icon::before": "content: ''; background-repeat: no-repeat; background-position: center; width: 14px; height: 14px; display: block; transform: rotate(270deg); background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 15 15' style='enable-background:new 0 0 15 15;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%23FFFFFF;%7D%0A%3C/style%3E%3Cpolygon class='st0' points='14,5.5 12.6,4.1 7.5,9.1 2.4,4.1 1,5.5 7.5,12 '/%3E%3C/svg%3E%0A\");", - ".sv_detail_panel_icon.sv_detail_expanded::before": "transform: rotate(0deg)", - ".sv_matrix_empty_rows_section": "text-align: center; vertical-align: middle;", - ".sv_matrix_empty_rows_text": "padding:20px", - ".sv_q_file > input[type=file], .sv_q_file > button": "display: inline-block;", - ".sv_q_file_preview": "display: inline-block; vertical-align: top; border: 1px solid lightgray; padding: 5px; margin-top: 10px;", - ".sv_q_file_preview > a": "display: block; overflow: hidden; vertical-align: top; white-space: nowrap; text-overflow: ellipsis;", - ".sv_q_file_remove_button": "line-height: normal;", - ".sv_q_file_remove": "display: block; cursor: pointer;", - ".sv_q_m_cell_text": "cursor: pointer;", - ".sv_q_dd_other": "margin-top: 1em;", - ".sv_q_dd_other input": "width: 100%;", - ".sv_qstn .sv-q-col-1, .sv-question .sv-q-col-1": "width: 100%; display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", - ".sv_qstn .sv-q-col-2, .sv-question .sv-q-col-2": "width: calc(50% - 1em); display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", - ".sv_qstn .sv-q-col-3, .sv-question .sv-q-col-3": "width: calc(33.33333% - 1em); display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", - ".sv_qstn .sv-q-col-4, .sv-question .sv-q-col-4": "width: calc(25% - 1em); display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", - ".sv_qstn .sv-q-col-5, .sv-question .sv-q-col-5": "width: calc(20% - 1em); display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", - ".sv_qstn .sv-q-column-1, .sv-question .sv-q-column-1": "width: 100%; max-width: 100%; display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", - ".sv_qstn .sv-q-column-2, .sv-question .sv-q-column-2": "max-width: 50%; display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", - ".sv_qstn .sv-q-column-3, .sv-question .sv-q-column-3": "max-width: 33.33333%; display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", - ".sv_qstn .sv-q-column-4, .sv-question .sv-q-column-4": "max-width: 25%; display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", - ".sv_qstn .sv-q-column-5, .sv-question .sv-q-column-5": "max-width: 20%; display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", - ".sv_qstn .sv_q_file_input": "color: transparent;", - ".sv_qstn .sv_q_imgsel label > div": "overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 4px; border: 1px solid lightgray; border-radius: 4px;", - ".sv_qstn .sv_q_imgsel label > div > img, .sv_qstn .sv_q_imgsel label > div > embed": "display: block;", - ".sv_qstn table tr td .sv_q_m_cell_label": "position: absolute; left: 0; right: 0; top: 0; bottom: 0;", - "f-panel": "padding: 0.5em 1em; display: inline-block; line-height: 2em;", - ".sv_progress_bar > span": "white-space: nowrap;", - //progress buttons - ".sv_progress-buttons__container-center": "text-align: center;", - ".sv_progress-buttons__container": "display: inline-block; font-size: 0; width: 100%; max-width: 1100px; white-space: nowrap; overflow: hidden;", - ".sv_progress-buttons__image-button-left": "display: inline-block; vertical-align: top; margin-top: 22px; font-size: 14px; width: 16px; height: 16px; cursor: pointer; background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMi4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwb2x5Z29uIHBvaW50cz0iMTEsMTIgOSwxNCAzLDggOSwyIDExLDQgNyw4ICIvPg0KPC9zdmc+DQo=);", - ".sv_progress-buttons__image-button-right": "display: inline-block; vertical-align: top; margin-top: 22px; font-size: 14px; width: 16px; height: 16px; cursor: pointer; background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMi4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwb2x5Z29uIHBvaW50cz0iNSw0IDcsMiAxMyw4IDcsMTQgNSwxMiA5LDggIi8+DQo8L3N2Zz4NCg==);", - ".sv_progress-buttons__image-button--hidden": "visibility: hidden;", - ".sv_progress-buttons__list-container": "max-width: calc(100% - 36px); display: inline-block; overflow: hidden;", - ".sv_progress-buttons__list": "display: inline-block; width: max-content; padding-left: 28px; padding-right: 28px; margin-top: 14px; margin-bottom: 14px;", - ".sv_progress-buttons__list li": "width: 138px; font-size: 14px; font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; position: relative; text-align: center; vertical-align: top; display: inline-block;", - ".sv_progress-buttons__list li:before": "width: 24px; height: 24px; content: ''; line-height: 30px; display: block; margin: 0 auto 10px auto; border: 3px solid; border-radius: 50%; box-sizing: content-box; cursor: pointer;", - ".sv_progress-buttons__list li:after": "width: 73%; height: 3px; content: ''; position: absolute; top: 15px; left: -36.5%;", - ".sv_progress-buttons__list li:first-child:after": "content: none;", - ".sv_progress-buttons__list .sv_progress-buttons__page-title": "width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: bold;", - ".sv_progress-buttons__list .sv_progress-buttons__page-description": "width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;", - ".sv_progress-buttons__list li.sv_progress-buttons__list-element--nonclickable:before": "cursor: not-allowed;", - // ranking - ".sv-ranking": "outline: none; user-select: none; touch-action: none;", - ".sv-ranking-item": "cursor: pointer; margin-bottom: 5px;position: relative;", - ".sv-ranking-item:focus .sv-ranking-item__icon--hover": "visibility: hidden;", - ".sv-ranking-item:hover .sv-ranking-item__icon--hover": "visibility: visible;", - ".sv-question--disabled .sv-ranking-item:hover .sv-ranking-item__icon--hover": "visibility: hidden;", - ".sv-ranking-item:focus": "outline: none;", - ".sv-ranking-item:focus .sv-ranking-item__icon--focus": "visibility: visible; top: 15px;", - ".sv-ranking-item:focus .sv-ranking-item__index": "background: white; border: 2px solid #19b394;", - ".sv-ranking-item__content": "display: inline-block;background-color: white;padding-top: 5px;padding-bottom: 5px;padding-left: 35px;padding-right: 10px; border-radius: 100px;", - ".sv-ranking-item__icon-container": "position: absolute;left: 0;top: 0;bottom: 0;width: 35px;", - ".sv-ranking-item__icon": "visibility: hidden;left:10px;top:20px;fill:#19b394;position: absolute;", - ".sv-ranking-item__index": "display: inline-block;padding: 10px 16px;background: rgba(25, 179, 148, 0.1);border-radius: 100px;border: 2px solid transparent; margin-right: 10px;", - ".sv-ranking-item__text": "display: inline-block;", - ".sv-ranking-item__ghost": "display: none;background: #f3f3f3;border-radius: 100px;width: 200px;height: 55px;z-index: 1;position: absolute;left: 35px;", - ".sv-ranking-item--ghost .sv-ranking-item__ghost": "display: block;", - ".sv-ranking-item--ghost .sv-ranking-item__content": "visibility: hidden;", - ".sv-ranking-item--drag .sv-ranking-item__content": "box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.1);border-radius: 100px;", - ".sv-ranking--drag .sv-ranking-item:hover .sv-ranking-item__icon": "visibility: hidden;", - ".sv-ranking-item--drag .sv-ranking-item__icon--hover": "visibility: visible;", - ".sv-ranking--mobile .sv-ranking-item__icon--hover": "visibility:visible; fill:#9f9f9f;", - ".sv-ranking--mobile.sv-ranking--drag .sv-ranking-item--ghost .sv-ranking-item__icon.sv-ranking-item__icon--hover": "visibility:hidden;", - // EO ranking - // drag drop - ".sv-dragged-element-shortcut": "height: 24px; min-width: 100px; border-radius: 36px; background-color: white; padding: 16px; cursor: grabbing; position: absolute; z-index: 1000; box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.1); font-family: 'Open Sans'; font-size: 16px; padding-left: 20px;line-height: 24px;", - // EO drag drop - ".sv_qstn .sv_q_select_column": "display: inline-block; vertical-align: top; min-width: 10%;", - ".sv_qstn .sv_q_select_column > *:not(.sv_technical)": "display: block;", - ".sv_main .sv_container .sv_body .sv_p_root .sv_qstn .sv_q_select_column textarea": "margin-left: 0; padding-left: 0; line-height: initial;", - ".sv_main .sv-hidden": "display: none !important;", - ".sv_main .sv-visuallyhidden": "position: absolute; height: 1px !important; width: 1px !important; overflow: hidden; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px);", - // paneldynamic progress - ".sv_main .sv-progress": "height: 0.19em; background-color: $header-background-color; position: relative;", - ".sv_main .sv-progress__bar": "background-color: $main-color; height: 100%; position: relative;", - // EO paneldynamic progress - // paneldynamic - ".sv_main .sv-paneldynamic__progress-container": "position: relative; display: inline-block; width: calc(100% - 250px); margin-top: 20px;", - ".sv_main .sv-paneldynamic__add-btn": "float: right;", - ".sv_main .sv-paneldynamic__add-btn--list-mode": "float: none; margin-top: 0;", - ".sv_main .sv-paneldynamic__remove-btn": "margin-top: 1.25em;", - ".sv_main .sv-paneldynamic__remove-btn--right": "margin-top: 0; margin-left: 1.25em;", - ".sv_main .sv-paneldynamic__prev-btn, .sv_main .sv-paneldynamic__next-btn": "box-sizing: border-box; display: inline-block; cursor: pointer; width: 0.7em; top: -0.28em; position: absolute;", - ".sv_main .sv-paneldynamic__prev-btn": "left: -1.3em; transform: rotate(90deg);", - ".sv_main .sv-paneldynamic__next-btn ": "right: -1.3em; transform: rotate(270deg);", - ".sv_main .sv-paneldynamic__prev-btn.sv-paneldynamic__prev-btn--disabled, .sv_main .sv-paneldynamic__next-btn.sv-paneldynamic__next-btn--disabled": "cursor: auto;", - ".sv_main .sv-paneldynamic__progress-text": "font-weight: bold; font-size: 0.87em; margin-top: 0.69em; margin-left: 4em", - // EO paneldynamic - //boolean - ".sv_main .sv-boolean__switch": "display: inline-block; box-sizing: border-box; width: 63px; height: 24px; margin-right: 17px; margin-left: 21px; padding: 2px 3px; vertical-align: middle; border-radius: 12px; cursor: pointer;", - ".sv_main .sv-boolean__slider": "display: inline-block; width: 20px; height: 20px; transition-duration: .4s; transition-property: margin-left; border: none; border-radius: 100%;", - ".sv_main .sv-boolean__label": "vertical-align: middle; cursor: pointer;", - ".sv_main .sv-boolean--indeterminate .sv-boolean__slider": "margin-left: calc(50% - 10px);", - ".sv_main .sv-boolean--checked .sv-boolean__slider": "margin-left: calc(100% - 20px);", - "[dir='rtl'] .sv-boolean__label ": "float: right;", - "[dir='rtl'] .sv-boolean--indeterminate .sv-boolean__slider": "margin-right: calc(50% - 0.625em);", - "[dir='rtl'] .sv-boolean--checked .sv-boolean__slider": "margin-right: calc(100% - 1.25em);", - "[dir='rtl'] .sv-boolean__switch": "float: right;", - "[style*='direction:rtl'] .sv-boolean__label ": "float: right;", - "[style*='direction:rtl'] .sv-boolean--indeterminate .sv-boolean__slider": "margin-right: calc(50% - 0.625em);", - "[style*='direction:rtl'] .sv-boolean--checked .sv-boolean__slider": "margin-right: calc(100% - 1.25em);", - "[style*='direction:rtl'] .sv-boolean__switch": "float: right;", - // EO boolean - ".sv_main .sv_q_num": "", - ".sv_main .sv_q_num + span": "", - // SignaturePad - ".sv_main .sjs_sp_container": "position: relative; box-sizing: content-box;", - ".sv_main .sjs_sp_controls": "position: absolute; left: 0; bottom: 0;", - ".sv_main .sjs_sp_controls > button": "user-select: none;", - ".sv_main .sjs_sp_container>div>canvas:focus": "outline: none;", - ".sv_main .sjs_sp_placeholder": "display: flex; align-items: center; justify-content: center; position: absolute; z-index: 0; user-select: none; pointer-events: none; width: 100%; height: 100%;", - // logo - // ".sv_main .sv_header": "white-space: nowrap;", - ".sv_main .sv_logo": "", - ".sv_main .sv-logo--left": "display: inline-block; vertical-align: top; margin-right: 2em;", - ".sv_main .sv-logo--right": "display: inline-block; vertical-align: top; margin-left: 2em; ", - ".sv_main .sv-logo--top": "display: block; width: 100%; text-align: center;", - ".sv_main .sv-logo--bottom": "display: block; width: 100%; text-align: center;", - ".sv_main .sv_header__text": "display: inline-block; vertical-align: top; max-width: 100%; width: 100%", - ".sv_main .sv-expand-action:before": "content: \"\"; display: inline-block; background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 10 10' style='enable-background:new 0 0 10 10;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%23404040;%7D%0A%3C/style%3E%3Cpolygon class='st0' points='2,2 0,4 5,9 10,4 8,2 5,5 '/%3E%3C/svg%3E%0A\"); background-repeat: no-repeat; background-position: center center; height: 10px; width: 12px; margin: auto 8px;", - ".sv_main .sv-expand-action--expanded:before": "transform: rotate(180deg);", - ".sv_main .sv-action-bar": "display: flex; position: relative; align-items: center; margin-left: auto; padding: 0 0 0 16px; overflow: hidden; white-space: nowrap;", - ".sv_main .sv-action-bar-separator": "display: inline-block; width: 1px; height: 24px; vertical-align: middle; margin-right: 16px; background-color: #d6d6d6;", - ".sv_main .sv-action-bar-item": "-webkit-appearance: none; -moz-appearance: none; appearance: none; display: flex; height: 40px; padding: 8px; box-sizing: border-box; margin-right: 16px; border: none; border-radius: 2px; background-color: transparent; cursor: pointer; line-height: 24px; font-size: 16px; overflow-x: hidden; white-space: nowrap; min-width: auto; font-weight: normal", - ".sv_main .sv-action-bar-item__title": "vertical-align: middle; white-space: nowrap;", - ".sv_main .sv-action-bar-item__title--with-icon": "margin-left: 8px;", - ".sv_main .sv-action__content": "display: flex; flex-direction: row; align-items: center;", - ".sv_main .sv-action__content > *": "flex: 0 0 auto;", - ".sv_main .sv-action--hidden": "width: 0px; height: 0px; overflow: hidden;", - ".sv_main .sv-action-bar-item__icon svg": "display: block;", - ".sv_main .sv-action-bar-item:active": "opacity: 0.5;", - ".sv_main .sv-action-bar-item:focus": "outline: none;", - ".sv_main .sv-title-actions": "display: flex;align-items: center;", - ".sv_main .sv-title-actions__title": "flex-wrap: wrap; max-width: 90%; min-width: 50%;", - ".sv_main .sv-title-actions__bar": "min-width: 56px;", - ".sv_main .sv_matrix_cell_actions .sv-action-bar": "margin-left: 0; padding-left: 0;", - ".sv_main .sv_p_wrapper_in_row": "display: flex; flex-direction: row; align-items: center;", - ".sv_main .sv_p_remove_btn_right": "margin-left: 1em;", - //button-group - ".sv_main .sv-button-group": "display: flex; align-items: center; flex-direction: row; font-size: 16px; height: 48px; overflow: auto;", - ".sv_main .sv-button-group__item": "display: flex; box-sizing: border-box; flex-direction: row; justify-content: center; align-items: center; width: 100%; padding: 11px 16px; line-height: 24px; border-width: 1px; border-style: solid; outline: none; font-size: 16px; font-weight: 400; cursor: pointer; overflow: hidden;", - ".sv_main .sv-button-group__item:not(:first-of-type)": "margin-left: -1px;", - ".sv_main .sv-button-group__item-icon": "display: block; height: 24px;", - ".sv_main .sv-button-group__item--selected": "font-weight: 600;", - ".sv_main .sv-button-group__item-decorator": "display: flex; align-items: center; max-width: 100%;", - ".sv_main .sv-button-group__item-icon + .sv-button-group__item-caption": "margin-left: 8px", - ".sv_main .sv-button-group__item-caption": "display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;", - ".sv_main .sv-button-group__item--disabled": "color: cursor: default;", - //eo button-group - //popup - "sv-popup": "display: block; position: absolute; z-index: -1;", - ".sv-popup": "position: fixed; left: 0; top: 0; z-index: 1000; width: 100vw; height: 100vh; outline: none;", - ".sv-popup--modal": "display: flex; align-items: center; justify-content: center;", - ".sv-popup--modal .sv-popup__container": "position: static; filter: none; padding: calc(4 * 8px);", - ".sv-popup__container": "position: absolute; filter: drop-shadow(0px calc(1 * 8px) calc(2 * 8px) rgba(0, 0, 0, 0.1)); padding: calc(1 * 8px) 0; background: white; border-radius: 4px; display: flex; flex-direction: column; max-height: 90vh; max-width: 90vw; box-sizing: border-box;", - ".sv-popup__scrolling-content": "overflow: auto;", - ".sv-popup__scrolling-content::-webkit-scrollbar": "height: 6px; width: 6px; background-color: #f3f3f3;", - ".sv-popup__scrolling-content::-webkit-scrollbar-thumb": "background: rgba(25, 179, 148, 0.1);", - ".sv-popup__content": "min-width: 100%;", - ".sv-popup--show-pointer.sv-popup--top": "transform: translateY(calc(-1 * 8px));", - ".sv-popup--show-pointer.sv-popup--top .sv-popup__pointer": "transform: translate(calc(-1 * 8px)) rotate(180deg);", - ".sv-popup--show-pointer.sv-popup--bottom": "transform: translateY(calc(1 * 8px));", - ".sv-popup--show-pointer.sv-popup--bottom .sv-popup__pointer": "transform: translate(calc(-1 * 8px), calc(-1 * 8px));", - ".sv-popup--show-pointer.sv-popup--right": "transform: translate(calc(1 * 8px));", - ".sv-popup--show-pointer.sv-popup--right .sv-popup__pointer": "transform: translate(-12px, -4px) rotate(-90deg);", - ".sv-popup--show-pointer.sv-popup--left": "transform: translate(calc(-1 * 8px));", - ".sv-popup--show-pointer.sv-popup--left .sv-popup__pointer": "transform: translate(-4px, -4px) rotate(90deg);", - ".sv-popup__pointer": "display: block; position: absolute;", - ".sv-popup__pointer:after": "content: ' '; display: block; width: 0; height: 0; border-left: calc(1 * 8px) solid transparent; border-right: calc(1 * 8px) solid transparent; border-bottom: calc(1 * 8px) solid white; align-self: center;", - ".sv-popup__header": "font-family: Open Sans; font-size: calc(3 * 8px); line-height: calc(4 * 8px); font-style: normal; font-weight: 700; margin-bottom: calc(2 * 8px); color: rgb(22, 22, 22)", - ".sv-popup__footer": "display: flex; margin-top: calc(4 * 8px);", - ".sv-popup__footer-item:first-child": "margin-left: auto;", - ".sv-popup__footer-item + .sv-popup__footer-item": "margin-left: calc(1 * 8px);", - ".sv-popup__button": "padding: calc(2 * 8px) calc(6 * 8px); background: #fff; box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.15); border-radius: 4px; cursor: pointer; margin: 2px; font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-style: normal; font-weight: 600; font-size: calc(2 * 8px); line-height: calc(3 * 8px); text-align: center; color: #19b394; border: none; outline: none;", - ".sv-popup__button:hover": "box-shadow: 0 0 0 2px #19b394;", - ".sv-popup__button:disabled": "color: rgba(22, 22, 22, 0.16); cursor: default;", - ".sv-popup__button:disabled:hover": "box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.15);", - ".sv-popup__button.sv-popup__button--apply": "background-color: #19b394; color: #fff;", - ".sv-popup__button.sv-popup__button--apply:disabled": "background-color: #f3f3f3;", - //eo popup - //list - ".sv-list": "display: flex; flex-direction: column; align-items: flex-start; padding: 0; margin: 0; background: #ffffff; font-family: 'Open Sans'; list-style-type: none;", - ".sv-list__item": "width: 100%; display: flex; align-items: center; box-sizing: border-box; padding: calc(1 * 8px) calc(2 * 8px); cursor: pointer;", - ".sv-list__item-icon": "float: left; width: calc(3 * 8px); height: calc(3 * 8px); margin-right: calc(2 * 8px);", - ".sv-list__item-icon svg": "display: block;", - ".sv-list__item-icon use": "fill: #909090;", - ".sv-list__item:not(.sv-list__item--selected):hover": "background-color: #f3f3f3;", - ".sv-list__item--selected": "background-color: #19b394; color: #fff;", - ".sv-list__item--selected .sv-list__item-icon use": "fill: #fff;", - ".sv-list__item--disabled": "color: rgba(22, 22, 22, 0.16); cursor: default; pointer-events: none;", - ".sv-list__item span": "white-space: nowrap;", - ".sv-list__input": "-webkit-appearance: none; -moz-appearance: none; appearance: none; display: block; box-sizing: border-box; width: 100%; height: calc(2em + 1px); padding-left: 1em; outline: none; font-size: 1em; border: 1px solid transparent;", - //eo list - ".sv-skeleton-element": "min-height: 50px;", - }; - StylesManager.Media = { - ".sv_qstn fieldset .sv-q-col-1": { - style: "width: 100%;", - media: "@media only screen and (max-width: 480px)", - }, - ".sv_qstn fieldset .sv-q-col-2": { - style: "width: 100%;", - media: "@media only screen and (max-width: 480px)", - }, - ".sv_qstn fieldset .sv-q-col-3": { - style: "width: 100%;", - media: "@media only screen and (max-width: 480px)", - }, - ".sv_qstn fieldset .sv-q-col-4": { - style: "width: 100%;", - media: "@media only screen and (max-width: 480px)", - }, - ".sv_qstn fieldset .sv-q-col-5": { - style: "width: 100%;", - media: "@media only screen and (max-width: 480px)", - }, - ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn": { - style: "display: block; width: 100% !important;", - media: "@media (max-width: 600px)", - }, - ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn .title-left": { - style: "float: none;", - media: "@media (max-width: 600px)", - }, - ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn .sv_q_radiogroup_inline, .sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn .sv_q_checkbox_inline, .sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn .sv_q_imagepicker_inline": { - style: "display: block;", - media: "@media (max-width: 600px)", - }, - ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.table": { - style: "display: block;", - media: "@media (max-width: 600px)", - }, - ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.table thead": { - style: "display: none;", - media: "@media (max-width: 600px)", - }, - ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.table tbody, .sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.table tr, .sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.table td": { - style: "display: block;", - media: "@media (max-width: 600px)", - }, - ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.table:not(.sv_q_matrix) td:before": { - style: "content: attr(title);", - media: "@media (max-width: 600px)", - }, - ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.sv_q_matrix td:after": { - style: "content: attr(title); padding-left: 1em", - media: "@media (max-width: 600px)", - }, - ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn .radio label, .sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn .checkbox label": { - style: "line-height: 12px; vertical-align: top;", - media: "@media (max-width: 600px)", - }, - ".sv_qstn label.sv_q_m_label": { - style: "display: inline;", - media: "@media (max-width: 600px)", - }, - ".sv_main .sv_custom_header": { - style: "display: none;", - media: "@media (max-width: 1300px)", - }, - ".sv_main .sv_container .sv_header h3": { - style: "font-size: 1.5em;", - media: "@media (max-width: 1300px)", - }, - ".sv_main .sv_container .sv_header h3 span": { - style: "font-size: 0.75em;", - media: "@media (max-width: 700px)", - }, - ".sv_main.sv_bootstrap_css .sv-progress__text": { - style: "margin-left: 8em;", - media: "@media (min-width: 768px)", - }, - ".sv_row": { - style: " display: flex; flex-wrap: wrap;", - media: "@supports (display: flex)", - }, - ".sv-vue-row-additional-div": { - style: " display: flex; flex-wrap: wrap; flex-basis: 100%; width: 100%;", - media: "@supports (display: flex)", - }, - ".sv-row > .sv-row__panel, .sv-row__question:not(:last-child)": { - style: "float: left;", - media: "@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)", - }, - "[dir='rtl'],[style*='direction:rtl'] .sv-row__question:not(:last-child)": { - style: "float: right;", - media: "@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)", - }, - ".sv-row > .sv-row__panel, .sv-row__question": { - style: "width: 100% !important; padding-right: 0 !important;", - media: "@media only screen and (max-width: 600px)", - }, - }; - StylesManager.ThemeColors = { - default: { - "$header-background-color": "#e7e7e7", - "$body-container-background-color": "#f4f4f4", - "$main-color": "#1ab394", - "$main-hover-color": "#0aa384", - "$body-background-color": "white", - "$inputs-background-color": "white", - "$text-color": "#6d7072", - "$text-input-color": "#6d7072", - "$header-color": "#6d7072", - "$border-color": "#e7e7e7", - "$error-color": "#ed5565", - "$error-background-color": "#fd6575", - "$progress-text-color": "#9d9d9d", - "$disable-color": "#dbdbdb", - "$disabled-label-color": "rgba(64, 64, 64, 0.5)", - "$slider-color": "white", - "$disabled-switch-color": "#9f9f9f", - "$disabled-slider-color": "#cfcfcf", - "$foreground-light": "#909090", - "$foreground-disabled": "#161616", - "$background-dim": "#f3f3f3", - "$progress-buttons-color": "#8dd9ca", - "$progress-buttons-line-color": "#d4d4d4" - }, - orange: { - "$header-background-color": "#4a4a4a", - "$body-container-background-color": "#f8f8f8", - "$main-color": "#f78119", - "$main-hover-color": "#e77109", - "$body-background-color": "white", - "$inputs-background-color": "white", - "$text-color": "#4a4a4a", - "$text-input-color": "#4a4a4a", - "$header-color": "#f78119", - "$border-color": "#e7e7e7", - "$error-color": "#ed5565", - "$error-background-color": "#fd6575", - "$progress-text-color": "#9d9d9d", - "$disable-color": "#dbdbdb", - "$disabled-label-color": "rgba(64, 64, 64, 0.5)", - "$slider-color": "white", - "$disabled-switch-color": "#9f9f9f", - "$disabled-slider-color": "#cfcfcf", - "$foreground-light": "#909090", - "$foreground-disabled": "#161616", - "$background-dim": "#f3f3f3", - "$progress-buttons-color": "#f7b781", - "$progress-buttons-line-color": "#d4d4d4" - }, - darkblue: { - "$header-background-color": "#d9d8dd", - "$body-container-background-color": "#f6f7f2", - "$main-color": "#3c4f6d", - "$main-hover-color": "#2c3f5d", - "$body-background-color": "white", - "$inputs-background-color": "white", - "$text-color": "#4a4a4a", - "$text-input-color": "#4a4a4a", - "$header-color": "#6d7072", - "$border-color": "#e7e7e7", - "$error-color": "#ed5565", - "$error-background-color": "#fd6575", - "$progress-text-color": "#9d9d9d", - "$disable-color": "#dbdbdb", - "$disabled-label-color": "rgba(64, 64, 64, 0.5)", - "$slider-color": "white", - "$disabled-switch-color": "#9f9f9f", - "$disabled-slider-color": "#cfcfcf", - "$foreground-light": "#909090", - "$foreground-disabled": "#161616", - "$background-dim": "#f3f3f3", - "$progress-buttons-color": "#839ec9", - "$progress-buttons-line-color": "#d4d4d4" - }, - darkrose: { - "$header-background-color": "#ddd2ce", - "$body-container-background-color": "#f7efed", - "$main-color": "#68656e", - "$main-hover-color": "#58555e", - "$body-background-color": "white", - "$inputs-background-color": "white", - "$text-color": "#4a4a4a", - "$text-input-color": "#4a4a4a", - "$header-color": "#6d7072", - "$border-color": "#e7e7e7", - "$error-color": "#ed5565", - "$error-background-color": "#fd6575", - "$progress-text-color": "#9d9d9d", - "$disable-color": "#dbdbdb", - "$disabled-label-color": "rgba(64, 64, 64, 0.5)", - "$slider-color": "white", - "$disabled-switch-color": "#9f9f9f", - "$disabled-slider-color": "#cfcfcf", - "$foreground-light": "#909090", - "$foreground-disabled": "#161616", - "$background-dim": "#f3f3f3", - "$progress-buttons-color": "#c6bed4", - "$progress-buttons-line-color": "#d4d4d4" - }, - stone: { - "$header-background-color": "#cdccd2", - "$body-container-background-color": "#efedf4", - "$main-color": "#0f0f33", - "$main-hover-color": "#191955", - "$body-background-color": "white", - "$inputs-background-color": "white", - "$text-color": "#0f0f33", - "$text-input-color": "#0f0f33", - "$header-color": "#0f0f33", - "$border-color": "#e7e7e7", - "$error-color": "#ed5565", - "$error-background-color": "#fd6575", - "$progress-text-color": "#9d9d9d", - "$disable-color": "#dbdbdb", - "$disabled-label-color": "rgba(64, 64, 64, 0.5)", - "$slider-color": "white", - "$disabled-switch-color": "#9f9f9f", - "$disabled-slider-color": "#cfcfcf", - "$foreground-light": "#909090", - "$foreground-disabled": "#161616", - "$background-dim": "#f3f3f3", - "$progress-buttons-color": "#747491", - "$progress-buttons-line-color": "#d4d4d4" - }, - winter: { - "$header-background-color": "#82b8da", - "$body-container-background-color": "#dae1e7", - "$main-color": "#3c3b40", - "$main-hover-color": "#1e1d20", - "$body-background-color": "white", - "$inputs-background-color": "white", - "$text-color": "#000", - "$text-input-color": "#000", - "$header-color": "#000", - "$border-color": "#e7e7e7", - "$error-color": "#ed5565", - "$error-background-color": "#fd6575", - "$disable-color": "#dbdbdb", - "$progress-text-color": "#9d9d9d", - "$disabled-label-color": "rgba(64, 64, 64, 0.5)", - "$slider-color": "white", - "$disabled-switch-color": "#9f9f9f", - "$disabled-slider-color": "#cfcfcf", - "$foreground-light": "#909090", - "$foreground-disabled": "#161616", - "$background-dim": "#f3f3f3", - "$progress-buttons-color": "#d1c9f5", - "$progress-buttons-line-color": "#d4d4d4" - }, - winterstone: { - "$header-background-color": "#323232", - "$body-container-background-color": "#f8f8f8", - "$main-color": "#5ac8fa", - "$main-hover-color": "#06a1e7", - "$body-background-color": "white", - "$inputs-background-color": "white", - "$text-color": "#000", - "$text-input-color": "#000", - "$header-color": "#000", - "$border-color": "#e7e7e7", - "$error-color": "#ed5565", - "$error-background-color": "#fd6575", - "$disable-color": "#dbdbdb", - "$progress-text-color": "#9d9d9d", - "$disabled-label-color": "rgba(64, 64, 64, 0.5)", - "$slider-color": "white", - "$disabled-switch-color": "#9f9f9f", - "$disabled-slider-color": "#cfcfcf", - "$foreground-light": "#909090", - "$foreground-disabled": "#161616", - "$background-dim": "#f3f3f3", - "$progress-buttons-color": "#acdcf2", - "$progress-buttons-line-color": "#d4d4d4" - }, - modern: { - "$main-color": "#1ab394", - "$add-button-color": "#1948b3", - "$remove-button-color": "#ff1800", - "$disable-color": "#dbdbdb", - "$progress-text-color": "#9d9d9d", - "$disabled-label-color": "rgba(64, 64, 64, 0.5)", - "$slider-color": "white", - "$disabled-switch-color": "#9f9f9f", - "$disabled-slider-color": "#cfcfcf", - "$error-color": "#d52901", - "$text-color": "#404040", - "$light-text-color": "#fff", - "$button-text-color": "#fff", - "$checkmark-color": "#fff", - "$matrix-text-checked-color": "#fff", - "$progress-buttons-color": "#8dd9ca", - "$progress-buttons-line-color": "#d4d4d4", - "$text-input-color": "#404040", - "$inputs-background-color": "transparent", - "$main-hover-color": "#9f9f9f", - "$body-container-background-color": "#f4f4f4", - "$text-border-color": "#d4d4d4", - "$disabled-text-color": "rgba(64, 64, 64, 0.5)", - "$border-color": "rgb(64, 64, 64, 0.5)", - "$dropdown-border-color": "#d4d4d4", - "$header-background-color": "#e7e7e7", - "$answer-background-color": "rgba(26, 179, 148, 0.2)", - "$error-background-color": "rgba(213, 41, 1, 0.2)", - "$radio-checked-color": "#404040", - "$clean-button-color": "#1948b3", - "$body-background-color": "#ffffff", - "$foreground-light": "#909090", - "$foreground-disabled": "#161616", - "$background-dim": "#f3f3f3", - }, - bootstrap: { - "$main-color": "#18a689", - "$text-color": "#404040;", - "$text-input-color": "#404040;", - "$progress-text-color": "#9d9d9d", - "$disable-color": "#dbdbdb", - "$header-background-color": "#e7e7e7", - "$disabled-label-color": "rgba(64, 64, 64, 0.5)", - "$slider-color": "white", - "$disabled-switch-color": "#9f9f9f", - "$disabled-slider-color": "#cfcfcf", - "$foreground-light": "#909090", - "$foreground-disabled": "#161616", - "$background-dim": "#f3f3f3", - "$progress-buttons-color": "#8dd6c7", - "$progress-buttons-line-color": "#d4d4d4", - }, - bootstrapmaterial: { - "$main-color": "#18a689", - "$text-color": "#404040;", - "$text-input-color": "#404040;", - "$progress-text-color": "#9d9d9d", - "$disable-color": "#dbdbdb", - "$header-background-color": "#e7e7e7", - "$disabled-label-color": "rgba(64, 64, 64, 0.5)", - "$slider-color": "white", - "$disabled-switch-color": "#9f9f9f", - "$disabled-slider-color": "#cfcfcf", - "$body-background-color": "#ffffff", - "$foreground-light": "#909090", - "$foreground-disabled": "#161616", - "$background-dim": "#f3f3f3", - "$progress-buttons-color": "#8dd6c7", - "$progress-buttons-line-color": "#d4d4d4", - }, - }; - StylesManager.ThemeCss = { - ".sv_default_css": "background-color: $body-container-background-color;", - ".sv_default_css hr": "border-color: $border-color;", - ".sv_default_css input[type='button'], .sv_default_css button": "color: $body-background-color; background-color: $main-color;", - ".sv_default_css input[type='button']:hover, .sv_default_css button:hover": "background-color: $main-hover-color;", - ".sv_default_css .sv_header": "color: $header-color;", - ".sv_default_css .sv_custom_header": "background-color: $header-background-color;", - ".sv_default_css .sv_container": "color: $text-color;", - ".sv_default_css .sv_body": "background-color: $body-background-color; border-color: $main-color;", - ".sv_default_css .sv_progress": "background-color: $border-color;", - ".sv_default_css .sv_progress_bar": "background-color: $main-color;", - ".sv_default_css .sv_progress-buttons__list li:before": "border-color: $progress-buttons-color; background-color: $progress-buttons-color;", - ".sv_default_css .sv_progress-buttons__list li:after": "background-color: $progress-buttons-line-color;", - ".sv_default_css .sv_progress-buttons__list .sv_progress-buttons__page-title": " color: $text-color;", - ".sv_default_css .sv_progress-buttons__list .sv_progress-buttons__page-description": " color: $text-color;", - ".sv_default_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed:before": "border-color: $main-color; background-color: $main-color;", - ".sv_default_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed + li:after": "background-color: $progress-buttons-color", - ".sv_default_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", - ".sv_default_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", - ".sv_default_css .sv_p_root > .sv_row": "border-color: $border-color;", - ".sv_default_css .sv_p_root > .sv_row:nth-child(odd)": "background-color: $body-background-color;", - ".sv_default_css .sv_p_root > .sv_row:nth-child(even)": "background-color: $body-container-background-color;", - ".sv_default_css .sv_q_other input": "color: $text-color; -webkit-text-fill-color: $text-color; border-color: $border-color; background-color: $inputs-background-color;", - ".sv_default_css .sv_q_text_root": "color: $text-color; -webkit-text-fill-color: $text-color; border-color: $border-color; background-color: $inputs-background-color;", - ".sv_default_css .sv_q_dropdown_control": "color: $text-input-color; border-color: $border-color; background-color: $inputs-background-color;", - ".sv_default_css input[type='text']": "color: $text-color; -webkit-text-fill-color: $text-color; border-color: $border-color; background-color: $inputs-background-color;", - ".sv_default_css select": "color: $text-color; border-color: $border-color; background-color: $inputs-background-color;", - ".sv_default_css textarea": "color: $text-input-color; -webkit-text-fill-color: $text-input-color; border-color: $border-color; background-color: $inputs-background-color;", - ".sv_default_css input:not([type='button']):not([type='reset']):not([type='submit']):not([type='image']):not([type='checkbox']):not([type='radio'])": "border: 1px solid $border-color; background-color: $inputs-background-color;color: $text-input-color; -webkit-text-fill-color: $text-input-color;", - ".sv_default_css input:not([type='button']):not([type='reset']):not([type='submit']):not([type='image']):not([type='checkbox']):not([type='radio']):focus": "border: 1px solid $main-color;", - ".sv_default_css .sv_container .sv_body .sv_p_root .sv_q .sv_select_wrapper .sv_q_dropdown_control ": "background-color: $inputs-background-color;", - ".sv_default_css .sv_q_other input:focus": "border-color: $main-color;", - ".sv_default_css .sv_q_text_root:focus": "border-color: $main-color;", - ".sv_default_css .sv_q_dropdown_control:focus": "border-color: $main-color;", - ".sv_default_css input[type='text']:focus": "border-color: $main-color;", - '.sv_default_css .sv_container .sv_body .sv_p_root .sv_q input[type="radio"]:focus, .sv_default_css .sv_container .sv_body .sv_p_root .sv_q input[type="checkbox"]:focus': "outline: 1px dotted $main-color;", - ".sv_default_css select:focus": "border-color: $main-color;", - ".sv_default_css textarea:focus": "border-color: $main-color;", - ".sv_default_css .sv_select_wrapper": "background-color: $body-background-color;", - ".sv_default_css .sv_select_wrapper::before": "background-color: $main-color;", - ".sv_default_css .sv_q_rating_item.active .sv_q_rating_item_text": "background-color: $main-hover-color; border-color: $main-hover-color; color: $body-background-color;", - ".sv_default_css .sv_q_rating_item .sv_q_rating_item_text": "border-color: $border-color;", - ".sv_default_css .sv_q_rating_item .sv_q_rating_item_text:hover": "border-color: $main-hover-color;", - ".sv_default_css table.sv_q_matrix tr": "border-color: $border-color;", - ".sv_default_css table.sv_q_matrix_dropdown tr": "border-color: $border-color;", - ".sv_default_css table.sv_q_matrix_dynamic tr": "border-color: $border-color;", - ".sv_default_css .sv_q_m_cell_selected": "color: $body-background-color; background-color: $main-hover-color;", - ".sv_main .sv_q_file_remove:hover": "color: $main-color;", - ".sv_main .sv_q_file_choose_button": "color: $body-background-color; background-color: $main-color;", - ".sv_main .sv_q_file_choose_button:hover": "background-color: $main-hover-color;", - ".sv_main .sv_q_imgsel.checked label>div": "background-color: $main-color", - ".sv_default_css .sv_p_description": "padding-left: 1.29em;", - //progress bar - ".sv_main .sv-progress": "background-color: $header-background-color;", - ".sv_main .sv-progress__bar": "background-color: $main-color;", - //paneldynamic - ".sv_main .sv-paneldynamic__prev-btn.sv-paneldynamic__prev-btn--disabled, .sv_main .sv-paneldynamic__next-btn.sv-paneldynamic__next-btn--disabled": "fill: $disable-color;", - ".sv_main .sv-paneldynamic__progress-text": "color: $progress-text-color;", - ".sv_main .sv-paneldynamic__prev-btn, .sv_main .sv-paneldynamic__next-btn": "fill: $text-color", - //boolean - ".sv_main .sv-boolean__switch": "background-color: $main-color;", - ".sv_main .sv-boolean__slider": "background-color: $slider-color;", - ".sv_main .sv-boolean__label--disabled": "color: $disabled-label-color;", - ".sv_main .sv-boolean--disabled .sv-boolean__switch": "background-color: $disabled-switch-color;", - ".sv_main .sv-boolean--disabled .sv-boolean__slider": "background-color: $disabled-slider-color;", - //eo boolean - //signature pad - ".sv_main .sjs_sp_container": "border: 1px dashed $disable-color;", - ".sv_main .sjs_sp_placeholder": "color: $foreground-light;", - ".sv_main .sv_matrix_detail_row": "background-color: #ededed; border-top: 1px solid $header-background-color; border-bottom: 1px solid $header-background-color;", - //action-bar - ".sv_main .sv-action-bar-item": "color: $text-color;", - ".sv_main .sv-action-bar-item__icon use": "fill: $foreground-light;", - ".sv_main .sv-action-bar-item:hover": "background-color: $background-dim;", - //eo action-bar - //button-group - ".sv_main .sv-button-group__item--hover:hover": "background-color: $background-dim;", - ".sv_main .sv-button-group__item-icon use": "fill: $foreground-light;", - ".sv_main .sv-button-group__item--selected": "color: $main-color;", - ".sv_main .sv-button-group__item--selected .sv-button-group__item-icon use": "fill: $main-color;", - ".sv_main .sv-button-group__item--disabled": "color: $foreground-disabled;", - ".sv_main .sv-button-group__item--disabled .sv-button-group__item-icon use": "fill: $foreground-disabled;", - ".sv_main .sv-button-group__item": "background: $body-background-color; border-color: $border-color;", - //eo button-group - ".sv_main .sv_qstn textarea": "max-width: 100%", - //drag-drop - ".sv_main .sv-matrixdynamic__drag-icon": "padding-top:14px", - ".sv_main .sv-matrixdynamic__drag-icon:after": "content: ' '; display: block; height: 6px; width: 20px; border: 1px solid $border-color; box-sizing: border-box; border-radius: 10px; cursor: move; margin-top: 12px;", - ".sv_main .sv-matrix__drag-drop-ghost-position-top, .sv_main .sv-matrix__drag-drop-ghost-position-bottom": "position: relative;", - ".sv_main .sv-matrix__drag-drop-ghost-position-top::after, .sv_main .sv-matrix__drag-drop-ghost-position-bottom::after": "content: ''; width: 100%; height: 4px; background-color: var(--primary, #19b394); position: absolute; left: 0;", - ".sv_main .sv-matrix__drag-drop-ghost-position-top::after": "top: 0;", - ".sv_main .sv-matrix__drag-drop-ghost-position-bottom::after": "bottom: 0;", - //eo drag-drop - //list - ".sv-list__input": "color: $text-input-color; border-color: $border-color; background-color: $inputs-background-color;", - ".sv-list__input::placeholder": "color: $foreground-light;", - ".sv-list__input:focus": "border-color: $main-color;", - ".sv-list__input:disabled": "color: $foreground-disabled;", - ".sv-list__input:disabled::placeholder": "color: $foreground-disabled;", - //eo list - ".sv-skeleton-element": "background-color: $background-dim;", - }; - StylesManager.modernThemeCss = { - // ".sv-paneldynamic__add-btn": "background-color: $add-button-color;", - // ".sv-paneldynamic__remove-btn": "background-color: $remove-button-color;", - ".sv-boolean__switch": "background-color: $main-color;", - ".sv-boolean__slider": "background-color: $slider-color;", - ".sv-boolean__label--disabled": "color: $disabled-label-color;", - ".sv-boolean--disabled .sv-boolean__switch": "background-color: $disabled-switch-color;", - ".sv-boolean--disabled .sv-boolean__slider": "background-color: $disabled-slider-color;", - ".sv-btn": "color: $button-text-color;", - ".sv-checkbox__svg": "border-color: $border-color; fill: transparent;", - ".sv-checkbox--allowhover:hover .sv-checkbox__svg": "background-color: $main-hover-color; fill: $checkmark-color;", - ".sv-checkbox--checked .sv-checkbox__svg": "background-color: $main-color; fill: $checkmark-color;", - ".sv-checkbox--checked.sv-checkbox--disabled .sv-checkbox__svg": "background-color: $disable-color; fill: $checkmark-color;", - ".sv-checkbox--disabled .sv-checkbox__svg": "border-color: $disable-color;", - ".sv-comment": "border-color: $text-border-color; max-width: 100%;", - ".sv-comment:focus": "border-color: $main-color;", - ".sv-completedpage": "color: $text-color; background-color: $body-container-background-color;", - ".sv-container-modern": "color: $text-color;", - ".sv-container-modern__title": "color: $main-color;", - ".sv-description": "color: $disabled-text-color;", - ".sv-dropdown": "border-bottom: 0.06em solid $text-border-color;", - ".sv-dropdown:focus": "border-color: $dropdown-border-color;", - ".sv-dropdown--error": "border-color: $error-color; color: $error-color;", - ".sv-dropdown--error::placeholder": "color: $error-color;", - ".sv-dropdown--error::-ms-input-placeholder": "color: $error-color;", - ".sv-file__decorator": "background-color: $body-container-background-color;", - ".sv-file__clean-btn": "background-color: $remove-button-color;", - ".sv-file__choose-btn:not(.sv-file__choose-btn--disabled)": "background-color: $add-button-color;", - ".sv-file__choose-btn--disabled": "background-color: $disable-color;", - ".sv-file__remove-svg": "fill: #ff1800;", - ".sv-file__sign a": "color: $text-color;", - ".sv-footer__complete-btn": "background-color: $main-color;", - ".sv-footer__next-btn": "background-color: $main-color;", - ".sv-footer__prev-btn": "background-color: $main-color;", - ".sv-footer__start-btn": "background-color: $main-color;", - ".sv-footer__preview-btn": "background-color: $main-color;", - ".sv-footer__edit-btn": "background-color: $main-color;", - ".sv-imagepicker__item--allowhover:hover .sv-imagepicker__image": "background-color: $main-hover-color; border-color: $main-hover-color;", - ".sv-imagepicker__item--checked .sv-imagepicker__image": "background-color: $main-color; border-color: $main-color;", - ".sv-imagepicker__item--disabled.sv-imagepicker__item--checked .sv-imagepicker__image": "background-color: $disable-color; border-color: $disable-color;", - ".sv-item__control:focus + .sv-item__decorator": "border-color: $main-color;", - ".sv-matrix__text--checked": "color: $matrix-text-checked-color; background-color: $main-color;", - ".sv-matrix__text--disabled.sv-matrix__text--checked": "background-color: $disable-color;", - ".sv-matrixdynamic__add-btn": "background-color: $add-button-color;", - ".sv-matrixdynamic__remove-btn": "background-color: $remove-button-color;", - ".sv-paneldynamic__add-btn": "background-color: $add-button-color;", - ".sv-paneldynamic__remove-btn": "background-color: $remove-button-color;", - ".sv-paneldynamic__prev-btn, .sv-paneldynamic__next-btn": "fill: $text-color;", - ".sv-paneldynamic__prev-btn--disabled, .sv-paneldynamic__next-btn--disabled": "fill: $disable-color;", - ".sv-paneldynamic__progress-text": "color: $progress-text-color;", - ".sv-progress": "background-color: $header-background-color;", - ".sv-progress__bar": "background-color: $main-color;", - ".sv-progress__text": "color: $progress-text-color;", - ".sv_progress-buttons__list li:before": "border-color: $progress-buttons-color; background-color: $progress-buttons-color;", - ".sv_progress-buttons__list li:after": "background-color: $progress-buttons-line-color;", - ".sv_progress-buttons__list .sv_progress-buttons__page-title": " color: $text-color;", - ".sv_progress-buttons__list .sv_progress-buttons__page-description": " color: $text-color;", - ".sv_progress-buttons__list li.sv_progress-buttons__list-element--passed:before": "border-color: $main-color; background-color: $main-color;", - ".sv_progress-buttons__list li.sv_progress-buttons__list-element--passed + li:after": "background-color: $progress-buttons-color", - ".sv_progress-buttons__list li.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", - ".sv_progress-buttons__list li.sv_progress-buttons__list-element--passed.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", - ".sv-question__erbox": "color: $error-color;", - ".sv-question__title--answer": "background-color: $answer-background-color;", - ".sv-question__title--error": "background-color: $error-background-color;", - ".sv-panel__title--error": "background-color: $error-background-color;", - ".sv-radio__svg": "border-color: $border-color; fill: transparent;", - ".sv-radio--allowhover:hover .sv-radio__svg": "fill: $border-color;", - ".sv-radio--checked .sv-radio__svg": "border-color: $radio-checked-color; fill: $radio-checked-color;", - ".sv-radio--disabled .sv-radio__svg": "border-color: $disable-color;", - ".sv-radio--disabled.sv-radio--checked .sv-radio__svg": "fill: $disable-color;", - ".sv-rating": "color: $text-color;", - ".sv-rating input:focus + .sv-rating__min-text + .sv-rating__item-text, .sv-rating input:focus + .sv-rating__item-text": "outline-color: $main-color;", - ".sv-rating__item-text": "color: $main-hover-color; border: solid 0.1875em $main-hover-color;", - ".sv-rating__item-text:hover": "background-color: $main-hover-color; color: $body-background-color;", - ".sv-rating__item--selected .sv-rating__item-text": "background-color: $main-color; color: $body-background-color; border-color: $main-color;", - ".sv-rating--disabled .sv-rating__item-text": "color: $disable-color; border-color: $disable-color;", - ".sv-rating--disabled .sv-rating__item-text:hover": "background-color: transparent;", - ".sv-rating--disabled .sv-rating__item-text:hover .sv-rating__item--selected .sv-rating__item-text": "background-color: $disable-color; color: $body-background-color;", - "::-webkit-scrollbar": "background-color: $main-hover-color;", - "::-webkit-scrollbar-thumb": "background: $main-color;", - ".sv-selectbase__clear-btn": "background-color: $clean-button-color;", - ".sv-table": "background-color: rgba($main-hover-color, 0.1);", - ".sv-text:focus": "border-color: $main-color;", - '.sv-text[type="date"]::-webkit-calendar-picker-indicator': "color: transparent; background: transparent;", - ".sv-text--error": "color: $error-color; border-color: $error-color;", - ".sv-text--error::placeholder": "color: $error-color;", - ".sv-text--error::-ms-placeholder": "color: $error-color;", - ".sv-text--error:-ms-placeholder": "color: $error-color;", - "input.sv-text, textarea.sv-comment, select.sv-dropdown": "color: $text-input-color; background-color: $inputs-background-color;", - ".sv-text::placeholder": "color: $text-input-color;", - ".sv-text::-ms-placeholder": "color: $text-input-color;", - ".sv-text:-ms-placeholder": "color: $text-input-color;", - ".sv-table__row--detail": "background-color: $header-background-color;", - //signature pad - ".sjs_sp_container": "border: 1px dashed $disable-color;", - ".sjs_sp_placeholder": "color: $foreground-light;", - //drag-drop - ".sv-matrixdynamic__drag-icon": "padding-top:16px", - ".sv-matrixdynamic__drag-icon:after": "content: ' '; display: block; height: 6px; width: 20px; border: 1px solid $border-color; box-sizing: border-box; border-radius: 10px; cursor: move; margin-top: 12px;", - ".sv-matrix__drag-drop-ghost-position-top, .sv-matrix__drag-drop-ghost-position-bottom": "position: relative;", - ".sv-matrix__drag-drop-ghost-position-top::after, .sv-matrix__drag-drop-ghost-position-bottom::after": "content: ''; width: 100%; height: 4px; background-color: var(--primary, #19b394); position: absolute; left: 0;", - ".sv-matrix__drag-drop-ghost-position-top::after": "top: 0;", - ".sv-matrix__drag-drop-ghost-position-bottom::after": "bottom: 0;", - //eo drag-drop - ".sv-skeleton-element": "background-color: $background-dim;", - }; - StylesManager.bootstrapThemeCss = { - ".sv_main .sv_q_imgsel.checked label>div": "background-color: $main-color", - ".sv_main .sv_p_description": "padding-left: 1.66em;", - ".sv_main .sv_qstn_error_bottom": "margin-top: 20px; margin-bottom: 0;", - ".sv_main .progress": "width: 60%;", - ".sv_main .progress-bar": "width: auto; margin-left: 2px; margin-right: 2px;", - ".sv_main .table>tbody>tr>td": "min-width: 90px;", - ".sv_main f-panel .sv_qstn": "padding: 0; vertical-align: middle;", - ".sv_main .sv_q_image": "display: inline-block;", - ".sv_main .sv_row .sv_qstn:first-child:last-child": "flex: none !important;", - ".sv_main .sv_row .sv_p_container:first-child:last-child": "flex: none !important;", - //progress bar - ".sv_main .sv-progress": "background-color: $header-background-color;", - ".sv_main .sv-progress__bar": "background-color: $main-color;", - //progress buttons - ".sv_main .sv_progress-buttons__list li:before": "border-color: $progress-buttons-color; background-color: $progress-buttons-color;", - ".sv_main .sv_progress-buttons__list li:after": "background-color: $progress-buttons-line-color;", - ".sv_main .sv_progress-buttons__list .sv_progress-buttons__page-title": " color: $text-color;", - ".sv_main .sv_progress-buttons__list .sv_progress-buttons__page-description": " color: $text-color;", - ".sv_main .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed:before": "border-color: $main-color; background-color: $main-color;", - ".sv_main .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed + li:after": "background-color: $progress-buttons-color", - ".sv_main .sv_progress-buttons__list li.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", - ".sv_main .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", - //paneldynamic - ".sv_main .sv-paneldynamic__prev-btn.sv-paneldynamic__prev-btn--disabled, .sv_main .sv-paneldynamic__next-btn.sv-paneldynamic__next-btn--disabled": "fill: $disable-color;", - ".sv_main .sv-paneldynamic__progress-text": "color: $progress-text-color;", - ".sv_main .sv-paneldynamic__prev-btn, .sv_main .sv-paneldynamic__next-btn": "fill: $text-color", - //boolean - ".sv_main .sv-boolean__switch": "background-color: $main-color;", - ".sv_main .sv-boolean__slider": "background-color: $slider-color;", - ".sv_main .sv-boolean__label--disabled": "color: $disabled-label-color;", - ".sv_main .sv-boolean--disabled .sv-boolean__switch": "background-color: $disabled-switch-color;", - ".sv_main .sv-boolean--disabled .sv-boolean__slider": "background-color: $disabled-slider-color;", - //eo boolean - //signature pad - ".sv_main .sjs_sp_container": "border: 1px dashed $disable-color;", - ".sv_main .sjs_sp_placeholder": "color: $foreground-light;", - ".sv_main .sv_matrix_detail_row": "background-color: #ededed; border-top: 1px solid $header-background-color; border-bottom: 1px solid $header-background-color;", - ".sv_main .sv-action-bar-item": "color: $text-color;", - ".sv_main .sv-action-bar-item__icon use": "fill: $foreground-light;", - ".sv_main .sv-action-bar-item:hover": "background-color: $background-dim;", - ".sv-skeleton-element": "background-color: $background-dim;", - }; - StylesManager.bootstrapmaterialThemeCss = { - ".sv_main.sv_bootstrapmaterial_css .form-group.is-focused .form-control": "linear-gradient(0deg, $main-color 2px, $main-color 0),linear-gradient(0deg, #D2D2D2 1px, transparent 0);", - ".sv_main.sv_bootstrapmaterial_css .sv_qstn": "margin-bottom: 1rem;", - ".sv_main.sv_bootstrapmaterial_css .sv_qstn label.sv_q_m_label": "height: 100%;", - ".sv_main.sv_bootstrapmaterial_css .sv_q_image": "display: inline-block;", - ".sv_main .sv_row .sv_qstn:first-child:last-child": "flex: none !important;", - ".sv_main .sv_row .sv_p_container:first-child:last-child": "flex: none !important;", - ".sv_main.sv_bootstrapmaterial_css .checkbox input[type=checkbox]:checked + .checkbox-material .check": "border-color: $main-color;", - ".sv_main.sv_bootstrapmaterial_css label.checkbox-inline input[type=checkbox]:checked + .checkbox-material .check": "border-color: $main-color;", - ".sv_main.sv_bootstrapmaterial_css .checkbox input[type=checkbox]:checked + .checkbox-material .check:before": "color: $main-color;", - ".sv_main.sv_bootstrapmaterial_css label.checkbox-inline input[type=checkbox]:checked + .checkbox-material .check:before": "color: $main-color;", - ".sv_main.sv_bootstrapmaterial_css .radio input[type=radio]:checked ~ .circle": "border-color: $main-color;", - ".sv_main.sv_bootstrapmaterial_css label.radio-inline input[type=radio]:checked ~ .circle": "border-color: $main-color;", - ".sv_main.sv_bootstrapmaterial_css .radio input[type=radio]:checked ~ .check": "background-color: $main-color;", - ".sv_main.sv_bootstrapmaterial_css label.radio-inline input[type=radio]:checked ~ .check": "background-color: $main-color;", - ".sv_main.sv_bootstrapmaterial_css .btn-default.active": "background-color: $main-color; color: $body-background-color;", - ".sv_main.sv_bootstrapmaterial_css .btn-default:active": "background-color: $main-color; color: $body-background-color;", - ".sv_main.sv_bootstrapmaterial_css .btn-secondary.active": "background-color: $main-color; color: $body-background-color;", - ".sv_main.sv_bootstrapmaterial_css .btn-secondary:active": "background-color: $main-color; color: $body-background-color;", - ".sv_main.sv_bootstrapmaterial_css .open>.dropdown-toggle.btn-default": "background-color: $main-color; color: $body-background-color;", - ".sv_main.sv_bootstrapmaterial_css input[type='button'].btn-primary, .sv_main.sv_bootstrapmaterial_css button.btn-primary": "color: $body-background-color; background-color: $main-color;", - ".sv_main.sv_bootstrapmaterial_css input[type='button'].btn-primary:hover, .sv_main.sv_bootstrapmaterial_css button.btn-primary:hover": "background-color: $main-hover-color;", - ".sv_main .sv_q_imgsel.checked label>div": "background-color: $main-color;", - ".sv_main.sv_bootstrapmaterial_css .sv_q_file_remove:hover": "color: $main-color;", - ".sv_main.sv_bootstrapmaterial_css .form-group input[type=file]": "position: relative; opacity: 1;", - ".sv_main.sv_bootstrapmaterial_css .progress": "width: 60%; height: 1.5em;", - ".sv_main.sv_bootstrapmaterial_css .progress-bar": "width: auto; margin-left: 2px; margin-right: 2px;", - //progress bar - ".sv_main .sv-progress": "background-color: $header-background-color;", - ".sv_main .sv-progress__bar": "background-color: $main-color;", - //progress buttons - ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list li:before": "border-color: $progress-buttons-color; background-color: $progress-buttons-color;", - ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list li:after": "background-color: $progress-buttons-line-color;", - ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list .sv_progress-buttons__page-title": " color: $text-color;", - ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list .sv_progress-buttons__page-description": " color: $text-color;", - ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed:before": "border-color: $main-color; background-color: $main-color;", - ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed + li:after": "background-color: $progress-buttons-color", - ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", - ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", - //paneldynamic - ".sv_main .sv-paneldynamic__prev-btn.sv-paneldynamic__prev-btn--disabled, .sv_main .sv-paneldynamic__next-btn.sv-paneldynamic__next-btn--disabled": "fill: $disable-color;", - ".sv_main .sv-paneldynamic__progress-text": "color: $progress-text-color;", - ".sv_main .sv-paneldynamic__prev-btn, .sv_main .sv-paneldynamic__next-btn": "fill: $text-color", - //boolean - ".sv_main .sv-boolean .checkbox-decorator": "display: none;", - ".sv_main .sv-boolean__switch": "background-color: $main-color;", - ".sv_main .sv-boolean__slider": "background-color: $slider-color;", - ".sv_main .sv-boolean__label.sv-boolean__label--disabled": "color: $disabled-label-color;", - ".sv_main .sv-boolean__label": "color: $text-color;", - ".sv_main .sv-boolean--disabled .sv-boolean__switch": "background-color: $disabled-switch-color;", - ".sv_main .sv-boolean--disabled .sv-boolean__slider": "background-color: $disabled-slider-color;", - //eo boolean - ".sv_main .sv_matrix_detail_row": "background-color: #ededed; border-top: 1px solid $header-background-color; border-bottom: 1px solid $header-background-color;", - //signature pad - ".sv_main .sjs_sp_container": "border: 1px dashed $disable-color;", - ".sv_main .sjs_sp_placeholder": "color: $foreground-light;", - ".sv_main .sv-action-bar-item": "color: $text-color;", - ".sv_main .sv-action-bar-item__icon use": "fill: $foreground-light;", - ".sv_main .sv-action-bar-item:hover": "background-color: $background-dim;", - ".sv-skeleton-element": "background-color: $background-dim;", - }; - StylesManager.Enabled = true; - return StylesManager; - }()); - - - - /***/ }), - - /***/ "./src/survey-element.ts": - /*!*******************************!*\ - !*** ./src/survey-element.ts ***! - \*******************************/ - /*! exports provided: SurveyElementCore, DragTypeOverMeEnum, SurveyElement */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyElementCore", function() { return SurveyElementCore; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DragTypeOverMeEnum", function() { return DragTypeOverMeEnum; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyElement", function() { return SurveyElement; }); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _rendererFactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rendererFactory */ "./src/rendererFactory.ts"); - /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base */ "./src/base.ts"); - /* harmony import */ var _actions_action__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./actions/action */ "./src/actions/action.ts"); - /* harmony import */ var _actions_adaptive_container__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./actions/adaptive-container */ "./src/actions/adaptive-container.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var __decorate = function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; - }; - - - - - - - - - /** - * Base class of SurveyJS Elements and Survey. - */ - var SurveyElementCore = /** @class */ (function (_super) { - __extends(SurveyElementCore, _super); - function SurveyElementCore() { - var _this = _super.call(this) || this; - _this.createLocTitleProperty(); - _this.createLocalizableString("description", _this, true); - return _this; - } - SurveyElementCore.prototype.createLocTitleProperty = function () { - return this.createLocalizableString("title", this, true); - }; - Object.defineProperty(SurveyElementCore.prototype, "title", { - /** - * Question, Panel, Page and Survey title. If page and panel is empty then they are not rendered. - * Question renders question name if the title is empty. Use survey questionTitleTemplate property to change the title question rendering. - * @see SurveyModel.questionTitleTemplate - */ - get: function () { - return this.getLocalizableStringText("title", this.getDefaultTitleValue()); - }, - set: function (val) { - this.setLocalizableStringText("title", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElementCore.prototype, "locTitle", { - get: function () { - return this.getLocalizableString("title"); - }, - enumerable: false, - configurable: true - }); - SurveyElementCore.prototype.getDefaultTitleValue = function () { return undefined; }; - Object.defineProperty(SurveyElementCore.prototype, "description", { - /** - * Question, Panel and Page description. It renders under element title by using smaller font. Unlike the question title, description can be empty. - * Please note, this property is hidden for questions without input, for example html question. - * @see title - */ - get: function () { - return this.getLocalizableStringText("description"); - }, - set: function (val) { - this.setLocalizableStringText("description", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElementCore.prototype, "locDescription", { - get: function () { - return this.getLocalizableString("description"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElementCore.prototype, "titleTagName", { - get: function () { - var titleTagName = this.getDefaultTitleTagName(); - var survey = this.getSurvey(); - return !!survey ? survey.getElementTitleTagName(this, titleTagName) : titleTagName; - }, - enumerable: false, - configurable: true - }); - SurveyElementCore.prototype.getDefaultTitleTagName = function () { - return _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].titleTags[this.getType()]; - }; - Object.defineProperty(SurveyElementCore.prototype, "hasTitle", { - get: function () { return this.title.length > 0; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElementCore.prototype, "hasTitleActions", { - get: function () { return false; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElementCore.prototype, "hasTitleEvents", { - get: function () { - return this.hasTitleActions; - }, - enumerable: false, - configurable: true - }); - SurveyElementCore.prototype.getTitleToolbar = function () { return null; }; - SurveyElementCore.prototype.getTitleOwner = function () { return undefined; }; - Object.defineProperty(SurveyElementCore.prototype, "isTitleOwner", { - get: function () { return !!this.getTitleOwner(); }, - enumerable: false, - configurable: true - }); - SurveyElementCore.prototype.toggleState = function () { return undefined; }; - Object.defineProperty(SurveyElementCore.prototype, "cssClasses", { - get: function () { return {}; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElementCore.prototype, "cssTitle", { - get: function () { return ""; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElementCore.prototype, "ariaTitleId", { - get: function () { return undefined; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElementCore.prototype, "titleTabIndex", { - get: function () { return undefined; }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElementCore.prototype, "titleAriaExpanded", { - get: function () { return undefined; }, - enumerable: false, - configurable: true - }); - return SurveyElementCore; - }(_base__WEBPACK_IMPORTED_MODULE_2__["Base"])); - - var DragTypeOverMeEnum; - (function (DragTypeOverMeEnum) { - DragTypeOverMeEnum[DragTypeOverMeEnum["InsideEmptyPanel"] = 1] = "InsideEmptyPanel"; - DragTypeOverMeEnum[DragTypeOverMeEnum["MultilineRight"] = 2] = "MultilineRight"; - DragTypeOverMeEnum[DragTypeOverMeEnum["MultilineLeft"] = 3] = "MultilineLeft"; - })(DragTypeOverMeEnum || (DragTypeOverMeEnum = {})); - /** - * Base class of SurveyJS Elements. - */ - var SurveyElement = /** @class */ (function (_super) { - __extends(SurveyElement, _super); - function SurveyElement(name) { - var _this = _super.call(this) || this; - _this.selectedElementInDesignValue = _this; - _this.disableDesignActions = SurveyElement.CreateDisabledDesignElements; - _this.isContentElement = false; - _this.isEditableTemplateElement = false; - _this.isInteractiveDesignElement = true; - _this.name = name; - _this.createNewArray("errors"); - _this.createNewArray("titleActions"); - _this.registerFunctionOnPropertyValueChanged("isReadOnly", function () { - _this.onReadOnlyChanged(); - }); - _this.registerFunctionOnPropertyValueChanged("errors", function () { - _this.updateVisibleErrors(); - }); - return _this; - } - SurveyElement.getProgressInfoByElements = function (children, isRequired) { - var info = _base__WEBPACK_IMPORTED_MODULE_2__["Base"].createProgressInfo(); - for (var i = 0; i < children.length; i++) { - if (!children[i].isVisible) - continue; - var childInfo = children[i].getProgressInfo(); - info.questionCount += childInfo.questionCount; - info.answeredQuestionCount += childInfo.answeredQuestionCount; - info.requiredQuestionCount += childInfo.requiredQuestionCount; - info.requiredAnsweredQuestionCount += - childInfo.requiredAnsweredQuestionCount; - } - if (isRequired && info.questionCount > 0) { - if (info.requiredQuestionCount == 0) - info.requiredQuestionCount = 1; - if (info.answeredQuestionCount > 0) - info.requiredAnsweredQuestionCount = 1; - } - return info; - }; - SurveyElement.ScrollElementToTop = function (elementId) { - if (!elementId || typeof document === "undefined") - return false; - var el = document.getElementById(elementId); - if (!el || !el.scrollIntoView) - return false; - var elemTop = el.getBoundingClientRect().top; - if (elemTop < 0) - el.scrollIntoView(); - return elemTop < 0; - }; - SurveyElement.GetFirstNonTextElement = function (elements, removeSpaces) { - if (removeSpaces === void 0) { removeSpaces = false; } - if (!elements || !elements.length || elements.length == 0) - return null; - if (removeSpaces) { - var tEl = elements[0]; - if (tEl.nodeName === "#text") - tEl.data = ""; - tEl = elements[elements.length - 1]; - if (tEl.nodeName === "#text") - tEl.data = ""; - } - for (var i = 0; i < elements.length; i++) { - if (elements[i].nodeName != "#text" && elements[i].nodeName != "#comment") - return elements[i]; - } - return null; - }; - SurveyElement.FocusElement = function (elementId) { - if (!elementId || typeof document === "undefined") - return false; - var res = SurveyElement.focusElementCore(elementId); - if (!res) { - setTimeout(function () { - SurveyElement.focusElementCore(elementId); - }, 10); - } - return res; - }; - SurveyElement.focusElementCore = function (elementId) { - var el = document.getElementById(elementId); - if (el) { - el.focus(); - return true; - } - return false; - }; - SurveyElement.prototype.onPropertyValueChanged = function (name, oldValue, newValue) { - _super.prototype.onPropertyValueChanged.call(this, name, oldValue, newValue); - if (name === "state") { - if (oldValue === "default" || newValue === "default") { - this.updateTitleActions(); - } - else { - this.updateExpandAction(); - } - if (this.stateChangedCallback) - this.stateChangedCallback(); - } - }; - SurveyElement.prototype.getSkeletonComponentNameCore = function () { - if (this.survey) { - return this.survey.getSkeletonComponentName(this); - } - return ""; - }; - Object.defineProperty(SurveyElement.prototype, "skeletonComponentName", { - get: function () { - return this.getSkeletonComponentNameCore(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "state", { - /** - * Set this property to "collapsed" to render only Panel title and expanded button and to "expanded" to render the collapsed button in the Panel caption - */ - get: function () { - return this.getPropertyValue("state"); - }, - set: function (val) { - this.setPropertyValue("state", val); - this.notifyStateChanged(); - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.notifyStateChanged = function () { - if (this.survey) { - this.survey.elementContentVisibilityChanged(this); - } - }; - Object.defineProperty(SurveyElement.prototype, "isCollapsed", { - /** - * Returns true if the Element is in the collapsed state - * @see state - * @see collapse - * @see isExpanded - */ - get: function () { - if (this.isDesignMode) - return; - return this.state === "collapsed"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "isExpanded", { - /** - * Returns true if the Element is in the expanded state - * @see state - * @see expand - * @see isCollapsed - */ - get: function () { - return this.state === "expanded"; - }, - enumerable: false, - configurable: true - }); - /** - * Collapse the Element - * @see state - */ - SurveyElement.prototype.collapse = function () { - if (this.isDesignMode) - return; - this.state = "collapsed"; - }; - /** - * Expand the Element - * @see state - */ - SurveyElement.prototype.expand = function () { - this.state = "expanded"; - }; - /** - * Toggle element's state - * @see state - */ - SurveyElement.prototype.toggleState = function () { - if (this.isCollapsed) { - this.expand(); - return true; - } - if (this.isExpanded) { - this.collapse(); - return false; - } - return true; - }; - Object.defineProperty(SurveyElement.prototype, "hasStateButton", { - get: function () { - return this.isExpanded || this.isCollapsed; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "shortcutText", { - get: function () { - return this.title || this.name; - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.getTitleToolbar = function () { - if (!this.titleToolbarValue) { - this.titleToolbarValue = new _actions_adaptive_container__WEBPACK_IMPORTED_MODULE_4__["AdaptiveActionContainer"](); - this.titleToolbarValue.setItems(this.getTitleActions()); - } - return this.titleToolbarValue; - }; - SurveyElement.prototype.updateExpandAction = function () { - if (!!this.expandAction) { - this.expandAction.visible = this.isExpanded || this.isCollapsed; - this.expandAction.innerCss = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() - .append("sv-expand-action").append("sv-expand-action--expanded", this.isExpanded).toString(); - } - }; - Object.defineProperty(SurveyElement.prototype, "titleActions", { - get: function () { - return this.getPropertyValue("titleActions"); - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.getTitleActions = function () { - if (!this.isTitleActionRequested) { - this.updateTitleActions(); - this.isTitleActionRequested = true; - } - return this.titleActions; - }; - SurveyElement.prototype.updateTitleActions = function () { - var _this = this; - var actions = []; - if (this.hasStateButton && !this.expandAction) { - this.expandAction = new _actions_action__WEBPACK_IMPORTED_MODULE_3__["Action"]({ - id: "expand-collapse-action", - title: "", - disableTabStop: true, - action: function () { - _this.toggleState(); - }, - }); - } - if (!!this.expandAction) { - actions.push(this.expandAction); - } - if (!!this.survey) { - actions = this.survey.getUpdatedElementTitleActions(this, actions); - } - this.updateExpandAction(); - this.setPropertyValue("titleActions", actions); - }; - Object.defineProperty(SurveyElement.prototype, "hasTitleActions", { - get: function () { - return this.getTitleActions().length > 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "hasTitleEvents", { - get: function () { - return this.hasTitleActions || this.state !== "default"; - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.getTitleComponentName = function () { - var componentName = _rendererFactory__WEBPACK_IMPORTED_MODULE_1__["RendererFactory"].Instance.getRenderer("element", "title-actions"); - if (componentName == "default") { - return "sv-default-title"; - } - return componentName; - }; - Object.defineProperty(SurveyElement.prototype, "titleTabIndex", { - get: function () { - return !this.isPage && this.state !== "default" ? 0 : undefined; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "titleAriaExpanded", { - get: function () { - if (this.isPage || this.state === "default") - return undefined; - return this.state === "expanded"; - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.setSurveyImpl = function (value, isLight) { - this.surveyImplValue = value; - if (!this.surveyImplValue) { - this.setSurveyCore(null); - } - else { - this.surveyDataValue = this.surveyImplValue.getSurveyData(); - this.setSurveyCore(this.surveyImplValue.getSurvey()); - this.textProcessorValue = this.surveyImplValue.getTextProcessor(); - this.onSetData(); - } - }; - Object.defineProperty(SurveyElement.prototype, "surveyImpl", { - get: function () { - return this.surveyImplValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "data", { - get: function () { - return this.surveyDataValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "survey", { - /** - * Returns the survey object. - */ - get: function () { - return this.getSurvey(); - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.getSurvey = function (live) { - if (!!this.surveyValue) - return this.surveyValue; - if (!!this.surveyImplValue) { - this.setSurveyCore(this.surveyImplValue.getSurvey()); - } - return this.surveyValue; - }; - SurveyElement.prototype.setSurveyCore = function (value) { - this.surveyValue = value; - if (!!this.surveyChangedCallback) { - this.surveyChangedCallback(); - } - }; - Object.defineProperty(SurveyElement.prototype, "isDesignMode", { - /** - * Returns true if the question in design mode right now. - */ - get: function () { - return !!this.survey && this.survey.isDesignMode; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "isInternal", { - get: function () { - return this.isContentElement; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "areInvisibleElementsShowing", { - get: function () { - return (!!this.survey && - this.survey.areInvisibleElementsShowing && - !this.isContentElement); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "isVisible", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "isReadOnly", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "readOnly", { - /** - * Set it to true to make an element question/panel/page readonly. - * Please note, this property is hidden for question without input, for example html question. - * @see enableIf - * @see isReadOnly - */ - get: function () { - return this.getPropertyValue("readOnly", false); - }, - set: function (val) { - if (this.readOnly == val) - return; - this.setPropertyValue("readOnly", val); - if (!this.isLoadingFromJson) { - this.setPropertyValue("isReadOnly", this.isReadOnly); - } - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.onReadOnlyChanged = function () { - if (!!this.readOnlyChangedCallback) { - this.readOnlyChangedCallback(); - } - }; - Object.defineProperty(SurveyElement.prototype, "css", { - get: function () { - return !!this.survey ? this.survey.getCss() : {}; - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.ensureCssClassesValue = function () { - if (!this.cssClassesValue) { - this.cssClassesValue = this.calcCssClasses(this.css); - this.updateElementCssCore(this.cssClassesValue); - } - }; - Object.defineProperty(SurveyElement.prototype, "cssClasses", { - /** - * Returns all css classes that used for rendering the question, panel or page. - * You can use survey.onUpdateQuestionCssClasses event to override css classes for a question, survey.onUpdatePanelCssClasses event for a panel and survey.onUpdatePageCssClasses for a page. - * @see SurveyModel.updateQuestionCssClasses - * @see SurveyModel.updatePanelCssClasses - * @see SurveyModel.updatePageCssClasses - */ - get: function () { - if (!this.survey) - return this.calcCssClasses(this.css); - this.ensureCssClassesValue(); - return this.cssClassesValue; - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.calcCssClasses = function (css) { return undefined; }; - SurveyElement.prototype.updateElementCssCore = function (cssClasses) { }; - Object.defineProperty(SurveyElement.prototype, "cssError", { - get: function () { return ""; }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.updateElementCss = function (reNew) { - this.cssClassesValue = undefined; - }; - SurveyElement.prototype.getIsLoadingFromJson = function () { - if (_super.prototype.getIsLoadingFromJson.call(this)) - return true; - return this.survey ? this.survey.isLoadingFromJson : false; - }; - Object.defineProperty(SurveyElement.prototype, "name", { - /** - * This is the identifier of a survey element - question or panel. - * @see valueName - */ - get: function () { - return this.getPropertyValue("name", ""); - }, - set: function (val) { - var oldValue = this.name; - this.setPropertyValue("name", this.getValidName(val)); - if (!this.isLoadingFromJson && !!oldValue) { - this.onNameChanged(oldValue); - } - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.getValidName = function (name) { - return name; - }; - SurveyElement.prototype.onNameChanged = function (oldValue) { }; - SurveyElement.prototype.updateBindingValue = function (valueName, value) { - if (!!this.data && - !this.isTwoValueEquals(value, this.data.getValue(valueName))) { - this.data.setValue(valueName, value, false); - } - }; - Object.defineProperty(SurveyElement.prototype, "errors", { - /** - * The list of errors. It is created by callig hasErrors functions - * @see hasErrors - */ - get: function () { - return this.getPropertyValue("errors"); - }, - set: function (val) { - this.setPropertyValue("errors", val); - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.updateVisibleErrors = function () { - var counter = 0; - for (var i = 0; i < this.errors.length; i++) { - if (this.errors[i].visible) - counter++; - } - this.hasVisibleErrors = counter > 0; - }; - Object.defineProperty(SurveyElement.prototype, "containsErrors", { - /** - * Returns true if a question or a container (panel/page) or their chidren have an error. - * The value can be out of date. hasErrors function should be called to get the correct value. - */ - get: function () { - return this.getPropertyValue("containsErrors", false); - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.updateContainsErrors = function () { - this.setPropertyValue("containsErrors", this.getContainsErrors()); - }; - SurveyElement.prototype.getContainsErrors = function () { - return this.errors.length > 0; - }; - SurveyElement.prototype.getElementsInDesign = function (includeHidden) { - return []; - }; - Object.defineProperty(SurveyElement.prototype, "selectedElementInDesign", { - get: function () { - return this.selectedElementInDesignValue; - }, - set: function (val) { - this.selectedElementInDesignValue = val; - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.updateCustomWidgets = function () { }; - SurveyElement.prototype.onSurveyLoad = function () { }; - SurveyElement.prototype.onFirstRendering = function () { - this.ensureCssClassesValue(); - }; - SurveyElement.prototype.endLoadingFromJson = function () { - _super.prototype.endLoadingFromJson.call(this); - if (!this.survey) { - this.onSurveyLoad(); - } - }; - SurveyElement.prototype.setVisibleIndex = function (index) { - return 0; - }; - Object.defineProperty(SurveyElement.prototype, "isPage", { - /** - * Returns true if it is a page. - */ - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "isPanel", { - /** - * Returns true if it is a panel. - */ - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyElement.prototype, "isQuestion", { - /** - * Returns true if it is a question. - */ - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.delete = function () { }; - /** - * Returns the current survey locale - * @see SurveyModel.locale - */ - SurveyElement.prototype.getLocale = function () { - return this.survey - ? this.survey.getLocale() - : this.locOwner - ? this.locOwner.getLocale() - : ""; - }; - SurveyElement.prototype.getMarkdownHtml = function (text, name) { - return this.survey - ? this.survey.getSurveyMarkdownHtml(this, text, name) - : this.locOwner - ? this.locOwner.getMarkdownHtml(text, name) - : null; - }; - SurveyElement.prototype.getRenderer = function (name) { - return this.survey && typeof this.survey.getRendererForString === "function" - ? this.survey.getRendererForString(this, name) - : this.locOwner && typeof this.locOwner.getRenderer === "function" - ? this.locOwner.getRenderer(name) - : null; - }; - SurveyElement.prototype.getRendererContext = function (locStr) { - return this.survey && typeof this.survey.getRendererContextForString === "function" - ? this.survey.getRendererContextForString(this, locStr) - : this.locOwner && typeof this.locOwner.getRendererContext === "function" - ? this.locOwner.getRendererContext(locStr) - : locStr; - }; - SurveyElement.prototype.getProcessedText = function (text) { - if (this.isLoadingFromJson) - return text; - if (this.textProcessor) - return this.textProcessor.processText(text, this.getUseDisplayValuesInTitle()); - if (this.locOwner) - return this.locOwner.getProcessedText(text); - return text; - }; - SurveyElement.prototype.getUseDisplayValuesInTitle = function () { return true; }; - SurveyElement.prototype.removeSelfFromList = function (list) { - if (!list || !Array.isArray(list)) - return; - var index = list.indexOf(this); - if (index > -1) { - list.splice(index, 1); - } - }; - Object.defineProperty(SurveyElement.prototype, "textProcessor", { - get: function () { - return this.textProcessorValue; - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.getProcessedHtml = function (html) { - if (!html || !this.textProcessor) - return html; - return this.textProcessor.processText(html, true); - }; - SurveyElement.prototype.onSetData = function () { }; - Object.defineProperty(SurveyElement.prototype, "parent", { - get: function () { - return this.getPropertyValue("parent", null); - }, - set: function (val) { - this.setPropertyValue("parent", val); - }, - enumerable: false, - configurable: true - }); - SurveyElement.prototype.getPage = function (parent) { - while (parent && parent.parent) - parent = parent.parent; - if (parent && parent.getType() == "page") - return parent; - return null; - }; - SurveyElement.prototype.moveToBase = function (parent, container, insertBefore) { - if (insertBefore === void 0) { insertBefore = null; } - if (!container) - return false; - parent.removeElement(this); - var index = -1; - if (_helpers__WEBPACK_IMPORTED_MODULE_6__["Helpers"].isNumber(insertBefore)) { - index = parseInt(insertBefore); - } - if (index == -1 && !!insertBefore && !!insertBefore.getType) { - index = container.indexOf(insertBefore); - } - container.addElement(this, index); - return true; - }; - SurveyElement.prototype.setPage = function (parent, newPage) { - var oldPage = this.getPage(parent); - //fix for the creator v1: https://github.com/surveyjs/survey-creator/issues/1744 - if (typeof newPage === "string") { - var survey = this.getSurvey(); - survey.pages.forEach(function (page) { - if (newPage === page.name) - newPage = page; - }); - } - if (oldPage === newPage) - return; - if (parent) - parent.removeElement(this); - if (newPage) { - newPage.addElement(this, -1); - } - }; - SurveyElement.prototype.getSearchableLocKeys = function (keys) { - keys.push("title"); - keys.push("description"); - }; - SurveyElement.CreateDisabledDesignElements = false; - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: null }) - ], SurveyElement.prototype, "dragTypeOverMe", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) - ], SurveyElement.prototype, "isDragMe", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])() - ], SurveyElement.prototype, "cssClassesValue", void 0); - __decorate([ - Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) - ], SurveyElement.prototype, "hasVisibleErrors", void 0); - return SurveyElement; - }(SurveyElementCore)); - - - - /***/ }), - - /***/ "./src/survey-error.ts": - /*!*****************************!*\ - !*** ./src/survey-error.ts ***! - \*****************************/ - /*! exports provided: SurveyError */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyError", function() { return SurveyError; }); - /* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts"); - - var SurveyError = /** @class */ (function () { - function SurveyError(text, errorOwner) { - if (text === void 0) { text = null; } - if (errorOwner === void 0) { errorOwner = null; } - this.text = text; - this.errorOwner = errorOwner; - this.visible = true; - } - Object.defineProperty(SurveyError.prototype, "locText", { - get: function () { - if (!this.locTextValue) { - this.locTextValue = new _localizablestring__WEBPACK_IMPORTED_MODULE_0__["LocalizableString"](this.errorOwner, true); - this.locTextValue.text = this.getText(); - } - return this.locTextValue; - }, - enumerable: false, - configurable: true - }); - SurveyError.prototype.getText = function () { - var res = this.text; - if (!res) - res = this.getDefaultText(); - if (!!this.errorOwner) { - res = this.errorOwner.getErrorCustomText(res, this); - } - return res; - }; - SurveyError.prototype.getErrorType = function () { - return "base"; - }; - SurveyError.prototype.getDefaultText = function () { - return ""; - }; - return SurveyError; - }()); - - - - /***/ }), - - /***/ "./src/survey.ts": - /*!***********************!*\ - !*** ./src/survey.ts ***! - \***********************/ - /*! exports provided: SurveyModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyModel", function() { return SurveyModel; }); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); - /* harmony import */ var _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./defaultCss/cssstandard */ "./src/defaultCss/cssstandard.ts"); - /* harmony import */ var _page__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./page */ "./src/page.ts"); - /* harmony import */ var _textPreProcessor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./textPreProcessor */ "./src/textPreProcessor.ts"); - /* harmony import */ var _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./conditionProcessValue */ "./src/conditionProcessValue.ts"); - /* harmony import */ var _dxSurveyService__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./dxSurveyService */ "./src/dxSurveyService.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./error */ "./src/error.ts"); - /* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts"); - /* harmony import */ var _stylesmanager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./stylesmanager */ "./src/stylesmanager.ts"); - /* harmony import */ var _surveytimer__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./surveytimer */ "./src/surveytimer.ts"); - /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - - - - - - - - - - - - - /** - * The `Survey` object contains information about the survey, Pages, Questions, flow logic and etc. - */ - var SurveyModel = /** @class */ (function (_super) { - __extends(SurveyModel, _super); - //#endregion - function SurveyModel(jsonObj) { - if (jsonObj === void 0) { jsonObj = null; } - var _this = _super.call(this) || this; - _this.valuesHash = {}; - _this.variablesHash = {}; - _this.localeValue = ""; - _this.completedStateValue = ""; - _this.completedStateTextValue = ""; - _this.isTimerStarted = false; - //#region Event declarations - /** - * The event is fired before the survey is completed and the `onComplete` event is fired. You can prevent the survey from completing by setting `options.allowComplete` to `false` - *
`sender` - the survey object that fires the event. - *
`options.allowComplete` - Specifies whether a user can complete a survey. Set this property to `false` to prevent the survey from completing. The default value is `true`. - *
`options.isCompleteOnTrigger` - returns true if the survey is completing on "complete" trigger. - * @see onComplete - */ - _this.onCompleting = _this.addEvent(); - /** - * The event is fired after a user clicks the 'Complete' button and finishes a survey. Use this event to send the survey data to your web server. - *
`sender` - the survey object that fires the event. - *
`options.showDataSaving(text)` - call this method to show that the survey is saving survey data on your server. The `text` is an optional parameter to show a custom message instead of default. - *
`options.showDataSavingError(text)` - call this method to show that an error occurred while saving the data on your server. If you want to show a custom error, use an optional `text` parameter. - *
`options.showDataSavingSuccess(text)` - call this method to show that the data was successfully saved on the server. - *
`options.showDataSavingClear` - call this method to hide the text about the saving progress. - *
`options.isCompleteOnTrigger` - returns true if the survey is completed on "complete" trigger. - * @see data - * @see clearInvisibleValues - * @see completeLastPage - * @see surveyPostId - */ - _this.onComplete = _this.addEvent(); - /** - * The event is fired before the survey is going to preview mode, state equals to `preview`. It happens when a user click on "Preview" button. It shows when "showPreviewBeforeComplete" proeprty equals to "showAllQuestions" or "showAnsweredQuestions". - * You can prevent showing it by setting allowShowPreview to `false`. - *
`sender` - the survey object that fires the event. - *
`options.allowShowPreview` - Specifies whether a user can see a preview. Set this property to `false` to prevent from showing the preview. The default value is `true`. - * @see showPreviewBeforeComplete - */ - _this.onShowingPreview = _this.addEvent(); - /** - * The event is fired after a user clicks the 'Complete' button. The event allows you to specify the URL opened after completing a survey. - * Specify the `navigateToUrl` property to make survey navigate to another url. - *
`sender` - the survey object that fires the event. - *
`options.url` - Specifies a URL opened after completing a survey. Set this property to an empty string to cancel the navigation and show the completed survey page. - * @see navigateToUrl - * @see navigateToUrlOnCondition - */ - _this.onNavigateToUrl = _this.addEvent(); - /** - * The event is fired after the survey changed it's state from "starting" to "running". The "starting" state means that survey shows the started page. - * The `firstPageIsStarted` property should be set to `true`, if you want to display a start page in your survey. In this case, an end user should click the "Start" button to start the survey. - * @see firstPageIsStarted - */ - _this.onStarted = _this.addEvent(); - /** - * The event is fired on clicking the 'Next' button if the `sendResultOnPageNext` is set to `true`. You can use it to save the intermediate results, for example, if your survey is large enough. - *
`sender` - the survey object that fires the event. - * @see sendResultOnPageNext - */ - _this.onPartialSend = _this.addEvent(); - /** - * The event is fired before the current page changes to another page. Typically it happens when a user click the 'Next' or 'Prev' buttons. - *
`sender` - the survey object that fires the event. - *
`option.oldCurrentPage` - the previous current/active page. - *
`option.newCurrentPage` - a new current/active page. - *
`option.allowChanging` - set it to `false` to disable the current page changing. It is `true` by default. - *
`option.isNextPage` - commonly means, that end-user press the next page button. In general, it means that options.newCurrentPage is the next page after options.oldCurrentPage - *
`option.isPrevPage` - commonly means, that end-user press the previous page button. In general, it means that options.newCurrentPage is the previous page before options.oldCurrentPage - * @see currentPage - * @see currentPageNo - * @see nextPage - * @see prevPage - * @see completeLastPage - * @see onCurrentPageChanged - **/ - _this.onCurrentPageChanging = _this.addEvent(); - /** - * The event is fired when the current page has been changed to another page. Typically it happens when a user click on 'Next' or 'Prev' buttons. - *
`sender` - the survey object that fires the event. - *
`option.oldCurrentPage` - a previous current/active page. - *
`option.newCurrentPage` - a new current/active page. - *
`option.isNextPage` - commonly means, that end-user press the next page button. In general, it means that options.newCurrentPage is the next page after options.oldCurrentPage - *
`option.isPrevPage` - commonly means, that end-user press the previous page button. In general, it means that options.newCurrentPage is the previous page before options.oldCurrentPage - * @see currentPage - * @see currentPageNo - * @see nextPage - * @see prevPage - * @see completeLastPage - * @see onCurrentPageChanging - */ - _this.onCurrentPageChanged = _this.addEvent(); - /** - * The event is fired before the question value (answer) is changed. It can be done via UI by a user or programmatically on calling the `setValue` method. - *
`sender` - the survey object that fires the event. - *
`options.name` - the value name that has being changed. - *
`options.question` - a question which `question.name` equals to the value name. If there are several questions with the same name, the first question is used. If there is no such questions, the `options.question` is null. - *
`options.oldValue` - an old, previous value. - *
`options.value` - a new value. You can change it. - * @see setValue - * @see onValueChanged - */ - _this.onValueChanging = _this.addEvent(); - /** - * The event is fired when the question value (i.e., answer) has been changed. The question value can be changed in UI (by a user) or programmatically (on calling `setValue` method). - * Use the `onDynamicPanelItemValueChanged` and `onMatrixCellValueChanged` events to handle changes in a question in the Panel Dynamic and a cell question in matrices. - *
`sender` - the survey object that fires the event. - *
`options.name` - the value name that has been changed. - *
`options.question` - a question which `question.name` equals to the value name. If there are several questions with the same name, the first question is used. If there is no such questions, the `options.question` is `null`. - *
`options.value` - a new value. - * @see setValue - * @see onValueChanging - * @see onDynamicPanelItemValueChanged - * @see onMatrixCellValueChanged - */ - _this.onValueChanged = _this.addEvent(); - /** - * The event is fired when setVariable function is called. It can be called on changing a calculated value. - *
`sender` - the survey object that fires the event. - *
`options.name` - the variable name that has been changed. - *
`options.value` - a new value. - * @see setVariable - * @see onValueChanged - * @see calculatedValues - */ - _this.onVariableChanged = _this.addEvent(); - /** - * The event is fired when a question visibility has been changed. - *
`sender` - the survey object that fires the event. - *
`options.question` - a question which visibility has been changed. - *
`options.name` - a question name. - *
`options.visible` - a question `visible` boolean value. - * @see Question.visibile - * @see Question.visibileIf - */ - _this.onVisibleChanged = _this.addEvent(); - /** - * The event is fired on changing a page visibility. - *
`sender` - the survey object that fires the event. - *
`options.page` - a page which visibility has been changed. - *
`options.visible` - a page `visible` boolean value. - * @see PageModel.visibile - * @see PageModel.visibileIf - */ - _this.onPageVisibleChanged = _this.addEvent(); - /** - * The event is fired on changing a panel visibility. - *
`sender` - the survey object that fires the event. - *
`options.panel` - a panel which visibility has been changed. - *
`options.visible` - a panel `visible` boolean value. - * @see PanelModel.visibile - * @see PanelModel.visibileIf - */ - _this.onPanelVisibleChanged = _this.addEvent(); - /** - * The event is fired on creating a new question. - * Unlike the onQuestionAdded event, this event calls for all question created in survey including inside: a page, panel, matrix cell, dynamic panel and multiple text. - * or inside a matrix cell or it can be a text question in multiple text items or inside a panel of a panel dynamic. - * You can use this event to set up properties to a question based on it's type for all questions, regardless where they are located, on the page or inside a matrix cell. - * Please note: If you want to use this event for questions loaded from JSON then you have to create survey with empty/null JSON parameter, assign the event and call survey.fromJSON(yourJSON) function. - *
`sender` - the survey object that fires the event. - *
`options.question` - a newly created question object. - * @see Question - * @see onQuestionAdded - */ - _this.onQuestionCreated = _this.addEvent(); - /** - * The event is fired on adding a new question into survey. - *
`sender` - the survey object that fires the event. - *
`options.question` - a newly added question object. - *
`options.name` - a question name. - *
`options.index` - an index of the question in the container (page or panel). - *
`options.parentPanel` - a container where a new question is located. It can be a page or panel. - *
`options.rootPanel` - typically, it is a page. - * @see Question - * @see onQuestionCreated - */ - _this.onQuestionAdded = _this.addEvent(); - /** - * The event is fired on removing a question from survey. - *
`sender` - the survey object that fires the event. - *
`options.question` - a removed question object. - *
`options.name` - a question name. - * @see Question - */ - _this.onQuestionRemoved = _this.addEvent(); - /** - * The event is fired on adding a panel into survey. - *
`sender` - the survey object that fires the event. - *
`options.panel` - a newly added panel object. - *
`options.name` - a panel name. - *
`options.index` - an index of the panel in the container (a page or panel). - *
`options.parentPanel` - a container (a page or panel) where a new panel is located. - *
`options.rootPanel` - a root container, typically it is a page. - * @see PanelModel - */ - _this.onPanelAdded = _this.addEvent(); - /** - * The event is fired on removing a panel from survey. - *
`sender` - the survey object that fires the event. - *
`options.panel` - a removed panel object. - *
`options.name` - a panel name. - * @see PanelModel - */ - _this.onPanelRemoved = _this.addEvent(); - /** - * The event is fired on adding a page into survey. - *
`sender` - the survey object that fires the event. - *
`options.page` - a newly added `panel` object. - * @see PanelModel - */ - _this.onPageAdded = _this.addEvent(); - /** - * The event is fired on validating value in a question. You can specify a custom error message using `options.error`. The survey blocks completing the survey or going to the next page when the error messages are displayed. - *
`sender` - the survey object that fires the event. - *
`options.question` - a validated question. - *
`options.name` - a question name. - *
`options.value` - the current question value (answer). - *
`options.error` - an error string. It is empty by default. - * @see onServerValidateQuestions - * @see onSettingQuestionErrors - */ - _this.onValidateQuestion = _this.addEvent(); - /** - * The event is fired before errors are assigned to a question. You may add/remove/modify errors for a question. - *
`sender` - the survey object that fires the event. - *
`options.question` - a validated question. - *
`options.errors` - the list of errors. The list is empty by default and remains empty if a validated question has no errors. - * @see onValidateQuestion - */ - _this.onSettingQuestionErrors = _this.addEvent(); - /** - * Use this event to validate data on your server. - *
`sender` - the survey object that fires the event. - *
`options.data` - the values of all non-empty questions on the current page. You can get a question value as `options.data["myQuestionName"]`. - *
`options.errors` - set your errors to this object as: `options.errors["myQuestionName"] = "Error text";`. It will be shown as a question error. - *
`options.complete()` - call this function to tell survey that your server callback has been processed. - * @see onValidateQuestion - * @see onValidatePanel - */ - _this.onServerValidateQuestions = _this.addEvent(); - /** - * Use this event to modify the HTML before rendering, for example HTML on a completed page. - *
`sender` - the survey object that fires the event. - *
`options.html` - an HTML that you may change before text processing and then rendering. - * @see completedHtml - * @see loadingHtml - * @see QuestionHtmlModel.html - */ - /** - * The event is fired on validating a panel. Set your error to `options.error` and survey will show the error for the panel and block completing the survey or going to the next page. - *
`sender` - the survey object that fires the event. - *
`options.name` - a panel name. - *
`options.error` - an error string. It is empty by default. - * @see onValidateQuestion - */ - _this.onValidatePanel = _this.addEvent(); - /** - * Use the event to change the default error text. - *
`sender` - the survey object that fires the event. - *
`options.text` - an error text. - *
`options.error` - an instance of the `SurveyError` object. - *
`options.name` - the error name. The following error names are available: - * required, requireoneanswer, requirenumeric, exceedsize, webrequest, webrequestempty, otherempty, - * uploadingfile, requiredinallrowserror, minrowcounterror, keyduplicationerror, custom - */ - _this.onErrorCustomText = _this.addEvent(); - /** - * Use the this event to be notified when the survey finished validate questions on the current page. It commonly happens when a user try to go to the next page or complete the survey - * options.questions - the list of questions that have errors - * options.errors - the list of errors - * options.page - the page where question(s) are located - */ - _this.onValidatedErrorsOnCurrentPage = _this.addEvent(); - /** - * Use this event to modify the HTML content before rendering, for example `completeHtml` or `loadingHtml`. - * `options.html` - specifies the modified HTML content. - * @see completedHtml - * @see loadingHtml - */ - _this.onProcessHtml = _this.addEvent(); - /** - * Use this event to change the question title in code. If you want to remove question numbering then set showQuestionNumbers to "off". - *
`sender` - the survey object that fires the event. - *
`options.title` - a calculated question title, based on question `title`, `name`. - *
`options.question` - a question object. - * @see showQuestionNumbers - * @see requiredText - */ - _this.onGetQuestionTitle = _this.addEvent(); - /** - * Use this event to change the element title tag name that renders by default. - *
`sender` - the survey object that fires the event. - *
`options.element` - an element (question, panel, page and survey) that SurveyJS is going to render. - *
`options.tagName` - an element title tagName that are used to render a title. You can change it from the default value. - * @see showQuestionNumbers - * @see requiredText - */ - _this.onGetTitleTagName = _this.addEvent(); - /** - * Use this event to change the question no in code. If you want to remove question numbering then set showQuestionNumbers to "off". - *
`sender` - the survey object that fires the event. - *
`options.no` - a calculated question no, based on question `visibleIndex`, survey `.questionStartIndex` properties. You can change it. - *
`options.question` - a question object. - * @see showQuestionNumbers - * @see questionStartIndex - */ - _this.onGetQuestionNo = _this.addEvent(); - /** - * Use this event to change the progress text in code. - *
`sender` - the survey object that fires the event. - *
`options.text` - a progress text, that SurveyJS will render in progress bar. - *
`options.questionCount` - a number of questions that have input(s). We do not count html or expression questions - *
`options.answeredQuestionCount` - a number of questions that have input(s) and an user has answered. - *
`options.requiredQuestionCount` - a number of required questions that have input(s). We do not count html or expression questions - *
`options.requiredAnsweredQuestionCount` - a number of required questions that have input(s) and an user has answered. - * @see progressBarType - */ - _this.onProgressText = _this.addEvent(); - /** - * Use this event to process the markdown text. - *
`sender` - the survey object that fires the event. - *
`options.element` - SurveyJS element (a question, panel, page, or survey) where the string is going to be rendered. - *
`options.name` - a property name is going to be rendered. - *
`options.text` - a text that is going to be rendered. - *
`options.html` - an HTML content. It is `null` by default. Use this property to specify the HTML content rendered instead of `options.text`. - */ - _this.onTextMarkdown = _this.addEvent(); - /** - * Use this event to specity render component name used for text rendering. - *
`sender` - the survey object that fires the event. - *
`options.element` - SurveyJS element (a question, panel, page, or survey) where the string is going to be rendered. - *
`options.name` - a property name is going to be rendered. - *
`options.renderAs` - a component name used for text rendering. - */ - _this.onTextRenderAs = _this.addEvent(); - /** - * The event fires when it gets response from the [api.surveyjs.io](https://api.surveyjs.io) service on saving survey results. Use it to find out if the results have been saved successfully. - *
`sender` - the survey object that fires the event. - *
`options.success` - it is `true` if the results has been sent to the service successfully. - *
`options.response` - a response from the service. - */ - _this.onSendResult = _this.addEvent(); - /** - * Use it to get results after calling the `getResult` method. It returns a simple analytics from [api.surveyjs.io](https://api.surveyjs.io) service. - *
`sender` - the survey object that fires the event. - *
`options.success` - it is `true` if the results were got from the service successfully. - *
`options.data` - the object `{AnswersCount, QuestionResult : {} }`. `AnswersCount` is the number of posted survey results. `QuestionResult` is an object with all possible unique answers to the question and number of these answers. - *
`options.dataList` - an array of objects `{name, value}`, where `name` is a unique value/answer to the question and `value` is a number/count of such answers. - *
`options.response` - the server response. - * @see getResult - */ - _this.onGetResult = _this.addEvent(); - /** - * The event is fired on uploading the file in QuestionFile when `storeDataAsText` is set to `false`. Use this event to change the uploaded file name or to prevent a particular file from being uploaded. - *
`sender` - the survey object that fires the event. - *
`options.question` - the file question instance. - *
`options.name` - the question name. - *
`options.files` - the Javascript File objects array to upload. - *
`options.callback` - a callback function to get the file upload status and the updloaded file content. - * @see uploadFiles - * @see QuestionFileModel.storeDataAsText - * @see onDownloadFile - * @see onClearFiles - * @see [View Examples](https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fsurveyjs.io%2FExamples%2F+%22onUploadFiles%22) - */ - _this.onUploadFiles = _this.addEvent(); - /** - * The event is fired on downloading a file in QuestionFile. Use this event to pass the file to a preview. - *
`sender` - the survey object that fires the event. - *
`options.name` - the question name. - *
`options.content` - the file content. - *
`options.fileValue` - single file question value. - *
`options.callback` - a callback function to get the file downloading status and the downloaded file content. - * @see downloadFile - * @see onClearFiles - * @see onUploadFiles - * @see [View Examples](https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fsurveyjs.io%2FExamples%2F+%22onDownloadFile%22) - */ - _this.onDownloadFile = _this.addEvent(); - /** - * This event is fired on clearing the value in a QuestionFile. Use this event to remove files stored on your server. - *
`sender` - the survey object that fires the event. - *
`question` - the question instance. - *
`options.name` - the question name. - *
`options.value` - the question value. - *
`options.fileName` - a removed file's name, set it to `null` to clear all files. - *
`options.callback` - a callback function to get the operation status. - * @see clearFiles - * @see onDownloadFile - * @see onUploadFiles - * @see [View Examples](https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fsurveyjs.io%2FExamples%2F+%22onClearFiles%22) - */ - _this.onClearFiles = _this.addEvent(); - /** - * The event is fired after choices for radiogroup, checkbox, and dropdown has been loaded from a RESTful service and before they are assigned to a question. - * You may change the choices, before they are assigned or disable/enabled make visible/invisible question, based on loaded results. - *
`sender` - the survey object that fires the event. - *
`question` - the question where loaded choices are going to be assigned. - *
`choices` - the loaded choices. You can change the loaded choices to before they are assigned to question. - *
`serverResult` - a result that comes from the server as it is. - */ - _this.onLoadChoicesFromServer = _this.addEvent(); - /** - * The event is fired after survey is loaded from api.surveyjs.io service. - * You can use this event to perform manipulation with the survey model after it was loaded from the web service. - *
`sender` - the survey object that fires the event. - * @see surveyId - * @see loadSurveyFromService - */ - _this.onLoadedSurveyFromService = _this.addEvent(); - /** - * The event is fired on processing the text when it finds a text in brackets: `{somevalue}`. By default, it uses the value of survey question values and variables. - * For example, you may use the text processing in loading choices from the web. If your `choicesByUrl.url` equals to "UrlToServiceToGetAllCities/{country}/{state}", - * you may set on this event `options.value` to "all" or empty string when the "state" value/question is non selected by a user. - *
`sender` - the survey object that fires the event. - *
`options.name` - the name of the processing value, for example, "state" in our example. - *
`options.value` - the value of the processing text. - *
`options.isExists` - a boolean value. Set it to `true` if you want to use the value and set it to `false` if you don't. - */ - _this.onProcessTextValue = _this.addEvent(); - /** - * The event is fired before rendering a question. Use it to override the default question CSS classes. - *
`sender` - the survey object that fires the event. - *
`options.question` - a question for which you can change the CSS classes. - *
`options.cssClasses` - an object with CSS classes. For example `{root: "table", button: "button"}`. You can change them to your own CSS classes. - */ - _this.onUpdateQuestionCssClasses = _this.addEvent(); - /** - * The event is fired before rendering a panel. Use it to override the default panel CSS classes. - *
`sender` - the survey object that fires the event. - *
`options.panel` - a panel for which you can change the CSS classes. - *
`options.cssClasses` - an object with CSS classes. For example `{title: "sv_p_title", description: "small"}`. You can change them to your own CSS classes. - */ - _this.onUpdatePanelCssClasses = _this.addEvent(); - /** - * The event is fired before rendering a page. Use it to override the default page CSS classes. - *
`sender` - the survey object that fires the event. - *
`options.page` - a page for which you can change the CSS classes. - *
`options.cssClasses` - an object with CSS classes. For example `{title: "sv_p_title", description: "small"}`. You can change them to your own CSS classes. - */ - _this.onUpdatePageCssClasses = _this.addEvent(); - /** - * The event is fired before rendering a choice item in radiogroup, checkbox or dropdown questions. Use it to override the default choice item css. - *
`sender` - the survey object that fires the event. - *
`options.question` - a question where choice item is rendered. - *
`options.item` - a choice item of ItemValue type. You can get value or text choice properties as options.item.value or options.choice.text - *
`options.css` - a string with css classes divided by space. You can change it. - */ - _this.onUpdateChoiceItemCss = _this.addEvent(); - /** - * The event is fired right after survey is rendered in DOM. - *
`sender` - the survey object that fires the event. - *
`options.htmlElement` - a root HTML element bound to the survey object. - */ - _this.onAfterRenderSurvey = _this.addEvent(); - /** - * The event is fired right after a page is rendered in DOM. Use it to modify HTML elements. - *
`sender` - the survey object that fires the event. - *
`options.htmlElement` - an HTML element bound to the survey header object. - */ - _this.onAfterRenderHeader = _this.addEvent(); - /** - * The event is fired right after a page is rendered in DOM. Use it to modify HTML elements. - *
`sender` - the survey object that fires the event. - *
`options.page` - a page object for which the event is fired. Typically the current/active page. - *
`options.htmlElement` - an HTML element bound to the page object. - */ - _this.onAfterRenderPage = _this.addEvent(); - /** - * The event is fired right after a question is rendered in DOM. Use it to modify HTML elements. - *
`sender` - the survey object that fires the event. - *
`options.question` - a question object for which the event is fired. - *
`options.htmlElement` - an HTML element bound to the question object. - */ - _this.onAfterRenderQuestion = _this.addEvent(); - /** - * The event is fired right after a non-composite question (text, comment, dropdown, radiogroup, checkbox) is rendered in DOM. Use it to modify HTML elements. - * This event is not fired for matrices, panels, multiple text and image picker. - *
`sender` - the survey object that fires the event. - *
`options.question` - a question object for which the event is fired. - *
`options.htmlElement` - an HTML element bound to the question object. - */ - _this.onAfterRenderQuestionInput = _this.addEvent(); - /** - * The event is fired right after a panel is rendered in DOM. Use it to modify HTML elements. - *
`sender` - the survey object that fires the event - *
`options.panel` - a panel object for which the event is fired - *
`options.htmlElement` - an HTML element bound to the panel object - */ - _this.onAfterRenderPanel = _this.addEvent(); - /** - * The event occurs when an element within a question gets focus. - *
`sender` - A [survey](https://surveyjs.io/Documentation/Library?id=surveymodel) object that fires the event. - *
`options.question` - A [question](https://surveyjs.io/Documentation/Library?id=Question) whose child element gets focus. - * @see onFocusInPanel - */ - _this.onFocusInQuestion = _this.addEvent(); - /** - * The event occurs when an element within a panel gets focus. - *
`sender` - A [survey](https://surveyjs.io/Documentation/Library?id=surveymodel) object that fires the event. - *
`options.panel` - A [panel](https://surveyjs.io/Documentation/Library?id=PanelModelBase) whose child element gets focus. - * @see onFocusInQuestion - */ - _this.onFocusInPanel = _this.addEvent(); - /** - * The event is fired on adding a new row in Matrix Dynamic question. - *
`sender` - the survey object that fires the event - *
`options.question` - a matrix question. - *
`options.row` - a new added row. - * @see QuestionMatrixDynamicModel - * @see QuestionMatrixDynamicModel.visibleRows - */ - _this.onMatrixRowAdded = _this.addEvent(); - /** - * The event is fired before adding a new row in Matrix Dynamic question. - *
`sender` - the survey object that fires the event - *
`options.question` - a matrix question. - *
`options.canAddRow` - specifies whether a new row can be added - * @see QuestionMatrixDynamicModel - * @see QuestionMatrixDynamicModel.visibleRows - */ - _this.onMatrixBeforeRowAdded = _this.addEvent(); - /** - * The event is fired before removing a row from Matrix Dynamic question. You can disable removing and clear the data instead. - *
`sender` - the survey object that fires the event - *
`options.question` - a matrix question. - *
`options.rowIndex` - a row index. - *
`options.row` - a row object. - *
`options.allow` - a boolean property. Set it to `false` to disable the row removing. - * @see QuestionMatrixDynamicModel - * @see onMatrixRowRemoved - * @see onMatrixAllowRemoveRow - */ - _this.onMatrixRowRemoving = _this.addEvent(); - /** - * The event is fired on removing a row from Matrix Dynamic question. - *
`sender` - the survey object that fires the event - *
`options.question` - a matrix question - *
`options.rowIndex` - a removed row index - *
`options.row` - a removed row object - * @see QuestionMatrixDynamicModel - * @see QuestionMatrixDynamicModel.visibleRows - * @see onMatrixRowRemoving - * @see onMatrixAllowRemoveRow - */ - _this.onMatrixRowRemoved = _this.addEvent(); - /** - * The event is fired before rendering "Remove" button for removing a row from Matrix Dynamic question. - *
`sender` - the survey object that fires the event - *
`options.question` - a matrix question. - *
`options.rowIndex` - a row index. - *
`options.row` - a row object. - *
`options.allow` - a boolean property. Set it to `false` to disable the row removing. - * @see QuestionMatrixDynamicModel - * @see onMatrixRowRemoving - * @see onMatrixRowRemoved - */ - _this.onMatrixAllowRemoveRow = _this.addEvent(); - /** - * The event is fired before creating cell question in the matrix. You can change the cell question type by setting different options.cellType. - *
`sender` - the survey object that fires the event. - *
`options.question` - the matrix question. - *
`options.cellType` - the cell question type. You can change it. - *
`options.rowValue` - the value of the current row. To access a particular column's value within the current row, use: `options.rowValue["columnValue"]`. - *
`options.column` - the matrix column object. - *
`options.columnName` - the matrix column name. - *
`options.row` - the matrix row object. - * @see onMatrixBeforeRowAdded - * @see onMatrixCellCreated - * @see QuestionMatrixDynamicModel - * @see QuestionMatrixDropdownModel - */ - _this.onMatrixCellCreating = _this.addEvent(); - /** - * The event is fired for every cell created in Matrix Dynamic and Matrix Dropdown questions. - *
`sender` - the survey object that fires the event. - *
`options.question` - the matrix question. - *
`options.cell` - the matrix cell. - *
`options.cellQuestion` - the question/editor in the cell. You may customize it, change it's properties, like choices or visible. - *
`options.rowValue` - the value of the current row. To access a particular column's value within the current row, use: `options.rowValue["columnValue"]`. - *
`options.column` - the matrix column object. - *
`options.columnName` - the matrix column name. - *
`options.row` - the matrix row object. - * @see onMatrixBeforeRowAdded - * @see onMatrixCellCreating - * @see onMatrixRowAdded - * @see QuestionMatrixDynamicModel - * @see QuestionMatrixDropdownModel - */ - _this.onMatrixCellCreated = _this.addEvent(); - /** - * The event is fired for every cell after is has been rendered in DOM. - *
`sender` - the survey object that fires the event. - *
`options.question` - the matrix question. - *
`options.cell` - the matrix cell. - *
`options.cellQuestion` - the question/editor in the cell. - *
`options.htmlElement` - an HTML element bound to the `cellQuestion` object. - *
`options.column` - the matrix column object. - *
`options.row` - the matrix row object. - * @see onMatrixCellCreated - * @see QuestionMatrixDynamicModel - * @see QuestionMatrixDropdownModel - */ - _this.onMatrixAfterCellRender = _this.addEvent(); - /** - * The event is fired when cell value is changed in Matrix Dynamic and Matrix Dropdown questions. - *
`sender` - the survey object that fires the event. - *
`options.question` - the matrix question. - *
`options.columnName` - the matrix column name. - *
`options.value` - a new value. - *
`options.row` - the matrix row object. - *
`options.getCellQuestion(columnName)` - the function that returns the cell question by column name. - * @see onMatrixCellValueChanging - * @see onMatrixBeforeRowAdded - * @see onMatrixRowAdded - * @see QuestionMatrixDynamicModel - * @see QuestionMatrixDropdownModel - */ - _this.onMatrixCellValueChanged = _this.addEvent(); - /** - * The event is fired on changing cell value in Matrix Dynamic and Matrix Dropdown questions. You may change the `options.value` property to change a cell value. - *
`sender` - the survey object that fires the event. - *
`options.question` - the matrix question. - *
`options.columnName` - the matrix column name. - *
`options.value` - a new value. - *
`options.oldValue` - the old value. - *
`options.row` - the matrix row object. - *
`options.getCellQuestion(columnName)` - the function that returns a cell question by column name. - * @see onMatrixCellValueChanged - * @see onMatrixBeforeRowAdded - * @see onMatrixRowAdded - * @see QuestionMatrixDynamicModel - * @see QuestionMatrixDropdownModel - */ - _this.onMatrixCellValueChanging = _this.addEvent(); - /** - * The event is fired when Matrix Dynamic and Matrix Dropdown questions validate the cell value. - *
`sender` - the survey object that fires the event. - *
`options.error` - an error string. It is empty by default. - *
`options.question` - the matrix question. - *
`options.columnName` - the matrix column name. - *
`options.value` - a cell value. - *
`options.row` - the matrix row object. - *
`options.getCellQuestion(columnName)` - the function that returns the cell question by column name. - * @see onMatrixBeforeRowAdded - * @see onMatrixRowAdded - * @see QuestionMatrixDynamicModel - * @see QuestionMatrixDropdownModel - */ - _this.onMatrixCellValidate = _this.addEvent(); - /** - * The event is fired on adding a new panel in Panel Dynamic question. - *
`sender` - the survey object that fires the event. - *
`options.question` - a panel question. - *
`options.panel` - an added panel. - * @see QuestionPanelDynamicModel - * @see QuestionPanelDynamicModel.panels - */ - _this.onDynamicPanelAdded = _this.addEvent(); - /** - * The event is fired on removing a panel from Panel Dynamic question. - *
`sender` - the survey object that fires the event. - *
`options.question` - a panel question. - *
`options.panelIndex` - a removed panel index. - *
`options.panel` - a removed panel. - * @see QuestionPanelDynamicModel - * @see QuestionPanelDynamicModel.panels - */ - _this.onDynamicPanelRemoved = _this.addEvent(); - /** - * The event is fired every second if the method `startTimer` has been called. - * @see startTimer - * @see timeSpent - * @see Page.timeSpent - */ - _this.onTimer = _this.addEvent(); - /** - * The event is fired before displaying a new information in the Timer Panel. Use it to change the default text. - *
`sender` - the survey object that fires the event. - *
`options.text` - the timer panel info text. - */ - _this.onTimerPanelInfoText = _this.addEvent(); - /** - * The event is fired when item value is changed in Panel Dynamic question. - *
`sender` - the survey object that fires the event. - *
`options.question` - the panel question. - *
`options.panel` - the dynamic panel item. - *
`options.name` - the item name. - *
`options.value` - a new value. - *
`options.itemIndex` - the panel item index. - *
`options.itemValue` - the panel item object. - * @see onDynamicPanelAdded - * @see QuestionPanelDynamicModel - */ - _this.onDynamicPanelItemValueChanged = _this.addEvent(); - /** - * Use this event to define, whether an answer to a question is correct or not. - *
`sender` - the survey object that fires the event. - *
`options.question` - a question on which you have to decide if the answer is correct or not. - *
`options.result` - returns `true`, if an answer is correct, or `false`, if the answer is not correct. Use questions' `value` and `correctAnswer` properties to return the correct value. - *
`options.correctAnswers` - you may change the default number of correct or incorrect answers in the question, for example for matrix, where each row is a quiz question. - * @see Question.value - * @see Question.correctAnswer - */ - _this.onIsAnswerCorrect = _this.addEvent(); - /** - * Use this event to control drag&drop operations during design mode. - *
`sender` - the survey object that fires the event. - *
`options.allow` - set it to `false` to disable dragging. - *
`options.target` - a target element that is dragged. - *
`options.source` - a source element. It can be `null`, if it is a new element, dragging from toolbox. - *
`options.parent` - a page or panel where target element is dragging. - *
`options.insertBefore` - an element before the target element is dragging. It can be `null` if parent container (page or panel) is empty or dragging an element after the last element in a container. - *
`options.insertAfter` - an element after the target element is dragging. It can be `null` if parent container (page or panel) is empty or dragging element to the first position within the parent container. - * @see setDesignMode - * @see isDesignMode - */ - _this.onDragDropAllow = _this.addEvent(); - /** - * Use this event to control scrolling element to top. You can cancel the default behavior by setting options.cancel property to true. - *
`sender` - the survey object that fires the event. - *
`options.element` - an element that is going to be scrolled on top. - *
`options.question` - a question that is going to be scrolled on top. It can be null if options.page is not null. - *
`options.page` - a page that is going to be scrolled on top. It can be null if options.question is not null. - *
`options.elementId` - the unique element DOM Id. - *
`options.cancel` - set this property to true to cancel the default scrolling. - */ - _this.onScrollingElementToTop = _this.addEvent(); - _this.onLocaleChangedEvent = _this.addEvent(); - /** - * Use this event to create/customize actions to be displayed in a question's title. - *
`sender` - A [Survey](https://surveyjs.io/Documentation/Library?id=SurveyModel) object that fires the event. - *
`options.question` - A [Question](https://surveyjs.io/Documentation/Library?id=Question) object for which the event is fired. - *
`options.titleActions` - A list of actions ([IAction](https://surveyjs.io/Documentation/Library?id=IAction) objects) associated with the processed question. - * @see IAction - * @see Question - */ - _this.onGetQuestionTitleActions = _this.addEvent(); - /** - * Use this event to create/customize actions to be displayed in a panel's title. - *
`sender` - A survey object that fires the event. - *
`options.panel` - A panel ([PanelModel](https://surveyjs.io/Documentation/Library?id=panelmodel) object) for which the event is fired. - *
`options.titleActions` - A list of actions ([IAction](https://surveyjs.io/Documentation/Library?id=IAction) objects) associated with the processed panel. - * @see IAction - * @see PanelModel - */ - _this.onGetPanelTitleActions = _this.addEvent(); - /** - * Use this event to create/customize actions to be displayed in a page's title. - *
`sender` - A survey object that fires the event. - *
`options.page` - A page ([PageModel](https://surveyjs.io/Documentation/Library?id=pagemodel) object) for which the event is fired. - *
`options.titleActions` - A list of actions ([IAction](https://surveyjs.io/Documentation/Library?id=IAction) objects) associated with the processed page. - * @see IAction - * @see PageModel - */ - _this.onGetPageTitleActions = _this.addEvent(); - /** - * Use this event to create/customize actions to be displayed in a matrix question's row. - *
`sender` - A survey object that fires the event. - *
`options.question` - A matrix question ([QuestionMatrixBaseModel](https://surveyjs.io/Documentation/Library?id=questionmatrixbasemodel) object) for which the event is fired. - *
`options.row` - A matrix row for which the event is fired. - *
`options.actions` - A list of actions ([IAction](https://surveyjs.io/Documentation/Library?id=IAction) objects) associated with the processed matrix question and row. - * @see IAction - * @see QuestionMatrixDropdownModelBase - */ - _this.onGetMatrixRowActions = _this.addEvent(); - /** - * The event is fired after the survey element content was collapsed or expanded. - *
`sender` - the survey object that fires the event. - *
`options.element` - Specifies which survey element content was collapsed or expanded. - * @see onElementContentVisibilityChanged - */ - _this.onElementContentVisibilityChanged = _this.addEvent(); - /** - * The event is fired before expression question convert it's value into display value for rendering. - *
`sender` - the survey object that fires the event. - *
`options.question` - The expression question. - *
`options.value` - The question value. - *
`options.displayValue` - the display value that you can change before rendering. - */ - _this.onGetExpressionDisplayValue = _this.addEvent(); - /** - * The list of errors on loading survey JSON. If the list is empty after loading a JSON, then the JSON is correct and has no errors. - * @see JsonError - */ - _this.jsonErrors = null; - _this.cssValue = null; - /** - * Gets or sets whether to hide all required errors. - */ - _this.hideRequiredErrors = false; - //#endregion - _this._isMobile = false; - _this._isDesignMode = false; - /** - * Gets or sets whether the survey must ignore validation like required questions and others, on `nextPage` and `completeLastPage` function calls. The default is `false`. - * @see nextPage - * @see completeLastPage - * @see mode - */ - _this.ignoreValidation = false; - _this.isNavigationButtonPressed = false; - _this.isCalculatingProgressText = false; - _this.isTriggerIsRunning = false; - _this.triggerValues = null; - _this.triggerKeys = null; - _this.conditionValues = null; - _this.isValueChangedOnRunningCondition = false; - _this.conditionRunnerCounter = 0; - _this.conditionUpdateVisibleIndexes = false; - _this.conditionNotifyElementsOnAnyValueOrVariableChanged = false; - _this.isEndLoadingFromJson = null; - _this.questionHashes = { - names: {}, - namesInsensitive: {}, - valueNames: {}, - valueNamesInsensitive: {}, - }; - _this.timerFunc = null; - /** - * Returns the time in seconds an end user spends on the survey - * @see startTimer - * @see PageModel.timeSpent - */ - _this.timeSpent = 0; - _this.skeletonComponentName = "sv-skeleton"; - if (typeof document !== "undefined") { - SurveyModel.stylesManager = new _stylesmanager__WEBPACK_IMPORTED_MODULE_11__["StylesManager"](); - } - _this.createLocalizableString("logo", _this, false); - _this.createLocalizableString("completedHtml", _this); - _this.createLocalizableString("completedBeforeHtml", _this); - _this.createLocalizableString("loadingHtml", _this); - _this.createLocalizableString("startSurveyText", _this, false, true); - _this.createLocalizableString("pagePrevText", _this, false, true); - _this.createLocalizableString("pageNextText", _this, false, true); - _this.createLocalizableString("completeText", _this, false, true); - _this.createLocalizableString("previewText", _this, false, true); - _this.createLocalizableString("editText", _this, false, true); - _this.createLocalizableString("questionTitleTemplate", _this, true); - _this.textPreProcessor = new _textPreProcessor__WEBPACK_IMPORTED_MODULE_5__["TextPreProcessor"](); - _this.textPreProcessor.onProcess = function (textValue) { - _this.getProcessedTextValue(textValue); - }; - _this.createNewArray("pages", function (value) { - _this.doOnPageAdded(value); - }, function (value) { - _this.doOnPageRemoved(value); - }); - _this.createNewArray("triggers", function (value) { - value.setOwner(_this); - }); - _this.createNewArray("calculatedValues", function (value) { - value.setOwner(_this); - }); - _this.createNewArray("completedHtmlOnCondition", function (value) { - value.locOwner = _this; - }); - _this.createNewArray("navigateToUrlOnCondition", function (value) { - value.locOwner = _this; - }); - _this.registerFunctionOnPropertyValueChanged("firstPageIsStarted", function () { - _this.onFirstPageIsStartedChanged(); - }); - _this.registerFunctionOnPropertyValueChanged("mode", function () { - _this.onModeChanged(); - }); - _this.registerFunctionOnPropertyValueChanged("progressBarType", function () { - _this.updateProgressText(); - }); - _this.registerFunctionOnPropertiesValueChanged(["questionStartIndex", "requiredText", "questionTitlePattern"], function () { - _this.resetVisibleIndexes(); - }); - _this.onGetQuestionNo.onCallbacksChanged = function () { - _this.resetVisibleIndexes(); - }; - _this.onProgressText.onCallbacksChanged = function () { - _this.updateProgressText(); - }; - _this.onTextMarkdown.onCallbacksChanged = function () { - _this.locStrsChanged(); - }; - _this.onGetQuestionTitle.onCallbacksChanged = function () { - _this.locStrsChanged(); - }; - _this.onUpdatePageCssClasses.onCallbacksChanged = function () { - _this.currentPage && _this.currentPage.updateElementCss(); - }; - _this.onUpdatePanelCssClasses.onCallbacksChanged = function () { - _this.currentPage && _this.currentPage.updateElementCss(); - }; - _this.onUpdateQuestionCssClasses.onCallbacksChanged = function () { - _this.currentPage && _this.currentPage.updateElementCss(); - }; - _this.onBeforeCreating(); - if (jsonObj) { - if (typeof jsonObj === "string" || jsonObj instanceof String) { - jsonObj = JSON.parse(jsonObj); - } - if (jsonObj && jsonObj.clientId) { - _this.clientId = jsonObj.clientId; - } - _this.fromJSON(jsonObj); - if (_this.surveyId) { - _this.loadSurveyFromService(_this.surveyId, _this.clientId); - } - } - _this.onCreating(); - return _this; - } - Object.defineProperty(SurveyModel.prototype, "platformName", { - get: function () { - return SurveyModel.platform; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "commentPrefix", { - /** - * You can display an additional field (comment field) for the most of questions; users can enter additional comments to their response. - * The comment field input is saved as `'question name' + 'commentPrefix'`. - * @see data - * @see Question.hasComment - */ - get: function () { - return _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].commentPrefix; - }, - set: function (val) { - _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].commentPrefix = val; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getType = function () { - return "survey"; - }; - SurveyModel.prototype.onPropertyValueChanged = function (name, oldValue, newValue) { - if (name === "questionsOnPageMode") { - this.onQuestionsOnPageModeChanged(oldValue); - } - }; - Object.defineProperty(SurveyModel.prototype, "pages", { - /** - * Returns a list of all pages in the survey, including invisible pages. - * @see PageModel - * @see visiblePages - */ - get: function () { - return this.getPropertyValue("pages"); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getCss = function () { - return this.css; - }; - Object.defineProperty(SurveyModel.prototype, "css", { - get: function () { - if (!this.cssValue) { - this.cssValue = {}; - this.copyCssClasses(this.cssValue, _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_3__["surveyCss"].getCss()); - } - return this.cssValue; - }, - set: function (value) { - this.updateElementCss(false); - this.mergeValues(value, this.css); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "cssTitle", { - get: function () { - return this.css.title; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "cssNavigationComplete", { - get: function () { - return this.getNavigationCss(this.css.navigationButton, this.css.navigation.complete); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "cssNavigationPreview", { - get: function () { - return this.getNavigationCss(this.css.navigationButton, this.css.navigation.preview); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "cssNavigationEdit", { - get: function () { - return this.getNavigationCss(this.css.navigationButton, this.css.navigation.edit); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "cssNavigationPrev", { - get: function () { - return this.getNavigationCss(this.css.navigationButton, this.css.navigation.prev); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "cssNavigationStart", { - get: function () { - return this.getNavigationCss(this.css.navigationButton, this.css.navigation.start); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "cssNavigationNext", { - get: function () { - return this.getNavigationCss(this.css.navigationButton, this.css.navigation.next); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "completedCss", { - get: function () { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_16__["CssClassBuilder"]().append(this.css.body) - .append(this.css.completedPage).toString(); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getNavigationCss = function (main, btn) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_16__["CssClassBuilder"]().append(main) - .append(btn).toString(); - }; - Object.defineProperty(SurveyModel.prototype, "lazyRendering", { - /** - * By default all rows are rendered no matters if they are visible or not. - * Set it true, and survey markup rows will be rendered only if they are visible in viewport. - * This feature is experimantal and might do not support all the use cases. - */ - get: function () { - return this.lazyRenderingValue === true; - }, - set: function (val) { - if (this.lazyRendering === val) - return; - this.lazyRenderingValue = val; - var page = this.currentPage; - if (!!page) { - page.updateRows(); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isLazyRendering", { - get: function () { - return this.lazyRendering || _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].lazyRowsRendering; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.updateLazyRenderingRowsOnRemovingElements = function () { - if (!this.isLazyRendering) - return; - var page = this.currentPage; - if (!!page) { - Object(_utils_utils__WEBPACK_IMPORTED_MODULE_15__["scrollElementByChildId"])(page.id); - } - }; - Object.defineProperty(SurveyModel.prototype, "triggers", { - /** - * Gets or sets a list of triggers in the survey. - * @see SurveyTrigger - */ - get: function () { - return this.getPropertyValue("triggers"); - }, - set: function (val) { - this.setPropertyValue("triggers", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "calculatedValues", { - /** - * Gets or sets a list of calculated values in the survey. - * @see CalculatedValue - */ - get: function () { - return this.getPropertyValue("calculatedValues"); - }, - set: function (val) { - this.setPropertyValue("calculatedValues", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "surveyId", { - /** - * Gets or sets an identifier of a survey model loaded from the [api.surveyjs.io](https://api.surveyjs.io) service. When specified, the survey JSON is automatically loaded from [api.surveyjs.io](https://api.surveyjs.io) service. - * @see loadSurveyFromService - * @see onLoadedSurveyFromService - */ - get: function () { - return this.getPropertyValue("surveyId", ""); - }, - set: function (val) { - this.setPropertyValue("surveyId", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "surveyPostId", { - /** - * Gets or sets an identifier of a survey model saved to the [api.surveyjs.io](https://api.surveyjs.io) service. When specified, the survey data is automatically saved to the [api.surveyjs.io](https://api.surveyjs.io) service. - * @see onComplete - * @see surveyShowDataSaving - */ - get: function () { - return this.getPropertyValue("surveyPostId", ""); - }, - set: function (val) { - this.setPropertyValue("surveyPostId", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "clientId", { - /** - * Gets or sets user's identifier (e.g., e-mail or unique customer id) in your web application. - * If you load survey or post survey results from/to [api.surveyjs.io](https://api.surveyjs.io) service, then the library do not allow users to run the same survey the second time. - * On the second run, the user will see the survey complete page. - */ - get: function () { - return this.getPropertyValue("clientId", ""); - }, - set: function (val) { - this.setPropertyValue("clientId", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "cookieName", { - /** - * Gets or sets a cookie name used to save information about completing the survey. - * If the property is not empty, before starting the survey, the Survey library checks if the cookie with this name exists. - * If it is `true`, the survey goes to complete mode and a user sees the survey complete page. On completing the survey the cookie with this name is created. - */ - get: function () { - return this.getPropertyValue("cookieName", ""); - }, - set: function (val) { - this.setPropertyValue("cookieName", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "sendResultOnPageNext", { - /** - * Gets or sets whether to save survey results on completing every page. If the property value is set to `true`, the `onPartialSend` event is fired. - * @see onPartialSend - * @see clientId - */ - get: function () { - return this.getPropertyValue("sendResultOnPageNext", false); - }, - set: function (val) { - this.setPropertyValue("sendResultOnPageNext", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "surveyShowDataSaving", { - /** - * Gets or sets whether to show the progress on saving/sending data into the [api.surveyjs.io](https://api.surveyjs.io) service. - * @see surveyPostId - */ - get: function () { - return this.getPropertyValue("surveyShowDataSaving", false); - }, - set: function (val) { - this.setPropertyValue("surveyShowDataSaving", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "focusFirstQuestionAutomatic", { - /** - * Gets or sets whether the first input is focused on showing a next or a previous page. - */ - get: function () { - return this.getPropertyValue("focusFirstQuestionAutomatic"); - }, - set: function (val) { - this.setPropertyValue("focusFirstQuestionAutomatic", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "focusOnFirstError", { - /** - * Gets or sets whether the first input is focused if the current page has errors. - * Set this property to `false` (the default value is `true`) if you do not want to bring the focus to the first question that has error on the page. - */ - get: function () { - return this.getPropertyValue("focusOnFirstError"); - }, - set: function (val) { - this.setPropertyValue("focusOnFirstError", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "showNavigationButtons", { - /** - * Gets or sets the navigation buttons position. - * Possible values: 'bottom' (default), 'top', 'both' and 'none'. Set it to 'none' to hide 'Prev', 'Next' and 'Complete' buttons. - * It makes sense if you are going to create a custom navigation, have only a single page, or the `goNextPageAutomatic` property is set to `true`. - * @see goNextPageAutomatic - * @see showPrevButton - */ - get: function () { - return this.getPropertyValue("showNavigationButtons"); - }, - set: function (val) { - if (val === true || val === undefined) { - val = "bottom"; - } - if (val === false) { - val = "none"; - } - this.setPropertyValue("showNavigationButtons", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "showPrevButton", { - /** - * Gets or sets whether the Survey displays "Prev" button in its pages. Set it to `false` to prevent end-users from going back to their answers. - * @see showNavigationButtons - */ - get: function () { - return this.getPropertyValue("showPrevButton"); - }, - set: function (val) { - this.setPropertyValue("showPrevButton", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "showTitle", { - /** - * Gets or sets whether the Survey displays survey title in its pages. Set it to `false` to hide a survey title. - * @see title - */ - get: function () { - return this.getPropertyValue("showTitle"); - }, - set: function (val) { - this.setPropertyValue("showTitle", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "showPageTitles", { - /** - * Gets or sets whether the Survey displays page titles. Set it to `false` to hide page titles. - * @see PageModel.title - */ - get: function () { - return this.getPropertyValue("showPageTitles"); - }, - set: function (val) { - this.setPropertyValue("showPageTitles", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "showCompletedPage", { - /** - * On finishing the survey the complete page is shown. Set the property to `false`, to hide the complete page. - * @see data - * @see onComplete - * @see navigateToUrl - */ - get: function () { - return this.getPropertyValue("showCompletedPage"); - }, - set: function (val) { - this.setPropertyValue("showCompletedPage", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "navigateToUrl", { - /** - * Set this property to a url you want to navigate after a user completing the survey. - * By default it uses after calling onComplete event. In case calling options.showDataSaving callback in onComplete event, navigateToUrl will be used on calling options.showDataSavingSuccess callback. - */ - get: function () { - return this.getPropertyValue("navigateToUrl"); - }, - set: function (val) { - this.setPropertyValue("navigateToUrl", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "navigateToUrlOnCondition", { - /** - * Gets or sets a list of URL condition items. If the expression of this item returns `true`, then survey will navigate to the item URL. - * @see UrlConditionItem - * @see navigateToUrl - */ - get: function () { - return this.getPropertyValue("navigateToUrlOnCondition"); - }, - set: function (val) { - this.setPropertyValue("navigateToUrlOnCondition", val); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getNavigateToUrl = function () { - var item = this.getExpressionItemOnRunCondition(this.navigateToUrlOnCondition); - var url = !!item ? item.url : this.navigateToUrl; - if (!!url) { - url = this.processText(url, true); - } - return url; - }; - SurveyModel.prototype.navigateTo = function () { - var url = this.getNavigateToUrl(); - var options = { url: url }; - this.onNavigateToUrl.fire(this, options); - if (!options.url || typeof window === "undefined" || !window.location) - return; - window.location.href = options.url; - }; - Object.defineProperty(SurveyModel.prototype, "requiredText", { - /** - * Gets or sets the required question mark. The required question mark is a char or string that is rendered in the required questions' titles. - * @see Question.title - */ - get: function () { - return this.getPropertyValue("requiredText", "*"); - }, - set: function (val) { - this.setPropertyValue("requiredText", val); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.beforeSettingQuestionErrors = function (question, errors) { - this.maakeRequiredErrorsInvisibgle(errors); - this.onSettingQuestionErrors.fire(this, { - question: question, - errors: errors, - }); - }; - SurveyModel.prototype.beforeSettingPanelErrors = function (question, errors) { - this.maakeRequiredErrorsInvisibgle(errors); - }; - SurveyModel.prototype.maakeRequiredErrorsInvisibgle = function (errors) { - if (!this.hideRequiredErrors) - return; - for (var i = 0; i < errors.length; i++) { - var erType = errors[i].getErrorType(); - if (erType == "required" || erType == "requireoneanswer") { - errors[i].visible = false; - } - } - }; - Object.defineProperty(SurveyModel.prototype, "questionStartIndex", { - /** - * Gets or sets the first question index. The first question index is '1' by default. You may start it from '100' or from 'A', by setting '100' or 'A' to this property. - * You can set the start index to "(1)" or "# A)" or "a)" to render question number as (1), # A) and a) accordingly. - * @see Question.title - * @see requiredText - */ - get: function () { - return this.getPropertyValue("questionStartIndex", ""); - }, - set: function (val) { - this.setPropertyValue("questionStartIndex", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "storeOthersAsComment", { - /** - * Gets or sets whether the "Others" option text is stored as question comment. - * - * By default the entered text in the "Others" input in the checkbox/radiogroup/dropdown is stored as `"question name " + "-Comment"`. The value itself is `"question name": "others"`. - * Set this property to `false`, to store the entered text directly in the `"question name"` key. - * @see commentPrefix - */ - get: function () { - return this.getPropertyValue("storeOthersAsComment"); - }, - set: function (val) { - this.setPropertyValue("storeOthersAsComment", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "maxTextLength", { - /** - * Specifies the default maximum length for questions like text and comment, including matrix cell questions. - * - * The default value is `0`, that means that the text and comment have the same max length as the standard HTML input - 524288 characters: https://www.w3schools.com/tags/att_input_maxlength.asp. - * @see maxOthersLength - */ - get: function () { - return this.getPropertyValue("maxTextLength"); - }, - set: function (val) { - this.setPropertyValue("maxTextLength", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "maxOthersLength", { - /** - * Gets or sets the default maximum length for question comments and others - * - * The default value is `0`, that means that the question comments have the same max length as the standard HTML input - 524288 characters: https://www.w3schools.com/tags/att_input_maxlength.asp. - * @see Question.hasComment - * @see Question.hasOther - * @see maxTextLength - */ - get: function () { - return this.getPropertyValue("maxOthersLength"); - }, - set: function (val) { - this.setPropertyValue("maxOthersLength", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "goNextPageAutomatic", { - /** - * Gets or ses whether a user can navigate the next page automatically after answering all the questions on a page without pressing the "Next" button. - * The available options: - * - * - `true` - navigate the next page and submit survey data automatically. - * - `autogonext` - navigate the next page automatically but do not submit survey data. - * - `false` - do not navigate the next page and do not submit survey data automatically. - * @see showNavigationButtons - */ - get: function () { - return this.getPropertyValue("goNextPageAutomatic", false); - }, - set: function (val) { - this.setPropertyValue("goNextPageAutomatic", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "allowCompleteSurveyAutomatic", { - /** - * Gets or sets whether a survey is automatically completed when `goNextPageAutomatic = true`. Set it to `false` if you do not want to submit survey automatically on completing the last survey page. - * @see goNextPageAutomatic - */ - get: function () { - return this.getPropertyValue("allowCompleteSurveyAutomatic", true); - }, - set: function (val) { - this.setPropertyValue("allowCompleteSurveyAutomatic", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "checkErrorsMode", { - /** - * Gets or sets a value that specifies how the survey validates the question answers. - * - * The following options are available: - * - * - `onNextPage` (default) - check errors on navigating to the next page or on completing the survey. - * - `onValueChanged` - check errors on every question value (i.e., answer) changing. - * - `onValueChanging` - check errors before setting value into survey. If there is an error, then survey data is not changed, but question value will be keeped. - * - `onComplete` - to validate all visible questions on complete button click. If there are errors on previous pages, then the page with the first error becomes the current. - */ - get: function () { - return this.getPropertyValue("checkErrorsMode"); - }, - set: function (val) { - this.setPropertyValue("checkErrorsMode", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "autoGrowComment", { - /** - * Specifies whether the text area of [comment](https://surveyjs.io/Documentation/Library?id=questioncommentmodel) questions/elements automatically expands its height to avoid the vertical scrollbar and to display the entire multi-line contents entered by respondents. - * Default value is false. - * @see QuestionCommentModel.autoGrow - */ - get: function () { - return this.getPropertyValue("autoGrowComment"); - }, - set: function (val) { - this.setPropertyValue("autoGrowComment", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "textUpdateMode", { - /** - * Gets or sets a value that specifies how the survey updates its questions' text values. - * - * The following options are available: - * - * - `onBlur` (default) - the value is updated after an input loses the focus. - * - `onTyping` - update the value of text questions, "text" and "comment", on every key press. - * - * Note, that setting to "onTyping" may lead to a performance degradation, in case you have many expressions in the survey. - */ - get: function () { - return this.getPropertyValue("textUpdateMode"); - }, - set: function (val) { - this.setPropertyValue("textUpdateMode", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "clearInvisibleValues", { - /** - * Gets or sets a value that specifies how the invisible data is included in survey data. - * - * The following options are available: - * - * - `none` - include the invisible values into the survey data. - * - `onHidden` - clear the question value when it becomes invisible. If a question has value and it was invisible initially then survey clears the value on completing. - * - `onHiddenContainer` - clear the question value when it or its parent (page or panel) becomes invisible. If a question has value and it was invisible initially then survey clears the value on completing. - * - `onComplete` (default) - clear invisible question values on survey complete. In this case, the invisible questions will not be stored on the server. - * @see Question.visible - * @see onComplete - */ - get: function () { - return this.getPropertyValue("clearInvisibleValues"); - }, - set: function (val) { - if (val === true) - val = "onComplete"; - if (val === false) - val = "none"; - this.setPropertyValue("clearInvisibleValues", val); - }, - enumerable: false, - configurable: true - }); - /** - * Call this function to remove all question values from the survey, that end-user will not be able to enter. - * For example the value that doesn't exists in a radiogroup/dropdown/checkbox choices or matrix rows/columns. - * Please note, this function doesn't clear values for invisible questions or values that doesn't associated with questions. - * In fact this function just call clearIncorrectValues function of all questions in the survey - * @param removeNonExisingRootKeys - set this parameter to true to remove keys from survey.data that doesn't have corresponded questions and calculated values - * @see Question.clearIncorrectValues - * @see Page.clearIncorrectValues - * @see Panel.clearIncorrectValues - */ - SurveyModel.prototype.clearIncorrectValues = function (removeNonExisingRootKeys) { - if (removeNonExisingRootKeys === void 0) { removeNonExisingRootKeys = false; } - for (var i = 0; i < this.pages.length; i++) { - this.pages[i].clearIncorrectValues(); - } - if (!removeNonExisingRootKeys) - return; - var data = this.data; - var hasChanges = false; - for (var key in data) { - if (!!this.getQuestionByValueName(key)) - continue; - if (this.iscorrectValueWithPostPrefix(key, _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].commentPrefix) || - this.iscorrectValueWithPostPrefix(key, _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].matrixTotalValuePostFix)) - continue; - var calcValue = this.getCalculatedValueByName(key); - if (!!calcValue && calcValue.includeIntoResult) - continue; - hasChanges = true; - delete data[key]; - } - if (hasChanges) { - this.data = data; - } - }; - SurveyModel.prototype.iscorrectValueWithPostPrefix = function (key, postPrefix) { - if (key.indexOf(postPrefix) !== key.length - postPrefix.length) - return false; - return !!this.getQuestionByValueName(key.substr(0, key.indexOf(postPrefix))); - }; - Object.defineProperty(SurveyModel.prototype, "locale", { - /** - * Gets or sets the survey locale. The default value it is empty, this means the 'en' locale is used. - * You can set it to 'de' - German, 'fr' - French and so on. The library has built-in localization for several languages. The library has a multi-language support as well. - */ - get: function () { - return this.localeValue; - }, - set: function (value) { - _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].currentLocale = value; - this.localeValue = _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].currentLocale; - this.setPropertyValue("locale", this.localeValue); - if (this.isLoadingFromJson) - return; - this.locStrsChanged(); - this.localeChanged(); - this.onLocaleChangedEvent.fire(this, value); - }, - enumerable: false, - configurable: true - }); - /** - * Returns an array of locales that are used in the survey's translation. - */ - SurveyModel.prototype.getUsedLocales = function () { - var locs = new Array(); - this.addUsedLocales(locs); - //Replace the default locale with the real one - var index = locs.indexOf("default"); - if (index > -1) { - var defaultLoc = _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].defaultLocale; - //Remove the defaultLoc - var defIndex = locs.indexOf(defaultLoc); - if (defIndex > -1) { - locs.splice(defIndex, 1); - } - index = locs.indexOf("default"); - locs[index] = defaultLoc; - } - return locs; - }; - SurveyModel.prototype.localeChanged = function () { - for (var i = 0; i < this.pages.length; i++) { - this.pages[i].localeChanged(); - } - }; - //ILocalizableOwner - SurveyModel.prototype.getLocale = function () { - return this.locale; - }; - SurveyModel.prototype.locStrsChanged = function () { - _super.prototype.locStrsChanged.call(this); - if (!this.currentPage) - return; - this.updateProgressText(); - var page = this.activePage; - if (!!page) { - page.locStrsChanged(); - } - }; - SurveyModel.prototype.getMarkdownHtml = function (text, name) { - return this.getSurveyMarkdownHtml(this, text, name); - }; - SurveyModel.prototype.getRenderer = function (name) { - return this.getRendererForString(this, name); - }; - SurveyModel.prototype.getRendererContext = function (locStr) { - return this.getRendererContextForString(this, locStr); - }; - SurveyModel.prototype.getRendererForString = function (element, name) { - var renderAs = this.getBuiltInRendererForString(element, name); - var options = { element: element, name: name, renderAs: renderAs }; - this.onTextRenderAs.fire(this, options); - return options.renderAs; - }; - SurveyModel.prototype.getRendererContextForString = function (element, locStr) { - return locStr; - }; - SurveyModel.prototype.getExpressionDisplayValue = function (question, value, displayValue) { - var options = { - question: question, - value: value, - displayValue: displayValue, - }; - this.onGetExpressionDisplayValue.fire(this, options); - return options.displayValue; - }; - SurveyModel.prototype.getBuiltInRendererForString = function (element, name) { - if (this.isDesignMode) - return _localizablestring__WEBPACK_IMPORTED_MODULE_10__["LocalizableString"].editableRenderer; - return undefined; - }; - SurveyModel.prototype.getProcessedText = function (text) { - return this.processText(text, true); - }; - SurveyModel.prototype.getLocString = function (str) { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].getString(str); - }; - //ISurveyErrorOwner - SurveyModel.prototype.getErrorCustomText = function (text, error) { - var options = { - text: text, - name: error.getErrorType(), - error: error, - }; - this.onErrorCustomText.fire(this, options); - return options.text; - }; - Object.defineProperty(SurveyModel.prototype, "emptySurveyText", { - /** - * Returns the text that is displayed when there are no any visible pages and questiona. - */ - get: function () { - return this.getLocString("emptySurvey"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "logo", { - //#region Title/Header options - /** - * Gets or sets a survey logo. - * @see title - */ - get: function () { - return this.getLocalizableStringText("logo"); - }, - set: function (value) { - this.setLocalizableStringText("logo", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "locLogo", { - get: function () { - return this.getLocalizableString("logo"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "logoWidth", { - /** - * Gets or sets a survey logo width. - * @see logo - */ - get: function () { - var width = this.getPropertyValue("logoWidth"); - return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_15__["getSize"])(width); - }, - set: function (value) { - this.setPropertyValue("logoWidth", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "logoHeight", { - /** - * Gets or sets a survey logo height. - * @see logo - */ - get: function () { - var height = this.getPropertyValue("logoHeight"); - return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_15__["getSize"])(height); - }, - set: function (value) { - this.setPropertyValue("logoHeight", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "logoPosition", { - /** - * Gets or sets a survey logo position. - * @see logo - */ - get: function () { - return this.getPropertyValue("logoPosition"); - }, - set: function (value) { - this.setPropertyValue("logoPosition", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "hasLogo", { - get: function () { - return !!this.logo && this.logoPosition !== "none"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isLogoBefore", { - get: function () { - if (this.isDesignMode) - return false; - return (this.renderedHasLogo && - (this.logoPosition === "left" || this.logoPosition === "top")); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isLogoAfter", { - get: function () { - if (this.isDesignMode) - return this.renderedHasLogo; - return (this.renderedHasLogo && - (this.logoPosition === "right" || this.logoPosition === "bottom")); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "logoClassNames", { - get: function () { - var logoClasses = { - left: "sv-logo--left", - right: "sv-logo--right", - top: "sv-logo--top", - bottom: "sv-logo--bottom", - }; - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_16__["CssClassBuilder"]().append(this.css.logo) - .append(logoClasses[this.logoPosition]).toString(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "renderedHasTitle", { - get: function () { - if (this.isDesignMode) - return this.isPropertyVisible("title"); - return !this.locTitle.isEmpty && this.showTitle; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "hasTitle", { - get: function () { - return this.renderedHasTitle; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "renderedHasLogo", { - get: function () { - if (this.isDesignMode) - return this.isPropertyVisible("logo"); - return this.hasLogo; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "renderedHasHeader", { - get: function () { - return this.renderedHasTitle || this.renderedHasLogo; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "logoFit", { - /** - * The logo fit mode. - * @see logo - */ - get: function () { - return this.getPropertyValue("logoFit"); - }, - set: function (val) { - this.setPropertyValue("logoFit", val); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.setIsMobile = function (newVal) { - if (newVal === void 0) { newVal = true; } - this._isMobile = newVal; - }; - Object.defineProperty(SurveyModel.prototype, "isMobile", { - get: function () { - return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_15__["isMobile"])() || this._isMobile; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.isLogoImageChoosen = function () { - return this.locLogo.renderedHtml; - }; - Object.defineProperty(SurveyModel.prototype, "titleMaxWidth", { - get: function () { - if (!this.isMobile && - !this.isValueEmpty(this.isLogoImageChoosen()) && - !_settings__WEBPACK_IMPORTED_MODULE_14__["settings"].supportCreatorV2) { - var logoWidth = this.logoWidth; - if (this.logoPosition === "left" || this.logoPosition === "right") { - return "calc(100% - 5px - 2em - " + logoWidth + ")"; - } - } - return ""; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "completedHtml", { - /** - * Gets or sets the HTML content displayed on the complete page. Use this property to change the default complete page text. - * @see showCompletedPage - * @see completedHtmlOnCondition - * @see locale - */ - get: function () { - return this.getLocalizableStringText("completedHtml"); - }, - set: function (value) { - this.setLocalizableStringText("completedHtml", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "locCompletedHtml", { - get: function () { - return this.getLocalizableString("completedHtml"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "completedHtmlOnCondition", { - /** - * The list of HTML condition items. If the expression of this item returns `true`, then a survey will use this item HTML instead of `completedHtml`. - * @see HtmlConditionItem - * @see completeHtml - */ - get: function () { - return this.getPropertyValue("completedHtmlOnCondition"); - }, - set: function (val) { - this.setPropertyValue("completedHtmlOnCondition", val); - }, - enumerable: false, - configurable: true - }); - /** - * Calculates a given expression and returns a result value. - * @param expression - */ - SurveyModel.prototype.runExpression = function (expression) { - if (!expression) - return null; - var values = this.getFilteredValues(); - var properties = this.getFilteredProperties(); - return new _conditions__WEBPACK_IMPORTED_MODULE_13__["ExpressionRunner"](expression).run(values, properties); - }; - /** - * Calculates a given expression and returns `true` or `false`. - * @param expression - */ - SurveyModel.prototype.runCondition = function (expression) { - if (!expression) - return false; - var values = this.getFilteredValues(); - var properties = this.getFilteredProperties(); - return new _conditions__WEBPACK_IMPORTED_MODULE_13__["ConditionRunner"](expression).run(values, properties); - }; - /** - * Run all triggers that performs on value changed and not on moving to the next page. - */ - SurveyModel.prototype.runTriggers = function () { - this.checkTriggers(this.getFilteredValues(), false); - }; - Object.defineProperty(SurveyModel.prototype, "renderedCompletedHtml", { - get: function () { - var item = this.getExpressionItemOnRunCondition(this.completedHtmlOnCondition); - return !!item ? item.html : this.completedHtml; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getExpressionItemOnRunCondition = function (items) { - if (items.length == 0) - return null; - var values = this.getFilteredValues(); - var properties = this.getFilteredProperties(); - for (var i = 0; i < items.length; i++) { - if (items[i].runCondition(values, properties)) { - return items[i]; - } - } - return null; - }; - Object.defineProperty(SurveyModel.prototype, "completedBeforeHtml", { - /** - * The HTML content displayed to an end user that has already completed the survey. - * @see clientId - * @see locale - */ - get: function () { - return this.getLocalizableStringText("completedBeforeHtml"); - }, - set: function (value) { - this.setLocalizableStringText("completedBeforeHtml", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "locCompletedBeforeHtml", { - get: function () { - return this.getLocalizableString("completedBeforeHtml"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "loadingHtml", { - /** - * The HTML that shows on loading survey Json from the [api.surveyjs.io](https://api.surveyjs.io) service. - * @see surveyId - * @see locale - */ - get: function () { - return this.getLocalizableStringText("loadingHtml"); - }, - set: function (value) { - this.setLocalizableStringText("loadingHtml", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "locLoadingHtml", { - get: function () { - return this.getLocalizableString("loadingHtml"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "startSurveyText", { - /** - * Gets or sets the 'Start' button caption. - * The 'Start' button is shown on the started page. Set the `firstPageIsStarted` property to `true`, to display the started page. - * @see firstPageIsStarted - * @see locale - */ - get: function () { - return this.getLocalizableStringText("startSurveyText"); - }, - set: function (newValue) { - this.setLocalizableStringText("startSurveyText", newValue); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "locStartSurveyText", { - get: function () { - return this.getLocalizableString("startSurveyText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "pagePrevText", { - /** - * Gets or sets the 'Prev' button caption. - * @see locale - */ - get: function () { - return this.getLocalizableStringText("pagePrevText"); - }, - set: function (newValue) { - this.setLocalizableStringText("pagePrevText", newValue); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "locPagePrevText", { - get: function () { - return this.getLocalizableString("pagePrevText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "pageNextText", { - /** - * Gets or sets the 'Next' button caption. - * @see locale - */ - get: function () { - return this.getLocalizableStringText("pageNextText"); - }, - set: function (newValue) { - this.setLocalizableStringText("pageNextText", newValue); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "locPageNextText", { - get: function () { - return this.getLocalizableString("pageNextText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "completeText", { - /** - * Gets or sets the 'Complete' button caption. - * @see locale - */ - get: function () { - return this.getLocalizableStringText("completeText"); - }, - set: function (newValue) { - this.setLocalizableStringText("completeText", newValue); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "locCompleteText", { - get: function () { - return this.getLocalizableString("completeText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "previewText", { - /** - * Gets or sets the 'Preview' button caption. - * @see locale - * @see showPreviewBeforeComplete - * @see editText - * @see showPreview - */ - get: function () { - return this.getLocalizableStringText("previewText"); - }, - set: function (newValue) { - this.setLocalizableStringText("previewText", newValue); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "locPreviewText", { - get: function () { - return this.getLocalizableString("previewText"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "editText", { - /** - * Gets or sets the 'Edit' button caption. - * @see locale - * @see showPreviewBeforeComplete - * @see previewText - * @see cancelPreview - */ - get: function () { - return this.getLocalizableStringText("editText"); - }, - set: function (newValue) { - this.setLocalizableStringText("editText", newValue); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "locEditText", { - get: function () { - return this.getLocalizableString("editText"); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getElementTitleTagName = function (element, tagName) { - if (this.onGetTitleTagName.isEmpty) - return tagName; - var options = { element: element, tagName: tagName }; - this.onGetTitleTagName.fire(this, options); - return options.tagName; - }; - Object.defineProperty(SurveyModel.prototype, "questionTitlePattern", { - /** - * Set the pattern for question title. Default is "numTitleRequire", 1. What is your name? *, - * You can set it to numRequireTitle: 1. * What is your name? - * You can set it to requireNumTitle: * 1. What is your name? - * You can set it to numTitle (remove require symbol completely): 1. What is your name? - * @see QuestionModel.title - */ - get: function () { - return this.getPropertyValue("questionTitlePattern", "numTitleRequire"); - }, - set: function (val) { - if (val !== "numRequireTitle" && - val !== "requireNumTitle" && - val != "numTitle") { - val = "numTitleRequire"; - } - this.setPropertyValue("questionTitlePattern", val); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getQuestionTitlePatternOptions = function () { - var res = new Array(); - var title = this.getLocString("questionTitlePatternText"); - var num = !!this.questionStartIndex ? this.questionStartIndex : "1."; - res.push({ - value: "numTitleRequire", - text: num + " " + title + " " + this.requiredText - }); - res.push({ - value: "numRequireTitle", - text: num + " " + this.requiredText + " " + title - }); - res.push({ - value: "requireNumTitle", - text: this.requiredText + " " + num + " " + title - }); - res.push({ - value: "numTitle", - text: num + " " + title - }); - return res; - }; - Object.defineProperty(SurveyModel.prototype, "questionTitleTemplate", { - /** - * Gets or sets a question title template. Obsolete, please use questionTitlePattern - * @see QuestionModel.title - * @see questionTitlePattern - */ - get: function () { - return this.getLocalizableStringText("questionTitleTemplate"); - }, - set: function (value) { - this.setLocalizableStringText("questionTitleTemplate", value); - this.questionTitlePattern = this.getNewTitlePattern(value); - this.questionStartIndex = this.getNewQuestionTitleElement(value, "no", this.questionStartIndex, "1"); - this.requiredText = this.getNewQuestionTitleElement(value, "require", this.requiredText, "*"); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getNewTitlePattern = function (template) { - if (!!template) { - var strs = []; - while (template.indexOf("{") > -1) { - template = template.substr(template.indexOf("{") + 1); - var ind = template.indexOf("}"); - if (ind < 0) - break; - strs.push(template.substr(0, ind)); - template = template.substr(ind + 1); - } - if (strs.length > 1) { - if (strs[0] == "require") - return "requireNumTitle"; - if (strs[1] == "require" && strs.length == 3) - return "numRequireTitle"; - if (strs.indexOf("require") < 0) - return "numTitle"; - } - if (strs.length == 1 && strs[0] == "title") { - return "numTitle"; - } - } - return "numTitleRequire"; - }; - SurveyModel.prototype.getNewQuestionTitleElement = function (template, name, currentValue, defaultValue) { - name = "{" + name + "}"; - if (!template || template.indexOf(name) < 0) - return currentValue; - var ind = template.indexOf(name); - var prefix = ""; - var postfix = ""; - var i = ind - 1; - for (; i >= 0; i--) { - if (template[i] == "}") - break; - } - if (i < ind - 1) { - prefix = template.substr(i + 1, ind - i - 1); - } - ind += name.length; - i = ind; - for (; i < template.length; i++) { - if (template[i] == "{") - break; - } - if (i > ind) { - postfix = template.substr(ind, i - ind); - } - i = 0; - while (i < prefix.length && prefix.charCodeAt(i) < 33) - i++; - prefix = prefix.substr(i); - i = postfix.length - 1; - while (i >= 0 && postfix.charCodeAt(i) < 33) - i--; - postfix = postfix.substr(0, i + 1); - if (!prefix && !postfix) - return currentValue; - var value = !!currentValue ? currentValue : defaultValue; - return prefix + value + postfix; - }; - Object.defineProperty(SurveyModel.prototype, "locQuestionTitleTemplate", { - get: function () { - return this.getLocalizableString("questionTitleTemplate"); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getUpdatedQuestionTitle = function (question, title) { - if (this.onGetQuestionTitle.isEmpty) - return title; - var options = { question: question, title: title }; - this.onGetQuestionTitle.fire(this, options); - return options.title; - }; - SurveyModel.prototype.getUpdatedQuestionNo = function (question, no) { - if (this.onGetQuestionNo.isEmpty) - return no; - var options = { question: question, no: no }; - this.onGetQuestionNo.fire(this, options); - return options.no; - }; - Object.defineProperty(SurveyModel.prototype, "showPageNumbers", { - /** - * Gets or sets whether the survey displays page numbers on pages titles. - */ - get: function () { - return this.getPropertyValue("showPageNumbers", false); - }, - set: function (value) { - if (value === this.showPageNumbers) - return; - this.setPropertyValue("showPageNumbers", value); - this.updateVisibleIndexes(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "showQuestionNumbers", { - /** - * Gets or sets a value that specifies how the question numbers are displayed. - * - * The following options are available: - * - * - `on` - display question numbers - * - `onpage` - display question numbers, start numbering on every page - * - `off` - turn off the numbering for questions titles - */ - get: function () { - return this.getPropertyValue("showQuestionNumbers"); - }, - set: function (value) { - value = value.toLowerCase(); - value = value === "onpage" ? "onPage" : value; - if (value === this.showQuestionNumbers) - return; - this.setPropertyValue("showQuestionNumbers", value); - this.updateVisibleIndexes(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "showProgressBar", { - /** - * Gets or sets the survey progress bar position. - * - * The following options are available: - * - * - `off` (default) - don't show progress bar - * - `top` - show progress bar in the top - * - `bottom` - show progress bar in the bottom - * - `both` - show progress bar in both sides: top and bottom. - */ - get: function () { - return this.getPropertyValue("showProgressBar"); - }, - set: function (newValue) { - this.setPropertyValue("showProgressBar", newValue.toLowerCase()); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "progressBarType", { - /** - * Gets or sets the type of info in the progress bar. - * - * The following options are available: - * - * - `pages` (default), - * - `questions`, - * - `requiredQuestions`, - * - `correctQuestions`, - * - `buttons` - */ - get: function () { - return this.getPropertyValue("progressBarType"); - }, - set: function (newValue) { - if (newValue === "correctquestion") - newValue = "correctQuestion"; - if (newValue === "requiredquestion") - newValue = "requiredQuestion"; - this.setPropertyValue("progressBarType", newValue); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isShowProgressBarOnTop", { - get: function () { - if (!this.canShowProresBar()) - return false; - return this.showProgressBar === "top" || this.showProgressBar === "both"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isShowProgressBarOnBottom", { - get: function () { - if (!this.canShowProresBar()) - return false; - return this.showProgressBar === "bottom" || this.showProgressBar === "both"; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.canShowProresBar = function () { - return (!this.isShowingPreview || - this.showPreviewBeforeComplete != "showAllQuestions"); - }; - Object.defineProperty(SurveyModel.prototype, "processedTitle", { - /** - * Returns the text/HTML that is rendered as a survey title. - */ - get: function () { - return this.locTitle.renderedHtml; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "questionTitleLocation", { - /** - * Gets or sets the question title location. - * - * The following options are available: - * - * - `bottom` - show a question title to bottom - * - `left` - show a question title to left - * - `top` - show a question title to top. - * - * > Some questions, for example matrixes, do not support 'left' value. The title for them will be displayed to the top. - */ - get: function () { - return this.getPropertyValue("questionTitleLocation"); - }, - set: function (value) { - this.setPropertyValue("questionTitleLocation", value.toLowerCase()); - if (!this.isLoadingFromJson) { - this.updateElementCss(true); - } - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.updateElementCss = function (reNew) { - var pages = this.visiblePages; - for (var i = 0; i < pages.length; i++) { - pages[i].updateElementCss(reNew); - } - }; - Object.defineProperty(SurveyModel.prototype, "questionErrorLocation", { - /** - * Gets or sets the error message position. - * - * The following options are available: - * - * - `top` - to show question error(s) over the question, - * - `bottom` - to show question error(s) under the question. - */ - get: function () { - return this.getPropertyValue("questionErrorLocation"); - }, - set: function (value) { - this.setPropertyValue("questionErrorLocation", value.toLowerCase()); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "questionDescriptionLocation", { - /** - * Gets or sets the question description position. The default value is `underTitle`. - * - * The following options are available: - * - * - `underTitle` - show question description under the question title, - * - `underInput` - show question description under the question input instead of question title. - */ - get: function () { - return this.getPropertyValue("questionDescriptionLocation"); - }, - set: function (value) { - this.setPropertyValue("questionDescriptionLocation", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "mode", { - /** - * Gets or sets the survey edit mode. - * - * The following options are available: - * - * - `edit` (default) - make a survey editable, - * - `display` - make a survey read-only. - */ - get: function () { - return this.getPropertyValue("mode"); - }, - set: function (value) { - value = value.toLowerCase(); - if (value == this.mode) - return; - if (value != "edit" && value != "display") - return; - this.setPropertyValue("mode", value); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.onModeChanged = function () { - for (var i = 0; i < this.pages.length; i++) { - var page = this.pages[i]; - page.setPropertyValue("isReadOnly", page.isReadOnly); - } - }; - Object.defineProperty(SurveyModel.prototype, "data", { - /** - * Gets or sets an object that stores the survey results/data. You can set it directly as `{ 'question name': questionValue, ... }` - * - * > If you set the `data` property after creating the survey, you may need to set the `currentPageNo` to `0`, if you are using `visibleIf` properties for questions/pages/panels to ensure that you are starting from the first page. - * @see setValue - * @see getValue - * @see mergeData - * @see currentPageNo - */ - get: function () { - var result = {}; - var keys = this.getValuesKeys(); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var dataValue = this.getDataValueCore(this.valuesHash, key); - if (dataValue !== undefined) { - result[key] = dataValue; - } - } - this.setCalcuatedValuesIntoResult(result); - return result; - }, - set: function (data) { - this.valuesHash = {}; - this.setDataCore(data); - }, - enumerable: false, - configurable: true - }); - /** - * Merge the values into survey.data. It works as survey.data, except it doesn't clean the existing data, but overrides them. - * @param data data to merge. It should be an object {keyValue: Value, ...} - * @see data - * @see setValue - */ - SurveyModel.prototype.mergeData = function (data) { - if (!data) - return; - this.setDataCore(data); - }; - SurveyModel.prototype.setDataCore = function (data) { - if (data) { - for (var key in data) { - this.setDataValueCore(this.valuesHash, key, data[key]); - } - } - this.updateAllQuestionsValue(); - this.notifyAllQuestionsOnValueChanged(); - this.notifyElementsOnAnyValueOrVariableChanged(""); - this.runConditions(); - }; - Object.defineProperty(SurveyModel.prototype, "editingObj", { - get: function () { - return this.editingObjValue; - }, - set: function (val) { - var _this = this; - if (this.editingObj == val) - return; - if (!!this.editingObj) { - this.editingObj.onPropertyChanged.remove(this.onEditingObjPropertyChanged); - } - this.editingObjValue = val; - if (this.isDisposed) - return; - if (!val) { - var questions = this.getAllQuestions(); - for (var i = 0; i < questions.length; i++) { - questions[i].unbindValue(); - } - } - if (!!this.editingObj) { - this.setDataCore({}); - this.onEditingObjPropertyChanged = function (sender, options) { - if (!_jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].hasOriginalProperty(_this.editingObj, options.name)) - return; - _this.updateOnSetValue(options.name, _this.editingObj[options.name], options.oldValue); - }; - this.editingObj.onPropertyChanged.add(this.onEditingObjPropertyChanged); - } - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isEditingSurveyElement", { - get: function () { - return !!this.editingObj; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.setCalcuatedValuesIntoResult = function (result) { - for (var i = 0; i < this.calculatedValues.length; i++) { - var calValue = this.calculatedValues[i]; - if (calValue.includeIntoResult && - !!calValue.name && - this.getVariable(calValue.name) !== undefined) { - result[calValue.name] = this.getVariable(calValue.name); - } - } - }; - SurveyModel.prototype.getAllValues = function () { - return this.data; - }; - /** - * Returns survey result data as an array of plain objects: with question `title`, `name`, `value`, and `displayValue`. - * - * For complex questions (like matrix, etc.) `isNode` flag is set to `true` and data contains array of nested objects (rows). - * - * Set `options.includeEmpty` to `false` if you want to skip empty answers. - */ - SurveyModel.prototype.getPlainData = function (options) { - if (!options) { - options = { includeEmpty: true, includeQuestionTypes: false }; - } - var result = []; - this.getAllQuestions().forEach(function (question) { - var resultItem = question.getPlainData(options); - if (!!resultItem) { - result.push(resultItem); - } - }); - return result; - }; - SurveyModel.prototype.getFilteredValues = function () { - var values = {}; - for (var key in this.variablesHash) - values[key] = this.variablesHash[key]; - this.addCalculatedValuesIntoFilteredValues(values); - var keys = this.getValuesKeys(); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - values[key] = this.getDataValueCore(this.valuesHash, key); - } - return values; - }; - SurveyModel.prototype.addCalculatedValuesIntoFilteredValues = function (values) { - var caclValues = this.calculatedValues; - for (var i = 0; i < caclValues.length; i++) - values[caclValues[i].name] = caclValues[i].value; - }; - SurveyModel.prototype.getFilteredProperties = function () { - return { survey: this }; - }; - SurveyModel.prototype.getValuesKeys = function () { - if (!this.editingObj) - return Object.keys(this.valuesHash); - var props = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].getPropertiesByObj(this.editingObj); - var res = []; - for (var i = 0; i < props.length; i++) { - res.push(props[i].name); - } - return res; - }; - SurveyModel.prototype.getDataValueCore = function (valuesHash, key) { - if (!!this.editingObj) - return _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].getObjPropertyValue(this.editingObj, key); - return valuesHash[key]; - }; - SurveyModel.prototype.setDataValueCore = function (valuesHash, key, value) { - if (!!this.editingObj) { - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].setObjPropertyValue(this.editingObj, key, value); - } - else { - valuesHash[key] = value; - } - }; - SurveyModel.prototype.deleteDataValueCore = function (valuesHash, key) { - if (!!this.editingObj) { - this.editingObj[key] = null; - } - else { - delete valuesHash[key]; - } - }; - Object.defineProperty(SurveyModel.prototype, "comments", { - /** - * Returns all comments from the data. - * @see data - */ - get: function () { - var result = {}; - var keys = this.getValuesKeys(); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - if (key.indexOf(this.commentPrefix) > 0) { - result[key] = this.getDataValueCore(this.valuesHash, key); - } - } - return result; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "visiblePages", { - /** - * Returns a list of visible pages. If all pages are visible, then this property returns the same list as the `pages` property. - * @see pages - * @see PageModel.visible - * @see PageModel.visibleIf - */ - get: function () { - if (this.isDesignMode) - return this.pages; - var result = new Array(); - for (var i = 0; i < this.pages.length; i++) { - if (this.isPageInVisibleList(this.pages[i])) { - result.push(this.pages[i]); - } - } - return result; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.isPageInVisibleList = function (page) { - return this.isDesignMode || page.isVisible && !page.isStarted; - }; - Object.defineProperty(SurveyModel.prototype, "isEmpty", { - /** - * Returns `true` if the survey contains no pages. The survey is empty. - */ - get: function () { - return this.pages.length == 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "PageCount", { - /** - * Deprecated. Use the `pageCount` property instead. - */ - get: function () { - return this.pageCount; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "pageCount", { - /** - * Returns the survey page count. - * @see visiblePageCount - * @see pages - */ - get: function () { - return this.pages.length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "visiblePageCount", { - /** - * Returns a number of visible pages within the survey. - * @see pageCount - * @see visiblePages - */ - get: function () { - return this.visiblePages.length; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "startedPage", { - /** - * Returns the started page. This property works if the `firstPageIsStarted` property is set to `true`. - * @see firstPageIsStarted - */ - get: function () { - var page = this.firstPageIsStarted && this.pages.length > 0 ? this.pages[0] : null; - if (!!page) { - page.onFirstRendering(); - page.setWasShown(true); - } - return page; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "currentPage", { - /** - * Gets or sets the current survey page. If a survey is rendered, then this property returns a page that a user can see/edit. - */ - get: function () { - return this.getPropertyValue("currentPage", null); - }, - set: function (value) { - if (this.isLoadingFromJson) - return; - var newPage = this.getPageByObject(value); - if (!!value && !newPage) - return; - if (!newPage && this.isCurrentPageAvailable) - return; - var vPages = this.visiblePages; - if (newPage != null && vPages.indexOf(newPage) < 0) - return; - if (newPage == this.currentPage) - return; - var oldValue = this.currentPage; - if (!this.currentPageChanging(newPage, oldValue)) - return; - this.setPropertyValue("currentPage", newPage); - this.updateIsFirstLastPageState(); - if (!!newPage) { - newPage.onFirstRendering(); - newPage.updateCustomWidgets(); - newPage.setWasShown(true); - } - this.locStrsChanged(); - this.currentPageChanged(newPage, oldValue); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.updateCurrentPage = function () { - if (this.isCurrentPageAvailable) - return; - this.currentPage = this.firstVisiblePage; - }; - Object.defineProperty(SurveyModel.prototype, "isCurrentPageAvailable", { - get: function () { - var page = this.currentPage; - return !!page && this.isPageInVisibleList(page) && this.isPageExistsInSurvey(page); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.isPageExistsInSurvey = function (page) { - if (this.pages.indexOf(page) > -1) - return true; - return !!this.onContainsPageCallback && this.onContainsPageCallback(page); - }; - Object.defineProperty(SurveyModel.prototype, "activePage", { - /** - * Returns the currentPage, unless the started page is showing. In this case returns the started page. - * @see currentPage - * @see firstPageIsStarted - * @see startedPage - */ - get: function () { - return this.isStartedState && this.startedPage && !this.isDesignMode - ? this.startedPage - : this.currentPage; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getPageByObject = function (value) { - if (!value) - return null; - if (value.getType && value.getType() == "page") - return value; - if (typeof value === "string" || value instanceof String) - return this.getPageByName(String(value)); - if (!isNaN(value)) { - var index = Number(value); - var vPages = this.visiblePages; - if (value < 0 || value >= vPages.length) - return null; - return vPages[index]; - } - return value; - }; - Object.defineProperty(SurveyModel.prototype, "currentPageNo", { - /** - * The zero-based index of the current page in the visible pages array. - */ - get: function () { - return this.visiblePages.indexOf(this.currentPage); - }, - set: function (value) { - var vPages = this.visiblePages; - if (value < 0 || value >= vPages.length) - return; - this.currentPage = vPages[value]; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "questionsOrder", { - /** - * Gets or sets the question display order. Use this property to randomize questions. You can randomize questions on a specific page. - * - * The following options are available: - * - * - `random` - randomize questions - * - `initial` - keep questions in the same order, as in a survey model. - * @see SurveyPage.questionsOrder - */ - get: function () { - return this.getPropertyValue("questionsOrder"); - }, - set: function (val) { - this.setPropertyValue("questionsOrder", val); - }, - enumerable: false, - configurable: true - }); - /** - * Sets the input focus to the first question with the input field. - */ - SurveyModel.prototype.focusFirstQuestion = function () { - if (this.isFocusingQuestion) - return; - var page = this.activePage; - if (page) { - page.scrollToTop(); - page.focusFirstQuestion(); - } - }; - SurveyModel.prototype.scrollToTopOnPageChange = function () { - var page = this.activePage; - if (!page) - return; - page.scrollToTop(); - if (this.focusFirstQuestionAutomatic && !this.isFocusingQuestion) { - page.focusFirstQuestion(); - } - }; - Object.defineProperty(SurveyModel.prototype, "state", { - /** - * Returns the current survey state: - * - * - `loading` - the survey is being loaded from JSON, - * - `empty` - there is nothing to display in the current survey, - * - `starting` - the survey's start page is displayed, - * - `running` - a respondent is answering survey questions right now, - * - `preview` - a respondent is previewing answered questions before submitting the survey (see [example](https://surveyjs.io/Examples/Library?id=survey-showpreview)), - * - `completed` - a respondent has completed the survey and submitted the results. - * - * Details: [Preview State](https://surveyjs.io/Documentation/Library#states) - */ - get: function () { - if (this.isLoading) - return "loading"; - if (this.isCompleted) - return "completed"; - if (this.isCompletedBefore) - return "completedbefore"; - if (!this.isDesignMode && - this.isEditMode && - this.isStartedState && - this.startedPage) - return "starting"; - if (this.isShowingPreview) - return this.currentPage ? "preview" : "empty"; - return this.currentPage ? "running" : "empty"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isCompleted", { - get: function () { - return this.getPropertyValue("isCompleted", false); - }, - set: function (val) { - this.setPropertyValue("isCompleted", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isShowingPreview", { - get: function () { - return this.getPropertyValue("isShowingPreview", false); - }, - set: function (val) { - if (this.isShowingPreview == val) - return; - this.setPropertyValue("isShowingPreview", val); - this.onShowingPreviewChanged(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isStartedState", { - get: function () { - return this.getPropertyValue("isStartedState", false); - }, - set: function (val) { - this.setPropertyValue("isStartedState", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isCompletedBefore", { - get: function () { - return this.getPropertyValue("isCompletedBefore", false); - }, - set: function (val) { - this.setPropertyValue("isCompletedBefore", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isLoading", { - get: function () { - return this.getPropertyValue("isLoading", false); - }, - set: function (val) { - this.setPropertyValue("isLoading", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "completedState", { - get: function () { - return this.completedStateValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "completedStateText", { - get: function () { - return this.completedStateTextValue; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.setCompletedState = function (value, text) { - this.completedStateValue = value; - if (!text) { - if (value == "saving") - text = this.getLocString("savingData"); - if (value == "error") - text = this.getLocString("savingDataError"); - if (value == "success") - text = this.getLocString("savingDataSuccess"); - } - this.completedStateTextValue = text; - }; - /** - * Clears the survey data and state. If the survey has a `completed` state, it will get a `running` state. - * @param clearData clear the data - * @param gotoFirstPage make the first page as a current page. - * @see data - * @see state - * @see currentPage - */ - SurveyModel.prototype.clear = function (clearData, gotoFirstPage) { - if (clearData === void 0) { clearData = true; } - if (gotoFirstPage === void 0) { gotoFirstPage = true; } - if (clearData) { - this.data = null; - this.variablesHash = {}; - } - this.timeSpent = 0; - for (var i = 0; i < this.pages.length; i++) { - this.pages[i].timeSpent = 0; - this.pages[i].setWasShown(false); - this.pages[i].passed = false; - } - this.isCompleted = false; - this.isCompletedBefore = false; - this.isLoading = false; - this.isStartedState = this.firstPageIsStarted; - if (gotoFirstPage) { - this.currentPage = this.firstVisiblePage; - } - if (clearData) { - this.updateValuesWithDefaults(); - } - }; - SurveyModel.prototype.mergeValues = function (src, dest) { - if (!dest || !src) - return; - if (typeof dest !== "object") - return; - for (var key in src) { - var value = src[key]; - if (value && typeof value === "object") { - if (!dest[key]) - dest[key] = {}; - this.mergeValues(value, dest[key]); - } - else { - dest[key] = value; - } - } - }; - SurveyModel.prototype.updateValuesWithDefaults = function () { - if (this.isDesignMode || this.isLoading) - return; - for (var i = 0; i < this.pages.length; i++) { - var questions = this.pages[i].questions; - for (var j = 0; j < questions.length; j++) { - questions[j].updateValueWithDefaults(); - } - } - }; - SurveyModel.prototype.updateCustomWidgets = function (page) { - if (!page) - return; - page.updateCustomWidgets(); - }; - SurveyModel.prototype.currentPageChanging = function (newValue, oldValue) { - var options = { - oldCurrentPage: oldValue, - newCurrentPage: newValue, - allowChanging: true, - isNextPage: this.isNextPage(newValue, oldValue), - isPrevPage: this.isPrevPage(newValue, oldValue), - }; - this.onCurrentPageChanging.fire(this, options); - return options.allowChanging; - }; - SurveyModel.prototype.currentPageChanged = function (newValue, oldValue) { - var isNextPage = this.isNextPage(newValue, oldValue); - if (isNextPage) { - oldValue.passed = true; - } - this.onCurrentPageChanged.fire(this, { - oldCurrentPage: oldValue, - newCurrentPage: newValue, - isNextPage: isNextPage, - isPrevPage: this.isPrevPage(newValue, oldValue), - }); - }; - SurveyModel.prototype.isNextPage = function (newValue, oldValue) { - if (!newValue || !oldValue) - return false; - return newValue.visibleIndex == oldValue.visibleIndex + 1; - }; - SurveyModel.prototype.isPrevPage = function (newValue, oldValue) { - if (!newValue || !oldValue) - return false; - return newValue.visibleIndex + 1 == oldValue.visibleIndex; - }; - /** - * Returns the progress that a user made while going through the survey. - * It depends from progressBarType property - * @see progressBarType - * @see progressValue - */ - SurveyModel.prototype.getProgress = function () { - if (this.currentPage == null) - return 0; - if (this.progressBarType !== "pages") { - var info = this.getProgressInfo(); - if (this.progressBarType === "requiredQuestions") { - return info.requiredQuestionCount > 1 - ? Math.ceil((info.requiredAnsweredQuestionCount * 100) / - info.requiredQuestionCount) - : 100; - } - return info.questionCount > 1 - ? Math.ceil((info.answeredQuestionCount * 100) / info.questionCount) - : 100; - } - var visPages = this.visiblePages; - var index = visPages.indexOf(this.currentPage) + 1; - return Math.ceil((index * 100) / visPages.length); - }; - Object.defineProperty(SurveyModel.prototype, "progressValue", { - /** - * Returns the progress that a user made while going through the survey. - * It depends from progressBarType property - * @see progressBarType - */ - get: function () { - return this.getPropertyValue("progressValue", 0); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isNavigationButtonsShowing", { - /** - * Returns the navigation buttons (i.e., 'Prev', 'Next', or 'Complete' and 'Preview') position. - */ - get: function () { - if (this.isDesignMode) - return "none"; - var page = this.currentPage; - if (!page) - return "none"; - if (page.navigationButtonsVisibility === "show") { - return "bottom"; - } - if (page.navigationButtonsVisibility === "hide") { - return "none"; - } - return this.showNavigationButtons; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isNavigationButtonsShowingOnTop", { - /** - * Returns true if the navigation buttons (i.e., 'Prev', 'Next', or 'Complete' and 'Preview') are shows on top. - */ - get: function () { - return this.getIsNavigationButtonsShowingOn("top"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isNavigationButtonsShowingOnBottom", { - /** - * Returns true if the navigation buttons (i.e., 'Prev', 'Next', or 'Complete' and 'Preview') are shows on bottom. - */ - get: function () { - return this.getIsNavigationButtonsShowingOn("bottom"); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getIsNavigationButtonsShowingOn = function (buttonPosition) { - var res = this.isNavigationButtonsShowing; - return res == "both" || res == buttonPosition; - }; - Object.defineProperty(SurveyModel.prototype, "isEditMode", { - /** - * Returns `true` if the survey is in edit mode. - * @see mode - */ - get: function () { - return this.mode == "edit"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isCompleteButtonVisible", { - get: function () { - var isLast = this.isLastPage; - var canEdit = this.isEditMode; - var state = this.state; - var showPreview = this.isShowPreviewBeforeComplete; - return canEdit && (state === "running" && isLast && !showPreview || state === "preview"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isPreviewButtonVisible", { - get: function () { - return (this.isEditMode && - this.isShowPreviewBeforeComplete && - this.state == "running"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isCancelPreviewButtonVisible", { - get: function () { - return (this.isEditMode && - this.isShowPreviewBeforeComplete && - this.state == "preview"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isDisplayMode", { - /** - * Returns `true` if the survey is in display mode or in preview mode. - * @see mode - * @see showPreviewBeforeComplete - */ - get: function () { - return this.mode == "display" || this.state == "preview"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isUpdateValueTextOnTyping", { - get: function () { - return this.textUpdateMode == "onTyping"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isDesignMode", { - /** - * Returns `true` if the survey is in design mode. It is used by SurveyJS Editor. - * @see setDesignMode - */ - get: function () { - return this._isDesignMode; - }, - enumerable: false, - configurable: true - }); - /** - * Sets the survey into design mode. - * @param value use true to set the survey into the design mode. - */ - SurveyModel.prototype.setDesignMode = function (value) { - this._isDesignMode = value; - this.onQuestionsOnPageModeChanged("standard"); - }; - Object.defineProperty(SurveyModel.prototype, "showInvisibleElements", { - /** - * Gets or sets whether to show all elements in the survey, regardless their visibility. The default value is `false`. - */ - get: function () { - return this.getPropertyValue("showInvisibleElements", false); - }, - set: function (val) { - var visPages = this.visiblePages; - this.setPropertyValue("showInvisibleElements", val); - if (this.isLoadingFromJson) - return; - this.runConditions(); - this.updateAllElementsVisibility(visPages); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.updateAllElementsVisibility = function (visPages) { - for (var i = 0; i < this.pages.length; i++) { - var page = this.pages[i]; - page.updateElementVisibility(); - if (visPages.indexOf(page) > -1 != page.isVisible) { - this.onPageVisibleChanged.fire(this, { - page: page, - visible: page.isVisible, - }); - } - } - }; - Object.defineProperty(SurveyModel.prototype, "areInvisibleElementsShowing", { - get: function () { - return this.isDesignMode || this.showInvisibleElements; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "areEmptyElementsHidden", { - get: function () { - return (this.isShowingPreview && - this.showPreviewBeforeComplete == "showAnsweredQuestions"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "hasCookie", { - /** - * Returns `true`, if a user has already completed the survey in this browser and there is a cookie about it. Survey goes to `completed` state if the function returns `true`. - * @see cookieName - * @see setCookie - * @see deleteCookie - * @see state - */ - get: function () { - if (!this.cookieName || typeof document === "undefined") - return false; - var cookies = document.cookie; - return cookies && cookies.indexOf(this.cookieName + "=true") > -1; - }, - enumerable: false, - configurable: true - }); - /** - * Set the cookie with `cookieName` in user's browser. It is done automatically on survey complete if the `cookieName` property value is not empty. - * @see cookieName - * @see hasCookie - * @see deleteCookie - */ - SurveyModel.prototype.setCookie = function () { - if (!this.cookieName || typeof document === "undefined") - return; - document.cookie = - this.cookieName + "=true; expires=Fri, 31 Dec 9999 0:0:0 GMT"; - }; - /** - * Deletes the cookie with `cookieName` from the browser. - * @see cookieName - * @see hasCookie - * @see setCookie - */ - SurveyModel.prototype.deleteCookie = function () { - if (!this.cookieName) - return; - document.cookie = this.cookieName + "=;"; - }; - /** - * Navigates user to the next page. - * - * Returns `false` in the following cases: - * - * - if the current page is the last page. - * - if the current page contains errors (for example, a required question is empty). - * @see isCurrentPageHasErrors - * @see prevPage - * @see completeLastPage - */ - SurveyModel.prototype.nextPage = function () { - if (this.isLastPage) - return false; - return this.doCurrentPageComplete(false); - }; - SurveyModel.prototype.hasErrorsOnNavigate = function (doComplete) { - var _this = this; - if (this.ignoreValidation || !this.isEditMode) - return false; - var func = function (hasErrors) { - if (!hasErrors) { - _this.doCurrentPageCompleteCore(doComplete); - } - }; - if (this.checkErrorsMode === "onComplete") { - if (!this.isLastPage) - return false; - return this.hasErrors(true, true, func) !== false; - } - return this.hasCurrentPageErrors(func) !== false; - }; - SurveyModel.prototype.checkForAsyncQuestionValidation = function (questions, func) { - var _this = this; - this.clearAsyncValidationQuesitons(); - var _loop_1 = function () { - if (questions[i].isRunningValidators) { - var q_1 = questions[i]; - q_1.onCompletedAsyncValidators = function (hasErrors) { - _this.onCompletedAsyncQuestionValidators(q_1, func, hasErrors); - }; - this_1.asyncValidationQuesitons.push(questions[i]); - } - }; - var this_1 = this; - for (var i = 0; i < questions.length; i++) { - _loop_1(); - } - return this.asyncValidationQuesitons.length > 0; - }; - SurveyModel.prototype.clearAsyncValidationQuesitons = function () { - if (!!this.asyncValidationQuesitons) { - var asynQuestions = this.asyncValidationQuesitons; - for (var i = 0; i < asynQuestions.length; i++) { - asynQuestions[i].onCompletedAsyncValidators = null; - } - } - this.asyncValidationQuesitons = []; - }; - SurveyModel.prototype.onCompletedAsyncQuestionValidators = function (question, func, hasErrors) { - if (hasErrors) { - this.clearAsyncValidationQuesitons(); - func(true); - if (this.focusOnFirstError && !!question && !!question.page && question.page === this.currentPage) { - var questions = this.currentPage.questions; - for (var i_1 = 0; i_1 < questions.length; i_1++) { - if (questions[i_1] !== question && questions[i_1].errors.length > 0) - return; - } - question.focus(true); - } - return; - } - var asynQuestions = this.asyncValidationQuesitons; - for (var i = 0; i < asynQuestions.length; i++) { - if (asynQuestions[i].isRunningValidators) - return; - } - func(false); - }; - Object.defineProperty(SurveyModel.prototype, "isCurrentPageHasErrors", { - /** - * Returns `true`, if the current page contains errors, for example, the required question is empty or a question validation is failed. - * @see nextPage - */ - get: function () { - return this.checkIsCurrentPageHasErrors(); - }, - enumerable: false, - configurable: true - }); - /** - * Returns `true`, if the current page contains any error. If there is an async function in an expression, then the function will return `undefined` value. - * In this case, you should use `onAsyncValidation` parameter, which is a callback function: (hasErrors: boolean) => void - * @param onAsyncValidation use this parameter if you use async functions in your expressions. This callback function will be called with hasErrors value equals to `true` or `false`. - * @see hasPageErrors - * @see hasErrors - * @see currentPage - */ - SurveyModel.prototype.hasCurrentPageErrors = function (onAsyncValidation) { - return this.hasPageErrors(undefined, onAsyncValidation); - }; - /** - * Returns `true`, if a page contains an error. If there is an async function in an expression, then the function will return `undefined` value. - * In this case, you should use the second `onAsyncValidation` parameter, which is a callback function: (hasErrors: boolean) => void - * @param page the page that you want to validate. If the parameter is undefined then the `activePage` is using - * @param onAsyncValidation use this parameter if you use async functions in your expressions. This callback function will be called with hasErrors value equals to `true` or `false`. - * @see hasCurrentPageErrors - * @see hasErrors - * @see activePage - * @see currentPage - */ - SurveyModel.prototype.hasPageErrors = function (page, onAsyncValidation) { - if (!page) { - page = this.activePage; - } - if (!page) - return false; - if (this.checkIsPageHasErrors(page)) - return true; - if (!onAsyncValidation) - return false; - return this.checkForAsyncQuestionValidation(page.questions, function (hasErrors) { return onAsyncValidation(hasErrors); }) - ? undefined - : false; - }; - /** - * Returns `true`, if any of the survey pages contains errors. If there is an async function in an expression, then the function will return `undefined` value. - * In this case, you should use the third `onAsyncValidation` parameter, which is a callback function: (hasErrors: boolean) => void - * @param fireCallback set it to `true`, to show errors in UI. - * @param focusOnFirstError set it to `true` to focus on the first question that doesn't pass the validation and make the page, where the question is located, the current. - * @param onAsyncValidation use this parameter if you use async functions in your expressions. This callback function will be called with hasErrors value equals to `true` or `false`. - * @see hasCurrentPageErrors - * @see hasPageErrors - */ - SurveyModel.prototype.hasErrors = function (fireCallback, focusOnFirstError, onAsyncValidation) { - if (fireCallback === void 0) { fireCallback = true; } - if (focusOnFirstError === void 0) { focusOnFirstError = false; } - if (!!onAsyncValidation) { - fireCallback = true; - } - var visPages = this.visiblePages; - var firstErrorPage = null; - var res = false; - for (var i = 0; i < visPages.length; i++) { - if (visPages[i].hasErrors(fireCallback, false)) { - if (!firstErrorPage) - firstErrorPage = visPages[i]; - res = true; - } - } - if (focusOnFirstError && !!firstErrorPage) { - this.currentPage = firstErrorPage; - var questions = firstErrorPage.questions; - for (var i = 0; i < questions.length; i++) { - if (questions[i].errors.length > 0) { - questions[i].focus(true); - break; - } - } - } - if (res || !onAsyncValidation) - return res; - return this.checkForAsyncQuestionValidation(this.getAllQuestions(), function (hasErrors) { return onAsyncValidation(hasErrors); }) - ? undefined - : false; - }; - /** - * Checks whether survey elements (pages, panels, and questions) have unique question names. - * You can check for unique names for individual page and panel (and all their elements) or a question. - * If the parameter is not specified, then a survey checks that all its elements have unique names. - * @param element page, panel or question, it is `null` by default, that means all survey elements will be checked - */ - SurveyModel.prototype.ensureUniqueNames = function (element) { - if (element === void 0) { element = null; } - if (element == null) { - for (var i = 0; i < this.pages.length; i++) { - this.ensureUniqueName(this.pages[i]); - } - } - else { - this.ensureUniqueName(element); - } - }; - SurveyModel.prototype.ensureUniqueName = function (element) { - if (element.isPage) { - this.ensureUniquePageName(element); - } - if (element.isPanel) { - this.ensureUniquePanelName(element); - } - if (element.isPage || element.isPanel) { - var elements = element.elements; - for (var i = 0; i < elements.length; i++) { - this.ensureUniqueNames(elements[i]); - } - } - else { - this.ensureUniqueQuestionName(element); - } - }; - SurveyModel.prototype.ensureUniquePageName = function (element) { - var _this = this; - return this.ensureUniqueElementName(element, function (name) { - return _this.getPageByName(name); - }); - }; - SurveyModel.prototype.ensureUniquePanelName = function (element) { - var _this = this; - return this.ensureUniqueElementName(element, function (name) { - return _this.getPanelByName(name); - }); - }; - SurveyModel.prototype.ensureUniqueQuestionName = function (element) { - var _this = this; - return this.ensureUniqueElementName(element, function (name) { - return _this.getQuestionByName(name); - }); - }; - SurveyModel.prototype.ensureUniqueElementName = function (element, getElementByName) { - var existingElement = getElementByName(element.name); - if (!existingElement || existingElement == element) - return; - var newName = this.getNewName(element.name); - while (!!getElementByName(newName)) { - var newName = this.getNewName(element.name); - } - element.name = newName; - }; - SurveyModel.prototype.getNewName = function (name) { - var pos = name.length; - while (pos > 0 && name[pos - 1] >= "0" && name[pos - 1] <= "9") { - pos--; - } - var base = name.substr(0, pos); - var num = 0; - if (pos < name.length) { - num = parseInt(name.substr(pos)); - } - num++; - return base + num; - }; - SurveyModel.prototype.checkIsCurrentPageHasErrors = function (isFocuseOnFirstError) { - if (isFocuseOnFirstError === void 0) { isFocuseOnFirstError = undefined; } - return this.checkIsPageHasErrors(this.activePage, isFocuseOnFirstError); - }; - SurveyModel.prototype.checkIsPageHasErrors = function (page, isFocuseOnFirstError) { - if (isFocuseOnFirstError === void 0) { isFocuseOnFirstError = undefined; } - if (isFocuseOnFirstError === undefined) { - isFocuseOnFirstError = this.focusOnFirstError; - } - if (!page) - return true; - var res = page.hasErrors(true, isFocuseOnFirstError); - this.fireValidatedErrorsOnPage(page); - return res; - }; - SurveyModel.prototype.fireValidatedErrorsOnPage = function (page) { - if (this.onValidatedErrorsOnCurrentPage.isEmpty || !page) - return; - var questionsOnPage = page.questions; - var questions = new Array(); - var errors = new Array(); - for (var i = 0; i < questionsOnPage.length; i++) { - var q = questionsOnPage[i]; - if (q.errors.length > 0) { - questions.push(q); - for (var j = 0; j < q.errors.length; j++) { - errors.push(q.errors[j]); - } - } - } - this.onValidatedErrorsOnCurrentPage.fire(this, { - questions: questions, - errors: errors, - page: page, - }); - }; - /** - * Navigates user to a previous page. If the current page is the first page, `prevPage` returns `false`. `prevPage` does not perform any checks, required questions can be empty. - * @see isFirstPage - */ - SurveyModel.prototype.prevPage = function () { - if (this.isFirstPage || this.isStartedState) - return false; - this.resetNavigationButton(); - var vPages = this.visiblePages; - var index = vPages.indexOf(this.currentPage); - this.currentPage = vPages[index - 1]; - return true; - }; - /** - * Completes the survey, if the current page is the last one. It returns `false` if the last page has errors. - * If the last page has no errors, `completeLastPage` calls `doComplete` and returns `true`. - * @see isCurrentPageHasErrors - * @see nextPage - * @see doComplete - */ - SurveyModel.prototype.completeLastPage = function () { - var res = this.doCurrentPageComplete(true); - if (res) { - this.cancelPreview(); - } - return res; - }; - SurveyModel.prototype.navigationMouseDown = function () { - this.isNavigationButtonPressed = true; - return true; - }; - SurveyModel.prototype.resetNavigationButton = function () { - this.isNavigationButtonPressed = false; - }; - /** - * Shows preview for the survey. Switches the survey to the "preview" state. - * - * Details: [Preview State](https://surveyjs.io/Documentation/Library#states-preview) - * @see showPreviewBeforeComplete - * @see cancelPreview - * @see state - * @see previewText - * @see editText - */ - SurveyModel.prototype.showPreview = function () { - this.resetNavigationButton(); - if (this.hasErrorsOnNavigate(true)) - return false; - if (this.doServerValidation(true, true)) - return false; - var options = { allowShowPreview: true }; - this.onShowingPreview.fire(this, options); - this.isShowingPreview = options.allowShowPreview; - return true; - }; - /** - * Cancels preview and switches back to the "running" state. - * - * Details: [Preview State](https://surveyjs.io/Documentation/Library#states-preview) - * @param curPage - A new current page. If the parameter is undefined then the last page becomes the current. - * @see showPreviewBeforeComplete - * @see showPreview - * @see state - */ - SurveyModel.prototype.cancelPreview = function (curPage) { - if (curPage === void 0) { curPage = null; } - if (!this.isShowingPreview) - return; - this.isShowingPreview = false; - if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(curPage) && this.visiblePageCount > 0) { - curPage = this.visiblePageCount - 1; - } - if (curPage !== null) { - this.currentPage = curPage; - } - }; - SurveyModel.prototype.cancelPreviewByPage = function (panel) { - this.cancelPreview(panel["originalPage"]); - }; - SurveyModel.prototype.doCurrentPageComplete = function (doComplete) { - if (this.isValidatingOnServer) - return false; - this.resetNavigationButton(); - if (this.hasErrorsOnNavigate(doComplete)) - return false; - return this.doCurrentPageCompleteCore(doComplete); - }; - SurveyModel.prototype.doCurrentPageCompleteCore = function (doComplete) { - if (this.doServerValidation(doComplete)) - return false; - if (doComplete) { - this.currentPage.passed = true; - return this.doComplete(); - } - this.doNextPage(); - return true; - }; - Object.defineProperty(SurveyModel.prototype, "isSinglePage", { - /** - * Obsolete. Use the `questionsOnPageMode` property instead. - * @see questionsOnPageMode - */ - get: function () { - return this.questionsOnPageMode == "singlePage"; - }, - set: function (val) { - this.questionsOnPageMode = val ? "singlePage" : "standard"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "questionsOnPageMode", { - /** - * Gets or sets a value that specifies how the survey combines questions, panels, and pages. - * - * The following options are available: - * - * - `singlePage` - combine all survey pages in a single page. Pages will be converted to panels. - * - `questionPerPage` - show one question per page. Survey will create a separate page for every question. - */ - get: function () { - return this.getPropertyValue("questionsOnPageMode"); - }, - set: function (val) { - this.setPropertyValue("questionsOnPageMode", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "firstPageIsStarted", { - /** - * Gets or sets whether the first survey page is a start page. Set this property to `true`, to make the first page a starting page. - * An end user cannot navigate to the start page and the start page does not affect a survey progress. - */ - get: function () { - return this.getPropertyValue("firstPageIsStarted", false); - }, - set: function (val) { - this.setPropertyValue("firstPageIsStarted", val); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.isPageStarted = function (page) { - return (this.firstPageIsStarted && this.pages.length > 0 && this.pages[0] === page); - }; - Object.defineProperty(SurveyModel.prototype, "showPreviewBeforeComplete", { - /** - * Set this property to "showAllQuestions" or "showAnsweredQuestions" to allow respondents to preview answers before submitting the survey results. - * - * Details: [Preview State](https://surveyjs.io/Documentation/Library#states-preview) - * Example: [Show Preview Before Complete](https://surveyjs.io/Examples/Library?id=survey-showpreview) - * @see showPreview - * @see cancelPreview - * @see state - * @see previewText - * @see editText - */ - get: function () { - return this.getPropertyValue("showPreviewBeforeComplete"); - }, - set: function (val) { - this.setPropertyValue("showPreviewBeforeComplete", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isShowPreviewBeforeComplete", { - get: function () { - var preview = this.showPreviewBeforeComplete; - return preview == "showAllQuestions" || preview == "showAnsweredQuestions"; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.onFirstPageIsStartedChanged = function () { - if (this.pages.length == 0) - return; - this.isStartedState = this.firstPageIsStarted; - this.pageVisibilityChanged(this.pages[0], !this.firstPageIsStarted); - }; - SurveyModel.prototype.onShowingPreviewChanged = function () { - if (this.isDesignMode) - return; - if (this.isShowingPreview) { - this.runningPages = this.pages.slice(0, this.pages.length); - this.setupPagesForPageModes(true); - } - else { - if (this.runningPages) { - this.restoreOrigionalPages(this.runningPages); - } - this.runningPages = undefined; - } - this.runConditions(); - this.updateAllElementsVisibility(this.pages); - this.updateVisibleIndexes(); - this.currentPageNo = 0; - }; - SurveyModel.prototype.onQuestionsOnPageModeChanged = function (oldValue) { - if (this.isShowingPreview) - return; - if (this.questionsOnPageMode == "standard" || this.isDesignMode) { - if (this.origionalPages) { - this.restoreOrigionalPages(this.origionalPages); - } - this.origionalPages = undefined; - } - else { - if (!oldValue || oldValue == "standard") { - this.origionalPages = this.pages.slice(0, this.pages.length); - } - this.setupPagesForPageModes(this.isSinglePage); - } - this.runConditions(); - this.updateVisibleIndexes(); - }; - SurveyModel.prototype.restoreOrigionalPages = function (originalPages) { - this.questionHashesClear(); - this.pages.splice(0, this.pages.length); - for (var i = 0; i < originalPages.length; i++) { - this.pages.push(originalPages[i]); - } - }; - SurveyModel.prototype.setupPagesForPageModes = function (isSinglePage) { - this.questionHashesClear(); - var startIndex = this.firstPageIsStarted ? 1 : 0; - _super.prototype.startLoadingFromJson.call(this); - var newPages = this.createPagesForQuestionOnPageMode(isSinglePage, startIndex); - var deletedLen = this.pages.length - startIndex; - this.pages.splice(startIndex, deletedLen); - for (var i = 0; i < newPages.length; i++) { - this.pages.push(newPages[i]); - } - _super.prototype.endLoadingFromJson.call(this); - for (var i = 0; i < newPages.length; i++) { - newPages[i].setSurveyImpl(this, true); - } - this.doElementsOnLoad(); - this.updateCurrentPage(); - }; - SurveyModel.prototype.createPagesForQuestionOnPageMode = function (isSinglePage, startIndex) { - if (isSinglePage) { - return [this.createSinglePage(startIndex)]; - } - return this.createPagesForEveryQuestion(startIndex); - }; - SurveyModel.prototype.createSinglePage = function (startIndex) { - var single = this.createNewPage("all"); - single.setSurveyImpl(this); - for (var i = startIndex; i < this.pages.length; i++) { - var page = this.pages[i]; - var panel = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass("panel"); - panel.originalPage = page; - single.addPanel(panel); - var json = new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"]().toJsonObject(page); - new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"]().toObject(json, panel); - if (!this.showPageTitles) { - panel.title = ""; - } - } - return single; - }; - SurveyModel.prototype.createPagesForEveryQuestion = function (startIndex) { - var res = []; - for (var i = startIndex; i < this.pages.length; i++) { - var originalPage = this.pages[i]; - // Initialize randomization - originalPage.setWasShown(true); - for (var j = 0; j < originalPage.elements.length; j++) { - var originalElement = originalPage.elements[j]; - var element = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass(originalElement.getType()); - if (!element) - continue; - var jsonObj = new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"](); - //Deserialize page properties only, excluding elements - jsonObj.lightSerializing = true; - var pageJson = jsonObj.toJsonObject(originalPage); - var page = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass(originalPage.getType()); - page.fromJSON(pageJson); - page.name = "page" + (res.length + 1); - page.setSurveyImpl(this); - res.push(page); - var json = new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"]().toJsonObject(originalElement); - new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"]().toObject(json, element); - page.addElement(element); - for (var k = 0; k < page.questions.length; k++) { - this.questionHashesAdded(page.questions[k]); - } - } - } - return res; - }; - Object.defineProperty(SurveyModel.prototype, "isFirstPage", { - /** - * Gets whether the current page is the first one. - */ - get: function () { - return this.getPropertyValue("isFirstPage"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isLastPage", { - /** - * Gets whether the current page is the last one. - */ - get: function () { - return this.getPropertyValue("isLastPage"); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isShowPrevButton", { - get: function () { - var isFirst = this.isFirstPage; - var showBtn = this.showPrevButton; - var isRun = this.state === "running"; - if (isFirst || !showBtn || !isRun) - return false; - var page = this.visiblePages[this.currentPageNo - 1]; - return this.getPageMaxTimeToFinish(page) <= 0; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isShowNextButton", { - get: function () { - var isLast = this.isLastPage; - var isRun = this.state === "running"; - return !isLast && isRun; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "firstVisiblePage", { - get: function () { - var pages = this.pages; - for (var i = 0; i < pages.length; i++) { - if (this.isPageInVisibleList(pages[i])) - return pages[i]; - } - return null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "lastVisiblePage", { - get: function () { - var pages = this.pages; - for (var i = pages.length - 1; i >= 0; i--) { - if (this.isPageInVisibleList(pages[i])) - return pages[i]; - } - return null; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.updateIsFirstLastPageState = function () { - var curPage = this.currentPage; - if (!curPage) - return; - this.setPropertyValue("isFirstPage", curPage === this.firstVisiblePage); - this.setPropertyValue("isLastPage", curPage === this.lastVisiblePage); - }; - /** - * Completes the survey. - * - * Calling this function performs the following tasks: - * - * - writes cookie if the `cookieName` property is not empty - * - sets the survey into `completed` state - * - fires the `onComplete` event - * - calls `sendResult` function. - * - * Calling the `doComplete` function does not perform any validation, unlike the `completeLastPage` function. - * The function can return false, if you set options.allowComplete to false in onCompleting event. Otherwise it returns true. - * It calls `navigateToUrl` after calling `onComplete` event. - * In case calling `options.showDataSaving` callback in the `onComplete` event, `navigateToUrl` is used on calling `options.showDataSavingSuccess` callback. - * @see completeLastPage - * @see onCompleting - * @see cookieName - * @see state - * @see onComplete - * @see surveyPostId - * @see completeLastPage - * @see navigateToUrl - * @see navigateToUrlOnCondition - */ - SurveyModel.prototype.doComplete = function (isCompleteOnTrigger) { - if (isCompleteOnTrigger === void 0) { isCompleteOnTrigger = false; } - var onCompletingOptions = { - allowComplete: true, - isCompleteOnTrigger: isCompleteOnTrigger, - }; - this.onCompleting.fire(this, onCompletingOptions); - if (!onCompletingOptions.allowComplete) { - this.isCompleted = false; - return false; - } - var previousCookie = this.hasCookie; - this.stopTimer(); - this.setCompleted(); - this.clearUnusedValues(); - this.setCookie(); - var self = this; - var savingDataStarted = false; - var onCompleteOptions = { - isCompleteOnTrigger: isCompleteOnTrigger, - showDataSaving: function (text) { - savingDataStarted = true; - self.setCompletedState("saving", text); - }, - showDataSavingError: function (text) { - self.setCompletedState("error", text); - }, - showDataSavingSuccess: function (text) { - self.setCompletedState("success", text); - self.navigateTo(); - }, - showDataSavingClear: function (text) { - self.setCompletedState("", ""); - }, - }; - this.onComplete.fire(this, onCompleteOptions); - if (!previousCookie && this.surveyPostId) { - this.sendResult(); - } - if (!savingDataStarted) { - this.navigateTo(); - } - return true; - }; - /** - * Starts the survey. Changes the survey mode from "starting" to "running". Call this function if your survey has a start page, otherwise this function does nothing. - * @see firstPageIsStarted - */ - SurveyModel.prototype.start = function () { - if (!this.firstPageIsStarted) - return false; - if (this.checkIsPageHasErrors(this.startedPage, true)) - return false; - this.isStartedState = false; - this.startTimerFromUI(); - this.onStarted.fire(this, {}); - this.updateVisibleIndexes(); - if (!!this.currentPage) { - this.currentPage.locStrsChanged(); - } - return true; - }; - Object.defineProperty(SurveyModel.prototype, "isValidatingOnServer", { - /** - * Gets whether the question values on the current page are validating on the server at the current moment. - * @see onServerValidateQuestions - */ - get: function () { - return this.getPropertyValue("isValidatingOnServer", false); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.setIsValidatingOnServer = function (val) { - if (val == this.isValidatingOnServer) - return; - this.setPropertyValue("isValidatingOnServer", val); - this.onIsValidatingOnServerChanged(); - }; - SurveyModel.prototype.onIsValidatingOnServerChanged = function () { }; - SurveyModel.prototype.doServerValidation = function (doComplete, isPreview) { - if (isPreview === void 0) { isPreview = false; } - if (!this.onServerValidateQuestions || - this.onServerValidateQuestions.isEmpty) - return false; - if (!doComplete && this.checkErrorsMode === "onComplete") - return false; - var self = this; - var options = { - data: {}, - errors: {}, - survey: this, - complete: function () { - self.completeServerValidation(options, isPreview); - }, - }; - if (doComplete && this.checkErrorsMode === "onComplete") { - options.data = this.data; - } - else { - var questions = this.activePage.questions; - for (var i = 0; i < questions.length; i++) { - var question = questions[i]; - if (!question.visible) - continue; - var value = this.getValue(question.getValueName()); - if (!this.isValueEmpty(value)) - options.data[question.getValueName()] = value; - } - } - this.setIsValidatingOnServer(true); - if (typeof this.onServerValidateQuestions === "function") { - this.onServerValidateQuestions(this, options); - } - else { - this.onServerValidateQuestions.fire(this, options); - } - return true; - }; - SurveyModel.prototype.completeServerValidation = function (options, isPreview) { - this.setIsValidatingOnServer(false); - if (!options && !options.survey) - return; - var self = options.survey; - var hasErrors = false; - if (options.errors) { - var hasToFocus = this.focusOnFirstError; - for (var name in options.errors) { - var question = self.getQuestionByName(name); - if (question && question["errors"]) { - hasErrors = true; - question.addError(new _error__WEBPACK_IMPORTED_MODULE_9__["CustomError"](options.errors[name], this)); - if (hasToFocus) { - hasToFocus = false; - if (!!question.page) { - this.currentPage = question.page; - } - question.focus(true); - } - } - } - this.fireValidatedErrorsOnPage(this.currentPage); - } - if (!hasErrors) { - if (isPreview) { - this.isShowingPreview = true; - } - else { - if (self.isLastPage) - self.doComplete(); - else - self.doNextPage(); - } - } - }; - SurveyModel.prototype.doNextPage = function () { - var curPage = this.currentPage; - this.checkOnPageTriggers(); - if (!this.isCompleted) { - if (this.sendResultOnPageNext) { - this.sendResult(this.surveyPostId, this.clientId, true); - } - if (curPage === this.currentPage) { - var vPages = this.visiblePages; - var index = vPages.indexOf(this.currentPage); - this.currentPage = vPages[index + 1]; - } - } - else { - this.doComplete(true); - } - }; - SurveyModel.prototype.setCompleted = function () { - this.isCompleted = true; - }; - Object.defineProperty(SurveyModel.prototype, "processedCompletedHtml", { - /** - * Returns the HTML content for the complete page. - * @see completedHtml - */ - get: function () { - var html = this.renderedCompletedHtml; - if (html) { - return this.processHtml(html); - } - return "

" + this.getLocString("completingSurvey") + "

"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "processedCompletedBeforeHtml", { - /** - * Returns the HTML content, that is shown to a user that had completed the survey before. - * @see completedHtml - * @see cookieName - */ - get: function () { - if (this.completedBeforeHtml) { - return this.processHtml(this.completedBeforeHtml); - } - return "

" + this.getLocString("completingSurveyBefore") + "

"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "processedLoadingHtml", { - /** - * Returns the HTML content, that is shows when a survey loads the survey JSON. - */ - get: function () { - if (this.loadingHtml) { - return this.processHtml(this.loadingHtml); - } - return "

" + this.getLocString("loadingSurvey") + "

"; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getProgressInfo = function () { - var pages = this.isDesignMode ? this.pages : this.visiblePages; - return _survey_element__WEBPACK_IMPORTED_MODULE_2__["SurveyElement"].getProgressInfoByElements(pages, false); - }; - Object.defineProperty(SurveyModel.prototype, "progressText", { - /** - * Returns the text for the current progress. - */ - get: function () { - var res = this.getPropertyValue("progressText", ""); - if (!res) { - this.updateProgressText(); - res = this.getPropertyValue("progressText", ""); - } - return res; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.updateProgressText = function (onValueChanged) { - if (onValueChanged === void 0) { onValueChanged = false; } - if (this.isCalculatingProgressText) - return; - if (onValueChanged && - this.progressBarType == "pages" && - this.onProgressText.isEmpty) - return; - this.isCalculatingProgressText = true; - this.setPropertyValue("progressText", this.getProgressText()); - this.setPropertyValue("progressValue", this.getProgress()); - this.isCalculatingProgressText = false; - }; - SurveyModel.prototype.getProgressText = function () { - if (!this.isDesignMode && this.currentPage == null) - return ""; - var options = { - questionCount: 0, - answeredQuestionCount: 0, - requiredQuestionCount: 0, - requiredAnsweredQuestionCount: 0, - text: "", - }; - var type = this.progressBarType.toLowerCase(); - if (type === "questions" || - type === "requiredquestions" || - type === "correctquestions" || - !this.onProgressText.isEmpty) { - var info = this.getProgressInfo(); - options.questionCount = info.questionCount; - options.answeredQuestionCount = info.answeredQuestionCount; - options.requiredQuestionCount = info.requiredQuestionCount; - options.requiredAnsweredQuestionCount = - info.requiredAnsweredQuestionCount; - } - options.text = this.getProgressTextCore(options); - this.onProgressText.fire(this, options); - return options.text; - }; - SurveyModel.prototype.getProgressTextCore = function (info) { - var type = this.progressBarType.toLowerCase(); - if (type === "questions") { - return this.getLocString("questionsProgressText")["format"](info.answeredQuestionCount, info.questionCount); - } - if (type === "requiredquestions") { - return this.getLocString("questionsProgressText")["format"](info.requiredAnsweredQuestionCount, info.requiredQuestionCount); - } - if (type === "correctquestions") { - var correctAnswersCount = this.getCorrectedAnswerCount(); - return this.getLocString("questionsProgressText")["format"](correctAnswersCount, info.questionCount); - } - var vPages = this.isDesignMode ? this.pages : this.visiblePages; - var index = vPages.indexOf(this.currentPage) + 1; - return this.getLocString("progressText")["format"](index, vPages.length); - }; - SurveyModel.prototype.afterRenderSurvey = function (htmlElement) { - this.onAfterRenderSurvey.fire(this, { - survey: this, - htmlElement: htmlElement, - }); - }; - SurveyModel.prototype.updateQuestionCssClasses = function (question, cssClasses) { - this.onUpdateQuestionCssClasses.fire(this, { - question: question, - cssClasses: cssClasses, - }); - }; - SurveyModel.prototype.updatePanelCssClasses = function (panel, cssClasses) { - this.onUpdatePanelCssClasses.fire(this, { - panel: panel, - cssClasses: cssClasses, - }); - }; - SurveyModel.prototype.updatePageCssClasses = function (page, cssClasses) { - this.onUpdatePageCssClasses.fire(this, { - page: page, - cssClasses: cssClasses, - }); - }; - SurveyModel.prototype.updateChoiceItemCss = function (question, options) { - options.question = question; - this.onUpdateChoiceItemCss.fire(this, options); - }; - SurveyModel.prototype.afterRenderPage = function (htmlElement) { - if (this.onAfterRenderPage.isEmpty) - return; - this.onAfterRenderPage.fire(this, { - page: this.activePage, - htmlElement: htmlElement, - }); - }; - SurveyModel.prototype.afterRenderHeader = function (htmlElement) { - if (this.onAfterRenderHeader.isEmpty) - return; - this.onAfterRenderHeader.fire(this, { - htmlElement: htmlElement, - }); - }; - SurveyModel.prototype.afterRenderQuestion = function (question, htmlElement) { - this.onAfterRenderQuestion.fire(this, { - question: question, - htmlElement: htmlElement, - }); - }; - SurveyModel.prototype.afterRenderQuestionInput = function (question, htmlElement) { - if (this.onAfterRenderQuestionInput.isEmpty) - return; - var id = question.inputId; - if (!!id && htmlElement.id !== id && typeof document !== "undefined") { - var el = document.getElementById(id); - if (!!el) { - htmlElement = el; - } - } - this.onAfterRenderQuestionInput.fire(this, { - question: question, - htmlElement: htmlElement, - }); - }; - SurveyModel.prototype.afterRenderPanel = function (panel, htmlElement) { - this.onAfterRenderPanel.fire(this, { - panel: panel, - htmlElement: htmlElement, - }); - }; - SurveyModel.prototype.whenQuestionFocusIn = function (question) { - this.onFocusInQuestion.fire(this, { - question: question - }); - }; - SurveyModel.prototype.whenPanelFocusIn = function (panel) { - this.onFocusInPanel.fire(this, { - panel: panel - }); - }; - SurveyModel.prototype.matrixBeforeRowAdded = function (options) { - this.onMatrixBeforeRowAdded.fire(this, options); - }; - SurveyModel.prototype.matrixRowAdded = function (question, row) { - this.onMatrixRowAdded.fire(this, { question: question, row: row }); - }; - SurveyModel.prototype.getQuestionByValueNameFromArray = function (valueName, name, index) { - var questions = this.getQuestionsByValueName(valueName); - if (!questions) - return; - for (var i = 0; i < questions.length; i++) { - var res = questions[i].getQuestionFromArray(name, index); - if (!!res) - return res; - } - return null; - }; - SurveyModel.prototype.matrixRowRemoved = function (question, rowIndex, row) { - this.onMatrixRowRemoved.fire(this, { - question: question, - rowIndex: rowIndex, - row: row, - }); - }; - SurveyModel.prototype.matrixRowRemoving = function (question, rowIndex, row) { - var options = { - question: question, - rowIndex: rowIndex, - row: row, - allow: true, - }; - this.onMatrixRowRemoving.fire(this, options); - return options.allow; - }; - SurveyModel.prototype.matrixAllowRemoveRow = function (question, rowIndex, row) { - var options = { - question: question, - rowIndex: rowIndex, - row: row, - allow: true, - }; - this.onMatrixAllowRemoveRow.fire(this, options); - return options.allow; - }; - SurveyModel.prototype.matrixCellCreating = function (question, options) { - options.question = question; - this.onMatrixCellCreating.fire(this, options); - }; - SurveyModel.prototype.matrixCellCreated = function (question, options) { - options.question = question; - this.onMatrixCellCreated.fire(this, options); - }; - SurveyModel.prototype.matrixAfterCellRender = function (question, options) { - options.question = question; - this.onMatrixAfterCellRender.fire(this, options); - }; - SurveyModel.prototype.matrixCellValueChanged = function (question, options) { - options.question = question; - this.onMatrixCellValueChanged.fire(this, options); - }; - SurveyModel.prototype.matrixCellValueChanging = function (question, options) { - options.question = question; - this.onMatrixCellValueChanging.fire(this, options); - }; - Object.defineProperty(SurveyModel.prototype, "isValidateOnValueChanging", { - get: function () { - return this.checkErrorsMode === "onValueChanging"; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.matrixCellValidate = function (question, options) { - options.question = question; - this.onMatrixCellValidate.fire(this, options); - return options.error ? new _error__WEBPACK_IMPORTED_MODULE_9__["CustomError"](options.error, this) : null; - }; - SurveyModel.prototype.dynamicPanelAdded = function (question) { - if (this.onDynamicPanelAdded.isEmpty) - return; - var panels = question.panels; - var panel = panels[panels.length - 1]; - this.onDynamicPanelAdded.fire(this, { question: question, panel: panel }); - }; - SurveyModel.prototype.dynamicPanelRemoved = function (question, panelIndex, panel) { - var questions = !!panel ? panel.questions : []; - for (var i = 0; i < questions.length; i++) { - questions[i].clearOnDeletingContainer(); - } - this.onDynamicPanelRemoved.fire(this, { - question: question, - panelIndex: panelIndex, - panel: panel, - }); - }; - SurveyModel.prototype.dynamicPanelItemValueChanged = function (question, options) { - options.question = question; - this.onDynamicPanelItemValueChanged.fire(this, options); - }; - SurveyModel.prototype.dragAndDropAllow = function (options) { - options.allow = true; - this.onDragDropAllow.fire(this, options); - return options.allow; - }; - SurveyModel.prototype.elementContentVisibilityChanged = function (element) { - if (this.currentPage) { - this.currentPage.ensureRowsVisibility(); - } - this.onElementContentVisibilityChanged.fire(this, { element: element }); - }; - SurveyModel.prototype.getUpdatedElementTitleActions = function (element, titleActions) { - if (element.isPage) - return this.getUpdatedPageTitleActions(element, titleActions); - if (element.isPanel) - return this.getUpdatedPanelTitleActions(element, titleActions); - return this.getUpdatedQuestionTitleActions(element, titleActions); - }; - SurveyModel.prototype.getUpdatedQuestionTitleActions = function (question, titleActions) { - var options = { - question: question, - titleActions: titleActions, - }; - this.onGetQuestionTitleActions.fire(this, options); - return options.titleActions; - }; - SurveyModel.prototype.getUpdatedPanelTitleActions = function (panel, titleActions) { - var options = { - panel: panel, - titleActions: titleActions, - }; - this.onGetPanelTitleActions.fire(this, options); - return options.titleActions; - }; - SurveyModel.prototype.getUpdatedPageTitleActions = function (page, titleActions) { - var options = { - page: page, - titleActions: titleActions, - }; - this.onGetPageTitleActions.fire(this, options); - return options.titleActions; - }; - SurveyModel.prototype.getUpdatedMatrixRowActions = function (question, row, actions) { - var options = { - question: question, - actions: actions, - row: row, - }; - this.onGetMatrixRowActions.fire(this, options); - return options.actions; - }; - SurveyModel.prototype.scrollElementToTop = function (element, question, page, id) { - var options = { - element: element, - question: question, - page: page, - elementId: id, - cancel: false, - }; - this.onScrollingElementToTop.fire(this, options); - if (!options.cancel) { - _survey_element__WEBPACK_IMPORTED_MODULE_2__["SurveyElement"].ScrollElementToTop(options.elementId); - } - }; - /** - * Uploads a file to server. - * @param question a file question object - * @param name a question name - * @param files files to upload - * @param uploadingCallback a call back function to get the status on uploading the files - */ - SurveyModel.prototype.uploadFiles = function (question, name, files, uploadingCallback) { - if (this.onUploadFiles.isEmpty) { - uploadingCallback("error", files); - } - else { - this.onUploadFiles.fire(this, { - question: question, - name: name, - files: files || [], - callback: uploadingCallback, - }); - } - if (this.surveyPostId) { - this.uploadFilesCore(name, files, uploadingCallback); - } - }; - /** - * Downloads a file from server - * @param name a question name - * @param fileValue a single file question value - * @param callback a call back function to get the status on downloading the file and the downloaded file content - */ - SurveyModel.prototype.downloadFile = function (questionName, fileValue, callback) { - if (this.onDownloadFile.isEmpty) { - !!callback && callback("success", fileValue.content || fileValue); - } - this.onDownloadFile.fire(this, { - name: questionName, - content: fileValue.content || fileValue, - fileValue: fileValue, - callback: callback, - }); - }; - /** - * Clears files from server. - * @param question question - * @param name question name - * @param value file question value - * @param callback call back function to get the status of the clearing operation - */ - SurveyModel.prototype.clearFiles = function (question, name, value, fileName, callback) { - if (this.onClearFiles.isEmpty) { - !!callback && callback("success", value); - } - this.onClearFiles.fire(this, { - question: question, - name: name, - value: value, - fileName: fileName, - callback: callback, - }); - }; - SurveyModel.prototype.updateChoicesFromServer = function (question, choices, serverResult) { - var options = { - question: question, - choices: choices, - serverResult: serverResult, - }; - this.onLoadChoicesFromServer.fire(this, options); - return options.choices; - }; - SurveyModel.prototype.loadedChoicesFromServer = function (question) { - this.locStrsChanged(); - }; - SurveyModel.prototype.createSurveyService = function () { - return new _dxSurveyService__WEBPACK_IMPORTED_MODULE_7__["dxSurveyService"](); - }; - SurveyModel.prototype.uploadFilesCore = function (name, files, uploadingCallback) { - var _this = this; - var responses = []; - files.forEach(function (file) { - if (uploadingCallback) - uploadingCallback("uploading", file); - _this.createSurveyService().sendFile(_this.surveyPostId, file, function (success, response) { - if (success) { - responses.push({ content: response, file: file }); - if (responses.length === files.length) { - if (uploadingCallback) - uploadingCallback("success", responses); - } - } - else { - if (uploadingCallback) - uploadingCallback("error", { - response: response, - file: file, - }); - } - }); - }); - }; - SurveyModel.prototype.getPage = function (index) { - return this.pages[index]; - }; - /** - * Adds an existing page to the survey. - * @param page a newly added page - * @param index - a page index to where insert a page. It is -1 by default and the page will be added into the end. - * @see addNewPage - */ - SurveyModel.prototype.addPage = function (page, index) { - if (index === void 0) { index = -1; } - if (page == null) - return; - if (index < 0 || index >= this.pages.length) { - this.pages.push(page); - } - else { - this.pages.splice(index, 0, page); - } - }; - /** - * Creates a new page and adds it to a survey. Generates a new name if the `name` parameter is not specified. - * @param name a page name - * @param index - a page index to where insert a new page. It is -1 by default and the page will be added into the end. - * @see addPage - */ - SurveyModel.prototype.addNewPage = function (name, index) { - if (name === void 0) { name = null; } - if (index === void 0) { index = -1; } - var page = this.createNewPage(name); - this.addPage(page, index); - return page; - }; - /** - * Removes a page from a survey. - * @param page - */ - SurveyModel.prototype.removePage = function (page) { - var index = this.pages.indexOf(page); - if (index < 0) - return; - this.pages.splice(index, 1); - if (this.currentPage == page) { - this.currentPage = this.pages.length > 0 ? this.pages[0] : null; - } - }; - /** - * Returns a question by its name. - * @param name a question name - * @param caseInsensitive - * @see getQuestionByValueName - */ - SurveyModel.prototype.getQuestionByName = function (name, caseInsensitive) { - if (caseInsensitive === void 0) { caseInsensitive = false; } - if (!name) - return null; - if (caseInsensitive) { - name = name.toLowerCase(); - } - var hash = !!caseInsensitive - ? this.questionHashes.namesInsensitive - : this.questionHashes.names; - var res = hash[name]; - if (!res) - return null; - return res[0]; - }; - /** - * Returns a question by its value name - * @param valueName a question name - * @param caseInsensitive - * @see getQuestionByName - * @see getQuestionsByValueName - * @see Question.valueName - */ - SurveyModel.prototype.getQuestionByValueName = function (valueName, caseInsensitive) { - if (caseInsensitive === void 0) { caseInsensitive = false; } - var res = this.getQuestionsByValueName(valueName, caseInsensitive); - return !!res ? res[0] : null; - }; - /** - * Returns all questions by their valueName. name property is used if valueName property is empty. - * @param valueName a question name - * @param caseInsensitive - * @see getQuestionByName - * @see getQuestionByValueName - * @see Question.valueName - */ - SurveyModel.prototype.getQuestionsByValueName = function (valueName, caseInsensitive) { - if (caseInsensitive === void 0) { caseInsensitive = false; } - var hash = !!caseInsensitive - ? this.questionHashes.valueNamesInsensitive - : this.questionHashes.valueNames; - var res = hash[valueName]; - if (!res) - return null; - return res; - }; - SurveyModel.prototype.getCalculatedValueByName = function (name) { - for (var i = 0; i < this.calculatedValues.length; i++) { - if (name == this.calculatedValues[i].name) - return this.calculatedValues[i]; - } - return null; - }; - /** - * Gets a list of questions by their names. - * @param names an array of question names - * @param caseInsensitive - */ - SurveyModel.prototype.getQuestionsByNames = function (names, caseInsensitive) { - if (caseInsensitive === void 0) { caseInsensitive = false; } - var result = []; - if (!names) - return result; - for (var i = 0; i < names.length; i++) { - if (!names[i]) - continue; - var question = this.getQuestionByName(names[i], caseInsensitive); - if (question) - result.push(question); - } - return result; - }; - /** - * Returns a page on which an element (question or panel) is placed. - * @param element Question or Panel - */ - SurveyModel.prototype.getPageByElement = function (element) { - for (var i = 0; i < this.pages.length; i++) { - var page = this.pages[i]; - if (page.containsElement(element)) - return page; - } - return null; - }; - /** - * Returns a page on which a question is located. - * @param question - */ - SurveyModel.prototype.getPageByQuestion = function (question) { - return this.getPageByElement(question); - }; - /** - * Returns a page by it's name. - * @param name - */ - SurveyModel.prototype.getPageByName = function (name) { - for (var i = 0; i < this.pages.length; i++) { - if (this.pages[i].name == name) - return this.pages[i]; - } - return null; - }; - /** - * Returns a list of pages by their names. - * @param names a list of page names - */ - SurveyModel.prototype.getPagesByNames = function (names) { - var result = []; - if (!names) - return result; - for (var i = 0; i < names.length; i++) { - if (!names[i]) - continue; - var page = this.getPageByName(names[i]); - if (page) - result.push(page); - } - return result; - }; - /** - * Returns a list of all questions in a survey. - * @param visibleOnly set it `true`, if you want to get only visible questions - */ - SurveyModel.prototype.getAllQuestions = function (visibleOnly, includingDesignTime) { - if (visibleOnly === void 0) { visibleOnly = false; } - if (includingDesignTime === void 0) { includingDesignTime = false; } - var result = new Array(); - for (var i = 0; i < this.pages.length; i++) { - this.pages[i].addQuestionsToList(result, visibleOnly, includingDesignTime); - } - return result; - }; - /** - * Returns quiz questions. All visible questions that has input(s) widgets. - * @see getQuizQuestionCount - */ - SurveyModel.prototype.getQuizQuestions = function () { - var result = new Array(); - var startIndex = this.firstPageIsStarted ? 1 : 0; - for (var i = startIndex; i < this.pages.length; i++) { - if (!this.pages[i].isVisible) - continue; - var questions = this.pages[i].questions; - for (var j = 0; j < questions.length; j++) { - var q = questions[j]; - if (q.quizQuestionCount > 0) { - result.push(q); - } - } - } - return result; - }; - /** - * Returns a panel by its name. - * @param name a panel name - * @param caseInsensitive - * @see getQuestionByName - */ - SurveyModel.prototype.getPanelByName = function (name, caseInsensitive) { - if (caseInsensitive === void 0) { caseInsensitive = false; } - var panels = this.getAllPanels(); - if (caseInsensitive) - name = name.toLowerCase(); - for (var i = 0; i < panels.length; i++) { - var panelName = panels[i].name; - if (caseInsensitive) - panelName = panelName.toLowerCase(); - if (panelName == name) - return panels[i]; - } - return null; - }; - /** - * Returns a list of all survey's panels. - */ - SurveyModel.prototype.getAllPanels = function (visibleOnly, includingDesignTime) { - if (visibleOnly === void 0) { visibleOnly = false; } - if (includingDesignTime === void 0) { includingDesignTime = false; } - var result = new Array(); - for (var i = 0; i < this.pages.length; i++) { - this.pages[i].addPanelsIntoList(result, visibleOnly, includingDesignTime); - } - return result; - }; - /** - * Creates and returns a new page, but do not add it into the survey. - * You can use addPage(page) function to add it into survey later. - * @see addPage - * @see addNewPage - */ - SurveyModel.prototype.createNewPage = function (name) { - return new _page__WEBPACK_IMPORTED_MODULE_4__["PageModel"](name); - }; - SurveyModel.prototype.questionOnValueChanging = function (valueName, newValue) { - if (this.onValueChanging.isEmpty) - return newValue; - var options = { - name: valueName, - question: this.getQuestionByValueName(valueName), - value: this.getUnbindValue(newValue), - oldValue: this.getValue(valueName), - }; - this.onValueChanging.fire(this, options); - return options.value; - }; - SurveyModel.prototype.updateQuestionValue = function (valueName, newValue) { - if (this.isLoadingFromJson) - return; - var questions = this.getQuestionsByValueName(valueName); - if (!!questions) { - for (var i = 0; i < questions.length; i++) { - var qValue = questions[i].value; - if ((qValue === newValue && Array.isArray(qValue) && !!this.editingObj) || - !this.isTwoValueEquals(qValue, newValue)) { - questions[i].updateValueFromSurvey(newValue); - } - } - } - }; - SurveyModel.prototype.checkQuestionErrorOnValueChanged = function (question) { - if (!this.isNavigationButtonPressed && - (this.checkErrorsMode === "onValueChanged" || - question.getAllErrors().length > 0)) { - this.checkQuestionErrorOnValueChangedCore(question); - } - }; - SurveyModel.prototype.checkQuestionErrorOnValueChangedCore = function (question) { - var oldErrorCount = question.getAllErrors().length; - var res = question.hasErrors(true, { - isOnValueChanged: !this.isValidateOnValueChanging, - }); - if (!!question.page && - (oldErrorCount > 0 || question.getAllErrors().length > 0)) { - this.fireValidatedErrorsOnPage(question.page); - } - return res; - }; - SurveyModel.prototype.checkErrorsOnValueChanging = function (valueName, newValue) { - if (this.isLoadingFromJson) - return false; - var questions = this.getQuestionsByValueName(valueName); - if (!questions) - return false; - var res = false; - for (var i = 0; i < questions.length; i++) { - var q = questions[i]; - if (!this.isTwoValueEquals(q.valueForSurvey, newValue)) { - q.value = newValue; - } - if (this.checkQuestionErrorOnValueChangedCore(q)) - res = true; - res = res || q.errors.length > 0; - } - return res; - }; - SurveyModel.prototype.notifyQuestionOnValueChanged = function (valueName, newValue) { - if (this.isLoadingFromJson) - return; - var questions = this.getQuestionsByValueName(valueName); - if (!!questions) { - for (var i = 0; i < questions.length; i++) { - var question = questions[i]; - this.checkQuestionErrorOnValueChanged(question); - question.onSurveyValueChanged(newValue); - this.onValueChanged.fire(this, { - name: valueName, - question: question, - value: newValue, - }); - } - } - else { - this.onValueChanged.fire(this, { - name: valueName, - question: null, - value: newValue, - }); - } - if (this.isDisposed) - return; - for (var i = 0; i < this.pages.length; i++) { - this.pages[i].checkBindings(valueName, newValue); - } - this.notifyElementsOnAnyValueOrVariableChanged(valueName); - }; - SurveyModel.prototype.notifyElementsOnAnyValueOrVariableChanged = function (name) { - if (this.isEndLoadingFromJson === "processing") - return; - if (this.isRunningConditions) { - this.conditionNotifyElementsOnAnyValueOrVariableChanged = true; - return; - } - for (var i = 0; i < this.pages.length; i++) { - this.pages[i].onAnyValueChanged(name); - } - if (!this.isEndLoadingFromJson) { - this.locStrsChanged(); - } - }; - SurveyModel.prototype.updateAllQuestionsValue = function () { - var questions = this.getAllQuestions(); - for (var i = 0; i < questions.length; i++) { - var q = questions[i]; - var valName = q.getValueName(); - q.updateValueFromSurvey(this.getValue(valName)); - if (q.requireUpdateCommentValue) { - q.updateCommentFromSurvey(this.getComment(valName)); - } - } - }; - SurveyModel.prototype.notifyAllQuestionsOnValueChanged = function () { - var questions = this.getAllQuestions(); - for (var i = 0; i < questions.length; i++) { - questions[i].onSurveyValueChanged(this.getValue(questions[i].getValueName())); - } - }; - SurveyModel.prototype.checkOnPageTriggers = function () { - var questions = this.getCurrentPageQuestions(true); - var values = {}; - for (var i = 0; i < questions.length; i++) { - var question = questions[i]; - var name = question.getValueName(); - values[name] = this.getValue(name); - } - this.addCalculatedValuesIntoFilteredValues(values); - this.checkTriggers(values, true); - }; - SurveyModel.prototype.getCurrentPageQuestions = function (includeInvsible) { - if (includeInvsible === void 0) { includeInvsible = false; } - var result = []; - var page = this.currentPage; - if (!page) - return result; - for (var i = 0; i < page.questions.length; i++) { - var question = page.questions[i]; - if ((!includeInvsible && !question.visible) || !question.name) - continue; - result.push(question); - } - return result; - }; - SurveyModel.prototype.checkTriggers = function (key, isOnNextPage) { - if (this.isCompleted || this.triggers.length == 0 || this.isDisplayMode) - return; - if (this.isTriggerIsRunning) { - this.triggerValues = this.getFilteredValues(); - for (var k in key) { - this.triggerKeys[k] = key[k]; - } - return; - } - this.isTriggerIsRunning = true; - this.triggerKeys = key; - this.triggerValues = this.getFilteredValues(); - var properties = this.getFilteredProperties(); - for (var i = 0; i < this.triggers.length; i++) { - var trigger = this.triggers[i]; - if (trigger.isOnNextPage == isOnNextPage) { - trigger.checkExpression(this.triggerKeys, this.triggerValues, properties); - } - } - this.isTriggerIsRunning = false; - }; - SurveyModel.prototype.doElementsOnLoad = function () { - for (var i = 0; i < this.pages.length; i++) { - this.pages[i].onSurveyLoad(); - } - }; - Object.defineProperty(SurveyModel.prototype, "isRunningConditions", { - get: function () { - return !!this.conditionValues; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.runConditions = function () { - if (this.isCompleted || - this.isEndLoadingFromJson === "processing" || - this.isRunningConditions) - return; - this.conditionValues = this.getFilteredValues(); - var properties = this.getFilteredProperties(); - var oldCurrentPageIndex = this.pages.indexOf(this.currentPage); - this.runConditionsCore(properties); - this.checkIfNewPagesBecomeVisible(oldCurrentPageIndex); - this.conditionValues = null; - if (this.isValueChangedOnRunningCondition && - this.conditionRunnerCounter < - _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].maximumConditionRunCountOnValueChanged) { - this.isValueChangedOnRunningCondition = false; - this.conditionRunnerCounter++; - this.runConditions(); - } - else { - this.isValueChangedOnRunningCondition = false; - this.conditionRunnerCounter = 0; - if (this.conditionUpdateVisibleIndexes) { - this.conditionUpdateVisibleIndexes = false; - this.updateVisibleIndexes(); - } - if (this.conditionNotifyElementsOnAnyValueOrVariableChanged) { - this.conditionNotifyElementsOnAnyValueOrVariableChanged = false; - this.notifyElementsOnAnyValueOrVariableChanged(""); - } - } - }; - SurveyModel.prototype.runConditionOnValueChanged = function (name, value) { - if (this.isRunningConditions) { - this.conditionValues[name] = value; - this.isValueChangedOnRunningCondition = true; - } - else { - this.runConditions(); - } - }; - SurveyModel.prototype.runConditionsCore = function (properties) { - var pages = this.pages; - for (var i = 0; i < this.calculatedValues.length; i++) { - this.calculatedValues[i].resetCalculation(); - } - for (var i = 0; i < this.calculatedValues.length; i++) { - this.calculatedValues[i].doCalculation(this.calculatedValues, this.conditionValues, properties); - } - for (var i = 0; i < pages.length; i++) { - pages[i].runCondition(this.conditionValues, properties); - } - }; - SurveyModel.prototype.checkIfNewPagesBecomeVisible = function (oldCurrentPageIndex) { - var newCurrentPageIndex = this.pages.indexOf(this.currentPage); - if (newCurrentPageIndex <= oldCurrentPageIndex + 1) - return; - for (var i = oldCurrentPageIndex + 1; i < newCurrentPageIndex; i++) { - if (this.pages[i].isVisible) { - this.currentPage = this.pages[i]; - break; - } - } - }; - /** - * Sends a survey result to the [api.surveyjs.io](https://api.surveyjs.io) service. - * @param postId [api.surveyjs.io](https://api.surveyjs.io) service postId - * @param clientId Typically a customer e-mail or an identifier - * @param isPartialCompleted Set it to `true` if the survey is not completed yet and the results are intermediate - * @see surveyPostId - * @see clientId - */ - SurveyModel.prototype.sendResult = function (postId, clientId, isPartialCompleted) { - if (postId === void 0) { postId = null; } - if (clientId === void 0) { clientId = null; } - if (isPartialCompleted === void 0) { isPartialCompleted = false; } - if (!this.isEditMode) - return; - if (isPartialCompleted && this.onPartialSend) { - this.onPartialSend.fire(this, null); - } - if (!postId && this.surveyPostId) { - postId = this.surveyPostId; - } - if (!postId) - return; - if (clientId) { - this.clientId = clientId; - } - if (isPartialCompleted && !this.clientId) - return; - var self = this; - if (this.surveyShowDataSaving) { - this.setCompletedState("saving", ""); - } - this.createSurveyService().sendResult(postId, this.data, function (success, response, request) { - if (self.surveyShowDataSaving) { - if (success) { - self.setCompletedState("success", ""); - } - else { - self.setCompletedState("error", response); - } - } - self.onSendResult.fire(self, { - success: success, - response: response, - request: request, - }); - }, this.clientId, isPartialCompleted); - }; - /** - * Calls the [api.surveyjs.io](https://api.surveyjs.io) service and, on callback, fires the `onGetResult` event with all answers that your users made for a question. - * @param resultId [api.surveyjs.io](https://api.surveyjs.io) service resultId - * @param name The question name - * @see onGetResult - */ - SurveyModel.prototype.getResult = function (resultId, name) { - var self = this; - this.createSurveyService().getResult(resultId, name, function (success, data, dataList, response) { - self.onGetResult.fire(self, { - success: success, - data: data, - dataList: dataList, - response: response, - }); - }); - }; - /** - * Loads the survey JSON from the [api.surveyjs.io](https://api.surveyjs.io) service. - * If `clientId` is not `null` and a user had completed a survey before, the survey switches to `completedbefore` state. - * @param surveyId [api.surveyjs.io](https://api.surveyjs.io) service surveyId - * @param clientId users' indentifier, for example an e-mail or a unique customer id in your web application. - * @see state - * @see onLoadedSurveyFromService - */ - SurveyModel.prototype.loadSurveyFromService = function (surveyId, cliendId) { - if (surveyId === void 0) { surveyId = null; } - if (cliendId === void 0) { cliendId = null; } - if (surveyId) { - this.surveyId = surveyId; - } - if (cliendId) { - this.clientId = cliendId; - } - var self = this; - this.isLoading = true; - this.onLoadingSurveyFromService(); - if (cliendId) { - this.createSurveyService().getSurveyJsonAndIsCompleted(this.surveyId, this.clientId, function (success, json, isCompleted, response) { - self.isLoading = false; - if (success) { - self.isCompletedBefore = isCompleted == "completed"; - self.loadSurveyFromServiceJson(json); - } - }); - } - else { - this.createSurveyService().loadSurvey(this.surveyId, function (success, result, response) { - self.isLoading = false; - if (success) { - self.loadSurveyFromServiceJson(result); - } - }); - } - }; - SurveyModel.prototype.loadSurveyFromServiceJson = function (json) { - if (!json) - return; - this.fromJSON(json); - this.notifyAllQuestionsOnValueChanged(); - this.onLoadSurveyFromService(); - this.onLoadedSurveyFromService.fire(this, {}); - }; - SurveyModel.prototype.onLoadingSurveyFromService = function () { }; - SurveyModel.prototype.onLoadSurveyFromService = function () { }; - SurveyModel.prototype.resetVisibleIndexes = function () { - var questions = this.getAllQuestions(true); - for (var i = 0; i < questions.length; i++) { - questions[i].setVisibleIndex(-1); - } - this.updateVisibleIndexes(); - }; - SurveyModel.prototype.updateVisibleIndexes = function () { - if (this.isLoadingFromJson || !!this.isEndLoadingFromJson) - return; - if (this.isRunningConditions && - this.onVisibleChanged.isEmpty && - this.onPageVisibleChanged.isEmpty) { - //Run update visible index only one time on finishing running conditions - this.conditionUpdateVisibleIndexes = true; - return; - } - this.updatePageVisibleIndexes(this.showPageNumbers); - if (this.showQuestionNumbers == "onPage") { - var visPages = this.visiblePages; - for (var i = 0; i < visPages.length; i++) { - visPages[i].setVisibleIndex(0); - } - } - else { - var index = this.showQuestionNumbers == "on" ? 0 : -1; - for (var i = 0; i < this.pages.length; i++) { - index += this.pages[i].setVisibleIndex(index); - } - } - this.updateProgressText(true); - }; - SurveyModel.prototype.updatePageVisibleIndexes = function (showIndex) { - this.updateIsFirstLastPageState(); - var index = 0; - for (var i = 0; i < this.pages.length; i++) { - var isPageVisible = this.pages[i].isVisible; - this.pages[i].visibleIndex = isPageVisible ? index++ : -1; - this.pages[i].num = - showIndex && isPageVisible ? this.pages[i].visibleIndex + 1 : -1; - } - }; - SurveyModel.prototype.fromJSON = function (json) { - if (!json) - return; - this.questionHashesClear(); - this.jsonErrors = null; - var jsonConverter = new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"](); - jsonConverter.toObject(json, this); - if (jsonConverter.errors.length > 0) { - this.jsonErrors = jsonConverter.errors; - } - }; - SurveyModel.prototype.setJsonObject = function (jsonObj) { - this.fromJSON(jsonObj); - }; - SurveyModel.prototype.endLoadingFromJson = function () { - this.isEndLoadingFromJson = "processing"; - this.isStartedState = this.firstPageIsStarted; - this.onQuestionsOnPageModeChanged("standard"); - _super.prototype.endLoadingFromJson.call(this); - if (this.hasCookie) { - this.doComplete(); - } - this.doElementsOnLoad(); - this.isEndLoadingFromJson = "conditions"; - this.runConditions(); - this.notifyElementsOnAnyValueOrVariableChanged(""); - this.isEndLoadingFromJson = null; - this.updateVisibleIndexes(); - this.updateCurrentPage(); - }; - SurveyModel.prototype.onBeforeCreating = function () { }; - SurveyModel.prototype.onCreating = function () { }; - SurveyModel.prototype.getProcessedTextValue = function (textValue) { - this.getProcessedTextValueCore(textValue); - if (!this.onProcessTextValue.isEmpty) { - var wasEmpty = this.isValueEmpty(textValue.value); - this.onProcessTextValue.fire(this, textValue); - textValue.isExists = - textValue.isExists || (wasEmpty && !this.isValueEmpty(textValue.value)); - } - }; - SurveyModel.prototype.getProcessedTextValueCore = function (textValue) { - var name = textValue.name.toLocaleLowerCase(); - if (["no", "require", "title"].indexOf(name) !== -1) { - return; - } - if (name === "pageno") { - textValue.isExists = true; - var page = this.currentPage; - textValue.value = page != null ? this.visiblePages.indexOf(page) + 1 : 0; - return; - } - if (name === "pagecount") { - textValue.isExists = true; - textValue.value = this.visiblePageCount; - return; - } - if (name === "locale") { - textValue.isExists = true; - textValue.value = !!this.locale - ? this.locale - : _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].defaultLocale; - return; - } - if (name === "correctedanswers" || name === "correctedanswercount") { - textValue.isExists = true; - textValue.value = this.getCorrectedAnswerCount(); - return; - } - if (name === "incorrectedanswers" || name === "incorrectedanswercount") { - textValue.isExists = true; - textValue.value = this.getInCorrectedAnswerCount(); - return; - } - if (name === "questioncount") { - textValue.isExists = true; - textValue.value = this.getQuizQuestionCount(); - return; - } - var variable = this.getVariable(name); - if (variable !== undefined) { - textValue.isExists = true; - textValue.value = variable; - return; - } - var question = this.getFirstName(name); - if (question) { - textValue.isExists = true; - var firstName = question.getValueName().toLowerCase(); - name = firstName + name.substr(firstName.length); - name = name.toLocaleLowerCase(); - var values = {}; - values[firstName] = textValue.returnDisplayValue - ? question.getDisplayValue(false, undefined) - : question.value; - textValue.value = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__["ProcessValue"]().getValue(name, values); - return; - } - var value = this.getValue(textValue.name); - if (value !== undefined) { - textValue.isExists = true; - textValue.value = value; - } - }; - SurveyModel.prototype.getFirstName = function (name) { - name = name.toLowerCase(); - var question; - do { - question = this.getQuestionByValueName(name, true); - name = this.reduceFirstName(name); - } while (!question && !!name); - return question; - }; - SurveyModel.prototype.reduceFirstName = function (name) { - var pos1 = name.lastIndexOf("."); - var pos2 = name.lastIndexOf("["); - if (pos1 < 0 && pos2 < 0) - return ""; - var pos = Math.max(pos1, pos2); - return name.substr(0, pos); - }; - SurveyModel.prototype.clearUnusedValues = function () { - var questions = this.getAllQuestions(); - for (var i = 0; i < questions.length; i++) { - questions[i].clearUnusedValues(); - } - if (this.clearInvisibleValues != "none") { - this.clearInvisibleQuestionValues(); - } - }; - SurveyModel.prototype.hasVisibleQuestionByValueName = function (valueName) { - var questions = this.getQuestionsByValueName(valueName); - if (!questions) - return false; - for (var i = 0; i < questions.length; i++) { - if (questions[i].isVisible && questions[i].isParentVisible) - return true; - } - return false; - }; - SurveyModel.prototype.questionCountByValueName = function (valueName) { - var questions = this.getQuestionsByValueName(valueName); - return !!questions ? questions.length : 0; - }; - SurveyModel.prototype.clearInvisibleQuestionValues = function () { - var questions = this.getAllQuestions(); - for (var i = 0; i < questions.length; i++) { - questions[i].clearValueIfInvisible(); - } - }; - /** - * Returns a variable value. Variable, unlike values, are not stored in the survey results. - * @param name A variable name - * @see SetVariable - */ - SurveyModel.prototype.getVariable = function (name) { - if (!name) - return null; - name = name.toLowerCase(); - var res = this.variablesHash[name]; - if (!this.isValueEmpty(res)) - return res; - if (name.indexOf(".") > -1 || name.indexOf("[") > -1) { - if (new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__["ProcessValue"]().hasValue(name, this.variablesHash)) - return new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__["ProcessValue"]().getValue(name, this.variablesHash); - } - return res; - }; - /** - * Sets a variable value. Variable, unlike values, are not stored in the survey results. - * @param name A variable name - * @param newValue A variable new value - * @see GetVariable - */ - SurveyModel.prototype.setVariable = function (name, newValue) { - if (!name) - return; - name = name.toLowerCase(); - this.variablesHash[name] = newValue; - this.notifyElementsOnAnyValueOrVariableChanged(name); - this.runConditionOnValueChanged(name, newValue); - this.onVariableChanged.fire(this, { name: name, value: newValue }); - }; - /** - * Returns all variables in the survey. Use setVariable function to create a new variable. - * @see getVariable - * @see setVariable - */ - SurveyModel.prototype.getVariableNames = function () { - var res = []; - for (var key in this.variablesHash) { - res.push(key); - } - return res; - }; - //ISurvey data - SurveyModel.prototype.getUnbindValue = function (value) { - if (!!this.editingObj) - return value; - return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].getUnbindValue(value); - }; - /** - * Returns a question value (answer) by a question's name. - * @param name A question name - * @see data - * @see setValue - */ - SurveyModel.prototype.getValue = function (name) { - if (!name || name.length == 0) - return null; - var value = this.getDataValueCore(this.valuesHash, name); - return this.getUnbindValue(value); - }; - /** - * Sets a question value (answer). It runs all triggers and conditions (`visibleIf` properties). - * - * Goes to the next page if `goNextPageAutomatic` is `true` and all questions on the current page are answered correctly. - * @param name A question name - * @param newValue A new question value - * @see data - * @see getValue - * @see PageModel.visibleIf - * @see Question.visibleIf - * @see goNextPageAutomatic - */ - SurveyModel.prototype.setValue = function (name, newQuestionValue, locNotification, allowNotifyValueChanged) { - if (locNotification === void 0) { locNotification = false; } - if (allowNotifyValueChanged === void 0) { allowNotifyValueChanged = true; } - var newValue = newQuestionValue; - if (allowNotifyValueChanged) { - newValue = this.questionOnValueChanging(name, newQuestionValue); - } - if (this.isValidateOnValueChanging && - this.checkErrorsOnValueChanging(name, newValue)) - return; - if (!this.editingObj && - this.isValueEqual(name, newValue) && - this.isTwoValueEquals(newValue, newQuestionValue)) - return; - var oldValue = this.getValue(name); - if (this.isValueEmpty(newValue)) { - this.deleteDataValueCore(this.valuesHash, name); - } - else { - newValue = this.getUnbindValue(newValue); - this.setDataValueCore(this.valuesHash, name, newValue); - } - this.updateOnSetValue(name, newValue, oldValue, locNotification, allowNotifyValueChanged); - }; - SurveyModel.prototype.updateOnSetValue = function (name, newValue, oldValue, locNotification, allowNotifyValueChanged) { - if (locNotification === void 0) { locNotification = false; } - if (allowNotifyValueChanged === void 0) { allowNotifyValueChanged = true; } - this.updateQuestionValue(name, newValue); - if (locNotification === true || this.isDisposed) - return; - var triggerKeys = {}; - triggerKeys[name] = { newValue: newValue, oldValue: oldValue }; - this.runConditionOnValueChanged(name, newValue); - this.checkTriggers(triggerKeys, false); - if (allowNotifyValueChanged) - this.notifyQuestionOnValueChanged(name, newValue); - if (locNotification !== "text") { - this.tryGoNextPageAutomatic(name); - } - this.updateProgressText(true); - }; - SurveyModel.prototype.isValueEqual = function (name, newValue) { - if (newValue === "" || newValue === undefined) - newValue = null; - var oldValue = this.getValue(name); - if (oldValue === "" || oldValue === undefined) - oldValue = null; - if (newValue === null || oldValue === null) - return newValue === oldValue; - return this.isTwoValueEquals(newValue, oldValue); - }; - SurveyModel.prototype.doOnPageAdded = function (page) { - page.setSurveyImpl(this); - if (!page.name) - page.name = this.generateNewName(this.pages, "page"); - this.questionHashesPanelAdded(page); - this.updateVisibleIndexes(); - if (!this.isLoadingFromJson) { - this.updateProgressText(); - this.updateCurrentPage(); - } - var options = { page: page }; - this.onPageAdded.fire(this, options); - }; - SurveyModel.prototype.doOnPageRemoved = function (page) { - page.setSurveyImpl(null); - if (page === this.currentPage) { - this.updateCurrentPage(); - } - this.updateVisibleIndexes(); - this.updateProgressText(); - this.updateLazyRenderingRowsOnRemovingElements(); - }; - SurveyModel.prototype.generateNewName = function (elements, baseName) { - var keys = {}; - for (var i = 0; i < elements.length; i++) - keys[elements[i]["name"]] = true; - var index = 1; - while (keys[baseName + index]) - index++; - return baseName + index; - }; - SurveyModel.prototype.tryGoNextPageAutomatic = function (name) { - if (!!this.isEndLoadingFromJson || - !this.goNextPageAutomatic || - !this.currentPage) - return; - var question = this.getQuestionByValueName(name); - if (!question || - (!!question && - (!question.visible || !question.supportGoNextPageAutomatic()))) - return; - if (question.hasErrors(false) && !question.supportGoNextPageError()) - return; - var questions = this.getCurrentPageQuestions(); - if (questions.indexOf(question) < 0) - return; - for (var i = 0; i < questions.length; i++) { - if (questions[i].hasInput && questions[i].isEmpty()) - return; - } - if (!this.checkIsCurrentPageHasErrors(false)) { - if (!this.isLastPage) { - this.nextPage(); - } - else { - if (this.goNextPageAutomatic === true && - this.allowCompleteSurveyAutomatic) { - if (this.isShowPreviewBeforeComplete) { - this.showPreview(); - } - else { - this.completeLastPage(); - } - } - } - } - }; - /** - * Returns the comment value. - * @param name A comment's name. - * @see setComment - */ - SurveyModel.prototype.getComment = function (name) { - var res = this.getValue(name + this.commentPrefix); - return res || ""; - }; - /** - * Sets a comment value. - * @param name A comment name. - * @param newValue A new comment value. - * @see getComment - */ - SurveyModel.prototype.setComment = function (name, newValue, locNotification) { - if (locNotification === void 0) { locNotification = false; } - if (!newValue) - newValue = ""; - if (this.isTwoValueEquals(newValue, this.getComment(name))) - return; - var commentName = name + this.commentPrefix; - if (this.isValueEmpty(newValue)) { - this.deleteDataValueCore(this.valuesHash, commentName); - } - else { - this.setDataValueCore(this.valuesHash, commentName, newValue); - } - var questions = this.getQuestionsByValueName(name); - if (!!questions) { - for (var i = 0; i < questions.length; i++) { - questions[i].updateCommentFromSurvey(newValue); - this.checkQuestionErrorOnValueChanged(questions[i]); - } - } - if (locNotification !== "text") { - this.tryGoNextPageAutomatic(name); - } - var question = this.getQuestionByName(name); - if (question) { - this.onValueChanged.fire(this, { - name: commentName, - question: question, - value: newValue, - }); - } - }; - /** - * Removes a value from the survey results. - * @param {string} name The name of the value. Typically it is a question name. - */ - SurveyModel.prototype.clearValue = function (name) { - this.setValue(name, null); - this.setComment(name, null); - }; - Object.defineProperty(SurveyModel.prototype, "clearValueOnDisableItems", { - /** - * Gets or sets whether to clear value on disable items in checkbox, dropdown and radiogroup questions. - * By default, values are not cleared on disabled the corresponded items. This property is not persisted in survey JSON and you have to set it in code. - */ - get: function () { - return this.getPropertyValue("clearValueOnDisableItems", false); - }, - set: function (val) { - this.setPropertyValue("clearValueOnDisableItems", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isClearValueOnHidden", { - get: function () { - return (this.clearInvisibleValues == "onHidden" || - this.isClearValueOnHiddenContainer); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isClearValueOnHiddenContainer", { - get: function () { - return (this.clearInvisibleValues == "onHiddenContainer" && - !this.isShowingPreview && - !this.runningPages); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.questionVisibilityChanged = function (question, newValue) { - this.updateVisibleIndexes(); - this.onVisibleChanged.fire(this, { - question: question, - name: question.name, - visible: newValue, - }); - }; - SurveyModel.prototype.pageVisibilityChanged = function (page, newValue) { - if (this.isLoadingFromJson) - return; - if (newValue && !this.currentPage || page === this.currentPage) { - this.updateCurrentPage(); - } - this.updateVisibleIndexes(); - this.onPageVisibleChanged.fire(this, { - page: page, - visible: newValue, - }); - }; - SurveyModel.prototype.panelVisibilityChanged = function (panel, newValue) { - this.updateVisibleIndexes(); - this.onPanelVisibleChanged.fire(this, { - panel: panel, - visible: newValue, - }); - }; - SurveyModel.prototype.questionCreated = function (question) { - this.onQuestionCreated.fire(this, { question: question }); - }; - SurveyModel.prototype.questionAdded = function (question, index, parentPanel, rootPanel) { - if (!question.name) { - question.name = this.generateNewName(this.getAllQuestions(false, true), "question"); - } - if (!!question.page) { - this.questionHashesAdded(question); - } - if (!this.currentPage) { - this.updateCurrentPage(); - } - this.updateVisibleIndexes(); - this.onQuestionAdded.fire(this, { - question: question, - name: question.name, - index: index, - parentPanel: parentPanel, - rootPanel: rootPanel, - }); - }; - SurveyModel.prototype.questionRemoved = function (question) { - this.questionHashesRemoved(question, question.name, question.getValueName()); - this.updateVisibleIndexes(); - this.onQuestionRemoved.fire(this, { - question: question, - name: question.name, - }); - this.updateLazyRenderingRowsOnRemovingElements(); - }; - SurveyModel.prototype.questionRenamed = function (question, oldName, oldValueName) { - this.questionHashesRemoved(question, oldName, oldValueName); - this.questionHashesAdded(question); - }; - SurveyModel.prototype.questionHashesClear = function () { - this.questionHashes.names = {}; - this.questionHashes.namesInsensitive = {}; - this.questionHashes.valueNames = {}; - this.questionHashes.valueNamesInsensitive = {}; - }; - SurveyModel.prototype.questionHashesPanelAdded = function (panel) { - if (this.isLoadingFromJson) - return; - var questions = panel.questions; - for (var i = 0; i < questions.length; i++) { - this.questionHashesAdded(questions[i]); - } - }; - SurveyModel.prototype.questionHashesAdded = function (question) { - this.questionHashAddedCore(this.questionHashes.names, question, question.name); - this.questionHashAddedCore(this.questionHashes.namesInsensitive, question, question.name.toLowerCase()); - this.questionHashAddedCore(this.questionHashes.valueNames, question, question.getValueName()); - this.questionHashAddedCore(this.questionHashes.valueNamesInsensitive, question, question.getValueName().toLowerCase()); - }; - SurveyModel.prototype.questionHashesRemoved = function (question, name, valueName) { - if (!!name) { - this.questionHashRemovedCore(this.questionHashes.names, question, name); - this.questionHashRemovedCore(this.questionHashes.namesInsensitive, question, name.toLowerCase()); - } - if (!!valueName) { - this.questionHashRemovedCore(this.questionHashes.valueNames, question, valueName); - this.questionHashRemovedCore(this.questionHashes.valueNamesInsensitive, question, valueName.toLowerCase()); - } - }; - SurveyModel.prototype.questionHashAddedCore = function (hash, question, name) { - var res = hash[name]; - if (!!res) { - var res = hash[name]; - if (res.indexOf(question) < 0) { - res.push(question); - } - } - else { - hash[name] = [question]; - } - }; - SurveyModel.prototype.questionHashRemovedCore = function (hash, question, name) { - var res = hash[name]; - if (!res) - return; - var index = res.indexOf(question); - if (index > -1) { - res.splice(index, 1); - } - if (res.length == 0) { - delete hash[name]; - } - }; - SurveyModel.prototype.panelAdded = function (panel, index, parentPanel, rootPanel) { - if (!panel.name) { - panel.name = this.generateNewName(this.getAllPanels(false, true), "panel"); - } - this.questionHashesPanelAdded(panel); - this.updateVisibleIndexes(); - this.onPanelAdded.fire(this, { - panel: panel, - name: panel.name, - index: index, - parentPanel: parentPanel, - rootPanel: rootPanel, - }); - }; - SurveyModel.prototype.panelRemoved = function (panel) { - this.updateVisibleIndexes(); - this.onPanelRemoved.fire(this, { panel: panel, name: panel.name }); - this.updateLazyRenderingRowsOnRemovingElements(); - }; - SurveyModel.prototype.validateQuestion = function (question) { - if (this.onValidateQuestion.isEmpty) - return null; - var options = { - name: question.name, - question: question, - value: question.value, - error: null, - }; - this.onValidateQuestion.fire(this, options); - return options.error ? new _error__WEBPACK_IMPORTED_MODULE_9__["CustomError"](options.error, this) : null; - }; - SurveyModel.prototype.validatePanel = function (panel) { - if (this.onValidatePanel.isEmpty) - return null; - var options = { - name: panel.name, - panel: panel, - error: null, - }; - this.onValidatePanel.fire(this, options); - return options.error ? new _error__WEBPACK_IMPORTED_MODULE_9__["CustomError"](options.error, this) : null; - }; - SurveyModel.prototype.processHtml = function (html) { - var options = { html: html }; - this.onProcessHtml.fire(this, options); - return this.processText(options.html, true); - }; - SurveyModel.prototype.processText = function (text, returnDisplayValue) { - return this.processTextEx(text, returnDisplayValue, false).text; - }; - SurveyModel.prototype.processTextEx = function (text, returnDisplayValue, doEncoding) { - var res = { - text: this.processTextCore(text, returnDisplayValue, doEncoding), - hasAllValuesOnLastRun: true, - }; - res.hasAllValuesOnLastRun = this.textPreProcessor.hasAllValuesOnLastRun; - return res; - }; - SurveyModel.prototype.processTextCore = function (text, returnDisplayValue, doEncoding) { - if (doEncoding === void 0) { doEncoding = false; } - if (this.isDesignMode) - return text; - return this.textPreProcessor.process(text, returnDisplayValue, doEncoding); - }; - SurveyModel.prototype.getSurveyMarkdownHtml = function (element, text, name) { - var options = { - element: element, - text: text, - name: name, - html: null, - }; - this.onTextMarkdown.fire(this, options); - return options.html; - }; - /** - * Returns an amount of corrected quiz answers. - */ - SurveyModel.prototype.getCorrectedAnswerCount = function () { - return this.getCorrectedAnswerCountCore(true); - }; - /** - * Returns quiz question number. It may be different from `getQuizQuestions.length` because some widgets like matrix may have several questions. - * @see getQuizQuestions - */ - SurveyModel.prototype.getQuizQuestionCount = function () { - var questions = this.getQuizQuestions(); - var res = 0; - for (var i = 0; i < questions.length; i++) { - res += questions[i].quizQuestionCount; - } - return res; - }; - /** - * Returns an amount of incorrect quiz answers. - */ - SurveyModel.prototype.getInCorrectedAnswerCount = function () { - return this.getCorrectedAnswerCountCore(false); - }; - SurveyModel.prototype.getCorrectedAnswerCountCore = function (isCorrect) { - var questions = this.getQuizQuestions(); - var counter = 0; - var options = { - question: null, - result: false, - correctAnswers: 0, - incorrectAnswers: 0, - }; - for (var i = 0; i < questions.length; i++) { - var q = questions[i]; - var quizQuestionCount = q.quizQuestionCount; - options.question = q; - options.correctAnswers = q.correctAnswerCount; - options.incorrectAnswers = quizQuestionCount - options.correctAnswers; - options.result = options.question.isAnswerCorrect(); - this.onIsAnswerCorrect.fire(this, options); - if (isCorrect) { - if (options.result || options.correctAnswers < quizQuestionCount) { - var addCount = options.correctAnswers; - if (addCount == 0 && options.result) - addCount = 1; - counter += addCount; - } - } - else { - if (!options.result || options.incorrectAnswers < quizQuestionCount) { - counter += options.incorrectAnswers; - } - } - } - return counter; - }; - SurveyModel.prototype.getCorrectedAnswers = function () { - return this.getCorrectedAnswerCount(); - }; - SurveyModel.prototype.getInCorrectedAnswers = function () { - return this.getInCorrectedAnswerCount(); - }; - Object.defineProperty(SurveyModel.prototype, "showTimerPanel", { - /** - * Gets or sets a timer panel position. The timer panel displays information about how much time an end user spends on a survey/page. - * - * The available options: - * - `top` - display timer panel in the top. - * - `bottom` - display timer panel in the bottom. - * - `none` - do not display a timer panel. - * - * If the value is not equal to 'none', the survey calls the `startTimer()` method on survey rendering. - * @see showTimerPanelMode - * @see startTimer - * @see stopTimer - */ - get: function () { - return this.getPropertyValue("showTimerPanel"); - }, - set: function (val) { - this.setPropertyValue("showTimerPanel", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isTimerPanelShowingOnTop", { - get: function () { - return this.isTimerStarted && this.showTimerPanel == "top"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "isTimerPanelShowingOnBottom", { - get: function () { - return this.isTimerStarted && this.showTimerPanel == "bottom"; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "showTimerPanelMode", { - /** - * Gets or set a value that specifies whether the timer displays information for the page or for the entire survey. - * - * The available options: - * - * - `page` - show timer information for page - * - `survey` - show timer information for survey - * - * Use the `onTimerPanelInfoText` event to change the default text. - * @see showTimerPanel - * @see onTimerPanelInfoText - */ - get: function () { - return this.getPropertyValue("showTimerPanelMode"); - }, - set: function (val) { - this.setPropertyValue("showTimerPanelMode", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "widthMode", { - /** - * Gets or sets a value that specifies how the survey width is calculated. - * - * The available options: - * - * - `static` - A survey has a fixed width that mostly depends upon the applied theme. Resizing a browser window does not affect the survey width. - * - `responsive` - A survey takes all available horizontal space. A survey stretches or shrinks horizonally according to the screen size. - * - `auto` - Depends on the question type and corresponds to the static or responsive mode. - */ - // `custom/precise` - The survey width is specified by the width property. // in-future - get: function () { - return this.getPropertyValue("widthMode"); - }, - set: function (val) { - this.setPropertyValue("widthMode", val); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.calculateWidthMode = function () { - if (this.widthMode == "auto") { - var isResponsive_1 = false; - this.pages.forEach(function (page) { - if (page.needResponsiveWidth()) - isResponsive_1 = true; - }); - return isResponsive_1 ? "responsive" : "static"; - } - return this.widthMode; - }; - Object.defineProperty(SurveyModel.prototype, "timerInfoText", { - get: function () { - var options = { text: this.getTimerInfoText() }; - this.onTimerPanelInfoText.fire(this, options); - var loc = new _localizablestring__WEBPACK_IMPORTED_MODULE_10__["LocalizableString"](this, true); - loc.text = options.text; - return loc.textOrHtml; - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getTimerInfoText = function () { - var page = this.currentPage; - if (!page) - return ""; - var pageSpent = this.getDisplayTime(page.timeSpent); - var surveySpent = this.getDisplayTime(this.timeSpent); - var pageLimitSec = this.getPageMaxTimeToFinish(page); - var pageLimit = this.getDisplayTime(pageLimitSec); - var surveyLimit = this.getDisplayTime(this.maxTimeToFinish); - if (this.showTimerPanelMode == "page") - return this.getTimerInfoPageText(page, pageSpent, pageLimit); - if (this.showTimerPanelMode == "survey") - return this.getTimerInfoSurveyText(surveySpent, surveyLimit); - if (this.showTimerPanelMode == "all") { - if (pageLimitSec <= 0 && this.maxTimeToFinish <= 0) { - return this.getLocString("timerSpentAll")["format"](pageSpent, surveySpent); - } - if (pageLimitSec > 0 && this.maxTimeToFinish > 0) { - return this.getLocString("timerLimitAll")["format"](pageSpent, pageLimit, surveySpent, surveyLimit); - } - var pageText = this.getTimerInfoPageText(page, pageSpent, pageLimit); - var surveyText = this.getTimerInfoSurveyText(surveySpent, surveyLimit); - return pageText + " " + surveyText; - } - return ""; - }; - SurveyModel.prototype.getTimerInfoPageText = function (page, pageSpent, pageLimit) { - return this.getPageMaxTimeToFinish(page) > 0 - ? this.getLocString("timerLimitPage")["format"](pageSpent, pageLimit) - : this.getLocString("timerSpentPage")["format"](pageSpent, pageLimit); - }; - SurveyModel.prototype.getTimerInfoSurveyText = function (surveySpent, surveyLimit) { - return this.maxTimeToFinish > 0 - ? this.getLocString("timerLimitSurvey")["format"](surveySpent, surveyLimit) - : this.getLocString("timerSpentSurvey")["format"](surveySpent, surveyLimit); - }; - SurveyModel.prototype.getDisplayTime = function (val) { - var min = Math.floor(val / 60); - var sec = val % 60; - var res = ""; - if (min > 0) { - res += min + " " + this.getLocString("timerMin"); - } - if (res && sec == 0) - return res; - if (res) - res += " "; - return res + sec + " " + this.getLocString("timerSec"); - }; - /** - * Starts a timer that will calculate how much time end-user spends on the survey or on pages. - * @see stopTimer - * @see timeSpent - */ - SurveyModel.prototype.startTimer = function () { - if (this.isTimerStarted || this.isDesignMode) - return; - var self = this; - this.timerFunc = function () { - self.doTimer(); - }; - this.isTimerStarted = true; - _surveytimer__WEBPACK_IMPORTED_MODULE_12__["SurveyTimer"].instance.start(this.timerFunc); - }; - SurveyModel.prototype.startTimerFromUI = function () { - if (this.showTimerPanel != "none" && this.state === "running") { - this.startTimer(); - } - }; - /** - * Stops the timer. - * @see startTimer - * @see timeSpent - */ - SurveyModel.prototype.stopTimer = function () { - if (!this.isTimerStarted) - return; - this.isTimerStarted = false; - _surveytimer__WEBPACK_IMPORTED_MODULE_12__["SurveyTimer"].instance.stop(this.timerFunc); - }; - Object.defineProperty(SurveyModel.prototype, "maxTimeToFinish", { - /** - * Gets or sets the maximum time in seconds that end user has to complete a survey. If the value is 0 or less, an end user has no time limit to finish a survey. - * @see startTimer - * @see maxTimeToFinishPage - */ - get: function () { - return this.getPropertyValue("maxTimeToFinish", 0); - }, - set: function (val) { - this.setPropertyValue("maxTimeToFinish", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyModel.prototype, "maxTimeToFinishPage", { - /** - * Gets or sets the maximum time in seconds that end user has to complete a page in the survey. If the value is 0 or less, an end user has no time limit. - * - * You may override this value for every page. - * @see startTimer - * @see maxTimeToFinish - * @see PageModel.maxTimeToFinish - */ - get: function () { - return this.getPropertyValue("maxTimeToFinishPage", 0); - }, - set: function (val) { - this.setPropertyValue("maxTimeToFinishPage", val); - }, - enumerable: false, - configurable: true - }); - SurveyModel.prototype.getPageMaxTimeToFinish = function (page) { - if (!page || page.maxTimeToFinish < 0) - return 0; - return page.maxTimeToFinish > 0 - ? page.maxTimeToFinish - : this.maxTimeToFinishPage; - }; - SurveyModel.prototype.doTimer = function () { - var page = this.currentPage; - if (page) { - page.timeSpent = page.timeSpent + 1; - } - this.timeSpent = this.timeSpent + 1; - this.onTimer.fire(this, {}); - if (this.maxTimeToFinish > 0 && this.maxTimeToFinish == this.timeSpent) { - this.completeLastPage(); - } - if (page) { - var pageLimit = this.getPageMaxTimeToFinish(page); - if (pageLimit > 0 && pageLimit == page.timeSpent) { - if (this.isLastPage) { - this.completeLastPage(); - } - else { - this.nextPage(); - } - } - } - }; - Object.defineProperty(SurveyModel.prototype, "inSurvey", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - //ISurveyImplementor - SurveyModel.prototype.getSurveyData = function () { - return this; - }; - SurveyModel.prototype.getSurvey = function () { - return this; - }; - SurveyModel.prototype.getTextProcessor = function () { - return this; - }; - //ISurveyTriggerOwner - SurveyModel.prototype.getObjects = function (pages, questions) { - var result = []; - Array.prototype.push.apply(result, this.getPagesByNames(pages)); - Array.prototype.push.apply(result, this.getQuestionsByNames(questions)); - return result; - }; - SurveyModel.prototype.setTriggerValue = function (name, value, isVariable) { - if (!name) - return; - if (isVariable) { - this.setVariable(name, value); - } - else { - var question = this.getQuestionByName(name); - if (!!question) { - question.value = value; - } - else { - var processor = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__["ProcessValue"](); - var firstName = processor.getFirstName(name); - if (firstName == name) { - this.setValue(name, value); - } - else { - if (!this.getQuestionByName(firstName)) - return; - var data = this.getUnbindValue(this.getFilteredValues()); - processor.setValue(data, name, value); - this.setValue(firstName, data[firstName]); - } - } - } - }; - SurveyModel.prototype.copyTriggerValue = function (name, fromName) { - if (!name || !fromName) - return; - var processor = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__["ProcessValue"](); - var value = processor.getValue(fromName, this.getFilteredValues()); - this.setTriggerValue(name, value, false); - }; - /** - * Focus question by its name. If needed change the current page on the page where question is located. - * Function returns false if there is no question with this name or question is invisible, otherwise it returns true. - * @param name question name - */ - SurveyModel.prototype.focusQuestion = function (name) { - var question = this.getQuestionByName(name, true); - if (!question || !question.isVisible || !question.page) - return false; - this.isFocusingQuestion = true; - this.currentPage = question.page; - question.focus(); - this.isFocusingQuestion = false; - return true; - }; - SurveyModel.prototype.getElementWrapperComponentName = function (element, reason) { - if (reason === "logo-image") { - return "sv-logo-image"; - } - return SurveyModel.TemplateRendererComponentName; - }; - SurveyModel.prototype.getRowWrapperComponentName = function (row) { - return SurveyModel.TemplateRendererComponentName; - }; - SurveyModel.prototype.getElementWrapperComponentData = function (element, reason) { - return element; - }; - SurveyModel.prototype.getRowWrapperComponentData = function (row) { - return row; - }; - SurveyModel.prototype.getItemValueWrapperComponentName = function (item, question) { - return SurveyModel.TemplateRendererComponentName; - }; - SurveyModel.prototype.getItemValueWrapperComponentData = function (item, question) { - return item; - }; - SurveyModel.prototype.getMatrixCellTemplateData = function (cell) { - return cell.question; - }; - SurveyModel.prototype.searchText = function (text) { - if (!!text) - text = text.toLowerCase(); - var res = []; - for (var i = 0; i < this.pages.length; i++) { - this.pages[i].searchText(text, res); - } - return res; - }; - SurveyModel.prototype.getSkeletonComponentName = function (element) { - return this.skeletonComponentName; - }; - /** - * Use this method to dispose survey model properly. - */ - SurveyModel.prototype.dispose = function () { - this.currentPage = null; - _super.prototype.dispose.call(this); - this.editingObj = null; - if (!this.pages) - return; - for (var i = 0; i < this.pages.length; i++) { - this.pages[i].dispose(); - } - this.pages.splice(0, this.pages.length); - }; - SurveyModel.TemplateRendererComponentName = "sv-template-renderer"; - SurveyModel.stylesManager = null; - SurveyModel.platform = "unknown"; - return SurveyModel; - }(_survey_element__WEBPACK_IMPORTED_MODULE_2__["SurveyElementCore"])); - - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("survey", [ - { - name: "locale", - choices: function () { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].getLocales(true); - }, - onGetValue: function (obj) { - return obj.locale == _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].defaultLocale ? null : obj.locale; - }, - }, - { name: "title", serializationProperty: "locTitle", dependsOn: "locale" }, - { - name: "description:text", - serializationProperty: "locDescription", - dependsOn: "locale", - }, - { name: "logo", serializationProperty: "locLogo" }, - { name: "logoWidth", default: "300px", minValue: 0 }, - { name: "logoHeight", default: "200px", minValue: 0 }, - { - name: "logoFit", - default: "contain", - choices: ["none", "contain", "cover", "fill"], - }, - { - name: "logoPosition", - default: "left", - choices: ["none", "left", "right", "top", "bottom"], - }, - { name: "focusFirstQuestionAutomatic:boolean", default: true }, - { name: "focusOnFirstError:boolean", default: true }, - { name: "completedHtml:html", serializationProperty: "locCompletedHtml" }, - { - name: "completedBeforeHtml:html", - serializationProperty: "locCompletedBeforeHtml", - }, - { - name: "completedHtmlOnCondition:htmlconditions", - className: "htmlconditionitem", - }, - { name: "loadingHtml:html", serializationProperty: "locLoadingHtml" }, - { name: "pages:surveypages", className: "page" }, - { - name: "questions", - alternativeName: "elements", - baseClassName: "question", - visible: false, - isLightSerializable: false, - onGetValue: function (obj) { - return null; - }, - onSetValue: function (obj, value, jsonConverter) { - obj.pages.splice(0, obj.pages.length); - var page = obj.addNewPage(""); - jsonConverter.toObject({ questions: value }, page); - }, - }, - { - name: "triggers:triggers", - baseClassName: "surveytrigger", - classNamePart: "trigger", - }, - { - name: "calculatedValues:calculatedvalues", - className: "calculatedvalue", - }, - { name: "surveyId", visible: false }, - { name: "surveyPostId", visible: false }, - { name: "surveyShowDataSaving:boolean", visible: false }, - "cookieName", - "sendResultOnPageNext:boolean", - { - name: "showNavigationButtons", - default: "bottom", - choices: ["none", "top", "bottom", "both"], - }, - { name: "showPrevButton:boolean", default: true }, - { name: "showTitle:boolean", default: true }, - { name: "showPageTitles:boolean", default: true }, - { name: "showCompletedPage:boolean", default: true }, - "navigateToUrl", - { - name: "navigateToUrlOnCondition:urlconditions", - className: "urlconditionitem", - }, - { - name: "questionsOrder", - default: "initial", - choices: ["initial", "random"], - }, - "showPageNumbers:boolean", - { - name: "showQuestionNumbers", - default: "on", - choices: ["on", "onPage", "off"], - }, - { - name: "questionTitleLocation", - default: "top", - choices: ["top", "bottom", "left"], - }, - { - name: "questionDescriptionLocation", - default: "underTitle", - choices: ["underInput", "underTitle"], - }, - { name: "questionErrorLocation", default: "top", choices: ["top", "bottom"] }, - { - name: "showProgressBar", - default: "off", - choices: ["off", "top", "bottom", "both"], - }, - { - name: "progressBarType", - default: "pages", - choices: [ - "pages", - "questions", - "requiredQuestions", - "correctQuestions", - "buttons", - ], - }, - { name: "mode", default: "edit", choices: ["edit", "display"] }, - { name: "storeOthersAsComment:boolean", default: true }, - { name: "maxTextLength:number", default: 0, minValue: 0 }, - { name: "maxOthersLength:number", default: 0, minValue: 0 }, - "goNextPageAutomatic:boolean", - { - name: "clearInvisibleValues", - default: "onComplete", - choices: ["none", "onComplete", "onHidden", "onHiddenContainer"], - }, - { - name: "checkErrorsMode", - default: "onNextPage", - choices: ["onNextPage", "onValueChanged", "onValueChanging", "onComplete"], - }, - { - name: "textUpdateMode", - default: "onBlur", - choices: ["onBlur", "onTyping"], - }, - { name: "autoGrowComment:boolean", default: false }, - { name: "startSurveyText", serializationProperty: "locStartSurveyText" }, - { name: "pagePrevText", serializationProperty: "locPagePrevText" }, - { name: "pageNextText", serializationProperty: "locPageNextText" }, - { name: "completeText", serializationProperty: "locCompleteText" }, - { name: "previewText", serializationProperty: "locPreviewText" }, - { name: "editText", serializationProperty: "locEditText" }, - { name: "requiredText", default: "*" }, - { - name: "questionStartIndex", - dependsOn: ["showQuestionNumbers"], - visibleIf: function (survey) { - return !survey || survey.showQuestionNumbers !== "off"; - }, - }, - { - name: "questionTitlePattern", - default: "numTitleRequire", - dependsOn: ["questionStartIndex", "requiredText"], - choices: function (obj) { - if (!obj) - return []; - return obj.getQuestionTitlePatternOptions(); - }, - }, - { - name: "questionTitleTemplate", - visible: false, - isSerializable: false, - serializationProperty: "locQuestionTitleTemplate", - }, - { name: "firstPageIsStarted:boolean", default: false }, - { - name: "isSinglePage:boolean", - default: false, - visible: false, - isSerializable: false, - }, - { - name: "questionsOnPageMode", - default: "standard", - choices: ["singlePage", "standard", "questionPerPage"], - }, - { - name: "showPreviewBeforeComplete", - default: "noPreview", - choices: ["noPreview", "showAllQuestions", "showAnsweredQuestions"], - }, - { name: "maxTimeToFinish:number", default: 0, minValue: 0 }, - { name: "maxTimeToFinishPage:number", default: 0, minValue: 0 }, - { - name: "showTimerPanel", - default: "none", - choices: ["none", "top", "bottom"], - }, - { - name: "showTimerPanelMode", - default: "all", - choices: ["all", "page", "survey"], - }, - { - name: "widthMode", - default: "auto", - choices: ["auto", "static", "responsive"], - } - ]); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "increaseHeightByContent", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["increaseHeightByContent"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createSvg", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["createSvg"]; }); - /***/ }), + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CssClassBuilder", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["CssClassBuilder"]; }); - /***/ "./src/surveyProgress.ts": - /*!*******************************!*\ - !*** ./src/surveyProgress.ts ***! - \*******************************/ - /*! exports provided: SurveyProgressModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyProgressModel", function() { return SurveyProgressModel; }); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "surveyCss", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["surveyCss"]; }); - var SurveyProgressModel = /** @class */ (function () { - function SurveyProgressModel() { - } - SurveyProgressModel.getProgressTextInBarCss = function (css) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_0__["CssClassBuilder"]() - .append(css.progressText) - .append(css.progressTextInBar) - .toString(); - }; - SurveyProgressModel.getProgressTextUnderBarCss = function (css) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_0__["CssClassBuilder"]() - .append(css.progressText) - .append(css.progressTextUnderBar) - .toString(); - }; - return SurveyProgressModel; - }()); - - - - /***/ }), - - /***/ "./src/surveyProgressButtons.ts": - /*!**************************************!*\ - !*** ./src/surveyProgressButtons.ts ***! - \**************************************/ - /*! exports provided: SurveyProgressButtonsModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyProgressButtonsModel", function() { return SurveyProgressButtonsModel; }); - /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); - - var SurveyProgressButtonsModel = /** @class */ (function () { - function SurveyProgressButtonsModel(survey) { - this.survey = survey; - } - SurveyProgressButtonsModel.prototype.isListElementClickable = function (index) { - if (!this.survey.onServerValidateQuestions || - this.survey.onServerValidateQuestions.isEmpty || - this.survey.checkErrorsMode === "onComplete") { - return true; - } - return index <= this.survey.currentPageNo + 1; - }; - SurveyProgressButtonsModel.prototype.getListElementCss = function (index) { - if (index >= this.survey.visiblePages.length) - return; - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_0__["CssClassBuilder"]() - .append(this.survey.css.progressButtonsListElementPassed, this.survey.visiblePages[index].passed) - .append(this.survey.css.progressButtonsListElementCurrent, this.survey.currentPageNo === index) - .append(this.survey.css.progressButtonsListElementNonClickable, !this.isListElementClickable(index)) - .toString(); - }; - SurveyProgressButtonsModel.prototype.getScrollButtonCss = function (hasScroller, isLeftScroll) { - return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_0__["CssClassBuilder"]() - .append(this.survey.css.progressButtonsImageButtonLeft, isLeftScroll) - .append(this.survey.css.progressButtonsImageButtonRight, !isLeftScroll) - .append(this.survey.css.progressButtonsImageButtonHidden, !hasScroller) - .toString(); - }; - SurveyProgressButtonsModel.prototype.clickListElement = function (index) { - if (this.survey.isDesignMode) - return; - if (index < this.survey.currentPageNo) { - this.survey.currentPageNo = index; - } - else if (index > this.survey.currentPageNo) { - for (var i = this.survey.currentPageNo; i < index; i++) { - if (!this.survey.nextPage()) - break; - } - } - }; - return SurveyProgressButtonsModel; - }()); - - - - /***/ }), - - /***/ "./src/surveyStrings.ts": - /*!******************************!*\ - !*** ./src/surveyStrings.ts ***! - \******************************/ - /*! exports provided: surveyLocalization, surveyStrings */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "surveyLocalization", function() { return surveyLocalization; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "surveyStrings", function() { return surveyStrings; }); - /* harmony import */ var _localization_english__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./localization/english */ "./src/localization/english.ts"); - - var surveyLocalization = { - currentLocaleValue: "", - defaultLocaleValue: "en", - locales: {}, - localeNames: {}, - supportedLocales: [], - get currentLocale() { - return this.currentLocaleValue === this.defaultLocaleValue - ? "" - : this.currentLocaleValue; - }, - set currentLocale(val) { - if (val === "cz") - val = "cs"; - this.currentLocaleValue = val; - }, - get defaultLocale() { - return this.defaultLocaleValue; - }, - set defaultLocale(val) { - if (val === "cz") - val = "cs"; - this.defaultLocaleValue = val; - }, - getLocaleStrings: function (loc) { - return this.locales[loc]; - }, - getCurrentStrings: function () { - var loc = this.currentLocale - ? this.locales[this.currentLocale] - : this.locales[this.defaultLocale]; - if (!loc) - loc = this.locales[this.defaultLocale]; - return loc; - }, - getString: function (strName) { - var loc = this.getCurrentStrings(); - if (!loc[strName]) - loc = this.locales[this.defaultLocale]; - var result = loc[strName]; - if (result === undefined) { - result = this.locales["en"][strName]; - } - return result; - }, - getLocales: function (removeDefaultLoc) { - if (removeDefaultLoc === void 0) { removeDefaultLoc = false; } - var res = []; - res.push(""); - var locs = this.locales; - if (this.supportedLocales && this.supportedLocales.length > 0) { - locs = {}; - for (var i = 0; i < this.supportedLocales.length; i++) { - locs[this.supportedLocales[i]] = true; - } - } - for (var key in locs) { - if (removeDefaultLoc && key == this.defaultLocale) - continue; - res.push(key); - } - var locName = function (loc) { - if (!loc) - return ""; - var res = surveyLocalization.localeNames[loc]; - if (!res) - res = loc; - return res.toLowerCase(); - }; - res.sort(function (a, b) { - var str1 = locName(a); - var str2 = locName(b); - if (str1 === str2) - return 0; - return str1 < str2 ? -1 : 1; - }); - return res; - }, - }; - var surveyStrings = _localization_english__WEBPACK_IMPORTED_MODULE_0__["englishStrings"]; - surveyLocalization.locales["en"] = _localization_english__WEBPACK_IMPORTED_MODULE_0__["englishStrings"]; - surveyLocalization.localeNames["en"] = "english"; - - - /***/ }), - - /***/ "./src/surveyWindow.ts": - /*!*****************************!*\ - !*** ./src/surveyWindow.ts ***! - \*****************************/ - /*! exports provided: SurveyWindowModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyWindowModel", function() { return SurveyWindowModel; }); - /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); - /* harmony import */ var _survey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./survey */ "./src/survey.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DragDropSurveyElements", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["DragDropSurveyElements"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DragDropChoices", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["DragDropChoices"]; }); - /** - * A Model for a survey running in the Window. - */ - var SurveyWindowModel = /** @class */ (function (_super) { - __extends(SurveyWindowModel, _super); - function SurveyWindowModel(jsonObj, initialModel) { - if (initialModel === void 0) { initialModel = null; } - var _this = _super.call(this) || this; - /** - * Set this value to negative value, for example -1, to avoid closing the window on completing the survey. Leave it equals to 0 (default value) to close the window immediately, or set it to 3, 5, 10, ... to close the window in 3, 5, 10 seconds. - */ - _this.closeOnCompleteTimeout = 0; - if (initialModel) { - _this.surveyValue = initialModel; - } - else { - _this.surveyValue = _this.createSurvey(jsonObj); - } - _this.surveyValue.showTitle = false; - if ("undefined" !== typeof document) { - _this.windowElement = document.createElement("div"); - } - var self = _this; - _this.survey.onComplete.add(function (survey, options) { - self.onSurveyComplete(); - }); - return _this; - } - SurveyWindowModel.prototype.getType = function () { - return "window"; - }; - Object.defineProperty(SurveyWindowModel.prototype, "survey", { - /** - * A survey object. - * @see SurveyModel - */ - get: function () { - return this.surveyValue; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyWindowModel.prototype, "isShowing", { - /** - * Returns true if the window is currently showing. Set it to true to show the window and false to hide it. - * @see show - * @see hide - */ - get: function () { - return this.getPropertyValue("isShowing", false); - }, - set: function (val) { - if (this.isShowing == val) - return; - this.setPropertyValue("isShowing", val); - if (this.showingChangedCallback) - this.showingChangedCallback(); - }, - enumerable: false, - configurable: true - }); - /** - * Show the window - * @see hide - * @see isShowing - */ - SurveyWindowModel.prototype.show = function () { - this.isShowing = true; - }; - /** - * Hide the window - * @see show - * @see isShowing - */ - SurveyWindowModel.prototype.hide = function () { - this.isShowing = false; - }; - Object.defineProperty(SurveyWindowModel.prototype, "isExpanded", { - /** - * Returns true if the window is expanded. Set it to true to expand the window or false to collapse it. - * @see expand - * @see collapse - */ - get: function () { - return this.getPropertyValue("isExpanded", false); - }, - set: function (val) { - this.setPropertyValue("isExpanded", val); - if (!this.isLoadingFromJson && this.expandedChangedCallback) - this.expandedChangedCallback(); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyWindowModel.prototype, "title", { - /** - * The window and survey title. - */ - get: function () { - return this.survey.title; - }, - set: function (value) { - this.survey.title = value; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyWindowModel.prototype, "locTitle", { - get: function () { - return this.survey.locTitle; - }, - enumerable: false, - configurable: true - }); - /** - * Expand the window to show the survey. - */ - SurveyWindowModel.prototype.expand = function () { - this.expandcollapse(true); - }; - /** - * Collapse the window and show survey title only. - */ - SurveyWindowModel.prototype.collapse = function () { - this.expandcollapse(false); - }; - SurveyWindowModel.prototype.createSurvey = function (jsonObj) { - return new _survey__WEBPACK_IMPORTED_MODULE_1__["SurveyModel"](jsonObj); - }; - SurveyWindowModel.prototype.expandcollapse = function (value) { - this.isExpanded = value; - }; - SurveyWindowModel.prototype.onSurveyComplete = function () { - if (this.closeOnCompleteTimeout < 0) - return; - if (this.closeOnCompleteTimeout == 0) { - this.closeWindowOnComplete(); - } - else { - var self = this; - var timerId = null; - var func = function () { - self.closeWindowOnComplete(); - if (typeof window !== "undefined") { - window.clearInterval(timerId); - } - }; - timerId = - typeof window !== "undefined" - ? window.setInterval(func, this.closeOnCompleteTimeout * 1000) - : 0; - } - }; - SurveyWindowModel.prototype.closeWindowOnComplete = function () { - if (!!this.closeWindowOnCompleteCallback) { - this.closeWindowOnCompleteCallback(); - } - }; - SurveyWindowModel.surveyElementName = "windowSurveyJS"; - return SurveyWindowModel; - }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); - - - - /***/ }), - - /***/ "./src/surveytimer.ts": - /*!****************************!*\ - !*** ./src/surveytimer.ts ***! - \****************************/ - /*! exports provided: surveyTimerFunctions, SurveyTimer */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "surveyTimerFunctions", function() { return surveyTimerFunctions; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTimer", function() { return SurveyTimer; }); - /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); - - var surveyTimerFunctions = { - setTimeout: function (func) { - if (typeof window === "undefined") - return 0; - return window.setTimeout(func, 1000); - }, - clearTimeout: function (timerId) { - if (typeof window === "undefined") - return; - window.clearTimeout(timerId); - }, - }; - var SurveyTimer = /** @class */ (function () { - function SurveyTimer() { - this.listenerCounter = 0; - this.timerId = -1; - this.onTimer = new _base__WEBPACK_IMPORTED_MODULE_0__["Event"](); - } - Object.defineProperty(SurveyTimer, "instance", { - get: function () { - if (!SurveyTimer.instanceValue) { - SurveyTimer.instanceValue = new SurveyTimer(); - } - return SurveyTimer.instanceValue; - }, - enumerable: false, - configurable: true - }); - SurveyTimer.prototype.start = function (func) { - var _this = this; - if (func === void 0) { func = null; } - if (func) { - this.onTimer.add(func); - } - if (this.timerId < 0) { - this.timerId = surveyTimerFunctions.setTimeout(function () { - _this.doTimer(); - }); - } - this.listenerCounter++; - }; - SurveyTimer.prototype.stop = function (func) { - if (func === void 0) { func = null; } - if (func) { - this.onTimer.remove(func); - } - this.listenerCounter--; - if (this.listenerCounter == 0 && this.timerId > -1) { - surveyTimerFunctions.clearTimeout(this.timerId); - this.timerId = -1; - } - }; - SurveyTimer.prototype.doTimer = function () { - var _this = this; - if (this.onTimer.isEmpty || this.listenerCounter == 0) { - this.timerId = -1; - } - if (this.timerId < 0) - return; - var prevItem = this.timerId; - this.onTimer.fire(this, {}); - //We have to check that we have the same timerId - //It could be changed during events execution and it will lead to double timer events - if (prevItem !== this.timerId) - return; - this.timerId = surveyTimerFunctions.setTimeout(function () { - _this.doTimer(); - }); - }; - SurveyTimer.instanceValue = null; - return SurveyTimer; - }()); - - - - /***/ }), - - /***/ "./src/svgbundle.ts": - /*!**************************!*\ - !*** ./src/svgbundle.ts ***! - \**************************/ - /*! exports provided: SvgBundleViewModel */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SvgBundleViewModel", function() { return SvgBundleViewModel; }); - var SvgBundleViewModel; - if (!!global.document) { - var svgTemplate = __webpack_require__(/*! html-loader?interpolate!val-loader!./svgbundle.html */ "./node_modules/html-loader/index.js?interpolate!./node_modules/val-loader/index.js!./src/svgbundle.html"); - var templateHolder = document.createElement("div"); - templateHolder.style.display = "none"; - templateHolder.innerHTML = svgTemplate; - document.head.appendChild(templateHolder); - } + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultStandardCss", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["defaultStandardCss"]; }); - /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultBootstrapCss", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["defaultBootstrapCss"]; }); - /***/ }), + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultBootstrapMaterialCss", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["defaultBootstrapMaterialCss"]; }); - /***/ "./src/template-renderer.ts": - /*!**********************************!*\ - !*** ./src/template-renderer.ts ***! - \**********************************/ - /*! no exports provided */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultV2Css", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["defaultV2Css"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "modernCss", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["modernCss"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SvgIconRegistry", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["SvgIconRegistry"]; }); - /***/ }), + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SvgRegistry", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["SvgRegistry"]; }); - /***/ "./src/textPreProcessor.ts": - /*!*********************************!*\ - !*** ./src/textPreProcessor.ts ***! - \*********************************/ - /*! exports provided: TextPreProcessorItem, TextPreProcessorValue, TextPreProcessor, QuestionTextProcessor */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextPreProcessorItem", function() { return TextPreProcessorItem; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextPreProcessorValue", function() { return TextPreProcessorValue; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextPreProcessor", function() { return TextPreProcessor; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionTextProcessor", function() { return QuestionTextProcessor; }); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - /* harmony import */ var _conditionProcessValue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./conditionProcessValue */ "./src/conditionProcessValue.ts"); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SvgBundleViewModel", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["SvgBundleViewModel"]; }); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RendererFactory", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["RendererFactory"]; }); - var TextPreProcessorItem = /** @class */ (function () { - function TextPreProcessorItem() { - } - return TextPreProcessorItem; - }()); - - var TextPreProcessorValue = /** @class */ (function () { - function TextPreProcessorValue(name, returnDisplayValue) { - this.name = name; - this.returnDisplayValue = returnDisplayValue; - this.isExists = false; - this.canProcess = true; - } - return TextPreProcessorValue; - }()); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ResponsivityManager", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["ResponsivityManager"]; }); - var TextPreProcessor = /** @class */ (function () { - function TextPreProcessor() { - this._unObservableValues = [undefined]; - } - Object.defineProperty(TextPreProcessor.prototype, "hasAllValuesOnLastRunValue", { - get: function () { - return this._unObservableValues[0]; - }, - set: function (val) { - this._unObservableValues[0] = val; - }, - enumerable: false, - configurable: true - }); - TextPreProcessor.prototype.process = function (text, returnDisplayValue, doEncoding) { - if (returnDisplayValue === void 0) { returnDisplayValue = false; } - if (doEncoding === void 0) { doEncoding = false; } - this.hasAllValuesOnLastRunValue = true; - if (!text) - return text; - if (!this.onProcess) - return text; - var items = this.getItems(text); - for (var i = items.length - 1; i >= 0; i--) { - var item = items[i]; - var name = this.getName(text.substring(item.start + 1, item.end)); - if (!name) - continue; - var textValue = new TextPreProcessorValue(name, returnDisplayValue); - this.onProcess(textValue); - if (!textValue.isExists) { - if (textValue.canProcess) { - this.hasAllValuesOnLastRunValue = false; - } - continue; - } - if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(textValue.value)) { - this.hasAllValuesOnLastRunValue = false; - } - var replacedValue = !_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(textValue.value) - ? textValue.value - : ""; - if (doEncoding) { - replacedValue = encodeURIComponent(replacedValue); - } - text = - text.substr(0, item.start) + replacedValue + text.substr(item.end + 1); - } - return text; - }; - TextPreProcessor.prototype.processValue = function (name, returnDisplayValue) { - var textValue = new TextPreProcessorValue(name, returnDisplayValue); - if (!!this.onProcess) { - this.onProcess(textValue); - } - return textValue; - }; - Object.defineProperty(TextPreProcessor.prototype, "hasAllValuesOnLastRun", { - get: function () { - return !!this.hasAllValuesOnLastRunValue; - }, - enumerable: false, - configurable: true - }); - TextPreProcessor.prototype.getItems = function (text) { - var items = []; - var length = text.length; - var start = -1; - var ch = ""; - for (var i = 0; i < length; i++) { - ch = text[i]; - if (ch == "{") - start = i; - if (ch == "}") { - if (start > -1) { - var item = new TextPreProcessorItem(); - item.start = start; - item.end = i; - items.push(item); - } - start = -1; - } - } - return items; - }; - TextPreProcessor.prototype.getName = function (name) { - if (!name) - return; - return name.trim(); - }; - return TextPreProcessor; - }()); - - var QuestionTextProcessor = /** @class */ (function () { - function QuestionTextProcessor(variableName) { - var _this = this; - this.variableName = variableName; - this.textPreProcessor = new TextPreProcessor(); - this.textPreProcessor.onProcess = function (textValue) { - _this.getProcessedTextValue(textValue); - }; - } - QuestionTextProcessor.prototype.processValue = function (name, returnDisplayValue) { - return this.textPreProcessor.processValue(name, returnDisplayValue); - }; - Object.defineProperty(QuestionTextProcessor.prototype, "survey", { - get: function () { - return null; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(QuestionTextProcessor.prototype, "panel", { - get: function () { - return null; - }, - enumerable: false, - configurable: true - }); - QuestionTextProcessor.prototype.getValues = function () { - return !!this.panel ? this.panel.getValue() : null; - }; - QuestionTextProcessor.prototype.getQuestionByName = function (name) { - return !!this.panel - ? this.panel.getQuestionByValueName(name) - : null; - }; - QuestionTextProcessor.prototype.onCustomProcessText = function (textValue) { - return false; - }; - //ITextProcessor - QuestionTextProcessor.prototype.getProcessedTextValue = function (textValue) { - if (!textValue) - return; - if (this.onCustomProcessText(textValue)) - return; - var firstName = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_1__["ProcessValue"]().getFirstName(textValue.name); - textValue.isExists = firstName == this.variableName; - textValue.canProcess = textValue.isExists; - if (!textValue.canProcess) - return; - //name should start with the variable name - textValue.name = textValue.name.replace(this.variableName + ".", ""); - var firstName = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_1__["ProcessValue"]().getFirstName(textValue.name); - var question = this.getQuestionByName(firstName); - var values = {}; - if (question) { - values[firstName] = textValue.returnDisplayValue - ? question.displayValue - : question.value; - } - else { - var allValues = !!this.panel ? this.getValues() : null; - if (allValues) { - values[firstName] = allValues[firstName]; - } - } - textValue.value = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_1__["ProcessValue"]().getValue(textValue.name, values); - }; - QuestionTextProcessor.prototype.processText = function (text, returnDisplayValue) { - text = this.textPreProcessor.process(text, returnDisplayValue); - var survey = this.survey; - return survey ? survey.processText(text, returnDisplayValue) : text; - }; - QuestionTextProcessor.prototype.processTextEx = function (text, returnDisplayValue) { - text = this.processText(text, returnDisplayValue); - var hasAllValuesOnLastRun = this.textPreProcessor.hasAllValuesOnLastRun; - var res = { hasAllValuesOnLastRun: true, text: text }; - if (this.survey) { - res = this.survey.processTextEx(text, returnDisplayValue, false); - } - res.hasAllValuesOnLastRun = - res.hasAllValuesOnLastRun && hasAllValuesOnLastRun; - return res; - }; - return QuestionTextProcessor; - }()); - - - - /***/ }), - - /***/ "./src/trigger.ts": - /*!************************!*\ - !*** ./src/trigger.ts ***! - \************************/ - /*! exports provided: Trigger, SurveyTrigger, SurveyTriggerVisible, SurveyTriggerComplete, SurveyTriggerSetValue, SurveyTriggerSkip, SurveyTriggerRunExpression, SurveyTriggerCopyValue */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Trigger", function() { return Trigger; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTrigger", function() { return SurveyTrigger; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTriggerVisible", function() { return SurveyTriggerVisible; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTriggerComplete", function() { return SurveyTriggerComplete; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTriggerSetValue", function() { return SurveyTriggerSetValue; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTriggerSkip", function() { return SurveyTriggerSkip; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTriggerRunExpression", function() { return SurveyTriggerRunExpression; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTriggerCopyValue", function() { return SurveyTriggerCopyValue; }); - /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); - /* harmony import */ var _expressions_expressions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./expressions/expressions */ "./src/expressions/expressions.ts"); - /* harmony import */ var _conditionProcessValue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./conditionProcessValue */ "./src/conditionProcessValue.ts"); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VerticalResponsivityManager", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["VerticalResponsivityManager"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "unwrap", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["unwrap"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Action", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["Action"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ActionDropdownViewModel", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["ActionDropdownViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AdaptiveActionContainer", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["AdaptiveActionContainer"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultActionBarCss", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["defaultActionBarCss"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ActionContainer", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["ActionContainer"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TooltipManager", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["TooltipManager"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DragOrClickHelper", function() { return _core__WEBPACK_IMPORTED_MODULE_0__["DragOrClickHelper"]; }); + + /* harmony import */ __webpack_require__(/*! ./chunks/localization */ "./src/entries/chunks/localization.ts"); + /* harmony import */ var _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./knockout-ui-model */ "./src/entries/knockout-ui-model.ts"); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Survey", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["Survey"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyWindow", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["SurveyWindow"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ImplementorBase", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["ImplementorBase"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionRow", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionRow"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Page", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["Page"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Panel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["Panel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FlowPanel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["FlowPanel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionImplementor", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionImplementor"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionSelectBaseImplementor", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionSelectBaseImplementor"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionCheckboxBaseImplementor", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionCheckboxBaseImplementor"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionCheckbox", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionCheckbox"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionRanking", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionRanking"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionComment", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionComment"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionDropdown", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionDropdown"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionFile", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionFile"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionHtml", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionHtml"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrix", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionMatrix"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDropdown", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionMatrixDropdown"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDynamicImplementor", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionMatrixDynamicImplementor"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDynamic", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionMatrixDynamic"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionPanelDynamic", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionPanelDynamic"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MultipleTextItem", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["MultipleTextItem"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionMultipleText", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionMultipleText"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionRadiogroup", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionRadiogroup"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionRating", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionRating"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionRatingImplementor", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionRatingImplementor"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionText", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionText"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionBoolean", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionBoolean"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionEmpty", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionEmpty"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionExpression", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionExpression"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionImagePicker", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionImagePicker"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyWindowImplementor", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["SurveyWindowImplementor"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyTemplateText", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["SurveyTemplateText"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionImage", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionImage"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionSignaturePad", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionSignaturePad"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionCustom", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionCustom"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QuestionButtonGroup", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["QuestionButtonGroup"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ActionBarItemViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["ActionBarItemViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ActionBarItemDropdownViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["ActionBarItemDropdownViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ActionBarSeparatorViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["ActionBarSeparatorViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ActionContainerImplementor", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["ActionContainerImplementor"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CheckboxViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["CheckboxViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BooleanRadioItemViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["BooleanRadioItemViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BooleanRadioViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["BooleanRadioViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PanelViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["PanelViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PopupViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["PopupViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "showModal", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["showModal"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ProgressButtonsViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["ProgressButtonsViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ProgressViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["ProgressViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TitleElementViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["TitleElementViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TitleContentViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["TitleContentViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TitleActionViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["TitleActionViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StringEditorViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["StringEditorViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StringViewerViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["StringViewerViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LogoImageViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["LogoImageViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Skeleton", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["Skeleton"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RatingDropdownViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["RatingDropdownViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DropdownViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["DropdownViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DropdownSelectViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["DropdownSelectViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ListItemViewComponent", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["ListItemViewComponent"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ListViewComponent", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["ListViewComponent"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SvgIconViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["SvgIconViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrixDynamicRemoveButton", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["SurveyQuestionMatrixDynamicRemoveButton"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrixDetailButton", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["SurveyQuestionMatrixDetailButton"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrixDynamicDragDropIcon", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["SurveyQuestionMatrixDynamicDragDropIcon"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ButtonGroupItemViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["ButtonGroupItemViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TooltipErrorViewModel", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["TooltipErrorViewModel"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyNavigationButton", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["SurveyNavigationButton"]; }); + + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionPaneldynamicActioons", function() { return _knockout_ui_model__WEBPACK_IMPORTED_MODULE_2__["SurveyQuestionPaneldynamicActioons"]; }); + + + // localization + + + + + /***/ }), + + /***/ "./src/error.ts": + /*!**********************!*\ + !*** ./src/error.ts ***! + \**********************/ + /*! exports provided: AnswerRequiredError, OneAnswerRequiredError, RequreNumericError, ExceedSizeError, WebRequestError, WebRequestEmptyError, OtherEmptyError, UploadingFileError, RequiredInAllRowsError, MinRowCountError, KeyDuplicationError, CustomError */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnswerRequiredError", function() { return AnswerRequiredError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OneAnswerRequiredError", function() { return OneAnswerRequiredError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RequreNumericError", function() { return RequreNumericError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExceedSizeError", function() { return ExceedSizeError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebRequestError", function() { return WebRequestError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebRequestEmptyError", function() { return WebRequestEmptyError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OtherEmptyError", function() { return OtherEmptyError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UploadingFileError", function() { return UploadingFileError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RequiredInAllRowsError", function() { return RequiredInAllRowsError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MinRowCountError", function() { return MinRowCountError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyDuplicationError", function() { return KeyDuplicationError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CustomError", function() { return CustomError; }); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _survey_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./survey-error */ "./src/survey-error.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + var AnswerRequiredError = /** @class */ (function (_super) { + __extends(AnswerRequiredError, _super); + function AnswerRequiredError(text, errorOwner) { + if (text === void 0) { text = null; } + if (errorOwner === void 0) { errorOwner = null; } + var _this = _super.call(this, text, errorOwner) || this; + _this.text = text; + return _this; + } + AnswerRequiredError.prototype.getErrorType = function () { + return "required"; + }; + AnswerRequiredError.prototype.getDefaultText = function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("requiredError"); + }; + return AnswerRequiredError; + }(_survey_error__WEBPACK_IMPORTED_MODULE_1__["SurveyError"])); + + var OneAnswerRequiredError = /** @class */ (function (_super) { + __extends(OneAnswerRequiredError, _super); + function OneAnswerRequiredError(text, errorOwner) { + if (text === void 0) { text = null; } + if (errorOwner === void 0) { errorOwner = null; } + var _this = _super.call(this, text, errorOwner) || this; + _this.text = text; + return _this; + } + OneAnswerRequiredError.prototype.getErrorType = function () { + return "requireoneanswer"; + }; + OneAnswerRequiredError.prototype.getDefaultText = function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("requiredErrorInPanel"); + }; + return OneAnswerRequiredError; + }(_survey_error__WEBPACK_IMPORTED_MODULE_1__["SurveyError"])); + + var RequreNumericError = /** @class */ (function (_super) { + __extends(RequreNumericError, _super); + function RequreNumericError(text, errorOwner) { + if (text === void 0) { text = null; } + if (errorOwner === void 0) { errorOwner = null; } + var _this = _super.call(this, text, errorOwner) || this; + _this.text = text; + return _this; + } + RequreNumericError.prototype.getErrorType = function () { + return "requirenumeric"; + }; + RequreNumericError.prototype.getDefaultText = function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("numericError"); + }; + return RequreNumericError; + }(_survey_error__WEBPACK_IMPORTED_MODULE_1__["SurveyError"])); + + var ExceedSizeError = /** @class */ (function (_super) { + __extends(ExceedSizeError, _super); + function ExceedSizeError(maxSize, errorOwner) { + if (errorOwner === void 0) { errorOwner = null; } + var _this = _super.call(this, null, errorOwner) || this; + _this.maxSize = maxSize; + _this.locText.text = _this.getText(); + return _this; + } + ExceedSizeError.prototype.getErrorType = function () { + return "exceedsize"; + }; + ExceedSizeError.prototype.getDefaultText = function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"] + .getString("exceedMaxSize")["format"](this.getTextSize()); + }; + ExceedSizeError.prototype.getTextSize = function () { + var sizes = ["Bytes", "KB", "MB", "GB", "TB"]; + var fixed = [0, 0, 2, 3, 3]; + if (this.maxSize === 0) { + return "0 Byte"; + } + var i = Math.floor(Math.log(this.maxSize) / Math.log(1024)); + var value = this.maxSize / Math.pow(1024, i); + return value.toFixed(fixed[i]) + " " + sizes[i]; + }; + return ExceedSizeError; + }(_survey_error__WEBPACK_IMPORTED_MODULE_1__["SurveyError"])); + + var WebRequestError = /** @class */ (function (_super) { + __extends(WebRequestError, _super); + function WebRequestError(status, response, errorOwner) { + if (errorOwner === void 0) { errorOwner = null; } + var _this = _super.call(this, null, errorOwner) || this; + _this.status = status; + _this.response = response; + return _this; + } + WebRequestError.prototype.getErrorType = function () { + return "webrequest"; + }; + WebRequestError.prototype.getDefaultText = function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"] + .getString("urlRequestError")["format"](this.status, this.response); + }; + return WebRequestError; + }(_survey_error__WEBPACK_IMPORTED_MODULE_1__["SurveyError"])); + + var WebRequestEmptyError = /** @class */ (function (_super) { + __extends(WebRequestEmptyError, _super); + function WebRequestEmptyError(text, errorOwner) { + if (errorOwner === void 0) { errorOwner = null; } + var _this = _super.call(this, text, errorOwner) || this; + _this.text = text; + return _this; + } + WebRequestEmptyError.prototype.getErrorType = function () { + return "webrequestempty"; + }; + WebRequestEmptyError.prototype.getDefaultText = function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("urlGetChoicesError"); + }; + return WebRequestEmptyError; + }(_survey_error__WEBPACK_IMPORTED_MODULE_1__["SurveyError"])); + + var OtherEmptyError = /** @class */ (function (_super) { + __extends(OtherEmptyError, _super); + function OtherEmptyError(text, errorOwner) { + if (errorOwner === void 0) { errorOwner = null; } + var _this = _super.call(this, text, errorOwner) || this; + _this.text = text; + return _this; + } + OtherEmptyError.prototype.getErrorType = function () { + return "otherempty"; + }; + OtherEmptyError.prototype.getDefaultText = function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("otherRequiredError"); + }; + return OtherEmptyError; + }(_survey_error__WEBPACK_IMPORTED_MODULE_1__["SurveyError"])); + + var UploadingFileError = /** @class */ (function (_super) { + __extends(UploadingFileError, _super); + function UploadingFileError(text, errorOwner) { + if (errorOwner === void 0) { errorOwner = null; } + var _this = _super.call(this, text, errorOwner) || this; + _this.text = text; + return _this; + } + UploadingFileError.prototype.getErrorType = function () { + return "uploadingfile"; + }; + UploadingFileError.prototype.getDefaultText = function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("uploadingFile"); + }; + return UploadingFileError; + }(_survey_error__WEBPACK_IMPORTED_MODULE_1__["SurveyError"])); + + var RequiredInAllRowsError = /** @class */ (function (_super) { + __extends(RequiredInAllRowsError, _super); + function RequiredInAllRowsError(text, errorOwner) { + if (errorOwner === void 0) { errorOwner = null; } + var _this = _super.call(this, text, errorOwner) || this; + _this.text = text; + return _this; + } + RequiredInAllRowsError.prototype.getErrorType = function () { + return "requiredinallrowserror"; + }; + RequiredInAllRowsError.prototype.getDefaultText = function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("requiredInAllRowsError"); + }; + return RequiredInAllRowsError; + }(_survey_error__WEBPACK_IMPORTED_MODULE_1__["SurveyError"])); + + var MinRowCountError = /** @class */ (function (_super) { + __extends(MinRowCountError, _super); + function MinRowCountError(minRowCount, errorOwner) { + if (errorOwner === void 0) { errorOwner = null; } + var _this = _super.call(this, null, errorOwner) || this; + _this.minRowCount = minRowCount; + return _this; + } + MinRowCountError.prototype.getErrorType = function () { + return "minrowcounterror"; + }; + MinRowCountError.prototype.getDefaultText = function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"] + .getString("minRowCountError")["format"](this.minRowCount); + }; + return MinRowCountError; + }(_survey_error__WEBPACK_IMPORTED_MODULE_1__["SurveyError"])); + + var KeyDuplicationError = /** @class */ (function (_super) { + __extends(KeyDuplicationError, _super); + function KeyDuplicationError(text, errorOwner) { + if (errorOwner === void 0) { errorOwner = null; } + var _this = _super.call(this, text, errorOwner) || this; + _this.text = text; + return _this; + } + KeyDuplicationError.prototype.getErrorType = function () { + return "keyduplicationerror"; + }; + KeyDuplicationError.prototype.getDefaultText = function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("keyDuplicationError"); + }; + return KeyDuplicationError; + }(_survey_error__WEBPACK_IMPORTED_MODULE_1__["SurveyError"])); + + var CustomError = /** @class */ (function (_super) { + __extends(CustomError, _super); + function CustomError(text, errorOwner) { + if (errorOwner === void 0) { errorOwner = null; } + var _this = _super.call(this, text, errorOwner) || this; + _this.text = text; + return _this; + } + CustomError.prototype.getErrorType = function () { + return "custom"; + }; + return CustomError; + }(_survey_error__WEBPACK_IMPORTED_MODULE_1__["SurveyError"])); + + + + /***/ }), + + /***/ "./src/expressionItems.ts": + /*!********************************!*\ + !*** ./src/expressionItems.ts ***! + \********************************/ + /*! exports provided: ExpressionItem, HtmlConditionItem, UrlConditionItem */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionItem", function() { return ExpressionItem; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HtmlConditionItem", function() { return HtmlConditionItem; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlConditionItem", function() { return UrlConditionItem; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + /** + * Base class for HtmlConditionItem and UrlConditionItem classes. + */ + var ExpressionItem = /** @class */ (function (_super) { + __extends(ExpressionItem, _super); + function ExpressionItem(expression) { + if (expression === void 0) { expression = null; } + var _this = _super.call(this) || this; + _this.createLocalizableString("html", _this); + _this.expression = expression; + return _this; + } + ExpressionItem.prototype.getType = function () { + return "expressionitem"; + }; + ExpressionItem.prototype.runCondition = function (values, properties) { + if (!this.expression) + return false; + return new _conditions__WEBPACK_IMPORTED_MODULE_2__["ConditionRunner"](this.expression).run(values, properties); + }; + Object.defineProperty(ExpressionItem.prototype, "expression", { + /** + * The expression property. If this expression returns true, then survey will use html property to show on complete page. + */ + get: function () { + return this.getPropertyValue("expression", ""); + }, + set: function (val) { + this.setPropertyValue("expression", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ExpressionItem.prototype, "locHtml", { + get: function () { + return this.getLocalizableString("html"); + }, + enumerable: false, + configurable: true + }); + ExpressionItem.prototype.getLocale = function () { + return !!this.locOwner ? this.locOwner.getLocale() : ""; + }; + ExpressionItem.prototype.getMarkdownHtml = function (text, name) { + return !!this.locOwner ? this.locOwner.getMarkdownHtml(text, name) : null; + }; + ExpressionItem.prototype.getRenderer = function (name) { + return !!this.locOwner ? this.locOwner.getRenderer(name) : null; + }; + ExpressionItem.prototype.getRendererContext = function (locStr) { + return !!this.locOwner ? this.locOwner.getRendererContext(locStr) : locStr; + }; + ExpressionItem.prototype.getProcessedText = function (text) { + return this.locOwner ? this.locOwner.getProcessedText(text) : text; + }; + ExpressionItem.prototype.getSurvey = function (isLive) { + return this.locOwner; + }; + return ExpressionItem; + }(_base__WEBPACK_IMPORTED_MODULE_1__["Base"])); + + /** + * A class that contains expression and html propeties. It uses in survey.completedHtmlOnCondition array. + * If the expression returns true then html of this item uses instead of survey.completedHtml property + * @see SurveyModel.completedHtmlOnCondition + * @see SurveyModel.completedHtml + */ + var HtmlConditionItem = /** @class */ (function (_super) { + __extends(HtmlConditionItem, _super); + function HtmlConditionItem(expression, html) { + if (expression === void 0) { expression = null; } + if (html === void 0) { html = null; } + var _this = _super.call(this, expression) || this; + _this.createLocalizableString("html", _this); + _this.html = html; + return _this; + } + HtmlConditionItem.prototype.getType = function () { + return "htmlconditionitem"; + }; + Object.defineProperty(HtmlConditionItem.prototype, "html", { + /** + * The html that shows on completed ('Thank you') page. The expression should return true + * @see expression + */ + get: function () { + return this.getLocalizableStringText("html"); + }, + set: function (value) { + this.setLocalizableStringText("html", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(HtmlConditionItem.prototype, "locHtml", { + get: function () { + return this.getLocalizableString("html"); + }, + enumerable: false, + configurable: true + }); + return HtmlConditionItem; + }(ExpressionItem)); + + /** + * A class that contains expression and url propeties. It uses in survey.navigateToUrlOnCondition array. + * If the expression returns true then url of this item uses instead of survey.navigateToUrl property + * @see SurveyModel.navigateToUrl + */ + var UrlConditionItem = /** @class */ (function (_super) { + __extends(UrlConditionItem, _super); + function UrlConditionItem(expression, url) { + if (expression === void 0) { expression = null; } + if (url === void 0) { url = null; } + var _this = _super.call(this, expression) || this; + _this.createLocalizableString("url", _this); + _this.url = url; + return _this; + } + UrlConditionItem.prototype.getType = function () { + return "urlconditionitem"; + }; + Object.defineProperty(UrlConditionItem.prototype, "url", { + /** + * The url that survey navigates to on completing the survey. The expression should return true + * @see expression + */ + get: function () { + return this.getLocalizableStringText("url"); + }, + set: function (value) { + this.setLocalizableStringText("url", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(UrlConditionItem.prototype, "locUrl", { + get: function () { + return this.getLocalizableString("url"); + }, + enumerable: false, + configurable: true + }); + return UrlConditionItem; + }(ExpressionItem)); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("expressionitem", ["expression:condition"], function () { + return new ExpressionItem(); + }, "base"); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("htmlconditionitem", [{ name: "html:html", serializationProperty: "locHtml" }], function () { + return new HtmlConditionItem(); + }, "expressionitem"); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("urlconditionitem", [{ name: "url:string", serializationProperty: "locUrl" }], function () { + return new UrlConditionItem(); + }, "expressionitem"); + + + /***/ }), + + /***/ "./src/expressions/expressionParser.ts": + /*!*********************************************!*\ + !*** ./src/expressions/expressionParser.ts ***! + \*********************************************/ + /*! exports provided: SyntaxError, parse */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SyntaxError", function() { return SyntaxError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parse", function() { return parse; }); + /* harmony import */ var _expressions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expressions */ "./src/expressions/expressions.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var SyntaxError = /** @class */ (function (_super) { + __extends(SyntaxError, _super); + function SyntaxError(message, expected, found, location) { + var _this = _super.call(this) || this; + _this.message = message; + _this.expected = expected; + _this.found = found; + _this.location = location; + _this.name = "SyntaxError"; + if (typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(_this, SyntaxError); + } + return _this; + } + SyntaxError.buildMessage = function (expected, found) { + function hex(ch) { + return ch.charCodeAt(0).toString(16).toUpperCase(); + } + function literalEscape(s) { + return s + .replace(/\\/g, "\\\\") + .replace(/"/g, "\\\"") + .replace(/\0/g, "\\0") + .replace(/\t/g, "\\t") + .replace(/\n/g, "\\n") + .replace(/\r/g, "\\r") + // eslint-disable-next-line no-control-regex + .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); }) + // eslint-disable-next-line no-control-regex + .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); }); + } + function classEscape(s) { + return s + .replace(/\\/g, "\\\\") + .replace(/\]/g, "\\]") + .replace(/\^/g, "\\^") + .replace(/-/g, "\\-") + .replace(/\0/g, "\\0") + .replace(/\t/g, "\\t") + .replace(/\n/g, "\\n") + .replace(/\r/g, "\\r") + // eslint-disable-next-line no-control-regex + .replace(/[\x00-\x0F]/g, function (ch) { return "\\x0" + hex(ch); }) + // eslint-disable-next-line no-control-regex + .replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x" + hex(ch); }); + } + function describeExpectation(expectation) { + switch (expectation.type) { + case "literal": + return "\"" + literalEscape(expectation.text) + "\""; + case "class": + var escapedParts = expectation.parts.map(function (part) { + return Array.isArray(part) + ? classEscape(part[0]) + "-" + classEscape(part[1]) + : classEscape(part); + }); + return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; + case "any": + return "any character"; + case "end": + return "end of input"; + case "other": + return expectation.description; + } + } + function describeExpected(expected1) { + var descriptions = expected1.map(describeExpectation); + var i; + var j; + descriptions.sort(); + if (descriptions.length > 0) { + for (i = 1, j = 1; i < descriptions.length; i++) { + if (descriptions[i - 1] !== descriptions[i]) { + descriptions[j] = descriptions[i]; + j++; + } + } + descriptions.length = j; + } + switch (descriptions.length) { + case 1: + return descriptions[0]; + case 2: + return descriptions[0] + " or " + descriptions[1]; + default: + return descriptions.slice(0, -1).join(", ") + + ", or " + + descriptions[descriptions.length - 1]; + } + } + function describeFound(found1) { + return found1 ? "\"" + literalEscape(found1) + "\"" : "end of input"; + } + return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; + }; + return SyntaxError; + }(Error)); + + function peg$parse(input, options) { + options = options !== undefined ? options : {}; + var peg$FAILED = {}; + var peg$startRuleFunctions = { Expression: peg$parseExpression }; + var peg$startRuleFunction = peg$parseExpression; + var peg$c0 = function (head, tail) { + return buildBinaryOperand(head, tail, true); + }; + var peg$c1 = "||"; + var peg$c2 = peg$literalExpectation("||", false); + var peg$c3 = "or"; + var peg$c4 = peg$literalExpectation("or", true); + var peg$c5 = function () { return "or"; }; + var peg$c6 = "&&"; + var peg$c7 = peg$literalExpectation("&&", false); + var peg$c8 = "and"; + var peg$c9 = peg$literalExpectation("and", true); + var peg$c10 = function () { return "and"; }; + var peg$c11 = function (head, tail) { + return buildBinaryOperand(head, tail); + }; + var peg$c12 = "<="; + var peg$c13 = peg$literalExpectation("<=", false); + var peg$c14 = "lessorequal"; + var peg$c15 = peg$literalExpectation("lessorequal", true); + var peg$c16 = function () { return "lessorequal"; }; + var peg$c17 = ">="; + var peg$c18 = peg$literalExpectation(">=", false); + var peg$c19 = "greaterorequal"; + var peg$c20 = peg$literalExpectation("greaterorequal", true); + var peg$c21 = function () { return "greaterorequal"; }; + var peg$c22 = "="; + var peg$c23 = peg$literalExpectation("=", false); + var peg$c24 = "equal"; + var peg$c25 = peg$literalExpectation("equal", true); + var peg$c26 = function () { return "equal"; }; + var peg$c27 = "!="; + var peg$c28 = peg$literalExpectation("!=", false); + var peg$c29 = "notequal"; + var peg$c30 = peg$literalExpectation("notequal", true); + var peg$c31 = function () { return "notequal"; }; + var peg$c32 = "<"; + var peg$c33 = peg$literalExpectation("<", false); + var peg$c34 = "less"; + var peg$c35 = peg$literalExpectation("less", true); + var peg$c36 = function () { return "less"; }; + var peg$c37 = ">"; + var peg$c38 = peg$literalExpectation(">", false); + var peg$c39 = "greater"; + var peg$c40 = peg$literalExpectation("greater", true); + var peg$c41 = function () { return "greater"; }; + var peg$c42 = "+"; + var peg$c43 = peg$literalExpectation("+", false); + var peg$c44 = function () { return "plus"; }; + var peg$c45 = "-"; + var peg$c46 = peg$literalExpectation("-", false); + var peg$c47 = function () { return "minus"; }; + var peg$c48 = "*"; + var peg$c49 = peg$literalExpectation("*", false); + var peg$c50 = function () { return "mul"; }; + var peg$c51 = "/"; + var peg$c52 = peg$literalExpectation("/", false); + var peg$c53 = function () { return "div"; }; + var peg$c54 = "%"; + var peg$c55 = peg$literalExpectation("%", false); + var peg$c56 = function () { return "mod"; }; + var peg$c57 = "^"; + var peg$c58 = peg$literalExpectation("^", false); + var peg$c59 = "power"; + var peg$c60 = peg$literalExpectation("power", true); + var peg$c61 = function () { return "power"; }; + var peg$c62 = "*="; + var peg$c63 = peg$literalExpectation("*=", false); + var peg$c64 = "contains"; + var peg$c65 = peg$literalExpectation("contains", true); + var peg$c66 = "contain"; + var peg$c67 = peg$literalExpectation("contain", true); + var peg$c68 = function () { return "contains"; }; + var peg$c69 = "notcontains"; + var peg$c70 = peg$literalExpectation("notcontains", true); + var peg$c71 = "notcontain"; + var peg$c72 = peg$literalExpectation("notcontain", true); + var peg$c73 = function () { return "notcontains"; }; + var peg$c74 = "anyof"; + var peg$c75 = peg$literalExpectation("anyof", true); + var peg$c76 = function () { return "anyof"; }; + var peg$c77 = "allof"; + var peg$c78 = peg$literalExpectation("allof", true); + var peg$c79 = function () { return "allof"; }; + var peg$c80 = "("; + var peg$c81 = peg$literalExpectation("(", false); + var peg$c82 = ")"; + var peg$c83 = peg$literalExpectation(")", false); + var peg$c84 = function (expr) { return expr; }; + var peg$c85 = function (name, params) { return new _expressions__WEBPACK_IMPORTED_MODULE_0__["FunctionOperand"](name, params); }; + var peg$c86 = "!"; + var peg$c87 = peg$literalExpectation("!", false); + var peg$c88 = "negate"; + var peg$c89 = peg$literalExpectation("negate", true); + var peg$c90 = function (expr) { return new _expressions__WEBPACK_IMPORTED_MODULE_0__["UnaryOperand"](expr, "negate"); }; + var peg$c91 = function (expr, op) { return new _expressions__WEBPACK_IMPORTED_MODULE_0__["UnaryOperand"](expr, op); }; + var peg$c92 = "empty"; + var peg$c93 = peg$literalExpectation("empty", true); + var peg$c94 = function () { return "empty"; }; + var peg$c95 = "notempty"; + var peg$c96 = peg$literalExpectation("notempty", true); + var peg$c97 = function () { return "notempty"; }; + var peg$c98 = "undefined"; + var peg$c99 = peg$literalExpectation("undefined", false); + var peg$c100 = "null"; + var peg$c101 = peg$literalExpectation("null", false); + var peg$c102 = function () { return null; }; + var peg$c103 = function (value) { return new _expressions__WEBPACK_IMPORTED_MODULE_0__["Const"](value); }; + var peg$c104 = "{"; + var peg$c105 = peg$literalExpectation("{", false); + var peg$c106 = "}"; + var peg$c107 = peg$literalExpectation("}", false); + var peg$c108 = function (value) { return new _expressions__WEBPACK_IMPORTED_MODULE_0__["Variable"](value); }; + var peg$c109 = function (value) { return value; }; + var peg$c110 = "''"; + var peg$c111 = peg$literalExpectation("''", false); + var peg$c112 = function () { return ""; }; + var peg$c113 = "\"\""; + var peg$c114 = peg$literalExpectation("\"\"", false); + var peg$c115 = "'"; + var peg$c116 = peg$literalExpectation("'", false); + var peg$c117 = function (value) { return "'" + value + "'"; }; + var peg$c118 = "\""; + var peg$c119 = peg$literalExpectation("\"", false); + var peg$c120 = "["; + var peg$c121 = peg$literalExpectation("[", false); + var peg$c122 = "]"; + var peg$c123 = peg$literalExpectation("]", false); + var peg$c124 = function (sequence) { return sequence; }; + var peg$c125 = ","; + var peg$c126 = peg$literalExpectation(",", false); + var peg$c127 = function (expr, tail) { + if (expr == null) + return new _expressions__WEBPACK_IMPORTED_MODULE_0__["ArrayOperand"]([]); + var array = [expr]; + if (Array.isArray(tail)) { + var flatten = flattenArray(tail); + for (var i = 3; i < flatten.length; i += 4) { + array.push(flatten[i]); + } + } + return new _expressions__WEBPACK_IMPORTED_MODULE_0__["ArrayOperand"](array); + }; + var peg$c128 = "true"; + var peg$c129 = peg$literalExpectation("true", true); + var peg$c130 = function () { return true; }; + var peg$c131 = "false"; + var peg$c132 = peg$literalExpectation("false", true); + var peg$c133 = function () { return false; }; + var peg$c134 = "0x"; + var peg$c135 = peg$literalExpectation("0x", false); + var peg$c136 = function () { return parseInt(text(), 16); }; + var peg$c137 = /^[\-]/; + var peg$c138 = peg$classExpectation(["-"], false, false); + var peg$c139 = function (sign, num) { return sign == null ? num : -num; }; + var peg$c140 = "."; + var peg$c141 = peg$literalExpectation(".", false); + var peg$c142 = function () { return parseFloat(text()); }; + var peg$c143 = function () { return parseInt(text(), 10); }; + var peg$c144 = "0"; + var peg$c145 = peg$literalExpectation("0", false); + var peg$c146 = function () { return 0; }; + var peg$c147 = function (chars) { return chars.join(""); }; + var peg$c148 = "\\'"; + var peg$c149 = peg$literalExpectation("\\'", false); + var peg$c150 = function () { return "'"; }; + var peg$c151 = "\\\""; + var peg$c152 = peg$literalExpectation("\\\"", false); + var peg$c153 = function () { return "\""; }; + var peg$c154 = /^[^"']/; + var peg$c155 = peg$classExpectation(["\"", "'"], true, false); + var peg$c156 = function () { return text(); }; + var peg$c157 = /^[^{}]/; + var peg$c158 = peg$classExpectation(["{", "}"], true, false); + var peg$c159 = /^[0-9]/; + var peg$c160 = peg$classExpectation([["0", "9"]], false, false); + var peg$c161 = /^[1-9]/; + var peg$c162 = peg$classExpectation([["1", "9"]], false, false); + var peg$c163 = /^[a-zA-Z]/; + var peg$c164 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false); + var peg$c165 = peg$otherExpectation("whitespace"); + var peg$c166 = /^[ \t\n\r]/; + var peg$c167 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false); + var peg$currPos = 0; + var peg$savedPos = 0; + var peg$posDetailsCache = [{ line: 1, column: 1 }]; + var peg$maxFailPos = 0; + var peg$maxFailExpected = []; + var peg$silentFails = 0; + var peg$resultsCache = {}; + var peg$result; + if (options.startRule !== undefined) { + if (!(options.startRule in peg$startRuleFunctions)) { + throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); + } + peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; + } + function text() { + return input.substring(peg$savedPos, peg$currPos); + } + function peg$literalExpectation(text1, ignoreCase) { + return { type: "literal", text: text1, ignoreCase: ignoreCase }; + } + function peg$classExpectation(parts, inverted, ignoreCase) { + return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; + } + function peg$endExpectation() { + return { type: "end" }; + } + function peg$otherExpectation(description) { + return { type: "other", description: description }; + } + function peg$computePosDetails(pos) { + var details = peg$posDetailsCache[pos]; + var p; + if (details) { + return details; + } + else { + p = pos - 1; + while (!peg$posDetailsCache[p]) { + p--; + } + details = peg$posDetailsCache[p]; + details = { + line: details.line, + column: details.column + }; + while (p < pos) { + if (input.charCodeAt(p) === 10) { + details.line++; + details.column = 1; + } + else { + details.column++; + } + p++; + } + peg$posDetailsCache[pos] = details; + return details; + } + } + function peg$computeLocation(startPos, endPos) { + var startPosDetails = peg$computePosDetails(startPos); + var endPosDetails = peg$computePosDetails(endPos); + return { + start: { + offset: startPos, + line: startPosDetails.line, + column: startPosDetails.column + }, + end: { + offset: endPos, + line: endPosDetails.line, + column: endPosDetails.column + } + }; + } + function peg$fail(expected1) { + if (peg$currPos < peg$maxFailPos) { + return; + } + if (peg$currPos > peg$maxFailPos) { + peg$maxFailPos = peg$currPos; + peg$maxFailExpected = []; + } + peg$maxFailExpected.push(expected1); + } + function peg$buildStructuredError(expected1, found, location1) { + return new SyntaxError(SyntaxError.buildMessage(expected1, found), expected1, found, location1); + } + function peg$parseExpression() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8; + var key = peg$currPos * 34 + 0; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = peg$parseLogicOr(); + if (s2 !== peg$FAILED) { + s3 = []; + s4 = peg$currPos; + s5 = peg$parse_(); + if (s5 !== peg$FAILED) { + s6 = peg$parseOrSign(); + if (s6 !== peg$FAILED) { + s7 = peg$parse_(); + if (s7 !== peg$FAILED) { + s8 = peg$parseLogicOr(); + if (s8 !== peg$FAILED) { + s5 = [s5, s6, s7, s8]; + s4 = s5; + } + else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + else { + peg$currPos = s4; + s4 = peg$FAILED; + } + while (s4 !== peg$FAILED) { + s3.push(s4); + s4 = peg$currPos; + s5 = peg$parse_(); + if (s5 !== peg$FAILED) { + s6 = peg$parseOrSign(); + if (s6 !== peg$FAILED) { + s7 = peg$parse_(); + if (s7 !== peg$FAILED) { + s8 = peg$parseLogicOr(); + if (s8 !== peg$FAILED) { + s5 = [s5, s6, s7, s8]; + s4 = s5; + } + else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + else { + peg$currPos = s4; + s4 = peg$FAILED; + } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s2, s3); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseOrSign() { + var s0, s1; + var key = peg$currPos * 34 + 1; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c1) { + s1 = peg$c1; + peg$currPos += 2; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c2); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 2).toLowerCase() === peg$c3) { + s1 = input.substr(peg$currPos, 2); + peg$currPos += 2; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c4); + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c5(); + } + s0 = s1; + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseLogicOr() { + var s0, s1, s2, s3, s4, s5, s6, s7; + var key = peg$currPos * 34 + 2; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parseLogicAnd(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndSign(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseLogicAnd(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseAndSign(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseLogicAnd(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s1, s2); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseAndSign() { + var s0, s1; + var key = peg$currPos * 34 + 3; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c6) { + s1 = peg$c6; + peg$currPos += 2; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c7); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 3).toLowerCase() === peg$c8) { + s1 = input.substr(peg$currPos, 3); + peg$currPos += 3; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c9); + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c10(); + } + s0 = s1; + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseLogicAnd() { + var s0, s1, s2, s3, s4, s5, s6, s7; + var key = peg$currPos * 34 + 4; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parseCompOps(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseComparableOperators(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseCompOps(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseComparableOperators(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseCompOps(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c11(s1, s2); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseComparableOperators() { + var s0, s1; + var key = peg$currPos * 34 + 5; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c12) { + s1 = peg$c12; + peg$currPos += 2; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c13); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c14) { + s1 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c15); + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c16(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c17) { + s1 = peg$c17; + peg$currPos += 2; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c18); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 14).toLowerCase() === peg$c19) { + s1 = input.substr(peg$currPos, 14); + peg$currPos += 14; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c20); + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c21(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 61) { + s1 = peg$c22; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c23); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c24) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c25); + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c26(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c27) { + s1 = peg$c27; + peg$currPos += 2; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c28); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c29) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c30); + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c31(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 60) { + s1 = peg$c32; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c33); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c34) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c35); + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c36(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 62) { + s1 = peg$c37; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c38); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c39) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c40); + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c41(); + } + s0 = s1; + } + } + } + } + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseCompOps() { + var s0, s1, s2, s3, s4, s5, s6, s7; + var key = peg$currPos * 34 + 6; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parsePlusMinusOps(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsePlusMinusSigns(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parsePlusMinusOps(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsePlusMinusSigns(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parsePlusMinusOps(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s1, s2); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parsePlusMinusSigns() { + var s0, s1; + var key = peg$currPos * 34 + 7; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 43) { + s1 = peg$c42; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c43); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c44(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 45) { + s1 = peg$c45; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c46); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c47(); + } + s0 = s1; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parsePlusMinusOps() { + var s0, s1, s2, s3, s4, s5, s6, s7; + var key = peg$currPos * 34 + 8; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parseMulDivOps(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseMulDivSigns(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseMulDivOps(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseMulDivSigns(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseMulDivOps(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s1, s2); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseMulDivSigns() { + var s0, s1; + var key = peg$currPos * 34 + 9; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 42) { + s1 = peg$c48; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c49); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c50(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 47) { + s1 = peg$c51; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c52); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c53(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 37) { + s1 = peg$c54; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c55); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c56(); + } + s0 = s1; + } + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseMulDivOps() { + var s0, s1, s2, s3, s4, s5, s6, s7; + var key = peg$currPos * 34 + 10; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parseBinaryFuncOp(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsePowerSigns(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseBinaryFuncOp(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parsePowerSigns(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseBinaryFuncOp(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c0(s1, s2); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parsePowerSigns() { + var s0, s1; + var key = peg$currPos * 34 + 11; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 94) { + s1 = peg$c57; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c58); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c59) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c60); + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c61(); + } + s0 = s1; + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseBinaryFuncOp() { + var s0, s1, s2, s3, s4, s5, s6, s7; + var key = peg$currPos * 34 + 12; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parseFactor(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseBinFunctions(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseFactor(); + if (s7 === peg$FAILED) { + s7 = null; + } + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + s5 = peg$parseBinFunctions(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseFactor(); + if (s7 === peg$FAILED) { + s7 = null; + } + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c11(s1, s2); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseBinFunctions() { + var s0, s1; + var key = peg$currPos * 34 + 13; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c62) { + s1 = peg$c62; + peg$currPos += 2; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c63); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c64) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c65); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 7).toLowerCase() === peg$c66) { + s1 = input.substr(peg$currPos, 7); + peg$currPos += 7; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c67); + } + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c68(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 11).toLowerCase() === peg$c69) { + s1 = input.substr(peg$currPos, 11); + peg$currPos += 11; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c70); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 10).toLowerCase() === peg$c71) { + s1 = input.substr(peg$currPos, 10); + peg$currPos += 10; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c72); + } + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c73(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c74) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c75); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c76(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c77) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c78); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c79(); + } + s0 = s1; + } + } + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseFactor() { + var s0, s1, s2, s3, s4, s5; + var key = peg$currPos * 34 + 14; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 40) { + s1 = peg$c80; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c81); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseExpression(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c82; + peg$currPos++; + } + else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c83); + } + } + if (s5 === peg$FAILED) { + s5 = null; + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c84(s3); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$parseFunctionOp(); + if (s0 === peg$FAILED) { + s0 = peg$parseUnaryFunctionOp(); + if (s0 === peg$FAILED) { + s0 = peg$parseAtom(); + if (s0 === peg$FAILED) { + s0 = peg$parseArrayOp(); + } + } + } + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseFunctionOp() { + var s0, s1, s2, s3, s4; + var key = peg$currPos * 34 + 15; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parseLettersAndDigits(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 40) { + s2 = peg$c80; + peg$currPos++; + } + else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c81); + } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseSequence(); + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 41) { + s4 = peg$c82; + peg$currPos++; + } + else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c83); + } + } + if (s4 === peg$FAILED) { + s4 = null; + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c85(s1, s3); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseUnaryFunctionOp() { + var s0, s1, s2, s3; + var key = peg$currPos * 34 + 16; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 33) { + s1 = peg$c86; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c87); + } + } + if (s1 === peg$FAILED) { + if (input.substr(peg$currPos, 6).toLowerCase() === peg$c88) { + s1 = input.substr(peg$currPos, 6); + peg$currPos += 6; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c89); + } + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseExpression(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c90(s3); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseAtom(); + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + if (s2 !== peg$FAILED) { + s3 = peg$parseUnFunctions(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c91(s1, s3); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseUnFunctions() { + var s0, s1; + var key = peg$currPos * 34 + 17; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c92) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c93); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c94(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 8).toLowerCase() === peg$c95) { + s1 = input.substr(peg$currPos, 8); + peg$currPos += 8; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c96); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c97(); + } + s0 = s1; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseAtom() { + var s0, s1, s2, s3, s4; + var key = peg$currPos * 34 + 18; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.substr(peg$currPos, 9) === peg$c98) { + s2 = peg$c98; + peg$currPos += 9; + } + else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c99); + } + } + if (s2 === peg$FAILED) { + if (input.substr(peg$currPos, 4) === peg$c100) { + s2 = peg$c100; + peg$currPos += 4; + } + else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c101); + } + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c102(); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + s2 = peg$parseConstValue(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c103(s2); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parse_(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 123) { + s2 = peg$c104; + peg$currPos++; + } + else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c105); + } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseValueInput(); + if (s3 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 125) { + s4 = peg$c106; + peg$currPos++; + } + else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c107); + } + } + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c108(s3); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseConstValue() { + var s0, s1, s2, s3; + var key = peg$currPos * 34 + 19; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parseLogicValue(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c109(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseArithmeticValue(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c109(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseLettersAndDigits(); + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c109(s1); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c110) { + s1 = peg$c110; + peg$currPos += 2; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c111); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c112(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c113) { + s1 = peg$c113; + peg$currPos += 2; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c114); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c112(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 39) { + s1 = peg$c115; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c116); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseAnyInput(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c115; + peg$currPos++; + } + else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c116); + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c117(s2); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 34) { + s1 = peg$c118; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c119); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseAnyInput(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 34) { + s3 = peg$c118; + peg$currPos++; + } + else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c119); + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c117(s2); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + } + } + } + } + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseArrayOp() { + var s0, s1, s2, s3; + var key = peg$currPos * 34 + 20; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 91) { + s1 = peg$c120; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c121); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseSequence(); + if (s2 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 93) { + s3 = peg$c122; + peg$currPos++; + } + else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c123); + } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c124(s2); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseSequence() { + var s0, s1, s2, s3, s4, s5, s6, s7; + var key = peg$currPos * 34 + 21; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parseExpression(); + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c125; + peg$currPos++; + } + else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c126); + } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseExpression(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parse_(); + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 44) { + s5 = peg$c125; + peg$currPos++; + } + else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c126); + } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (s6 !== peg$FAILED) { + s7 = peg$parseExpression(); + if (s7 !== peg$FAILED) { + s4 = [s4, s5, s6, s7]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c127(s1, s2); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseLogicValue() { + var s0, s1; + var key = peg$currPos * 34 + 22; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.substr(peg$currPos, 4).toLowerCase() === peg$c128) { + s1 = input.substr(peg$currPos, 4); + peg$currPos += 4; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c129); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c130(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 5).toLowerCase() === peg$c131) { + s1 = input.substr(peg$currPos, 5); + peg$currPos += 5; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c132); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c133(); + } + s0 = s1; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseArithmeticValue() { + var s0, s1, s2; + var key = peg$currPos * 34 + 23; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c134) { + s1 = peg$c134; + peg$currPos += 2; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c135); + } + } + if (s1 !== peg$FAILED) { + s2 = peg$parseDigits(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c136(); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (peg$c137.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c138); + } + } + if (s1 === peg$FAILED) { + s1 = null; + } + if (s1 !== peg$FAILED) { + s2 = peg$parseNumber(); + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c139(s1, s2); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseNumber() { + var s0, s1, s2, s3; + var key = peg$currPos * 34 + 24; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parseDigits(); + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 46) { + s2 = peg$c140; + peg$currPos++; + } + else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c141); + } + } + if (s2 !== peg$FAILED) { + s3 = peg$parseDigits(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c142(); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = peg$parseNonZeroDigits(); + if (s1 !== peg$FAILED) { + s2 = peg$parseDigits(); + if (s2 === peg$FAILED) { + s2 = null; + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c143(); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.charCodeAt(peg$currPos) === 48) { + s1 = peg$c144; + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c145); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c146(); + } + s0 = s1; + } + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseValueInput() { + var s0, s1, s2; + var key = peg$currPos * 34 + 25; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = []; + s2 = peg$parseValueCharacters(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseValueCharacters(); + } + } + else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c147(s1); + } + s0 = s1; + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseAnyInput() { + var s0, s1, s2; + var key = peg$currPos * 34 + 26; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = []; + s2 = peg$parseAnyCharacters(); + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + s2 = peg$parseAnyCharacters(); + } + } + else { + s1 = peg$FAILED; + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c147(s1); + } + s0 = s1; + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseAnyCharacters() { + var s0, s1; + var key = peg$currPos * 34 + 27; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c148) { + s1 = peg$c148; + peg$currPos += 2; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c149); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c150(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c151) { + s1 = peg$c151; + peg$currPos += 2; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c152); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c153(); + } + s0 = s1; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (peg$c154.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c155); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c156(); + } + s0 = s1; + } + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseValueCharacters() { + var s0, s1; + var key = peg$currPos * 34 + 28; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + if (peg$c157.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c158); + } + } + if (s1 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c156(); + } + s0 = s1; + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseLettersAndDigits() { + var s0, s1, s2, s3, s4, s5, s6; + var key = peg$currPos * 34 + 29; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = peg$currPos; + s1 = peg$parseLetters(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parseDigits(); + if (s4 !== peg$FAILED) { + s5 = []; + s6 = peg$parseLetters(); + while (s6 !== peg$FAILED) { + s5.push(s6); + s6 = peg$parseLetters(); + } + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parseDigits(); + if (s4 !== peg$FAILED) { + s5 = []; + s6 = peg$parseLetters(); + while (s6 !== peg$FAILED) { + s5.push(s6); + s6 = peg$parseLetters(); + } + if (s5 !== peg$FAILED) { + s4 = [s4, s5]; + s3 = s4; + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + else { + peg$currPos = s3; + s3 = peg$FAILED; + } + } + if (s2 !== peg$FAILED) { + peg$savedPos = s0; + s1 = peg$c156(); + s0 = s1; + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + } + else { + peg$currPos = s0; + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseDigits() { + var s0, s1; + var key = peg$currPos * 34 + 30; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = []; + if (peg$c159.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c160); + } + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c159.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c160); + } + } + } + } + else { + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseNonZeroDigits() { + var s0, s1; + var key = peg$currPos * 34 + 31; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = []; + if (peg$c161.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c162); + } + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c161.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c162); + } + } + } + } + else { + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parseLetters() { + var s0, s1; + var key = peg$currPos * 34 + 32; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + s0 = []; + if (peg$c163.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c164); + } + } + if (s1 !== peg$FAILED) { + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c163.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c164); + } + } + } + } + else { + s0 = peg$FAILED; + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function peg$parse_() { + var s0, s1; + var key = peg$currPos * 34 + 33; + var cached = peg$resultsCache[key]; + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + peg$silentFails++; + s0 = []; + if (peg$c166.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c167); + } + } + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c166.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } + else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c167); + } + } + } + peg$silentFails--; + if (s0 === peg$FAILED) { + s1 = peg$FAILED; + if (peg$silentFails === 0) { + peg$fail(peg$c165); + } + } + peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; + return s0; + } + function buildBinaryOperand(head, tail, isArithmeticOp) { + if (isArithmeticOp === void 0) { isArithmeticOp = false; } + return tail.reduce(function (result, elements) { + return new _expressions__WEBPACK_IMPORTED_MODULE_0__["BinaryOperand"](elements[1], result, elements[3], isArithmeticOp); + }, head); + } + function flattenArray(array) { + return [].concat.apply([], array); + } + peg$result = peg$startRuleFunction(); + if (peg$result !== peg$FAILED && peg$currPos === input.length) { + return peg$result; + } + else { + if (peg$result !== peg$FAILED && peg$currPos < input.length) { + peg$fail(peg$endExpectation()); + } + throw peg$buildStructuredError(peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length + ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) + : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)); + } + } + var parse = peg$parse; + + + /***/ }), + + /***/ "./src/expressions/expressions.ts": + /*!****************************************!*\ + !*** ./src/expressions/expressions.ts ***! + \****************************************/ + /*! exports provided: Operand, BinaryOperand, UnaryOperand, ArrayOperand, Const, Variable, FunctionOperand, OperandMaker */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Operand", function() { return Operand; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BinaryOperand", function() { return BinaryOperand; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UnaryOperand", function() { return UnaryOperand; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayOperand", function() { return ArrayOperand; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Const", function() { return Const; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Variable", function() { return Variable; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionOperand", function() { return FunctionOperand; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OperandMaker", function() { return OperandMaker; }); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../helpers */ "./src/helpers.ts"); + /* harmony import */ var _functionsfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../functionsfactory */ "./src/functionsfactory.ts"); + /* harmony import */ var _conditionProcessValue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../conditionProcessValue */ "./src/conditionProcessValue.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + var Operand = /** @class */ (function () { + function Operand() { + } + Operand.prototype.toString = function (func) { + return ""; + }; + Operand.prototype.hasFunction = function () { + return false; + }; + Operand.prototype.hasAsyncFunction = function () { + return false; + }; + Operand.prototype.addToAsyncList = function (list) { }; + Operand.prototype.isEqual = function (op) { + return !!op && op.getType() === this.getType() && this.isContentEqual(op); + }; + Operand.prototype.areOperatorsEquals = function (op1, op2) { + return !op1 && !op2 || !!op1 && op1.isEqual(op2); + }; + return Operand; + }()); + + var BinaryOperand = /** @class */ (function (_super) { + __extends(BinaryOperand, _super); + function BinaryOperand(operatorName, left, right, isArithmeticOp) { + if (left === void 0) { left = null; } + if (right === void 0) { right = null; } + if (isArithmeticOp === void 0) { isArithmeticOp = false; } + var _this = _super.call(this) || this; + _this.operatorName = operatorName; + _this.left = left; + _this.right = right; + _this.isArithmeticValue = isArithmeticOp; + if (isArithmeticOp) { + _this.consumer = OperandMaker.binaryFunctions["arithmeticOp"](operatorName); + } + else { + _this.consumer = OperandMaker.binaryFunctions[operatorName]; + } + if (_this.consumer == null) { + OperandMaker.throwInvalidOperatorError(operatorName); + } + return _this; + } + BinaryOperand.prototype.getType = function () { + return "binary"; + }; + Object.defineProperty(BinaryOperand.prototype, "isArithmetic", { + get: function () { + return this.isArithmeticValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BinaryOperand.prototype, "isConjunction", { + get: function () { + return this.operatorName == "or" || this.operatorName == "and"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BinaryOperand.prototype, "conjunction", { + get: function () { + return this.isConjunction ? this.operatorName : ""; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BinaryOperand.prototype, "operator", { + get: function () { + return this.operatorName; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BinaryOperand.prototype, "leftOperand", { + get: function () { + return this.left; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BinaryOperand.prototype, "rightOperand", { + get: function () { + return this.right; + }, + enumerable: false, + configurable: true + }); + BinaryOperand.prototype.isContentEqual = function (op) { + var bOp = op; + return bOp.operator === this.operator && + this.areOperatorsEquals(this.left, bOp.left) && + this.areOperatorsEquals(this.right, bOp.right); + }; + BinaryOperand.prototype.evaluateParam = function (x, processValue) { + return x == null ? null : x.evaluate(processValue); + }; + BinaryOperand.prototype.evaluate = function (processValue) { + return this.consumer.call(this, this.evaluateParam(this.left, processValue), this.evaluateParam(this.right, processValue)); + }; + BinaryOperand.prototype.toString = function (func) { + if (func === void 0) { func = undefined; } + if (!!func) { + var res = func(this); + if (!!res) + return res; + } + return ("(" + + OperandMaker.safeToString(this.left, func) + + " " + + OperandMaker.operatorToString(this.operatorName) + + " " + + OperandMaker.safeToString(this.right, func) + + ")"); + }; + BinaryOperand.prototype.setVariables = function (variables) { + if (this.left != null) + this.left.setVariables(variables); + if (this.right != null) + this.right.setVariables(variables); + }; + BinaryOperand.prototype.hasFunction = function () { + return ((!!this.left && this.left.hasFunction()) || + (!!this.right && this.right.hasFunction())); + }; + BinaryOperand.prototype.hasAsyncFunction = function () { + return ((!!this.left && this.left.hasAsyncFunction()) || + (!!this.right && this.right.hasAsyncFunction())); + }; + BinaryOperand.prototype.addToAsyncList = function (list) { + if (!!this.left) + this.left.addToAsyncList(list); + if (!!this.right) + this.right.addToAsyncList(list); + }; + return BinaryOperand; + }(Operand)); + + var UnaryOperand = /** @class */ (function (_super) { + __extends(UnaryOperand, _super); + function UnaryOperand(expressionValue, operatorName) { + var _this = _super.call(this) || this; + _this.expressionValue = expressionValue; + _this.operatorName = operatorName; + _this.consumer = OperandMaker.unaryFunctions[operatorName]; + if (_this.consumer == null) { + OperandMaker.throwInvalidOperatorError(operatorName); + } + return _this; + } + Object.defineProperty(UnaryOperand.prototype, "operator", { + get: function () { + return this.operatorName; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(UnaryOperand.prototype, "expression", { + get: function () { + return this.expressionValue; + }, + enumerable: false, + configurable: true + }); + UnaryOperand.prototype.getType = function () { + return "unary"; + }; + UnaryOperand.prototype.toString = function (func) { + if (func === void 0) { func = undefined; } + if (!!func) { + var res = func(this); + if (!!res) + return res; + } + return (OperandMaker.operatorToString(this.operatorName) + + " " + + this.expression.toString(func)); + }; + UnaryOperand.prototype.isContentEqual = function (op) { + var uOp = op; + return uOp.operator == this.operator && this.areOperatorsEquals(this.expression, uOp.expression); + }; + UnaryOperand.prototype.evaluate = function (processValue) { + var value = this.expression.evaluate(processValue); + return this.consumer.call(this, value); + }; + UnaryOperand.prototype.setVariables = function (variables) { + this.expression.setVariables(variables); + }; + return UnaryOperand; + }(Operand)); + + var ArrayOperand = /** @class */ (function (_super) { + __extends(ArrayOperand, _super); + function ArrayOperand(values) { + var _this = _super.call(this) || this; + _this.values = values; + return _this; + } + ArrayOperand.prototype.getType = function () { + return "array"; + }; + ArrayOperand.prototype.toString = function (func) { + if (func === void 0) { func = undefined; } + if (!!func) { + var res = func(this); + if (!!res) + return res; + } + return ("[" + + this.values + .map(function (el) { + return el.toString(func); + }) + .join(", ") + + "]"); + }; + ArrayOperand.prototype.evaluate = function (processValue) { + return this.values.map(function (el) { + return el.evaluate(processValue); + }); + }; + ArrayOperand.prototype.setVariables = function (variables) { + this.values.forEach(function (el) { + el.setVariables(variables); + }); + }; + ArrayOperand.prototype.hasFunction = function () { + return this.values.some(function (operand) { return operand.hasFunction(); }); + }; + ArrayOperand.prototype.hasAsyncFunction = function () { + return this.values.some(function (operand) { return operand.hasAsyncFunction(); }); + }; + ArrayOperand.prototype.addToAsyncList = function (list) { + this.values.forEach(function (operand) { return operand.addToAsyncList(list); }); + }; + ArrayOperand.prototype.isContentEqual = function (op) { + var aOp = op; + if (aOp.values.length !== this.values.length) + return false; + for (var i = 0; i < this.values.length; i++) { + if (!aOp.values[i].isEqual(this.values[i])) + return false; + } + return true; + }; + return ArrayOperand; + }(Operand)); + + var Const = /** @class */ (function (_super) { + __extends(Const, _super); + function Const(value) { + var _this = _super.call(this) || this; + _this.value = value; + return _this; + } + Const.prototype.getType = function () { + return "const"; + }; + Const.prototype.toString = function (func) { + if (func === void 0) { func = undefined; } + if (!!func) { + var res = func(this); + if (!!res) + return res; + } + return this.value.toString(); + }; + Object.defineProperty(Const.prototype, "correctValue", { + get: function () { + return this.getCorrectValue(this.value); + }, + enumerable: false, + configurable: true + }); + Const.prototype.evaluate = function () { + return this.getCorrectValue(this.value); + }; + Const.prototype.setVariables = function (variables) { }; + Const.prototype.getCorrectValue = function (value) { + if (!value || typeof value != "string") + return value; + if (this.isBooleanValue(value)) + return value.toLowerCase() === "true"; + if (value.length > 1 && + this.isQuote(value[0]) && + this.isQuote(value[value.length - 1])) + return value.substr(1, value.length - 2); + if (OperandMaker.isNumeric(value)) { + if (value.indexOf("0x") == 0) + return parseInt(value); + if (value.length > 1 && value[0] == "0") + return value; + return parseFloat(value); + } + return value; + }; + Const.prototype.isContentEqual = function (op) { + var cOp = op; + return cOp.value == this.value; + }; + Const.prototype.isQuote = function (ch) { + return ch == "'" || ch == '"'; + }; + Const.prototype.isBooleanValue = function (value) { + return (value && + (value.toLowerCase() === "true" || value.toLowerCase() === "false")); + }; + return Const; + }(Operand)); + + var Variable = /** @class */ (function (_super) { + __extends(Variable, _super); + function Variable(variableName) { + var _this = _super.call(this, variableName) || this; + _this.variableName = variableName; + _this.valueInfo = {}; + _this.useValueAsItIs = false; + if (!!_this.variableName && + _this.variableName.length > 1 && + _this.variableName[0] === Variable.DisableConversionChar) { + _this.variableName = _this.variableName.substr(1); + _this.useValueAsItIs = true; + } + return _this; + } + Variable.prototype.getType = function () { + return "variable"; + }; + Variable.prototype.toString = function (func) { + if (func === void 0) { func = undefined; } + if (!!func) { + var res = func(this); + if (!!res) + return res; + } + var prefix = this.useValueAsItIs ? Variable.DisableConversionChar : ""; + return "{" + prefix + this.variableName + "}"; + }; + Object.defineProperty(Variable.prototype, "variable", { + get: function () { + return this.variableName; + }, + enumerable: false, + configurable: true + }); + Variable.prototype.evaluate = function (processValue) { + this.valueInfo.name = this.variableName; + processValue.getValueInfo(this.valueInfo); + return this.valueInfo.hasValue + ? this.getCorrectValue(this.valueInfo.value) + : null; + }; + Variable.prototype.setVariables = function (variables) { + variables.push(this.variableName); + }; + Variable.prototype.getCorrectValue = function (value) { + if (this.useValueAsItIs) + return value; + return _super.prototype.getCorrectValue.call(this, value); + }; + Variable.prototype.isContentEqual = function (op) { + var vOp = op; + return vOp.variable == this.variable; + }; + Variable.DisableConversionChar = "#"; + return Variable; + }(Const)); + + var FunctionOperand = /** @class */ (function (_super) { + __extends(FunctionOperand, _super); + function FunctionOperand(originalValue, parameters) { + var _this = _super.call(this) || this; + _this.originalValue = originalValue; + _this.parameters = parameters; + _this.isReadyValue = false; + if (Array.isArray(parameters) && parameters.length === 0) { + _this.parameters = new ArrayOperand([]); + } + return _this; + } + FunctionOperand.prototype.getType = function () { + return "function"; + }; + FunctionOperand.prototype.evaluateAsync = function (processValue) { + var _this = this; + this.isReadyValue = false; + var asyncProcessValue = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_2__["ProcessValue"](); + asyncProcessValue.values = _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].createCopy(processValue.values); + asyncProcessValue.properties = _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].createCopy(processValue.properties); + asyncProcessValue.properties.returnResult = function (result) { + _this.asynResult = result; + _this.isReadyValue = true; + _this.onAsyncReady(); + }; + this.evaluateCore(asyncProcessValue); + }; + FunctionOperand.prototype.evaluate = function (processValue) { + if (this.isReady) + return this.asynResult; + return this.evaluateCore(processValue); + }; + FunctionOperand.prototype.evaluateCore = function (processValue) { + return _functionsfactory__WEBPACK_IMPORTED_MODULE_1__["FunctionFactory"].Instance.run(this.originalValue, this.parameters.evaluate(processValue), processValue.properties); + }; + FunctionOperand.prototype.toString = function (func) { + if (func === void 0) { func = undefined; } + if (!!func) { + var res = func(this); + if (!!res) + return res; + } + return this.originalValue + "(" + this.parameters.toString(func) + ")"; + }; + FunctionOperand.prototype.setVariables = function (variables) { + this.parameters.setVariables(variables); + }; + Object.defineProperty(FunctionOperand.prototype, "isReady", { + get: function () { + return this.isReadyValue; + }, + enumerable: false, + configurable: true + }); + FunctionOperand.prototype.hasFunction = function () { + return true; + }; + FunctionOperand.prototype.hasAsyncFunction = function () { + return _functionsfactory__WEBPACK_IMPORTED_MODULE_1__["FunctionFactory"].Instance.isAsyncFunction(this.originalValue); + }; + FunctionOperand.prototype.addToAsyncList = function (list) { + if (this.hasAsyncFunction()) { + list.push(this); + } + }; + FunctionOperand.prototype.isContentEqual = function (op) { + var fOp = op; + return fOp.originalValue == this.originalValue && this.areOperatorsEquals(fOp.parameters, this.parameters); + }; + return FunctionOperand; + }(Operand)); + + var OperandMaker = /** @class */ (function () { + function OperandMaker() { + } + OperandMaker.throwInvalidOperatorError = function (op) { + throw new Error("Invalid operator: '" + op + "'"); + }; + OperandMaker.safeToString = function (operand, func) { + return operand == null ? "" : operand.toString(func); + }; + OperandMaker.toOperandString = function (value) { + if (!!value && + !OperandMaker.isNumeric(value) && + !OperandMaker.isBooleanValue(value)) + value = "'" + value + "'"; + return value; + }; + OperandMaker.isSpaceString = function (str) { + return !!str && !str.replace(" ", ""); + }; + OperandMaker.isNumeric = function (value) { + if (!!value && + (value.indexOf("-") > -1 || + value.indexOf("+") > 1 || + value.indexOf("*") > -1 || + value.indexOf("^") > -1 || + value.indexOf("/") > -1 || + value.indexOf("%") > -1)) + return false; + if (OperandMaker.isSpaceString(value)) + return false; + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(value); + }; + OperandMaker.isBooleanValue = function (value) { + return (!!value && + (value.toLowerCase() === "true" || value.toLowerCase() === "false")); + }; + OperandMaker.countDecimals = function (value) { + if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(value) && Math.floor(value) !== value) { + var strs = value.toString().split("."); + return strs.length > 1 && strs[1].length || 0; + } + return 0; + }; + OperandMaker.plusMinus = function (a, b, res) { + var digitsA = OperandMaker.countDecimals(a); + var digitsB = OperandMaker.countDecimals(b); + if (digitsA > 0 || digitsB > 0) { + var digits = Math.max(digitsA, digitsB); + res = parseFloat(res.toFixed(digits)); + } + return res; + }; + OperandMaker.isTwoValueEquals = function (x, y) { + if (x === "undefined") + x = undefined; + if (y === "undefined") + y = undefined; + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isTwoValueEquals(x, y, true); + }; + OperandMaker.operatorToString = function (operatorName) { + var opStr = OperandMaker.signs[operatorName]; + return opStr == null ? operatorName : opStr; + }; + OperandMaker.unaryFunctions = { + empty: function (value) { + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(value); + }, + notempty: function (value) { + return !OperandMaker.unaryFunctions.empty(value); + }, + negate: function (value) { + return !value; + }, + }; + OperandMaker.binaryFunctions = { + arithmeticOp: function (operatorName) { + return function (a, b) { + if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(a) && !OperandMaker.isSpaceString(a)) { + a = typeof b === "string" ? "" : 0; + } + if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(b) && !OperandMaker.isSpaceString(b)) { + b = typeof a === "string" ? "" : 0; + } + var consumer = OperandMaker.binaryFunctions[operatorName]; + return consumer == null ? null : consumer.call(this, a, b); + }; + }, + and: function (a, b) { + return a && b; + }, + or: function (a, b) { + return a || b; + }, + plus: function (a, b) { + if (!_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(a) || !_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(b)) { + return a + b; + } + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].correctAfterPlusMinis(a, b, a + b); + }, + minus: function (a, b) { + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].correctAfterPlusMinis(a, b, a - b); + }, + mul: function (a, b) { + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].correctAfterMultiple(a, b, a * b); + }, + div: function (a, b) { + if (!b) + return null; + return a / b; + }, + mod: function (a, b) { + if (!b) + return null; + return a % b; + }, + power: function (a, b) { + return Math.pow(a, b); + }, + greater: function (left, right) { + if (left == null || right == null) + return false; + return left > right; + }, + less: function (left, right) { + if (left == null || right == null) + return false; + return left < right; + }, + greaterorequal: function (left, right) { + if (OperandMaker.binaryFunctions.equal(left, right)) + return true; + return OperandMaker.binaryFunctions.greater(left, right); + }, + lessorequal: function (left, right) { + if (OperandMaker.binaryFunctions.equal(left, right)) + return true; + return OperandMaker.binaryFunctions.less(left, right); + }, + equal: function (left, right) { + return OperandMaker.isTwoValueEquals(left, right); + }, + notequal: function (left, right) { + return !OperandMaker.binaryFunctions.equal(left, right); + }, + contains: function (left, right) { + return OperandMaker.binaryFunctions.containsCore(left, right, true); + }, + notcontains: function (left, right) { + if (!left && !_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(right)) + return true; + return OperandMaker.binaryFunctions.containsCore(left, right, false); + }, + anyof: function (left, right) { + if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(left) && _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(right)) + return true; + if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(left) || + (!Array.isArray(left) && left.length === 0)) + return false; + if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(right)) + return true; + if (!Array.isArray(left)) + return OperandMaker.binaryFunctions.contains(right, left); + if (!Array.isArray(right)) + return OperandMaker.binaryFunctions.contains(left, right); + for (var i = 0; i < right.length; i++) { + if (OperandMaker.binaryFunctions.contains(left, right[i])) + return true; + } + return false; + }, + allof: function (left, right) { + if (!left && !_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(right)) + return false; + if (!Array.isArray(right)) + return OperandMaker.binaryFunctions.contains(left, right); + for (var i = 0; i < right.length; i++) { + if (!OperandMaker.binaryFunctions.contains(left, right[i])) + return false; + } + return true; + }, + containsCore: function (left, right, isContains) { + if (!left && left !== 0 && left !== false) + return false; + if (!left.length) { + left = left.toString(); + if (typeof right === "string" || right instanceof String) { + left = left.toUpperCase(); + right = right.toUpperCase(); + } + } + if (typeof left === "string" || left instanceof String) { + if (!right) + return false; + right = right.toString(); + var found = left.indexOf(right) > -1; + return isContains ? found : !found; + } + var rightArray = Array.isArray(right) ? right : [right]; + for (var rIndex = 0; rIndex < rightArray.length; rIndex++) { + var i = 0; + right = rightArray[rIndex]; + for (; i < left.length; i++) { + if (OperandMaker.isTwoValueEquals(left[i], right)) + break; + } + if (i == left.length) + return !isContains; + } + return isContains; + }, + }; + OperandMaker.signs = { + less: "<", + lessorequal: "<=", + greater: ">", + greaterorequal: ">=", + equal: "==", + notequal: "!=", + plus: "+", + minus: "-", + mul: "*", + div: "/", + and: "and", + or: "or", + power: "^", + mod: "%", + negate: "!", + }; + return OperandMaker; + }()); + + + + /***/ }), + + /***/ "./src/flowpanel.ts": + /*!**************************!*\ + !*** ./src/flowpanel.ts ***! + \**************************/ + /*! exports provided: FlowPanelModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FlowPanelModel", function() { return FlowPanelModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _panel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./panel */ "./src/panel.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + /** + * The flow panel object. It is a container with flow layout where you can mix questions with markdown text. + * + */ + var FlowPanelModel = /** @class */ (function (_super) { + __extends(FlowPanelModel, _super); + function FlowPanelModel(name) { + if (name === void 0) { name = ""; } + var _this = _super.call(this, name) || this; + _this.createLocalizableString("content", _this, true); + var self = _this; + _this.registerFunctionOnPropertyValueChanged("content", function () { + self.onContentChanged(); + }); + return _this; + } + FlowPanelModel.prototype.getType = function () { + return "flowpanel"; + }; + FlowPanelModel.prototype.getChildrenLayoutType = function () { + return "flow"; + }; + FlowPanelModel.prototype.onSurveyLoad = function () { + _super.prototype.onSurveyLoad.call(this); + this.onContentChanged(); + }; + Object.defineProperty(FlowPanelModel.prototype, "content", { + get: function () { + return this.getLocalizableStringText("content"); + }, + set: function (val) { + this.setLocalizableStringText("content", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(FlowPanelModel.prototype, "locContent", { + get: function () { + return this.getLocalizableString("content"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(FlowPanelModel.prototype, "html", { + get: function () { + return this.getPropertyValue("html", ""); + }, + set: function (val) { + this.setPropertyValue("html", val); + }, + enumerable: false, + configurable: true + }); + FlowPanelModel.prototype.onContentChanged = function () { + var html = ""; + if (!!this.onCustomHtmlProducing) { + html = this.onCustomHtmlProducing(); + } + else { + html = this.produceHtml(); + } + this.html = html; + if (!!this.contentChangedCallback) + this.contentChangedCallback(); + }; + FlowPanelModel.prototype.produceHtml = function () { + var html = []; + //contentElementNamePrefix + var regEx = /{(.*?(element:)[^$].*?)}/g; + var str = this.content; + var startIndex = 0; + var res = null; + while ((res = regEx.exec(str)) !== null) { + if (res.index > startIndex) { + html.push(str.substr(startIndex, res.index - startIndex)); + startIndex = res.index; + } + var question = this.getQuestionFromText(res[0]); + if (!!question) { + html.push(this.getHtmlForQuestion(question)); + } + else { + html.push(str.substr(startIndex, res.index + res[0].length - startIndex)); + } + startIndex = res.index + res[0].length; + } + if (startIndex < str.length) { + html.push(str.substr(startIndex, str.length - startIndex)); + } + return html.join("").replace(new RegExp("
", "g"), "
"); + }; + FlowPanelModel.prototype.getQuestionFromText = function (str) { + str = str.substr(1, str.length - 2); + str = str.replace(FlowPanelModel.contentElementNamePrefix, "").trim(); + return this.getQuestionByName(str); + }; + FlowPanelModel.prototype.getHtmlForQuestion = function (question) { + if (!!this.onGetHtmlForQuestion) + return this.onGetHtmlForQuestion(question); + return ""; + }; + FlowPanelModel.prototype.getQuestionHtmlId = function (question) { + return this.name + "_" + question.id; + }; + FlowPanelModel.prototype.onAddElement = function (element, index) { + _super.prototype.onAddElement.call(this, element, index); + this.addElementToContent(element); + element.renderWidth = ""; + }; + FlowPanelModel.prototype.onRemoveElement = function (element) { + var searchStr = this.getElementContentText(element); + this.content = this.content.replace(searchStr, ""); + _super.prototype.onRemoveElement.call(this, element); + }; + FlowPanelModel.prototype.dragDropMoveElement = function (src, target, targetIndex) { }; + FlowPanelModel.prototype.addElementToContent = function (element) { + if (this.isLoadingFromJson) + return; + var text = this.getElementContentText(element); + if (!this.insertTextAtCursor(text)) { + this.content = this.content + text; + } + }; + FlowPanelModel.prototype.insertTextAtCursor = function (text, prevName) { + if (prevName === void 0) { prevName = null; } + if (!this.isDesignMode || + typeof document === "undefined" || + !window.getSelection) + return false; + var sel = window.getSelection(); + if (sel.getRangeAt && sel.rangeCount) { + var range = sel.getRangeAt(0); + range.deleteContents(); + range.insertNode(document.createTextNode(text)); + var self = this; + if (self.getContent) { + var str = self.getContent(prevName); + this.content = str; + } + return true; + } + return false; + }; + FlowPanelModel.prototype.getElementContentText = function (element) { + return "{" + FlowPanelModel.contentElementNamePrefix + element.name + "}"; + }; + FlowPanelModel.contentElementNamePrefix = "element:"; + return FlowPanelModel; + }(_panel__WEBPACK_IMPORTED_MODULE_1__["PanelModel"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("flowpanel", [{ name: "content:html", serializationProperty: "locContent" }], function () { + return new FlowPanelModel(); + }, "panel"); + + + /***/ }), + + /***/ "./src/functionsfactory.ts": + /*!*********************************!*\ + !*** ./src/functionsfactory.ts ***! + \*********************************/ + /*! exports provided: FunctionFactory, registerFunction */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionFactory", function() { return FunctionFactory; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerFunction", function() { return registerFunction; }); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + + var FunctionFactory = /** @class */ (function () { + function FunctionFactory() { + this.functionHash = {}; + this.isAsyncHash = {}; + } + FunctionFactory.prototype.register = function (name, func, isAsync) { + if (isAsync === void 0) { isAsync = false; } + this.functionHash[name] = func; + if (isAsync) + this.isAsyncHash[name] = true; + }; + FunctionFactory.prototype.unregister = function (name) { + delete this.functionHash[name]; + delete this.isAsyncHash[name]; + }; + FunctionFactory.prototype.hasFunction = function (name) { + return !!this.functionHash[name]; + }; + FunctionFactory.prototype.isAsyncFunction = function (name) { + return !!this.isAsyncHash[name]; + }; + FunctionFactory.prototype.clear = function () { + this.functionHash = {}; + }; + FunctionFactory.prototype.getAll = function () { + var result = []; + for (var key in this.functionHash) { + result.push(key); + } + return result.sort(); + }; + FunctionFactory.prototype.run = function (name, params, properties) { + if (properties === void 0) { properties = null; } + var func = this.functionHash[name]; + if (!func) + return null; + var classRunner = { + func: func, + }; + if (properties) { + for (var key in properties) { + classRunner[key] = properties[key]; + } + } + return classRunner.func(params); + }; + FunctionFactory.Instance = new FunctionFactory(); + return FunctionFactory; + }()); + + var registerFunction = FunctionFactory.Instance.register; + function getParamsAsArray(value, arr) { + if (value === undefined || value === null) + return; + if (Array.isArray(value)) { + for (var i = 0; i < value.length; i++) { + getParamsAsArray(value[i], arr); + } + } + else { + if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(value)) { + value = parseFloat(value); + } + arr.push(value); + } + } + function sum(params) { + var arr = []; + getParamsAsArray(params, arr); + var res = 0; + for (var i = 0; i < arr.length; i++) { + res = _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].correctAfterPlusMinis(res, arr[i], res + arr[i]); + } + return res; + } + FunctionFactory.Instance.register("sum", sum); + function min_max(params, isMin) { + var arr = []; + getParamsAsArray(params, arr); + var res = undefined; + for (var i = 0; i < arr.length; i++) { + if (res === undefined) { + res = arr[i]; + } + if (isMin) { + if (res > arr[i]) + res = arr[i]; + } + else { + if (res < arr[i]) + res = arr[i]; + } + } + return res; + } + function min(params) { + return min_max(params, true); + } + FunctionFactory.Instance.register("min", min); + function max(params) { + return min_max(params, false); + } + FunctionFactory.Instance.register("max", max); + function count(params) { + var arr = []; + getParamsAsArray(params, arr); + return arr.length; + } + FunctionFactory.Instance.register("count", count); + function avg(params) { + var arr = []; + getParamsAsArray(params, arr); + var res = sum(params); + return arr.length > 0 ? res / arr.length : 0; + } + FunctionFactory.Instance.register("avg", avg); + function getInArrayParams(params) { + if (params.length != 2) + return null; + var arr = params[0]; + if (!arr) + return null; + if (!Array.isArray(arr) && !Array.isArray(Object.keys(arr))) + return null; + var name = params[1]; + if (typeof name !== "string" && !(name instanceof String)) + return null; + return { data: arr, name: name }; + } + function convertToNumber(val) { + if (typeof val === "string") + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(val) ? parseFloat(val) : undefined; + return val; + } + function processItemInArray(item, name, res, func, needToConvert) { + if (!item || _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(item[name])) + return res; + var val = needToConvert ? convertToNumber(item[name]) : 1; + return func(res, val); + } + function calcInArray(params, func, needToConvert) { + if (needToConvert === void 0) { needToConvert = true; } + var v = getInArrayParams(params); + if (!v) + return undefined; + var res = undefined; + if (Array.isArray(v.data)) { + for (var i = 0; i < v.data.length; i++) { + res = processItemInArray(v.data[i], v.name, res, func, needToConvert); + } + } + else { + for (var key in v.data) { + res = processItemInArray(v.data[key], v.name, res, func, needToConvert); + } + } + return res; + } + function sumInArray(params) { + var res = calcInArray(params, function (res, val) { + if (res == undefined) + res = 0; + if (val == undefined || val == null) + return res; + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].correctAfterPlusMinis(res, val, res + val); + }); + return res !== undefined ? res : 0; + } + FunctionFactory.Instance.register("sumInArray", sumInArray); + function minInArray(params) { + return calcInArray(params, function (res, val) { + if (res == undefined) + return val; + if (val == undefined || val == null) + return res; + return res < val ? res : val; + }); + } + FunctionFactory.Instance.register("minInArray", minInArray); + function maxInArray(params) { + return calcInArray(params, function (res, val) { + if (res == undefined) + return val; + if (val == undefined || val == null) + return res; + return res > val ? res : val; + }); + } + FunctionFactory.Instance.register("maxInArray", maxInArray); + function countInArray(params) { + var res = calcInArray(params, function (res, val) { + if (res == undefined) + res = 0; + if (val == undefined || val == null) + return res; + return res + 1; + }, false); + return res !== undefined ? res : 0; + } + FunctionFactory.Instance.register("countInArray", countInArray); + function avgInArray(params) { + var count = countInArray(params); + if (count == 0) + return 0; + return sumInArray(params) / count; + } + FunctionFactory.Instance.register("avgInArray", avgInArray); + function iif(params) { + if (!params && params.length !== 3) + return ""; + return params[0] ? params[1] : params[2]; + } + FunctionFactory.Instance.register("iif", iif); + function getDate(params) { + if (!params && params.length < 1) + return null; + if (!params[0]) + return null; + return new Date(params[0]); + } + FunctionFactory.Instance.register("getDate", getDate); + function age(params) { + if (!params && params.length < 1) + return null; + if (!params[0]) + return null; + var birthDate = new Date(params[0]); + var today = new Date(); + var age = today.getFullYear() - birthDate.getFullYear(); + var m = today.getMonth() - birthDate.getMonth(); + if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) { + age -= age > 0 ? 1 : 0; + } + return age; + } + FunctionFactory.Instance.register("age", age); + function isContainerReadyCore(container) { + if (!container) + return false; + var questions = container.questions; + for (var i = 0; i < questions.length; i++) { + if (questions[i].hasErrors(false)) + return false; + } + return true; + } + function isContainerReady(params) { + if (!params && params.length < 1) + return false; + if (!params[0] || !this.survey) + return false; + var name = params[0]; + var container = this.survey.getPageByName(name); + if (!container) + container = this.survey.getPanelByName(name); + if (!container) { + var question = this.survey.getQuestionByName(name); + if (!question || !Array.isArray(question.panels)) + return false; + if (params.length > 1) { + if (params[1] < question.panels.length) { + container = question.panels[params[1]]; + } + } + else { + for (var i = 0; i < question.panels.length; i++) { + if (!isContainerReadyCore(question.panels[i])) + return false; + } + return true; + } + } + return isContainerReadyCore(container); + } + FunctionFactory.Instance.register("isContainerReady", isContainerReady); + function isDisplayMode() { + return this.survey && this.survey.isDisplayMode; + } + FunctionFactory.Instance.register("isDisplayMode", isDisplayMode); + function currentDate() { + return new Date(); + } + FunctionFactory.Instance.register("currentDate", currentDate); + function today(params) { + var res = new Date(); + res.setUTCHours(0, 0, 0, 0); + if (Array.isArray(params) && params.length == 1) { + res.setDate(res.getDate() + params[0]); + } + return res; + } + FunctionFactory.Instance.register("today", today); + function getYear(params) { + if (params.length !== 1 || !params[0]) + return undefined; + return new Date(params[0]).getFullYear(); + } + FunctionFactory.Instance.register("getYear", getYear); + function currentYear() { + return new Date().getFullYear(); + } + FunctionFactory.Instance.register("currentYear", currentYear); + function diffDays(params) { + if (!Array.isArray(params) || params.length !== 2) + return 0; + if (!params[0] || !params[1]) + return 0; + var date1 = new Date(params[0]); + var date2 = new Date(params[1]); + var diffTime = Math.abs(date2 - date1); + return Math.ceil(diffTime / (1000 * 60 * 60 * 24)); + } + FunctionFactory.Instance.register("diffDays", diffDays); + + + /***/ }), + + /***/ "./src/helpers.ts": + /*!************************!*\ + !*** ./src/helpers.ts ***! + \************************/ + /*! exports provided: Helpers */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Helpers", function() { return Helpers; }); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + + var Helpers = /** @class */ (function () { + function Helpers() { + } + /** + * A static methods that returns true if a value undefined, null, empty string or empty array. + * @param value + */ + Helpers.isValueEmpty = function (value) { + if (Array.isArray(value) && value.length === 0) + return true; + if (!!value && typeof value === "object" && value.constructor === Object) { + for (var key in value) { + if (!Helpers.isValueEmpty(value[key])) + return false; + } + return true; + } + return !value && value !== 0 && value !== false; + }; + Helpers.isArrayContainsEqual = function (x, y) { + if (!Array.isArray(x) || !Array.isArray(y)) + return false; + if (x.length !== y.length) + return false; + for (var i = 0; i < x.length; i++) { + var j = 0; + for (; j < y.length; j++) { + if (Helpers.isTwoValueEquals(x[i], y[j])) + break; + } + if (j === y.length) + return false; + } + return true; + }; + Helpers.isArraysEqual = function (x, y, ignoreOrder, caseSensitive, trimStrings) { + if (ignoreOrder === void 0) { ignoreOrder = false; } + if (!Array.isArray(x) || !Array.isArray(y)) + return false; + if (x.length !== y.length) + return false; + if (ignoreOrder) { + var xSorted = []; + var ySorted = []; + for (var i = 0; i < x.length; i++) { + xSorted.push(x[i]); + ySorted.push(y[i]); + } + xSorted.sort(); + ySorted.sort(); + x = xSorted; + y = ySorted; + } + for (var i = 0; i < x.length; i++) { + if (!Helpers.isTwoValueEquals(x[i], y[i], ignoreOrder, caseSensitive, trimStrings)) + return false; + } + return true; + }; + Helpers.isTwoValueEquals = function (x, y, ignoreOrder, caseSensitive, trimStrings) { + if (ignoreOrder === void 0) { ignoreOrder = false; } + if (x === y) + return true; + if (Array.isArray(x) && x.length === 0 && typeof y === "undefined") + return true; + if (Array.isArray(y) && y.length === 0 && typeof x === "undefined") + return true; + if ((x === undefined || x === null) && y === "") + return true; + if ((y === undefined || y === null) && x === "") + return true; + if (trimStrings === undefined) + trimStrings = _settings__WEBPACK_IMPORTED_MODULE_0__["settings"].comparator.trimStrings; + if (caseSensitive === undefined) + caseSensitive = _settings__WEBPACK_IMPORTED_MODULE_0__["settings"].comparator.caseSensitive; + if (typeof x === "string" && typeof y === "string") { + if (trimStrings) { + x = x.trim(); + y = y.trim(); + } + if (!caseSensitive) { + x = x.toLowerCase(); + y = y.toLowerCase(); + } + return x === y; + } + if (x instanceof Date && y instanceof Date) + return x.getTime() == y.getTime(); + if (Helpers.isConvertibleToNumber(x) && Helpers.isConvertibleToNumber(y)) { + if (parseInt(x) === parseInt(y) && parseFloat(x) === parseFloat(y)) { + return true; + } + } + if ((!Helpers.isValueEmpty(x) && Helpers.isValueEmpty(y)) || + (Helpers.isValueEmpty(x) && !Helpers.isValueEmpty(y))) + return false; + if ((x === true || x === false) && typeof y == "string") { + return x.toString() === y.toLocaleLowerCase(); + } + if ((y === true || y === false) && typeof x == "string") { + return y.toString() === x.toLocaleLowerCase(); + } + if (!(x instanceof Object) && !(y instanceof Object)) + return x == y; + if (!(x instanceof Object) || !(y instanceof Object)) + return false; + if (x["equals"]) + return x.equals(y); + if (!!x.toJSON && !!y.toJSON && !!x.getType && !!y.getType) { + if (x.isDiposed || y.isDiposed) + return false; + if (x.getType() !== y.getType()) + return false; + if (!!x.name && x.name !== y.name) + return false; + return this.isTwoValueEquals(x.toJSON(), y.toJSON(), ignoreOrder, caseSensitive, trimStrings); + } + if (Array.isArray(x) && Array.isArray(y)) + return Helpers.isArraysEqual(x, y, ignoreOrder, caseSensitive, trimStrings); + if (!!x.equalsTo && y.equalsTo) + return x.equalsTo(y); + for (var p in x) { + if (!x.hasOwnProperty(p)) + continue; + if (!y.hasOwnProperty(p)) + return false; + if (x[p] === y[p]) + continue; + if (typeof x[p] !== "object") + return false; + if (!this.isTwoValueEquals(x[p], y[p])) + return false; + } + for (p in y) { + if (y.hasOwnProperty(p) && !x.hasOwnProperty(p)) + return false; + } + return true; + }; + Helpers.randomizeArray = function (array) { + for (var i = array.length - 1; i > 0; i--) { + var j = Math.floor(Math.random() * (i + 1)); + var temp = array[i]; + array[i] = array[j]; + array[j] = temp; + } + return array; + }; + Helpers.getUnbindValue = function (value) { + if (!!value && value instanceof Object) { + //do not return the same object instance!!! + return JSON.parse(JSON.stringify(value)); + } + return value; + }; + Helpers.createCopy = function (obj) { + var res = {}; + if (!obj) + return res; + for (var key in obj) { + res[key] = obj[key]; + } + return res; + }; + Helpers.isConvertibleToNumber = function (value) { + return (value !== undefined && + value !== null && + !Array.isArray(value) && + !isNaN(value)); + }; + Helpers.isNumber = function (value) { + if (typeof value == "string" && + !!value && + value.indexOf("0x") == 0 && + value.length > 32) + return false; + return !isNaN(parseFloat(value)) && isFinite(value); + }; + Helpers.getMaxLength = function (maxLength, surveyLength) { + if (maxLength < 0) { + maxLength = surveyLength; + } + return maxLength > 0 ? maxLength : null; + }; + Helpers.getNumberByIndex = function (index, startIndexStr) { + if (index < 0) + return ""; + var startIndex = 1; + var prefix = ""; + var postfix = "."; + var isNumeric = true; + var strIndex = "A"; + var str = ""; + if (!!startIndexStr) { + str = startIndexStr; + var ind = str.length - 1; + var hasDigit = false; + for (var i = 0; i < str.length; i++) { + if (Helpers.isCharDigit(str[i])) { + hasDigit = true; + break; + } + } + var checkLetter = function () { + return ((hasDigit && !Helpers.isCharDigit(str[ind])) || + Helpers.isCharNotLetterAndDigit(str[ind])); + }; + while (ind >= 0 && checkLetter()) + ind--; + var newPostfix = ""; + if (ind < str.length - 1) { + newPostfix = str.substr(ind + 1); + str = str.substr(0, ind + 1); + } + ind = str.length - 1; + while (ind >= 0) { + if (checkLetter()) + break; + ind--; + if (!hasDigit) + break; + } + strIndex = str.substr(ind + 1); + prefix = str.substr(0, ind + 1); + if (parseInt(strIndex)) + startIndex = parseInt(strIndex); + else if (strIndex.length == 1) + isNumeric = false; + if (!!newPostfix || !!prefix) { + postfix = newPostfix; + } + } + if (isNumeric) + return prefix + (index + startIndex).toString() + postfix; + return (prefix + String.fromCharCode(strIndex.charCodeAt(0) + index) + postfix); + }; + Helpers.isCharNotLetterAndDigit = function (ch) { + return ch.toUpperCase() == ch.toLowerCase() && !Helpers.isCharDigit(ch); + }; + Helpers.isCharDigit = function (ch) { + return ch >= "0" && ch <= "9"; + }; + Helpers.countDecimals = function (value) { + if (Helpers.isNumber(value) && Math.floor(value) !== value) { + var strs = value.toString().split("."); + return strs.length > 1 && strs[1].length || 0; + } + return 0; + }; + Helpers.correctAfterPlusMinis = function (a, b, res) { + var digitsA = Helpers.countDecimals(a); + var digitsB = Helpers.countDecimals(b); + if (digitsA > 0 || digitsB > 0) { + var digits = Math.max(digitsA, digitsB); + res = parseFloat(res.toFixed(digits)); + } + return res; + }; + Helpers.correctAfterMultiple = function (a, b, res) { + var digits = Helpers.countDecimals(a) + Helpers.countDecimals(b); + if (digits > 0) { + res = parseFloat(res.toFixed(digits)); + } + return res; + }; + return Helpers; + }()); + + if (!String.prototype["format"]) { + String.prototype["format"] = function () { + var args = arguments; + return this.replace(/{(\d+)}/g, function (match, number) { + return typeof args[number] != "undefined" ? args[number] : match; + }); + }; + } + + + /***/ }), + + /***/ "./src/images sync \\.svg$": + /*!*********************************************!*\ + !*** ./src/images sync nonrecursive \.svg$ ***! + \*********************************************/ + /*! no static exports found */ + /***/ (function(module, exports, __webpack_require__) { + + var map = { + "./ArrowDown_34x34.svg": "./src/images/ArrowDown_34x34.svg", + "./ArrowLeft.svg": "./src/images/ArrowLeft.svg", + "./ArrowRight.svg": "./src/images/ArrowRight.svg", + "./Arrow_downGREY_10x10.svg": "./src/images/Arrow_downGREY_10x10.svg", + "./ChooseFile.svg": "./src/images/ChooseFile.svg", + "./Clear.svg": "./src/images/Clear.svg", + "./DefaultFile.svg": "./src/images/DefaultFile.svg", + "./Delete.svg": "./src/images/Delete.svg", + "./Down_34x34.svg": "./src/images/Down_34x34.svg", + "./Left.svg": "./src/images/Left.svg", + "./ModernCheck.svg": "./src/images/ModernCheck.svg", + "./ModernRadio.svg": "./src/images/ModernRadio.svg", + "./More.svg": "./src/images/More.svg", + "./ProgressButton.svg": "./src/images/ProgressButton.svg", + "./ProgressButtonV2.svg": "./src/images/ProgressButtonV2.svg", + "./RemoveFile.svg": "./src/images/RemoveFile.svg", + "./Right.svg": "./src/images/Right.svg", + "./V2Check.svg": "./src/images/V2Check.svg", + "./V2DragElement_16x16.svg": "./src/images/V2DragElement_16x16.svg", + "./collapseDetail.svg": "./src/images/collapseDetail.svg", + "./expandDetail.svg": "./src/images/expandDetail.svg", + "./no-image.svg": "./src/images/no-image.svg", + "./search.svg": "./src/images/search.svg" + }; + + + function webpackContext(req) { + var id = webpackContextResolve(req); + return __webpack_require__(id); + } + function webpackContextResolve(req) { + if(!__webpack_require__.o(map, req)) { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + } + return map[req]; + } + webpackContext.keys = function webpackContextKeys() { + return Object.keys(map); + }; + webpackContext.resolve = webpackContextResolve; + module.exports = webpackContext; + webpackContext.id = "./src/images sync \\.svg$"; + + /***/ }), + + /***/ "./src/images/ArrowDown_34x34.svg": + /*!****************************************!*\ + !*** ./src/images/ArrowDown_34x34.svg ***! + \****************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/ArrowLeft.svg": + /*!**********************************!*\ + !*** ./src/images/ArrowLeft.svg ***! + \**********************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/ArrowRight.svg": + /*!***********************************!*\ + !*** ./src/images/ArrowRight.svg ***! + \***********************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/Arrow_downGREY_10x10.svg": + /*!*********************************************!*\ + !*** ./src/images/Arrow_downGREY_10x10.svg ***! + \*********************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/ChooseFile.svg": + /*!***********************************!*\ + !*** ./src/images/ChooseFile.svg ***! + \***********************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/Clear.svg": + /*!******************************!*\ + !*** ./src/images/Clear.svg ***! + \******************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/DefaultFile.svg": + /*!************************************!*\ + !*** ./src/images/DefaultFile.svg ***! + \************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/Delete.svg": + /*!*******************************!*\ + !*** ./src/images/Delete.svg ***! + \*******************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/Down_34x34.svg": + /*!***********************************!*\ + !*** ./src/images/Down_34x34.svg ***! + \***********************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/Left.svg": + /*!*****************************!*\ + !*** ./src/images/Left.svg ***! + \*****************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/ModernCheck.svg": + /*!************************************!*\ + !*** ./src/images/ModernCheck.svg ***! + \************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/ModernRadio.svg": + /*!************************************!*\ + !*** ./src/images/ModernRadio.svg ***! + \************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/More.svg": + /*!*****************************!*\ + !*** ./src/images/More.svg ***! + \*****************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/ProgressButton.svg": + /*!***************************************!*\ + !*** ./src/images/ProgressButton.svg ***! + \***************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/ProgressButtonV2.svg": + /*!*****************************************!*\ + !*** ./src/images/ProgressButtonV2.svg ***! + \*****************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/RemoveFile.svg": + /*!***********************************!*\ + !*** ./src/images/RemoveFile.svg ***! + \***********************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/Right.svg": + /*!******************************!*\ + !*** ./src/images/Right.svg ***! + \******************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/V2Check.svg": + /*!********************************!*\ + !*** ./src/images/V2Check.svg ***! + \********************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/V2DragElement_16x16.svg": + /*!********************************************!*\ + !*** ./src/images/V2DragElement_16x16.svg ***! + \********************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/collapseDetail.svg": + /*!***************************************!*\ + !*** ./src/images/collapseDetail.svg ***! + \***************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/expandDetail.svg": + /*!*************************************!*\ + !*** ./src/images/expandDetail.svg ***! + \*************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/no-image.svg": + /*!*********************************!*\ + !*** ./src/images/no-image.svg ***! + \*********************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/images/search.svg": + /*!*******************************!*\ + !*** ./src/images/search.svg ***! + \*******************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/itemvalue.ts": + /*!**************************!*\ + !*** ./src/itemvalue.ts ***! + \**************************/ + /*! exports provided: ItemValue */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ItemValue", function() { return ItemValue; }); + /* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + + + + + + /** + * Array of ItemValue is used in checkox, dropdown and radiogroup choices, matrix columns and rows. + * It has two main properties: value and text. If text is empty, value is used for displaying. + * The text property is localizable and support markdown. + */ + var ItemValue = /** @class */ (function (_super) { + __extends(ItemValue, _super); + function ItemValue(value, text, typeName) { + if (text === void 0) { text = null; } + if (typeName === void 0) { typeName = "itemvalue"; } + var _this = _super.call(this) || this; + _this.typeName = typeName; + _this.ownerPropertyName = ""; + _this.isVisibleValue = true; + _this.locTextValue = new _localizablestring__WEBPACK_IMPORTED_MODULE_0__["LocalizableString"](_this, true, "text"); + _this.locTextValue.onStrChanged = function (oldValue, newValue) { + if (newValue == _this.value) { + newValue = undefined; + } + _this.propertyValueChanged("text", oldValue, newValue); + }; + _this.locTextValue.onGetTextCallback = function (txt) { + return txt + ? txt + : !_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(_this.value) + ? _this.value.toString() + : null; + }; + if (text) + _this.locText.text = text; + if (!!value && typeof value === "object") { + _this.setData(value); + } + else { + _this.value = value; + } + if (_this.getType() != "itemvalue") { + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["CustomPropertiesCollection"].createProperties(_this); + } + _this.onCreating(); + return _this; + } + ItemValue.prototype.getMarkdownHtml = function (text, name) { + return !!this.locOwner ? this.locOwner.getMarkdownHtml(text, name) : null; + }; + ItemValue.prototype.getRenderer = function (name) { + return !!this.locOwner ? this.locOwner.getRenderer(name) : null; + }; + ItemValue.prototype.getRendererContext = function (locStr) { + return !!this.locOwner ? this.locOwner.getRendererContext(locStr) : locStr; + }; + ItemValue.prototype.getProcessedText = function (text) { + return this.locOwner ? this.locOwner.getProcessedText(text) : text; + }; + Object.defineProperty(ItemValue, "Separator", { + get: function () { + return _settings__WEBPACK_IMPORTED_MODULE_5__["settings"].itemValueSeparator; + }, + set: function (val) { + _settings__WEBPACK_IMPORTED_MODULE_5__["settings"].itemValueSeparator = val; + }, + enumerable: false, + configurable: true + }); + ItemValue.createArray = function (locOwner) { + var items = []; + ItemValue.setupArray(items, locOwner); + return items; + }; + ItemValue.setupArray = function (items, locOwner) { + items.push = function (value) { + var result = Array.prototype.push.call(this, value); + value.locOwner = locOwner; + return result; + }; + items.unshift = function (value) { + var result = Array.prototype.unshift.call(this, value); + value.locOwner = locOwner; + return result; + }; + items.splice = function (start, deleteCount) { + var _a; + var items = []; + for (var _i = 2; _i < arguments.length; _i++) { + items[_i - 2] = arguments[_i]; + } + var result = (_a = Array.prototype.splice).call.apply(_a, __spreadArray([this, + start, + deleteCount], items, false)); + if (!items) + items = []; + for (var i = 0; i < items.length; i++) { + items[i].locOwner = locOwner; + } + return result; + }; + }; + /** + * Resets the input array and fills it with values from the values array + */ + ItemValue.setData = function (items, values, type) { + items.length = 0; + for (var i = 0; i < values.length; i++) { + var value = values[i]; + var itemType = !!value && typeof value.getType === "function" ? value.getType() : (type !== null && type !== void 0 ? type : "itemvalue"); + var item = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass(itemType); + item.setData(value); + if (!!value.originalItem) { + item.originalItem = value.originalItem; + } + items.push(item); + } + }; + ItemValue.getData = function (items) { + var result = []; + for (var i = 0; i < items.length; i++) { + result.push(items[i].getData()); + } + return result; + }; + ItemValue.getItemByValue = function (items, val) { + if (!Array.isArray(items)) + return null; + var valIsEmpty = _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(val); + for (var i = 0; i < items.length; i++) { + if (valIsEmpty && _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(items[i].value)) + return items[i]; + if (_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isTwoValueEquals(items[i].value, val, false, true, false)) + return items[i]; + } + return null; + }; + ItemValue.getTextOrHtmlByValue = function (items, val) { + var item = ItemValue.getItemByValue(items, val); + return item !== null ? item.locText.textOrHtml : ""; + }; + ItemValue.locStrsChanged = function (items) { + for (var i = 0; i < items.length; i++) { + items[i].locStrsChanged(); + } + }; + ItemValue.runConditionsForItems = function (items, filteredItems, runner, values, properties, useItemExpression, onItemCallBack) { + if (useItemExpression === void 0) { useItemExpression = true; } + return ItemValue.runConditionsForItemsCore(items, filteredItems, runner, values, properties, true, useItemExpression, onItemCallBack); + }; + ItemValue.runEnabledConditionsForItems = function (items, runner, values, properties, onItemCallBack) { + return ItemValue.runConditionsForItemsCore(items, null, runner, values, properties, false, true, onItemCallBack); + }; + ItemValue.runConditionsForItemsCore = function (items, filteredItems, runner, values, properties, isVisible, useItemExpression, onItemCallBack) { + if (useItemExpression === void 0) { useItemExpression = true; } + if (!values) { + values = {}; + } + var itemValue = values["item"]; + var choiceValue = values["choice"]; + var hasChanded = false; + for (var i = 0; i < items.length; i++) { + var item = items[i]; + values["item"] = item.value; + values["choice"] = item.value; + var itemRunner = useItemExpression && !!item.getConditionRunner + ? item.getConditionRunner(isVisible) + : false; + if (!itemRunner) { + itemRunner = runner; + } + var newValue = true; + if (itemRunner) { + newValue = itemRunner.run(values, properties); + } + if (!!onItemCallBack) { + newValue = onItemCallBack(item, newValue); + } + if (!!filteredItems && newValue) { + filteredItems.push(item); + } + var oldValue = isVisible ? item.isVisible : item.isEnabled; + if (newValue != oldValue) { + hasChanded = true; + if (isVisible) { + if (!!item.setIsVisible) + item.setIsVisible(newValue); + } + else { + if (!!item.setIsEnabled) + item.setIsEnabled(newValue); + } + } + } + if (itemValue) { + values["item"] = itemValue; + } + else { + delete values["item"]; + } + if (choiceValue) { + values["choice"] = choiceValue; + } + else { + delete values["choice"]; + } + return hasChanded; + }; + ItemValue.prototype.onCreating = function () { }; + ItemValue.prototype.getType = function () { + return !!this.typeName ? this.typeName : "itemvalue"; + }; + ItemValue.prototype.getSurvey = function (live) { + return !!this.locOwner && !!this.locOwner["getSurvey"] + ? this.locOwner.getSurvey() + : null; + }; + ItemValue.prototype.getLocale = function () { + return !!this.locOwner && this.locOwner.getLocale ? this.locOwner.getLocale() : ""; + }; + Object.defineProperty(ItemValue.prototype, "locText", { + get: function () { + return this.locTextValue; + }, + enumerable: false, + configurable: true + }); + ItemValue.prototype.setLocText = function (locText) { + this.locTextValue = locText; + }; + Object.defineProperty(ItemValue.prototype, "locOwner", { + get: function () { + return this._locOwner; + }, + set: function (value) { + this._locOwner = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ItemValue.prototype, "value", { + get: function () { + return this.getPropertyValue("value"); + }, + set: function (newValue) { + var text = undefined; + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(newValue)) { + var str = newValue.toString(); + var index = str.indexOf(_settings__WEBPACK_IMPORTED_MODULE_5__["settings"].itemValueSeparator); + if (index > -1) { + newValue = str.slice(0, index); + text = str.slice(index + 1); + } + } + this.setPropertyValue("value", newValue); + if (!!text) { + this.text = text; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ItemValue.prototype, "hasText", { + get: function () { + return this.locText.pureText ? true : false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ItemValue.prototype, "pureText", { + get: function () { + return this.locText.pureText; + }, + set: function (val) { + this.text = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ItemValue.prototype, "text", { + get: function () { + return this.locText.calculatedText; //TODO: it will be correct to use this.locText.text, however it would require a lot of rewriting in Creator + }, + set: function (newText) { + this.locText.text = newText; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ItemValue.prototype, "calculatedText", { + get: function () { + return this.locText.calculatedText; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ItemValue.prototype, "shortcutText", { + get: function () { + return this.text; + }, + enumerable: false, + configurable: true + }); + ItemValue.prototype.canSerializeValue = function () { + var val = this.value; + if (val === undefined || val === null) + return false; + return !Array.isArray(val) && typeof val !== "object"; + }; + ItemValue.prototype.getData = function () { + var json = this.toJSON(); + if (!!json["value"] && !!json["value"]["pos"]) { + delete json["value"]["pos"]; + } + if (_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(json.value)) + return json; + var canSerializeVal = this.canSerializeValue(); + var canSerializeAsContant = !canSerializeVal || !_settings__WEBPACK_IMPORTED_MODULE_5__["settings"].itemValueAlwaysSerializeAsObject && !_settings__WEBPACK_IMPORTED_MODULE_5__["settings"].itemValueAlwaysSerializeText; + if (canSerializeAsContant && Object.keys(json).length == 1) + return this.value; + if (_settings__WEBPACK_IMPORTED_MODULE_5__["settings"].itemValueAlwaysSerializeText && json.text === undefined && canSerializeVal) { + json.text = this.value.toString(); + } + return json; + }; + ItemValue.prototype.toJSON = function () { + var res = {}; + var properties = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].getProperties(this.getType()); + if (!properties || properties.length == 0) { + properties = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].getProperties("itemvalue"); + } + var jsoObj = new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"](); + for (var i = 0; i < properties.length; i++) { + var prop = properties[i]; + if (prop.name === "text" && !this.locText.hasNonDefaultText() && + _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isTwoValueEquals(this.value, this.text, false, true, false)) + continue; + jsoObj.valueToJson(this, res, prop); + } + return res; + }; + ItemValue.prototype.setData = function (value) { + if (_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(value)) + return; + if (typeof value.value !== "undefined") { + var json = void 0; + if (typeof value.toJSON === "function") { + json = value.toJSON(); + } + else { + json = value; + } + new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"]().toObject(json, this); + } + else { + this.value = value; + } + this.locText.strChanged(); + }; + Object.defineProperty(ItemValue.prototype, "visibleIf", { + get: function () { + return this.getPropertyValue("visibleIf", ""); + }, + set: function (val) { + this.setPropertyValue("visibleIf", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ItemValue.prototype, "enableIf", { + get: function () { + return this.getPropertyValue("enableIf", ""); + }, + set: function (val) { + this.setPropertyValue("enableIf", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ItemValue.prototype, "isVisible", { + get: function () { + return this.isVisibleValue; + }, + enumerable: false, + configurable: true + }); + ItemValue.prototype.setIsVisible = function (val) { + this.isVisibleValue = val; + }; + Object.defineProperty(ItemValue.prototype, "isEnabled", { + get: function () { + return this.getPropertyValue("isEnabled", true); + }, + enumerable: false, + configurable: true + }); + ItemValue.prototype.setIsEnabled = function (val) { + this.setPropertyValue("isEnabled", val); + }; + ItemValue.prototype.addUsedLocales = function (locales) { + this.AddLocStringToUsedLocales(this.locTextValue, locales); + }; + ItemValue.prototype.locStrsChanged = function () { + _super.prototype.locStrsChanged.call(this); + this.locText.strChanged(); + }; + ItemValue.prototype.onPropertyValueChanged = function (name, oldValue, newValue) { + if (name === "value" && !this.hasText) { + this.locText.onChanged(); + } + var funcName = "itemValuePropertyChanged"; + if (!this.locOwner || !this.locOwner[funcName]) + return; + this.locOwner[funcName](this, name, oldValue, newValue); + }; + ItemValue.prototype.getConditionRunner = function (isVisible) { + if (isVisible) + return this.getVisibleConditionRunner(); + return this.getEnableConditionRunner(); + }; + ItemValue.prototype.getVisibleConditionRunner = function () { + if (!this.visibleIf) + return null; + if (!this.visibleConditionRunner) + this.visibleConditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__["ConditionRunner"](this.visibleIf); + this.visibleConditionRunner.expression = this.visibleIf; + return this.visibleConditionRunner; + }; + ItemValue.prototype.getEnableConditionRunner = function () { + if (!this.enableIf) + return null; + if (!this.enableConditionRunner) + this.enableConditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_3__["ConditionRunner"](this.enableIf); + this.enableConditionRunner.expression = this.enableIf; + return this.enableConditionRunner; + }; + return ItemValue; + }(_base__WEBPACK_IMPORTED_MODULE_4__["Base"])); + + _base__WEBPACK_IMPORTED_MODULE_4__["Base"].createItemValue = function (source, type) { + var item = null; + if (!!type) { + item = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"].metaData.createClass(type, {}); + } + else if (typeof source.getType === "function") { + item = new ItemValue(null, undefined, source.getType()); + } + else { + item = new ItemValue(null); + } + item.setData(source); + return item; + }; + _base__WEBPACK_IMPORTED_MODULE_4__["Base"].itemValueLocStrChanged = function (arr) { + ItemValue.locStrsChanged(arr); + }; + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObjectProperty"].getItemValuesDefaultValue = function (val, type) { + var res = new Array(); + ItemValue.setData(res, Array.isArray(val) ? val : [], type); + return res; + }; + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("itemvalue", [ + "!value", + { + name: "text", + serializationProperty: "locText", + }, + { name: "visibleIf:condition", showMode: "form" }, + { + name: "enableIf:condition", + showMode: "form", + visibleIf: function (obj) { + return !obj || obj.ownerPropertyName !== "rateValues"; + }, + }, + ], function (value) { return new ItemValue(value); }); + + + /***/ }), + + /***/ "./src/jsonobject.ts": + /*!***************************!*\ + !*** ./src/jsonobject.ts ***! + \***************************/ + /*! exports provided: property, propertyArray, JsonObjectProperty, CustomPropertiesCollection, JsonMetadataClass, JsonMetadata, JsonError, JsonUnknownPropertyError, JsonMissingTypeErrorBase, JsonMissingTypeError, JsonIncorrectTypeError, JsonRequiredPropertyError, JsonObject, Serializer */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return property; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "propertyArray", function() { return propertyArray; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonObjectProperty", function() { return JsonObjectProperty; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CustomPropertiesCollection", function() { return CustomPropertiesCollection; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonMetadataClass", function() { return JsonMetadataClass; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonMetadata", function() { return JsonMetadata; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonError", function() { return JsonError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonUnknownPropertyError", function() { return JsonUnknownPropertyError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonMissingTypeErrorBase", function() { return JsonMissingTypeErrorBase; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonMissingTypeError", function() { return JsonMissingTypeError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonIncorrectTypeError", function() { return JsonIncorrectTypeError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonRequiredPropertyError", function() { return JsonRequiredPropertyError; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonObject", function() { return JsonObject; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Serializer", function() { return Serializer; }); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + + + function ensureLocString(target, options, key) { + var locString = target.getLocalizableString(key); + if (!locString) { + locString = target.createLocalizableString(key, target, true); + if (typeof options.localizable === "object" && + typeof options.localizable.onGetTextCallback === "function") { + locString.onGetTextCallback = options.localizable.onGetTextCallback; + } + } + } + function getLocStringValue(target, options, key) { + ensureLocString(target, options, key); + var res = target.getLocalizableStringText(key); + if (!!res) + return res; + if (typeof options.localizable === "object" && options.localizable.defaultStr) + return _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString(options.localizable.defaultStr); + return ""; + } + function property(options) { + return function (target, key) { + var processComputedUpdater = function (obj, val) { + if (!!val && typeof val === "object" && val.type === _base__WEBPACK_IMPORTED_MODULE_1__["ComputedUpdater"].ComputedUpdaterType) { + _base__WEBPACK_IMPORTED_MODULE_1__["Base"].startCollectDependencies(function () { return obj[key] = val.updater(); }, obj, key); + var result = val.updater(); + var dependencies = _base__WEBPACK_IMPORTED_MODULE_1__["Base"].finishCollectDependencies(); + val.setDependencies(dependencies); + return result; + } + return val; + }; + if (!options || !options.localizable) { + Object.defineProperty(target, key, { + get: function () { + var value = this.getPropertyValue(key); + if (value !== undefined) { + return value; + } + if (!!options) { + if (typeof options.getDefaultValue === "function") { + return options.getDefaultValue(this); + } + if (options.defaultValue !== undefined) { + return options.defaultValue; + } + } + return undefined; + }, + set: function (val) { + var newValue = processComputedUpdater(this, val); + this.setPropertyValue(key, newValue); + if (!!options && options.onSet) { + options.onSet(newValue, this); + } + }, + }); + } + else { + Object.defineProperty(target, key, { + get: function () { + return getLocStringValue(this, options, key); + }, + set: function (val) { + ensureLocString(this, options, key); + var newValue = processComputedUpdater(this, val); + this.setLocalizableStringText(key, newValue); + if (!!options && options.onSet) { + options.onSet(newValue, this); + } + }, + }); + Object.defineProperty(target, typeof options.localizable === "object" && !!options.localizable.name ? + options.localizable.name : "loc" + key.charAt(0).toUpperCase() + key.slice(1), { + get: function () { + ensureLocString(this, options, key); + return this.getLocalizableString(key); + }, + }); + } + }; + } + function ensureArray(target, options, key) { + target.ensureArray(key, function (item, index) { + var handler = !!options ? options.onPush : null; + handler && handler(item, index, target); + }, function (item, index) { + var handler = !!options ? options.onRemove : null; + handler && handler(item, index, target); + }); + } + function propertyArray(options) { + return function (target, key) { + Object.defineProperty(target, key, { + get: function () { + ensureArray(this, options, key); + return this.getPropertyValue(key); + }, + set: function (val) { + ensureArray(this, options, key); + var arr = this.getPropertyValue(key); + if (val === arr) { + return; + } + if (arr) { + arr.splice.apply(arr, __spreadArray([0, arr.length], (val || []), false)); + } + else { + this.setPropertyValue(key, val); + } + if (!!options && options.onSet) { + options.onSet(val, this); + } + }, + }); + }; + } + /** + * Contains information about a property of a survey element (page, panel, questions, and etc). + * @see addProperty + * @see removeProperty + * @see [Add Properties](https://surveyjs.io/Documentation/Survey-Creator#addproperties) + * @see [Remove Properties](https://surveyjs.io/Documentation/Survey-Creator#removeproperties) + */ + var JsonObjectProperty = /** @class */ (function () { + function JsonObjectProperty(classInfo, name, isRequired) { + if (isRequired === void 0) { isRequired = false; } + this.name = name; + this.isRequiredValue = false; + this.isUniqueValue = false; + this.isSerializable = true; + this.isLightSerializable = true; + this.isCustom = false; + this.isDynamicChoices = false; //TODO obsolete, use dependsOn attribute + this.isBindable = false; + this.category = ""; + this.categoryIndex = -1; + this.visibleIndex = -1; + this.maxLength = -1; + this.isArray = false; + this.classInfoValue = classInfo; + this.isRequiredValue = isRequired; + this.idValue = JsonObjectProperty.Index++; + } + Object.defineProperty(JsonObjectProperty.prototype, "id", { + get: function () { + return this.idValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(JsonObjectProperty.prototype, "classInfo", { + get: function () { + return this.classInfoValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(JsonObjectProperty.prototype, "type", { + get: function () { + return this.typeValue ? this.typeValue : "string"; + }, + set: function (value) { + if (value === "itemvalues") + value = "itemvalue[]"; + if (value === "textitems") + value = "textitem[]"; + this.typeValue = value; + if (this.typeValue.indexOf("[]") === this.typeValue.length - 2) { + this.isArray = true; + this.className = this.typeValue.substr(0, this.typeValue.length - 2); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(JsonObjectProperty.prototype, "isRequired", { + get: function () { + return this.isRequiredValue; + }, + set: function (val) { + this.isRequiredValue = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(JsonObjectProperty.prototype, "isUnique", { + get: function () { + return this.isUniqueValue; + }, + set: function (val) { + this.isUniqueValue = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(JsonObjectProperty.prototype, "hasToUseGetValue", { + get: function () { + return this.onGetValue || this.serializationProperty; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(JsonObjectProperty.prototype, "defaultValue", { + get: function () { + var result = this.defaultValueValue; + if (!!JsonObjectProperty.getItemValuesDefaultValue && + JsonObject.metaData.isDescendantOf(this.className, "itemvalue")) { + result = JsonObjectProperty.getItemValuesDefaultValue(this.defaultValueValue || [], this.className); + } + return result; + }, + set: function (newValue) { + this.defaultValueValue = newValue; + }, + enumerable: false, + configurable: true + }); + JsonObjectProperty.prototype.isDefaultValue = function (value) { + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(this.defaultValue)) { + return _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isTwoValueEquals(value, this.defaultValue, false, true, false); + } + return ((value === false && (this.type == "boolean" || this.type == "switch")) || + value === "" || + _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(value)); + }; + JsonObjectProperty.prototype.getValue = function (obj) { + if (this.onGetValue) + return this.onGetValue(obj); + if (this.serializationProperty && !!obj[this.serializationProperty]) + return obj[this.serializationProperty].getJson(); + return obj[this.name]; + }; + JsonObjectProperty.prototype.getPropertyValue = function (obj) { + if (this.isLocalizable) { + return !!obj[this.serializationProperty] + ? obj[this.serializationProperty].text + : null; + } + return this.getValue(obj); + }; + Object.defineProperty(JsonObjectProperty.prototype, "hasToUseSetValue", { + get: function () { + return this.onSetValue || this.serializationProperty; + }, + enumerable: false, + configurable: true + }); + JsonObjectProperty.prototype.setValue = function (obj, value, jsonConv) { + if (this.onSetValue) { + this.onSetValue(obj, value, jsonConv); + } + else { + if (this.serializationProperty && !!obj[this.serializationProperty]) + obj[this.serializationProperty].setJson(value); + else { + if (value && typeof value === "string") { + if (this.type == "number") { + value = parseInt(value); + } + if (this.type == "boolean" || this.type == "switch") { + value = value.toLowerCase() === "true"; + } + } + obj[this.name] = value; + } + } + }; + JsonObjectProperty.prototype.getObjType = function (objType) { + if (!this.classNamePart) + return objType; + return objType.replace(this.classNamePart, ""); + }; + JsonObjectProperty.prototype.getClassName = function (className) { + if (className) + className = className.toLowerCase(); + return this.classNamePart && className.indexOf(this.classNamePart) < 0 + ? className + this.classNamePart + : className; + }; + Object.defineProperty(JsonObjectProperty.prototype, "choices", { + /** + * Depricated, please use getChoices + */ + get: function () { + return this.getChoices(null); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(JsonObjectProperty.prototype, "hasChoices", { + get: function () { + return !!this.choicesValue || !!this.choicesfunc; + }, + enumerable: false, + configurable: true + }); + JsonObjectProperty.prototype.getChoices = function (obj, choicesCallback) { + if (choicesCallback === void 0) { choicesCallback = null; } + if (this.choicesValue != null) + return this.choicesValue; + if (this.choicesfunc != null) + return this.choicesfunc(obj, choicesCallback); + return null; + }; + JsonObjectProperty.prototype.setChoices = function (value, valueFunc) { + if (valueFunc === void 0) { valueFunc = null; } + this.choicesValue = value; + this.choicesfunc = valueFunc; + }; + JsonObjectProperty.prototype.getBaseValue = function () { + if (!this.baseValue) + return ""; + if (typeof this.baseValue == "function") + return this.baseValue(); + return this.baseValue; + }; + JsonObjectProperty.prototype.setBaseValue = function (val) { + this.baseValue = val; + }; + Object.defineProperty(JsonObjectProperty.prototype, "readOnly", { + get: function () { + return this.readOnlyValue != null ? this.readOnlyValue : false; + }, + set: function (val) { + this.readOnlyValue = val; + }, + enumerable: false, + configurable: true + }); + JsonObjectProperty.prototype.isVisible = function (layout, obj) { + if (obj === void 0) { obj = null; } + var isLayout = !this.layout || this.layout == layout; + if (!this.visible || !isLayout) + return false; + if (!!this.visibleIf && !!obj) + return this.visibleIf(obj); + return true; + }; + Object.defineProperty(JsonObjectProperty.prototype, "visible", { + get: function () { + return this.visibleValue != null ? this.visibleValue : true; + }, + set: function (val) { + this.visibleValue = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(JsonObjectProperty.prototype, "isLocalizable", { + get: function () { + return this.isLocalizableValue != null ? this.isLocalizableValue : false; + }, + set: function (val) { + this.isLocalizableValue = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(JsonObjectProperty.prototype, "dataList", { + get: function () { + return Array.isArray(this.dataListValue) ? this.dataListValue : []; + }, + set: function (val) { + this.dataListValue = val; + }, + enumerable: false, + configurable: true + }); + JsonObjectProperty.prototype.mergeWith = function (prop) { + var valuesNames = JsonObjectProperty.mergableValues; + for (var i = 0; i < valuesNames.length; i++) { + this.mergeValue(prop, valuesNames[i]); + } + }; + JsonObjectProperty.prototype.addDependedProperty = function (name) { + if (!this.dependedProperties) { + this.dependedProperties = []; + } + if (this.dependedProperties.indexOf(name) < 0) { + this.dependedProperties.push(name); + } + }; + JsonObjectProperty.prototype.getDependedProperties = function () { + return !!this.dependedProperties ? this.dependedProperties : []; + }; + JsonObjectProperty.prototype.schemaType = function () { + if (!!this.className) + return "array"; + if (!!this.baseClassName) + return "array"; + if (this.type == "boolean" || this.type == "number") + return this.type; + return "string"; + }; + JsonObjectProperty.prototype.mergeValue = function (prop, valueName) { + if (this[valueName] == null && prop[valueName] != null) { + this[valueName] = prop[valueName]; + } + }; + JsonObjectProperty.Index = 1; + JsonObjectProperty.mergableValues = [ + "typeValue", + "choicesValue", + "baseValue", + "readOnlyValue", + "visibleValue", + "isSerializable", + "isLightSerializable", + "isCustom", + "isBindable", + "isUnique", + "isDynamicChoices", + "isLocalizableValue", + "className", + "alternativeName", + "layout", + "classNamePart", + "baseClassName", + "defaultValue", + "serializationProperty", + "onGetValue", + "onSetValue", + "displayName", + "category", + "categoryIndex", + "visibleIndex", + "nextToProperty", + "showMode", + "dependedProperties", + "visibleIf", + "onExecuteExpression", + "onPropertyEditorUpdate", + "maxLength", + "maxValue", + "minValue", + "dataListValue", + ]; + return JsonObjectProperty; + }()); + + var CustomPropertiesCollection = /** @class */ (function () { + function CustomPropertiesCollection() { + } + CustomPropertiesCollection.addProperty = function (className, property) { + className = className.toLowerCase(); + var props = CustomPropertiesCollection.properties; + if (!props[className]) { + props[className] = []; + } + props[className].push(property); + }; + CustomPropertiesCollection.removeProperty = function (className, propertyName) { + className = className.toLowerCase(); + var props = CustomPropertiesCollection.properties; + if (!props[className]) + return; + var properties = props[className]; + for (var i = 0; i < properties.length; i++) { + if (properties[i].name == propertyName) { + props[className].splice(i, 1); + break; + } + } + }; + CustomPropertiesCollection.addClass = function (className, parentClassName) { + className = className.toLowerCase(); + if (parentClassName) { + parentClassName = parentClassName.toLowerCase(); + } + CustomPropertiesCollection.parentClasses[className] = parentClassName; + }; + CustomPropertiesCollection.getProperties = function (className) { + className = className.toLowerCase(); + var res = []; + var props = CustomPropertiesCollection.properties; + while (className) { + var properties = props[className]; + if (properties) { + for (var i = 0; i < properties.length; i++) { + res.push(properties[i]); + } + } + className = CustomPropertiesCollection.parentClasses[className]; + } + return res; + }; + CustomPropertiesCollection.createProperties = function (obj) { + if (!obj || !obj.getType) + return; + CustomPropertiesCollection.createPropertiesCore(obj, obj.getType()); + }; + CustomPropertiesCollection.createPropertiesCore = function (obj, className) { + var props = CustomPropertiesCollection.properties; + if (props[className]) { + CustomPropertiesCollection.createPropertiesInObj(obj, props[className]); + } + var parentClass = CustomPropertiesCollection.parentClasses[className]; + if (parentClass) { + CustomPropertiesCollection.createPropertiesCore(obj, parentClass); + } + }; + CustomPropertiesCollection.createPropertiesInObj = function (obj, properties) { + for (var i = 0; i < properties.length; i++) { + CustomPropertiesCollection.createPropertyInObj(obj, properties[i]); + } + }; + CustomPropertiesCollection.createPropertyInObj = function (obj, prop) { + if (obj[prop.name] || obj.hasOwnProperty(prop.name)) + return; + if (prop.isLocalizable && + prop.serializationProperty && + !obj[prop.serializationProperty] && + obj.createCustomLocalizableObj) { + obj.createCustomLocalizableObj(prop.name); + var locDesc = { + get: function () { + return obj.getLocalizableString(prop.name); + }, + }; + Object.defineProperty(obj, prop.serializationProperty, locDesc); + var desc = { + get: function () { + return obj.getLocalizableStringText(prop.name, prop.defaultValue); + }, + set: function (v) { + obj.setLocalizableStringText(prop.name, v); + }, + }; + Object.defineProperty(obj, prop.name, desc); + } + else { + var defaultValue = prop.defaultValue; + var isArrayProp = false; + if (typeof obj.createNewArray === "function") { + if (JsonObject.metaData.isDescendantOf(prop.className, "itemvalue")) { + obj.createNewArray(prop.name, function (item) { + item.locOwner = obj; + item.ownerPropertyName = prop.name; + }); + isArrayProp = true; + } + //It is a simple array property + if (prop.type === "multiplevalues") { + obj.createNewArray(prop.name); + isArrayProp = true; + } + if (isArrayProp) { + if (Array.isArray(defaultValue)) { + obj.setPropertyValue(prop.name, defaultValue); + } + defaultValue = null; + } + } + if (!!obj.getPropertyValue && !!obj.setPropertyValue) { + var desc = { + get: function () { + if (!!prop.onGetValue) { + return prop.onGetValue(obj); + } + return obj.getPropertyValue(prop.name, defaultValue); + }, + set: function (v) { + if (!!prop.onSetValue) { + prop.onSetValue(obj, v, null); + } + else { + obj.setPropertyValue(prop.name, v); + } + }, + }; + Object.defineProperty(obj, prop.name, desc); + } + } + if (prop.type === "condition" || prop.type === "expression") { + if (!!prop.onExecuteExpression) { + obj.addExpressionProperty(prop.name, prop.onExecuteExpression); + } + } + }; + CustomPropertiesCollection.properties = {}; + CustomPropertiesCollection.parentClasses = {}; + return CustomPropertiesCollection; + }()); + + var JsonMetadataClass = /** @class */ (function () { + function JsonMetadataClass(name, properties, creator, parentName) { + if (creator === void 0) { creator = null; } + if (parentName === void 0) { parentName = null; } + this.name = name; + this.creator = creator; + this.parentName = parentName; + this.properties = null; + name = name.toLowerCase(); + if (this.parentName) { + this.parentName = this.parentName.toLowerCase(); + CustomPropertiesCollection.addClass(name, this.parentName); + } + this.properties = new Array(); + for (var i = 0; i < properties.length; i++) { + var prop = this.createProperty(properties[i]); + if (prop) { + this.properties.push(prop); + } + } + } + JsonMetadataClass.prototype.find = function (name) { + for (var i = 0; i < this.properties.length; i++) { + if (this.properties[i].name == name) + return this.properties[i]; + } + return null; + }; + JsonMetadataClass.prototype.createProperty = function (propInfo) { + var propertyName = typeof propInfo === "string" ? propInfo : propInfo.name; + if (!propertyName) + return; + var propertyType = null; + var typeIndex = propertyName.indexOf(JsonMetadataClass.typeSymbol); + if (typeIndex > -1) { + propertyType = propertyName.substring(typeIndex + 1); + propertyName = propertyName.substring(0, typeIndex); + } + var isRequired = this.getIsPropertyNameRequired(propertyName) || !!propInfo.isRequired; + propertyName = this.getPropertyName(propertyName); + var prop = new JsonObjectProperty(this, propertyName, isRequired); + if (propertyType) { + prop.type = propertyType; + } + if (typeof propInfo === "object") { + if (propInfo.type) { + prop.type = propInfo.type; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.default)) { + prop.defaultValue = propInfo.default; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.isSerializable)) { + prop.isSerializable = propInfo.isSerializable; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.isLightSerializable)) { + prop.isLightSerializable = propInfo.isLightSerializable; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.maxLength)) { + prop.maxLength = propInfo.maxLength; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.displayName)) { + prop.displayName = propInfo.displayName; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.category)) { + prop.category = propInfo.category; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.categoryIndex)) { + prop.categoryIndex = propInfo.categoryIndex; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.nextToProperty)) { + prop.nextToProperty = propInfo.nextToProperty; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.visibleIndex)) { + prop.visibleIndex = propInfo.visibleIndex; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.showMode)) { + prop.showMode = propInfo.showMode; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.maxValue)) { + prop.maxValue = propInfo.maxValue; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.minValue)) { + prop.minValue = propInfo.minValue; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.dataList)) { + prop.dataList = propInfo.dataList; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.isDynamicChoices)) { + prop.isDynamicChoices = propInfo.isDynamicChoices; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.isBindable)) { + prop.isBindable = propInfo.isBindable; + } + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(propInfo.isUnique)) { + prop.isUnique = propInfo.isUnique; + } + if (propInfo.visible === true || propInfo.visible === false) { + prop.visible = propInfo.visible; + } + if (!!propInfo.visibleIf) { + prop.visibleIf = propInfo.visibleIf; + } + if (!!propInfo.onExecuteExpression) { + prop.onExecuteExpression = propInfo.onExecuteExpression; + } + if (!!propInfo.onPropertyEditorUpdate) { + prop.onPropertyEditorUpdate = propInfo.onPropertyEditorUpdate; + } + if (propInfo.readOnly === true) { + prop.readOnly = true; + } + if (propInfo.choices) { + var choicesFunc = typeof propInfo.choices === "function" ? propInfo.choices : null; + var choicesValue = typeof propInfo.choices !== "function" ? propInfo.choices : null; + prop.setChoices(choicesValue, choicesFunc); + } + if (!!propInfo.baseValue) { + prop.setBaseValue(propInfo.baseValue); + } + if (propInfo.onGetValue) { + prop.onGetValue = propInfo.onGetValue; + } + if (propInfo.onSetValue) { + prop.onSetValue = propInfo.onSetValue; + } + if (propInfo.isLocalizable) { + propInfo.serializationProperty = "loc" + prop.name; + } + if (propInfo.serializationProperty) { + prop.serializationProperty = propInfo.serializationProperty; + if (prop.serializationProperty && + prop.serializationProperty.indexOf("loc") == 0) { + prop.isLocalizable = true; + } + } + if (propInfo.isLocalizable) { + prop.isLocalizable = propInfo.isLocalizable; + } + if (propInfo.className) { + prop.className = propInfo.className; + } + if (propInfo.baseClassName) { + prop.baseClassName = propInfo.baseClassName; + } + if (propInfo.classNamePart) { + prop.classNamePart = propInfo.classNamePart; + } + if (propInfo.alternativeName) { + prop.alternativeName = propInfo.alternativeName; + } + if (propInfo.layout) { + prop.layout = propInfo.layout; + } + if (propInfo.dependsOn) { + this.addDependsOnProperties(prop, propInfo.dependsOn); + } + } + return prop; + }; + JsonMetadataClass.prototype.addDependsOnProperties = function (prop, dependsOn) { + if (Array.isArray(dependsOn)) { + for (var i = 0; i < dependsOn.length; i++) { + this.addDependsOnProperty(prop, dependsOn[i]); + } + } + else { + this.addDependsOnProperty(prop, dependsOn); + } + }; + JsonMetadataClass.prototype.addDependsOnProperty = function (prop, dependsOn) { + var property = this.find(dependsOn); + if (!property) { + property = Serializer.findProperty(this.parentName, dependsOn); + } + if (!property) + return; + property.addDependedProperty(prop.name); + }; + JsonMetadataClass.prototype.getIsPropertyNameRequired = function (propertyName) { + return (propertyName.length > 0 && + propertyName[0] == JsonMetadataClass.requiredSymbol); + }; + JsonMetadataClass.prototype.getPropertyName = function (propertyName) { + if (!this.getIsPropertyNameRequired(propertyName)) + return propertyName; + propertyName = propertyName.slice(1); + return propertyName; + }; + JsonMetadataClass.requiredSymbol = "!"; + JsonMetadataClass.typeSymbol = ":"; + return JsonMetadataClass; + }()); + + /** + * The metadata object. It contains object properties' runtime information and allows you to modify it. + */ + var JsonMetadata = /** @class */ (function () { + function JsonMetadata() { + this.classes = {}; + this.alternativeNames = {}; + this.childrenClasses = {}; + this.classProperties = {}; + this.classHashProperties = {}; + } + JsonMetadata.prototype.getObjPropertyValue = function (obj, name) { + if (this.isObjWrapper(obj)) { + var orignalObj = obj.getOriginalObj(); + var prop = Serializer.findProperty(orignalObj.getType(), name); + if (!!prop) + return this.getObjPropertyValueCore(orignalObj, prop); + } + var prop = Serializer.findProperty(obj.getType(), name); + if (!prop) + return obj[name]; + return this.getObjPropertyValueCore(obj, prop); + }; + JsonMetadata.prototype.setObjPropertyValue = function (obj, name, val) { + if (obj[name] === val) + return; + if (!!obj[name] && !!obj[name].setJson) { + obj[name].setJson(val); + } + else { + obj[name] = val; + } + }; + JsonMetadata.prototype.getObjPropertyValueCore = function (obj, prop) { + if (!prop.isSerializable) + return obj[prop.name]; + if (prop.isLocalizable) { + if (prop.isArray) + return obj[prop.name]; + if (!!prop.serializationProperty) + return obj[prop.serializationProperty].text; + } + return obj.getPropertyValue(prop.name); + }; + JsonMetadata.prototype.isObjWrapper = function (obj) { + return !!obj.getOriginalObj && !!obj.getOriginalObj(); + }; + JsonMetadata.prototype.addClass = function (name, properties, creator, parentName) { + if (creator === void 0) { creator = null; } + if (parentName === void 0) { parentName = null; } + name = name.toLowerCase(); + var metaDataClass = new JsonMetadataClass(name, properties, creator, parentName); + this.classes[name] = metaDataClass; + if (parentName) { + parentName = parentName.toLowerCase(); + var children = this.childrenClasses[parentName]; + if (!children) { + this.childrenClasses[parentName] = []; + } + this.childrenClasses[parentName].push(metaDataClass); + } + return metaDataClass; + }; + JsonMetadata.prototype.removeClass = function (name) { + var metaClass = this.findClass(name); + if (!metaClass) + return; + delete this.classes[metaClass.name]; + if (!!metaClass.parentName) { + var index = this.childrenClasses[metaClass.parentName].indexOf(metaClass); + if (index > -1) { + this.childrenClasses[metaClass.parentName].splice(index, 1); + } + } + }; + JsonMetadata.prototype.overrideClassCreatore = function (name, creator) { + this.overrideClassCreator(name, creator); + }; + JsonMetadata.prototype.overrideClassCreator = function (name, creator) { + name = name.toLowerCase(); + var metaDataClass = this.findClass(name); + if (metaDataClass) { + metaDataClass.creator = creator; + } + }; + JsonMetadata.prototype.getProperties = function (className) { + var metaClass = this.findClass(className); + if (!metaClass) + return []; + var properties = this.classProperties[metaClass.name]; + if (!!properties) + return properties; + this.fillPropertiesForClass(metaClass.name); + return this.classProperties[metaClass.name]; + }; + JsonMetadata.prototype.getHashProperties = function (className) { + var metaClass = this.findClass(className); + if (!metaClass) + return {}; + var properties = this.classHashProperties[metaClass.name]; + if (!!properties) + return properties; + this.fillPropertiesForClass(metaClass.name); + return this.classHashProperties[metaClass.name]; + }; + JsonMetadata.prototype.fillPropertiesForClass = function (className) { + var properties = new Array(); + var hashProperties = {}; + this.fillProperties(className, properties, hashProperties); + this.classProperties[className] = properties; + this.classHashProperties[className] = hashProperties; + }; + JsonMetadata.prototype.getPropertiesByObj = function (obj) { + if (!obj || !obj.getType) + return []; + var res = {}; + var props = this.getProperties(obj.getType()); + for (var i = 0; i < props.length; i++) { + res[props[i].name] = props[i]; + } + var dynamicProps = !!obj.getDynamicType + ? this.getProperties(obj.getDynamicType()) + : null; + if (dynamicProps && dynamicProps.length > 0) { + for (var i = 0; i < dynamicProps.length; i++) { + var dProp = dynamicProps[i]; + if (!!res[dProp.name]) + continue; + res[dProp.name] = dProp; + } + } + return Object.keys(res).map(function (key) { return res[key]; }); + }; + JsonMetadata.prototype.getDynamicPropertiesByObj = function (obj, dynamicType) { + if (dynamicType === void 0) { dynamicType = null; } + if (!obj || !obj.getType || (!obj.getDynamicType && !dynamicType)) + return []; + var dType = !!dynamicType ? dynamicType : obj.getDynamicType(); + if (!dType) + return []; + var dynamicProps = this.getProperties(dType); + if (!dynamicProps || dynamicProps.length == 0) + return []; + var hash = {}; + var props = this.getProperties(obj.getType()); + for (var i = 0; i < props.length; i++) { + hash[props[i].name] = props[i]; + } + var res = []; + for (var i = 0; i < dynamicProps.length; i++) { + var dProp = dynamicProps[i]; + if (!hash[dProp.name]) { + res.push(dProp); + } + } + return res; + }; + JsonMetadata.prototype.hasOriginalProperty = function (obj, propName) { + return !!this.getOriginalProperty(obj, propName); + }; + JsonMetadata.prototype.getOriginalProperty = function (obj, propName) { + var res = this.findProperty(obj.getType(), propName); + if (!!res) + return res; + if (this.isObjWrapper(obj)) + return this.findProperty(obj.getOriginalObj().getType(), propName); + return null; + }; + JsonMetadata.prototype.getProperty = function (className, propertyName) { + var prop = this.findProperty(className, propertyName); + if (!prop) + return prop; + var classInfo = this.findClass(className); + if (prop.classInfo === classInfo) + return prop; + var newProp = new JsonObjectProperty(classInfo, propertyName, prop.isRequired); + newProp.mergeWith(prop); + newProp.isArray = prop.isArray; + classInfo.properties.push(newProp); + this.emptyClassPropertiesHash(classInfo); + return newProp; + }; + JsonMetadata.prototype.findProperty = function (className, propertyName) { + var hash = this.getHashProperties(className); + var res = hash[propertyName]; + return !!res ? res : null; + }; + JsonMetadata.prototype.findProperties = function (className, propertyNames) { + var result = []; + var hash = this.getHashProperties(className); + for (var i = 0; i < propertyNames.length; i++) { + var prop = hash[propertyNames[i]]; + if (prop) { + result.push(prop); + } + } + return result; + }; + JsonMetadata.prototype.getAllPropertiesByName = function (propertyName) { + var res = new Array(); + var classes = this.getAllClasses(); + for (var i = 0; i < classes.length; i++) { + var classInfo = this.findClass(classes[i]); + for (var j = 0; j < classInfo.properties.length; j++) { + if (classInfo.properties[j].name == propertyName) { + res.push(classInfo.properties[j]); + break; + } + } + } + return res; + }; + JsonMetadata.prototype.getAllClasses = function () { + var res = new Array(); + for (var name in this.classes) { + res.push(name); + } + return res; + }; + JsonMetadata.prototype.createClass = function (name, json) { + if (json === void 0) { json = undefined; } + name = name.toLowerCase(); + var metaDataClass = this.findClass(name); + if (!metaDataClass) + return null; + if (metaDataClass.creator) + return metaDataClass.creator(json); + var parentName = metaDataClass.parentName; + while (parentName) { + metaDataClass = this.findClass(parentName); + if (!metaDataClass) + return null; + parentName = metaDataClass.parentName; + if (metaDataClass.creator) + return this.createCustomType(name, metaDataClass.creator, json); + } + return null; + }; + JsonMetadata.prototype.createCustomType = function (name, creator, json) { + if (json === void 0) { json = undefined; } + name = name.toLowerCase(); + var res = creator(json); + var customTypeName = name; + var customTemplateName = res.getTemplate + ? res.getTemplate() + : res.getType(); + res.getType = function () { + return customTypeName; + }; + res.getTemplate = function () { + return customTemplateName; + }; + CustomPropertiesCollection.createProperties(res); + return res; + }; + JsonMetadata.prototype.getChildrenClasses = function (name, canBeCreated) { + if (canBeCreated === void 0) { canBeCreated = false; } + name = name.toLowerCase(); + var result = []; + this.fillChildrenClasses(name, canBeCreated, result); + return result; + }; + JsonMetadata.prototype.getRequiredProperties = function (name) { + var properties = this.getProperties(name); + var res = []; + for (var i = 0; i < properties.length; i++) { + if (properties[i].isRequired) { + res.push(properties[i].name); + } + } + return res; + }; + JsonMetadata.prototype.addProperties = function (className, propertiesInfos) { + className = className.toLowerCase(); + var metaDataClass = this.findClass(className); + for (var i = 0; i < propertiesInfos.length; i++) { + this.addCustomPropertyCore(metaDataClass, propertiesInfos[i]); + } + }; + JsonMetadata.prototype.addProperty = function (className, propertyInfo) { + return this.addCustomPropertyCore(this.findClass(className), propertyInfo); + }; + JsonMetadata.prototype.addCustomPropertyCore = function (metaDataClass, propertyInfo) { + if (!metaDataClass) + return null; + var property = metaDataClass.createProperty(propertyInfo); + if (property) { + property.isCustom = true; + this.addPropertyToClass(metaDataClass, property); + this.emptyClassPropertiesHash(metaDataClass); + CustomPropertiesCollection.addProperty(metaDataClass.name, property); + } + return property; + }; + JsonMetadata.prototype.removeProperty = function (className, propertyName) { + var metaDataClass = this.findClass(className); + if (!metaDataClass) + return false; + var property = metaDataClass.find(propertyName); + if (property) { + this.removePropertyFromClass(metaDataClass, property); + this.emptyClassPropertiesHash(metaDataClass); + CustomPropertiesCollection.removeProperty(metaDataClass.name, propertyName); + } + }; + JsonMetadata.prototype.addPropertyToClass = function (metaDataClass, property) { + if (metaDataClass.find(property.name) != null) + return; + metaDataClass.properties.push(property); + }; + JsonMetadata.prototype.removePropertyFromClass = function (metaDataClass, property) { + var index = metaDataClass.properties.indexOf(property); + if (index < 0) + return; + metaDataClass.properties.splice(index, 1); + }; + JsonMetadata.prototype.emptyClassPropertiesHash = function (metaDataClass) { + this.classProperties[metaDataClass.name] = null; + this.classHashProperties[metaDataClass.name] = null; + var childClasses = this.getChildrenClasses(metaDataClass.name); + for (var i = 0; i < childClasses.length; i++) { + this.classProperties[childClasses[i].name] = null; + this.classHashProperties[childClasses[i].name] = null; + } + }; + JsonMetadata.prototype.fillChildrenClasses = function (name, canBeCreated, result) { + var children = this.childrenClasses[name]; + if (!children) + return; + for (var i = 0; i < children.length; i++) { + if (!canBeCreated || children[i].creator) { + result.push(children[i]); + } + this.fillChildrenClasses(children[i].name, canBeCreated, result); + } + }; + JsonMetadata.prototype.findClass = function (name) { + name = name.toLowerCase(); + var res = this.classes[name]; + if (!res) { + var newName = this.alternativeNames[name]; + if (!!newName && newName != name) + return this.findClass(newName); + } + return res; + }; + JsonMetadata.prototype.isDescendantOf = function (className, ancestorClassName) { + if (!className || !ancestorClassName) { + return false; + } + className = className.toLowerCase(); + ancestorClassName = ancestorClassName.toLowerCase(); + var class_ = this.findClass(className); + if (!class_) { + return false; + } + var parentClass = class_; + do { + if (parentClass.name === ancestorClassName) { + return true; + } + parentClass = this.classes[parentClass.parentName]; + } while (!!parentClass); + return false; + }; + JsonMetadata.prototype.addAlterNativeClassName = function (name, alternativeName) { + this.alternativeNames[alternativeName.toLowerCase()] = name.toLowerCase(); + }; + JsonMetadata.prototype.generateSchema = function (className) { + if (className === void 0) { className = undefined; } + if (!className) + className = "survey"; + var classInfo = this.findClass(className); + if (!classInfo) + return null; + var res = { + $schema: "http://json-schema.org/draft-07/schema#", + title: "SurveyJS Library json schema", + type: "object", + properties: {}, + definitions: {}, + }; + this.generateSchemaProperties(classInfo, res.properties, res.definitions); + return res; + }; + JsonMetadata.prototype.generateSchemaProperties = function (classInfo, schemaProperties, schemaDef) { + if (!classInfo) + return; + for (var i = 0; i < classInfo.properties.length; i++) { + var prop = classInfo.properties[i]; + schemaProperties[prop.name] = this.generateSchemaProperty(prop, schemaDef); + } + }; + JsonMetadata.prototype.generateSchemaProperty = function (prop, schemaDef) { + var res = { type: prop.schemaType() }; + if (prop.hasChoices) { + res.enum = prop.getChoices(null); + } + if (!!prop.className) { + res.items = { $ref: "#" + prop.className }; + this.generateChemaClass(prop.className, schemaDef); + } + if (!!prop.baseClassName) { + var usedClasses = this.getChildrenClasses(prop.baseClassName, true); + if (prop.baseClassName == "question") { + usedClasses.push(this.findClass("panel")); + } + res.items = []; + for (var i = 0; i < usedClasses.length; i++) { + var className = usedClasses[i].name; + res.items.push({ $ref: "#" + className }); + this.generateChemaClass(className, schemaDef); + } + } + return res; + }; + JsonMetadata.prototype.generateChemaClass = function (className, schemaDef) { + if (!!schemaDef[className]) + return; + var classInfo = this.findClass(className); + if (!classInfo) + return; + var hasParent = !!classInfo.parentName && classInfo.parentName != "base"; + if (hasParent) { + this.generateChemaClass(classInfo.parentName, schemaDef); + } + var res = { type: "object", $id: "#" + className }; + schemaDef[className] = res; + var props = {}; + this.generateSchemaProperties(classInfo, props, schemaDef); + if (hasParent) { + res.allOff = [ + { $ref: "#" + classInfo.parentName }, + { properties: props }, + ]; + } + else { + res.properties = props; + } + }; + JsonMetadata.prototype.fillProperties = function (name, list, hash) { + var metaDataClass = this.findClass(name); + if (!metaDataClass) + return; + if (metaDataClass.parentName) { + this.fillProperties(metaDataClass.parentName, list, hash); + } + for (var i = 0; i < metaDataClass.properties.length; i++) { + var prop = metaDataClass.properties[i]; + this.addPropertyCore(prop, list, hash); + hash[prop.name] = prop; + } + }; + JsonMetadata.prototype.addPropertyCore = function (property, list, hash) { + if (!hash[property.name]) { + list.push(property); + return; + } + var index = -1; + for (var i = 0; i < list.length; i++) { + if (list[i].name == property.name) { + index = i; + break; + } + } + property.mergeWith(list[index]); + list[index] = property; + }; + return JsonMetadata; + }()); + + var JsonError = /** @class */ (function () { + function JsonError(type, message) { + this.type = type; + this.message = message; + this.description = ""; + this.at = -1; + } + JsonError.prototype.getFullDescription = function () { + return this.message + (this.description ? "\n" + this.description : ""); + }; + return JsonError; + }()); + + var JsonUnknownPropertyError = /** @class */ (function (_super) { + __extends(JsonUnknownPropertyError, _super); + function JsonUnknownPropertyError(propertyName, className) { + var _this = _super.call(this, "unknownproperty", "The property '" + + propertyName + + "' in class '" + + className + + "' is unknown.") || this; + _this.propertyName = propertyName; + _this.className = className; + var properties = JsonObject.metaData.getProperties(className); + if (properties) { + _this.description = "The list of available properties are: "; + for (var i = 0; i < properties.length; i++) { + if (i > 0) + _this.description += ", "; + _this.description += properties[i].name; + } + _this.description += "."; + } + return _this; + } + return JsonUnknownPropertyError; + }(JsonError)); + + var JsonMissingTypeErrorBase = /** @class */ (function (_super) { + __extends(JsonMissingTypeErrorBase, _super); + function JsonMissingTypeErrorBase(baseClassName, type, message) { + var _this = _super.call(this, type, message) || this; + _this.baseClassName = baseClassName; + _this.type = type; + _this.message = message; + _this.description = "The following types are available: "; + var types = JsonObject.metaData.getChildrenClasses(baseClassName, true); + for (var i = 0; i < types.length; i++) { + if (i > 0) + _this.description += ", "; + _this.description += "'" + types[i].name + "'"; + } + _this.description += "."; + return _this; + } + return JsonMissingTypeErrorBase; + }(JsonError)); + + var JsonMissingTypeError = /** @class */ (function (_super) { + __extends(JsonMissingTypeError, _super); + function JsonMissingTypeError(propertyName, baseClassName) { + var _this = _super.call(this, baseClassName, "missingtypeproperty", "The property type is missing in the object. Please take a look at property: '" + + propertyName + + "'.") || this; + _this.propertyName = propertyName; + _this.baseClassName = baseClassName; + return _this; + } + return JsonMissingTypeError; + }(JsonMissingTypeErrorBase)); + + var JsonIncorrectTypeError = /** @class */ (function (_super) { + __extends(JsonIncorrectTypeError, _super); + function JsonIncorrectTypeError(propertyName, baseClassName) { + var _this = _super.call(this, baseClassName, "incorrecttypeproperty", "The property type is incorrect in the object. Please take a look at property: '" + + propertyName + + "'.") || this; + _this.propertyName = propertyName; + _this.baseClassName = baseClassName; + return _this; + } + return JsonIncorrectTypeError; + }(JsonMissingTypeErrorBase)); + + var JsonRequiredPropertyError = /** @class */ (function (_super) { + __extends(JsonRequiredPropertyError, _super); + function JsonRequiredPropertyError(propertyName, className) { + var _this = _super.call(this, "requiredproperty", "The property '" + + propertyName + + "' is required in class '" + + className + + "'.") || this; + _this.propertyName = propertyName; + _this.className = className; + return _this; + } + return JsonRequiredPropertyError; + }(JsonError)); + + var JsonObject = /** @class */ (function () { + function JsonObject() { + this.errors = new Array(); + this.lightSerializing = false; + } + Object.defineProperty(JsonObject, "metaData", { + get: function () { + return JsonObject.metaDataValue; + }, + enumerable: false, + configurable: true + }); + JsonObject.prototype.toJsonObject = function (obj, storeDefaults) { + if (storeDefaults === void 0) { storeDefaults = false; } + return this.toJsonObjectCore(obj, null, storeDefaults); + }; + JsonObject.prototype.toObject = function (jsonObj, obj) { + this.toObjectCore(jsonObj, obj); + var error = this.getRequiredError(obj, jsonObj); + if (!!error) { + this.addNewError(error, jsonObj); + } + }; + JsonObject.prototype.toObjectCore = function (jsonObj, obj) { + if (!jsonObj) + return; + var properties = null; + var objType = undefined; + var needAddErrors = true; + if (obj.getType) { + objType = obj.getType(); + properties = JsonObject.metaData.getProperties(objType); + needAddErrors = + !!objType && !JsonObject.metaData.isDescendantOf(objType, "itemvalue"); + } + if (!properties) + return; + if (obj.startLoadingFromJson) { + obj.startLoadingFromJson(); + } + properties = this.addDynamicProperties(obj, jsonObj, properties); + for (var key in jsonObj) { + if (key === JsonObject.typePropertyName) + continue; + if (key === JsonObject.positionPropertyName) { + obj[key] = jsonObj[key]; + continue; + } + var property = this.findProperty(properties, key); + if (!property) { + if (needAddErrors) { + this.addNewError(new JsonUnknownPropertyError(key.toString(), objType), jsonObj); + } + continue; + } + this.valueToObj(jsonObj[key], obj, property); + } + if (obj.endLoadingFromJson) { + obj.endLoadingFromJson(); + } + }; + JsonObject.prototype.toJsonObjectCore = function (obj, property, storeDefaults) { + if (storeDefaults === void 0) { storeDefaults = false; } + if (!obj || !obj.getType) + return obj; + if (typeof obj.getData === "function") + return obj.getData(); + var result = {}; + if (property != null && !property.className) { + result[JsonObject.typePropertyName] = property.getObjType(obj.getType()); + } + this.propertiesToJson(obj, JsonObject.metaData.getProperties(obj.getType()), result, storeDefaults); + this.propertiesToJson(obj, this.getDynamicProperties(obj), result, storeDefaults); + return result; + }; + JsonObject.prototype.getDynamicProperties = function (obj) { + return Serializer.getDynamicPropertiesByObj(obj); + }; + JsonObject.prototype.addDynamicProperties = function (obj, jsonObj, properties) { + if (!obj.getDynamicPropertyName) + return properties; + var dynamicPropName = obj.getDynamicPropertyName(); + if (!dynamicPropName) + return properties; + if (jsonObj[dynamicPropName]) { + obj[dynamicPropName] = jsonObj[dynamicPropName]; + } + var dynamicProperties = this.getDynamicProperties(obj); + var res = []; + for (var i = 0; i < properties.length; i++) { + res.push(properties[i]); + } + for (var i = 0; i < dynamicProperties.length; i++) { + res.push(dynamicProperties[i]); + } + return res; + }; + JsonObject.prototype.propertiesToJson = function (obj, properties, json, storeDefaults) { + if (storeDefaults === void 0) { storeDefaults = false; } + for (var i = 0; i < properties.length; i++) { + this.valueToJson(obj, json, properties[i], storeDefaults); + } + }; + JsonObject.prototype.valueToJson = function (obj, result, property, storeDefaults) { + if (storeDefaults === void 0) { storeDefaults = false; } + if (property.isSerializable === false || + (property.isLightSerializable === false && this.lightSerializing)) + return; + var value = property.getValue(obj); + if (!storeDefaults && property.isDefaultValue(value)) + return; + if (this.isValueArray(value)) { + var arrValue = []; + for (var i = 0; i < value.length; i++) { + arrValue.push(this.toJsonObjectCore(value[i], property, storeDefaults)); + } + value = arrValue.length > 0 ? arrValue : null; + } + else { + value = this.toJsonObjectCore(value, property, storeDefaults); + } + var hasValue = typeof obj["getPropertyValue"] === "function" && + obj["getPropertyValue"](property.name, null) !== null; + if ((storeDefaults && hasValue) || !property.isDefaultValue(value)) { + result[property.name] = value; + } + }; + JsonObject.prototype.valueToObj = function (value, obj, property) { + if (value == null) + return; + this.removePos(property, value); + if (property != null && property.hasToUseSetValue) { + property.setValue(obj, value, this); + return; + } + if (this.isValueArray(value)) { + this.valueToArray(value, obj, property.name, property); + return; + } + var newObj = this.createNewObj(value, property); + if (newObj.newObj) { + this.toObjectCore(value, newObj.newObj); + value = newObj.newObj; + } + if (!newObj.error) { + if (property != null) { + property.setValue(obj, value, this); + } + else { + obj[property.name] = value; + } + } + }; + JsonObject.prototype.removePos = function (property, value) { + if (!property || !property.type || property.type.indexOf("value") < 0) + return; + this.removePosFromObj(value); + }; + JsonObject.prototype.removePosFromObj = function (obj) { + if (!obj) + return; + if (Array.isArray(obj)) { + for (var i = 0; i < obj.length; i++) { + this.removePosFromObj(obj[i]); + } + } + if (!!obj[JsonObject.positionPropertyName]) { + delete obj[JsonObject.positionPropertyName]; + } + }; + JsonObject.prototype.isValueArray = function (value) { + return value && Array.isArray(value); + }; + JsonObject.prototype.createNewObj = function (value, property) { + var result = { newObj: null, error: null }; + var className = value[JsonObject.typePropertyName]; + if (!className && property != null && property.className) { + className = property.className; + } + className = property.getClassName(className); + result.newObj = className + ? JsonObject.metaData.createClass(className, value) + : null; + result.error = this.checkNewObjectOnErrors(result.newObj, value, property, className); + return result; + }; + JsonObject.prototype.checkNewObjectOnErrors = function (newObj, value, property, className) { + var error = null; + if (newObj) { + error = this.getRequiredError(newObj, value); + } + else { + if (property.baseClassName) { + if (!className) { + error = new JsonMissingTypeError(property.name, property.baseClassName); + } + else { + error = new JsonIncorrectTypeError(property.name, property.baseClassName); + } + } + } + if (error) { + this.addNewError(error, value); + } + return error; + }; + JsonObject.prototype.getRequiredError = function (obj, jsonValue) { + if (!obj.getType || typeof obj.getData === "function") + return null; + var className = obj.getType(); + var requiredProperties = JsonObject.metaData.getRequiredProperties(className); + if (!requiredProperties) + return null; + for (var i = 0; i < requiredProperties.length; i++) { + if (!jsonValue[requiredProperties[i]]) { + return new JsonRequiredPropertyError(requiredProperties[i], className); + } + } + return null; + }; + JsonObject.prototype.addNewError = function (error, jsonObj) { + if (jsonObj && jsonObj[JsonObject.positionPropertyName]) { + error.at = jsonObj[JsonObject.positionPropertyName].start; + } + this.errors.push(error); + }; + JsonObject.prototype.valueToArray = function (value, obj, key, property) { + if (obj[key] && value.length > 0) + obj[key].splice(0, obj[key].length); + var valueRes = obj[key] ? obj[key] : []; + this.addValuesIntoArray(value, valueRes, property); + if (!obj[key]) + obj[key] = valueRes; + }; + JsonObject.prototype.addValuesIntoArray = function (value, result, property) { + for (var i = 0; i < value.length; i++) { + var newValue = this.createNewObj(value[i], property); + if (newValue.newObj) { + if (!!value[i].name) { + newValue.newObj.name = value[i].name; + } + result.push(newValue.newObj); + this.toObjectCore(value[i], newValue.newObj); + } + else { + if (!newValue.error) { + result.push(value[i]); + } + } + } + }; + JsonObject.prototype.findProperty = function (properties, key) { + if (!properties) + return null; + for (var i = 0; i < properties.length; i++) { + var prop = properties[i]; + if (prop.name == key || prop.alternativeName == key) + return prop; + } + return null; + }; + JsonObject.typePropertyName = "type"; + JsonObject.positionPropertyName = "pos"; + JsonObject.metaDataValue = new JsonMetadata(); + return JsonObject; + }()); + + /** + * An alias for the metadata object. It contains object properties' runtime information and allows you to modify it. + * @see JsonMetadata + */ + var Serializer = JsonObject.metaData; + + + /***/ }), + + /***/ "./src/knockout/components/action-bar/action-bar-item-dropdown.html": + /*!**************************************************************************!*\ + !*** ./src/knockout/components/action-bar/action-bar-item-dropdown.html ***! + \**************************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n"; + + /***/ }), + + /***/ "./src/knockout/components/action-bar/action-bar-item-dropdown.ts": + /*!************************************************************************!*\ + !*** ./src/knockout/components/action-bar/action-bar-item-dropdown.ts ***! + \************************************************************************/ + /*! exports provided: ActionBarItemDropdownViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActionBarItemDropdownViewModel", function() { return ActionBarItemDropdownViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + + var template = __webpack_require__(/*! ./action-bar-item-dropdown.html */ "./src/knockout/components/action-bar/action-bar-item-dropdown.html"); + var ActionBarItemDropdownViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-action-bar-item-dropdown", { + viewModel: { + createViewModel: function (params) { + return new survey_core__WEBPACK_IMPORTED_MODULE_1__["ActionDropdownViewModel"](params.item); + } + }, + template: template + }); + + + /***/ }), + + /***/ "./src/knockout/components/action-bar/action-bar-item.html": + /*!*****************************************************************!*\ + !*** ./src/knockout/components/action-bar/action-bar-item.html ***! + \*****************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n \n \n \n \n \n \n\n"; + + /***/ }), + + /***/ "./src/knockout/components/action-bar/action-bar-item.ts": + /*!***************************************************************!*\ + !*** ./src/knockout/components/action-bar/action-bar-item.ts ***! + \***************************************************************/ + /*! exports provided: ActionBarItemViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActionBarItemViewModel", function() { return ActionBarItemViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! ./action-bar-item.html */ "./src/knockout/components/action-bar/action-bar-item.html"); + var ActionBarItemViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-action-bar-item", { + viewModel: { + createViewModel: function (params) { + return params; + }, + }, + template: template + }); + + + /***/ }), + + /***/ "./src/knockout/components/action-bar/action-bar-separator.html": + /*!**********************************************************************!*\ + !*** ./src/knockout/components/action-bar/action-bar-separator.html ***! + \**********************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "
"; + + /***/ }), + + /***/ "./src/knockout/components/action-bar/action-bar-separator.ts": + /*!********************************************************************!*\ + !*** ./src/knockout/components/action-bar/action-bar-separator.ts ***! + \********************************************************************/ + /*! exports provided: ActionBarSeparatorViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActionBarSeparatorViewModel", function() { return ActionBarSeparatorViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! ./action-bar-separator.html */ "./src/knockout/components/action-bar/action-bar-separator.html"); + var ActionBarSeparatorViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-action-bar-separator", { + viewModel: { + createViewModel: function (params, componentInfo) { + var item = params.item; + if (!!item) { + return { + css: item.innerCss, + }; + } + return {}; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/action-bar/action-bar.html": + /*!************************************************************!*\ + !*** ./src/knockout/components/action-bar/action-bar.html ***! + \************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n \n \n \n \n\n\n"; + + /***/ }), + + /***/ "./src/knockout/components/action-bar/action-bar.ts": + /*!**********************************************************!*\ + !*** ./src/knockout/components/action-bar/action-bar.ts ***! + \**********************************************************/ + /*! exports provided: ActionBarItemViewModel, ActionBarItemDropdownViewModel, ActionBarSeparatorViewModel, ActionContainerImplementor */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActionContainerImplementor", function() { return ActionContainerImplementor; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var _kobase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../kobase */ "./src/knockout/kobase.ts"); + /* harmony import */ __webpack_require__(/*! ./action */ "./src/knockout/components/action-bar/action.ts"); + /* empty/unused harmony star reexport *//* harmony import */ var _action_bar_item__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./action-bar-item */ "./src/knockout/components/action-bar/action-bar-item.ts"); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ActionBarItemViewModel", function() { return _action_bar_item__WEBPACK_IMPORTED_MODULE_3__["ActionBarItemViewModel"]; }); + + /* harmony import */ var _action_bar_item_dropdown__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./action-bar-item-dropdown */ "./src/knockout/components/action-bar/action-bar-item-dropdown.ts"); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ActionBarItemDropdownViewModel", function() { return _action_bar_item_dropdown__WEBPACK_IMPORTED_MODULE_4__["ActionBarItemDropdownViewModel"]; }); + + /* harmony import */ var _action_bar_separator__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./action-bar-separator */ "./src/knockout/components/action-bar/action-bar-separator.ts"); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ActionBarSeparatorViewModel", function() { return _action_bar_separator__WEBPACK_IMPORTED_MODULE_5__["ActionBarSeparatorViewModel"]; }); + + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + var template = __webpack_require__(/*! ./action-bar.html */ "./src/knockout/components/action-bar/action-bar.html"); + + + + + var ActionContainerImplementor = /** @class */ (function (_super) { + __extends(ActionContainerImplementor, _super); + function ActionContainerImplementor(model, handleClick) { + if (handleClick === void 0) { handleClick = true; } + var _this = _super.call(this, model) || this; + _this.model = model; + _this.handleClick = handleClick; + _this.itemsSubscription = knockout__WEBPACK_IMPORTED_MODULE_0__["computed"](function () { + (model.renderedActions || model.items || model.actions).forEach(function (item) { + if (!!item.stateItem) { + new _kobase__WEBPACK_IMPORTED_MODULE_1__["ImplementorBase"](item.stateItem); + } + else { + new _kobase__WEBPACK_IMPORTED_MODULE_1__["ImplementorBase"](item); + } + }); + }); + return _this; + } + ActionContainerImplementor.prototype.dispose = function () { + _super.prototype.dispose.call(this); + this.itemsSubscription.dispose(); + this.model.resetResponsivityManager(); + }; + return ActionContainerImplementor; + }(_kobase__WEBPACK_IMPORTED_MODULE_1__["ImplementorBase"])); + + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-action-bar", { + viewModel: { + createViewModel: function (params, componentInfo) { + var handleClick = params.handleClick !== undefined ? params.handleClick : true; + var model = params.model; + var container = componentInfo.element.nextElementSibling; + params.model.initResponsivityManager(container); + return new ActionContainerImplementor(model, handleClick); + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/action-bar/action.html": + /*!********************************************************!*\ + !*** ./src/knockout/components/action-bar/action.html ***! + \********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\r\n
\r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n"; + + /***/ }), + + /***/ "./src/knockout/components/action-bar/action.ts": + /*!******************************************************!*\ + !*** ./src/knockout/components/action-bar/action.ts ***! + \******************************************************/ + /*! no exports provided */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var _kobase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../kobase */ "./src/knockout/kobase.ts"); + + + var template = __webpack_require__(/*! ./action.html */ "./src/knockout/components/action-bar/action.html"); + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-action", { + viewModel: { + createViewModel: function (params) { + var item = params.item; + new _kobase__WEBPACK_IMPORTED_MODULE_1__["ImplementorBase"](item); + return params; + }, + }, + template: template + }); + + + /***/ }), + + /***/ "./src/knockout/components/boolean-checkbox/boolean-checkbox.html": + /*!************************************************************************!*\ + !*** ./src/knockout/components/boolean-checkbox/boolean-checkbox.html ***! + \************************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "
\n \n
\n"; + + /***/ }), + + /***/ "./src/knockout/components/boolean-checkbox/boolean-checkbox.ts": + /*!**********************************************************************!*\ + !*** ./src/knockout/components/boolean-checkbox/boolean-checkbox.ts ***! + \**********************************************************************/ + /*! exports provided: CheckboxViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CheckboxViewModel", function() { return CheckboxViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + + var template = __webpack_require__(/*! ./boolean-checkbox.html */ "./src/knockout/components/boolean-checkbox/boolean-checkbox.html"); + var CheckboxViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-boolean-checkbox", { + viewModel: { + createViewModel: function (params, componentInfo) { + return { question: params.question }; + }, + }, + template: template, + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["RendererFactory"].Instance.registerRenderer("boolean", "checkbox", "sv-boolean-checkbox"); + + + /***/ }), + + /***/ "./src/knockout/components/boolean-radio/boolean-radio-item.html": + /*!***********************************************************************!*\ + !*** ./src/knockout/components/boolean-radio/boolean-radio-item.html ***! + \***********************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "
\n \n
\n\n"; + + /***/ }), + + /***/ "./src/knockout/components/boolean-radio/boolean-radio-item.ts": + /*!*********************************************************************!*\ + !*** ./src/knockout/components/boolean-radio/boolean-radio-item.ts ***! + \*********************************************************************/ + /*! exports provided: BooleanRadioItemViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BooleanRadioItemViewModel", function() { return BooleanRadioItemViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! ./boolean-radio-item.html */ "./src/knockout/components/boolean-radio/boolean-radio-item.html"); + var BooleanRadioItemViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-boolean-radio-item", { + viewModel: { + createViewModel: function (params) { + params.handleChange = function () { + params.question.value = params.value; + }; + return params; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/boolean-radio/boolean-radio.html": + /*!******************************************************************!*\ + !*** ./src/knockout/components/boolean-radio/boolean-radio.html ***! + \******************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "
\n
\n \n \n
\n
\n"; + + /***/ }), + + /***/ "./src/knockout/components/boolean-radio/boolean-radio.ts": + /*!****************************************************************!*\ + !*** ./src/knockout/components/boolean-radio/boolean-radio.ts ***! + \****************************************************************/ + /*! exports provided: BooleanRadioItemViewModel, BooleanRadioViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BooleanRadioViewModel", function() { return BooleanRadioViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _boolean_radio_item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./boolean-radio-item */ "./src/knockout/components/boolean-radio/boolean-radio-item.ts"); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BooleanRadioItemViewModel", function() { return _boolean_radio_item__WEBPACK_IMPORTED_MODULE_2__["BooleanRadioItemViewModel"]; }); + + + + + var template = __webpack_require__(/*! ./boolean-radio.html */ "./src/knockout/components/boolean-radio/boolean-radio.html"); + var BooleanRadioViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-boolean-radio", { + viewModel: { + createViewModel: function (params, componentInfo) { + return { question: params.question }; + }, + }, + template: template, + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["RendererFactory"].Instance.registerRenderer("boolean", "radio", "sv-boolean-radio"); + + + /***/ }), + + /***/ "./src/knockout/components/button-group/button-group-item.html": + /*!*********************************************************************!*\ + !*** ./src/knockout/components/button-group/button-group-item.html ***! + \*********************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/knockout/components/button-group/button-group-item.ts": + /*!*******************************************************************!*\ + !*** ./src/knockout/components/button-group/button-group-item.ts ***! + \*******************************************************************/ + /*! exports provided: ButtonGroupItemViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ButtonGroupItemViewModel", function() { return ButtonGroupItemViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + + var template = __webpack_require__(/*! ./button-group-item.html */ "./src/knockout/components/button-group/button-group-item.html"); + var ButtonGroupItemViewModel = /** @class */ (function () { + function ButtonGroupItemViewModel(model) { + this.model = model; + } + return ButtonGroupItemViewModel; + }()); + + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-button-group-item", { + viewModel: { + createViewModel: function (params) { + var model = new survey_core__WEBPACK_IMPORTED_MODULE_1__["ButtonGroupItemModel"](params.question, params.item, params.index()); + var viewModel = new ButtonGroupItemViewModel(model); + return viewModel; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/dropdown-select/dropdown-select.html": + /*!**********************************************************************!*\ + !*** ./src/knockout/components/dropdown-select/dropdown-select.html ***! + \**********************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "
\n
\n \n
\n
\n \n \n \n \n
\n
\n \n
\n \n
\n
\n \n
"; + + /***/ }), + + /***/ "./src/knockout/components/dropdown-select/dropdown-select.ts": + /*!********************************************************************!*\ + !*** ./src/knockout/components/dropdown-select/dropdown-select.ts ***! + \********************************************************************/ + /*! exports provided: DropdownSelectViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DropdownSelectViewModel", function() { return DropdownSelectViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var src_utils_popup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! src/utils/popup */ "./src/utils/popup.ts"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + + + var template = __webpack_require__(/*! ./dropdown-select.html */ "./src/knockout/components/dropdown-select/dropdown-select.html"); + var DropdownSelectViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-dropdown-select", { + viewModel: { + createViewModel: function (params, componentInfo) { + var click = function (_, e) { + src_utils_popup__WEBPACK_IMPORTED_MODULE_1__["PopupUtils"].updatePopupWidthBeforeShow(params.question.popupModel, e); + }; + return { question: params.question, popupModel: params.question.popupModel, click: click }; + }, + }, + template: template, + }); + survey_core__WEBPACK_IMPORTED_MODULE_2__["RendererFactory"].Instance.registerRenderer("dropdown", "select", "sv-dropdown-select"); + + + /***/ }), + + /***/ "./src/knockout/components/dropdown/dropdown.html": + /*!********************************************************!*\ + !*** ./src/knockout/components/dropdown/dropdown.html ***! + \********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "
\n \n \n \n\n \n
\n \n
\n"; + + /***/ }), + + /***/ "./src/knockout/components/dropdown/dropdown.ts": + /*!******************************************************!*\ + !*** ./src/knockout/components/dropdown/dropdown.ts ***! + \******************************************************/ + /*! exports provided: DropdownViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DropdownViewModel", function() { return DropdownViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! ./dropdown.html */ "./src/knockout/components/dropdown/dropdown.html"); + var DropdownViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-dropdown", { + viewModel: { + createViewModel: function (params, componentInfo) { + return { question: params.question }; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/list/list-item.html": + /*!*****************************************************!*\ + !*** ./src/knockout/components/list/list-item.html ***! + \*****************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n"; + + /***/ }), + + /***/ "./src/knockout/components/list/list-item.ts": + /*!***************************************************!*\ + !*** ./src/knockout/components/list/list-item.ts ***! + \***************************************************/ + /*! exports provided: ListItemViewComponent */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ListItemViewComponent", function() { return ListItemViewComponent; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var _kobase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../kobase */ "./src/knockout/kobase.ts"); + + + var template = __webpack_require__(/*! ./list-item.html */ "./src/knockout/components/list/list-item.html"); + var ListItemViewComponent; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-list-item", { + viewModel: { + createViewModel: function (params, componentInfo) { + new _kobase__WEBPACK_IMPORTED_MODULE_1__["ImplementorBase"](params.item); + return { + item: params.item, + model: params.model, + itemClick: function (data) { return data.model.selectItem(data.item); } + }; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/list/list.html": + /*!************************************************!*\ + !*** ./src/knockout/components/list/list.html ***! + \************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "
\n \n
\n
\n \n
\n \n
\n \n
    \n \n \n \n \n
\n
"; + + /***/ }), + + /***/ "./src/knockout/components/list/list.ts": + /*!**********************************************!*\ + !*** ./src/knockout/components/list/list.ts ***! + \**********************************************/ + /*! exports provided: ListItemViewComponent, ListViewComponent */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ListViewComponent", function() { return ListViewComponent; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var _action_bar_action_bar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../action-bar/action-bar */ "./src/knockout/components/action-bar/action-bar.ts"); + /* harmony import */ var _list_item__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./list-item */ "./src/knockout/components/list/list-item.ts"); + /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ListItemViewComponent", function() { return _list_item__WEBPACK_IMPORTED_MODULE_2__["ListItemViewComponent"]; }); + + + + var template = __webpack_require__(/*! ./list.html */ "./src/knockout/components/list/list.html"); + + var ListViewComponent; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-list", { + viewModel: { + createViewModel: function (params, componentInfo) { + var model = params.model; + var _implementor = new _action_bar_action_bar__WEBPACK_IMPORTED_MODULE_1__["ActionContainerImplementor"](model); + return { model: model, dispose: function () { _implementor.dispose(); } }; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/logo-image/logo-image.html": + /*!************************************************************!*\ + !*** ./src/knockout/components/logo-image/logo-image.html ***! + \************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n
\n \n
\n"; + + /***/ }), + + /***/ "./src/knockout/components/logo-image/logo-image.ts": + /*!**********************************************************!*\ + !*** ./src/knockout/components/logo-image/logo-image.ts ***! + \**********************************************************/ + /*! exports provided: LogoImageViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogoImageViewModel", function() { return LogoImageViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! ./logo-image.html */ "./src/knockout/components/logo-image/logo-image.html"); + var LogoImageViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-logo-image", { + viewModel: { + createViewModel: function (params) { + return { survey: params }; + }, + }, + template: template + }); + + + /***/ }), + + /***/ "./src/knockout/components/matrix-actions/detail-button/detail-button.html": + /*!*********************************************************************************!*\ + !*** ./src/knockout/components/matrix-actions/detail-button/detail-button.html ***! + \*********************************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n\n\n\n\n"; + + /***/ }), + + /***/ "./src/knockout/components/matrix-actions/detail-button/detail-button.ts": + /*!*******************************************************************************!*\ + !*** ./src/knockout/components/matrix-actions/detail-button/detail-button.ts ***! + \*******************************************************************************/ + /*! exports provided: SurveyQuestionMatrixDetailButton */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrixDetailButton", function() { return SurveyQuestionMatrixDetailButton; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! ./detail-button.html */ "./src/knockout/components/matrix-actions/detail-button/detail-button.html"); + var SurveyQuestionMatrixDetailButton; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-matrix-detail-button", { + viewModel: { + createViewModel: function (params, componentInfo) { + return params.item.data; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/matrix-actions/drag-drop-icon/drag-drop-icon.html": + /*!***********************************************************************************!*\ + !*** ./src/knockout/components/matrix-actions/drag-drop-icon/drag-drop-icon.html ***! + \***********************************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n \n\n\n\n\n"; + + /***/ }), + + /***/ "./src/knockout/components/matrix-actions/drag-drop-icon/drag-drop-icon.ts": + /*!*********************************************************************************!*\ + !*** ./src/knockout/components/matrix-actions/drag-drop-icon/drag-drop-icon.ts ***! + \*********************************************************************************/ + /*! exports provided: SurveyQuestionMatrixDynamicDragDropIcon */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrixDynamicDragDropIcon", function() { return SurveyQuestionMatrixDynamicDragDropIcon; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! ./drag-drop-icon.html */ "./src/knockout/components/matrix-actions/drag-drop-icon/drag-drop-icon.html"); + var SurveyQuestionMatrixDynamicDragDropIcon; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-matrix-drag-drop-icon", { + viewModel: { + createViewModel: function (params, componentInfo) { + return params.item.data; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/matrix-actions/remove-button/remove-button.html": + /*!*********************************************************************************!*\ + !*** ./src/knockout/components/matrix-actions/remove-button/remove-button.html ***! + \*********************************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n \n \n\n"; + + /***/ }), + + /***/ "./src/knockout/components/matrix-actions/remove-button/remove-button.ts": + /*!*******************************************************************************!*\ + !*** ./src/knockout/components/matrix-actions/remove-button/remove-button.ts ***! + \*******************************************************************************/ + /*! exports provided: SurveyQuestionMatrixDynamicRemoveButton */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionMatrixDynamicRemoveButton", function() { return SurveyQuestionMatrixDynamicRemoveButton; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! ./remove-button.html */ "./src/knockout/components/matrix-actions/remove-button/remove-button.html"); + var SurveyQuestionMatrixDynamicRemoveButton; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-matrix-remove-button", { + viewModel: { + createViewModel: function (params) { + return params.item.data; + }, + }, + template: template + }); + + + /***/ }), + + /***/ "./src/knockout/components/panel/panel.ts": + /*!************************************************!*\ + !*** ./src/knockout/components/panel/panel.ts ***! + \************************************************/ + /*! exports provided: PanelViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PanelViewModel", function() { return PanelViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! html-loader?interpolate!val-loader!./panel.html */ "./node_modules/html-loader/index.js?interpolate!./node_modules/val-loader/index.js!./src/knockout/components/panel/panel.html"); + var PanelViewModel = /** @class */ (function () { + function PanelViewModel(question, targetElement) { + this.question = question; + this.targetElement = targetElement; + } + return PanelViewModel; + }()); + + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-panel", { + viewModel: { + createViewModel: function (params, componentInfo) { + var viewModel = new PanelViewModel(params.question, componentInfo.element.parentElement); + return viewModel; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/paneldynamic-actions/paneldynamic-actions.ts": + /*!******************************************************************************!*\ + !*** ./src/knockout/components/paneldynamic-actions/paneldynamic-actions.ts ***! + \******************************************************************************/ + /*! exports provided: SurveyQuestionPaneldynamicActioons */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyQuestionPaneldynamicActioons", function() { return SurveyQuestionPaneldynamicActioons; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var addBtnTemplate = __webpack_require__(/*! ./paneldynamic-add-btn.html */ "./src/knockout/components/paneldynamic-actions/paneldynamic-add-btn.html"); + var nextBtnTemplate = __webpack_require__(/*! ./paneldynamic-next-btn.html */ "./src/knockout/components/paneldynamic-actions/paneldynamic-next-btn.html"); + var prevBtnTemplate = __webpack_require__(/*! ./paneldynamic-prev-btn.html */ "./src/knockout/components/paneldynamic-actions/paneldynamic-prev-btn.html"); + var progressTextTemplate = __webpack_require__(/*! ./paneldynamic-progress-text.html */ "./src/knockout/components/paneldynamic-actions/paneldynamic-progress-text.html"); + var SurveyQuestionPaneldynamicActioons; + function getPaneldynamicActionViewModel() { + return { + createViewModel: function (params, componentInfo) { + return (!!params.item && params.item.data) || params; + }, + }; + } + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-paneldynamic-add-btn", { + viewModel: getPaneldynamicActionViewModel(), + template: addBtnTemplate, + }); + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-paneldynamic-next-btn", { + viewModel: getPaneldynamicActionViewModel(), + template: nextBtnTemplate, + }); + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-paneldynamic-prev-btn", { + viewModel: getPaneldynamicActionViewModel(), + template: prevBtnTemplate, + }); + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-paneldynamic-progress-text", { + viewModel: getPaneldynamicActionViewModel(), + template: progressTextTemplate, + }); + + + /***/ }), + + /***/ "./src/knockout/components/paneldynamic-actions/paneldynamic-add-btn.html": + /*!********************************************************************************!*\ + !*** ./src/knockout/components/paneldynamic-actions/paneldynamic-add-btn.html ***! + \********************************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n"; + + /***/ }), + + /***/ "./src/knockout/components/paneldynamic-actions/paneldynamic-next-btn.html": + /*!*********************************************************************************!*\ + !*** ./src/knockout/components/paneldynamic-actions/paneldynamic-next-btn.html ***! + \*********************************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "
\n \n
"; + + /***/ }), + + /***/ "./src/knockout/components/paneldynamic-actions/paneldynamic-prev-btn.html": + /*!*********************************************************************************!*\ + !*** ./src/knockout/components/paneldynamic-actions/paneldynamic-prev-btn.html ***! + \*********************************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "
\n \n
"; + + /***/ }), + + /***/ "./src/knockout/components/paneldynamic-actions/paneldynamic-progress-text.html": + /*!**************************************************************************************!*\ + !*** ./src/knockout/components/paneldynamic-actions/paneldynamic-progress-text.html ***! + \**************************************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "
"; + + /***/ }), + + /***/ "./src/knockout/components/popup/popup.ts": + /*!************************************************!*\ + !*** ./src/knockout/components/popup/popup.ts ***! + \************************************************/ + /*! exports provided: PopupViewModel, showModal */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PopupViewModel", function() { return PopupViewModel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showModal", function() { return showModal; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _kobase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../kobase */ "./src/knockout/kobase.ts"); + + + + + var template = __webpack_require__(/*! html-loader?interpolate!val-loader!./popup.html */ "./node_modules/html-loader/index.js?interpolate!./node_modules/val-loader/index.js!./src/knockout/components/popup/popup.html"); + var PopupViewModel = /** @class */ (function () { + function PopupViewModel(popupViewModel) { + this.popupViewModel = popupViewModel; + popupViewModel.initializePopupContainer(); + new _kobase__WEBPACK_IMPORTED_MODULE_2__["ImplementorBase"](popupViewModel.model); + new _kobase__WEBPACK_IMPORTED_MODULE_2__["ImplementorBase"](popupViewModel); + popupViewModel.container.innerHTML = template; + popupViewModel.model.onVisibilityChanged = function (isVisible) { + if (isVisible) { + knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"].runEarly(); + popupViewModel.updateOnShowing(); + } + }; + knockout__WEBPACK_IMPORTED_MODULE_0__["applyBindings"](popupViewModel, popupViewModel.container); + } + PopupViewModel.prototype.dispose = function () { + knockout__WEBPACK_IMPORTED_MODULE_0__["cleanNode"](this.popupViewModel.container); + this.popupViewModel.dispose(); + }; + return PopupViewModel; + }()); + + function showModal(componentName, data, onApply, onCancel, cssClass, title, displayMode) { + if (displayMode === void 0) { displayMode = "popup"; } + var popupViewModel = Object(survey_core__WEBPACK_IMPORTED_MODULE_1__["createPopupModalViewModel"])(componentName, data, onApply, onCancel, function () { + viewModel.dispose(); + }, undefined, cssClass, title, displayMode); + var viewModel = new PopupViewModel(popupViewModel); + popupViewModel.model.isVisible = true; + } + survey_core__WEBPACK_IMPORTED_MODULE_1__["settings"].showModal = showModal; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-popup", { + viewModel: { + createViewModel: function (params, componentInfo) { + var viewModel = new survey_core__WEBPACK_IMPORTED_MODULE_1__["PopupBaseViewModel"](knockout__WEBPACK_IMPORTED_MODULE_0__["unwrap"](params.model), componentInfo.element.parentElement); + return new PopupViewModel(viewModel); + }, + }, + template: "
", + }); + + + /***/ }), + + /***/ "./src/knockout/components/progress/buttons.ts": + /*!*****************************************************!*\ + !*** ./src/knockout/components/progress/buttons.ts ***! + \*****************************************************/ + /*! exports provided: ProgressButtonsViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProgressButtonsViewModel", function() { return ProgressButtonsViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + + var template = __webpack_require__(/*! html-loader?interpolate!val-loader!./buttons.html */ "./node_modules/html-loader/index.js?interpolate!./node_modules/val-loader/index.js!./src/knockout/components/progress/buttons.html"); + var ProgressButtonsViewModel = /** @class */ (function () { + function ProgressButtonsViewModel(survey, element) { + var _this = this; + this.survey = survey; + this.scrollButtonCssKo = undefined; + this.hasScroller = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](false); + this.updateScroller = undefined; + this.progressButtonsModel = new survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyProgressButtonsModel"](survey); + this.updateScroller = setInterval(function () { + var listContainerElement = element.querySelector("." + survey.css.progressButtonsListContainer); + if (!!listContainerElement) { + _this.hasScroller(listContainerElement.scrollWidth > listContainerElement.offsetWidth); + } + }, 100); + } + ProgressButtonsViewModel.prototype.isListElementClickable = function (index) { + return this.progressButtonsModel.isListElementClickable(index()); + }; + ProgressButtonsViewModel.prototype.getListElementCss = function (index) { + return this.progressButtonsModel.getListElementCss(index()); + }; + ProgressButtonsViewModel.prototype.clickListElement = function (index) { + this.progressButtonsModel.clickListElement(index()); + }; + ProgressButtonsViewModel.prototype.getScrollButtonCss = function (isLeftScroll) { + var _this = this; + this.scrollButtonCssKo = knockout__WEBPACK_IMPORTED_MODULE_0__["computed"](function () { + return _this.progressButtonsModel.getScrollButtonCss(_this.hasScroller(), isLeftScroll); + }, this); + return this.scrollButtonCssKo; + }; + ProgressButtonsViewModel.prototype.clickScrollButton = function (listContainerElement, isLeftScroll) { + listContainerElement.scrollLeft += (isLeftScroll ? -1 : 1) * 70; + }; + ProgressButtonsViewModel.prototype.dispose = function () { + if (typeof this.updateScroller !== "undefined") { + clearInterval(this.updateScroller); + this.updateScroller = undefined; + } + if (typeof this.scrollButtonCssKo !== "undefined") { + this.scrollButtonCssKo.dispose(); + this.scrollButtonCssKo = undefined; + } + }; + return ProgressButtonsViewModel; + }()); + + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-progress-buttons", { + viewModel: { + createViewModel: function (params, componentInfo) { + return new ProgressButtonsViewModel(params.model, componentInfo.element.nextElementSibling); + }, + }, + template: template + }); + + + /***/ }), + + /***/ "./src/knockout/components/progress/progress.ts": + /*!******************************************************!*\ + !*** ./src/knockout/components/progress/progress.ts ***! + \******************************************************/ + /*! exports provided: ProgressViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProgressViewModel", function() { return ProgressViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + + var template = __webpack_require__(/*! html-loader?interpolate!val-loader!./progress.html */ "./node_modules/html-loader/index.js?interpolate!./node_modules/val-loader/index.js!./src/knockout/components/progress/progress.html"); + var ProgressViewModel = /** @class */ (function () { + function ProgressViewModel(model) { + this.model = model; + } + ProgressViewModel.prototype.getProgressTextInBarCss = function (css) { + return survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyProgressModel"].getProgressTextInBarCss(css); + }; + ProgressViewModel.prototype.getProgressTextUnderBarCss = function (css) { + return survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyProgressModel"].getProgressTextUnderBarCss(css); + }; + return ProgressViewModel; + }()); + + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-progress-progress", { + viewModel: { + createViewModel: function (params) { + return new ProgressViewModel(params.model); + } + }, + template: template + }); + var templateBridge = ""; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-progress-pages", { + viewModel: { + createViewModel: function (params) { + return new ProgressViewModel(params.model); + } + }, + template: templateBridge + }); + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-progress-questions", { + viewModel: { + createViewModel: function (params) { + return new ProgressViewModel(params.model); + } + }, + template: templateBridge + }); + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-progress-correctQuestions", { + viewModel: { + createViewModel: function (params) { + return new ProgressViewModel(params.model); + } + }, + template: templateBridge + }); + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-progress-requiredQuestions", { + viewModel: { + createViewModel: function (params) { + return new ProgressViewModel(params.model); + } + }, + template: templateBridge + }); + + + /***/ }), + + /***/ "./src/knockout/components/rating-dropdown/rating-dropdown.html": + /*!**********************************************************************!*\ + !*** ./src/knockout/components/rating-dropdown/rating-dropdown.html ***! + \**********************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "
\n \n \n
\n"; + + /***/ }), + + /***/ "./src/knockout/components/rating-dropdown/rating-dropdown.ts": + /*!********************************************************************!*\ + !*** ./src/knockout/components/rating-dropdown/rating-dropdown.ts ***! + \********************************************************************/ + /*! exports provided: RatingDropdownViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RatingDropdownViewModel", function() { return RatingDropdownViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + + var template = __webpack_require__(/*! ./rating-dropdown.html */ "./src/knockout/components/rating-dropdown/rating-dropdown.html"); + var RatingDropdownViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-rating-dropdown", { + viewModel: { + createViewModel: function (params, componentInfo) { + return { question: params.question }; + }, + }, + template: template, + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["RendererFactory"].Instance.registerRenderer("rating", "dropdown", "sv-rating-dropdown"); + + + /***/ }), + + /***/ "./src/knockout/components/skeleton/skeleton.html": + /*!********************************************************!*\ + !*** ./src/knockout/components/skeleton/skeleton.html ***! + \********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "
\n
"; + + /***/ }), + + /***/ "./src/knockout/components/skeleton/skeleton.ts": + /*!******************************************************!*\ + !*** ./src/knockout/components/skeleton/skeleton.ts ***! + \******************************************************/ + /*! exports provided: Skeleton */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Skeleton", function() { return Skeleton; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! ./skeleton.html */ "./src/knockout/components/skeleton/skeleton.html"); + var Skeleton; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-skeleton", { + viewModel: { + createViewModel: function (params, componentInfo) { + return { question: params.question }; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/string-editor/string-editor.html": + /*!******************************************************************!*\ + !*** ./src/knockout/components/string-editor/string-editor.html ***! + \******************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n\n\n\n\n\n"; + + /***/ }), + + /***/ "./src/knockout/components/string-editor/string-editor.ts": + /*!****************************************************************!*\ + !*** ./src/knockout/components/string-editor/string-editor.ts ***! + \****************************************************************/ + /*! exports provided: StringEditorViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringEditorViewModel", function() { return StringEditorViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + + var template = __webpack_require__(/*! ./string-editor.html */ "./src/knockout/components/string-editor/string-editor.html"); + var StringEditorViewModel = /** @class */ (function () { + function StringEditorViewModel(locString) { + this.locString = locString; + } + Object.defineProperty(StringEditorViewModel.prototype, "koHasHtml", { + get: function () { + return this.locString.koHasHtml(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(StringEditorViewModel.prototype, "editValue", { + get: function () { + return this.locString.koRenderedHtml(); + }, + set: function (value) { + this.locString.searchElement = undefined; + this.locString.text = value; + }, + enumerable: false, + configurable: true + }); + StringEditorViewModel.prototype.onInput = function (sender, event) { + sender.editValue = event.target.innerText; + }; + StringEditorViewModel.prototype.onClick = function (sender, event) { + event.stopPropagation(); + }; + StringEditorViewModel.prototype.dispose = function () { + this.locString.onSearchChanged = undefined; + }; + return StringEditorViewModel; + }()); + + function getSearchElement(element) { + while (!!element && element.nodeName !== "SPAN") { + var elements = element.parentElement.getElementsByClassName("sv-string-editor"); + element = elements.length > 0 ? elements[0] : undefined; + } + if (!!element && element.childNodes.length > 0) + return element; + return null; + } + function resetLocalizationSpan(element, locStr) { + while (element.childNodes.length > 1) { + element.removeChild(element.childNodes[1]); + } + element.childNodes[0].textContent = locStr.renderedHtml; + } + function applyLocStrOnSearchChanged(element, locStr) { + locStr.onSearchChanged = function () { + if (locStr.searchElement == undefined) { + locStr.searchElement = getSearchElement(element); + } + if (locStr.searchElement == null) + return; + var el = locStr.searchElement; + if (!locStr.highlightDiv) { + locStr.highlightDiv = document.createElement("span"); + locStr.highlightDiv.style.backgroundColor = "lightgray"; + } + if (locStr.searchIndex != undefined) { + resetLocalizationSpan(el, locStr); + var rng = document.createRange(); + rng.setStart(el.childNodes[0], locStr.searchIndex); + rng.setEnd(el.childNodes[0], locStr.searchIndex + locStr.searchText.length); + rng.surroundContents(locStr.highlightDiv); + } + else { + resetLocalizationSpan(el, locStr); + locStr.searchElement = undefined; + } + }; + } + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register(survey_core__WEBPACK_IMPORTED_MODULE_1__["LocalizableString"].editableRenderer, { + viewModel: { + createViewModel: function (params, componentInfo) { + var locStr = params.locString; + applyLocStrOnSearchChanged(componentInfo.element, locStr); + return new StringEditorViewModel(locStr); + }, + }, + template: template + }); + + + /***/ }), + + /***/ "./src/knockout/components/string-viewer/string-viewer.html": + /*!******************************************************************!*\ + !*** ./src/knockout/components/string-viewer/string-viewer.html ***! + \******************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n\n\n\n"; + + /***/ }), + + /***/ "./src/knockout/components/string-viewer/string-viewer.ts": + /*!****************************************************************!*\ + !*** ./src/knockout/components/string-viewer/string-viewer.ts ***! + \****************************************************************/ + /*! exports provided: StringViewerViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringViewerViewModel", function() { return StringViewerViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! ./string-viewer.html */ "./src/knockout/components/string-viewer/string-viewer.html"); + var StringViewerViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-string-viewer", { + viewModel: { + createViewModel: function (params, componentInfo) { + return { + locString: params.locString + }; + }, + }, + template: template + }); + + + /***/ }), + + /***/ "./src/knockout/components/survey-actions/survey-nav-button.html": + /*!***********************************************************************!*\ + !*** ./src/knockout/components/survey-actions/survey-nav-button.html ***! + \***********************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n \n"; + + /***/ }), + + /***/ "./src/knockout/components/survey-actions/survey-nav-button.ts": + /*!*********************************************************************!*\ + !*** ./src/knockout/components/survey-actions/survey-nav-button.ts ***! + \*********************************************************************/ + /*! exports provided: SurveyNavigationButton */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyNavigationButton", function() { return SurveyNavigationButton; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! ./survey-nav-button.html */ "./src/knockout/components/survey-actions/survey-nav-button.html"); + var SurveyNavigationButton; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-nav-btn", { + viewModel: { + createViewModel: function (params, componentInfo) { + return params; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/svg-icon/svg-icon.html": + /*!********************************************************!*\ + !*** ./src/knockout/components/svg-icon/svg-icon.html ***! + \********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n\n"; + + /***/ }), + + /***/ "./src/knockout/components/svg-icon/svg-icon.ts": + /*!******************************************************!*\ + !*** ./src/knockout/components/svg-icon/svg-icon.ts ***! + \******************************************************/ + /*! exports provided: SvgIconViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SvgIconViewModel", function() { return SvgIconViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + + var template = __webpack_require__(/*! ./svg-icon.html */ "./src/knockout/components/svg-icon/svg-icon.html"); + var SvgIconViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-svg-icon", { + viewModel: { + createViewModel: function (params, componentInfo) { + knockout__WEBPACK_IMPORTED_MODULE_0__["computed"](function () { + var iconName = knockout__WEBPACK_IMPORTED_MODULE_0__["unwrap"](params.iconName); + var element = componentInfo.element.querySelector && componentInfo.element.querySelector("svg") || componentInfo.element.nextElementSibling; + if (iconName) { + Object(survey_core__WEBPACK_IMPORTED_MODULE_1__["createSvg"])(knockout__WEBPACK_IMPORTED_MODULE_0__["unwrap"](params.size), knockout__WEBPACK_IMPORTED_MODULE_0__["unwrap"](params.width), knockout__WEBPACK_IMPORTED_MODULE_0__["unwrap"](params.height), iconName, element); + } + }); + return { + hasIcon: params.iconName, + css: params.css, + title: params.title + }; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/template-renderer/template-renderer.html": + /*!**************************************************************************!*\ + !*** ./src/knockout/components/template-renderer/template-renderer.html ***! + \**************************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n \n \n\n\n \n \n\n"; + + /***/ }), + + /***/ "./src/knockout/components/template-renderer/template-renderer.ts": + /*!************************************************************************!*\ + !*** ./src/knockout/components/template-renderer/template-renderer.ts ***! + \************************************************************************/ + /*! no exports provided */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + + var template = __webpack_require__(/*! ./template-renderer.html */ "./src/knockout/components/template-renderer/template-renderer.html"); + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register(survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyModel"].TemplateRendererComponentName, { + viewModel: { + createViewModel: function (params) { + return params; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/title/title-actions.html": + /*!**********************************************************!*\ + !*** ./src/knockout/components/title/title-actions.html ***! + \**********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n \n\n\n
\n \n \n \n \n \n
\n"; + + /***/ }), + + /***/ "./src/knockout/components/title/title-actions.ts": + /*!********************************************************!*\ + !*** ./src/knockout/components/title/title-actions.ts ***! + \********************************************************/ + /*! exports provided: TitleActionViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TitleActionViewModel", function() { return TitleActionViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + + var template = __webpack_require__(/*! ./title-actions.html */ "./src/knockout/components/title/title-actions.html"); + var TitleActionViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-title-actions", { + viewModel: { + createViewModel: function (params, componentInfo) { + var element = params.element; + return { + element: element, + toolbar: element.getTitleToolbar(), + }; + }, + }, + template: template, + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["RendererFactory"].Instance.registerRenderer("element", "title-actions", "sv-title-actions"); + + + /***/ }), + + /***/ "./src/knockout/components/title/title-content.html": + /*!**********************************************************!*\ + !*** ./src/knockout/components/title/title-content.html ***! + \**********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n \n\n\n \n \n \n \n \n  \n \n \n \n  \n \n \n \n  \n \n \n"; + + /***/ }), + + /***/ "./src/knockout/components/title/title-content.ts": + /*!********************************************************!*\ + !*** ./src/knockout/components/title/title-content.ts ***! + \********************************************************/ + /*! exports provided: TitleContentViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TitleContentViewModel", function() { return TitleContentViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var template = __webpack_require__(/*! ./title-content.html */ "./src/knockout/components/title/title-content.html"); + var TitleContentViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("survey-element-title-content", { + viewModel: { + createViewModel: function (params, componentInfo) { + var element = params.element; + return { element: element }; + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/components/title/title-element.ts": + /*!********************************************************!*\ + !*** ./src/knockout/components/title/title-element.ts ***! + \********************************************************/ + /*! exports provided: TitleElementViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TitleElementViewModel", function() { return TitleElementViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var TitleElementViewModel; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("survey-element-title", { + viewModel: { + createViewModel: function (params, componentInfo) { + var element = params.element; + var rootEl = componentInfo.element; + var titleEl = document.createElement(element.titleTagName); + var ariaLabelAttr = element.getType() === "radiogroup" ? "" : "'aria-label': element.locTitle.renderedHtml,"; + var bindings = "css: element.cssTitle, attr: { ".concat(ariaLabelAttr, " id: element.ariaTitleId, tabindex: element.titleTabIndex, 'aria-expanded': element.titleAriaExpanded }"); + if (element.hasTitleEvents) { + bindings += ", key2click"; + } + titleEl.setAttribute("data-bind", bindings); + titleEl.innerHTML = ""; + var dummyNode = rootEl.nextSibling; + rootEl.parentNode.insertBefore(document.createComment(" ko if: element.hasTitle "), dummyNode); + rootEl.parentNode.insertBefore(titleEl, dummyNode); + rootEl.parentNode.insertBefore(document.createComment(" /ko "), dummyNode); + rootEl.parentNode.removeChild(dummyNode); + return { element: element }; + }, + }, + template: "", + }); + + + /***/ }), + + /***/ "./src/knockout/components/tooltip-error/tooltip-error.ts": + /*!****************************************************************!*\ + !*** ./src/knockout/components/tooltip-error/tooltip-error.ts ***! + \****************************************************************/ + /*! exports provided: TooltipErrorViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TooltipErrorViewModel", function() { return TooltipErrorViewModel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + + var template = __webpack_require__(/*! html-loader?interpolate!val-loader!./tooltip-error.html */ "./node_modules/html-loader/index.js?interpolate!./node_modules/val-loader/index.js!./src/knockout/components/tooltip-error/tooltip-error.html"); + var TooltipErrorViewModel = /** @class */ (function () { + function TooltipErrorViewModel(question) { + var _this = this; + this.question = question; + this.afterRender = function (elements) { + var tooltipElement = elements.filter(function (el) { return el instanceof HTMLElement; })[0]; + _this.tooltipManager = new survey_core__WEBPACK_IMPORTED_MODULE_1__["TooltipManager"](tooltipElement); + knockout__WEBPACK_IMPORTED_MODULE_0__["utils"].domNodeDisposal.addDisposeCallback(elements[1], function () { + _this.tooltipManager.dispose(); + }); + }; + } + return TooltipErrorViewModel; + }()); + + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("sv-tooltip-error", { + viewModel: { + createViewModel: function (params, componentInfo) { + return new TooltipErrorViewModel(params.question); + }, + }, + template: template, + }); + + + /***/ }), + + /***/ "./src/knockout/koSurveyWindow.ts": + /*!****************************************!*\ + !*** ./src/knockout/koSurveyWindow.ts ***! + \****************************************/ + /*! exports provided: SurveyWindowImplementor, SurveyWindow */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyWindowImplementor", function() { return SurveyWindowImplementor; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyWindow", function() { return SurveyWindow; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _kobase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./kobase */ "./src/knockout/kobase.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + var koTemplate = __webpack_require__(/*! html-loader?interpolate!val-loader!./templates/window/window.html */ "./node_modules/html-loader/index.js?interpolate!./node_modules/val-loader/index.js!./src/knockout/templates/window/window.html"); + var SurveyWindowImplementor = /** @class */ (function (_super) { + __extends(SurveyWindowImplementor, _super); + function SurveyWindowImplementor(window) { + var _this = _super.call(this, window) || this; + _this.window = window; + _this.window.showingChangedCallback = function () { + _this.doShowingChanged(); + }; + _this.window["doExpand"] = function () { + _this.window.changeExpandCollapse(); + }; + return _this; + } + SurveyWindowImplementor.prototype.doShowingChanged = function () { + var windowElement = this.window.windowElement; + if (this.window.isShowing) { + windowElement.innerHTML = this.template; + knockout__WEBPACK_IMPORTED_MODULE_0__["cleanNode"](windowElement); + knockout__WEBPACK_IMPORTED_MODULE_0__["applyBindings"](this.window, windowElement); + document.body.appendChild(windowElement); + this.window.survey.render(survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyWindowModel"].surveyElementName); + } + else { + document.body.removeChild(windowElement); + windowElement.innerHTML = ""; + } + }; + Object.defineProperty(SurveyWindowImplementor.prototype, "template", { + get: function () { + return this.window.templateValue ? this.window.templateValue : koTemplate; + }, + enumerable: false, + configurable: true + }); + return SurveyWindowImplementor; + }(_kobase__WEBPACK_IMPORTED_MODULE_2__["ImplementorBase"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyWindowModel"].prototype["onCreating"] = function () { + this.implementor = new SurveyWindowImplementor(this); + }; + var SurveyWindow = /** @class */ (function (_super) { + __extends(SurveyWindow, _super); + function SurveyWindow(jsonObj, initialModel) { + if (initialModel === void 0) { initialModel = null; } + return _super.call(this, jsonObj, initialModel) || this; + } + return SurveyWindow; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyWindowModel"])); + + + + /***/ }), + + /***/ "./src/knockout/kobase.ts": + /*!********************************!*\ + !*** ./src/knockout/kobase.ts ***! + \********************************/ + /*! exports provided: ImplementorBase */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ImplementorBase", function() { return ImplementorBase; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + + var ImplementorBase = /** @class */ (function () { + function ImplementorBase(element) { + this.element = element; + this.implementedMark = "__surveyImplementedKo"; + if (element[this.implementedMark]) { + return; + } + element.iteratePropertiesHash(function (hash, key) { + ImplementorBase.doIterateProperties(element, hash, key); + }); + element.createArrayCoreHandler = function (hash, key) { + var res = knockout__WEBPACK_IMPORTED_MODULE_0__["observableArray"](); + res()["onArrayChanged"] = function () { + if (element.isLoadingFromJson || element.isDisposed) + return; + res.notifySubscribers(); + }; + hash[key] = res; + return res(); + }; + element.getPropertyValueCoreHandler = function (hash, key) { + if (hash[key] === undefined) { + hash[key] = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](); + } + return typeof hash[key] === "function" ? hash[key]() : hash[key]; + }; + element.setPropertyValueCoreHandler = function (hash, key, val) { + if (hash[key] !== undefined) { + // if(hash[key]() === val) { + // hash[key].notifySubscribers(); + // } + hash[key](val); + } + else { + hash[key] = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](val); + } + }; + element[this.implementedMark] = true; + } + ImplementorBase.doIterateProperties = function (element, hash, key) { + var val = hash[key]; + if (val === "function") + return; + if (Array.isArray(val)) { + hash[key] = knockout__WEBPACK_IMPORTED_MODULE_0__["observableArray"](val); + val["onArrayChanged"] = function () { + if (element.isLoadingFromJson || element.isDisposed) + return; + hash[key].notifySubscribers(); + }; + } + else { + hash[key] = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](val); + } + }; + ImplementorBase.prototype.dispose = function () { + this.element.iteratePropertiesHash(function (hash, key) { + hash[key] = knockout__WEBPACK_IMPORTED_MODULE_0__["unwrap"](hash[key]); + if (Array.isArray(hash[key])) { + hash[key]["onArrayChanged"] = undefined; + } + }); + this.element.createArrayCoreHandler = undefined; + this.element.getPropertyValueCoreHandler = undefined; + this.element.setPropertyValueCoreHandler = undefined; + delete this.element[this.implementedMark]; + }; + return ImplementorBase; + }()); + + + + /***/ }), + + /***/ "./src/knockout/koflowpanel.ts": + /*!*************************************!*\ + !*** ./src/knockout/koflowpanel.ts ***! + \*************************************/ + /*! exports provided: FlowPanel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FlowPanel", function() { return FlowPanel; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _kobase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./kobase */ "./src/knockout/kobase.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + var FlowPanel = /** @class */ (function (_super) { + __extends(FlowPanel, _super); + function FlowPanel(name) { + if (name === void 0) { name = ""; } + var _this = _super.call(this, name) || this; + _this.koElementType = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"]("survey-flowpanel"); + new _kobase__WEBPACK_IMPORTED_MODULE_2__["ImplementorBase"](_this); + _this.onCreating(); + var self = _this; + _this.koElementAfterRender = function (el, con) { + return self.elementAfterRender(el, con); + }; + return _this; + } + FlowPanel.prototype.onCreating = function () { }; + FlowPanel.prototype.getHtmlForQuestion = function (question) { + return (''); + }; + FlowPanel.prototype.elementAfterRender = function (elements, con) { + if (!this.survey) + return; + var el = survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].GetFirstNonTextElement(elements); + if (!!el) { + this.survey.afterRenderQuestion(con, el); + } + }; + return FlowPanel; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["FlowPanelModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].overrideClassCreator("flowpanel", function () { + return new FlowPanel(); + }); + /* + ElementFactory.Instance.registerElement("flowpanel", name => { + return new FlowPanel(name); + }); + */ + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("f-panel", { + viewModel: { + createViewModel: function (params, componentInfo) { + var self = this; + var question = knockout__WEBPACK_IMPORTED_MODULE_0__["unwrap"](params.question); + self.element = componentInfo.element; + self.element.innerHTML = question.html; + self.isOnFocus = false; + self.wasChanged = false; + self.isContentUpdating = false; + question.contentChangedCallback = function () { + if (self.isContentUpdating) + return; + knockout__WEBPACK_IMPORTED_MODULE_0__["cleanNode"](self.element); + self.element.innerHTML = question.html; + knockout__WEBPACK_IMPORTED_MODULE_0__["applyBindings"]({ question: question }, self.element); + !!knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"] && knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"].runEarly(); + }; + self.element.onfocus = function () { + self.isOnFocus = true; + }; + self.element.onblur = function () { + if (self.wasChanged) + self.updateContent(); + self.isOnFocus = false; + self.wasChanged = false; + }; + self.element.ondragend = function (event) { + var regEx = /{(.*?(element:)[^$].*?)}/g; + var str = self.element.innerHTML; + var res = regEx.exec(str); + if (res !== null) { + var q = question.getQuestionFromText(res[0]); + if (!!q) { + question.content = self.getContent(q.name); + } + } + }; + self.updateContent = function () { + self.isContentUpdating = true; + question.content = self.getContent(); + self.isContentUpdating = false; + }; + question.getContent = self.getContent = function (deletedName) { + var content = document.createElement("DIV"); + content.innerHTML = self.element.innerHTML; + var cps = content.querySelectorAll('span[question="true"]'); + for (var i = 0; i < cps.length; i++) { + var name = cps[i].id.replace("flowpanel_", ""); + var html = ""; + if (name !== deletedName) { + var el = question.getQuestionByName(name); + html = !!el ? question.getElementContentText(el) : ""; + } + cps[i].outerHTML = html; + } + return content.innerHTML; + }; + var config = { + characterData: true, + attributes: true, + childList: true, + subtree: true, + }; + var callback = function (mutationsList, observer) { + if (!self.isOnFocus) + return; + self.wasChanged = true; + }; + var observer = new MutationObserver(callback); + observer.observe(self.element, config); + return { question: question }; + }, + }, + template: "
", + }); + + + /***/ }), + + /***/ "./src/knockout/kopage.ts": + /*!********************************!*\ + !*** ./src/knockout/kopage.ts ***! + \********************************/ + /*! exports provided: QuestionRow, PanelImplementorBase, Panel, Page */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRow", function() { return QuestionRow; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PanelImplementorBase", function() { return PanelImplementorBase; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Panel", function() { return Panel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Page", function() { return Page; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _kobase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./kobase */ "./src/knockout/kobase.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + + var QuestionRow = /** @class */ (function (_super) { + __extends(QuestionRow, _super); + function QuestionRow(panel) { + var _this = _super.call(this, panel) || this; + _this.panel = panel; + new _kobase__WEBPACK_IMPORTED_MODULE_2__["ImplementorBase"](_this); + var self = _this; + _this.koElementAfterRender = function (el, con) { + return self.elementAfterRender(el, con); + }; + return _this; + } + QuestionRow.prototype.getElementType = function (el) { + return el.isPanel ? "survey-panel" : "survey-question"; + }; + QuestionRow.prototype.koAfterRender = function (el, con) { + for (var i = 0; i < el.length; i++) { + var tEl = el[i]; + var nName = tEl.nodeName; + if (nName == "#text") + tEl.data = ""; + } + }; + QuestionRow.prototype.elementAfterRender = function (elements, con) { + var _this = this; + if (!this.panel || !this.panel.survey) + return; + setTimeout(function () { + !!knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"] && knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"].runEarly(); + var el = survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].GetFirstNonTextElement(elements); + if (!el) + return; + var element = con; + if (element.isPanel) { + _this.panel.survey.afterRenderPanel(con, el); + } + else { + element.afterRender(el); + } + }, 0); + }; + QuestionRow.prototype.rowAfterRender = function (elements, model) { + if (!model.isNeedRender) { + var rowContainerDiv_1 = elements[0].parentElement; + var timer_1 = setTimeout(function () { return model.startLazyRendering(rowContainerDiv_1); }, 1); + knockout__WEBPACK_IMPORTED_MODULE_0__["utils"].domNodeDisposal.addDisposeCallback(rowContainerDiv_1, function () { + clearTimeout(timer_1); + model.stopLazyRendering(); + model.isNeedRender = !model.isLazyRendering(); + }); + } + }; + QuestionRow.prototype.dispose = function () { + _super.prototype.dispose.call(this); + this.koElementAfterRender = undefined; + }; + return QuestionRow; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionRowModel"])); + + var PanelImplementorBase = /** @class */ (function (_super) { + __extends(PanelImplementorBase, _super); + function PanelImplementorBase(panel) { + var _this = _super.call(this, panel) || this; + _this.panel = panel; + return _this; + } + return PanelImplementorBase; + }(_kobase__WEBPACK_IMPORTED_MODULE_2__["ImplementorBase"])); + + var Panel = /** @class */ (function (_super) { + __extends(Panel, _super); + function Panel(name) { + if (name === void 0) { name = ""; } + var _this = _super.call(this, name) || this; + _this.onCreating(); + var self = _this; + _this.koElementType = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"]("survey-panel"); + _this.koCss = knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + return self.cssClasses; + }); + _this.koErrorClass = knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + return self.cssError; + }); + return _this; + } + Panel.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new PanelImplementorBase(this); + }; + Panel.prototype.createRow = function () { + return new QuestionRow(this); + }; + Panel.prototype.onCreating = function () { }; + Panel.prototype.onNumChanged = function (value) { + this.locTitle.onChanged(); + }; + Panel.prototype.dispose = function () { + this.koCss.dispose(); + this.koErrorClass.dispose(); + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return Panel; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["PanelModel"])); + + var Page = /** @class */ (function (_super) { + __extends(Page, _super); + function Page(name) { + if (name === void 0) { name = ""; } + var _this = _super.call(this, name) || this; + _this.onCreating(); + return _this; + } + Page.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _kobase__WEBPACK_IMPORTED_MODULE_2__["ImplementorBase"](this); + }; + Page.prototype.createRow = function () { + return new QuestionRow(this); + }; + Page.prototype.onCreating = function () { }; + Page.prototype.onNumChanged = function (value) { + this.locTitle.onChanged(); + }; + Page.prototype.dispose = function () { + _super.prototype.dispose.call(this); + this._implementor.dispose(); + this._implementor = undefined; + }; + return Page; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["PageModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].overrideClassCreator("panel", function () { + return new Panel(); + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].overrideClassCreator("page", function () { + return new Page(); + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["ElementFactory"].Instance.registerElement("panel", function (name) { + return new Panel(name); + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion.ts": + /*!************************************!*\ + !*** ./src/knockout/koquestion.ts ***! + \************************************/ + /*! exports provided: QuestionImplementor */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionImplementor", function() { return QuestionImplementor; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _kobase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./kobase */ "./src/knockout/kobase.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + var QuestionImplementor = /** @class */ (function (_super) { + __extends(QuestionImplementor, _super); + function QuestionImplementor(question) { + var _this = _super.call(this, question) || this; + _this.question = question; + _this._koValue = knockout__WEBPACK_IMPORTED_MODULE_0__["observableArray"](); + _this.disposedObjects = []; + _this.callBackFunctions = []; + var isSynchronizing = false; + _this._koValue.subscribe(function (newValue) { + if (!isSynchronizing) { + _this.question.value = newValue; + } + }); + Object.defineProperty(_this.question, "koValue", { + get: function () { + if (!survey_core__WEBPACK_IMPORTED_MODULE_1__["Helpers"].isTwoValueEquals(_this._koValue(), _this.getKoValue(), false, true, false)) { + try { + isSynchronizing = true; + _this._koValue(_this.getKoValue()); + } + finally { + isSynchronizing = false; + } + } + return _this._koValue; + }, + enumerable: true, + configurable: true, + }); + question.surveyLoadCallback = function () { + _this.onSurveyLoad(); + }; + _this.setObservaleObj("koTemplateName", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + return _this.getTemplateName(); + })); + _this.setObservaleObj("koElementType", knockout__WEBPACK_IMPORTED_MODULE_0__["observable"]("survey-question")); + _this.setObservaleObj("koCss", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + return _this.question.cssClasses; + })); + _this.setObservaleObj("koRootCss", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + return _this.question.getRootCss(); + })); + _this.setObservaleObj("koErrorClass", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + return _this.question.cssError; + })); + _this.koDummy = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](0); + _this.setCallbackFunc("koQuestionAfterRender", function (el, con) { + _this.koQuestionAfterRender(el, con); + }); + return _this; + } + QuestionImplementor.prototype.setObservaleObj = function (name, obj, addToQuestion) { + if (addToQuestion === void 0) { addToQuestion = true; } + this.disposedObjects.push(name); + if (addToQuestion) { + this.question[name] = obj; + } + return obj; + }; + QuestionImplementor.prototype.setCallbackFunc = function (name, func) { + this.callBackFunctions.push(name); + this.question[name] = func; + }; + QuestionImplementor.prototype.getKoValue = function () { + return this.question.value; + }; + QuestionImplementor.prototype.onSurveyLoad = function () { }; + QuestionImplementor.prototype.getQuestionTemplate = function () { + return this.question.getTemplate(); + }; + QuestionImplementor.prototype.getTemplateName = function () { + if (this.question.customWidget && + !this.question.customWidget.widgetJson.isDefaultRender) + return "survey-widget-" + this.question.customWidget.name; + return "survey-question-" + this.getQuestionTemplate(); + }; + QuestionImplementor.prototype.getNo = function () { + return this.question.visibleIndex > -1 + ? this.question.visibleIndex + 1 + ". " + : ""; + }; + QuestionImplementor.prototype.updateKoDummy = function () { + if (this.question.isDisposed) + return; + this.koDummy(this.koDummy() + 1); + this.question.locTitle.onChanged(); + }; + QuestionImplementor.prototype.koQuestionAfterRender = function (elements, con) { + var _this = this; + setTimeout(function () { + !!knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"] && knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"].runEarly(); + var el = survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].GetFirstNonTextElement(elements, true); + if (!!el) { + _this.question.afterRenderQuestionElement(el); + if (!!_this.question.customWidget) { + _this.question.customWidget.afterRender(_this.question, el); + } + knockout__WEBPACK_IMPORTED_MODULE_0__["utils"].domNodeDisposal.addDisposeCallback(el, function () { + _this.question.beforeDestroyQuestionElement(el); + if (!!_this.question.customWidget) { + try { + _this.question.customWidget.willUnmount(_this.question, el); + } + catch (_a) { + // eslint-disable-next-line no-console + console.warn("Custom widget will unmount failed"); + } + } + }); + } + }, 0); + }; + QuestionImplementor.prototype.dispose = function () { + _super.prototype.dispose.call(this); + for (var i_1 = 0; i_1 < this.disposedObjects.length; i_1++) { + var name_1 = this.disposedObjects[i_1]; + var obj = this[name_1] || this.question[name_1]; + if (!obj) + continue; + if (this[name_1]) + this[name_1] = undefined; + if (this.question[name_1]) + this.question[name_1] = undefined; + if (obj["dispose"]) + obj.dispose(); + } + this.disposedObjects = []; + for (var i = 0; i < this.callBackFunctions.length; i++) { + this.question[this.callBackFunctions[i]] = undefined; + } + this.callBackFunctions = []; + this.question.unRegisterFunctionOnPropertyValueChanged("visibleIndex"); + }; + return QuestionImplementor; + }(_kobase__WEBPACK_IMPORTED_MODULE_2__["ImplementorBase"])); + + + + /***/ }), + + /***/ "./src/knockout/koquestion_baseselect.ts": + /*!***********************************************!*\ + !*** ./src/knockout/koquestion_baseselect.ts ***! + \***********************************************/ + /*! exports provided: QuestionSelectBaseImplementor, QuestionCheckboxBaseImplementor */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionSelectBaseImplementor", function() { return QuestionSelectBaseImplementor; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCheckboxBaseImplementor", function() { return QuestionCheckboxBaseImplementor; }); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + var QuestionSelectBaseImplementor = /** @class */ (function (_super) { + __extends(QuestionSelectBaseImplementor, _super); + function QuestionSelectBaseImplementor(question) { + var _this = _super.call(this, question) || this; + _this.onCreated(); + return _this; + } + QuestionSelectBaseImplementor.prototype.onCreated = function () { }; + Object.defineProperty(QuestionSelectBaseImplementor.prototype, "isOtherSelected", { + get: function () { + return this.question.isOtherSelected; + }, + enumerable: false, + configurable: true + }); + return QuestionSelectBaseImplementor; + }(_koquestion__WEBPACK_IMPORTED_MODULE_0__["QuestionImplementor"])); + + var QuestionCheckboxBaseImplementor = /** @class */ (function (_super) { + __extends(QuestionCheckboxBaseImplementor, _super); + function QuestionCheckboxBaseImplementor(question) { + var _this = _super.call(this, question) || this; + _this.setCallbackFunc("koAfterRender", _this.koAfterRender); + return _this; + } + QuestionCheckboxBaseImplementor.prototype.koAfterRender = function (el, con) { + var tEl = el[0]; + if (tEl.nodeName == "#text") + tEl.data = ""; + tEl = el[el.length - 1]; + if (tEl.nodeName == "#text") + tEl.data = ""; + }; + return QuestionCheckboxBaseImplementor; + }(QuestionSelectBaseImplementor)); + + + + /***/ }), + + /***/ "./src/knockout/koquestion_boolean.ts": + /*!********************************************!*\ + !*** ./src/knockout/koquestion_boolean.ts ***! + \********************************************/ + /*! exports provided: QuestionBoolean */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionBoolean", function() { return QuestionBoolean; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/utils */ "./src/utils/utils.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + var QuestionBoolean = /** @class */ (function (_super) { + __extends(QuestionBoolean, _super); + function QuestionBoolean(name) { + return _super.call(this, name) || this; + } + QuestionBoolean.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion__WEBPACK_IMPORTED_MODULE_1__["QuestionImplementor"](this); + }; + QuestionBoolean.prototype.onSwitchClick = function (data, event) { + return _super.prototype.onSwitchClickModel.call(this, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_2__["getOriginalEvent"])(event)); + }; + QuestionBoolean.prototype.onTrueLabelClick = function (data, event) { + return this.onLabelClick(event, true); + }; + QuestionBoolean.prototype.onFalseLabelClick = function (data, event) { + return this.onLabelClick(event, false); + }; + QuestionBoolean.prototype.onKeyDown = function (data, event) { + return this.onKeyDownCore(event); + }; + QuestionBoolean.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionBoolean; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionBooleanModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].overrideClassCreator("boolean", function () { + return new QuestionBoolean(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("boolean", function (name) { + return new QuestionBoolean(name); + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_buttongroup.ts": + /*!************************************************!*\ + !*** ./src/knockout/koquestion_buttongroup.ts ***! + \************************************************/ + /*! exports provided: QuestionButtonGroup */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionButtonGroup", function() { return QuestionButtonGroup; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion_baseselect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion_baseselect */ "./src/knockout/koquestion_baseselect.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + var QuestionButtonGroup = /** @class */ (function (_super) { + __extends(QuestionButtonGroup, _super); + function QuestionButtonGroup(name) { + return _super.call(this, name) || this; + } + QuestionButtonGroup.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion_baseselect__WEBPACK_IMPORTED_MODULE_1__["QuestionCheckboxBaseImplementor"](this); + }; + QuestionButtonGroup.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionButtonGroup; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionButtonGroupModel"])); + + // Serializer.overrideClassCreator("buttongroup", function() { + // return new QuestionButtonGroup(""); + // }); + // QuestionFactory.Instance.registerQuestion("buttongroup", name => { + // var q = new QuestionButtonGroup(name); + // q.choices = QuestionFactory.DefaultChoices; + // return q; + // }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_checkbox.ts": + /*!*********************************************!*\ + !*** ./src/knockout/koquestion_checkbox.ts ***! + \*********************************************/ + /*! exports provided: QuestionCheckboxImplementor, QuestionCheckbox */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCheckboxImplementor", function() { return QuestionCheckboxImplementor; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCheckbox", function() { return QuestionCheckbox; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var _koquestion_baseselect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion_baseselect */ "./src/knockout/koquestion_baseselect.ts"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + var QuestionCheckboxImplementor = /** @class */ (function (_super) { + __extends(QuestionCheckboxImplementor, _super); + function QuestionCheckboxImplementor(question) { + return _super.call(this, question) || this; + } + QuestionCheckboxImplementor.prototype.getKoValue = function () { + return this.question.renderedValue; + }; + return QuestionCheckboxImplementor; + }(_koquestion_baseselect__WEBPACK_IMPORTED_MODULE_1__["QuestionCheckboxBaseImplementor"])); + + var QuestionCheckbox = /** @class */ (function (_super) { + __extends(QuestionCheckbox, _super); + function QuestionCheckbox(name) { + var _this = _super.call(this, name) || this; + _this.isAllSelectedUpdating = false; + _this.koAllSelected = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](_this.isAllSelected); + _this.koAllSelected.subscribe(function (newValue) { + if (_this.isAllSelectedUpdating) + return; + if (newValue) + _this.selectAll(); + else + _this.clearValue(); + }); + return _this; + } + QuestionCheckbox.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new QuestionCheckboxImplementor(this); + }; + QuestionCheckbox.prototype.onSurveyValueChanged = function (newValue) { + _super.prototype.onSurveyValueChanged.call(this, newValue); + this.updateAllSelected(); + }; + QuestionCheckbox.prototype.onVisibleChoicesChanged = function () { + _super.prototype.onVisibleChoicesChanged.call(this); + this.updateAllSelected(); + }; + QuestionCheckbox.prototype.updateAllSelected = function () { + this.isAllSelectedUpdating = true; + this.koAllSelected(this.isAllSelected); + this.isAllSelectedUpdating = false; + }; + QuestionCheckbox.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + this.koAllSelected = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionCheckbox; + }(survey_core__WEBPACK_IMPORTED_MODULE_2__["QuestionCheckboxModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_2__["Serializer"].overrideClassCreator("checkbox", function () { + return new QuestionCheckbox(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_2__["QuestionFactory"].Instance.registerQuestion("checkbox", function (name) { + var q = new QuestionCheckbox(name); + q.choices = survey_core__WEBPACK_IMPORTED_MODULE_2__["QuestionFactory"].DefaultChoices; + return q; + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_comment.ts": + /*!********************************************!*\ + !*** ./src/knockout/koquestion_comment.ts ***! + \********************************************/ + /*! exports provided: QuestionComment */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionComment", function() { return QuestionComment; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + var QuestionComment = /** @class */ (function (_super) { + __extends(QuestionComment, _super); + function QuestionComment(name) { + return _super.call(this, name) || this; + } + QuestionComment.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion__WEBPACK_IMPORTED_MODULE_1__["QuestionImplementor"](this); + }; + QuestionComment.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionComment; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionCommentModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].overrideClassCreator("comment", function () { + return new QuestionComment(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("comment", function (name) { + return new QuestionComment(name); + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_custom.ts": + /*!*******************************************!*\ + !*** ./src/knockout/koquestion_custom.ts ***! + \*******************************************/ + /*! exports provided: QuestionCustom, QuestionComposite */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCustom", function() { return QuestionCustom; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionComposite", function() { return QuestionComposite; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + var QuestionCustom = /** @class */ (function (_super) { + __extends(QuestionCustom, _super); + function QuestionCustom(name, questionJSON) { + return _super.call(this, name, questionJSON) || this; + } + QuestionCustom.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion__WEBPACK_IMPORTED_MODULE_1__["QuestionImplementor"](this); + }; + QuestionCustom.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionCustom; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionCustomModel"])); + + var QuestionComposite = /** @class */ (function (_super) { + __extends(QuestionComposite, _super); + function QuestionComposite(name, questionJSON) { + return _super.call(this, name, questionJSON) || this; + } + QuestionComposite.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion__WEBPACK_IMPORTED_MODULE_1__["QuestionImplementor"](this); + }; + QuestionComposite.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionComposite; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionCompositeModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_0__["ComponentCollection"].Instance.onCreateCustom = function (name, questionJSON) { + return new QuestionCustom(name, questionJSON); + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["ComponentCollection"].Instance.onCreateComposite = function (name, questionJSON) { + return new QuestionComposite(name, questionJSON); + }; + + + /***/ }), + + /***/ "./src/knockout/koquestion_dropdown.ts": + /*!*********************************************!*\ + !*** ./src/knockout/koquestion_dropdown.ts ***! + \*********************************************/ + /*! exports provided: QuestionDropdown */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionDropdown", function() { return QuestionDropdown; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion_baseselect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./koquestion_baseselect */ "./src/knockout/koquestion_baseselect.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + var QuestionDropdownImplementor = /** @class */ (function (_super) { + __extends(QuestionDropdownImplementor, _super); + function QuestionDropdownImplementor(question) { + return _super.call(this, question) || this; + } + return QuestionDropdownImplementor; + }(_koquestion_baseselect__WEBPACK_IMPORTED_MODULE_2__["QuestionSelectBaseImplementor"])); + var QuestionDropdown = /** @class */ (function (_super) { + __extends(QuestionDropdown, _super); + function QuestionDropdown(name) { + var _this = _super.call(this, name) || this; + _this.koDisableOption = function (option, item) { + if (!item) + return; + knockout__WEBPACK_IMPORTED_MODULE_0__["applyBindingsToNode"](option, { disable: knockout__WEBPACK_IMPORTED_MODULE_0__["computed"](function () { return !item.isEnabled; }) }, item); + }; + return _this; + } + QuestionDropdown.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new QuestionDropdownImplementor(this); + }; + QuestionDropdown.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionDropdown; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionDropdownModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].overrideClassCreator("dropdown", function () { + return new QuestionDropdown(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("dropdown", function (name) { + var q = new QuestionDropdown(name); + q.choices = survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].DefaultChoices; + return q; + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_empty.ts": + /*!******************************************!*\ + !*** ./src/knockout/koquestion_empty.ts ***! + \******************************************/ + /*! exports provided: QuestionEmpty */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionEmpty", function() { return QuestionEmpty; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + var QuestionEmpty = /** @class */ (function (_super) { + __extends(QuestionEmpty, _super); + function QuestionEmpty(name) { + return _super.call(this, name) || this; + } + QuestionEmpty.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion__WEBPACK_IMPORTED_MODULE_1__["QuestionImplementor"](this); + }; + QuestionEmpty.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionEmpty; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionEmptyModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].overrideClassCreator("empty", function () { + return new QuestionEmpty(""); + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_expression.ts": + /*!***********************************************!*\ + !*** ./src/knockout/koquestion_expression.ts ***! + \***********************************************/ + /*! exports provided: QuestionExpression */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionExpression", function() { return QuestionExpression; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + var QuestionExpression = /** @class */ (function (_super) { + __extends(QuestionExpression, _super); + function QuestionExpression(name) { + return _super.call(this, name) || this; + } + QuestionExpression.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion__WEBPACK_IMPORTED_MODULE_1__["QuestionImplementor"](this); + }; + QuestionExpression.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionExpression; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionExpressionModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].overrideClassCreator("expression", function () { + return new QuestionExpression(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("expression", function (name) { + return new QuestionExpression(name); + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_file.ts": + /*!*****************************************!*\ + !*** ./src/knockout/koquestion_file.ts ***! + \*****************************************/ + /*! exports provided: QuestionFile */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionFile", function() { return QuestionFile; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/utils */ "./src/utils/utils.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + var QuestionFileImplementor = /** @class */ (function (_super) { + __extends(QuestionFileImplementor, _super); + function QuestionFileImplementor(question) { + var _this = _super.call(this, question) || this; + _this.setObservaleObj("koState", knockout__WEBPACK_IMPORTED_MODULE_0__["observable"]("empty")); + _this.setObservaleObj("koHasValue", knockout__WEBPACK_IMPORTED_MODULE_0__["computed"](function () { return _this.question.koState() === "loaded"; })); + _this.setObservaleObj("koData", knockout__WEBPACK_IMPORTED_MODULE_0__["computed"](function () { + if (_this.question.koHasValue()) { + return _this.question.previewValue; + } + return []; + })); + _this.setObservaleObj("koInputTitle", knockout__WEBPACK_IMPORTED_MODULE_0__["observable"]()); + _this.setObservaleObj("koChooseFileCss", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + return _this.question.getChooseFileCss(); + })); + _this.setCallbackFunc("ondrop", function (data, event) { + _this.question.onDrop(Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["getOriginalEvent"])(event)); + }); + _this.setCallbackFunc("ondragover", function (data, event) { + _this.question.onDragOver(Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["getOriginalEvent"])(event)); + }); + _this.setCallbackFunc("ondragleave", function (data, event) { + _this.question.onDragLeave(Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["getOriginalEvent"])(event)); + }); + _this.setCallbackFunc("dochange", function (data, event) { + _this.question.doChange(Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["getOriginalEvent"])(event)); + }); + _this.setCallbackFunc("doclean", function (data, event) { + _this.question.doClean(Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["getOriginalEvent"])(event)); + }); + _this.setCallbackFunc("doremovefile", function (data, event) { + _this.question.doRemoveFile(data); + }); + _this.setCallbackFunc("dodownload", function (data, event) { + _this.question.doDownloadFile(Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["getOriginalEvent"])(event), data); + return true; + }); + return _this; + } + return QuestionFileImplementor; + }(_koquestion__WEBPACK_IMPORTED_MODULE_2__["QuestionImplementor"])); + var QuestionFile = /** @class */ (function (_super) { + __extends(QuestionFile, _super); + function QuestionFile(name) { + var _this = _super.call(this, name) || this; + var updateState = function (state) { + _this.koState(state); + _this.koInputTitle(_this.inputTitle); + }; + _this.onStateChanged.add(function (sender, options) { + updateState(options.state); + }); + return _this; + } + QuestionFile.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new QuestionFileImplementor(this); + }; + QuestionFile.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionFile; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFileModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].overrideClassCreator("file", function () { + return new QuestionFile(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("file", function (name) { + return new QuestionFile(name); + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_html.ts": + /*!*****************************************!*\ + !*** ./src/knockout/koquestion_html.ts ***! + \*****************************************/ + /*! exports provided: QuestionHtml */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionHtml", function() { return QuestionHtml; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + var QuestionHtml = /** @class */ (function (_super) { + __extends(QuestionHtml, _super); + function QuestionHtml(name) { + return _super.call(this, name) || this; + } + QuestionHtml.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion__WEBPACK_IMPORTED_MODULE_1__["QuestionImplementor"](this); + }; + QuestionHtml.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionHtml; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionHtmlModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].overrideClassCreator("html", function () { + return new QuestionHtml(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("html", function (name) { + return new QuestionHtml(name); + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_image.ts": + /*!******************************************!*\ + !*** ./src/knockout/koquestion_image.ts ***! + \******************************************/ + /*! exports provided: QuestionImage */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionImage", function() { return QuestionImage; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + var QuestionImage = /** @class */ (function (_super) { + __extends(QuestionImage, _super); + function QuestionImage(name) { + return _super.call(this, name) || this; + } + QuestionImage.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion__WEBPACK_IMPORTED_MODULE_1__["QuestionImplementor"](this); + }; + QuestionImage.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionImage; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionImageModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].overrideClassCreator("image", function () { + return new QuestionImage(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("image", function (name) { + return new QuestionImage(name); + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_imagepicker.ts": + /*!************************************************!*\ + !*** ./src/knockout/koquestion_imagepicker.ts ***! + \************************************************/ + /*! exports provided: QuestionImagePicker */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionImagePicker", function() { return QuestionImagePicker; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion_baseselect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion_baseselect */ "./src/knockout/koquestion_baseselect.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + var QuestionImagePickerImplementor = /** @class */ (function (_super) { + __extends(QuestionImagePickerImplementor, _super); + function QuestionImagePickerImplementor(question) { + return _super.call(this, question) || this; + } + QuestionImagePickerImplementor.prototype.getKoValue = function () { + return this.question.renderedValue; + }; + return QuestionImagePickerImplementor; + }(_koquestion_baseselect__WEBPACK_IMPORTED_MODULE_1__["QuestionCheckboxBaseImplementor"])); + var QuestionImagePicker = /** @class */ (function (_super) { + __extends(QuestionImagePicker, _super); + function QuestionImagePicker(name) { + return _super.call(this, name) || this; + } + QuestionImagePicker.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new QuestionImagePickerImplementor(this); + }; + QuestionImagePicker.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionImagePicker; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionImagePickerModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].overrideClassCreator("imagepicker", function () { + return new QuestionImagePicker(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("imagepicker", function (name) { + var q = new QuestionImagePicker(name); + //q.choices = QuestionFactory.DefaultChoices; + return q; + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_matrix.ts": + /*!*******************************************!*\ + !*** ./src/knockout/koquestion_matrix.ts ***! + \*******************************************/ + /*! exports provided: QuestionMatrix */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrix", function() { return QuestionMatrix; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + /* harmony import */ var _kobase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./kobase */ "./src/knockout/kobase.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + var QuestionMatrix = /** @class */ (function (_super) { + __extends(QuestionMatrix, _super); + function QuestionMatrix(name) { + var _this = _super.call(this, name) || this; + _this.koVisibleRows = knockout__WEBPACK_IMPORTED_MODULE_0__["observableArray"](); + _this.koVisibleColumns = knockout__WEBPACK_IMPORTED_MODULE_0__["observableArray"](); + _this.koVisibleRows(_this.visibleRows); + _this.koVisibleColumns(_this.visibleColumns); + return _this; + } + QuestionMatrix.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion__WEBPACK_IMPORTED_MODULE_2__["QuestionImplementor"](this); + }; + QuestionMatrix.prototype.onColumnsChanged = function () { + _super.prototype.onColumnsChanged.call(this); + this.koVisibleColumns(this.visibleColumns); + }; + QuestionMatrix.prototype.onRowsChanged = function () { + _super.prototype.onRowsChanged.call(this); + this.koVisibleRows(this.visibleRows); + }; + QuestionMatrix.prototype.onSurveyLoad = function () { + _super.prototype.onSurveyLoad.call(this); + this.onRowsChanged(); + }; + QuestionMatrix.prototype.onMatrixRowCreated = function (row) { + new _kobase__WEBPACK_IMPORTED_MODULE_3__["ImplementorBase"](row); + }; + QuestionMatrix.prototype.getVisibleRows = function () { + var rows = _super.prototype.getVisibleRows.call(this); + this.koVisibleRows(rows); + return rows; + }; + QuestionMatrix.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + this.koVisibleRows = undefined; + this.koVisibleColumns = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionMatrix; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionMatrixModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].overrideClassCreator("matrix", function () { + return new QuestionMatrix(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("matrix", function (name) { + var q = new QuestionMatrix(name); + q.rows = survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].DefaultRows; + q.columns = survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].DefaultColums; + return q; + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_matrixdropdown.ts": + /*!***************************************************!*\ + !*** ./src/knockout/koquestion_matrixdropdown.ts ***! + \***************************************************/ + /*! exports provided: QuestionMatrixBaseImplementor, QuestionMatrixDropdown */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixBaseImplementor", function() { return QuestionMatrixBaseImplementor; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDropdown", function() { return QuestionMatrixDropdown; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + /* harmony import */ var _kobase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./kobase */ "./src/knockout/kobase.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + + + var QuestionMatrixBaseImplementor = /** @class */ (function (_super) { + __extends(QuestionMatrixBaseImplementor, _super); + function QuestionMatrixBaseImplementor(question) { + var _this = _super.call(this, question) || this; + _this.koRecalc = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](0); + (_this.question).onRenderedTableCreatedCallback = function (table) { + if (!!_this._tableImplementor) { + _this._tableImplementor.dispose(); + } + _this._tableImplementor = new _kobase__WEBPACK_IMPORTED_MODULE_3__["ImplementorBase"](table); + }; + (_this.question).onRenderedTableResetCallback = function () { + if (_this.question.isDisposed) + return; + _this.koRecalc(_this.koRecalc() + 1); + }; + _this.setObservaleObj("koTable", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.renderedTable; + })); + _this.setCallbackFunc("koCellAfterRender", function (el, con) { + return _this.cellAfterRender(el, con); + }); + _this.setCallbackFunc("koCellQuestionAfterRender", function (el, con) { + return _this.cellQuestionAfterRender(el, con); + }); + _this.setCallbackFunc("koAddRowClick", function () { + _this.addRow(); + }); + _this.setCallbackFunc("koRemoveRowClick", function (data) { + _this.removeRow(data.row); + }); + _this.setCallbackFunc("koPanelAfterRender", function (el, con) { + _this.panelAfterRender(el, con); + }); + return _this; + } + QuestionMatrixBaseImplementor.prototype.getQuestionTemplate = function () { + return "matrixdynamic"; + }; + QuestionMatrixBaseImplementor.prototype.cellAfterRender = function (elements, con) { + var _this = this; + if (!this.question.survey) + return; + setTimeout(function () { + !!knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"] && knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"].runEarly(); + var el = survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].GetFirstNonTextElement(elements); + if (!el) + return; + var cell = con; + var options = { + cell: cell.cell, + cellQuestion: cell.question, + htmlElement: el, + row: cell.row, + column: !!cell.cell ? cell.cell.column : null, + }; + _this.question.survey.matrixAfterCellRender(_this.question, options); + }, 0); + }; + QuestionMatrixBaseImplementor.prototype.cellQuestionAfterRender = function (elements, con) { + if (!this.question.survey) + return; + setTimeout(function () { + !!knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"] && knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"].runEarly(); + var el = survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].GetFirstNonTextElement(elements); + if (!el) + return; + var cell = con; + if (cell.question.customWidget) { + cell.question.customWidget.afterRender(cell.question, el); + knockout__WEBPACK_IMPORTED_MODULE_0__["utils"].domNodeDisposal.addDisposeCallback(el, function () { + cell.question.customWidget.willUnmount(cell.question, el); + }); + } + cell.question.afterRenderQuestionElement(el); + }, 0); + }; + QuestionMatrixBaseImplementor.prototype.isAddRowTop = function () { + return false; + }; + QuestionMatrixBaseImplementor.prototype.isAddRowBottom = function () { + return false; + }; + QuestionMatrixBaseImplementor.prototype.addRow = function () { }; + QuestionMatrixBaseImplementor.prototype.removeRow = function (row) { }; + QuestionMatrixBaseImplementor.prototype.panelAfterRender = function (elements, con) { + if (!this.question || !this.question.survey) + return; + var el = survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].GetFirstNonTextElement(elements); + this.question.survey.afterRenderPanel(con, el); + }; + QuestionMatrixBaseImplementor.prototype.dispose = function () { + if (!!this._tableImplementor) { + this._tableImplementor.dispose(); + } + (this.question).onRenderedTableCreatedCallback = undefined; + (this.question).onRenderedTableResetCallback = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionMatrixBaseImplementor; + }(_koquestion__WEBPACK_IMPORTED_MODULE_2__["QuestionImplementor"])); + + var QuestionMatrixDropdown = /** @class */ (function (_super) { + __extends(QuestionMatrixDropdown, _super); + function QuestionMatrixDropdown(name) { + return _super.call(this, name) || this; + } + QuestionMatrixDropdown.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new QuestionMatrixBaseImplementor(this); + }; + QuestionMatrixDropdown.prototype.dispose = function () { + _super.prototype.dispose.call(this); + this._implementor.dispose(); + this._implementor = undefined; + }; + return QuestionMatrixDropdown; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionMatrixDropdownModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].overrideClassCreator("matrixdropdown", function () { + return new QuestionMatrixDropdown(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("matrixdropdown", function (name) { + var q = new QuestionMatrixDropdown(name); + q.choices = [1, 2, 3, 4, 5]; + q.rows = survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].DefaultRows; + survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionMatrixDropdownModelBase"].addDefaultColumns(q); + return q; + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_matrixdynamic.ts": + /*!**************************************************!*\ + !*** ./src/knockout/koquestion_matrixdynamic.ts ***! + \**************************************************/ + /*! exports provided: QuestionMatrixDynamicImplementor, QuestionMatrixDynamic */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDynamicImplementor", function() { return QuestionMatrixDynamicImplementor; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDynamic", function() { return QuestionMatrixDynamic; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion_matrixdropdown__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./koquestion_matrixdropdown */ "./src/knockout/koquestion_matrixdropdown.ts"); + /* harmony import */ var _kobase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./kobase */ "./src/knockout/kobase.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + + var QuestionMatrixDynamicImplementor = /** @class */ (function (_super) { + __extends(QuestionMatrixDynamicImplementor, _super); + function QuestionMatrixDynamicImplementor(question) { + var _this = _super.call(this, question) || this; + _this.question["getKoPopupIsVisible"] = _this.getKoPopupIsVisible; + return _this; + } + QuestionMatrixDynamicImplementor.prototype.addRow = function () { + this.question.addRowUI(); + }; + QuestionMatrixDynamicImplementor.prototype.removeRow = function (row) { + this.question.removeRowUI(row); + }; + QuestionMatrixDynamicImplementor.prototype.getKoPopupIsVisible = function (row) { + return knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](row.isDetailPanelShowing); + }; + QuestionMatrixDynamicImplementor.prototype.dispose = function () { + _super.prototype.dispose.call(this); + this.question["getKoPopupIsVisible"] = undefined; + }; + return QuestionMatrixDynamicImplementor; + }(_koquestion_matrixdropdown__WEBPACK_IMPORTED_MODULE_2__["QuestionMatrixBaseImplementor"])); + + var QuestionMatrixDynamic = /** @class */ (function (_super) { + __extends(QuestionMatrixDynamic, _super); + function QuestionMatrixDynamic(name) { + return _super.call(this, name) || this; + } + QuestionMatrixDynamic.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new QuestionMatrixDynamicImplementor(this); + }; + QuestionMatrixDynamic.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionMatrixDynamic; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionMatrixDynamicModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].overrideClassCreator("matrixdynamic", function () { + return new QuestionMatrixDynamic(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionMatrixDropdownRenderedRow"].prototype["onCreating"] = function () { + new _kobase__WEBPACK_IMPORTED_MODULE_3__["ImplementorBase"](this); + }; + survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("matrixdynamic", function (name) { + var q = new QuestionMatrixDynamic(name); + q.choices = [1, 2, 3, 4, 5]; + q.rowCount = 2; + survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionMatrixDropdownModelBase"].addDefaultColumns(q); + return q; + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_multipletext.ts": + /*!*************************************************!*\ + !*** ./src/knockout/koquestion_multipletext.ts ***! + \*************************************************/ + /*! exports provided: MultipleTextItem, QuestionMultipleTextImplementor, QuestionMultipleText */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MultipleTextItem", function() { return MultipleTextItem; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMultipleTextImplementor", function() { return QuestionMultipleTextImplementor; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMultipleText", function() { return QuestionMultipleText; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + /* harmony import */ var _koquestion_text__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./koquestion_text */ "./src/knockout/koquestion_text.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + var MultipleTextItem = /** @class */ (function (_super) { + __extends(MultipleTextItem, _super); + function MultipleTextItem(name, title) { + if (name === void 0) { name = null; } + if (title === void 0) { title = null; } + return _super.call(this, name, title) || this; + } + MultipleTextItem.prototype.createEditor = function (name) { + return new _koquestion_text__WEBPACK_IMPORTED_MODULE_3__["QuestionText"](name); + }; + return MultipleTextItem; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["MultipleTextItemModel"])); + + var QuestionMultipleTextImplementor = /** @class */ (function (_super) { + __extends(QuestionMultipleTextImplementor, _super); + function QuestionMultipleTextImplementor(question) { + var _this = _super.call(this, question) || this; + _this.koRecalc = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](0); + _this.setObservaleObj("koItemCss", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.getItemCss(); + })); + _this.setObservaleObj("koItemTitleCss", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.getItemTitleCss(); + })); + return _this; + } + return QuestionMultipleTextImplementor; + }(_koquestion__WEBPACK_IMPORTED_MODULE_2__["QuestionImplementor"])); + + var QuestionMultipleText = /** @class */ (function (_super) { + __extends(QuestionMultipleText, _super); + function QuestionMultipleText(name) { + var _this = _super.call(this, name) || this; + _this.koRows = knockout__WEBPACK_IMPORTED_MODULE_0__["observableArray"](_this.getRows()); + _this.colCountChangedCallback = function () { + _this.onColCountChanged(); + }; + _this.onColCountChanged(); + return _this; + } + QuestionMultipleText.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new QuestionMultipleTextImplementor(this); + }; + QuestionMultipleText.prototype.onColCountChanged = function () { + this.koRows(this.getRows()); + }; + QuestionMultipleText.prototype.createTextItem = function (name, title) { + return new MultipleTextItem(name, title); + }; + QuestionMultipleText.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + this.koRows = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionMultipleText; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionMultipleTextModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].overrideClassCreator("multipletextitem", function () { + return new MultipleTextItem(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].overrideClassCreator("multipletext", function () { + return new QuestionMultipleText(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("multipletext", function (name) { + var q = new QuestionMultipleText(name); + survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionMultipleTextModel"].addDefaultItems(q); + return q; + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_paneldynamic.ts": + /*!*************************************************!*\ + !*** ./src/knockout/koquestion_paneldynamic.ts ***! + \*************************************************/ + /*! exports provided: QuestionPanelDynamicImplementor, QuestionPanelDynamic */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionPanelDynamicImplementor", function() { return QuestionPanelDynamicImplementor; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionPanelDynamic", function() { return QuestionPanelDynamic; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + var QuestionPanelDynamicImplementor = /** @class */ (function (_super) { + __extends(QuestionPanelDynamicImplementor, _super); + function QuestionPanelDynamicImplementor(question) { + var _this = _super.call(this, question) || this; + _this.koRecalc = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](0); + _this.setCallbackFunc("koAddPanelClick", function () { + _this.addPanel(); + }); + _this.setCallbackFunc("koRemovePanelClick", function (data) { + _this.removePanel(data); + }); + _this.setCallbackFunc("koPrevPanelClick", function () { + _this.question.goToPrevPanel(); + }); + _this.setCallbackFunc("koNextPanelClick", function () { + _this.question.goToNextPanel(); + }); + _this.setObservaleObj("koCanAddPanel", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.canAddPanel; + })); + _this.setObservaleObj("koCanRemovePanel", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.canRemovePanel; + })); + _this.setObservaleObj("koIsPrevButton", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.isPrevButtonShowing; + })); + _this.setObservaleObj("koIsNextButton", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.isNextButtonShowing; + })); + _this.setObservaleObj("koIsRange", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.isRangeShowing; + })); + _this.setObservaleObj("koPanel", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.currentPanel; + })); + _this.setObservaleObj("koIsList", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.isRenderModeList; + })); + _this.setObservaleObj("koIsProgressTop", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.isProgressTopShowing; + })); + _this.setObservaleObj("koIsProgressBottom", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.isProgressBottomShowing; + })); + var koRangeValue = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](_this.question.currentIndex); + koRangeValue.subscribe(function (newValue) { + _this.question.currentIndex = newValue; + }); + _this.setObservaleObj("koRangeValue", koRangeValue); + _this.setObservaleObj("koRangeMax", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.panelCount - 1; + })); + _this.setObservaleObj("koAddButtonCss", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.getAddButtonCss(); + })); + _this.setObservaleObj("koPrevButtonCss", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.getPrevButtonCss(); + })); + _this.setObservaleObj("koNextButtonCss", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.getNextButtonCss(); + })); + _this.setObservaleObj("koProgressText", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.progressText; + })); + _this.setObservaleObj("koProgress", knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { + _this.koRecalc(); + return _this.question.progress; + })); + _this.setCallbackFunc("koPanelAfterRender", function (el, con) { + _this.panelAfterRender(el, con); + }); + _this.question.panelCountChangedCallback = function () { + _this.onPanelCountChanged(); + }; + _this.question.renderModeChangedCallback = function () { + _this.onRenderModeChanged(); + }; + _this.question.currentIndexChangedCallback = function () { + _this.onCurrentIndexChanged(); + }; + return _this; + } + QuestionPanelDynamicImplementor.prototype.onPanelCountChanged = function () { + this.onCurrentIndexChanged(); + }; + QuestionPanelDynamicImplementor.prototype.onRenderModeChanged = function () { + this.onCurrentIndexChanged(); + }; + QuestionPanelDynamicImplementor.prototype.onCurrentIndexChanged = function () { + if (this.question.isDisposed) + return; + this.koRecalc(this.koRecalc() + 1); + this.question.koRangeValue(this.question.currentIndex); + }; + QuestionPanelDynamicImplementor.prototype.addPanel = function () { + this.question.addPanelUI(); + }; + QuestionPanelDynamicImplementor.prototype.removePanel = function (val) { + if (!this.question.isRenderModeList) { + val = this.question.currentPanel; + } + this.question.removePanelUI(val); + }; + QuestionPanelDynamicImplementor.prototype.panelAfterRender = function (elements, con) { + if (!this.question || !this.question.survey) + return; + var el = survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].GetFirstNonTextElement(elements); + this.question.survey.afterRenderPanel(con, el); + }; + QuestionPanelDynamicImplementor.prototype.dispose = function () { + this.question.panelCountChangedCallback = undefined; + this.question.renderModeChangedCallback = undefined; + this.question.currentIndexChangedCallback = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionPanelDynamicImplementor; + }(_koquestion__WEBPACK_IMPORTED_MODULE_2__["QuestionImplementor"])); + + var QuestionPanelDynamic = /** @class */ (function (_super) { + __extends(QuestionPanelDynamic, _super); + function QuestionPanelDynamic(name) { + return _super.call(this, name) || this; + } + QuestionPanelDynamic.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new QuestionPanelDynamicImplementor(this); + }; + QuestionPanelDynamic.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionPanelDynamic; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionPanelDynamicModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].overrideClassCreator("paneldynamic", function () { + return new QuestionPanelDynamic(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("paneldynamic", function (name) { + return new QuestionPanelDynamic(name); + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_radiogroup.ts": + /*!***********************************************!*\ + !*** ./src/knockout/koquestion_radiogroup.ts ***! + \***********************************************/ + /*! exports provided: QuestionRadiogroup */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRadiogroup", function() { return QuestionRadiogroup; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion_baseselect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion_baseselect */ "./src/knockout/koquestion_baseselect.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + var QuestionRadiogroup = /** @class */ (function (_super) { + __extends(QuestionRadiogroup, _super); + function QuestionRadiogroup(name) { + return _super.call(this, name) || this; + } + QuestionRadiogroup.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion_baseselect__WEBPACK_IMPORTED_MODULE_1__["QuestionCheckboxBaseImplementor"](this); + }; + QuestionRadiogroup.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionRadiogroup; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionRadiogroupModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].overrideClassCreator("radiogroup", function () { + return new QuestionRadiogroup(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("radiogroup", function (name) { + var q = new QuestionRadiogroup(name); + q.choices = survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].DefaultChoices; + return q; + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_ranking.ts": + /*!********************************************!*\ + !*** ./src/knockout/koquestion_ranking.ts ***! + \********************************************/ + /*! exports provided: QuestionRanking */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRanking", function() { return QuestionRanking; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + var QuestionRanking = /** @class */ (function (_super) { + __extends(QuestionRanking, _super); + function QuestionRanking() { + var _this = _super !== null && _super.apply(this, arguments) || this; + _this.koHandleKeydown = function (data, event) { + _this.handleKeydown(event, data); + return true; + }; + _this.koHandlePointerDown = function (data, event) { + event.preventDefault(); + _this.handlePointerDown(event, data, event.currentTarget); + return true; + }; + return _this; + } + QuestionRanking.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion__WEBPACK_IMPORTED_MODULE_1__["QuestionImplementor"](this); + }; + QuestionRanking.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionRanking; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionRankingModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].overrideClassCreator("ranking", function () { + return new QuestionRanking(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("ranking", function (name) { + var q = new QuestionRanking(name); + q.choices = survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].DefaultChoices; + return q; + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_rating.ts": + /*!*******************************************!*\ + !*** ./src/knockout/koquestion_rating.ts ***! + \*******************************************/ + /*! exports provided: QuestionRatingImplementor, QuestionRating */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRatingImplementor", function() { return QuestionRatingImplementor; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRating", function() { return QuestionRating; }); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + var QuestionRatingImplementor = /** @class */ (function (_super) { + __extends(QuestionRatingImplementor, _super); + function QuestionRatingImplementor(question) { + var _this = _super.call(this, question) || this; + _this.onCreated(); + return _this; + } + QuestionRatingImplementor.prototype.onCreated = function () { }; + QuestionRatingImplementor.prototype.dispose = function () { + this.question.rateValuesChangedCallback = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionRatingImplementor; + }(_koquestion__WEBPACK_IMPORTED_MODULE_0__["QuestionImplementor"])); + + var QuestionRating = /** @class */ (function (_super) { + __extends(QuestionRating, _super); + function QuestionRating(name) { + return _super.call(this, name) || this; + } + QuestionRating.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new QuestionRatingImplementor(this); + }; + QuestionRating.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionRating; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionRatingModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["Serializer"].overrideClassCreator("rating", function () { + return new QuestionRating(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("rating", function (name) { + return new QuestionRating(name); + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_signaturepad.ts": + /*!*************************************************!*\ + !*** ./src/knockout/koquestion_signaturepad.ts ***! + \*************************************************/ + /*! exports provided: QuestionSignaturePad */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionSignaturePad", function() { return QuestionSignaturePad; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + var QuestionSignaturePad = /** @class */ (function (_super) { + __extends(QuestionSignaturePad, _super); + function QuestionSignaturePad(name) { + return _super.call(this, name) || this; + } + QuestionSignaturePad.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion__WEBPACK_IMPORTED_MODULE_1__["QuestionImplementor"](this); + }; + QuestionSignaturePad.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionSignaturePad; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionSignaturePadModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].overrideClassCreator("signaturepad", function () { + return new QuestionSignaturePad(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("signaturepad", function (name) { + return new QuestionSignaturePad(name); + }); + + + /***/ }), + + /***/ "./src/knockout/koquestion_text.ts": + /*!*****************************************!*\ + !*** ./src/knockout/koquestion_text.ts ***! + \*****************************************/ + /*! exports provided: QuestionText */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionText", function() { return QuestionText; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _koquestion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./koquestion */ "./src/knockout/koquestion.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + var QuestionText = /** @class */ (function (_super) { + __extends(QuestionText, _super); + function QuestionText(name) { + return _super.call(this, name) || this; + } + QuestionText.prototype.onBaseCreating = function () { + _super.prototype.onBaseCreating.call(this); + this._implementor = new _koquestion__WEBPACK_IMPORTED_MODULE_1__["QuestionImplementor"](this); + }; + QuestionText.prototype.dispose = function () { + this._implementor.dispose(); + this._implementor = undefined; + _super.prototype.dispose.call(this); + }; + return QuestionText; + }(survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionTextModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_0__["Serializer"].overrideClassCreator("text", function () { + return new QuestionText(""); + }); + survey_core__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("text", function (name) { + return new QuestionText(name); + }); + + + /***/ }), + + /***/ "./src/knockout/kosurvey.ts": + /*!**********************************!*\ + !*** ./src/knockout/kosurvey.ts ***! + \**********************************/ + /*! exports provided: SurveyImplementor, Survey, registerTemplateEngine */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyImplementor", function() { return SurveyImplementor; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Survey", function() { return Survey; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerTemplateEngine", function() { return registerTemplateEngine; }); + /* harmony import */ var knockout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! knockout */ "knockout"); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _templateText__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./templateText */ "./src/knockout/templateText.ts"); + /* harmony import */ var _kobase__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./kobase */ "./src/knockout/kobase.ts"); + /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/utils */ "./src/utils/utils.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + + + + survey_core__WEBPACK_IMPORTED_MODULE_1__["CustomWidgetCollection"].Instance.onCustomWidgetAdded.add(function (customWidget) { + if (customWidget.widgetJson.isDefaultRender) + return; + if (!customWidget.htmlTemplate) + customWidget.htmlTemplate = + "
'htmlTemplate' attribute is missed.
"; + new _templateText__WEBPACK_IMPORTED_MODULE_2__["SurveyTemplateText"]().replaceText(customWidget.htmlTemplate, "widget", customWidget.name); + }); + var SurveyImplementor = /** @class */ (function (_super) { + __extends(SurveyImplementor, _super); + function SurveyImplementor(survey) { + var _this = _super.call(this, survey) || this; + _this.survey = survey; + _this.survey.valueHashGetDataCallback = function (valuesHash, key) { + if (valuesHash[key] === undefined) { + valuesHash[key] = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](); + } + return knockout__WEBPACK_IMPORTED_MODULE_0__["unwrap"](valuesHash[key]); + }; + _this.survey.valueHashSetDataCallback = function (valuesHash, key, value) { + if (knockout__WEBPACK_IMPORTED_MODULE_0__["isWriteableObservable"](valuesHash[key])) { + valuesHash[key](value); + } + else { + valuesHash[key] = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](value); + } + }; + _this.survey.valueHashDeleteDataCallback = function (valuesHash, key) { + if (knockout__WEBPACK_IMPORTED_MODULE_0__["isWriteableObservable"](valuesHash[key])) { + valuesHash[key](undefined); + } + else { + delete valuesHash[key]; + } + }; + _this.survey["koTitleTemplate"] = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"]("survey-header"); + _this.survey["koAfterRenderPage"] = function (elements, con) { + var el = survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].GetFirstNonTextElement(elements); + if (!el) + return; + setTimeout(function () { + !!knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"] && knockout__WEBPACK_IMPORTED_MODULE_0__["tasks"].runEarly(); + _this.survey.afterRenderPage(el); + }, 0); + }; + _this.survey["koAfterRenderHeader"] = function (elements, con) { + var el = survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].GetFirstNonTextElement(elements); + if (el) + _this.survey.afterRenderHeader(el); + }; + _this.survey.disposeCallback = function () { + _this.dispose(); + }; + new _kobase__WEBPACK_IMPORTED_MODULE_3__["ImplementorBase"](_this.survey.timerModel); + return _this; + } + SurveyImplementor.prototype.render = function (element) { + if (element === void 0) { element = null; } + if (typeof knockout__WEBPACK_IMPORTED_MODULE_0__ === "undefined") + throw new Error("knockoutjs library is not loaded."); + var page = this.survey.activePage; + if (!!page) { + page.updateCustomWidgets(); + } + this.survey.updateElementCss(false); + if (element && typeof element === "string") { + element = document.getElementById(element); + } + if (element) { + this.renderedElement = element; + } + this.survey.startTimerFromUI(); + this.applyBinding(); + }; + SurveyImplementor.prototype.applyBinding = function () { + if (!this.renderedElement) + return; + knockout__WEBPACK_IMPORTED_MODULE_0__["cleanNode"](this.renderedElement); + knockout__WEBPACK_IMPORTED_MODULE_0__["renderTemplate"]("survey-content", this.survey, {}, this.renderedElement); + }; + SurveyImplementor.prototype.koEventAfterRender = function (element, survey) { + if (survey["needRenderIcons"]) { + survey_core__WEBPACK_IMPORTED_MODULE_1__["SvgRegistry"].renderIcons(); + } + survey.afterRenderSurvey(element); + }; + SurveyImplementor.prototype.dispose = function () { + _super.prototype.dispose.call(this); + if (!!this.renderedElement) { + knockout__WEBPACK_IMPORTED_MODULE_0__["cleanNode"](this.renderedElement); + this.renderedElement.innerHTML = ""; + } + this.survey["koAfterRenderPage"] = undefined; + this.survey["koAfterRenderHeader"] = undefined; + this.survey.iteratePropertiesHash(function (hash, key) { + delete hash[key]; + }); + }; + return SurveyImplementor; + }(_kobase__WEBPACK_IMPORTED_MODULE_3__["ImplementorBase"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyModel"].prototype["onCreating"] = function () { + this.implementor = new SurveyImplementor(this); + }; + survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyModel"].prototype["render"] = function (element) { + if (element === void 0) { element = null; } + this.implementor.render(element); + }; + survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyModel"].prototype["getHtmlTemplate"] = function () { + return _templateText__WEBPACK_IMPORTED_MODULE_2__["koTemplate"]; + }; + var Survey = /** @class */ (function (_super) { + __extends(Survey, _super); + function Survey(jsonObj, renderedElement) { + if (jsonObj === void 0) { jsonObj = null; } + if (renderedElement === void 0) { renderedElement = null; } + return _super.call(this, jsonObj, renderedElement) || this; + } + return Survey; + }(survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyModel"])); + + survey_core__WEBPACK_IMPORTED_MODULE_1__["LocalizableString"].prototype["onCreating"] = function () { + // var self = this; + // this.koReRender = ko.observable(0); + this.koHasHtml = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](this.hasHtml); + this.koRenderedHtml = knockout__WEBPACK_IMPORTED_MODULE_0__["observable"](this.renderedHtml); + // Object.defineProperty(self, "koHasHtml", { + // get: () => { + // self.koReRender(); + // return self.hasHtml; + // }, + // }); + // this.koRenderedHtml = ko.pureComputed(function() { + // self.koReRender(); + // return self.renderedHtml; + // }); + }; + survey_core__WEBPACK_IMPORTED_MODULE_1__["ItemValue"].prototype["onCreating"] = function () { + var _this = this; + new _kobase__WEBPACK_IMPORTED_MODULE_3__["ImplementorBase"](this); + this.koText = knockout__WEBPACK_IMPORTED_MODULE_0__["pureComputed"](function () { return _this.locText.koRenderedHtml(); }); + }; + survey_core__WEBPACK_IMPORTED_MODULE_1__["LocalizableString"].prototype["onChanged"] = function () { + // this.koReRender(this.koReRender() + 1); + var hasHtml = this.hasHtml; + this.koHasHtml(hasHtml); + this.koRenderedHtml(hasHtml ? this.getHtmlValue() : this.calculatedText); + }; + knockout__WEBPACK_IMPORTED_MODULE_0__["components"].register("survey", { + viewModel: { + createViewModel: function (params, componentInfo) { + var survey = knockout__WEBPACK_IMPORTED_MODULE_0__["unwrap"](params.survey); + setTimeout(function () { + var surveyRoot = document.createElement("div"); + componentInfo.element.appendChild(surveyRoot); + survey.render(surveyRoot); + }, 1); + // !!ko.tasks && ko.tasks.runEarly(); + return params.survey; + }, + }, + template: _templateText__WEBPACK_IMPORTED_MODULE_2__["koTemplate"], + }); + knockout__WEBPACK_IMPORTED_MODULE_0__["bindingHandlers"]["surveyProp"] = { + update: function (element, valueAccessor, allBindingsAccessor) { + var value = knockout__WEBPACK_IMPORTED_MODULE_0__["utils"].unwrapObservable(valueAccessor()) || {}; + for (var propName in value) { + if (typeof propName == "string") { + var propValue = knockout__WEBPACK_IMPORTED_MODULE_0__["utils"].unwrapObservable(value[propName]); + element[propName] = propValue; + } + } + }, + }; + survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyModel"].platform = "knockout"; + var registerTemplateEngine = function (ko, platform) { + ko.surveyTemplateEngine = function () { }; + ko.surveyTemplateEngine.prototype = new ko.nativeTemplateEngine(); + ko.surveyTemplateEngine.prototype.makeTemplateSource = function (template, templateDocument) { + if (typeof template === "string") { + templateDocument = templateDocument || document; + var templateElementRoot = templateDocument.getElementById("survey-content-" + platform); + if (!templateElementRoot) { + templateElementRoot = document.createElement("div"); + templateElementRoot.id = "survey-content-" + survey_core__WEBPACK_IMPORTED_MODULE_1__["SurveyModel"].platform; + templateElementRoot.style.display = "none"; + templateElementRoot.innerHTML = _templateText__WEBPACK_IMPORTED_MODULE_2__["koTemplate"]; + document.body.appendChild(templateElementRoot); + } + var elem; + for (var i = 0; i < templateElementRoot.children.length; i++) { + if (templateElementRoot.children[i].id === template) { + elem = templateElementRoot.children[i]; + break; + } + } + if (!elem) { + elem = templateDocument.getElementById(template); + } + if (!elem) { + return new ko.nativeTemplateEngine().makeTemplateSource(template, templateDocument); + } + return new ko.templateSources.domElement(elem); + } + else if (template.nodeType === 1 || template.nodeType === 8) { + return new ko.templateSources.anonymousTemplate(template); + } + else { + throw new Error("Unknown template type: " + template); + } + }; + // (ko).surveyTemplateEngine.prototype.renderTemplateSource = function (templateSource: any, bindingContext: any, options: any, templateDocument: any) { + // var useNodesIfAvailable = !((ko.utils).ieVersion < 9), + // templateNodesFunc = useNodesIfAvailable ? templateSource["nodes"] : null, + // templateNodes = templateNodesFunc ? templateSource["nodes"]() : null; + // if (templateNodes) { + // return (ko.utils).makeArray(templateNodes.cloneNode(true).childNodes); + // } else { + // var templateText = templateSource["text"](); + // return (ko.utils).parseHtmlFragment(templateText, templateDocument); + // } + // }; + var surveyTemplateEngineInstance = new ko.surveyTemplateEngine(); + ko.setTemplateEngine(surveyTemplateEngineInstance); + }; + knockout__WEBPACK_IMPORTED_MODULE_0__["bindingHandlers"]["key2click"] = { + init: function (element, valueAccessor, allBindingsAccessor, viewModel) { + var options = valueAccessor() || { + processEsc: true + }; + if (viewModel.disableTabStop) { + element.tabIndex = -1; + return; + } + element.tabIndex = 0; + element.onkeyup = function (evt) { + evt.preventDefault(); + evt.stopPropagation(); + Object(_utils_utils__WEBPACK_IMPORTED_MODULE_4__["doKey2ClickUp"])(evt, options); + return false; + }; + element.onkeydown = function (evt) { return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_4__["doKey2ClickDown"])(evt, options); }; + element.onblur = function (evt) { return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_4__["doKey2ClickBlur"])(evt); }; + }, + }; + + + /***/ }), + + /***/ "./src/knockout/templateText.ts": + /*!**************************************!*\ + !*** ./src/knockout/templateText.ts ***! + \**************************************/ + /*! exports provided: koTemplate, SurveyTemplateText */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "koTemplate", function() { return koTemplate; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTemplateText", function() { return SurveyTemplateText; }); + var koTemplate = __webpack_require__(/*! html-loader?interpolate!val-loader!./templates/entry.html */ "./node_modules/html-loader/index.js?interpolate!./node_modules/val-loader/index.js!./src/knockout/templates/entry.html"); + var SurveyTemplateText = /** @class */ (function () { + function SurveyTemplateText() { + } + SurveyTemplateText.prototype.addText = function (newText, id, name) { + id = this.getId(id, name); + this.text = + this.text + + '"; + }; + SurveyTemplateText.prototype.replaceText = function (replaceText, id, questionType) { + if (questionType === void 0) { questionType = null; } + var posId = this.getId(id, questionType); + var pos = this.text.indexOf(posId); + if (pos < 0) { + this.addText(replaceText, id, questionType); + return; + } + pos = this.text.indexOf(">", pos); + if (pos < 0) + return; + var startPos = pos + 1; + var endString = ""; + pos = this.text.indexOf(endString, startPos); + if (pos < 0) + return; + this.text = + this.text.substr(0, startPos) + replaceText + this.text.substr(pos); + }; + SurveyTemplateText.prototype.getId = function (id, questionType) { + var result = 'id="survey-' + id; + if (questionType) { + result += "-" + questionType; + } + return result + '"'; + }; + Object.defineProperty(SurveyTemplateText.prototype, "text", { + get: function () { + return koTemplate; + }, + set: function (value) { + koTemplate = value; + }, + enumerable: false, + configurable: true + }); + return SurveyTemplateText; + }()); + + + + /***/ }), + + /***/ "./src/knockout/templates/comment.html": + /*!*********************************************!*\ + !*** ./src/knockout/templates/comment.html ***! + \*********************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/knockout/templates/flowpanel.html": + /*!***********************************************!*\ + !*** ./src/knockout/templates/flowpanel.html ***! + \***********************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n"; + + /***/ }), + + /***/ "./src/knockout/templates/header.html": + /*!********************************************!*\ + !*** ./src/knockout/templates/header.html ***! + \********************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/knockout/templates/index.html": + /*!*******************************************!*\ + !*** ./src/knockout/templates/index.html ***! + \*******************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n"; + + /***/ }), + + /***/ "./src/knockout/templates/page.html": + /*!******************************************!*\ + !*** ./src/knockout/templates/page.html ***! + \******************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/panel.html": + /*!*******************************************!*\ + !*** ./src/knockout/templates/panel.html ***! + \*******************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-boolean.html": + /*!******************************************************!*\ + !*** ./src/knockout/templates/question-boolean.html ***! + \******************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/knockout/templates/question-buttongroup.html": + /*!**********************************************************!*\ + !*** ./src/knockout/templates/question-buttongroup.html ***! + \**********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-checkbox.html": + /*!*******************************************************!*\ + !*** ./src/knockout/templates/question-checkbox.html ***! + \*******************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-comment.html": + /*!******************************************************!*\ + !*** ./src/knockout/templates/question-comment.html ***! + \******************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/knockout/templates/question-composite.html": + /*!********************************************************!*\ + !*** ./src/knockout/templates/question-composite.html ***! + \********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-custom.html": + /*!*****************************************************!*\ + !*** ./src/knockout/templates/question-custom.html ***! + \*****************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-dropdown.html": + /*!*******************************************************!*\ + !*** ./src/knockout/templates/question-dropdown.html ***! + \*******************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-empty.html": + /*!****************************************************!*\ + !*** ./src/knockout/templates/question-empty.html ***! + \****************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-errors.html": + /*!*****************************************************!*\ + !*** ./src/knockout/templates/question-errors.html ***! + \*****************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/knockout/templates/question-expression.html": + /*!*********************************************************!*\ + !*** ./src/knockout/templates/question-expression.html ***! + \*********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-file.html": + /*!***************************************************!*\ + !*** ./src/knockout/templates/question-file.html ***! + \***************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-html.html": + /*!***************************************************!*\ + !*** ./src/knockout/templates/question-html.html ***! + \***************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-image.html": + /*!****************************************************!*\ + !*** ./src/knockout/templates/question-image.html ***! + \****************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-imagepicker.html": + /*!**********************************************************!*\ + !*** ./src/knockout/templates/question-imagepicker.html ***! + \**********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-matrix.html": + /*!*****************************************************!*\ + !*** ./src/knockout/templates/question-matrix.html ***! + \*****************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question-matrixdynamic.html": + /*!************************************************************!*\ + !*** ./src/knockout/templates/question-matrixdynamic.html ***! + \************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n\n"; + + /***/ }), + /***/ "./src/knockout/templates/question-multipletext.html": + /*!***********************************************************!*\ + !*** ./src/knockout/templates/question-multipletext.html ***! + \***********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + module.exports = "\n"; + /***/ }), + /***/ "./src/knockout/templates/question-paneldynamic-navigator.html": + /*!*********************************************************************!*\ + !*** ./src/knockout/templates/question-paneldynamic-navigator.html ***! + \*********************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + module.exports = "\n"; - /** - * A base class for all triggers. - * A trigger calls a method when the expression change the result: from false to true or from true to false. - * Please note, it runs only one changing the expression result. - */ - var Trigger = /** @class */ (function (_super) { - __extends(Trigger, _super); - function Trigger() { - var _this = _super.call(this) || this; - _this.usedNames = []; - var self = _this; - _this.registerFunctionOnPropertiesValueChanged(["operator", "value", "name"], function () { - self.oldPropertiesChanged(); - }); - _this.registerFunctionOnPropertyValueChanged("expression", function () { - self.onExpressionChanged(); - }); - return _this; - } - Object.defineProperty(Trigger, "operators", { - get: function () { - if (Trigger.operatorsValue != null) - return Trigger.operatorsValue; - Trigger.operatorsValue = { - empty: function (value, expectedValue) { - return !value; - }, - notempty: function (value, expectedValue) { - return !!value; - }, - equal: function (value, expectedValue) { - return value == expectedValue; - }, - notequal: function (value, expectedValue) { - return value != expectedValue; - }, - contains: function (value, expectedValue) { - return value && value["indexOf"] && value.indexOf(expectedValue) > -1; - }, - notcontains: function (value, expectedValue) { - return (!value || !value["indexOf"] || value.indexOf(expectedValue) == -1); - }, - greater: function (value, expectedValue) { - return value > expectedValue; - }, - less: function (value, expectedValue) { - return value < expectedValue; - }, - greaterorequal: function (value, expectedValue) { - return value >= expectedValue; - }, - lessorequal: function (value, expectedValue) { - return value <= expectedValue; - }, - }; - return Trigger.operatorsValue; - }, - enumerable: false, - configurable: true - }); - Trigger.prototype.getType = function () { - return "triggerbase"; - }; - Trigger.prototype.toString = function () { - var res = this.getType().replace("trigger", ""); - var exp = !!this.expression ? this.expression : this.buildExpression(); - if (exp) { - res += ", " + exp; - } - return res; - }; - Object.defineProperty(Trigger.prototype, "operator", { - get: function () { - return this.getPropertyValue("operator", "equal"); - }, - set: function (value) { - if (!value) - return; - value = value.toLowerCase(); - if (!Trigger.operators[value]) - return; - this.setPropertyValue("operator", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Trigger.prototype, "value", { - get: function () { - return this.getPropertyValue("value", null); - }, - set: function (val) { - this.setPropertyValue("value", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Trigger.prototype, "name", { - get: function () { - return this.getPropertyValue("name", ""); - }, - set: function (val) { - this.setPropertyValue("name", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(Trigger.prototype, "expression", { - get: function () { - return this.getPropertyValue("expression", ""); - }, - set: function (val) { - this.setPropertyValue("expression", val); - }, - enumerable: false, - configurable: true - }); - Trigger.prototype.checkExpression = function (keys, values, properties) { - if (properties === void 0) { properties = null; } - if (!this.isCheckRequired(keys)) - return; - if (!!this.conditionRunner) { - this.perform(values, properties); - } - }; - Trigger.prototype.check = function (value) { - var triggerResult = Trigger.operators[this.operator](value, this.value); - if (triggerResult) { - this.onSuccess({}, null); - } - else { - this.onFailure(); - } - }; - Trigger.prototype.perform = function (values, properties) { - var _this = this; - this.conditionRunner.onRunComplete = function (res) { - _this.triggerResult(res, values, properties); - }; - this.conditionRunner.run(values, properties); - }; - Trigger.prototype.triggerResult = function (res, values, properties) { - if (res) { - this.onSuccess(values, properties); - } - else { - this.onFailure(); - } - }; - Trigger.prototype.onSuccess = function (values, properties) { }; - Trigger.prototype.onFailure = function () { }; - Trigger.prototype.endLoadingFromJson = function () { - _super.prototype.endLoadingFromJson.call(this); - this.oldPropertiesChanged(); - }; - Trigger.prototype.oldPropertiesChanged = function () { - this.onExpressionChanged(); - }; - Trigger.prototype.onExpressionChanged = function () { - this.usedNames = []; - this.hasFunction = false; - this.conditionRunner = null; - }; - Trigger.prototype.buildExpression = function () { - if (!this.name) - return ""; - if (this.isValueEmpty(this.value) && this.isRequireValue) - return ""; - return ("{" + - this.name + - "} " + - this.operator + - " " + - _expressions_expressions__WEBPACK_IMPORTED_MODULE_3__["OperandMaker"].toOperandString(this.value)); - }; - Trigger.prototype.isCheckRequired = function (keys) { - if (!keys) - return false; - this.buildUsedNames(); - if (this.hasFunction === true) - return true; - var processValue = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_4__["ProcessValue"](); - for (var i = 0; i < this.usedNames.length; i++) { - var name = this.usedNames[i]; - if (keys.hasOwnProperty(name)) - return true; - var firstName = processValue.getFirstName(name); - if (!keys.hasOwnProperty(firstName)) - continue; - if (name == firstName) - return true; - var keyValue = keys[firstName]; - if (keyValue == undefined) - continue; - if (!keyValue.hasOwnProperty("oldValue") || - !keyValue.hasOwnProperty("newValue")) - return true; - var v = {}; - v[firstName] = keyValue["oldValue"]; - var oldValue = processValue.getValue(name, v); - v[firstName] = keyValue["newValue"]; - var newValue = processValue.getValue(name, v); - return !this.isTwoValueEquals(oldValue, newValue); - } - return false; - }; - Trigger.prototype.buildUsedNames = function () { - if (!!this.conditionRunner) - return; - var expression = this.expression; - if (!expression) { - expression = this.buildExpression(); - } - if (!expression) - return; - this.conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_2__["ConditionRunner"](expression); - this.hasFunction = this.conditionRunner.hasFunction(); - this.usedNames = this.conditionRunner.getVariables(); - }; - Object.defineProperty(Trigger.prototype, "isRequireValue", { - get: function () { - return this.operator !== "empty" && this.operator != "notempty"; - }, - enumerable: false, - configurable: true - }); - Trigger.operatorsValue = null; - return Trigger; - }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); + /***/ }), - /** - * It extends the Trigger base class and add properties required for SurveyJS classes. - */ - var SurveyTrigger = /** @class */ (function (_super) { - __extends(SurveyTrigger, _super); - function SurveyTrigger() { - var _this = _super.call(this) || this; - _this.ownerValue = null; - return _this; - } - Object.defineProperty(SurveyTrigger.prototype, "owner", { - get: function () { - return this.ownerValue; - }, - enumerable: false, - configurable: true - }); - SurveyTrigger.prototype.setOwner = function (owner) { - this.ownerValue = owner; - }; - SurveyTrigger.prototype.getSurvey = function (live) { - return !!this.owner && !!this.owner["getSurvey"] - ? this.owner.getSurvey() - : null; - }; - Object.defineProperty(SurveyTrigger.prototype, "isOnNextPage", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - return SurveyTrigger; - }(Trigger)); + /***/ "./src/knockout/templates/question-paneldynamic.html": + /*!***********************************************************!*\ + !*** ./src/knockout/templates/question-paneldynamic.html ***! + \***********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { - /** - * If expression returns true, it makes questions/pages visible. - * Ohterwise it makes them invisible. - */ - var SurveyTriggerVisible = /** @class */ (function (_super) { - __extends(SurveyTriggerVisible, _super); - function SurveyTriggerVisible() { - var _this = _super.call(this) || this; - _this.pages = []; - _this.questions = []; - return _this; - } - SurveyTriggerVisible.prototype.getType = function () { - return "visibletrigger"; - }; - SurveyTriggerVisible.prototype.onSuccess = function (values, properties) { - this.onTrigger(this.onItemSuccess); - }; - SurveyTriggerVisible.prototype.onFailure = function () { - this.onTrigger(this.onItemFailure); - }; - SurveyTriggerVisible.prototype.onTrigger = function (func) { - if (!this.owner) - return; - var objects = this.owner.getObjects(this.pages, this.questions); - for (var i = 0; i < objects.length; i++) { - func(objects[i]); - } - }; - SurveyTriggerVisible.prototype.onItemSuccess = function (item) { - item.visible = true; - }; - SurveyTriggerVisible.prototype.onItemFailure = function (item) { - item.visible = false; - }; - return SurveyTriggerVisible; - }(SurveyTrigger)); + module.exports = "\n\n"; - /** - * If expression returns true, it completes the survey. - */ - var SurveyTriggerComplete = /** @class */ (function (_super) { - __extends(SurveyTriggerComplete, _super); - function SurveyTriggerComplete() { - return _super.call(this) || this; - } - SurveyTriggerComplete.prototype.getType = function () { - return "completetrigger"; - }; - Object.defineProperty(SurveyTriggerComplete.prototype, "isOnNextPage", { - get: function () { - return !_settings__WEBPACK_IMPORTED_MODULE_5__["settings"].executeCompleteTriggerOnValueChanged; - }, - enumerable: false, - configurable: true - }); - SurveyTriggerComplete.prototype.onSuccess = function (values, properties) { - if (this.owner) - this.owner.setCompleted(); - }; - return SurveyTriggerComplete; - }(SurveyTrigger)); + /***/ }), - /** - * If expression returns true, the value from property **setValue** will be set to **setToName** - */ - var SurveyTriggerSetValue = /** @class */ (function (_super) { - __extends(SurveyTriggerSetValue, _super); - function SurveyTriggerSetValue() { - return _super.call(this) || this; - } - SurveyTriggerSetValue.prototype.getType = function () { - return "setvaluetrigger"; - }; - SurveyTriggerSetValue.prototype.onPropertyValueChanged = function (name, oldValue, newValue) { - _super.prototype.onPropertyValueChanged.call(this, name, oldValue, newValue); - if (name !== "setToName") - return; - var survey = this.getSurvey(); - if (survey && !survey.isLoadingFromJson && survey.isDesignMode) { - this.setValue = undefined; - } - }; - Object.defineProperty(SurveyTriggerSetValue.prototype, "setToName", { - get: function () { - return this.getPropertyValue("setToName", ""); - }, - set: function (val) { - this.setPropertyValue("setToName", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyTriggerSetValue.prototype, "setValue", { - get: function () { - return this.getPropertyValue("setValue"); - }, - set: function (val) { - this.setPropertyValue("setValue", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyTriggerSetValue.prototype, "isVariable", { - get: function () { - return this.getPropertyValue("isVariable", false); - }, - set: function (val) { - this.setPropertyValue("isVariable", val); - }, - enumerable: false, - configurable: true - }); - SurveyTriggerSetValue.prototype.onSuccess = function (values, properties) { - if (!this.setToName || !this.owner) - return; - this.owner.setTriggerValue(this.setToName, this.setValue, this.isVariable); - }; - return SurveyTriggerSetValue; - }(SurveyTrigger)); + /***/ "./src/knockout/templates/question-radiogroup.html": + /*!*********************************************************!*\ + !*** ./src/knockout/templates/question-radiogroup.html ***! + \*********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { - /** - * If expression returns true, the survey go to question **gotoName** and focus it. - */ - var SurveyTriggerSkip = /** @class */ (function (_super) { - __extends(SurveyTriggerSkip, _super); - function SurveyTriggerSkip() { - return _super.call(this) || this; - } - SurveyTriggerSkip.prototype.getType = function () { - return "skiptrigger"; - }; - Object.defineProperty(SurveyTriggerSkip.prototype, "gotoName", { - get: function () { - return this.getPropertyValue("gotoName", ""); - }, - set: function (val) { - this.setPropertyValue("gotoName", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyTriggerSkip.prototype, "isOnNextPage", { - get: function () { - return !_settings__WEBPACK_IMPORTED_MODULE_5__["settings"].executeSkipTriggerOnValueChanged; - }, - enumerable: false, - configurable: true - }); - SurveyTriggerSkip.prototype.onSuccess = function (values, properties) { - if (!this.gotoName || !this.owner) - return; - this.owner.focusQuestion(this.gotoName); - }; - return SurveyTriggerSkip; - }(SurveyTrigger)); + module.exports = "\n\n"; - /** - * If expression returns true, the **runExpression** will be run. If **setToName** property is not empty then the result of **runExpression** will be set to it. - */ - var SurveyTriggerRunExpression = /** @class */ (function (_super) { - __extends(SurveyTriggerRunExpression, _super); - function SurveyTriggerRunExpression() { - return _super.call(this) || this; - } - SurveyTriggerRunExpression.prototype.getType = function () { - return "runexpressiontrigger"; - }; - Object.defineProperty(SurveyTriggerRunExpression.prototype, "setToName", { - get: function () { - return this.getPropertyValue("setToName", ""); - }, - set: function (val) { - this.setPropertyValue("setToName", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyTriggerRunExpression.prototype, "runExpression", { - get: function () { - return this.getPropertyValue("runExpression", ""); - }, - set: function (val) { - this.setPropertyValue("runExpression", val); - }, - enumerable: false, - configurable: true - }); - SurveyTriggerRunExpression.prototype.onSuccess = function (values, properties) { - var _this = this; - if (!this.owner || !this.runExpression) - return; - var expression = new _conditions__WEBPACK_IMPORTED_MODULE_2__["ExpressionRunner"](this.runExpression); - if (expression.canRun) { - expression.onRunComplete = function (res) { - _this.onCompleteRunExpression(res); - }; - expression.run(values, properties); - } - }; - SurveyTriggerRunExpression.prototype.onCompleteRunExpression = function (newValue) { - if (!!this.setToName && newValue !== undefined) { - this.owner.setTriggerValue(this.setToName, newValue, false); - } - }; - return SurveyTriggerRunExpression; - }(SurveyTrigger)); + /***/ }), - /** - * If expression returns true, the value from question **fromName** will be set into **setToName**. - */ - var SurveyTriggerCopyValue = /** @class */ (function (_super) { - __extends(SurveyTriggerCopyValue, _super); - function SurveyTriggerCopyValue() { - return _super.call(this) || this; - } - Object.defineProperty(SurveyTriggerCopyValue.prototype, "setToName", { - get: function () { - return this.getPropertyValue("setToName", ""); - }, - set: function (val) { - this.setPropertyValue("setToName", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyTriggerCopyValue.prototype, "fromName", { - get: function () { - return this.getPropertyValue("fromName", ""); - }, - set: function (val) { - this.setPropertyValue("fromName", val); - }, - enumerable: false, - configurable: true - }); - SurveyTriggerCopyValue.prototype.getType = function () { - return "copyvaluetrigger"; - }; - SurveyTriggerCopyValue.prototype.onSuccess = function (values, properties) { - if (!this.setToName || !this.owner) - return; - this.owner.copyTriggerValue(this.setToName, this.fromName); - }; - return SurveyTriggerCopyValue; - }(SurveyTrigger)); - - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("trigger", [ - { name: "operator", default: "equal", visible: false }, - { name: "value", visible: false }, - "expression:condition", - ]); - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("surveytrigger", [{ name: "name", visible: false }], null, "trigger"); - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("visibletrigger", ["pages:pages", "questions:questions"], function () { - return new SurveyTriggerVisible(); - }, "surveytrigger"); - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("completetrigger", [], function () { - return new SurveyTriggerComplete(); - }, "surveytrigger"); - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("setvaluetrigger", [ - { name: "!setToName:questionvalue" }, - { - name: "setValue:triggervalue", - dependsOn: "setToName", - visibleIf: function (obj) { - return !!obj && !!obj["setToName"]; - }, - }, - { name: "isVariable:boolean", visible: false }, - ], function () { - return new SurveyTriggerSetValue(); - }, "surveytrigger"); - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("copyvaluetrigger", [{ name: "!fromName:questionvalue" }, { name: "!setToName:questionvalue" }], function () { - return new SurveyTriggerCopyValue(); - }, "surveytrigger"); - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("skiptrigger", [{ name: "!gotoName:question" }], function () { - return new SurveyTriggerSkip(); - }, "surveytrigger"); - _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("runexpressiontrigger", [{ name: "setToName:questionvalue" }, "runExpression:expression"], function () { - return new SurveyTriggerRunExpression(); - }, "surveytrigger"); - - - /***/ }), - - /***/ "./src/utils/cssClassBuilder.ts": - /*!**************************************!*\ - !*** ./src/utils/cssClassBuilder.ts ***! - \**************************************/ - /*! exports provided: CssClassBuilder */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CssClassBuilder", function() { return CssClassBuilder; }); - var CssClassBuilder = /** @class */ (function () { - function CssClassBuilder() { - this.classes = []; - } - CssClassBuilder.prototype.isEmpty = function () { - return this.toString() === ""; - }; - CssClassBuilder.prototype.append = function (value, condition) { - if (condition === void 0) { condition = true; } - if (!!value && condition) { - if (typeof value === "string") { - value = value.trim(); - } - this.classes.push(value); - } - return this; - }; - CssClassBuilder.prototype.toString = function () { - return this.classes.join(" "); - }; - return CssClassBuilder; - }()); - - - - /***/ }), - - /***/ "./src/utils/is-mobile.ts": - /*!********************************!*\ - !*** ./src/utils/is-mobile.ts ***! - \********************************/ - /*! exports provided: IsMobile */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IsMobile", function() { return IsMobile; }); - var _isMobile = false; - var vendor = null; - if (typeof navigator !== "undefined" && - typeof window !== "undefined" && - navigator && - window) { - vendor = navigator.userAgent || navigator.vendor || window.opera; - } - (function (a) { - if (!a) - return; - if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || - /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) - _isMobile = true; - })(vendor); - var IsMobile = _isMobile; - - - /***/ }), - - /***/ "./src/utils/popup.ts": - /*!****************************!*\ - !*** ./src/utils/popup.ts ***! - \****************************/ - /*! exports provided: PopupUtils */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PopupUtils", function() { return PopupUtils; }); - var PopupUtils = /** @class */ (function () { - function PopupUtils() { - } - PopupUtils.calculatePosition = function (targetRect, height, width, verticalPosition, horizontalPosition, showPointer) { - if (horizontalPosition == "center") - var left = (targetRect.left + targetRect.right - width) / 2; - else if (horizontalPosition == "left") - left = targetRect.left - width; - else - left = targetRect.right; - if (verticalPosition == "middle") - var top = (targetRect.top + targetRect.bottom - height) / 2; - else if (verticalPosition == "top") - top = targetRect.top - height; - else - top = targetRect.bottom; - if (showPointer) { - if (horizontalPosition != "center" && verticalPosition != "middle") { - if (verticalPosition == "top") { - top = top + targetRect.height; - } - else { - top = top - targetRect.height; - } - } - } - return { left: Math.round(left), top: Math.round(top) }; - }; - PopupUtils.updateVerticalDimensions = function (top, height, windowHeight) { - var result; - if (top < 0) { - result = { height: height + top, top: 0 }; - } - else if (height + top > windowHeight) { - var newHeight = Math.min(height, windowHeight - top); - result = { height: newHeight, top: top }; - } - return result; - }; - PopupUtils.updateVerticalPosition = function (targetRect, height, verticalPosition, showPointer, windowHeight) { - var deltaTop = height - (targetRect.top + (showPointer ? targetRect.height : 0)); - var deltaBottom = height + - targetRect.bottom - - (showPointer ? targetRect.height : 0) - - windowHeight; - if (deltaTop > 0 && deltaBottom <= 0 && verticalPosition == "top") { - verticalPosition = "bottom"; - } - else if (deltaBottom > 0 && - deltaTop <= 0 && - verticalPosition == "bottom") { - verticalPosition = "top"; - } - else if (deltaBottom > 0 && deltaTop > 0) { - verticalPosition = deltaTop < deltaBottom ? "top" : "bottom"; - } - return verticalPosition; - }; - PopupUtils.calculatePopupDirection = function (verticalPosition, horizontalPosition) { - var popupDirection; - if (horizontalPosition == "center" && verticalPosition != "middle") { - popupDirection = verticalPosition; - } - else if (horizontalPosition != "center") { - popupDirection = horizontalPosition; - } - return popupDirection; - }; - //called when showPointer is true - PopupUtils.calculatePointerTarget = function (targetRect, top, left, verticalPosition, horizontalPosition) { - var targetPos = {}; - if (horizontalPosition != "center") { - targetPos.top = targetRect.top + targetRect.height / 2; - targetPos.left = targetRect[horizontalPosition]; - } - else if (verticalPosition != "middle") { - targetPos.top = targetRect[verticalPosition]; - targetPos.left = targetRect.left + targetRect.width / 2; - } - targetPos.left = Math.round(targetPos.left - left); - targetPos.top = Math.round(targetPos.top - top); - return targetPos; - }; - return PopupUtils; - }()); - - - - /***/ }), - - /***/ "./src/utils/responsivity-manager.ts": - /*!*******************************************!*\ - !*** ./src/utils/responsivity-manager.ts ***! - \*******************************************/ - /*! exports provided: ResponsivityManager, VerticalResponsivityManager */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResponsivityManager", function() { return ResponsivityManager; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VerticalResponsivityManager", function() { return VerticalResponsivityManager; }); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - var ResponsivityManager = /** @class */ (function () { - function ResponsivityManager(container, model, itemsSelector, dotsItemSize) { - var _this = this; - if (dotsItemSize === void 0) { dotsItemSize = 48; } - this.container = container; - this.model = model; - this.itemsSelector = itemsSelector; - this.dotsItemSize = dotsItemSize; - this.resizeObserver = undefined; - this.isInitialized = false; - this.minDimensionConst = 56; - this.separatorSize = 17; - this.separatorAddConst = 1; - this.paddingSizeConst = 8; - this.recalcMinDimensionConst = true; - this.getComputedStyle = window.getComputedStyle.bind(window); - this.model.updateCallback = function (isResetInitialized) { - if (isResetInitialized) - _this.isInitialized = false; - else - _this.process(); - }; - if (typeof ResizeObserver !== "undefined") { - this.resizeObserver = new ResizeObserver(function (_) { return _this.process(); }); - this.resizeObserver.observe(this.container.parentElement); - } - } - ResponsivityManager.prototype.getDimensions = function (element) { - return { - scroll: element.scrollWidth, - offset: element.offsetWidth, - }; - }; - ResponsivityManager.prototype.getAvailableSpace = function () { - var style = this.getComputedStyle(this.container); - var space = this.container.offsetWidth; - if (style.boxSizing === "border-box") { - space -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight); - } - return space; - }; - ResponsivityManager.prototype.calcItemSize = function (item) { - return item.offsetWidth; - }; - ResponsivityManager.prototype.calcMinDimension = function (currentAction) { - var minDimensionConst = this.minDimensionConst; - if (currentAction.iconSize && this.recalcMinDimensionConst) { - minDimensionConst = 2 * currentAction.iconSize + this.paddingSizeConst; - } - return currentAction.canShrink - ? minDimensionConst + - (currentAction.needSeparator ? this.separatorSize : 0) - : currentAction.maxDimension; - }; - ResponsivityManager.prototype.calcItemsSizes = function () { - var _this = this; - var actions = this.model.actions; - this.container - .querySelectorAll(this.itemsSelector) - .forEach(function (item, index) { - var currentAction = actions[index]; - currentAction.maxDimension = _this.calcItemSize(item); - currentAction.minDimension = _this.calcMinDimension(currentAction); - }); - }; - Object.defineProperty(ResponsivityManager.prototype, "isContainerVisible", { - get: function () { - return !!(this.container.offsetWidth || - this.container.offsetHeight || - this.container.getClientRects().length); - }, - enumerable: false, - configurable: true - }); - ResponsivityManager.prototype.process = function () { - if (this.isContainerVisible) { - if (!this.isInitialized) { - this.model.actions.forEach(function (action) { return (action.mode = "large"); }); - this.calcItemsSizes(); - this.isInitialized = true; - } - this.model.fit(this.getAvailableSpace(), this.dotsItemSize); - } - }; - ResponsivityManager.prototype.dispose = function () { - this.model.updateCallback = undefined; - if (!!this.resizeObserver) { - this.resizeObserver.disconnect(); - } - }; - return ResponsivityManager; - }()); - - var VerticalResponsivityManager = /** @class */ (function (_super) { - __extends(VerticalResponsivityManager, _super); - function VerticalResponsivityManager(container, model, itemsSelector, dotsItemSize) { - var _this = _super.call(this, container, model, itemsSelector, dotsItemSize) || this; - _this.minDimensionConst = 40; - _this.recalcMinDimensionConst = false; - return _this; - } - VerticalResponsivityManager.prototype.getDimensions = function () { - return { - scroll: this.container.scrollHeight, - offset: this.container.offsetHeight, - }; - }; - VerticalResponsivityManager.prototype.getAvailableSpace = function () { - var style = this.getComputedStyle(this.container); - var space = this.container.offsetHeight; - if (style.boxSizing === "border-box") { - space -= parseFloat(style.paddingTop) + parseFloat(style.paddingBottom); - } - return space; - }; - VerticalResponsivityManager.prototype.calcItemSize = function (item) { - return item.offsetHeight; - }; - return VerticalResponsivityManager; - }(ResponsivityManager)); - - - - /***/ }), - - /***/ "./src/utils/tooltip.ts": - /*!******************************!*\ - !*** ./src/utils/tooltip.ts ***! - \******************************/ - /*! exports provided: TooltipManager */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TooltipManager", function() { return TooltipManager; }); - var TooltipManager = /** @class */ (function () { - function TooltipManager(tooltipElement) { - var _this = this; - this.tooltipElement = tooltipElement; - this.onMouseMoveCallback = function (e) { - _this.tooltipElement.style.left = e.clientX + 12 + "px"; - _this.tooltipElement.style.top = e.clientY + 12 + "px"; - }; - this.targetElement = tooltipElement.parentElement; - this.targetElement.addEventListener("mousemove", this.onMouseMoveCallback); - } - TooltipManager.prototype.dispose = function () { - this.targetElement.removeEventListener("mousemove", this.onMouseMoveCallback); - }; - return TooltipManager; - }()); - - - - /***/ }), - - /***/ "./src/utils/utils.ts": - /*!****************************!*\ - !*** ./src/utils/utils.ts ***! - \****************************/ - /*! exports provided: unwrap, getSize, compareVersions, confirmAction, detectIEOrEdge, detectIEBrowser, loadFileFromBase64, isMobile, isElementVisible, findScrollableParent, scrollElementByChildId, createSvg, doKey2ClickUp, doKey2ClickDown, getIconNameFromProxy, increaseHeightByContent, getOriginalEvent, preventDefaults */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unwrap", function() { return unwrap; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSize", function() { return getSize; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compareVersions", function() { return compareVersions; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "confirmAction", function() { return confirmAction; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectIEOrEdge", function() { return detectIEOrEdge; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectIEBrowser", function() { return detectIEBrowser; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadFileFromBase64", function() { return loadFileFromBase64; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isMobile", function() { return isMobile; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isElementVisible", function() { return isElementVisible; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findScrollableParent", function() { return findScrollableParent; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scrollElementByChildId", function() { return scrollElementByChildId; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSvg", function() { return createSvg; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doKey2ClickUp", function() { return doKey2ClickUp; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doKey2ClickDown", function() { return doKey2ClickDown; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getIconNameFromProxy", function() { return getIconNameFromProxy; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "increaseHeightByContent", function() { return increaseHeightByContent; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getOriginalEvent", function() { return getOriginalEvent; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "preventDefaults", function() { return preventDefaults; }); - /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../settings */ "./src/settings.ts"); - - function compareVersions(a, b) { - var regExStrip0 = /(\.0+)+$/; - var segmentsA = a.replace(regExStrip0, "").split("."); - var segmentsB = b.replace(regExStrip0, "").split("."); - var len = Math.min(segmentsA.length, segmentsB.length); - for (var i = 0; i < len; i++) { - var diff = parseInt(segmentsA[i], 10) - parseInt(segmentsB[i], 10); - if (diff) { - return diff; - } - } - return segmentsA.length - segmentsB.length; - } - function confirmAction(message) { - if (!!_settings__WEBPACK_IMPORTED_MODULE_0__["settings"] && !!_settings__WEBPACK_IMPORTED_MODULE_0__["settings"].confirmActionFunc) - return _settings__WEBPACK_IMPORTED_MODULE_0__["settings"].confirmActionFunc(message); - return confirm(message); - } - function detectIEBrowser() { - if (typeof window === "undefined") - return false; - var ua = window.navigator.userAgent; - var oldIe = ua.indexOf("MSIE "); - var elevenIe = ua.indexOf("Trident/"); - return oldIe > -1 || elevenIe > -1; - } - function detectIEOrEdge() { - if (typeof window === "undefined") - return false; - if (typeof detectIEOrEdge.isIEOrEdge === "undefined") { - var ua = window.navigator.userAgent; - var msie = ua.indexOf("MSIE "); - var trident = ua.indexOf("Trident/"); - var edge = ua.indexOf("Edge/"); - detectIEOrEdge.isIEOrEdge = edge > 0 || trident > 0 || msie > 0; - } - return detectIEOrEdge.isIEOrEdge; - } - function loadFileFromBase64(b64Data, fileName) { - try { - var byteString = atob(b64Data.split(",")[1]); - // separate out the mime component - var mimeString = b64Data - .split(",")[0] - .split(":")[1] - .split(";")[0]; - // write the bytes of the string to an ArrayBuffer - var ab = new ArrayBuffer(byteString.length); - var ia = new Uint8Array(ab); - for (var i = 0; i < byteString.length; i++) { - ia[i] = byteString.charCodeAt(i); - } - // write the ArrayBuffer to a blob, and you're done - var bb = new Blob([ab], { type: mimeString }); - if (typeof window !== "undefined" && - window.navigator && - window.navigator["msSaveBlob"]) { - window.navigator["msSaveOrOpenBlob"](bb, fileName); - } - } - catch (err) { } - } - function isMobile() { - return (typeof window !== "undefined" && typeof window.orientation !== "undefined"); - } - function isElementVisible(element, threshold) { - if (threshold === void 0) { threshold = 0; } - if (typeof document === "undefined") { - return false; - } - var elementRect = element.getBoundingClientRect(); - var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight); - var topWin = -threshold; - var bottomWin = viewHeight + threshold; - var topEl = elementRect.top; - var bottomEl = elementRect.bottom; - var maxTop = Math.max(topWin, topEl); - var minBottom = Math.min(bottomWin, bottomEl); - return maxTop <= minBottom; - } - function findScrollableParent(element) { - if (!element) { - return document.documentElement; - } - if (element.scrollHeight > element.clientHeight && - (getComputedStyle(element).overflowY === "scroll" || - getComputedStyle(element).overflowY === "auto")) { - return element; - } - if (element.scrollWidth > element.clientWidth && - (getComputedStyle(element).overflowX === "scroll" || - getComputedStyle(element).overflowX === "auto")) { - return element; - } - return findScrollableParent(element.parentElement); - } - function scrollElementByChildId(id) { - if (!document) - return; - var el = document.getElementById(id); - if (!el) - return; - var scrollableEl = findScrollableParent(el); - if (!!scrollableEl) { - scrollableEl.dispatchEvent(new CustomEvent("scroll")); - } - } - function getIconNameFromProxy(iconName) { - if (!iconName) - return iconName; - var proxyName = _settings__WEBPACK_IMPORTED_MODULE_0__["settings"].customIcons[iconName]; - return !!proxyName ? proxyName : iconName; - } - function createSvg(size, width, height, iconName, svgElem) { - svgElem.style.width = (size || width || 16) + "px"; - svgElem.style.height = (size || height || 16) + "px"; - var node = svgElem.childNodes[0]; - var realIconName = getIconNameFromProxy(iconName); - node.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "#" + realIconName); - } - function unwrap(value) { - if (typeof value !== "function") { - return value; - } - else { - return value(); - } - } - function getSize(value) { - if (typeof value === "number") { - return "" + value + "px"; - } - if (!!value && typeof value === "string" && value.length > 0) { - var lastSymbol = value[value.length - 1]; - if ((lastSymbol >= "0" && lastSymbol <= "9") || lastSymbol == ".") { - try { - var num = parseFloat(value); - return "" + num + "px"; - } - catch (_a) { } - } - } - return value; - } - function doKey2ClickUp(evt, options) { - if (options === void 0) { options = { processEsc: true }; } - if (!!evt.target && evt.target["contentEditable"] === "true") { - return; - } - var element = evt.target; - if (!element) - return; - var char = evt.which || evt.keyCode; - if (char === 13 || char === 32) { - if (element.click) - element.click(); - } - else if (options.processEsc && char === 27) { - if (element.blur) - element.blur(); - } - } - function doKey2ClickDown(evt, options) { - if (options === void 0) { options = { processEsc: true }; } - if (!!evt.target && evt.target["contentEditable"] === "true") { - return; - } - var char = evt.which || evt.keyCode; - var supportedCodes = [13, 32]; - if (options.processEsc) { - supportedCodes.push(27); - } - if (supportedCodes.indexOf(char) !== -1) { - evt.preventDefault(); - } - } - function increaseHeightByContent(element, getComputedStyle) { - if (!element) - return; - if (!getComputedStyle) - getComputedStyle = function (elt) { return window.getComputedStyle(elt); }; - var style = getComputedStyle(element); - element.style.height = "auto"; - element.style.height = (element.scrollHeight + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth)) + "px"; - } - function getOriginalEvent(event) { - return event.originalEvent || event; - } - function preventDefaults(event) { - event.preventDefault(); - event.stopPropagation(); - } + /***/ "./src/knockout/templates/question-ranking.html": + /*!******************************************************!*\ + !*** ./src/knockout/templates/question-ranking.html ***! + \******************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + module.exports = "\n\n\n"; + /***/ }), - /***/ }), - - /***/ "./src/validator.ts": - /*!**************************!*\ - !*** ./src/validator.ts ***! - \**************************/ - /*! exports provided: ValidatorResult, SurveyValidator, ValidatorRunner, NumericValidator, TextValidator, AnswerCountValidator, RegexValidator, EmailValidator, ExpressionValidator */ - /***/ (function(module, __webpack_exports__, __webpack_require__) { - __webpack_require__.r(__webpack_exports__); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ValidatorResult", function() { return ValidatorResult; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyValidator", function() { return SurveyValidator; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ValidatorRunner", function() { return ValidatorRunner; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumericValidator", function() { return NumericValidator; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextValidator", function() { return TextValidator; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnswerCountValidator", function() { return AnswerCountValidator; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RegexValidator", function() { return RegexValidator; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmailValidator", function() { return EmailValidator; }); - /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionValidator", function() { return ExpressionValidator; }); - /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); - /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./error */ "./src/error.ts"); - /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); - /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); - /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); - /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); - var __extends = (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - })(); - - - - - - - var ValidatorResult = /** @class */ (function () { - function ValidatorResult(value, error) { - if (error === void 0) { error = null; } - this.value = value; - this.error = error; - } - return ValidatorResult; - }()); + /***/ "./src/knockout/templates/question-rating.html": + /*!*****************************************************!*\ + !*** ./src/knockout/templates/question-rating.html ***! + \*****************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { - /** - * Base SurveyJS validator class. - */ - var SurveyValidator = /** @class */ (function (_super) { - __extends(SurveyValidator, _super); - function SurveyValidator() { - var _this = _super.call(this) || this; - _this.createLocalizableString("text", _this, true); - return _this; - } - SurveyValidator.prototype.getSurvey = function (live) { - return !!this.errorOwner && !!this.errorOwner["getSurvey"] - ? this.errorOwner.getSurvey() - : null; - }; - Object.defineProperty(SurveyValidator.prototype, "text", { - get: function () { - return this.getLocalizableStringText("text"); - }, - set: function (value) { - this.setLocalizableStringText("text", value); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyValidator.prototype, "isValidateAllValues", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyValidator.prototype, "locText", { - get: function () { - return this.getLocalizableString("text"); - }, - enumerable: false, - configurable: true - }); - SurveyValidator.prototype.getErrorText = function (name) { - if (this.text) - return this.text; - return this.getDefaultErrorText(name); - }; - SurveyValidator.prototype.getDefaultErrorText = function (name) { - return ""; - }; - SurveyValidator.prototype.validate = function (value, name, values, properties) { - return null; - }; - Object.defineProperty(SurveyValidator.prototype, "isRunning", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(SurveyValidator.prototype, "isAsync", { - get: function () { - return false; - }, - enumerable: false, - configurable: true - }); - SurveyValidator.prototype.getLocale = function () { - return !!this.errorOwner ? this.errorOwner.getLocale() : ""; - }; - SurveyValidator.prototype.getMarkdownHtml = function (text, name) { - return !!this.errorOwner - ? this.errorOwner.getMarkdownHtml(text, name) - : null; - }; - SurveyValidator.prototype.getRenderer = function (name) { - return !!this.errorOwner ? this.errorOwner.getRenderer(name) : null; - }; - SurveyValidator.prototype.getRendererContext = function (locStr) { - return !!this.errorOwner ? this.errorOwner.getRendererContext(locStr) : locStr; - }; - SurveyValidator.prototype.getProcessedText = function (text) { - return !!this.errorOwner ? this.errorOwner.getProcessedText(text) : text; - }; - SurveyValidator.prototype.createCustomError = function (name) { - return new _error__WEBPACK_IMPORTED_MODULE_1__["CustomError"](this.getErrorText(name), this.errorOwner); - }; - SurveyValidator.prototype.toString = function () { - var res = this.getType().replace("validator", ""); - if (!!this.text) { - res += ", " + this.text; - } - return res; - }; - return SurveyValidator; - }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); + module.exports = "\n"; - var ValidatorRunner = /** @class */ (function () { - function ValidatorRunner() { - } - ValidatorRunner.prototype.run = function (owner) { - var _this = this; - var res = []; - var values = null; - var properties = null; - this.prepareAsyncValidators(); - var asyncResults = []; - var validators = owner.getValidators(); - for (var i = 0; i < validators.length; i++) { - var validator = validators[i]; - if (!values && validator.isValidateAllValues) { - values = owner.getDataFilteredValues(); - properties = owner.getDataFilteredProperties(); - } - if (validator.isAsync) { - this.asyncValidators.push(validator); - validator.onAsyncCompleted = function (result) { - if (!!result && !!result.error) - asyncResults.push(result.error); - if (!_this.onAsyncCompleted) - return; - for (var i = 0; i < _this.asyncValidators.length; i++) { - if (_this.asyncValidators[i].isRunning) - return; - } - _this.onAsyncCompleted(asyncResults); - }; - } - } - validators = owner.getValidators(); - for (var i = 0; i < validators.length; i++) { - var validator = validators[i]; - var validatorResult = validator.validate(owner.validatedValue, owner.getValidatorTitle(), values, properties); - if (!!validatorResult && !!validatorResult.error) { - res.push(validatorResult.error); - } - } - if (this.asyncValidators.length == 0 && !!this.onAsyncCompleted) - this.onAsyncCompleted([]); - return res; - }; - ValidatorRunner.prototype.prepareAsyncValidators = function () { - if (!!this.asyncValidators) { - for (var i = 0; i < this.asyncValidators.length; i++) { - this.asyncValidators[i].onAsyncCompleted = null; - } - } - this.asyncValidators = []; - }; - return ValidatorRunner; - }()); + /***/ }), - /** - * Validate numeric values. - */ - var NumericValidator = /** @class */ (function (_super) { - __extends(NumericValidator, _super); - function NumericValidator(minValue, maxValue) { - if (minValue === void 0) { minValue = null; } - if (maxValue === void 0) { maxValue = null; } - var _this = _super.call(this) || this; - _this.minValue = minValue; - _this.maxValue = maxValue; - return _this; - } - NumericValidator.prototype.getType = function () { - return "numericvalidator"; - }; - NumericValidator.prototype.validate = function (value, name, values, properties) { - if (name === void 0) { name = null; } - if (this.isValueEmpty(value)) - return null; - if (!_helpers__WEBPACK_IMPORTED_MODULE_5__["Helpers"].isNumber(value)) { - return new ValidatorResult(null, new _error__WEBPACK_IMPORTED_MODULE_1__["RequreNumericError"](null, this.errorOwner)); - } - var result = new ValidatorResult(parseFloat(value)); - if (this.minValue !== null && this.minValue > result.value) { - result.error = this.createCustomError(name); - return result; - } - if (this.maxValue !== null && this.maxValue < result.value) { - result.error = this.createCustomError(name); - return result; - } - return typeof value === "number" ? null : result; - }; - NumericValidator.prototype.getDefaultErrorText = function (name) { - var vName = name ? name : _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("value"); - if (this.minValue !== null && this.maxValue !== null) { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] - .getString("numericMinMax")["format"](vName, this.minValue, this.maxValue); - } - else { - if (this.minValue !== null) { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] - .getString("numericMin")["format"](vName, this.minValue); - } - return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] - .getString("numericMax")["format"](vName, this.maxValue); - } - }; - Object.defineProperty(NumericValidator.prototype, "minValue", { - /** - * The minValue property. - */ - get: function () { - return this.getPropertyValue("minValue"); - }, - set: function (val) { - this.setPropertyValue("minValue", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(NumericValidator.prototype, "maxValue", { - /** - * The maxValue property. - */ - get: function () { - return this.getPropertyValue("maxValue"); - }, - set: function (val) { - this.setPropertyValue("maxValue", val); - }, - enumerable: false, - configurable: true - }); - return NumericValidator; - }(SurveyValidator)); + /***/ "./src/knockout/templates/question-signaturepad.html": + /*!***********************************************************!*\ + !*** ./src/knockout/templates/question-signaturepad.html ***! + \***********************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { - /** - * Validate text values. - */ - var TextValidator = /** @class */ (function (_super) { - __extends(TextValidator, _super); - function TextValidator() { - return _super.call(this) || this; - } - TextValidator.prototype.getType = function () { - return "textvalidator"; - }; - TextValidator.prototype.validate = function (value, name, values, properties) { - if (name === void 0) { name = null; } - if (this.isValueEmpty(value)) - return null; - if (!this.allowDigits) { - var reg = /^[A-Za-z\s]*$/; - if (!reg.test(value)) { - return new ValidatorResult(null, this.createCustomError(name)); - } - } - if (this.minLength > 0 && value.length < this.minLength) { - return new ValidatorResult(null, this.createCustomError(name)); - } - if (this.maxLength > 0 && value.length > this.maxLength) { - return new ValidatorResult(null, this.createCustomError(name)); - } - return null; - }; - TextValidator.prototype.getDefaultErrorText = function (name) { - if (this.minLength > 0 && this.maxLength > 0) - return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] - .getString("textMinMaxLength")["format"](this.minLength, this.maxLength); - if (this.minLength > 0) - return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] - .getString("textMinLength")["format"](this.minLength); - return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] - .getString("textMaxLength")["format"](this.maxLength); - }; - Object.defineProperty(TextValidator.prototype, "minLength", { - /** - * The minLength property. - */ - get: function () { - return this.getPropertyValue("minLength"); - }, - set: function (val) { - this.setPropertyValue("minLength", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextValidator.prototype, "maxLength", { - /** - * The maxLength property. - */ - get: function () { - return this.getPropertyValue("maxLength"); - }, - set: function (val) { - this.setPropertyValue("maxLength", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(TextValidator.prototype, "allowDigits", { - /** - * The allowDigits property. - */ - get: function () { - return this.getPropertyValue("allowDigits"); - }, - set: function (val) { - this.setPropertyValue("allowDigits", val); - }, - enumerable: false, - configurable: true - }); - return TextValidator; - }(SurveyValidator)); - - var AnswerCountValidator = /** @class */ (function (_super) { - __extends(AnswerCountValidator, _super); - function AnswerCountValidator(minCount, maxCount) { - if (minCount === void 0) { minCount = null; } - if (maxCount === void 0) { maxCount = null; } - var _this = _super.call(this) || this; - _this.minCount = minCount; - _this.maxCount = maxCount; - return _this; - } - AnswerCountValidator.prototype.getType = function () { - return "answercountvalidator"; - }; - AnswerCountValidator.prototype.validate = function (value, name, values, properties) { - if (value == null || value.constructor != Array) - return null; - var count = value.length; - if (count == 0) - return null; - if (this.minCount && count < this.minCount) { - return new ValidatorResult(null, this.createCustomError(_surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] - .getString("minSelectError")["format"](this.minCount))); - } - if (this.maxCount && count > this.maxCount) { - return new ValidatorResult(null, this.createCustomError(_surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] - .getString("maxSelectError")["format"](this.maxCount))); - } - return null; - }; - AnswerCountValidator.prototype.getDefaultErrorText = function (name) { - return name; - }; - Object.defineProperty(AnswerCountValidator.prototype, "minCount", { - /** - * The minCount property. - */ - get: function () { - return this.getPropertyValue("minCount"); - }, - set: function (val) { - this.setPropertyValue("minCount", val); - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(AnswerCountValidator.prototype, "maxCount", { - /** - * The maxCount property. - */ - get: function () { - return this.getPropertyValue("maxCount"); - }, - set: function (val) { - this.setPropertyValue("maxCount", val); - }, - enumerable: false, - configurable: true - }); - return AnswerCountValidator; - }(SurveyValidator)); + module.exports = ""; - /** - * Use it to validate the text by regular expressions. - */ - var RegexValidator = /** @class */ (function (_super) { - __extends(RegexValidator, _super); - function RegexValidator(regex) { - if (regex === void 0) { regex = null; } - var _this = _super.call(this) || this; - _this.regex = regex; - return _this; - } - RegexValidator.prototype.getType = function () { - return "regexvalidator"; - }; - RegexValidator.prototype.validate = function (value, name, values, properties) { - if (name === void 0) { name = null; } - if (!this.regex || this.isValueEmpty(value)) - return null; - var re = new RegExp(this.regex); - if (Array.isArray(value)) { - for (var i = 0; i < value.length; i++) { - var res = this.hasError(re, value[i], name); - if (res) - return res; - } - } - return this.hasError(re, value, name); - }; - RegexValidator.prototype.hasError = function (re, value, name) { - if (re.test(value)) - return null; - return new ValidatorResult(value, this.createCustomError(name)); - }; - Object.defineProperty(RegexValidator.prototype, "regex", { - /** - * The regex property. - */ - get: function () { - return this.getPropertyValue("regex"); - }, - set: function (val) { - this.setPropertyValue("regex", val); - }, - enumerable: false, - configurable: true - }); - return RegexValidator; - }(SurveyValidator)); + /***/ }), - /** - * Validate e-mail address in the text input - */ - var EmailValidator = /** @class */ (function (_super) { - __extends(EmailValidator, _super); - function EmailValidator() { - var _this = _super.call(this) || this; - _this.re = /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()=[\]\.,;:\s@\"]+\.)+[^<>()=[\]\.,;:\s@\"]{2,})$/i; - return _this; - } - EmailValidator.prototype.getType = function () { - return "emailvalidator"; - }; - EmailValidator.prototype.validate = function (value, name, values, properties) { - if (name === void 0) { name = null; } - if (!value) - return null; - if (this.re.test(value)) - return null; - return new ValidatorResult(value, this.createCustomError(name)); - }; - EmailValidator.prototype.getDefaultErrorText = function (name) { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("invalidEmail"); - }; - return EmailValidator; - }(SurveyValidator)); + /***/ "./src/knockout/templates/question-text.html": + /*!***************************************************!*\ + !*** ./src/knockout/templates/question-text.html ***! + \***************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { - /** - * Show error if expression returns false - */ - var ExpressionValidator = /** @class */ (function (_super) { - __extends(ExpressionValidator, _super); - function ExpressionValidator(expression) { - if (expression === void 0) { expression = null; } - var _this = _super.call(this) || this; - _this.conditionRunner = null; - _this.isRunningValue = false; - _this.expression = expression; - return _this; - } - ExpressionValidator.prototype.getType = function () { - return "expressionvalidator"; - }; - Object.defineProperty(ExpressionValidator.prototype, "isValidateAllValues", { - get: function () { - return true; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ExpressionValidator.prototype, "isAsync", { - get: function () { - if (!this.ensureConditionRunner()) - return false; - return this.conditionRunner.isAsync; - }, - enumerable: false, - configurable: true - }); - Object.defineProperty(ExpressionValidator.prototype, "isRunning", { - get: function () { - return this.isRunningValue; - }, - enumerable: false, - configurable: true - }); - ExpressionValidator.prototype.validate = function (value, name, values, properties) { - var _this = this; - if (name === void 0) { name = null; } - if (values === void 0) { values = null; } - if (properties === void 0) { properties = null; } - if (!this.ensureConditionRunner()) - return null; - this.conditionRunner.onRunComplete = function (res) { - _this.isRunningValue = false; - if (!!_this.onAsyncCompleted) { - _this.onAsyncCompleted(_this.generateError(res, value, name)); - } - }; - this.isRunningValue = true; - var res = this.conditionRunner.run(values, properties); - if (this.conditionRunner.isAsync) - return null; - this.isRunningValue = false; - return this.generateError(res, value, name); - }; - ExpressionValidator.prototype.generateError = function (res, value, name) { - if (!res) { - return new ValidatorResult(value, this.createCustomError(name)); - } - return null; - }; - ExpressionValidator.prototype.getDefaultErrorText = function (name) { - return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] - .getString("invalidExpression")["format"](this.expression); - }; - ExpressionValidator.prototype.ensureConditionRunner = function () { - if (!!this.conditionRunner) { - this.conditionRunner.expression = this.expression; - return true; - } - if (!this.expression) - return false; - this.conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_4__["ConditionRunner"](this.expression); - return true; - }; - Object.defineProperty(ExpressionValidator.prototype, "expression", { - /** - * The expression property. - */ - get: function () { - return this.getPropertyValue("expression"); - }, - set: function (val) { - this.setPropertyValue("expression", val); - }, - enumerable: false, - configurable: true - }); - return ExpressionValidator; - }(SurveyValidator)); - - _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("surveyvalidator", [ - { name: "text", serializationProperty: "locText" }, - ]); - _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("numericvalidator", ["minValue:number", "maxValue:number"], function () { - return new NumericValidator(); - }, "surveyvalidator"); - _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("textvalidator", [{ name: "minLength:number", default: 0 }, - { name: "maxLength:number", default: 0 }, - { name: "allowDigits:boolean", default: true }], function () { - return new TextValidator(); - }, "surveyvalidator"); - _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("answercountvalidator", ["minCount:number", "maxCount:number"], function () { - return new AnswerCountValidator(); - }, "surveyvalidator"); - _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("regexvalidator", ["regex"], function () { - return new RegexValidator(); - }, "surveyvalidator"); - _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("emailvalidator", [], function () { - return new EmailValidator(); - }, "surveyvalidator"); - _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("expressionvalidator", ["expression:condition"], function () { - return new ExpressionValidator(); - }, "surveyvalidator"); - - - /***/ }), - - /***/ "knockout": - /*!********************************************************************************************!*\ - !*** external {"root":"ko","commonjs2":"knockout","commonjs":"knockout","amd":"knockout"} ***! - \********************************************************************************************/ - /*! no static exports found */ - /***/ (function(module, exports) { - - module.exports = __WEBPACK_EXTERNAL_MODULE_knockout__; - - /***/ }) - - /******/ }); - }); - - }(survey_ko)); + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/question.html": + /*!**********************************************!*\ + !*** ./src/knockout/templates/question.html ***! + \**********************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/knockout/templates/questioncontent.html": + /*!*****************************************************!*\ + !*** ./src/knockout/templates/questioncontent.html ***! + \*****************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/knockout/templates/questiontitle.html": + /*!***************************************************!*\ + !*** ./src/knockout/templates/questiontitle.html ***! + \***************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/knockout/templates/row.html": + /*!*****************************************!*\ + !*** ./src/knockout/templates/row.html ***! + \*****************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/rows.html": + /*!******************************************!*\ + !*** ./src/knockout/templates/rows.html ***! + \******************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = ""; + + /***/ }), + + /***/ "./src/knockout/templates/string.html": + /*!********************************************!*\ + !*** ./src/knockout/templates/string.html ***! + \********************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/knockout/templates/timerpanel.html": + /*!************************************************!*\ + !*** ./src/knockout/templates/timerpanel.html ***! + \************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = "\n"; + + /***/ }), + + /***/ "./src/list.ts": + /*!*********************!*\ + !*** ./src/list.ts ***! + \*********************/ + /*! exports provided: ListModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ListModel", function() { return ListModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + var ListModel = /** @class */ (function (_super) { + __extends(ListModel, _super); + function ListModel(items, onItemSelect, allowSelection, selectedItem, onFilteredTextChangedCallback) { + var _this = _super.call(this) || this; + _this.onItemSelect = onItemSelect; + _this.allowSelection = allowSelection; + _this.onFilteredTextChangedCallback = onFilteredTextChangedCallback; + _this.selectItem = function (itemValue) { + _this.isExpanded = false; + if (_this.allowSelection) { + _this.selectedItem = itemValue; + } + if (!!_this.onItemSelect) { + _this.onItemSelect(itemValue); + } + }; + _this.isItemDisabled = function (itemValue) { + return itemValue.enabled !== undefined && !itemValue.enabled; + }; + _this.isItemSelected = function (itemValue) { + return !!_this.allowSelection && !!_this.selectedItem && _this.selectedItem.id == itemValue.id; + }; + _this.getItemClass = function (itemValue) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_2__["CssClassBuilder"]() + .append("sv-list__item") + .append("sv-list__item--disabled", _this.isItemDisabled(itemValue)) + .append("sv-list__item--selected", _this.isItemSelected(itemValue)) + .toString(); + }; + _this.getItemIndent = function (itemValue) { + var level = itemValue.level || 0; + return (level + 1) * ListModel.INDENT + "px"; + }; + _this.setItems(items); + _this.selectedItem = selectedItem; + return _this; + } + ListModel.prototype.hasText = function (item, filteredTextInLow) { + if (!filteredTextInLow) + return true; + var textInLow = (item.title || "").toLocaleLowerCase(); + return textInLow.indexOf(filteredTextInLow.toLocaleLowerCase()) > -1; + }; + ListModel.prototype.isItemVisible = function (item) { + return item.visible && (!this.shouldProcessFilter || this.hasText(item, this.filteredText)); + }; + Object.defineProperty(ListModel.prototype, "shouldProcessFilter", { + get: function () { + return this.needFilter && !this.onFilteredTextChangedCallback; + }, + enumerable: false, + configurable: true + }); + ListModel.prototype.onFilteredTextChanged = function (text) { + if (!this.needFilter) + return; + if (!!this.onFilteredTextChangedCallback) { + this.onFilteredTextChangedCallback(text); + } + }; + ListModel.prototype.onSet = function () { + this.needFilter = !this.denySearch && (this.actions || []).length > ListModel.MINELEMENTCOUNT; + _super.prototype.onSet.call(this); + }; + Object.defineProperty(ListModel.prototype, "filteredTextPlaceholder", { + get: function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("filteredTextPlaceholder"); + }, + enumerable: false, + configurable: true + }); + ListModel.prototype.onKeyDown = function (event) { + var currentElement = event.target; + if (event.key === "ArrowDown" || event.keyCode === 40) { + if (!!currentElement.nextElementSibling) { + currentElement.nextElementSibling.focus(); + } + else { + currentElement.parentElement.firstElementChild && currentElement.parentElement.firstElementChild.focus(); + } + event.preventDefault(); + } + else if (event.key === "ArrowUp" || event.keyCode === 38) { + if (!!currentElement.previousElementSibling) { + currentElement.previousElementSibling.focus(); + } + else { + currentElement.parentElement.lastElementChild && currentElement.parentElement.lastElementChild.focus(); + } + event.preventDefault(); + } + }; + ListModel.prototype.onPointerDown = function (event, item) { }; + ListModel.prototype.refresh = function () { + this.filteredText = ""; + }; + ListModel.INDENT = 16; + ListModel.MINELEMENTCOUNT = 10; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ + defaultValue: false, + onSet: function (newValue, target) { + target.onSet(); + } + }) + ], ListModel.prototype, "denySearch", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) + ], ListModel.prototype, "needFilter", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) + ], ListModel.prototype, "isExpanded", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])() + ], ListModel.prototype, "selectedItem", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ + onSet: function (_, target) { + target.onFilteredTextChanged(target.filteredText); + } + }) + ], ListModel.prototype, "filteredText", void 0); + return ListModel; + }(_actions_container__WEBPACK_IMPORTED_MODULE_1__["ActionContainer"])); + + + + /***/ }), + + /***/ "./src/localizablestring.ts": + /*!**********************************!*\ + !*** ./src/localizablestring.ts ***! + \**********************************/ + /*! exports provided: LocalizableString, LocalizableStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizableString", function() { return LocalizableString; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizableStrings", function() { return LocalizableStrings; }); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + + + + /** + * The class represents the string that supports multi-languages and markdown. + * It uses in all objects where support for multi-languages and markdown is required. + */ + var LocalizableString = /** @class */ (function () { + function LocalizableString(owner, useMarkdown, name) { + if (useMarkdown === void 0) { useMarkdown = false; } + this.owner = owner; + this.useMarkdown = useMarkdown; + this.name = name; + this.values = {}; + this.htmlValues = {}; + this.onCreating(); + } + Object.defineProperty(LocalizableString, "defaultLocale", { + get: function () { + return _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; + }, + set: function (val) { + _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName = val; + }, + enumerable: false, + configurable: true + }); + LocalizableString.prototype.getIsMultiple = function () { return false; }; + Object.defineProperty(LocalizableString.prototype, "locale", { + get: function () { + return this.owner && this.owner.getLocale ? this.owner.getLocale() : ""; + }, + enumerable: false, + configurable: true + }); + LocalizableString.prototype.strChanged = function () { + this.searchableText = undefined; + if (this.renderedText === undefined) + return; + this.calculatedTextValue = this.calcText(); + if (this.renderedText !== this.calculatedTextValue) { + this.renderedText = undefined; + this.calculatedTextValue = undefined; + } + this.onChanged(); + }; + Object.defineProperty(LocalizableString.prototype, "text", { + get: function () { + return this.pureText; + }, + set: function (value) { + this.setLocaleText(this.locale, value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LocalizableString.prototype, "calculatedText", { + get: function () { + this.renderedText = + this.calculatedTextValue !== undefined + ? this.calculatedTextValue + : this.calcText(); + this.calculatedTextValue = undefined; + return this.renderedText; + }, + enumerable: false, + configurable: true + }); + LocalizableString.prototype.calcText = function () { + var res = this.pureText; + if (res && + this.owner && + this.owner.getProcessedText && + res.indexOf("{") > -1) { + res = this.owner.getProcessedText(res); + } + if (this.onGetTextCallback) + res = this.onGetTextCallback(res); + return res; + }; + Object.defineProperty(LocalizableString.prototype, "pureText", { + get: function () { + var loc = this.locale; + if (!loc) + loc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; + var res = this.getValue(loc); + if (!res && loc == _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName) { + res = this.getValue(_surveyStrings__WEBPACK_IMPORTED_MODULE_1__["surveyLocalization"].defaultLocale); + } + if (!res && loc !== _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName) { + res = this.getValue(_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName); + } + if (!res && !!this.localizationName) { + res = this.getLocalizationStr(); + if (!!this.onGetLocalizationTextCallback) { + res = this.onGetLocalizationTextCallback(res); + } + } + if (!res) + res = ""; + return res; + }, + enumerable: false, + configurable: true + }); + LocalizableString.prototype.getLocalizationStr = function () { + return !!this.localizationName ? _surveyStrings__WEBPACK_IMPORTED_MODULE_1__["surveyLocalization"].getString(this.localizationName) : ""; + }; + Object.defineProperty(LocalizableString.prototype, "hasHtml", { + get: function () { + return this.hasHtmlValue(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LocalizableString.prototype, "html", { + get: function () { + if (!this.hasHtml) + return ""; + return this.getHtmlValue(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LocalizableString.prototype, "isEmpty", { + get: function () { + return this.getValuesKeys().length == 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LocalizableString.prototype, "textOrHtml", { + get: function () { + return this.hasHtml ? this.getHtmlValue() : this.calculatedText; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LocalizableString.prototype, "renderedHtml", { + get: function () { + return this.textOrHtml; + }, + enumerable: false, + configurable: true + }); + LocalizableString.prototype.getLocaleText = function (loc) { + if (!loc) + loc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; + var res = this.getValue(loc); + return res ? res : ""; + }; + LocalizableString.prototype.getLocaleTextWithDefault = function (loc) { + var res = this.getLocaleText(loc); + if (!res && this.onGetDefaultTextCallback) { + return this.onGetDefaultTextCallback(); + } + return res; + }; + LocalizableString.prototype.setLocaleText = function (loc, value) { + if (value == this.getLocaleTextWithDefault(loc)) + return; + if (value && + loc && + loc != _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName && + !this.getValue(loc) && + value == this.getLocaleText(_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName)) + return; + var curLoc = this.locale; + if (!loc) + loc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; + if (!curLoc) + curLoc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; + var oldValue = this.onStrChanged && loc === curLoc ? this.pureText : undefined; + delete this.htmlValues[loc]; + if (!value) { + if (this.getValue(loc)) + this.deleteValue(loc); + } + else { + if (typeof value === "string") { + if (loc != _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName && + value == this.getLocaleText(_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName)) { + this.setLocaleText(loc, null); + } + else { + this.setValue(loc, value); + if (loc == _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName) { + this.deleteValuesEqualsToDefault(value); + } + } + } + } + this.strChanged(); + if (!!this.onStrChanged && oldValue !== value) { + this.onStrChanged(oldValue, value); + } + }; + LocalizableString.prototype.hasNonDefaultText = function () { + var keys = this.getValuesKeys(); + if (keys.length == 0) + return false; + return keys.length > 1 || keys[0] != _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; + }; + LocalizableString.prototype.getLocales = function () { + var keys = this.getValuesKeys(); + if (keys.length == 0) + return []; + return keys; + }; + LocalizableString.prototype.getJson = function () { + if (!!this.sharedData) + return this.sharedData.getJson(); + var keys = this.getValuesKeys(); + if (keys.length == 0) + return null; + if (keys.length == 1 && + keys[0] == _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName && + !_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].serializeLocalizableStringAsObject) + return this.values[keys[0]]; + return this.values; + }; + LocalizableString.prototype.setJson = function (value) { + if (!!this.sharedData) { + this.sharedData.setJson(value); + return; + } + this.values = {}; + this.htmlValues = {}; + if (!value) + return; + if (typeof value === "string") { + this.setLocaleText(null, value); + } + else { + for (var key in value) { + this.setLocaleText(key, value[key]); + } + } + this.strChanged(); + }; + Object.defineProperty(LocalizableString.prototype, "renderAs", { + get: function () { + if (!this.owner || typeof this.owner.getRenderer !== "function") { + return LocalizableString.defaultRenderer; + } + return this.owner.getRenderer(this.name) || LocalizableString.defaultRenderer; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LocalizableString.prototype, "renderAsData", { + get: function () { + if (!this.owner || typeof this.owner.getRendererContext !== "function") { + return this; + } + return this.owner.getRendererContext(this) || this; + }, + enumerable: false, + configurable: true + }); + LocalizableString.prototype.equals = function (obj) { + if (!!this.sharedData) + return this.sharedData.equals(obj); + if (!obj || !obj.values) + return false; + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isTwoValueEquals(this.values, obj.values, false, true, false); + }; + LocalizableString.prototype.setFindText = function (text) { + if (this.searchText == text) + return; + this.searchText = text; + if (!this.searchableText) { + var textOrHtml = this.textOrHtml; + this.searchableText = !!textOrHtml ? textOrHtml.toLowerCase() : ""; + } + var str = this.searchableText; + var index = !!str && !!text ? str.indexOf(text) : undefined; + if (index < 0) + index = undefined; + if (index != undefined || this.searchIndex != index) { + this.searchIndex = index; + if (!!this.onSearchChanged) { + this.onSearchChanged(); + } + } + return this.searchIndex != undefined; + }; + LocalizableString.prototype.onChanged = function () { }; + LocalizableString.prototype.onCreating = function () { }; + LocalizableString.prototype.hasHtmlValue = function () { + if (!this.owner || !this.useMarkdown) + return false; + var renderedText = this.calculatedText; + if (!renderedText) + return false; + if (!!this.localizationName && renderedText === this.getLocalizationStr()) + return false; + var loc = this.locale; + if (!loc) + loc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; + this.htmlValues[loc] = this.owner.getMarkdownHtml(renderedText, this.name); + return this.htmlValues[loc] ? true : false; + }; + LocalizableString.prototype.getHtmlValue = function () { + var loc = this.locale; + if (!loc) + loc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; + return this.htmlValues[loc]; + }; + LocalizableString.prototype.deleteValuesEqualsToDefault = function (defaultValue) { + var keys = this.getValuesKeys(); + for (var i = 0; i < keys.length; i++) { + if (keys[i] == _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName) + continue; + if (this.getValue(keys[i]) == defaultValue) { + this.deleteValue(keys[i]); + } + } + }; + LocalizableString.prototype.getValue = function (loc) { + if (!!this.sharedData) + return this.sharedData.getValue(loc); + return this.values[loc]; + }; + LocalizableString.prototype.setValue = function (loc, value) { + if (!!this.sharedData) + this.sharedData.setValue(loc, value); + else + this.values[loc] = value; + }; + LocalizableString.prototype.deleteValue = function (loc) { + if (!!this.sharedData) + this.sharedData.deleteValue(loc); + else + delete this.values[loc]; + }; + LocalizableString.prototype.getValuesKeys = function () { + if (!!this.sharedData) + return this.sharedData.getValuesKeys(); + return Object.keys(this.values); + }; + LocalizableString.SerializeAsObject = false; + LocalizableString.defaultRenderer = "sv-string-viewer"; + LocalizableString.editableRenderer = "sv-string-editor"; + return LocalizableString; + }()); + + /** + * The class represents the list of strings that supports multi-languages. + */ + var LocalizableStrings = /** @class */ (function () { + function LocalizableStrings(owner) { + this.owner = owner; + this.values = {}; + } + LocalizableStrings.prototype.getIsMultiple = function () { return true; }; + Object.defineProperty(LocalizableStrings.prototype, "locale", { + get: function () { + return this.owner && this.owner.getLocale ? this.owner.getLocale() : ""; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LocalizableStrings.prototype, "value", { + get: function () { + return this.getValue(""); + }, + set: function (val) { + this.setValue("", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(LocalizableStrings.prototype, "text", { + get: function () { + return Array.isArray(this.value) ? this.value.join("\n") : ""; + }, + set: function (val) { + this.value = !!val ? val.split("\n") : []; + }, + enumerable: false, + configurable: true + }); + LocalizableStrings.prototype.getLocaleText = function (loc) { + var res = this.getValueCore(loc, !loc || loc === this.locale); + if (!res || !Array.isArray(res) || res.length == 0) + return ""; + return res.join("\n"); + }; + LocalizableStrings.prototype.setLocaleText = function (loc, newValue) { + var val = !!newValue ? newValue.split("\n") : null; + this.setValue(loc, val); + }; + LocalizableStrings.prototype.getValue = function (loc) { + return this.getValueCore(loc); + }; + LocalizableStrings.prototype.getValueCore = function (loc, useDefault) { + if (useDefault === void 0) { useDefault = true; } + loc = this.getLocale(loc); + if (this.values[loc]) + return this.values[loc]; + if (useDefault) { + var defLoc = _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; + if (loc !== defLoc && this.values[defLoc]) + return this.values[defLoc]; + } + return []; + }; + LocalizableStrings.prototype.setValue = function (loc, val) { + loc = this.getLocale(loc); + var oldValue = _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].createCopy(this.values); + if (!val || val.length == 0) { + delete this.values[loc]; + } + else { + this.values[loc] = val; + } + if (!!this.onValueChanged) { + this.onValueChanged(oldValue, this.values); + } + }; + LocalizableStrings.prototype.hasValue = function (loc) { + if (loc === void 0) { loc = ""; } + return !this.isEmpty && this.getValue(loc).length > 0; + }; + Object.defineProperty(LocalizableStrings.prototype, "isEmpty", { + get: function () { + return this.getValuesKeys().length == 0; + }, + enumerable: false, + configurable: true + }); + LocalizableStrings.prototype.getLocale = function (loc) { + if (!!loc) + return loc; + loc = this.locale; + return !!loc ? loc : _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName; + }; + LocalizableStrings.prototype.getLocales = function () { + var keys = this.getValuesKeys(); + if (keys.length == 0) + return []; + return keys; + }; + LocalizableStrings.prototype.getJson = function () { + var keys = this.getValuesKeys(); + if (keys.length == 0) + return null; + if (keys.length == 1 && + keys[0] == _settings__WEBPACK_IMPORTED_MODULE_2__["settings"].defaultLocaleName && + !_settings__WEBPACK_IMPORTED_MODULE_2__["settings"].serializeLocalizableStringAsObject) + return this.values[keys[0]]; + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].createCopy(this.values); + }; + LocalizableStrings.prototype.setJson = function (value) { + this.values = {}; + if (!value) + return; + if (Array.isArray(value)) { + this.setValue(null, value); + } + else { + for (var key in value) { + this.setValue(key, value[key]); + } + } + }; + LocalizableStrings.prototype.getValuesKeys = function () { + return Object.keys(this.values); + }; + return LocalizableStrings; + }()); + + + + /***/ }), + + /***/ "./src/localization/arabic.ts": + /*!************************************!*\ + !*** ./src/localization/arabic.ts ***! + \************************************/ + /*! exports provided: arabicSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "arabicSurveyStrings", function() { return arabicSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var arabicSurveyStrings = { + pagePrevText: "السابق", + pageNextText: "التالي", + completeText: "إرسال البيانات", + previewText: "معاينة", + editText: "تعديل", + startSurveyText: "بداية", + otherItemText: "نص آخر", + noneItemText: "لا شيء", + selectAllItemText: "اختر الكل", + progressText: "{1} صفحة {0} من", + panelDynamicProgressText: "سجل {0} من {1}", + questionsProgressText: "تمت الإجابة على أسئلة {0} / {1}", + emptySurvey: "لا توجد صفحة مرئية أو سؤال في النموذج", + completingSurvey: "شكرا لكم لاستكمال النموذج!", + completingSurveyBefore: "تظهر سجلاتنا أنك قد أكملت هذا الاستطلاع بالفعل.", + loadingSurvey: "...يتم تحميل النموذج", + optionsCaption: "...اختر", + value: "القيمة", + requiredError: ".يرجى الإجابة على السؤال", + requiredErrorInPanel: "الرجاء الإجابة على سؤال واحد على الأقل.", + requiredInAllRowsError: "يرجى الإجابة على الأسئلة في جميع الصفوف", + numericError: "يجب أن تكون القيمة رقمية.", + textMinLength: "الرجاء إدخال ما لا يقل عن {0} حروف", + textMaxLength: "الرجاء إدخال أقل من {0} حروف", + textMinMaxLength: "يرجى إدخال أكثر من {0} وأقل من {1} حروف", + minRowCountError: "يرجى ملء ما لا يقل عن {0} الصفوف", + minSelectError: "يرجى تحديد ما لا يقل عن {0} المتغيرات", + maxSelectError: "يرجى تحديد ما لا يزيد عن {0} المتغيرات", + numericMinMax: "و'{0}' يجب أن تكون مساوية أو أكثر من {1} وتساوي أو أقل من {2}ا", + numericMin: "و'{0}' يجب أن تكون مساوية أو أكثر من {1}ا", + numericMax: "و'{0}' يجب أن تكون مساوية أو أقل من {1}ا", + invalidEmail: "الرجاء إدخال بريد الكتروني صحيح", + invalidExpression: "يجب أن يعرض التعبير: {0} 'صواب'.", + urlRequestError: "طلب إرجاع خطأ '{0}'. {1}ا", + urlGetChoicesError: "عاد طلب البيانات فارغ أو 'المسار' غير صحيح ", + exceedMaxSize: "ينبغي ألا يتجاوز حجم الملف {0}ا", + otherRequiredError: "الرجاء إدخال قيمة أخرى", + uploadingFile: "تحميل الملف الخاص بك. يرجى الانتظار عدة ثوان والمحاولة لاحقًا", + loadingFile: "جار التحميل...", + chooseFile: "اختر الملفات...", + noFileChosen: "لم تقم باختيار ملف", + confirmDelete: "هل تريد حذف السجل؟", + keyDuplicationError: "يجب أن تكون هذه القيمة فريدة.", + addColumn: "أضف العمود", + addRow: "اضافة صف", + removeRow: "إزالة صف", + addPanel: "اضف جديد", + removePanel: "إزالة", + choices_Item: "بند", + matrix_column: "عمود", + matrix_row: "صف", + savingData: "يتم حفظ النتائج على الخادم ...", + savingDataError: "حدث خطأ ولم نتمكن من حفظ النتائج.", + savingDataSuccess: "تم حفظ النتائج بنجاح!", + saveAgainButton: "حاول مجددا", + timerMin: "دقيقة", + timerSec: "ثانية", + timerSpentAll: "لقد أنفقت {0} على هذه الصفحة و {1} إجمالاً.", + timerSpentPage: "لقد أنفقت {0} على هذه الصفحة.", + timerSpentSurvey: "لقد أنفقت {0} إجمالاً.", + timerLimitAll: "لقد أنفقت {0} من {1} في هذه الصفحة و {2} من إجمالي {3}.", + timerLimitPage: "لقد أنفقت {0} من {1} في هذه الصفحة.", + timerLimitSurvey: "لقد أنفقت {0} من إجمالي {1}.", + cleanCaption: "نظيف", + clearCaption: "واضح", + chooseFileCaption: "اختر ملف", + removeFileCaption: "قم بإزالة هذا الملف", + booleanCheckedLabel: "نعم", + booleanUncheckedLabel: "لا", + confirmRemoveFile: "هل أنت متأكد أنك تريد إزالة هذا الملف: {0}؟", + confirmRemoveAllFiles: "هل أنت متأكد أنك تريد إزالة كافة الملفات؟", + questionTitlePatternText: "عنوان السؤال", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ar"] = arabicSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ar"] = "العربية"; + + + /***/ }), + + /***/ "./src/localization/basque.ts": + /*!************************************!*\ + !*** ./src/localization/basque.ts ***! + \************************************/ + /*! exports provided: basqueSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "basqueSurveyStrings", function() { return basqueSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var basqueSurveyStrings = { + pagePrevText: "Aurrekoa", + pageNextText: "Hurrengoa", + completeText: "Bukatu", + previewText: "Aurrebista", + editText: "Editatu", + startSurveyText: "Hasi", + otherItemText: "Beste bat (zehaztu)", + noneItemText: "Bat ere ez", + selectAllItemText: "Guztia hautatu", + progressText: "{1}-(e)tik {0} orrialde", + panelDynamicProgressText: "{0} errigistro {1}-(e)tik", + questionsProgressText: "Erantzundako galderak {0}/{1}", + emptySurvey: "Ez dago orrialde bistaragarririk edo ez dago galderarik.", + completingSurvey: "Eskerrik asko galdetegia erantzuteagatik!", + completingSurveyBefore: "Gure datuek diote dagoeneko galdetegia erantzun duzula.", + loadingSurvey: "Galdetegia kargatzen...", + optionsCaption: "Hautatu...", + value: "balioa", + requiredError: "Mesedez, galdera erantzun.", + requiredErrorInPanel: "Mesedez, gutxienez galdera bat erantzun.", + requiredInAllRowsError: "Mesedez, errenkadako galdera guztiak erantzun.", + numericError: "Estimazioa zenbakizkoa izan behar du.", + minError: "Balioa ez da {0} baino txikiagoa izan behar", + maxError: "Balioa ez da {0} baino handiagoa izan behar", + textMinLength: "Mesedez, gutxienez {0} karaktere erabili behar dira.", + textMaxLength: "Mesedez, gehienez {0} karaktere erabili behar dira.", + textMinMaxLength: "Mesedez, gehienez {0} eta gutxienez {1} karaktere erabili behar dira.", + minRowCountError: "Mesedez, gutxienez {0} errenkada bete.", + minSelectError: "Mesedez, gutxienez {0} aukera hautatu.", + maxSelectError: "Mesedez, {0} aukera baino gehiago ez hautatu.", + numericMinMax: "El '{0}' debe de ser igual o más de {1} y igual o menos de {2}", + numericMin: "'{0}' {1} baino handiagoa edo berdin izan behar da", + numericMax: "'{0}' {1} baino txikiago edo berdin izan behar da", + invalidEmail: "Mesedez, baliozko emaila idatz ezazu.", + invalidExpression: "{0} adierazpenak 'egiazkoa' itzuli beharko luke.", + urlRequestError: "Eskaerak '{0}' errorea itzuli du. {1}", + urlGetChoicesError: "La solicitud regresó vacío de data o la propiedad 'trayectoria' no es correcta", + exceedMaxSize: "Fitxategiaren tamaina ez da {0} baino handiagoa izan behar.", + otherRequiredError: "Mesedez, beste estimazioa gehitu.", + uploadingFile: "Zure fitxategia igotzen ari da. Mesedez, segundo batzuk itxaron eta saiatu berriro.", + loadingFile: "Kargatzen...", + chooseFile: "Fitxategia(k) hautatu...", + noFileChosen: "Ez da inolako fitxategirik hautatu", + confirmDelete: "¿Erregistroa borratu nahi al duzu?", + keyDuplicationError: "Balio hau bakarra izan behar du.", + addColumn: "Zutabe bat gehitu", + addRow: "Errenkada bat gehitu", + removeRow: "Errenkada bat kendu", + emptyRowsText: "Ez dago errenkadarik.", + addPanel: "Berria gehitu", + removePanel: "Kendu", + choices_Item: "artikulua", + matrix_column: "Zutabea", + matrix_row: "Errenkada", + multipletext_itemname: "testua", + savingData: "Erantzunak zerbitzarian gordetzen ari dira...", + savingDataError: "Erroreren bat gertatu eta erantzunak ez dira zerbitzarian gorde ahal izan.", + savingDataSuccess: "Erantzunak egoki gorde dira!", + saveAgainButton: "Berriro saiatu.", + timerMin: "min", + timerSec: "seg", + timerSpentAll: "{0} erabili duzu orrialde honetan eta orotara {1}.", + timerSpentPage: "Zuk {0} erabili duzu.", + timerSpentSurvey: "Orotara gastatu duzu.", + timerLimitAll: "{0} gastatu duzu {1}-(e)tik orrialde honetan eta orotara {2} {3}-(e)tik.", + timerLimitPage: "{0} gastatu duzu orrialde honetan {1}-(e)tik.", + timerLimitSurvey: "Zuk orotara {0} gastatu duzu {1}-(e)tik.", + cleanCaption: "Garbitu", + clearCaption: "Hustu", + signaturePlaceHolder: "Sinatu hemen", + chooseFileCaption: "Fitxategia hautatu", + removeFileCaption: "Fitxategi hau ezabatu", + booleanCheckedLabel: "Bai", + booleanUncheckedLabel: "Ez", + confirmRemoveFile: "Ziur zaude hurrengo fitxategia ezabatu nahi duzula: {0}?", + confirmRemoveAllFiles: "Ziur al zaude fitxategi guztiak ezabatu nahi dituzula?", + questionTitlePatternText: "Galderaren izenburua", + modalCancelButtonText: "Ezeztatu", + modalApplyButtonText: "Ezarri", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["eu"] = basqueSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["eu"] = "Euskara"; + + + /***/ }), + + /***/ "./src/localization/bulgarian.ts": + /*!***************************************!*\ + !*** ./src/localization/bulgarian.ts ***! + \***************************************/ + /*! exports provided: bulgarianStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bulgarianStrings", function() { return bulgarianStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var bulgarianStrings = { + pagePrevText: "Назад", + pageNextText: "Напред", + completeText: "Край", + previewText: "Визуализация", + editText: "редактиране", + startSurveyText: "Начало", + otherItemText: "Друго (опишете)", + noneItemText: "Нито един", + selectAllItemText: "Всички", + progressText: "стр. {0}, общо стр. {1}", + panelDynamicProgressText: "Запис {0} от {1}", + questionsProgressText: "Отговорени на {0} / {1} въпроса", + emptySurvey: "Анкетата не съдържа видими страници или въпроси.", + completingSurvey: "Благодарим ви за участието в анкетата!", + completingSurveyBefore: "Изглежда, че вие вече сте попълнили анкетата.", + loadingSurvey: "Зареждане на анкетата...", + optionsCaption: "Изберете...", + value: "value", + requiredError: "Моля, отговорете на следния въпрос.", + requiredErrorInPanel: "Моля, отговорете поне на един от въпросите.", + requiredInAllRowsError: "Моля, отговорете на въпросите на всички редове.", + numericError: "Стойността следва да бъде число.", + textMinLength: "Моля, използвайте поне {0} символа.", + textMaxLength: "Моля, използвайте не повече от {0} символа.", + textMinMaxLength: "Моля, използвайте повече от {0} и по-малко от {1} символа.", + minRowCountError: "Моля, попълнете поне {0} реда.", + minSelectError: "Моля, изберете поне {0} варианта.", + maxSelectError: "Моля, изберете не повече от {0} варианта.", + numericMinMax: "Стойността '{0}' следва да бъде равна или по-голяма от {1} и равна или по-малка от {2}", + numericMin: "Стойността '{0}' следва да бъде равна или по-голяма от {1}", + numericMax: "Стойността '{0}' следва да бъде равна или по-малка от {1}", + invalidEmail: "Моля, въведете валиден адрес на електронна поща.", + invalidExpression: "Изразът: {0} трябва да дава резултат 'true' (истина).", + urlRequestError: "Заявката води до грешка '{0}'. {1}", + urlGetChoicesError: "Заявката не връща данни или частта 'path' (път до търсения ресурс на сървъра) е неправилно зададена", + exceedMaxSize: "Размерът на файла следва да не превишава {0}.", + otherRequiredError: "Моля, въведете другата стойност.", + uploadingFile: "Вашит файл се зарежда на сървъра. Моля, изчакайте няколко секунди и тогава опитвайте отново.", + loadingFile: "Зареждане...", + chooseFile: "Изберете файл(ове)...", + noFileChosen: "Няма избран файл", + confirmDelete: "Желаете ли да изтриете записа?", + keyDuplicationError: "Стойността следва да бъде уникална.", + addColumn: "Добавяне на колона", + addRow: "Добавяне на ред", + removeRow: "Премахване на ред", + addPanel: "Добавяне на панел", + removePanel: "Премахване на панел", + choices_Item: "елемент", + matrix_column: "Колона", + matrix_row: "Ред", + savingData: "Резултатите се запазват на сървъра...", + savingDataError: "Поради възникнала грешка резултатите не можаха да бъдат запазени.", + savingDataSuccess: "Резултатите бяха запазени успешно!", + saveAgainButton: "Нов опит", + timerMin: "мин", + timerSec: "сек", + timerSpentAll: "Вие използвахте {0} на тази страница и общо {1}.", + timerSpentPage: "Вие използвахте {0} на тази страница.", + timerSpentSurvey: "Вие използвахте общо {0}.", + timerLimitAll: "Вие изпозвахте {0} от {1} на тази страница и общо {2} от {3}.", + timerLimitPage: "Вие използвахте {0} от {1} на тази страница.", + timerLimitSurvey: "Вие използвахте общо {0} от {1}.", + cleanCaption: "Изчистване", + clearCaption: "Начално състояние", + chooseFileCaption: "Изберете файл", + removeFileCaption: "Премахване на файла", + booleanCheckedLabel: "Да", + booleanUncheckedLabel: "Не", + confirmRemoveFile: "Наистина ли искате да премахнете този файл: {0}?", + confirmRemoveAllFiles: "Наистина ли искате да премахнете всички файлове?", + questionTitlePatternText: "Заглавие на въпроса", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["bg"] = bulgarianStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["bg"] = "български"; + + + /***/ }), + + /***/ "./src/localization/catalan.ts": + /*!*************************************!*\ + !*** ./src/localization/catalan.ts ***! + \*************************************/ + /*! exports provided: catalanSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "catalanSurveyStrings", function() { return catalanSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var catalanSurveyStrings = { + pagePrevText: "Anterior", + pageNextText: "Següent", + completeText: "Complet", + otherItemText: "Un altre (descrigui)", + progressText: "Pàgina {0} de {1}", + emptySurvey: "No hi ha cap pàgina visible o pregunta a l'enquesta.", + completingSurvey: "Gràcies per completar l'enquesta!", + loadingSurvey: "L'enquesta s'està carregant ...", + optionsCaption: "Selecciona ...", + requiredError: "Si us plau contesti la pregunta.", + requiredInAllRowsError: "Si us plau contesti les preguntes de cada filera.", + numericError: "L'estimació ha de ser numèrica.", + textMinLength: "Si us plau entre almenys {0} símbols.", + textMaxLength: "Si us plau entre menys de {0} símbols.", + textMinMaxLength: "Si us plau entre més de {0} i menys de {1} símbols.", + minRowCountError: "Si us plau ompli almenys {0} fileres.", + minSelectError: "Si us plau seleccioni almenys {0} variants.", + maxSelectError: "Si us plau seleccioni no més de {0} variants.", + numericMinMax: "El '{0}' deu ser igual o més de {1} i igual o menys de {2}", + numericMin: "El '{0}' ha de ser igual o més de {1}", + numericMax: "El '{0}' ha de ser igual o menys de {1}", + invalidEmail: "Si us plau afegiu un correu electrònic vàlid.", + urlRequestError: "La sol·licitud va tornar error '{0}'. {1}", + urlGetChoicesError: "La sol·licitud va tornar buida de dates o la propietat 'trajectòria' no és correcta", + exceedMaxSize: "La mida de l'arxiu no pot excedir {0}.", + otherRequiredError: "Si us plau afegiu l'altra estimació.", + uploadingFile: "El seu arxiu s'està pujant. Si us plau esperi uns segons i intenteu-ho de nou.", + addRow: "Afegiu una filera", + removeRow: "Eliminar una filera", + choices_firstItem: "primer article", + choices_secondItem: "segon article", + choices_thirdItem: "tercer article", + matrix_column: "Columna", + matrix_row: "Filera" + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ca"] = catalanSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ca"] = "català"; + + + /***/ }), + + /***/ "./src/localization/croatian.ts": + /*!**************************************!*\ + !*** ./src/localization/croatian.ts ***! + \**************************************/ + /*! exports provided: croatianStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "croatianStrings", function() { return croatianStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var croatianStrings = { + pagePrevText: "Prethodni", + pageNextText: "Sljedeći", + completeText: "Kompletan", + previewText: "Pregled", + editText: "Uređivanje", + startSurveyText: "Početak", + otherItemText: "Ostali (opis)", + noneItemText: "Nitko", + selectAllItemText: "Select All", + progressText: "Stranica {0} od {1}", + panelDynamicProgressText: "Zapisa {0} od {1}", + questionsProgressText: "Odgovorio na {0}/{1} pitanja", + emptySurvey: "U anketi nema vidljive stranice ili pitanja.", + completingSurvey: "Hvala vam što ste završili anketu!", + completingSurveyBefore: "Naši zapisi pokazuju da ste već završili ovu anketu.", + loadingSurvey: "Anketa o učitavanje...", + optionsCaption: "Odaberite...", + value: "vrijednost", + requiredError: "Molim vas odgovorite na pitanje.", + requiredErrorInPanel: "Molim vas odgovorite na barem jedno pitanje.", + requiredInAllRowsError: "Odgovorite na pitanja u svim redovima.", + numericError: "Vrijednost bi trebala biti brojčana.", + textMinLength: "Unesite najmanje {0} znak(ova).", + textMaxLength: "Unesite manje od {0} znak(ova).", + textMinMaxLength: "Unesite više od {0} i manje od {1} znakova.", + minRowCountError: "Molimo ispunite najmanje {0} redaka.", + minSelectError: "Odaberite barem {0} varijante.", + maxSelectError: "Odaberite ne više od {0} varijanti.", + numericMinMax: "'{0}'bi trebao biti jednak ili više od {1} i jednak ili manji od {2}.", + numericMin: "'{0}' bi trebao biti jednak ili više od {1}.", + numericMax: "'{0}' bi trebao biti jednak ili manji od {1}", + invalidEmail: "Unesite valjanu e-mail adresu.", + invalidExpression: "Izraz: {0} treba vratiti 'true'.", + urlRequestError: "Zahtjev vratio pogrešku '{0}'. {1}", + urlGetChoicesError: "Zahtjev je vratio prazne podatke ili je 'path' svojstvo netočna.", + exceedMaxSize: "Veličina datoteke ne smije prelaziti {0}.", + otherRequiredError: "Unesite drugu vrijednost.", + uploadingFile: "Vaša datoteka se prenosi. Pričekajte nekoliko sekundi i pokušajte ponovno.", + loadingFile: "Učitavanje...", + chooseFile: "Odaberite datoteku...", + noFileChosen: "Nije odabrana datoteka", + confirmDelete: "Želite li izbrisati zapis?", + keyDuplicationError: "Ta bi vrijednost trebala biti jedinstvena.", + addColumn: "Dodavanje stupca", + addRow: "Dodavanje redaka", + removeRow: "Ukloniti", + addPanel: "Dodavanje novih", + removePanel: "Ukloniti", + choices_Item: "stavku", + matrix_column: "Stupca", + matrix_row: "Redak", + savingData: "Rezultati se spremaju na poslužitelju...", + savingDataError: "Došlo je do pogreške i nismo mogli spremiti rezultate.", + savingDataSuccess: "Rezultati su uspješno spremljeni!", + saveAgainButton: "Pokušaj ponovo", + timerMin: "min", + timerSec: "sec", + timerSpentAll: "Vi ste proveli {0} na ovoj stranici i {1} ukupno.", + timerSpentPage: "Potrošili ste {0} na ovu stranicu.", + timerSpentSurvey: "You have spent {0} in total. {0}.", + timerLimitAll: "Vi ste proveli {0} od {1} na ovoj stranici i {2} od {3} ukupno.", + timerLimitPage: "Potrošio si {0} od {1} na ovoj stranici.", + timerLimitSurvey: "Ukupno ste potrošili {0} od {1}.", + cleanCaption: "Očistiti", + clearCaption: "Očistiti", + chooseFileCaption: "Odaberite datoteku", + removeFileCaption: "Uklonite ovu datoteku", + booleanCheckedLabel: "Da", + booleanUncheckedLabel: "Ne", + confirmRemoveFile: "Jeste li sigurni da želite ukloniti ovu datoteku: {0}?", + confirmRemoveAllFiles: "Jeste li sigurni da želite ukloniti sve datoteke?", + questionTitlePatternText: "Naslov pitanja", + modalCancelButtonText: "Otkazati", + modalApplyButtonText: "Primijeniti", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["hr"] = croatianStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["hr"] = "hrvatski"; + + + /***/ }), + + /***/ "./src/localization/czech.ts": + /*!***********************************!*\ + !*** ./src/localization/czech.ts ***! + \***********************************/ + /*! exports provided: czechSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "czechSurveyStrings", function() { return czechSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var czechSurveyStrings = { + pagePrevText: "Předchozí", + pageNextText: "Další", + completeText: "Hotovo", + previewText: "Náhled", + editText: "Upravit", + startSurveyText: "Start", + otherItemText: "Jiná odpověď (napište)", + noneItemText: "Žádný", + selectAllItemText: "Vybrat vše", + progressText: "Strana {0} z {1}", + panelDynamicProgressText: "Záznam {0} z {1}", + questionsProgressText: "Zodpovězené otázky: {0} / {1}", + emptySurvey: "Průzkumu neobsahuje žádné otázky.", + completingSurvey: "Děkujeme za vyplnění průzkumu!", + completingSurveyBefore: "Naše záznamy ukazují, že jste tento průzkum již dokončili.", + loadingSurvey: "Probíhá načítání průzkumu...", + optionsCaption: "Vyber...", + value: "hodnota", + requiredError: "Odpovězte prosím na otázku.", + requiredErrorInPanel: "Please answer at least one question.", + requiredInAllRowsError: "Odpovězte prosím na všechny otázky.", + numericError: "V tomto poli lze zadat pouze čísla.", + textMinLength: "Zadejte prosím alespoň {0} znaků.", + textMaxLength: "Zadejte prosím méně než {0} znaků.", + textMinMaxLength: "Zadejte prosím více než {0} a méně než {1} znaků.", + minRowCountError: "Vyplňte prosím alespoň {0} řádků.", + minSelectError: "Vyberte prosím alespoň {0} varianty.", + maxSelectError: "Nevybírejte prosím více než {0} variant.", + numericMinMax: "Odpověď '{0}' by mělo být větší nebo rovno {1} a menší nebo rovno {2}", + numericMin: "Odpověď '{0}' by mělo být větší nebo rovno {1}", + numericMax: "Odpověď '{0}' by mělo být menší nebo rovno {1}", + invalidEmail: "Zadejte prosím platnou e-mailovou adresu.", + invalidExpression: "Výraz: {0} by měl vrátit hodnotu „true“.", + urlRequestError: "Požadavek vrátil chybu '{0}'. {1}", + urlGetChoicesError: "Požadavek nevrátil data nebo cesta je neplatná", + exceedMaxSize: "Velikost souboru by neměla být větší než {0}.", + otherRequiredError: "Zadejte prosím jinou hodnotu.", + uploadingFile: "Váš soubor se nahrává. Zkuste to prosím za několik sekund.", + loadingFile: "Načítání...", + chooseFile: "Vyberte soubory ...", + noFileChosen: "Není zvolený žádný soubor", + confirmDelete: "Chcete smazat záznam?", + keyDuplicationError: "Tato hodnota by měla být jedinečná.", + addColumn: "Přidat sloupec", + addRow: "Přidat řádek", + removeRow: "Odstranit", + addPanel: "Přidat nový", + removePanel: "Odstranit", + choices_Item: "položka", + matrix_column: "Sloupec", + matrix_row: "Řádek", + savingData: "Výsledky se ukládají na server ...", + savingDataError: "Došlo k chybě a výsledky jsme nemohli uložit.", + savingDataSuccess: "Výsledky byly úspěšně uloženy!", + saveAgainButton: "Zkus to znovu", + timerMin: "min", + timerSec: "sek", + timerSpentAll: "Na této stránce jste utratili celkem {0} a celkem {1}.", + timerSpentPage: "Na této stránce jste utratili {0}.", + timerSpentSurvey: "Celkem jste utratili {0}.", + timerLimitAll: "Na této stránce jste utratili {0} z {1} a celkem {2} z {3}.", + timerLimitPage: "Na této stránce jste strávili {0} z {1}.", + timerLimitSurvey: "Celkově jste utratili {0} z {1}.", + cleanCaption: "Čistý", + clearCaption: "Průhledná", + chooseFileCaption: "Vyberte soubor", + removeFileCaption: "Odeberte tento soubor", + booleanCheckedLabel: "Ano", + booleanUncheckedLabel: "Ne", + confirmRemoveFile: "Opravdu chcete odebrat tento soubor: {0}?", + confirmRemoveAllFiles: "Opravdu chcete odstranit všechny soubory?", + questionTitlePatternText: "Název otázky", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["cs"] = czechSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["cs"] = "čeština"; + + + /***/ }), + + /***/ "./src/localization/danish.ts": + /*!************************************!*\ + !*** ./src/localization/danish.ts ***! + \************************************/ + /*! exports provided: danishSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "danishSurveyStrings", function() { return danishSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var danishSurveyStrings = { + pagePrevText: "Tilbage", + pageNextText: "Videre", + completeText: "Færdig", + previewText: "Forpremiere", + editText: "Redigér", + startSurveyText: "Start", + otherItemText: "Valgfrit svar...", + noneItemText: "Ingen", + selectAllItemText: "Vælg alle", + progressText: "Side {0} af {1}", + panelDynamicProgressText: "Optag {0} af {1}", + questionsProgressText: "Besvarede {0} / {1} spørgsmål", + emptySurvey: "Der er ingen synlige spørgsmål.", + completingSurvey: "Mange tak for din besvarelse!", + completingSurveyBefore: "Vores data viser at du allerede har gennemført dette spørgeskema.", + loadingSurvey: "Spørgeskemaet hentes fra serveren...", + optionsCaption: "Vælg...", + value: "værdi", + requiredError: "Besvar venligst spørgsmålet.", + requiredErrorInPanel: "Besvar venligst mindst ét spørgsmål.", + requiredInAllRowsError: "Besvar venligst spørgsmål i alle rækker.", + numericError: "Angiv et tal.", + textMinLength: "Angiv mindst {0} tegn.", + textMaxLength: "Please enter less than {0} characters.", + textMinMaxLength: "Angiv mere end {0} og mindre end {1} tegn.", + minRowCountError: "Udfyld mindst {0} rækker.", + minSelectError: "Vælg venligst mindst {0} svarmulighed(er).", + maxSelectError: "Vælg venligst færre {0} svarmuligheder(er).", + numericMinMax: "'{0}' skal være lig med eller større end {1} og lig med eller mindre end {2}", + numericMin: "'{0}' skal være lig med eller større end {1}", + numericMax: "'{0}' skal være lig med eller mindre end {1}", + invalidEmail: "Angiv venligst en gyldig e-mail adresse.", + invalidExpression: "Udtrykket: {0} skal returnere 'true'.", + urlRequestError: "Forespørgslen returnerede fejlen '{0}'. {1}", + urlGetChoicesError: "Forespørgslen returnerede ingen data eller 'path' parameteren er forkert", + exceedMaxSize: "Filstørrelsen må ikke overstige {0}.", + otherRequiredError: "Angiv en værdi for dit valgfrie svar.", + uploadingFile: "Din fil bliver uploadet. Vent nogle sekunder og prøv eventuelt igen.", + loadingFile: "Indlæser...", + chooseFile: "Vælg fil(er)...", + noFileChosen: "Ingen fil er valgt", + confirmDelete: "Vil du fjerne den?", + keyDuplicationError: "Denne værdi skal være unik.", + addColumn: "Tilføj kolonne", + addRow: "Tilføj række", + removeRow: "Fjern", + addPanel: "Tilføj ny", + removePanel: "Fjern", + choices_Item: "valg", + matrix_column: "Kolonne", + matrix_row: "Række", + savingData: "Resultaterne bliver gemt på serveren...", + savingDataError: "Der opstod en fejl og vi kunne ikke gemme resultatet.", + savingDataSuccess: "Resultatet blev gemt!", + saveAgainButton: "Prøv igen", + timerMin: "min", + timerSec: "sek", + timerSpentAll: "Du har brugt {0} på denne side og {1} i alt.", + timerSpentPage: "Du har brugt {0} på denne side.", + timerSpentSurvey: "Du har brugt {0} i alt.", + timerLimitAll: "Du har brugt {0} af {1} på denne side og {2} af {3} i alt.", + timerLimitPage: "Du har brugt {0} af {1} på denne side.", + timerLimitSurvey: "Du har brugt {0} af {1} i alt.", + cleanCaption: "Rens", + clearCaption: "Fjern", + chooseFileCaption: "Vælg fil", + removeFileCaption: "Fjern denne fil", + booleanCheckedLabel: "Ja", + booleanUncheckedLabel: "Ingen", + confirmRemoveFile: "Er du sikker på, at du vil fjerne denne fil: {0}?", + confirmRemoveAllFiles: "Er du sikker på, at du vil fjerne alle filer?", + questionTitlePatternText: "Spørgsmåls titel", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["da"] = danishSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["da"] = "dansk"; + + + /***/ }), + + /***/ "./src/localization/dutch.ts": + /*!***********************************!*\ + !*** ./src/localization/dutch.ts ***! + \***********************************/ + /*! exports provided: dutchSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dutchSurveyStrings", function() { return dutchSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + //Created on behalf https://github.com/Frank13 + //Modified on behalf Roeland Verbakel + + var dutchSurveyStrings = { + pagePrevText: "Vorige", + pageNextText: "Volgende", + completeText: "Verzenden", + previewText: "Voorbeeld", + editText: "Bewerk", + startSurveyText: "Start", + otherItemText: "Anders, nl.", + noneItemText: "Geen", + selectAllItemText: "Selecteer Alles", + progressText: "Pagina {0} van {1}", + panelDynamicProgressText: "Record {0} of {1}", + questionsProgressText: "Geantwoord {0}/{1} vragen", + emptySurvey: "Er is geen zichtbare pagina of vraag in deze vragenlijst", + completingSurvey: "Bedankt voor het invullen van de vragenlijst", + completingSurveyBefore: "Onze gegevens tonen aan dat je deze vragenlijst reeds beantwoord hebt.", + loadingSurvey: "De vragenlijst is aan het laden...", + optionsCaption: "Kies...", + value: "waarde", + requiredError: "Dit is een vereiste vraag", + requiredErrorInPanel: "Gelieve ten minste een vraag te beantwoorden.", + requiredInAllRowsError: "Deze vraag vereist één antwoord per rij", + numericError: "Het antwoord moet een getal zijn", + textMinLength: "Vul minstens {0} karakters in", + textMaxLength: "Gelieve minder dan {0} karakters in te vullen.", + textMinMaxLength: "Gelieve meer dan {0} en minder dan {1} karakters in te vullen.", + minRowCountError: "Gelieve ten minste {0} rijen in te vullen.", + minSelectError: "Selecteer minimum {0} antwoorden", + maxSelectError: "Selecteer niet meer dan {0} antwoorden", + numericMinMax: "Uw antwoord '{0}' moet groter of gelijk zijn aan {1} en kleiner of gelijk aan {2}", + numericMin: "Uw antwoord '{0}' moet groter of gelijk zijn aan {1}", + numericMax: "Uw antwoord '{0}' moet groter of gelijk zijn aan {1}", + invalidEmail: "Vul een geldig e-mailadres in", + invalidExpression: "De uitdrukking: {0} moet 'waar' teruggeven.", + urlRequestError: "De vraag keerde een fout terug '{0}'. {1}", + urlGetChoicesError: "De vraag gaf een leeg antwoord terug of de 'pad' eigenschap is niet correct", + exceedMaxSize: "De grootte van het bestand mag niet groter zijn dan {0}", + otherRequiredError: "Vul het veld 'Anders, nl.' in", + uploadingFile: "Uw bestand wordt opgeladen. Gelieve enkele seconden te wachten en opnieuw te proberen.", + loadingFile: "Opladen...", + chooseFile: "Kies uw bestand(en)...", + noFileChosen: "Geen bestand gekozen", + confirmDelete: "Wil je deze gegevens verwijderen?", + keyDuplicationError: "Deze waarde moet uniek zijn.", + addColumn: "Voeg kolom toe", + addRow: "Voeg rij toe", + removeRow: "Verwijder", + addPanel: "Nieuwe toevoegen", + removePanel: "Verwijder", + choices_Item: "onderwerp", + matrix_column: "Kolom", + matrix_row: "Rij", + savingData: "De resultaten worden bewaard op de server...", + savingDataError: "Er was een probleem en we konden de resultaten niet bewaren.", + savingDataSuccess: "De resultaten werden succesvol bewaard!", + saveAgainButton: "Probeer opnieuw", + timerMin: "minimum", + timerSec: "sec", + timerSpentAll: "U heeft {0} gespendeerd op deze pagina en {1} in totaal.", + timerSpentPage: "U heeft {0} op deze pagina gespendeerd.", + timerSpentSurvey: "U heeft in totaal {0} gespendeerd.", + timerLimitAll: "U heeft {0} van {1} op deze pagina gespendeerd en {2} van {3} in totaal.", + timerLimitPage: "U heeft {0} van {1} gespendeerd op deze pagina.", + timerLimitSurvey: "U heeft {0} van {1} in het totaal.", + cleanCaption: "Kuis op", + clearCaption: "Kuis op", + chooseFileCaption: "Gekozen bestand", + removeFileCaption: "Verwijder deze file", + booleanCheckedLabel: "Ja", + booleanUncheckedLabel: "Neen", + confirmRemoveFile: "Bent u zeker dat u deze file wilt verwijderen: {0}?", + confirmRemoveAllFiles: "Bent u zeker dat u al deze files wilt verwijderen?", + questionTitlePatternText: "Titel van de vraag", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["nl"] = dutchSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["nl"] = "nederlands"; + + + /***/ }), + + /***/ "./src/localization/english.ts": + /*!*************************************!*\ + !*** ./src/localization/english.ts ***! + \*************************************/ + /*! exports provided: englishStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "englishStrings", function() { return englishStrings; }); + // Uncomment this line on creating a translation file + // import { surveyLocalization } from "survey-core"; + var englishStrings = { + pagePrevText: "Previous", + pageNextText: "Next", + completeText: "Complete", + previewText: "Preview", + editText: "Edit", + startSurveyText: "Start", + otherItemText: "Other (describe)", + noneItemText: "None", + selectAllItemText: "Select All", + progressText: "Page {0} of {1}", + indexText: "{0} of {1}", + panelDynamicProgressText: "{0} of {1}", + questionsProgressText: "Answered {0}/{1} questions", + emptySurvey: "There is no visible page or question in the survey.", + completingSurvey: "Thank you for completing the survey!", + completingSurveyBefore: "Our records show that you have already completed this survey.", + loadingSurvey: "Loading Survey...", + optionsCaption: "Choose...", + ratingOptionsCaption: "Tap to rate here...", + value: "value", + requiredError: "Response required.", + requiredErrorInPanel: "Response required: answer at least one question.", + requiredInAllRowsError: "Response required: answer questions in all rows.", + numericError: "The value should be numeric.", + minError: "The value should not be less than {0}", + maxError: "The value should not be greater than {0}", + textMinLength: "Please enter at least {0} character(s).", + textMaxLength: "Please enter no more than {0} character(s).", + textMinMaxLength: "Please enter at least {0} and no more than {1} characters.", + minRowCountError: "Please fill in at least {0} row(s).", + minSelectError: "Please select at least {0} variant(s).", + maxSelectError: "Please select no more than {0} variant(s).", + numericMinMax: "The '{0}' should be at least {1} and at most {2}", + numericMin: "The '{0}' should be at least {1}", + numericMax: "The '{0}' should be at most {1}", + invalidEmail: "Please enter a valid e-mail address.", + invalidExpression: "The expression: {0} should return 'true'.", + urlRequestError: "The request returned error '{0}'. {1}", + urlGetChoicesError: "The request returned empty data or the 'path' property is incorrect", + exceedMaxSize: "The file size should not exceed {0}.", + otherRequiredError: "Response required: enter another value.", + uploadingFile: "Your file is uploading. Please wait several seconds and try again.", + loadingFile: "Loading...", + chooseFile: "Choose file(s)...", + noFileChosen: "No file chosen", + fileDragAreaPlaceholder: "Drop a file here or click the button below to load the file.", + confirmDelete: "Do you want to delete the record?", + keyDuplicationError: "This value should be unique.", + addColumn: "Add column", + addRow: "Add row", + removeRow: "Remove", + emptyRowsText: "There are no rows.", + addPanel: "Add new", + removePanel: "Remove", + choices_Item: "item", + matrix_column: "Column", + matrix_row: "Row", + multipletext_itemname: "text", + savingData: "The results are being saved on the server...", + savingDataError: "An error occurred and we could not save the results.", + savingDataSuccess: "The results were saved successfully!", + saveAgainButton: "Try again", + timerMin: "min", + timerSec: "sec", + timerSpentAll: "You have spent {0} on this page and {1} in total.", + timerSpentPage: "You have spent {0} on this page.", + timerSpentSurvey: "You have spent {0} in total.", + timerLimitAll: "You have spent {0} of {1} on this page and {2} of {3} in total.", + timerLimitPage: "You have spent {0} of {1} on this page.", + timerLimitSurvey: "You have spent {0} of {1} in total.", + cleanCaption: "Clean", + clearCaption: "Clear", + signaturePlaceHolder: "Sign here", + chooseFileCaption: "Choose file", + removeFileCaption: "Remove this file", + booleanCheckedLabel: "Yes", + booleanUncheckedLabel: "No", + confirmRemoveFile: "Are you sure that you want to remove this file: {0}?", + confirmRemoveAllFiles: "Are you sure that you want to remove all files?", + questionTitlePatternText: "Question Title", + modalCancelButtonText: "Cancel", + modalApplyButtonText: "Apply", + filteredTextPlaceholder: "Type to search...", + noEntriesText: "There are no entries yet.\nClick the button below to add a new entry." + }; + //Uncomment these two lines on creating a translation file. You should replace "en" and enStrings with your locale ("fr", "de" and so on) and your variable. + //surveyLocalization.locales["en"] = englishStrings; + //surveyLocalization.localeNames["en"] = "English"; + + + /***/ }), + + /***/ "./src/localization/estonian.ts": + /*!**************************************!*\ + !*** ./src/localization/estonian.ts ***! + \**************************************/ + /*! exports provided: estonianSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "estonianSurveyStrings", function() { return estonianSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var estonianSurveyStrings = { + pagePrevText: "Tagasi", + pageNextText: "Edasi", + completeText: "Lõpeta", + previewText: "Eelvaade", + editText: "Muuda", + startSurveyText: "Alusta", + otherItemText: "Muu (täpsusta)", + noneItemText: "Mitte midagi", + selectAllItemText: "Vali kõik", + progressText: "Lehekülg {0}/{1}", + panelDynamicProgressText: "Kirje {0}/{1}", + questionsProgressText: "Vastatud {0} küsimust {1}-st", + emptySurvey: "Selles uuringus ei ole ühtki nähtavat lehekülge või küsimust.", + completingSurvey: "Aitäh, et vastasid ankeedile!", + completingSurveyBefore: "Meie andmetel oled sa sellele ankeedile juba vastanud.", + loadingSurvey: "Laen ankeeti...", + optionsCaption: "Vali...", + value: "väärtus", + requiredError: "Palun vasta küsimusele.", + requiredErrorInPanel: "Palun vasta vähemalt ühele küsimusele.", + requiredInAllRowsError: "Palun anna vastus igal real.", + numericError: "See peaks olema numbriline väärtus.", + textMinLength: "Palun sisesta vähemalt {0} tähemärki.", + textMaxLength: "Palun ära sisesta rohkem kui {0} tähemärki.", + textMinMaxLength: "Sisesta palun {0} - {1} tähemärki.", + minRowCountError: "Sisesta plaun vähemalt {0} rida.", + minSelectError: "Palun vali vähemalt {0} varianti.", + maxSelectError: "Palun vali kõige rohkem {0} varianti.", + numericMinMax: "'{0}' peaks olema võrdne või suurem kui {1} ja võrdne või väiksem kui {2}", + numericMin: "'{0}' peaks olema võrdne või suurem kui {1}", + numericMax: "'{0}' peaks olema võrnde või väiksem kui {1}", + invalidEmail: "Sisesta palun korrektne e-posti aadress.", + invalidExpression: "Avaldis: {0} peaks tagastama tõese.", + urlRequestError: "Taotlus tagastas vea „{0}”. {1}", + urlGetChoicesError: "Taotlus tagastas tühjad andmed või atribuut 'path' on vale", + exceedMaxSize: "Faili suurus ei tohi ületada {0}.", + otherRequiredError: "Sisesta palun muu vastus.", + uploadingFile: "Sinu fail laeb üles. Palun oota mõned sekundid ning proovi seejärel uuesti.", + loadingFile: "Laen...", + chooseFile: "Vali fail(id)...", + noFileChosen: "Faili pole valitud", + confirmDelete: "Kas tahad kirje kustutada?", + keyDuplicationError: "See väärtus peab olema unikaalne.", + addColumn: "Lisa veerg", + addRow: "Lisa rida", + removeRow: "Eemalda", + addPanel: "Lisa uus", + removePanel: "Eemalda", + choices_Item: "üksus", + matrix_column: "Veerg", + matrix_row: "Rida", + savingData: "Salvestan andmed serveris...", + savingDataError: "Tekkis viga ning me ei saanud vastuseid salvestada.", + savingDataSuccess: "Vastuste salvestamine õnnestus!", + saveAgainButton: "Proovi uuesti", + timerMin: "min", + timerSec: "sek", + timerSpentAll: "Oled veetnud {0} sellel lehel ning kokku {1}.", + timerSpentPage: "Oled veetnud {0} sellel lehel.", + timerSpentSurvey: "Oled veetnud {0} kokku.", + timerLimitAll: "Oled kulutanud {0} võimalikust {1} sellel lehel ning {2} võimalikust {3} kokku.", + timerLimitPage: "Oled kulutanud {0} võimalikust {1} sellel lehel.", + timerLimitSurvey: "Oled kulutanud {0} võimalikust {1} koguajast.", + cleanCaption: "Puhasta", + clearCaption: "Puhasta", + chooseFileCaption: "Vali fail", + removeFileCaption: "Eemalda see fail", + booleanCheckedLabel: "Jah", + booleanUncheckedLabel: "Ei", + confirmRemoveFile: "Oled sa kindel, et soovid selle faili eemaldada: {0}?", + confirmRemoveAllFiles: "Oled sa kindel, et soovid eemaldada kõik failid?", + questionTitlePatternText: "Küsimuse pealkiri", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["et"] = estonianSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["et"] = "eesti keel"; + + + /***/ }), + + /***/ "./src/localization/finnish.ts": + /*!*************************************!*\ + !*** ./src/localization/finnish.ts ***! + \*************************************/ + /*! exports provided: finnishSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "finnishSurveyStrings", function() { return finnishSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var finnishSurveyStrings = { + pagePrevText: "Edellinen", + pageNextText: "Seuraava", + completeText: "Valmis", + previewText: "Esikatselu", + editText: "Muokkaa", + startSurveyText: "Aloita", + otherItemText: "Muu (tarkenna)", + noneItemText: "Ei mitään", + selectAllItemText: "Valitse kaikki", + progressText: "Sivu {0} / {1}", + panelDynamicProgressText: "Osio {0} / {1}", + questionsProgressText: "Olet vastannut {0} / {1} kysymykseen.", + emptySurvey: "Tässä kyselyssä ei ole yhtään näkyvillä olevaa sivua tai kysymystä.", + completingSurvey: "Kiitos kyselyyn vastaamisesta!", + completingSurveyBefore: "Tietojemme mukaan olet jo suorittanut tämän kyselyn.", + loadingSurvey: "Kyselyä ladataan palvelimelta...", + optionsCaption: "Valitse...", + value: "arvo", + requiredError: "Vastaa kysymykseen, kiitos.", + requiredErrorInPanel: "Vastaa ainakin yhteen kysymykseen.", + requiredInAllRowsError: "Vastaa kysymyksiin kaikilla riveillä.", + numericError: "Arvon tulee olla numeerinen.", + textMinLength: "Syötä vähintään {0} merkkiä.", + textMaxLength: "Älä syötä yli {0} merkkiä.", + textMinMaxLength: "Syötä vähintään {0} ja enintään {1} merkkiä.", + minRowCountError: "Täytä vähintään {0} riviä.", + minSelectError: "Valitse vähintään {0} vaihtoehtoa.", + maxSelectError: "Valitse enintään {0} vaihtoehtoa.", + numericMinMax: "Luvun '{0}' tulee olla vähintään {1} ja korkeintaan {2}.", + numericMin: "Luvun '{0}' tulee olla vähintään {1}.", + numericMax: "Luvun '{0}' tulee olla korkeintaan {1}.", + invalidEmail: "Syötä validi sähköpostiosoite.", + invalidExpression: "Lausekkeen: {0} pitäisi palauttaa 'true'.", + urlRequestError: "Pyyntö palautti virheen {0}. {1}", + urlGetChoicesError: "Pyyntö palautti tyhjän tiedoston tai 'path'-asetus on väärä", + exceedMaxSize: "Tiedoston koko ei saa olla suurempi kuin {0}.", + otherRequiredError: "Tarkenna vastaustasi tekstikenttään.", + uploadingFile: "Tiedostoa lähetetään. Odota muutama sekunti ja yritä uudelleen.", + loadingFile: "Ladataan...", + chooseFile: "Valitse tiedosto(t)...", + fileDragAreaPlaceholder: "Pudota tiedosto tähän tai lataa tiedosto napsauttamalla alla olevaa painiketta.", + noFileChosen: "Ei tiedostoa valittuna", + confirmDelete: "Haluatko poistaa osion?", + keyDuplicationError: "Tämä arvo on jo käytössä. Syötä toinen arvo.", + addColumn: "Lisää sarake", + addRow: "Lisää rivi", + removeRow: "Poista", + emptyRowsText: "Ei rivejä", + addPanel: "Lisää uusi", + removePanel: "Poista", + choices_Item: "kohde", + matrix_column: "Sarake", + matrix_row: "Rivi", + savingData: "Tietoja tallennetaan palvelimelle...", + savingDataError: "Tapahtui virhe, emmekä voineet tallentaa kyselyn tietoja.", + savingDataSuccess: "Tiedot tallennettiin onnistuneesti!", + saveAgainButton: "Yritä uudelleen", + timerMin: "min", + timerSec: "sek", + timerSpentAll: "Olet käyttänyt {0} tällä sivulla ja yhteensä {1}.", + timerSpentPage: "Olet käyttänyt {0} tällä sivulla.", + timerSpentSurvey: "Olet käyttänyt yhteensä {0}.", + timerLimitAll: "Olet käyttänyt tällä sivulla {0} / {1} ja yhteensä {2} / {3}.", + timerLimitPage: "Olet käyttänyt {0} / {1} tällä sivulla.", + timerLimitSurvey: "Olet käyttänyt yhteensä {0} / {1}.", + cleanCaption: "Pyyhi", + clearCaption: "Tyhjennä", + chooseFileCaption: "Valitse tiedosto", + removeFileCaption: "Poista tämä tiedosto", + booleanCheckedLabel: "Kyllä", + booleanUncheckedLabel: "Ei", + confirmRemoveFile: "Haluatko varmasti poistaa tämän tiedoston: {0}?", + confirmRemoveAllFiles: "Haluatko varmasti poistaa kaikki tiedostot?", + questionTitlePatternText: "Kysymyksen otsikko", + modalCancelButtonText: "Peruuta", + modalApplyButtonText: "Käytä", + ratingOptionsCaption: "Arvioi napauttamalla tätä...", + filteredTextPlaceholder: "Hae kirjoittamalla...", + indexText: "{0} / {1}", + minError: "Arvo ei saa olla pienempi kuin {0}", + maxError: "Arvo ei saa olla suurempi kuin {0}", + multipletext_itemname: "teksti", + noEntriesText: "Merkintöjä ei ole vielä.\nLisää uusi merkintä napsauttamalla alla olevaa painiketta.", + signaturePlaceHolder: "Allekirjoita tähän", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["fi"] = finnishSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["fi"] = "suomi"; + + + /***/ }), + + /***/ "./src/localization/french.ts": + /*!************************************!*\ + !*** ./src/localization/french.ts ***! + \************************************/ + /*! exports provided: frenchSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "frenchSurveyStrings", function() { return frenchSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var frenchSurveyStrings = { + pagePrevText: "Précédent", + pageNextText: "Suivant", + completeText: "Terminer", + previewText: "Aperçu", + editText: "Modifier", + startSurveyText: "Commencer", + otherItemText: "Autre (préciser)", + noneItemText: "Aucun", + selectAllItemText: "Tout sélectionner", + progressText: "Page {0} sur {1}", + panelDynamicProgressText: "Enregistrement {0} sur {1}", + questionsProgressText: "{0}/{1} question(s) répondue(s)", + emptySurvey: "Il n'y a ni page visible ni question visible dans ce questionnaire", + completingSurvey: "Merci d'avoir répondu au questionnaire !", + completingSurveyBefore: "Nos données indiquent que vous avez déjà rempli ce questionnaire.", + loadingSurvey: "Le questionnaire est en cours de chargement...", + optionsCaption: "Choisissez...", + ratingOptionsCaption: "Appuyez ici pour noter...", + value: "valeur", + requiredError: "La réponse à cette question est obligatoire.", + requiredErrorInPanel: "Merci de répondre au moins à une question.", + requiredInAllRowsError: "Toutes les lignes sont obligatoires", + numericError: "La réponse doit être un nombre.", + textMinLength: "Merci de saisir au moins {0} caractères.", + textMaxLength: "Merci de saisir moins de {0} caractères.", + textMinMaxLength: "Merci de saisir entre {0} et {1} caractères.", + minRowCountError: "Merci de compléter au moins {0} lignes.", + minSelectError: "Merci de sélectionner au minimum {0} réponses.", + maxSelectError: "Merci de sélectionner au maximum {0} réponses.", + numericMinMax: "Votre réponse '{0}' doit être supérieure ou égale à {1} et inférieure ou égale à {2}", + numericMin: "Votre réponse '{0}' doit être supérieure ou égale à {1}", + numericMax: "Votre réponse '{0}' doit être inférieure ou égale à {1}", + invalidEmail: "Merci d'entrer une adresse mail valide.", + invalidExpression: "L'expression: {0} doit retourner 'true'.", + urlRequestError: "La requête a renvoyé une erreur '{0}'. {1}", + urlGetChoicesError: "La requête a renvoyé des données vides ou la propriété 'path' est incorrecte", + exceedMaxSize: "La taille du fichier ne doit pas excéder {0}.", + otherRequiredError: "Merci de préciser le champ 'Autre'.", + uploadingFile: "Votre fichier est en cours de chargement. Merci d'attendre quelques secondes et de réessayer.", + loadingFile: "Chargement...", + chooseFile: "Ajouter des fichiers...", + fileDragAreaPlaceholder: "Déposez un fichier ici ou cliquez sur le bouton ci-dessous pour charger le fichier.", + noFileChosen: "Aucun fichier ajouté", + confirmDelete: "Voulez-vous supprimer cet enregistrement ?", + keyDuplicationError: "Cette valeur doit être unique.", + addColumn: "Ajouter une colonne", + addRow: "Ajouter une ligne", + removeRow: "Supprimer", + addPanel: "Ajouter", + removePanel: "Supprimer", + choices_Item: "item", + matrix_column: "Colonne", + matrix_row: "Ligne", + savingData: "Les résultats sont en cours de sauvegarde sur le serveur...", + savingDataError: "Une erreur est survenue et a empêché la sauvegarde des résultats.", + savingDataSuccess: "Les résultats ont bien été enregistrés !", + saveAgainButton: "Réessayer", + timerMin: "min", + timerSec: "sec", + timerSpentAll: "Vous avez passé {0} sur cette page et {1} au total.", + timerSpentPage: "Vous avez passé {0} sur cette page.", + timerSpentSurvey: "Vous avez passé {0} au total.", + timerLimitAll: "Vous avez passé {0} sur {1} sur cette page et {2} sur {3} au total.", + timerLimitPage: "Vous avez passé {0} sur {1} sur cette page.", + timerLimitSurvey: "Vous avez passé {0} sur {1} au total.", + cleanCaption: "Nettoyer", + clearCaption: "Vider", + chooseFileCaption: "Ajouter un fichier", + removeFileCaption: "Enlever ce fichier", + booleanCheckedLabel: "Oui", + booleanUncheckedLabel: "Non", + confirmRemoveFile: "Êtes-vous certains de vouloir supprimer ce fichier : {0}?", + confirmRemoveAllFiles: "Êtes-vous certains de vouloir supprimer tous les fichiers?", + questionTitlePatternText: "Titre de la question", + emptyRowsText: "Il n'y a pas de lignes.", + filteredTextPlaceholder: "Tapez pour rechercher...", + indexText: "{0} sur {1}", + minError: "La valeur ne doit pas être inférieure à {0}", + maxError: "La valeur ne doit pas être supérieure à {0}", + modalApplyButtonText: "Appliquer", + modalCancelButtonText: "Annuler", + multipletext_itemname: "texte", + noEntriesText: "Il n'y a pas encore d'entrées.\nCliquez sur le bouton ci-dessous pour ajouter une nouvelle entrée.", + signaturePlaceHolder: "Signez ici", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["fr"] = frenchSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["fr"] = "français"; + + + /***/ }), + + /***/ "./src/localization/georgian.ts": + /*!**************************************!*\ + !*** ./src/localization/georgian.ts ***! + \**************************************/ + /*! exports provided: georgianSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "georgianSurveyStrings", function() { return georgianSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var georgianSurveyStrings = { + pagePrevText: "უკან", + pageNextText: "შემდეგ", + completeText: "დასრულება", + progressText: "გვერდი {0} / {1}", + emptySurvey: "არცერთი კითხვა არ არის.", + completingSurvey: "გმადლობთ კითხვარის შევსებისთვის!", + loadingSurvey: "ჩატვირთვა სერვერიდან...", + otherItemText: "სხვა (გთხოვთ მიუთითეთ)", + optionsCaption: "არჩევა...", + requiredError: "გთხოვთ უპასუხეთ კითხვას.", + numericError: "პასუხი უნდა იყოს რიცხვი.", + textMinLength: "გთხოვთ შეიყვანეთ არანაკლებ {0} სიმბოლო.", + minSelectError: "გთხოვთ აირჩიეთ არანაკლებ {0} ვარიანტი.", + maxSelectError: "გთხოვთ აირჩიეთ არაუმეტეს {0} ვარიანტი.", + numericMinMax: "'{0}' უნდა იყოს მეტი ან ტოლი, ვიდრე {1}, და ნაკლები ან ტოლი ვიდრე {2}", + numericMin: "'{0}' უნდა იყოს მეტი ან ტოლი ვიდრე {1}", + numericMax: "'{0}' უნდა იყოს ნაკლები ან ტოლი ვიდრე {1}", + invalidEmail: "გთხოვთ შეიყვანოთ ელ. ფოსტის რეალური მისამართი.", + otherRequiredEror: "გთხოვთ შეავსეთ ველი 'სხვა'" + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ka"] = georgianSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ka"] = "ქართული"; + + + /***/ }), + + /***/ "./src/localization/german.ts": + /*!************************************!*\ + !*** ./src/localization/german.ts ***! + \************************************/ + /*! exports provided: germanSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "germanSurveyStrings", function() { return germanSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var germanSurveyStrings = { + pagePrevText: "Zurück", + pageNextText: "Weiter", + completeText: "Abschließen", + previewText: "Vorschau", + editText: "Bearbeiten", + startSurveyText: "Start", + otherItemText: "Sonstiges (Bitte angeben)", + noneItemText: "Nichts trifft zu", + selectAllItemText: "Alles auswählen", + progressText: "Seite {0} von {1}", + panelDynamicProgressText: "Eintrag {0} von {1}", + questionsProgressText: "{0}/{1} Fragen beantwortet", + emptySurvey: "Es sind keine Fragen vorhanden.", + completingSurvey: "Vielen Dank, dass Sie die Umfrage abgeschlossen haben!", + completingSurveyBefore: "Wir haben festgestellt, dass Sie diese Umfrage bereits abgeschlossen haben.", + loadingSurvey: "Umfrage wird geladen...", + optionsCaption: "Bitte auswählen...", + value: "Wert", + requiredError: "Bitte beantworten Sie diese Frage.", + requiredErrorInPanel: "Bitte beantworten Sie mindestens eine Frage.", + requiredInAllRowsError: "Bitte beantworten Sie alle Fragen.", + numericError: "Der Wert muss eine Zahl sein.", + textMinLength: "Bitte geben Sie mindestens {0} Zeichen ein.", + textMaxLength: "Bitte geben Sie nicht mehr als {0} Zeichen ein.", + textMinMaxLength: "Bitte geben Sie mindestens {0} und maximal {1} Zeichen ein.", + minRowCountError: "Bitte machen Sie in mindestens {0} Zeilen eine Eingabe.", + minSelectError: "Bitte wählen Sie mindestens {0} Antwort(en) aus.", + maxSelectError: "Bitte wählen Sie nicht mehr als {0} Antwort(en) aus.", + numericMinMax: "'{0}' muss größer oder gleich {1} und kleiner oder gleich {2} sein", + numericMin: "'{0}' muss größer oder gleich {1} sein", + numericMax: "'{0}' muss kleiner oder gleich {1} sein", + invalidEmail: "Bitte geben Sie eine gültige E-Mail-Adresse ein.", + invalidExpression: "Der Ausdruck: {0} muss den Wert 'wahr' zurückgeben.", + urlRequestError: "Ein Netzwerkdienst hat folgenden Fehler zurückgegeben '{0}'. {1}", + urlGetChoicesError: "Eine Netzwerkdienst hat ungültige Daten zurückgegeben", + exceedMaxSize: "Die Datei darf nicht größer als {0} sein.", + otherRequiredError: "Bitte geben Sie einen Wert an.", + uploadingFile: "Bitte warten Sie bis der Upload Ihrer Dateien abgeschlossen ist.", + loadingFile: "Wird hochgeladen...", + chooseFile: "Datei(en) auswählen...", + fileDragAreaPlaceholder: "Legen Sie hier eine Datei ab oder klicken Sie auf die Schaltfläche unten, um die Datei zu laden.", + noFileChosen: "Keine Datei ausgewählt", + confirmDelete: "Wollen Sie den Eintrag löschen?", + keyDuplicationError: "Dieser Wert muss einmalig sein.", + addColumn: "Spalte hinzufügen", + addRow: "Zeile hinzufügen", + removeRow: "Entfernen", + addPanel: "Neu hinzufügen", + removePanel: "Entfernen", + choices_Item: "Element", + matrix_column: "Spalte", + matrix_row: "Zeile", + savingData: "Die Ergebnisse werden auf dem Server gespeichert...", + savingDataError: "Es ist ein Fehler aufgetreten. Die Ergebnisse konnten nicht gespeichert werden.", + savingDataSuccess: "Die Ergebnisse wurden gespeichert!", + saveAgainButton: "Erneut absenden", + timerMin: "Min.", + timerSec: "Sek.", + timerSpentAll: "Sie waren {0} auf dieser Seite und brauchten insgesamt {1}.", + timerSpentPage: "Sie waren {0} auf dieser Seite.", + timerSpentSurvey: "Sie haben insgesamt {0} gebraucht.", + timerLimitAll: "Sie waren {0} von {1} auf dieser Seite und brauchten insgesamt {2} von {3}.", + timerLimitPage: "Sie waren {0} von {1} auf dieser Seite.", + timerLimitSurvey: "Sie haben insgesamt {0} von {1} gebraucht.", + cleanCaption: "Alles löschen", + clearCaption: "Auswahl entfernen", + chooseFileCaption: "Datei auswählen", + removeFileCaption: "Datei löschen", + booleanCheckedLabel: "Ja", + booleanUncheckedLabel: "Nein", + confirmRemoveFile: "Sind Sie sicher, dass Sie diese Datei löschen möchten: {0}?", + confirmRemoveAllFiles: "Sind Sie sicher, dass Sie alle Dateien löschen möchten?", + questionTitlePatternText: "Fragentitel", + ratingOptionsCaption: "Tippen Sie hier, um zu bewerten...", + emptyRowsText: "Es gibt keine Reihen.", + filteredTextPlaceholder: "Tippe um zu suchen...", + indexText: "{0} von {1}", + minError: "Der Wert sollte nicht kleiner als {0} sein", + maxError: "Der Wert sollte nicht größer als {0} sein", + modalApplyButtonText: "Anwenden", + modalCancelButtonText: "Stornieren", + multipletext_itemname: "Text", + noEntriesText: "Es gibt noch keine Einträge.\nKlicken Sie auf die Schaltfläche unten, um einen neuen Eintrag hinzuzufügen.", + signaturePlaceHolder: "Hier unterschreiben", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["de"] = germanSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["de"] = "deutsch"; + + + /***/ }), + + /***/ "./src/localization/greek.ts": + /*!***********************************!*\ + !*** ./src/localization/greek.ts ***! + \***********************************/ + /*! exports provided: greekSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "greekSurveyStrings", function() { return greekSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + //Created by https://github.com/agelospanagiotakis + + var greekSurveyStrings = { + pagePrevText: "Προηγούμενο", + pageNextText: "Επόμενο", + completeText: "Ολοκλήρωση", + previewText: "Προεπισκόπηση", + editText: "Επεξεργασία", + startSurveyText: "Αρχή", + otherItemText: "Άλλο (παρακαλώ διευκρινίστε)", + noneItemText: "Κανένας", + selectAllItemText: "Επιλογή όλων", + progressText: "Σελίδα {0} από {1}", + panelDynamicProgressText: "Εγγραφή {0} από {1}", + questionsProgressText: "Απαντήθηκαν {0} / {1} ερωτήσεις", + emptySurvey: "Δεν υπάρχει καμία ορατή σελίδα ή ορατή ερώτηση σε αυτό το ερωτηματολόγιο.", + completingSurvey: "Ευχαριστούμε για την συμπλήρωση αυτού του ερωτηματολογίου!", + completingSurveyBefore: "Τα αρχεία μας δείχνουν ότι έχετε ήδη ολοκληρώσει αυτήν την έρευνα.", + loadingSurvey: "Το ερωτηματολόγιο φορτώνεται απο το διακομιστή...", + optionsCaption: "Επιλέξτε...", + value: "αξία", + requiredError: "Παρακαλώ απαντήστε στην ερώτηση.", + requiredErrorInPanel: "Απαντήστε σε τουλάχιστον μία ερώτηση.", + requiredInAllRowsError: "Παρακαλώ απαντήστε στις ερωτήσεις σε όλες τις γραμμές.", + numericError: "Η τιμή πρέπει να είναι αριθμητική.", + textMinLength: "Παρακαλώ συμπληρώστε τουλάχιστον {0} σύμβολα.", + textMaxLength: "Εισαγάγετε λιγότερους από {0} χαρακτήρες.", + textMinMaxLength: "Εισαγάγετε περισσότερους από {0} και λιγότερους από {1} χαρακτήρες.", + minRowCountError: "Παρακαλώ συμπληρώστε τουλάχιστον {0} γραμμές.", + minSelectError: "Παρακαλώ επιλέξτε τουλάχιστον {0} παραλλαγές.", + maxSelectError: "Παρακαλώ επιλέξτε όχι παραπάνω απο {0} παραλλαγές.", + numericMinMax: "Το '{0}' θα πρέπει να είναι ίσο ή μεγαλύτερο απο το {1} και ίσο ή μικρότερο απο το {2}", + numericMin: "Το '{0}' πρέπει να είναι μεγαλύτερο ή ισο με το {1}", + numericMax: "Το '{0}' πρέπει να είναι μικρότερο ή ίσο απο το {1}", + invalidEmail: "Παρακαλώ δώστε μια αποδεκτή διεύθυνση e-mail.", + invalidExpression: "Η έκφραση: {0} θα πρέπει να επιστρέψει 'true'.", + urlRequestError: "Η αίτηση επέστρεψε σφάλμα '{0}'. {1}", + urlGetChoicesError: "Η αίτηση επέστρεψε κενά δεδομένα ή η ιδιότητα 'μονοπάτι/path' είναι εσφαλμένη", + exceedMaxSize: "Το μέγεθος δεν μπορεί να υπερβαίνει τα {0}.", + otherRequiredError: "Παρακαλώ συμπληρώστε την τιμή για το πεδίο 'άλλο'.", + uploadingFile: "Το αρχείο σας ανεβαίνει. Παρακαλώ περιμένετε καποια δευτερόλεπτα και δοκιμάστε ξανά.", + loadingFile: "Φόρτωση...", + chooseFile: "Επιλογή αρχείων ...", + noFileChosen: "Δεν έχει επιλεγεί αρχείο", + confirmDelete: "Θέλετε να διαγράψετε την εγγραφή;", + keyDuplicationError: "Αυτή η τιμή πρέπει να είναι μοναδική.", + addColumn: "Προσθήκη στήλης", + addRow: "Προσθήκη γραμμής", + removeRow: "Αφαίρεση", + addPanel: "Προσθεσε νεο", + removePanel: "Αφαιρώ", + choices_Item: "είδος", + matrix_column: "Στήλη", + matrix_row: "Σειρά", + savingData: "Τα αποτελέσματα αποθηκεύονται στον διακομιστή ...", + savingDataError: "Παρουσιάστηκε σφάλμα και δεν ήταν δυνατή η αποθήκευση των αποτελεσμάτων.", + savingDataSuccess: "Τα αποτελέσματα αποθηκεύτηκαν με επιτυχία!", + saveAgainButton: "Προσπάθησε ξανά", + timerMin: "ελάχ", + timerSec: "δευτ", + timerSpentAll: "Έχετε δαπανήσει {0} σε αυτήν τη σελίδα και {1} συνολικά.", + timerSpentPage: "Έχετε ξοδέψει {0} σε αυτήν τη σελίδα.", + timerSpentSurvey: "Έχετε ξοδέψει συνολικά {0}.", + timerLimitAll: "Έχετε δαπανήσει {0} από {1} σε αυτήν τη σελίδα και {2} από {3} συνολικά.", + timerLimitPage: "Έχετε ξοδέψει {0} από {1} σε αυτήν τη σελίδα.", + timerLimitSurvey: "Έχετε ξοδέψει {0} από {1} συνολικά.", + cleanCaption: "ΚΑΘΑΡΗ", + clearCaption: "Σαφή", + chooseFileCaption: "Επιλέξτε το αρχείο", + removeFileCaption: "Καταργήστε αυτό το αρχείο", + booleanCheckedLabel: "Ναί", + booleanUncheckedLabel: "Οχι", + confirmRemoveFile: "Είστε βέβαιοι ότι θέλετε να καταργήσετε αυτό το αρχείο: {0};", + confirmRemoveAllFiles: "Είστε βέβαιοι ότι θέλετε να καταργήσετε όλα τα αρχεία;", + questionTitlePatternText: "Τίτλος ερώτησης", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["gr"] = greekSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["gr"] = "ελληνικά"; + + + /***/ }), + + /***/ "./src/localization/hebrew.ts": + /*!************************************!*\ + !*** ./src/localization/hebrew.ts ***! + \************************************/ + /*! exports provided: hebrewSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hebrewSurveyStrings", function() { return hebrewSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var hebrewSurveyStrings = { + pagePrevText: "אחורה", + pageNextText: "קדימה", + completeText: "סיום", + previewText: "תצוגה מקדימה", + editText: "לַעֲרוֹך", + startSurveyText: "הַתחָלָה", + otherItemText: "אחר (נא לתאר)", + noneItemText: "אף אחד", + selectAllItemText: "בחר הכל", + progressText: "דף {1} מתוך {0}", + panelDynamicProgressText: "הקלטה {0} מתוך {1}", + questionsProgressText: "ענה על שאלות", + emptySurvey: "אין שאלות", + completingSurvey: "תודה על מילוי השאלון!", + completingSurveyBefore: "הרשומות שלנו מראות שכבר סיימת את הסקר הזה.", + loadingSurvey: "טעינה מהשרת...", + optionsCaption: "בחר...", + value: "ערך", + requiredError: "אנא השב על השאלה", + requiredErrorInPanel: "אנא ענה לפחות על שאלה אחת.", + requiredInAllRowsError: "אנא ענה על שאלות בכל השורות.", + numericError: "התשובה צריכה להיות מספר.", + textMinLength: "הזן לפחות {0} תווים.", + textMaxLength: "הזן פחות מ- {0} תווים.", + textMinMaxLength: "הזן יותר מ- {0} ופחות מ- {1} תווים.", + minRowCountError: "אנא מלא לפחות {0} שורות.", + minSelectError: "בחר לפחות {0} אפשרויות.", + maxSelectError: "בחר עד {0} אפשרויות.", + numericMinMax: "'{0}' חייב להיות שווה או גדול מ {1}, ושווה ל- {2} או פחות מ- {}}", + numericMin: "'{0}' חייב להיות שווה או גדול מ {1}", + numericMax: "'{0}' חייב להיות שווה או קטן מ {1}", + invalidEmail: 'הזן כתובת דוא"ל חוקית.', + invalidExpression: "הביטוי: {0} צריך להחזיר 'אמת'.", + urlRequestError: "הבקשה החזירה את השגיאה '{0}'. {1}", + urlGetChoicesError: "הבקשה החזירה נתונים ריקים או שהמאפיין 'נתיב' שגוי", + exceedMaxSize: "גודל הקובץ לא יעלה על {0}.", + otherRequiredError: 'נא להזין נתונים בשדה "אחר"', + uploadingFile: "הקובץ שלך נטען. המתן מספר שניות ונסה שוב.", + loadingFile: "טוען...", + chooseFile: "לבחור קבצים...", + noFileChosen: "לא נבחר קובץ", + confirmDelete: "האם אתה רוצה למחוק את הרשומה?", + keyDuplicationError: "ערך זה צריך להיות ייחודי.", + addColumn: "הוסף עמודה", + addRow: "להוסיף שורה", + removeRow: "לְהַסִיר", + addPanel: "הוסף חדש", + removePanel: "לְהַסִיר", + choices_Item: "פריט", + matrix_column: "טור", + matrix_row: "שׁוּרָה", + savingData: "התוצאות נשמרות בשרת ...", + savingDataError: "אירעה שגיאה ולא הצלחנו לשמור את התוצאות.", + savingDataSuccess: "התוצאות נשמרו בהצלחה!", + saveAgainButton: "נסה שוב", + timerMin: "דקה", + timerSec: "שניות", + timerSpentAll: "הוצאת {0} בדף זה ובסך הכל {1}.", + timerSpentPage: "הוצאת {0} בדף זה.", + timerSpentSurvey: "הוצאת סכום כולל של {0}.", + timerLimitAll: "הוצאת {0} מתוך {1} בדף זה ו- {2} מתוך {3} בסך הכל.", + timerLimitPage: "הוצאת {0} מתוך {1} בדף זה.", + timerLimitSurvey: "הוצאת סכום כולל של {0} מתוך {1}.", + cleanCaption: "לְנַקוֹת", + clearCaption: "ברור", + chooseFileCaption: "בחר קובץ", + removeFileCaption: "הסר קובץ זה", + booleanCheckedLabel: "כן", + booleanUncheckedLabel: "לא", + confirmRemoveFile: "האם אתה בטוח שברצונך להסיר קובץ זה: {0}?", + confirmRemoveAllFiles: "האם אתה בטוח שברצונך להסיר את כל הקבצים?", + questionTitlePatternText: "כותרת שאלה", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["he"] = hebrewSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["he"] = "עברית"; + + + /***/ }), + + /***/ "./src/localization/hindi.ts": + /*!***********************************!*\ + !*** ./src/localization/hindi.ts ***! + \***********************************/ + /*! exports provided: hindiStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hindiStrings", function() { return hindiStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var hindiStrings = { + pagePrevText: "पिछला", + pageNextText: "अगला", + completeText: "पूरा", + previewText: "पूर्वसमीक्षा", + editText: "संपादित", + startSurveyText: "शुरू", + otherItemText: "दूसरा (वर्णन करें)", + noneItemTex: "कोई नहीं", + selectAllItemText: "सभी का चयन करें", + progressText: "पृष्ठ 1 में से 0", + panelDynamicProgressText: " दस्तावेज {1} के {0}", + questionsProgressText: "{1} सवालों में से {0} के जवाब दिए", + emptySurvey: "सर्वेक्षण में कोई दृश्यमान पृष्ठ या प्रश्न नहीं है", + completingSurvey: "सर्वेक्षण को पूरा करने के लिए धन्यवाद", + completingSurveyBefore: " हमारे रिकॉर्ड बताते हैं कि आप पहले ही इस सर्वेक्षण को पूरा कर चुके हैं", + loadingSurvey: "सर्वेक्षण खुल रहा है.…", + optionsCaption: "चुनें", + value: "मूल्य", + requiredError: "कृपया प्रश्न का उत्तर दें", + requiredErrorInPanel: "कृपया कम से कम एक प्रश्न का उत्तर दें", + requiredInAllRowsError: "कृपया सभी पंक्तियों में सवालों के जवाब दें", + numericError: "मूल्य संख्यात्मक होना चाहिए", + textMinLength: "कृपया कम से कम {0} वर्ण दर्ज करें", + textMaxLength: "कृपया {0} से कम वर्ण दर्ज करें", + textMinMaxLength: "कृपया {0} से अधिक और {1} से कम पात्रों में प्रवेश करें", + minRowCountError: "कृपया कम से कम {0} पंक्तियों को भरें", + minSelectError: "कृपया कम से कम {0} विकल्प का चयन करें", + maxSelectError: "कृपया {0} विकल्पों से अधिक नहीं चुनें", + numericMinMax: "'{0}' {1} से बराबर या अधिक और {2} से बराबर या कम होना चाहिए", + numericMin: "'{0}' {1} से बराबर या अधिक होना चाहिए", + numericMax: "'{0}' {1} से बराबर या कम होना चाहिए", + invalidEmail: "कृपया एक वैध ईमेल पता दर्ज करें", + invalidExpression: "अभिव्यक्ति: {0} को ' सच ' लौटना चाहिए", + urlRequestError: "अनुरोध लौटाया त्रुटि '{0}' . {1}", + urlGetChoicesError: "अनुरोध ने खाली डेटा वापस कर दिया है ", + exceedMaxSize: "फ़ाइल का आकार {0} से अधिक नहीं होना चाहिए या फिर 'पाथ' प्रॉपर्टी गलत है", + otherRequiredError: "कृपया दूसरा मूल्य दर्ज करें", + uploadingFile: "आपकी फाइल अपलोड हो रही है। कृपया कई सेकंड इंतजार करें और फिर से प्रयास करें।", + loadingFile: "लोडिंग", + chooseFile: "फ़ाइल चुनें", + noFileChosen: "कोई फाइल नहीं चुनी गई", + confirmDelete: "क्या आप रिकॉर्ड हटाना चाहते हैं", + keyDuplicationError: "यह मान अनोखा होना चाहिए", + addColumn: "कॉलम जोड़ें", + addRow: "पंक्ति जोड़ें", + removeRow: "हटाए", + addPanel: "नया जोड़ें", + removePanel: "हटाए", + choices_Item: "मद", + matrix_column: "कॉलम", + matrix_row: "पंक्ति", + savingData: "परिणाम सर्वर पर सेव हो रहे हैं", + savingDataError: "एक त्रुटि हुई और हम परिणामों को नहीं सेव कर सके", + savingDataSuccess: "परिणाम सफलतापूर्वक सेव हो गए", + saveAgainButton: "फिर कोशिश करो", + timerMin: "मिनट", + timerSec: "सेकंड", + timerSpentAll: "आपने इस पृष्ठ पर {0} खर्च किए हैं और कुल {1}", + timerSpentPage: "आपने इस पृष्ठ पर {0} खर्च किया है", + timerSpentSurvey: "आपने कुल {0} खर्च किया है", + timerLimitAll: "आपने इस पृष्ठ पर {1} की {0} और कुल {3} की {2} खर्च की है।", + timerLimitPage: "आपने इस पृष्ठ पर {1} का {0} खर्च किया है", + timerLimitSurvey: "आपने कुल {1} की {0} खर्च की है", + cleanCaption: "साफ", + clearCaption: "स्पष्ट", + chooseFileCaption: "फ़ाइल चुनें", + removeFileCaption: "इस फाइल को निकालें", + booleanCheckedLabel: "हाँ", + booleanUncheckedLabel: "नहीं", + confirmRemoveFile: "क्या आप सुनिश्चित हैं कि आप इस फ़ाइल को हटाना चाहते हैं: {0}", + confirmRemoveAllFiles: "क्या आप सुनिश्चित हैं कि आप सभी फ़ाइलों को हटाना चाहते हैं", + questionTitlePatternText: "प्रश्न का शीर्षक", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["hi"] = hindiStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["hi"] = "hindi"; + + + /***/ }), + + /***/ "./src/localization/hungarian.ts": + /*!***************************************!*\ + !*** ./src/localization/hungarian.ts ***! + \***************************************/ + /*! exports provided: hungarianSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hungarianSurveyStrings", function() { return hungarianSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var hungarianSurveyStrings = { + pagePrevText: "Vissza", + pageNextText: "Tovább", + completeText: "Kész", + previewText: "Előnézet", + editText: "Szerkesztés", + startSurveyText: "Rajt", + otherItemText: "Egyéb (adja meg)", + noneItemText: "Egyik sem", + selectAllItemText: "Mindet kiválaszt", + progressText: "{0}./{1} oldal", + panelDynamicProgressText: "{0} / {1} rekord", + questionsProgressText: "Válaszolt kérdések: {0} / {1}", + emptySurvey: "There is no visible page or question in the survey.", + completingSurvey: "Köszönjük, hogy kitöltötte felmérésünket!", + completingSurveyBefore: "Már kitöltötte a felmérést.", + loadingSurvey: "Felmérés betöltése...", + optionsCaption: "Válasszon...", + value: "érték", + requiredError: "Kérjük, válaszolja meg ezt a kérdést!", + requiredErrorInPanel: "Kérjük, válaszoljon legalább egy kérdésre.", + requiredInAllRowsError: "Kérjük adjon választ minden sorban!", + numericError: "Az érték szám kell, hogy legyen!", + textMinLength: "Adjon meg legalább {0} karaktert!", + textMaxLength: "Legfeljebb {0} karaktert adjon meg!", + textMinMaxLength: "Adjon meg legalább {0}, de legfeljebb {1} karaktert!", + minRowCountError: "Töltsön ki minimum {0} sort!", + minSelectError: "Válasszon ki legalább {0} lehetőséget!", + maxSelectError: "Ne válasszon többet, mint {0} lehetőség!", + numericMinMax: "'{0}' legyen nagyobb, vagy egyenlő, mint {1} és kisebb, vagy egyenlő, mint {2}!", + numericMin: "'{0}' legyen legalább {1}!", + numericMax: "The '{0}' ne legyen nagyobb, mint {1}!", + invalidEmail: "Adjon meg egy valós email címet!", + invalidExpression: "A következő kifejezés: {0} vissza kell adnia az „igaz” értéket.", + urlRequestError: "A lekérdezés hibával tért vissza: '{0}'. {1}", + urlGetChoicesError: "A lekérdezés üres adattal tért vissza, vagy a 'path' paraméter helytelen.", + exceedMaxSize: "A méret nem lehet nagyobb, mint {0}.", + otherRequiredError: "Adja meg az egyéb értéket!", + uploadingFile: "Feltöltés folyamatban. Várjon pár másodpercet, majd próbálja újra.", + loadingFile: "Betöltés...", + chooseFile: "Fájlok kiválasztása ...", + fileDragAreaPlaceholder: "Dobjon ide egy fájlt, vagy kattintson az alábbi gombra a fájl betöltéséhez.", + noFileChosen: "Nincs kiválasztva fájl", + confirmDelete: "Törli ezt a rekordot?", + keyDuplicationError: "Az értéknek egyedinek kell lennie.", + addColumn: "Oszlop hozzáadása", + addRow: "Sor hozzáadása", + removeRow: "Eltávolítás", + addPanel: "Új hozzáadása", + removePanel: "Eltávolítás", + choices_Item: "elem", + matrix_column: "Oszlop", + matrix_row: "Sor", + savingData: "Eredmény mentése a szerverre...", + savingDataError: "Egy hiba folytán nem tudtuk elmenteni az eredményt.", + savingDataSuccess: "Eredmény sikeresen mentve!", + saveAgainButton: "Próbálja újra", + timerMin: "min", + timerSec: "sec", + timerSpentAll: "Ön {0} összeget költött ezen az oldalon, és összesen {1}.", + timerSpentPage: "{0} összeget költött ezen az oldalon.", + timerSpentSurvey: "Összesen {0} költött.", + timerLimitAll: "Ön {0} / {1} összeget költött ezen az oldalon, és összesen {2} / {3}.", + timerLimitPage: "Ön {0} / {1} összeget költött ezen az oldalon.", + timerLimitSurvey: "Összesen {0} / {1} összeget költött el.", + cleanCaption: "Tiszta", + clearCaption: "Egyértelmű", + chooseFileCaption: "Válassz fájlt", + removeFileCaption: "Távolítsa el ezt a fájlt", + booleanCheckedLabel: "Igen", + booleanUncheckedLabel: "Nem", + confirmRemoveFile: "Biztosan eltávolítja ezt a fájlt: {0}?", + confirmRemoveAllFiles: "Biztosan el akarja távolítani az összes fájlt?", + questionTitlePatternText: "Kérdés címe", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["hu"] = hungarianSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["hu"] = "magyar"; + + + /***/ }), + + /***/ "./src/localization/icelandic.ts": + /*!***************************************!*\ + !*** ./src/localization/icelandic.ts ***! + \***************************************/ + /*! exports provided: icelandicSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "icelandicSurveyStrings", function() { return icelandicSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var icelandicSurveyStrings = { + pagePrevText: "Tilbaka", + pageNextText: "Áfram", + completeText: "Lokið", + previewText: "Forskoða", + editText: "Breyta", + startSurveyText: "Byrjaðu", + otherItemText: "Hinn (skýring)", + noneItemText: "Enginn", + selectAllItemText: "Velja allt", + progressText: "Síða {0} of {1}", + panelDynamicProgressText: "Taka upp {0} af {1}", + questionsProgressText: "Svarað {0} / {1} spurningum", + emptySurvey: "Það er enginn síða eða spurningar í þessari könnun.", + completingSurvey: "Takk fyrir að fyllja út þessa könnun!", + completingSurveyBefore: "Skrár okkar sýna að þú hefur þegar lokið þessari könnun.", + loadingSurvey: "Könnunin er að hlaða...", + optionsCaption: "Veldu...", + value: "gildi", + requiredError: "Vinsamlegast svarið spurningunni.", + requiredErrorInPanel: "Vinsamlegast svaraðu að minnsta kosti einni spurningu.", + requiredInAllRowsError: "Vinsamlegast svarið spurningum í öllum röðum.", + numericError: "Þetta gildi verður að vera tala.", + textMinLength: "Það ætti að vera minnst {0} tákn.", + textMaxLength: "Það ætti að vera mest {0} tákn.", + textMinMaxLength: "Það ætti að vera fleiri en {0} og færri en {1} tákn.", + minRowCountError: "Vinsamlegast fyllið úr að minnsta kosti {0} raðir.", + minSelectError: "Vinsamlegast veljið að minnsta kosti {0} möguleika.", + maxSelectError: "Vinsamlegast veljið ekki fleiri en {0} möguleika.", + numericMinMax: "'{0}' ætti að vera meira en eða jafnt og {1} minna en eða jafnt og {2}", + numericMin: "{0}' ætti að vera meira en eða jafnt og {1}", + numericMax: "'{0}' ætti að vera minna en eða jafnt og {1}", + invalidEmail: "Vinsamlegast sláið inn gilt netfang.", + invalidExpression: "Tjáningin: {0} ætti að skila 'satt'.", + urlRequestError: "Beiðninn skilaði eftirfaranadi villu '{0}'. {1}", + urlGetChoicesError: "Beiðninng skilaði engum gögnum eða slóðinn var röng", + exceedMaxSize: "Skráinn skal ekki vera stærri en {0}.", + otherRequiredError: "Vinamlegast fyllið út hitt gildið.", + uploadingFile: "Skráinn þín var send. Vinsamlegast bíðið í nokkrar sekúndur og reynið aftur.", + loadingFile: "Hleður ...", + chooseFile: "Veldu skrár ...", + noFileChosen: "Engin skrá valin", + confirmDelete: "Viltu eyða skránni?", + keyDuplicationError: "Þetta gildi ætti að vera einstakt.", + addColumn: "Bæta við dálki", + addRow: "Bæta við röð", + removeRow: "Fjarlægja", + addPanel: "Bæta við nýju", + removePanel: "Fjarlægðu", + choices_Item: "hlutur", + matrix_column: "Dálkur", + matrix_row: "Röð", + savingData: "Niðurstöðurnar eru að spara á netþjóninum ... ", + savingDataError: "Villa kom upp og við gátum ekki vistað niðurstöðurnar.", + savingDataSuccess: "Árangurinn var vistaður með góðum árangri!", + saveAgainButton: "Reyndu aftur", + timerMin: "mín", + timerSec: "sek", + timerSpentAll: "Þú hefur eytt {0} á þessari síðu og {1} samtals.", + timerSpentPage: "Þú hefur eytt {0} á þessari síðu.", + timerSpentSurvey: "Þú hefur eytt {0} samtals.", + timerLimitAll: "Þú hefur eytt {0} af {1} á þessari síðu og {2} af {3} samtals.", + timerLimitPage: "Þú hefur eytt {0} af {1} á þessari síðu.", + timerLimitSurvey: "Þú hefur eytt {0} af {1} samtals.", + cleanCaption: "Hreint", + clearCaption: "Hreinsa", + chooseFileCaption: "Veldu skrá", + removeFileCaption: "Fjarlægðu þessa skrá", + booleanCheckedLabel: "Já", + booleanUncheckedLabel: "Nei", + confirmRemoveFile: "Ertu viss um að þú viljir fjarlægja þessa skrá: {0}?", + confirmRemoveAllFiles: "Ertu viss um að þú viljir fjarlægja allar skrár?", + questionTitlePatternText: "Spurningartitill", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["is"] = icelandicSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["is"] = "íslenska"; + + + /***/ }), + + /***/ "./src/localization/indonesian.ts": + /*!****************************************!*\ + !*** ./src/localization/indonesian.ts ***! + \****************************************/ + /*! exports provided: indonesianStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "indonesianStrings", function() { return indonesianStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var indonesianStrings = { + pagePrevText: "Sebelumnya", + pageNextText: "Selanjutnya", + completeText: "Selesai", + previewText: "Pratinjau", + editText: "Sunting", + startSurveyText: "Mulai", + otherItemText: "Lainnya (jelaskan)", + noneItemText: "Tidak Ada", + selectAllItemText: "Pilih Semua", + progressText: "Halaman {0} dari {1}", + panelDynamicProgressText: "Rekam {0} dari {1}", + questionsProgressText: "Menjawab pertanyaan {0} / {1}", + emptySurvey: "Tidak ada halaman atau pertanyaan dalam survei.", + completingSurvey: "Terima kasih telah menyelesaikan survei!", + completingSurveyBefore: "Catatan kami menunjukkan bahwa Anda telah menyelesaikan survei ini.", + loadingSurvey: "Memuat survei...", + optionsCaption: "Pilih...", + value: "nilai", + requiredError: "Silahkan jawab pertanyaan berikut.", + requiredErrorInPanel: "Silahkan jawab setidaknya satu petanyaan.", + requiredInAllRowsError: "Silahkan jawab pertanyaan pada semua baris.", + numericError: "Nilai harus berupa angka.", + textMinLength: "Silahkan masukkan setidaknya {0} karakter.", + textMaxLength: "Silahkan masukkan kurang {0} karakter.", + textMinMaxLength: "PSilahkan masukkan lebih dari {0} dan kurang dari {1} karakter.", + minRowCountError: "Silahkan isi setidaknya {0} baris.", + minSelectError: "Silahkan pilih setidaknya {0} varian.", + maxSelectError: "Silahkan pilih tidak lebih dari {0} varian.", + numericMinMax: "'{0}' harus sama dengan atau lebih dari {1} dan harus sama dengan atau kurang dari {2}", + numericMin: "'{0}' harus sama dengan atau lebih dari {1}", + numericMax: "'{0}' harus sama dengan atau kurang dari {1}", + invalidEmail: "Silahkan masukkan e-mail yang benar.", + invalidExpression: "Ekspresi: {0} harus mengembalikan 'benar'.", + urlRequestError: "Permintaan mengembalikan kesalahan '{0}'. {1}", + urlGetChoicesError: "Permintaan mengembalikan data kosong atau properti 'path' salah.", + exceedMaxSize: "Ukuran berkas tidak boleh melebihi {0}.", + otherRequiredError: "Silahkan masukkan nilai lainnnya.", + uploadingFile: "Berkas Anda sedang diunggah. Silahkan tunggu beberapa saat atau coba lagi.", + loadingFile: "Memuat...", + chooseFile: "Pilih berkas...", + noFileChosen: "Tidak ada file yang dipilih", + confirmDelete: "Apakah Anda ingin menghapus catatan?", + keyDuplicationError: "Nilai harus unik.", + addColumn: "Tambah kolom", + addRow: "Tambah baris", + removeRow: "Hapus", + addPanel: "Tambah baru", + removePanel: "Hapus", + choices_Item: "item", + matrix_column: "Kolom", + matrix_row: "Baris", + savingData: "Hasil sedang disimpan pada server...", + savingDataError: "Kesalahan terjadi dan kami tidak dapat menyimpan hasil.", + savingDataSuccess: "Hasil telah sukses disimpan!", + saveAgainButton: "Coba lagi", + timerMin: "menit", + timerSec: "detik", + timerSpentAll: "Anda telah menghabiskan {0} pada halaman ini dan {1} secara keseluruhan.", + timerSpentPage: "YAnda telah menghabiskan {0} pada halaman ini.", + timerSpentSurvey: "Anda telah menghabiskan {0} secara keseluruhan.", + timerLimitAll: "Anda telah menghabiskan {0} dari {1} pada halaman ini dan {2} dari {3} secara keseluruhan.", + timerLimitPage: "Anda telah menghabiskan {0} dari {1} pada halaman ini.", + timerLimitSurvey: "Anda telah menghabiskan {0} dari {1} secara keseluruhan.", + cleanCaption: "Bersihkan", + clearCaption: "Bersihkan", + chooseFileCaption: "Pilih File", + removeFileCaption: "Hapus berkas ini", + booleanCheckedLabel: "Iya", + booleanUncheckedLabel: "Tidak", + confirmRemoveFile: "Anda yakin ingin menghapus file ini: {0}?", + confirmRemoveAllFiles: "Anda yakin ingin menghapus semua file?", + questionTitlePatternText: "Judul pertanyaan", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["id"] = indonesianStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["id"] = "bahasa Indonesia"; + + + /***/ }), + + /***/ "./src/localization/italian.ts": + /*!*************************************!*\ + !*** ./src/localization/italian.ts ***! + \*************************************/ + /*! exports provided: italianSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "italianSurveyStrings", function() { return italianSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var italianSurveyStrings = { + pagePrevText: "Precedente", + pageNextText: "Successivo", + completeText: "Salva", + previewText: "Anteprima", + editText: "Modifica", + startSurveyText: "Inizio", + otherItemText: "Altro (descrivi)", + noneItemText: "Nessuno", + selectAllItemText: "Seleziona tutti", + progressText: "Pagina {0} di {1}", + panelDynamicProgressText: "Record di {0} di {1}", + questionsProgressText: "Risposte a {0}/{1} domande", + emptySurvey: "Non ci sono pagine o domande visibili nel questionario.", + completingSurvey: "Grazie per aver completato il questionario!", + completingSurveyBefore: "I nostri records mostrano che hai già completato questo questionario.", + loadingSurvey: "Caricamento del questionario in corso...", + optionsCaption: "Scegli...", + value: "valore", + requiredError: "Campo obbligatorio", + requiredErrorInPanel: "Per Favore, rispondi ad almeno una domanda.", + requiredInAllRowsError: "Completare tutte le righe", + numericError: "Il valore deve essere numerico", + textMinLength: "Inserire almeno {0} caratteri", + textMaxLength: "Lunghezza massima consentita {0} caratteri", + textMinMaxLength: "Inserire una stringa con minimo {0} e massimo {1} caratteri", + minRowCountError: "Completare almeno {0} righe.", + minSelectError: "Selezionare almeno {0} varianti.", + maxSelectError: "Selezionare massimo {0} varianti.", + numericMinMax: "'{0}' deve essere uguale o superiore a {1} e uguale o inferiore a {2}", + numericMin: "'{0}' deve essere uguale o superiore a {1}", + numericMax: "'{0}' deve essere uguale o inferiore a {1}", + invalidEmail: "Inserire indirizzo mail valido", + invalidExpression: "L'espressione: {0} dovrebbe tornare 'vero'.", + urlRequestError: "La richiesta ha risposto con un errore '{0}'. {1}", + urlGetChoicesError: "La richiesta ha risposto null oppure il percorso non è corretto", + exceedMaxSize: "Il file non può eccedere {0}", + otherRequiredError: "Inserire il valore 'altro'", + uploadingFile: "File in caricamento. Attendi alcuni secondi e riprova", + loadingFile: "Caricamento...", + chooseFile: "Selezionare file(s)...", + fileDragAreaPlaceholder: "Trascina un file qui o fai clic sul pulsante in basso per caricare il file.", + noFileChosen: "Nessun file selezionato", + confirmDelete: "Sei sicuro di voler elminare il record?", + keyDuplicationError: "Questo valore deve essere univoco.", + addColumn: "Aggiungi colonna", + addRow: "Aggiungi riga", + removeRow: "Rimuovi riga", + addPanel: "Aggiungi riga", + removePanel: "Elimina", + choices_Item: "Elemento", + matrix_column: "Colonna", + matrix_row: "Riga", + savingData: "Salvataggio dati sul server...", + savingDataError: "Si è verificato un errore e non è stato possibile salvare i risultati.", + savingDataSuccess: "I risultati sono stati salvati con successo!", + saveAgainButton: "Riprova", + timerMin: "min", + timerSec: "sec", + timerSpentAll: "Hai impiegato {0} su questa pagina e {1} in totale.", + timerSpentPage: "Hai impiegato {0} su questa pagina.", + timerSpentSurvey: "Hai impiegato {0} in totale.", + timerLimitAll: "Hai impiegato {0} di {1} su questa pagina e {2} di {3} in totale.", + timerLimitPage: "Hai impiegato {0} di {1} su questa pagina.", + timerLimitSurvey: "Hai impiegato {0} di {1} in totale.", + cleanCaption: "Pulisci", + clearCaption: "Cancella", + chooseFileCaption: "Scegliere il file", + removeFileCaption: "Rimuovere questo file", + booleanCheckedLabel: "Sì", + booleanUncheckedLabel: "No", + confirmRemoveFile: "Sei sicuro di voler elminare questo file: {0}?", + confirmRemoveAllFiles: "Sei sicuro di voler elminare tutti i files?", + questionTitlePatternText: "Titolo della domanda", + ratingOptionsCaption: "Tocca qui per valutare...", + emptyRowsText: "Non ci sono righe.", + filteredTextPlaceholder: "Digita per cercare...", + indexText: "{0} da {1}", + minError: "Il valore non deve essere inferiore a {0}", + maxError: "Il valore non deve essere maggiore di {0}", + modalApplyButtonText: "Applicare", + modalCancelButtonText: "Annulla", + multipletext_itemname: "testo", + noEntriesText: "Non ci sono ancora voci.\nFai clic sul pulsante qui sotto per aggiungere una nuova voce.", + signaturePlaceHolder: "Firmare qui", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["it"] = italianSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["it"] = "italiano"; + + + /***/ }), + + /***/ "./src/localization/japanese.ts": + /*!**************************************!*\ + !*** ./src/localization/japanese.ts ***! + \**************************************/ + /*! exports provided: japaneseSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "japaneseSurveyStrings", function() { return japaneseSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var japaneseSurveyStrings = { + pagePrevText: "前へ", + pageNextText: "次へ", + completeText: "完了", + previewText: "プレビュー", + editText: "編集", + startSurveyText: "スタート", + otherItemText: "その他(説明)", + noneItemText: "なし", + selectAllItemText: "すべて選択", + progressText: "{0}/{1}頁", + panelDynamicProgressText: "{1}の{0}を記録する", + questionsProgressText: "{0}/{1}の質問に回答しました。", + emptySurvey: "この調査に表示できるページや質問はありません", + completingSurvey: "調査を完了してくれてありがとうございました", + completingSurveyBefore: "当社の記録によると、この調査はすでに完了しています。", + loadingSurvey: "調査をダウンロード中", + optionsCaption: "選択", + value: "値打ち", + requiredError: "質問にお答え下さい", + requiredErrorInPanel: "最低でも1つの質問に答えてください。", + requiredInAllRowsError: "質問には全列で回答してください。", + numericError: "数字でご記入下さい", + textMinLength: "{0} 文字以上で入力して下さい", + textMaxLength: "{0}文字以下で入力してください。", + textMinMaxLength: "{0}以上{1}未満の文字を入力してください。", + minRowCountError: "{0}行以上で入力して下さい", + minSelectError: "{0}種類以上を選択して下さい", + maxSelectError: "{0}以上のバリアントを選択しないでください。", + numericMinMax: "{0}は{1}以上であり、{2}以下であることが望ましい。", + numericMin: "'{0}' は同等か{1}より大きくなければなりません", + numericMax: "'{0}' は同等か{1}より小さくなければなりません", + invalidEmail: "有効なメールアドレスをご記入下さい", + invalidExpression: "式は {0}は'true'を返すべきです。", + urlRequestError: "リクエストはエラー '{0}' を返しました。{1}", + urlGetChoicesError: "リクエストが空のデータを返したか、'path' プロパティが正しくありません。", + exceedMaxSize: "ファイルのサイズは{0}を超えてはいけません", + otherRequiredError: "その他の値を入力してください。", + uploadingFile: "ファイルをアップロード中です。しばらくしてから再度お試し下さい", + loadingFile: "読み込み中", + chooseFile: "ファイルを選択", + noFileChosen: "選択されたファイルはありません", + confirmDelete: "レコードを削除しますか?", + keyDuplicationError: "この値は一意でなければなりません。", + addColumn: "列の追加", + addRow: "追加行", + removeRow: "除去", + addPanel: "新規追加", + removePanel: "除去", + choices_Item: "品目", + matrix_column: "コラム", + matrix_row: "行", + savingData: "結果はサーバーに保存されています...。", + savingDataError: "エラーが発生し、結果を保存できませんでした。", + savingDataSuccess: "結果は無事に保存されました", + saveAgainButton: "もう一度試してみてください。", + timerMin: "僅少", + timerSec: "セック", + timerSpentAll: "あなたはこのページに{0}を費やし、合計で{1}を費やしました。", + timerSpentPage: "あなたはこのページに{0}を費やしました。", + timerSpentSurvey: "合計で{0}を使ったことになります。", + timerLimitAll: "このページに{1}のうち{0}を費やし、{3}のうち{2}を合計で費やしました。", + timerLimitPage: "このページで{1}の{0}を使ったことがあります。", + timerLimitSurvey: "合計で{1}の{0}を使ったことがあります。", + cleanCaption: "削除", + clearCaption: "空白", + chooseFileCaption: "ファイルを選択", + removeFileCaption: "このファイルを削除", + booleanCheckedLabel: "噫", + booleanUncheckedLabel: "否", + confirmRemoveFile: "このファイルを削除してもよろしいですか?{0}?", + confirmRemoveAllFiles: "すべてのファイルを削除してもよろしいですか?", + questionTitlePatternText: "質問名", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ja"] = japaneseSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ja"] = "日本語"; + + + /***/ }), + + /***/ "./src/localization/kazakh.ts": + /*!************************************!*\ + !*** ./src/localization/kazakh.ts ***! + \************************************/ + /*! exports provided: kazakhStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "kazakhStrings", function() { return kazakhStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var kazakhStrings = { + pagePrevText: "Артқа", + pageNextText: "Келесі", + completeText: "Дайын", + previewText: "Алдын ала қарау", + editText: "Редакциялау", + startSurveyText: "Бастау", + otherItemText: "Басқа (өтінеміз, жазыңыз)", + noneItemText: "Жоқ", + selectAllItemText: "Барлығын таңдау", + progressText: "{0} ден {1} бет ", + panelDynamicProgressText: "{0} ден {1} жазба", + questionsProgressText: "{0}/{1} сұрақтарға жауап", + emptySurvey: "Бір де бір сұрақ жоқ.", + completingSurvey: "Сауалнаманы толтырғаныңыз үшін рахмет!", + completingSurveyBefore: "Сіз бұл сауалнаманы өтіп қойдыңыз.", + loadingSurvey: "Серверден жүктеу...", + optionsCaption: "Таңдау...", + value: "мәні", + requiredError: "Өтінеміз, сұраққа жауап беріңіз.", + requiredErrorInPanel: "Өтінеміз, кем дегенде бір сұраққа жауап беріңіз.", + requiredInAllRowsError: "Өтінеміз, әрбір жолдың сұрағаны жауап беріңіз.", + numericError: "Жауап сан түрінде болуы керек.", + textMinLength: "Өтінеміз, {0} ден көп таңба енгізіңіз.", + textMaxLength: "Өтінеміз, {0} ден аз таңба енгізіңіз.", + textMinMaxLength: "Өтінеміз, {0} аз және {1} көп таңба енгізіңіз.", + minRowCountError: "Өтінеміз, {0} ден кем емес жол толтырыңыз.", + minSelectError: "Өтінеміз, тым болмаса {0} нұсқа таңдаңыз.", + maxSelectError: "Өтінеміз, {0} нұсқадан көп таңдамаңыз.", + numericMinMax: "'{0}' {1} ден кем емес және {2} ден көп емес болу керек", + numericMin: "'{0}' {1} ден кем емес болу керек", + numericMax: "'{0}' {1} ден көп емес болу керек", + invalidEmail: "Өтінеміз, жарамды электрондық поштаңызды енгізіңіз.", + invalidExpression: "{0} өрнегі 'true' қайтару керек.", + urlRequestError: "Сұратым қателікті қайтарды'{0}'. {1}", + urlGetChoicesError: "Сұратымға жауап бос келді немесе 'path' қасиеті қате көрсетілген ", + exceedMaxSize: "Файлдың мөлшері {0} аспау керек.", + otherRequiredError: "Өтінеміз, “Басқа” жолына деректі енгізіңіз", + uploadingFile: "Сіздің файлыңыз жүктеліп жатыр. Бірнеше секунд тосып, қайтадан байқап көріңіз.", + loadingFile: "Жүктеу...", + chooseFile: "Файлдарды таңдаңыз...", + noFileChosen: "Файл таңдалынбады", + confirmDelete: "Сіз жазбаны жоятыныңызға сенімдісіз бе?", + keyDuplicationError: "Бұл мән бірегей болу керек.", + addColumn: "Бағана қосу", + addRow: "Жолды қосу", + removeRow: "Өшіру", + addPanel: "Жаңа қосу", + removePanel: "Өшіру", + choices_Item: "Нұсқа", + matrix_column: "Бағана", + matrix_row: "Жол", + savingData: "Нәтижелер серверде сақталады...", + savingDataError: "Қателік туындады, нәтиже сақталынбады.", + savingDataSuccess: "Нәтиже ойдағыдай сақталды!", + saveAgainButton: "Қайтадан байқап көру", + timerMin: "мин", + timerSec: "сек", + timerSpentAll: "Сіз бұл бетте {0} кетірдіңіз және барлығы {1}.", + timerSpentPage: "Сіз бұл бетте {0} кетірдіңіз.", + timerSpentSurvey: "Сіз сауалнама кезінде {0} кетірдіңіз.", + timerLimitAll: "Сіз бұл бетте {0} ден {1} кетірдіңіз және {2} ден {3} бүкіл сауалнама үшін.", + timerLimitPage: "Сіз бұл бетте {0} ден {1} кетірдіңіз.", + timerLimitSurvey: "Сіз бүкіл сауалнама үшін {0} ден {1} кетірдіңіз ", + cleanCaption: "Тазалау", + clearCaption: "Тазалау", + chooseFileCaption: "Файл таңдаңыз", + removeFileCaption: "Файлды жойыңыз", + booleanCheckedLabel: "Иә", + booleanUncheckedLabel: "Жоқ", + confirmRemoveFile: "Сіз бұл файлды жоятыныңызға сенімдісіз бе: {0}?", + confirmRemoveAllFiles: "Сіз барлық файлдарды жоятыныңызға сенімдісіз бе?", + questionTitlePatternText: "Сұрақтың атауы", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["kk"] = kazakhStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["kk"] = "Kazakh"; + + + /***/ }), + + /***/ "./src/localization/korean.ts": + /*!************************************!*\ + !*** ./src/localization/korean.ts ***! + \************************************/ + /*! exports provided: koreanStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "koreanStrings", function() { return koreanStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var koreanStrings = { + pagePrevText: "이전", + pageNextText: "다음", + completeText: "완료", + previewText: "시사", + editText: "편집하다", + startSurveyText: "시작", + otherItemText: "기타(설명)", + noneItemText: "없음", + selectAllItemText: "모두 선택", + progressText: "페이지 {1} 중 {0}", + panelDynamicProgressText: "{0} / {1} 기록", + questionsProgressText: "{0} / {1} 개의 질문에 답변 함", + emptySurvey: "설문지에 보여지는 페이지나 질문이 없습니다", + completingSurvey: "설문 조사를 완료해 주셔서 감사합니다!", + completingSurveyBefore: "기록에 따르면 이미 설문 조사를 마치셨습니다.", + loadingSurvey: "설문조사가 로드중입니다...", + optionsCaption: "선택하십시오...", + value: "값", + requiredError: "질문에 답하시오.", + requiredErrorInPanel: "하나 이상의 질문에 답하십시오.", + requiredInAllRowsError: "모든 행에 있는 질문에 답하십시오.", + numericError: "값은 숫자여야 합니다.", + textMinLength: "답변의 길이는 최소 {0}자여야 입니다.", + textMaxLength: "답변의 길이는 {0}자를 초과 할 수 없습니다.", + textMinMaxLength: "답변의 길이는 {0} - {1}자 사이여야 합니다.", + minRowCountError: "최소 {0}개의 행을 채우십시오", + minSelectError: "최소 {0}개의 변수를 선택하십시오.", + maxSelectError: "최대 {0}개의 변수를 선택하십시오.", + numericMinMax: "'{0}'은 {1}보다 크거나 같고 {2}보다 작거나 같아야합니다.", + numericMin: "'{0}'은 {1}보다 크거나 같아야합니다.", + numericMax: "'{0}'은 {1}보다 작거나 같아야합니다.", + invalidEmail: "올바른 이메일 주소를 입력하십시오.", + invalidExpression: "표현식: {0}은 '참'이어야 합니다.", + urlRequestError: "'{0}'으로 잘못된 요청입니다. {1}", + urlGetChoicesError: "비어있는 데이터를 요청했거나 잘못된 속성의 경로입니다.", + exceedMaxSize: "파일 크기가 {0}을 초과 할 수 없습니다.", + otherRequiredError: "다른 질문을 작성하십시오.", + uploadingFile: "파일 업로드 중입니다. 잠시 후 다시 시도하십시오.", + loadingFile: "로드 중...", + chooseFile: "파일 선택...", + noFileChosen: "선택된 파일이 없습니다", + confirmDelete: "기록을 삭제하시겠습니까?", + keyDuplicationError: " 이 값은 고유해야합니다.", + addColumn: "열 추가", + addRow: "행 추가", + removeRow: "제거", + addPanel: "새롭게 추가", + removePanel: "제거", + choices_Item: "항목", + matrix_column: "열", + matrix_row: "행", + savingData: "결과가 서버에 저장 중입니다...", + savingDataError: "오류가 발생하여 결과를 저장할 수 없습니다.", + savingDataSuccess: "결과가 성공적으로 저장되었습니다!", + saveAgainButton: "다시 시도하십시오", + timerMin: "분", + timerSec: "초", + timerSpentAll: "현재 페이지에서 {0}을 소요해 총 {1}이 걸렸습니다.", + timerSpentPage: "현재 페이지에서 {0]이 걸렸습니다", + timerSpentSurvey: "총 {0}이 걸렸습니다.", + timerLimitAll: "현재 페이지에서 {0}/{1}을 소요해 총 {2}/{3}이 걸렸습니다.", + timerLimitPage: "현재 페이지에서 {0}/{1}이 걸렸습니다.", + timerLimitSurvey: "총 {0}/{1}이 걸렸습니다.", + cleanCaption: "닦기", + clearCaption: "지우기", + chooseFileCaption: "파일을 선택", + removeFileCaption: "이 파일 제거", + booleanCheckedLabel: "예", + booleanUncheckedLabel: "아니", + confirmRemoveFile: "{0} 파일을 제거 하시겠습니까?", + confirmRemoveAllFiles: "모든 파일을 제거 하시겠습니까?", + questionTitlePatternText: "질문 제목", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ko"] = koreanStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ko"] = "한국어"; + + + /***/ }), + + /***/ "./src/localization/latvian.ts": + /*!*************************************!*\ + !*** ./src/localization/latvian.ts ***! + \*************************************/ + /*! exports provided: latvianSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "latvianSurveyStrings", function() { return latvianSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var latvianSurveyStrings = { + pagePrevText: "Atpakaļ", + pageNextText: "Tālāk", + completeText: "Pabeigt", + previewText: "Priekšskatījums", + editText: "Rediģēt", + startSurveyText: "Sākt", + otherItemText: "Cits (lūdzu, aprakstiet!)", + noneItemText: "Nav", + selectAllItemText: "Izvēlēties visus", + progressText: "{0}. lapa no {1}", + panelDynamicProgressText: "Ierakstīt {0} no {1}", + questionsProgressText: "Atbildēts uz {0} / {1} jautājumiem", + emptySurvey: "Nav neviena jautājuma.", + completingSurvey: "Pateicamies Jums par anketas aizpildīšanu!", + completingSurveyBefore: "Mūsu ieraksti liecina, ka Jūs jau esat aizpildījis šo aptauju.", + loadingSurvey: "Ielāde no servera...", + optionsCaption: "Izvēlēties...", + value: "value", + requiredError: "Lūdzu, atbildiet uz jautājumu!", + requiredErrorInPanel: "Lūdzu, atbildiet uz vismaz vienu jautājumu.", + requiredInAllRowsError: "Lūdzu, atbildiet uz jautājumiem visās rindās.", + numericError: "Atbildei ir jābūt skaitlim.", + textMinLength: "Lūdzu, ievadiet vismaz {0} simbolus.", + textMaxLength: "Lūdzu, ievadiet mazāk nekā {0} rakstzīmes.", + textMinMaxLength: "Lūdzu, ievadiet vairāk nekā {0} rakstzīmes un mazāk nekā {1} rakstzīmes.", + minRowCountError: "Lūdzu, aizpildiet vismaz {0} rindas.", + minSelectError: "Lūdzu, izvēlieties vismaz {0} variantu.", + maxSelectError: "Lūdzu, izvēlieties ne vairak par {0} variantiem.", + numericMinMax: "'{0}' jābūt vienādam vai lielākam nekā {1}, un vienādam vai mazākam, nekā {2}", + numericMin: "'{0}' jābūt vienādam vai lielākam {1}", + numericMax: "'{0}' jābūt vienādam vai lielākam {1}", + invalidEmail: "Lūdzu, ievadiet pareizu e-pasta adresi!", + invalidExpression: "Izteicienam: {0} jāatgriež “true”.", + urlRequestError: "Pieprasījumā tika atgriezta kļūda “{0}”. {1}", + urlGetChoicesError: "Pieprasījums atgrieza tukšus datus vai rekvizīts “path” ir nepareizs", + exceedMaxSize: "Faila lielums nedrīkst pārsniegt {0}.", + otherRequiredError: "Lūdzu, ievadiet datus laukā 'Cits'", + uploadingFile: "Jūsu fails tiek augšupielādēts. Lūdzu, uzgaidiet dažas sekundes un mēģiniet vēlreiz.", + loadingFile: "Notiek ielāde ...", + chooseFile: "Izvēlieties failus ...", + fileDragAreaPlaceholder: "Lai pievienotu, ievelciet failu šeit vai arī klikšķiniet uz zemāk redzamās pogas", + noFileChosen: "Nav izvēlēts neviens fails", + confirmDelete: "Vai vēlaties izdzēst ierakstu?", + keyDuplicationError: "Šai vērtībai jābūt unikālai.", + addColumn: "Pievienot kolonnu", + addRow: "Pievienot rindu", + removeRow: "Noņemt", + addPanel: "Pievieno jaunu", + removePanel: "Noņemt", + choices_Item: "vienums", + matrix_column: "Sleja", + matrix_row: "Rinda", + savingData: "Rezultāti tiek saglabāti serverī ...", + savingDataError: "Radās kļūda, un mēs nevarējām saglabāt rezultātus.", + savingDataSuccess: "Rezultāti tika veiksmīgi saglabāti!", + saveAgainButton: "Mēģiniet vēlreiz", + timerMin: "min", + timerSec: "sek", + timerSpentAll: "Šajā lapā esat iztērējis {0} un kopā {1}.", + timerSpentPage: "Šajā lapā esat iztērējis {0}.", + timerSpentSurvey: "Kopā esat iztērējis {0}.", + timerLimitAll: "Šajā lapā esat iztērējis {0} no {1} un kopā {2} no {3}.", + timerLimitPage: "Šajā lapā esat iztērējis {0} no {1}.", + timerLimitSurvey: "Kopā esat iztērējis {0} no {1}.", + cleanCaption: "Notīrīt", + clearCaption: "Iztīrīt", + chooseFileCaption: "Izvēlēties failu", + removeFileCaption: "Noņemiet šo failu", + booleanCheckedLabel: "Jā", + booleanUncheckedLabel: "Nē", + confirmRemoveFile: "Vai tiešām vēlaties noņemt šo failu: {0}?", + confirmRemoveAllFiles: "Vai tiešām vēlaties noņemt visus failus?", + questionTitlePatternText: "Jautājuma nosaukums", + ratingOptionsCaption: "Nospiediet šeit, lai novērtētu...", + emptyRowsText: "Nav rindu.", + filteredTextPlaceholder: "Ierakstiet, lai meklētu...", + indexText: "{0} no {1}", + minError: "Vērtība nedrīkst būt mazāka par {0}", + maxError: "Vērtība nedrīkst būt lielāka par {0}", + modalApplyButtonText: "Pielietot", + modalCancelButtonText: "Atcelt", + multipletext_itemname: "teksts", + noEntriesText: "Vēl nav neviena ieraksta.\nNoklikšķiniet uz zemāk esošās pogas, lai pievienotu jaunu ierakstu.", + signaturePlaceHolder: "Parakstieties šeit", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["lv"] = latvianSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["lv"] = "latviešu"; + + + /***/ }), + + /***/ "./src/localization/lithuanian.ts": + /*!****************************************!*\ + !*** ./src/localization/lithuanian.ts ***! + \****************************************/ + /*! exports provided: lithuaniaSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lithuaniaSurveyStrings", function() { return lithuaniaSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var lithuaniaSurveyStrings = { + pagePrevText: "Atgal", + pageNextText: "Toliau", + completeText: "Baigti", + previewText: "Peržiūra", + editText: "Redaguoti", + startSurveyText: "Pradėti", + otherItemText: "Kita (įvesti)", + noneItemText: "Nėra", + selectAllItemText: "Pasirinkti visus", + progressText: "Puslapis {0} iš {1}", + panelDynamicProgressText: "Įrašyti {0} iš {1}", + questionsProgressText: "Atsakė į {0} / {1} klausimus", + emptySurvey: "Apklausoje nėra matomo puslapio ar klausimo.", + completingSurvey: "Dėkojame už dalyvavimą apklausoje!", + completingSurveyBefore: "Mūsų įrašai rodo, kad jau atlikote šią apklausą.", + loadingSurvey: "Prašome palaukti...", + optionsCaption: "Pasirinkti...", + value: "reikšmė", + requiredError: "Būtina atsakyti į šį klausimą.", + requiredErrorInPanel: "Būtina atsakyti bent į vieną klausimą.", + requiredInAllRowsError: "Prašome atsakyti į klausimus visose eilutėse.", + numericError: "Turi būti skaičiai.", + textMinLength: "Prašome suvesti bent {0} simbolius.", + textMaxLength: "Prašome suvesti mažiau nei {0} simbolių.", + textMinMaxLength: "Prašome suvesti daugiau nei {0} ir mažiau nei {1} simbolių.", + minRowCountError: "Prašome suvesti ne mažiau nei {0} eilučių.", + minSelectError: "Prašome pasirinkti bent {0} variantų.", + maxSelectError: "Pasirinkite ne daugiau kaip {0} variantus.", + numericMinMax: "'{0}' turi būti lygus arba didesnis nei {1} ir lygus arba mažesnis nei {2}", + numericMin: "'{0}' turėtų būti lygus arba didesnis nei {1}", + numericMax: "'{0}' turėtų būti lygus ar mažesnis už {1}", + invalidEmail: "Prašome įvesti galiojantį elektroninio pašto adresą.", + invalidExpression: "Reikšmė: {0} turi grąžinti 'true'.", + urlRequestError: "Užklausa grąžino klaidą'{0}'. {1}", + urlGetChoicesError: "Užklausa grąžino tuščius duomenis arba 'path' savybė yra neteisinga", + exceedMaxSize: "Failo dydis neturi viršyti {0}.", + otherRequiredError: "Įveskite kitą reikšmę.", + uploadingFile: "Jūsų failas yra keliamas. Palaukite keletą sekundžių ir bandykite dar kartą.", + loadingFile: "Prašome palaukti...", + chooseFile: "Pasirinkti failą(us)...", + noFileChosen: "Nepasirinktas joks failas", + confirmDelete: "Ar norite ištrinti įrašą?", + keyDuplicationError: "Ši reikšmė turėtų būti unikali.", + addColumn: "Pridėti stulpelį", + addRow: "Pridėti eilutę", + removeRow: "Ištrinti", + addPanel: "Pridėti naują", + removePanel: "Ištrinti", + choices_Item: "elementas", + matrix_column: "Stulpelis", + matrix_row: "Eilutė", + savingData: "Rezultatai saugomi serveryje...", + savingDataError: "Įvyko klaida ir mes negalėjome išsaugoti rezultatų.", + savingDataSuccess: "Rezultatai buvo išsaugoti sėkmingai!", + saveAgainButton: "Bandyti dar kartą", + timerMin: "min", + timerSec: "sek", + timerSpentAll: "Praleidote {0} šiame puslapyje ir {1} iš viso.", + timerSpentPage: "Praleidote {0} šiame puslapyje.", + timerSpentSurvey: "Praleidote {0} iš viso.", + timerLimitAll: "Praleidote {0} iš {1} šiame puslapyje ir {2} iš {3} iš viso.", + timerLimitPage: "Praleidote {0} iš {1} šiame puslapyje.", + timerLimitSurvey: "Praleidote {0} iš {1} iš viso.", + cleanCaption: "Išvalyti", + clearCaption: "Valyti", + chooseFileCaption: "Pasirinkti failą", + removeFileCaption: "Ištrinti šį failą", + booleanCheckedLabel: "Taip", + booleanUncheckedLabel: "Ne", + confirmRemoveFile: "Ar tikrai norite pašalinti šį failą: {0}?", + confirmRemoveAllFiles: "Ar tikrai norite pašalinti visus failus?", + questionTitlePatternText: "Klausimo pavadinimas", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["lt"] = lithuaniaSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["lt"] = "lietuvių"; + + + /***/ }), + + /***/ "./src/localization/macedonian.ts": + /*!****************************************!*\ + !*** ./src/localization/macedonian.ts ***! + \****************************************/ + /*! exports provided: macedonianSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "macedonianSurveyStrings", function() { return macedonianSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var macedonianSurveyStrings = { + pagePrevText: "Претходна", + pageNextText: "Следно", + completeText: "Заврши", + previewText: "Преглед", + editText: "Уредување", + startSurveyText: "Започнете", + otherItemText: "Друго (опиши)", + noneItemText: "Ништо", + selectAllItemText: "Селектирај се", + progressText: "Страница {0} од {1}", + panelDynamicProgressText: "Сними {0} од {1}", + questionsProgressText: "Одговорени на {0} / {1} прашања", + emptySurvey: "Нема видлива страница или прашање во истражувањето.", + completingSurvey: "Ви благодариме што го завршивте истражувањето!", + completingSurveyBefore: "Нашите записи покажуваат дека веќе сте го завршиле ова истражување.", + loadingSurvey: "Анкетата се вчитува ...", + optionsCaption: "Изберете ...", + value: "вредност", + requiredError: "Ве молам, одговорете на прашањето.", + requiredErrorInPanel: "Ве молам, одговорете барем на едно прашање.", + requiredInAllRowsError: "Ве молиме, одговорете на прашања во сите редови.", + numericError: "Вредноста треба да биде нумеричка.", + minError: "Вредноста не треба да биде помала од {0}", + maxError: "Вредноста не треба да биде поголема од {0}", + textMinLength: "Внесете најмалку {0} знак/ци.", + textMaxLength: "Внесете не повеќе од {0} знак/ци.", + textMinMaxLength: "Внесете најмалку {0} и не повеќе од {1} знаци.", + minRowCountError: "Пополнете најмалку {0} ред(ови).", + minSelectError: "Ве молиме изберете најмалку {0} варијанта(и).", + maxSelectError: "Изберете не повеќе од {0} варијанта(и).", + numericMinMax: "'{0}' треба да биде најмалку {1} и најмногу {2}", + numericMin: "'{0}' треба да биде најмалку {1}", + numericMax: "'{0}' треба да биде најмногу {1}", + invalidEmail: "Ве молиме внесете валидна е-маил адреса.", + invalidExpression: "Изразот: {0} треба да се врати 'true'.", + urlRequestError: "Барањето врати грешка '{0}'. {1} ", + urlGetChoicesError: "Барањето врати празни податоци или својството 'path' е неточно", + exceedMaxSize: "Големината на датотеката не треба да надминува {0}.", + otherRequiredError: "Внесете ја другата вредност.", + uploadingFile: "Вашата датотека се поставува. Ве молиме почекајте неколку секунди и обидете се повторно.", + loadingFile: "Се вчитува ...", + chooseFile: "Изберете датотека (и) ...", + fileDragAreaPlaceholder: "Пуштете датотека овде или кликнете на копчето подолу за да ја вчитате датотеката.", + noFileChosen: "Не се избрани датотеки", + confirmDelete: "Дали сакате да го избришете записот?", + keyDuplicationError: "Оваа вредност треба да биде единствена.", + addColumn: "Додај колона", + addRow: "Додади ред", + removeRow: "Отстрани", + emptyRowsText: "Нема редови.", + addPanel: "Додади ново", + removePanel: "Отстрани", + choices_Item: "ставка", + matrix_column: "Колона", + matrix_row: "Ред", + savingData: "Резултатите се зачувуваат на серверот ...", + savingDataError: "Настана грешка и не можевме да ги зачуваме резултатите.", + savingDataSuccess: "Резултатите беа успешно зачувани!", + saveAgainButton: "Обиди се повторно", + timerMin: "мин", + timerSec: "сек", + timerSpentAll: "Поминавте {0} на оваа страница и вкупно {1}.", + timerSpentPage: "Поминавте {0} на оваа страница.", + timerSpentSurvey: "Вие потрошивте вкупно {0}.", + timerLimitAll: "Поминавте {0} од {1} на оваа страница и {2} од {3} вкупно.", + timerLimitPage: "Поминавте {0} од {1} на оваа страница.", + timerLimitSurvey: "Вие потрошивте вкупно {0} од {1}.", + cleanCaption: "Чисти", + clearCaption: "Да расчисти", + chooseFileCaption: "Изберете датотека", + removeFileCaption: "Отстранете ја оваа датотека", + booleanCheckedLabel: "Да", + booleanUncheckedLabel: "Не", + confirmRemoveFile: "Дали сте сигурни дека сакате да ја отстраните оваа датотека: {0}?", + confirmRemoveAllFiles: "Дали сте сигурни дека сакате да ги отстраните сите датотеки?", + questionTitlePatternText: "Наслов на прашањето", + modalCancelButtonText: "Откажи", + modalApplyButtonText: "Аплицирај", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["mk"] = macedonianSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["mk"] = "Македонски"; + + + /***/ }), + + /***/ "./src/localization/malay.ts": + /*!***********************************!*\ + !*** ./src/localization/malay.ts ***! + \***********************************/ + /*! exports provided: malaySurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "malaySurveyStrings", function() { return malaySurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var malaySurveyStrings = { + pagePrevText: "Sebelumnya", + pageNextText: "Seterusnya", + completeText: "Selesai", + previewText: "Pratonton", + editText: "Edit", + startSurveyText: "Mula", + otherItemText: "Lain (terangkan)", + noneItemText: "Tiada", + selectAllItemText: "Pilih Semua", + progressText: "Halaman {0} daripada {1}", + panelDynamicProgressText: "Rekod {0} daripada {1}", + questionsProgressText: "{0}/{1} soalan telah dijawab", + emptySurvey: "Tiada halaman atau soalan boleh dilihat dalam tinjauan.", + completingSurvey: "Terima kasih kerana melengkapkan tinjauan!", + completingSurveyBefore: "Rekod kami menunjukkan yang anda telah melengkapkan tinjauan ini.", + loadingSurvey: "Memuatkan Tinjauan...", + optionsCaption: "Pilih...", + value: "nilai", + requiredError: "Respons diperlukan.", + requiredErrorInPanel: "Respons diperlukan: jawab sekurang-kurangnya satu soalan.", + requiredInAllRowsError: "Respons diperlukan: jawab soalan dalam semua baris.", + numericError: "Nilai mestilah numerik.", + minError: "Nilai tidak boleh kurang daripada {0}", + maxError: "Nilai tidak boleh lebih besar daripada {0}", + textMinLength: "Sila masukkan sekurang-kurangnya {0} aksara.", + textMaxLength: "Sila masukkan tidak lebih daripada {0} aksara.", + textMinMaxLength: "Sila masukkan sekurang-kurangnya {0} dan tidak lebih daripada {1} aksara.", + minRowCountError: "Sila isikan sekurang-kurangnya {0} baris.", + minSelectError: "Sila pilih sekurang-kurangnya {0} varian.", + maxSelectError: "Sila pilih tidak lebih daripada {0} varian.", + numericMinMax: "'{0}' mestilah sekurang-kurangnya {1} dan paling banyak {2}", + numericMin: "'{0}' mestilah sekurang-kurangnya {1}", + numericMax: "'{0}' mestilah paling banyak {1}", + invalidEmail: "Sila masukkan alamat e-mel yang sah.", + invalidExpression: "Ekspresi: {0} hendaklah mengembalikan nilai 'benar'.", + urlRequestError: "Permintaan mengembalikan ralat '{0}'. {1}", + urlGetChoicesError: "Permintaan mengembalikan data kosong atau ciri 'laluan' salah", + exceedMaxSize: "Saiz fail hendaklah tidak melebihi {0}.", + otherRequiredError: "Respons diperlukan: masukkan nilai lain.", + uploadingFile: "Fail anda sedang dimuat naik. Sila tunggu beberapa saat dan cuba lagi.", + loadingFile: "Memuat...", + chooseFile: "Pilih fail...", + noFileChosen: "Tiada fail dipilih", + fileDragAreaPlaceholder: "Letakkan fail di sini atau klik butang di bawah untuk memuatkan fail.", + confirmDelete: "Adakah anda ingin memadamkan rekod?", + keyDuplicationError: "Nilai ini hendaklah unik.", + addColumn: "Tambahkan lajur", + addRow: "Tambahkan baris", + removeRow: "Alih keluar", + emptyRowsText: "Tiada baris.", + addPanel: "Tambah baharu", + removePanel: "Alih keluar", + choices_Item: "item", + matrix_column: "Lajur", + matrix_row: "Baris", + multipletext_itemname: "teks", + savingData: "Keputusan sedang disimpan pada pelayan...", + savingDataError: "Ralat berlaku dan kami tidak dapat menyimpan keputusan.", + savingDataSuccess: "Keputusan berjaya disimpan!", + saveAgainButton: "Cuba lagi", + timerMin: "min", + timerSec: "saat", + timerSpentAll: "Anda telah meluangkan {0} pada halaman ini dan {1} secara keseluruhan.", + timerSpentPage: "Anda telah meluangkan {0} pada halaman ini.", + timerSpentSurvey: "Anda telah meluangkan {0} secara keseluruhan.", + timerLimitAll: "Anda telah meluangkan {0} daripada {1} pada halaman ini dan {2} daripada {3} secara keseluruhan.", + timerLimitPage: "Anda telah meluangkan {0} daripada {1} pada halaman ini.", + timerLimitSurvey: "Anda telah meluangkan {0} daripada {1} secara keseluruhan.", + cleanCaption: "Kosongkan", + clearCaption: "Kosongkan", + signaturePlaceHolder: "Tandatangan di sini", + chooseFileCaption: "Pilih fail", + removeFileCaption: "Alih keluar fail ini", + booleanCheckedLabel: "Ya", + booleanUncheckedLabel: "Tidak", + confirmRemoveFile: "Anda pasti ingin mengalih keluar fail ini: {0}?", + confirmRemoveAllFiles: "Anda pasti ingin mengalih keluar semua fail?", + questionTitlePatternText: "Tajuk Soalan", + modalCancelButtonText: "Batal", + modalApplyButtonText: "Guna", + filteredTextPlaceholder: "Taip untuk membuat carian...", + noEntriesText: "Belum ada entri.\nKlik butang di bawah untuk menambahkan entri." + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ms"] = malaySurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ms"] = "melayu"; + + + /***/ }), + + /***/ "./src/localization/nl-BE.ts": + /*!***********************************!*\ + !*** ./src/localization/nl-BE.ts ***! + \***********************************/ + /*! no exports provided */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + /* harmony import */ var _dutch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dutch */ "./src/localization/dutch.ts"); + + + /** + * This is initialized as a copy of the Dutch strings, when they start to deviate a choice has to be made: + * - Copy the Dutch set once and move forward as if it are 2 totally different languages + * - Override the relevant strings only + */ + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["nl-BE"] = _dutch__WEBPACK_IMPORTED_MODULE_1__["dutchSurveyStrings"]; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["nl-BE"] = "vlaams"; + + + /***/ }), + + /***/ "./src/localization/norwegian.ts": + /*!***************************************!*\ + !*** ./src/localization/norwegian.ts ***! + \***************************************/ + /*! exports provided: norwegianSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "norwegianSurveyStrings", function() { return norwegianSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var norwegianSurveyStrings = { + pagePrevText: "Forrige", + pageNextText: "Neste", + completeText: "Fullfør", + previewText: "Forhåndsvisning", + editText: "Redigere", + startSurveyText: "Start", + otherItemText: "Annet (beskriv)", + noneItemText: "Ingen", + selectAllItemText: "Velg alle", + progressText: "Side {0} av {1}", + panelDynamicProgressText: "Ta opp {0} av {1}", + questionsProgressText: "Besvarte {0} / {1} spørsmål", + emptySurvey: "Det er ingen synlig side eller spørsmål i undersøkelsen.", + completingSurvey: "Takk for at du fullførte undersøkelsen!", + completingSurveyBefore: "Våre data viser at du allerede har gjennomført denne undersøkelsen.", + loadingSurvey: "Undersøkelsen laster...", + optionsCaption: "Velg...", + value: "verdi", + requiredError: "Vennligst svar på spørsmålet.", + requiredErrorInPanel: "Vennligst svar på minst ett spørsmål.", + requiredInAllRowsError: "Vennligst svar på spørsmål i alle rader.", + numericError: "Verdien skal være numerisk.", + textMinLength: "Vennligst skriv inn minst {0} tegn.", + textMaxLength: "Vennligst skriv inn mindre enn {0} tegn.", + textMinMaxLength: "Vennligst skriv inn mer enn {0} og mindre enn {1} tegn.", + minRowCountError: "Vennligst fyll inn minst {0} rader.", + minSelectError: "Vennligst velg minst {0} varianter.", + maxSelectError: "Vennligst ikke velg mer enn {0} varianter.", + numericMinMax: "'{0}' bør være lik eller mer enn {1} og lik eller mindre enn {2}", + numericMin: "'{0}' bør være lik eller mer enn {1}", + numericMax: "'{0}' bør være lik eller mindre enn {1}", + invalidEmail: "Vennligst skriv inn en gyldig e-post adresse.", + invalidExpression: "Uttrykket: {0} skal returnere 'sant'.", + urlRequestError: "Forespørselen returnerte feilen '{0}'. {1}", + urlGetChoicesError: "Forespørselen returnerte tomme data, eller 'sti' -egenskapen er feil", + exceedMaxSize: "Filstørrelsen bør ikke overstige {0}.", + otherRequiredError: "Vennligst skriv inn den andre verdien.", + uploadingFile: "Filen din lastes opp. Vennligst vent noen sekunder og prøv igjen.", + loadingFile: "Laster inn ...", + chooseFile: "Velg fil (er) ...", + noFileChosen: "Ingen fil valgt", + confirmDelete: "Ønsker du å slette posten?", + keyDuplicationError: "Denne verdien skal være unik.", + addColumn: "Legg til kolonne", + addRow: "Legg til rad", + removeRow: "Fjern", + addPanel: "Legg til ny", + removePanel: "Fjerne", + choices_Item: "element", + matrix_column: "Kolonne", + matrix_row: "Rad", + savingData: "Resultatene lagres på serveren ...", + savingDataError: "Det oppsto en feil, og vi kunne ikke lagre resultatene.", + savingDataSuccess: "Resultatene ble lagret!", + saveAgainButton: "Prøv igjen", + timerMin: "min", + timerSec: "sek", + timerSpentAll: "Du har tilbrakt {0} på denne siden og {1} totalt.", + timerSpentPage: "Du har tilbrakt {0} på denne siden.", + timerSpentSurvey: "Du har tilbrakt {0} totalt.", + timerLimitAll: "Du har tilbrakt {0} av {1} på denne siden og totalt {2} av {3}.", + timerLimitPage: "Du har tilbrakt {0} av {1} på denne siden.", + timerLimitSurvey: "Du har tilbrakt {0} av {1} totalt.", + cleanCaption: "Rens", + clearCaption: "Klar", + chooseFileCaption: "Velg Fil", + removeFileCaption: "Fjern denne filen", + booleanCheckedLabel: "Ja", + booleanUncheckedLabel: "Nei", + confirmRemoveFile: "Er du sikker på at du vil fjerne denne filen: {0}?", + confirmRemoveAllFiles: "Er du sikker på at du vil fjerne alle filene?", + questionTitlePatternText: "Spørsmålstittel", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["no"] = norwegianSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["no"] = "norsk"; + + + /***/ }), + + /***/ "./src/localization/persian.ts": + /*!*************************************!*\ + !*** ./src/localization/persian.ts ***! + \*************************************/ + /*! exports provided: persianSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "persianSurveyStrings", function() { return persianSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var persianSurveyStrings = { + pagePrevText: "قبلی", + pageNextText: "بعدی", + completeText: "تکمیل", + previewText: "پیش نمایش", + editText: "ویرایش", + startSurveyText: "شروع", + otherItemText: "دیگر(توضیح)", + noneItemText: "هیچ", + selectAllItemText: "انتخاب همه", + progressText: "صفحه {0} از {1}", + panelDynamicProgressText: "مورد {0} از {1}", + questionsProgressText: "تعداد پاسخ {0}/{1} سوال", + emptySurvey: "صفحه ای یا گزینه ای برای این پرسشنامه موجود نیست.", + completingSurvey: "از شما بابت تکمیل این پرسشنامه متشکریم", + completingSurveyBefore: "به نظر می رسد هم هم اکنون پرسشنامه را تکمیل کرده اید.", + loadingSurvey: "درحال ایجاد پرسشنامه", + optionsCaption: "انتخاب کنید...", + value: "مقدار", + requiredError: "لطفا به سوال پاسخ دهید", + requiredErrorInPanel: "لطفا حداقل به یک سوال پاسخ دهید.", + requiredInAllRowsError: "لطفا سوالات تمام سطرها را پاسخ دهید.", + numericError: "مقدار باید عددی باشد", + textMinLength: "لطفا حداقل {0} حرف وارد کنید", + textMaxLength: "لطفا کمتر از {0} حرف وارد کنید.", + textMinMaxLength: "لطفا بیشتر از {0} حرف و کمتر از {1} حرف وارد کنید.", + minRowCountError: "لطفا حداقل {0} سطر وارد کنید.", + minSelectError: "حداقل {0} انتخاب کنید.", + maxSelectError: "لطفا بیشتر از {0} انتخاب کنید.", + numericMinMax: "'{0}' باید بین {1} و {2} باشد", + numericMin: "'{0}' بزرگتر مساوی {1} باشد", + numericMax: "'{0}' باید کوچکتر یا مساوی {1} باشد", + invalidEmail: "لطفا ایمیل صحیح درج کنید", + invalidExpression: "عبارت: {0} پاسخ باید 'true' باشد.", + urlRequestError: "درخواست با خطا روبرو شد: '{0}'. {1}", + urlGetChoicesError: "درخواست مسیری خالی بازگشت داده یا مسیر درست تنظیم نشده", + exceedMaxSize: "بیشترین حجم مجاز فایل: {0}", + otherRequiredError: "مقدار 'دیگر' را وارد کنید", + uploadingFile: "فایل در حال آیلود است. لطفا صبر کنید.", + loadingFile: "بارگیری...", + chooseFile: "انتخاب فایل(ها)...", + noFileChosen: "هیچ فایلی انتخاب نشده", + confirmDelete: "آیا مایل به حذف این ردیف هستید؟", + keyDuplicationError: "این مقدار باید غیر تکراری باشد", + addColumn: "ستون جدید", + addRow: "سطر جدید", + removeRow: "حذف", + addPanel: "جدید", + removePanel: "حذف", + choices_Item: "آیتم", + matrix_column: "ستون", + matrix_row: "سطر", + savingData: "نتایج در حال ذخیره سازی در سرور است", + savingDataError: "خطایی در ذخیره سازی نتایج رخ داده است", + savingDataSuccess: "نتایج با موفقیت ذخیره شد", + saveAgainButton: "مجدد تلاش کنید", + timerMin: "دقیقه", + timerSec: "ثانیه", + timerSpentAll: "شما مدت {0} در این صفحه و مدت {1} را در مجموع سپری کرده اید.", + timerSpentPage: "شما مدت {0} را در این صفحه سپری کرده اید.", + timerSpentSurvey: "شما مدت {0} را در مجموع سپری کرده اید.", + timerLimitAll: "شما مدت {0} از {1} در این صفحه و مدت {2} از {3} را در مجموع سپری کرده اید.", + timerLimitPage: "شما مدت {0} از {1} را در این صفحه سپری کرده اید.", + timerLimitSurvey: "شما مدت {0} از {1} را در مجموع سپری کرده اید.", + cleanCaption: "پاکسازی", + clearCaption: "خالی کردن", + chooseFileCaption: "انتخاب فایل", + removeFileCaption: "حذف این فایل", + booleanCheckedLabel: "بله", + booleanUncheckedLabel: "خیر", + confirmRemoveFile: "آیا میخواهید این فایل را پاک کنید: {0}?", + confirmRemoveAllFiles: "آیا میخواهید تمام فایل ها را پاک کنید?", + questionTitlePatternText: "عنوان سوال", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["fa"] = persianSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["fa"] = "فارْسِى"; + + + /***/ }), + + /***/ "./src/localization/polish.ts": + /*!************************************!*\ + !*** ./src/localization/polish.ts ***! + \************************************/ + /*! exports provided: polishSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "polishSurveyStrings", function() { return polishSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var polishSurveyStrings = { + pagePrevText: "Wstecz", + pageNextText: "Dalej", + completeText: "Gotowe", + previewText: "Premiera", + editText: "Edycja", + startSurveyText: "Start", + otherItemText: "Inna odpowiedź (wpisz)", + noneItemText: "Brak", + selectAllItemText: "Wybierz wszystkie", + progressText: "Strona {0} z {1}", + panelDynamicProgressText: "Zapis {0} z {1}", + questionsProgressText: "Odpowiedzi na {0}/{1} pytania", + emptySurvey: "Nie ma widocznych pytań.", + completingSurvey: "Dziękujemy za wypełnienie ankiety!", + completingSurveyBefore: "Z naszych zapisów wynika, że wypełniłeś już tę ankietę.", + loadingSurvey: "Trwa wczytywanie ankiety...", + optionsCaption: "Wybierz...", + value: "Wartość", + requiredError: "Proszę odpowiedzieć na to pytanie.", + requiredErrorInPanel: "Proszę odpowiedzieć na co najmniej jedno pytanie.", + requiredInAllRowsError: "Proszę odpowiedzieć na wszystkie pytania.", + numericError: "W tym polu można wpisać tylko liczby.", + textMinLength: "Proszę wpisać co najmniej {0} znaków.", + textMaxLength: "Proszę wpisać mniej niż {0} znaków.", + textMinMaxLength: "Proszę wpisać więcej niż {0} i mniej niż {1} znaków.", + minRowCountError: "Proszę uzupełnić przynajmniej {0} wierszy.", + minSelectError: "Proszę wybrać co najmniej {0} pozycji.", + maxSelectError: "Proszę wybrać nie więcej niż {0} pozycji.", + numericMinMax: "Odpowiedź '{0}' powinna być większa lub równa {1} oraz mniejsza lub równa {2}", + numericMin: "Odpowiedź '{0}' powinna być większa lub równa {1}", + numericMax: "Odpowiedź '{0}' powinna być mniejsza lub równa {1}", + invalidEmail: "Proszę podać prawidłowy adres email.", + invalidExpression: "Wyrażenie: {0} powinno wracać 'prawdziwe'.", + urlRequestError: "Żądanie zwróciło błąd '{0}'. {1}", + urlGetChoicesError: "Żądanie nie zwróciło danych albo ścieżka jest nieprawidłowa", + exceedMaxSize: "Rozmiar przesłanego pliku nie może przekraczać {0}.", + otherRequiredError: "Proszę podać inną odpowiedź.", + uploadingFile: "Trwa przenoszenie Twojego pliku, proszę spróbować ponownie za kilka sekund.", + loadingFile: "Ładowanie...", + chooseFile: "Wybierz plik(i)...", + fileDragAreaPlaceholder: "Upuść plik tutaj lub kliknij przycisk poniżej, aby załadować plik.", + noFileChosen: "Nie wybrano żadnego pliku", + confirmDelete: "Chcesz skasować nagranie?", + keyDuplicationError: "Ta wartość powinna być wyjątkowa.", + addColumn: "Dodaj kolumnę", + addRow: "Dodaj wiersz", + removeRow: "Usuń", + addPanel: "Dodaj panel", + removePanel: "Usuń", + choices_Item: "element", + matrix_column: "Kolumna", + matrix_row: "Wiersz", + savingData: "Zapisuję wyniki ankiety na serwerze...", + savingDataError: "Wystąpił błąd i wyniki nie mogły zostać zapisane.", + savingDataSuccess: "Wyniki zostały poprawnie zapisane!", + saveAgainButton: "Spróbuj ponownie", + timerMin: "min", + timerSec: "sek", + timerSpentAll: "Spędziłeś {0} na tej stronie a w sumie {1}.", + timerSpentPage: "Spędziłeś {0} na tej stronie.", + timerSpentSurvey: "Spędziłeś w sumie {0}.", + timerLimitAll: "Spędziłeś {0} z {1} na tej stronie a w sumie {2} z {3}.", + timerLimitPage: "Spędziłeś {0} z {1} na tej stronie", + timerLimitSurvey: "Spędziłeś {0} z {1}.", + cleanCaption: "Wyczyść", + clearCaption: "Jasne", + chooseFileCaption: "Wybierz plik", + removeFileCaption: "Usuń ten plik", + booleanCheckedLabel: "Tak", + booleanUncheckedLabel: "Nie", + confirmRemoveFile: "Jesteś pewien, że chcesz usunąć ten plik: {0}?", + confirmRemoveAllFiles: "Jesteś pewien, że chcesz usunąć wszystkie pliki?", + questionTitlePatternText: "Tytuł pytania", + ratingOptionsCaption: "Kliknij tutaj, aby ocenić...", + emptyRowsText: "Nie ma rzędów.", + filteredTextPlaceholder: "Wpisz aby wyszukać...", + indexText: "{0} od {1}", + minError: "Wartość nie powinna być mniejsza niż {0}", + maxError: "Wartość nie powinna być większa niż {0}", + modalApplyButtonText: "Zastosować", + modalCancelButtonText: "Anulować", + multipletext_itemname: "tekst", + noEntriesText: "Nie ma jeszcze wpisów.\nKliknij przycisk poniżej, aby dodać nowy wpis.", + signaturePlaceHolder: "Podpisz tutaj", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["pl"] = polishSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["pl"] = "polski"; + + + /***/ }), + + /***/ "./src/localization/portuguese-br.ts": + /*!*******************************************!*\ + !*** ./src/localization/portuguese-br.ts ***! + \*******************************************/ + /*! exports provided: portugueseBrSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "portugueseBrSurveyStrings", function() { return portugueseBrSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var portugueseBrSurveyStrings = { + pagePrevText: "Anterior", + pageNextText: "Próximo", + completeText: "Finalizar", + previewText: "Pré-visualização", + editText: "Editar", + startSurveyText: "Começar", + otherItemText: "Outros (descrever)", + noneItemText: "Nenhum", + selectAllItemText: "Selecionar Todos", + progressText: "Página {0} de {1}", + panelDynamicProgressText: "Registro {0} de {1}", + questionsProgressText: "Respostas {0}/{1} perguntas", + emptySurvey: "Não há página visível ou pergunta na pesquisa.", + completingSurvey: "Obrigado por finalizar a pesquisa!", + completingSurveyBefore: "Nossos registros mostram que você já finalizou a pesquisa.", + loadingSurvey: "A pesquisa está carregando...", + optionsCaption: "Selecione...", + value: "valor", + requiredError: "Por favor, responda a pergunta.", + requiredErrorInPanel: "Por favor, responda pelo menos uma pergunta.", + requiredInAllRowsError: "Por favor, responda as perguntas em todas as linhas.", + numericError: "O valor deve ser numérico.", + textMinLength: "Por favor, insira pelo menos {0} caracteres.", + textMaxLength: "Por favor, insira menos de {0} caracteres.", + textMinMaxLength: "Por favor, insira mais de {0} e menos de {1} caracteres.", + minRowCountError: "Preencha pelo menos {0} linhas.", + minSelectError: "Selecione pelo menos {0} opções.", + maxSelectError: "Por favor, selecione não mais do que {0} opções.", + numericMinMax: "O '{0}' deve ser igual ou superior a {1} e igual ou menor que {2}", + numericMin: "O '{0}' deve ser igual ou superior a {1}", + numericMax: "O '{0}' deve ser igual ou inferior a {1}", + invalidEmail: "Por favor, informe um e-mail válido.", + invalidExpression: "A expressão: {0} deve retornar 'verdadeiro'.", + urlRequestError: "A requisição retornou o erro '{0}'. {1}", + urlGetChoicesError: "A requisição não retornou dados ou o 'caminho' da requisição não está correto", + exceedMaxSize: "O tamanho do arquivo não deve exceder {0}.", + otherRequiredError: "Por favor, informe o outro valor.", + uploadingFile: "Seu arquivo está sendo carregado. Por favor, aguarde alguns segundos e tente novamente.", + loadingFile: "Carregando...", + chooseFile: "Selecione o(s) arquivo(s)...", + noFileChosen: "Nenhum arquivo escolhido", + confirmDelete: "Tem certeza que deseja deletar?", + keyDuplicationError: "Esse valor deve ser único.", + addColumn: "Adicionar coluna", + addRow: "Adicionar linha", + removeRow: "Remover linha", + addPanel: "Adicionar novo", + removePanel: "Remover", + choices_Item: "item", + matrix_column: "Coluna", + matrix_row: "Linha", + savingData: "Os resultados esto sendo salvos no servidor...", + savingDataError: "Ocorreu um erro e não foi possível salvar os resultados.", + savingDataSuccess: "Os resultados foram salvos com sucesso!", + saveAgainButton: "Tente novamente", + timerMin: "min", + timerSec: "seg", + timerSpentAll: "Você gastou {0} nesta página e {1} no total.", + timerSpentPage: "Você gastou {0} nesta página.", + timerSpentSurvey: "Você gastou {0} no total.", + timerLimitAll: "Você gastou {0} de {1} nesta página e {2} de {3} no total.", + timerLimitPage: "Você gastou {0} de {1} nesta página.", + timerLimitSurvey: "Você gastou {0} de {1} no total.", + cleanCaption: "Limpar", + clearCaption: "Limpar", + chooseFileCaption: "Escolher arquivo", + removeFileCaption: "Remover este arquivo", + booleanCheckedLabel: "Sim", + booleanUncheckedLabel: "Não", + confirmRemoveFile: "Tem certeza que deseja remover este arquivo: {0}?", + confirmRemoveAllFiles: "Tem certeza que deseja remover todos os arquivos?", + questionTitlePatternText: "Título da questão", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["pt-br"] = portugueseBrSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["pt-br"] = "português brasileiro"; + + + /***/ }), + + /***/ "./src/localization/portuguese.ts": + /*!****************************************!*\ + !*** ./src/localization/portuguese.ts ***! + \****************************************/ + /*! exports provided: portugueseSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "portugueseSurveyStrings", function() { return portugueseSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var portugueseSurveyStrings = { + pagePrevText: "Anterior", + pageNextText: "Próximo", + completeText: "Finalizar", + previewText: "Pré-visualização", + editText: "Editar", + startSurveyText: "Começar", + otherItemText: "Outros (descrever)", + noneItemText: "Nenhum", + selectAllItemText: "Selecionar Todos", + progressText: "Página {0} de {1}", + panelDynamicProgressText: "Registo {0} de {1}", + questionsProgressText: "Respostas {0}/{1} perguntas", + emptySurvey: "Não há página visível ou pergunta no questionário.", + completingSurvey: "Obrigado por finalizar o questionário!", + completingSurveyBefore: "Os nossos registos mostram que já finalizou o questionário.", + loadingSurvey: "O questionário está a carregar...", + optionsCaption: "Selecione...", + value: "valor", + requiredError: "Por favor, responda à pergunta.", + requiredErrorInPanel: "Por favor, responda pelo menos a uma pergunta.", + requiredInAllRowsError: "Por favor, responda às perguntas em todas as linhas.", + numericError: "O valor deve ser numérico.", + textMinLength: "Por favor, insira pelo menos {0} caracteres.", + textMaxLength: "Por favor, insira menos de {0} caracteres.", + textMinMaxLength: "Por favor, insira mais de {0} e menos de {1} caracteres.", + minRowCountError: "Preencha pelo menos {0} linhas.", + minSelectError: "Selecione pelo menos {0} opções.", + maxSelectError: "Por favor, selecione no máximo {0} opções.", + numericMinMax: "O '{0}' deve ser igual ou superior a {1} e igual ou menor que {2}", + numericMin: "O '{0}' deve ser igual ou superior a {1}", + numericMax: "O '{0}' deve ser igual ou inferior a {1}", + invalidEmail: "Por favor, insira um e-mail válido.", + invalidExpression: "A expressão: {0} deve retornar 'verdadeiro'.", + urlRequestError: "O pedido retornou o erro '{0}'. {1}", + urlGetChoicesError: "O pedido não retornou dados ou o 'caminho' do pedido não está correto", + exceedMaxSize: "O tamanho do arquivo não deve exceder {0}.", + otherRequiredError: "Por favor, insira o outro valor.", + uploadingFile: "O seu ficheiro está a carregar. Por favor, aguarde alguns segundos e tente novamente.", + loadingFile: "A carregar...", + chooseFile: "Selecione o(s) arquivo(s)...", + noFileChosen: "Nenhum ficheiro escolhido", + confirmDelete: "Tem a certeza que deseja apagar?", + keyDuplicationError: "Este valor deve ser único.", + addColumn: "Adicionar coluna", + addRow: "Adicionar linha", + removeRow: "Remover linha", + addPanel: "Adicionar novo", + removePanel: "Remover", + choices_Item: "item", + matrix_column: "Coluna", + matrix_row: "Linha", + savingData: "Os resultados estão a ser guardados no servidor...", + savingDataError: "Ocorreu um erro e não foi possível guardar os resultados.", + savingDataSuccess: "Os resultados foram guardados com sucesso!", + saveAgainButton: "Tente novamente", + timerMin: "min", + timerSec: "seg", + timerSpentAll: "Você gastou {0} nesta página e {1} no total.", + timerSpentPage: "Você gastou {0} nesta página.", + timerSpentSurvey: "Você gastou {0} no total.", + timerLimitAll: "Você gastou {0} de {1} nesta página e {2} de {3} no total.", + timerLimitPage: "Você gastou {0} de {1} nesta página.", + timerLimitSurvey: "Você gastou {0} de {1} no total.", + cleanCaption: "Limpar", + clearCaption: "Limpar", + chooseFileCaption: "Escolher ficheiro", + removeFileCaption: "Remover este ficheiro", + booleanCheckedLabel: "Sim", + booleanUncheckedLabel: "Não", + confirmRemoveFile: "Tem a certeza que deseja remover este ficheiro: {0}?", + confirmRemoveAllFiles: "Tem a certeza que deseja remover todos os ficheiros?", + questionTitlePatternText: "Título da questão", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["pt"] = portugueseSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["pt"] = "português"; + + + /***/ }), + + /***/ "./src/localization/romanian.ts": + /*!**************************************!*\ + !*** ./src/localization/romanian.ts ***! + \**************************************/ + /*! exports provided: romanianSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "romanianSurveyStrings", function() { return romanianSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var romanianSurveyStrings = { + pagePrevText: "Precedent", + pageNextText: "Următor", + completeText: "Finalizare", + previewText: "previzualizare", + editText: "Editați", + startSurveyText: "start", + otherItemText: "Altul(precizaţi)", + noneItemText: "Nici unul", + selectAllItemText: "Selectează tot", + progressText: "Pagina {0} din {1}", + panelDynamicProgressText: "Înregistrare {0} din {1}", + questionsProgressText: "Răspunsuri la {0} / {1} întrebări", + emptySurvey: "Nu sunt întrebări pentru acest chestionar", + completingSurvey: "Vă mulţumim pentru timpul acordat!", + completingSurveyBefore: "Din înregistrările noastre reiese că ați completat deja acest chestionar.", + loadingSurvey: "Chestionarul se încarcă...", + optionsCaption: "Alegeţi...", + value: "valoare", + requiredError: "Răspunsul la această întrebare este obligatoriu.", + requiredErrorInPanel: "Vă rugăm să răspundeți la cel puțin o întrebare.", + requiredInAllRowsError: "Toate răspunsurile sunt obligatorii", + numericError: "Răspunsul trebuie să fie numeric.", + textMinLength: "Trebuie să introduceți minim {0} caractere.", + textMaxLength: "Trebuie să introduceți maxim {0} caractere.", + textMinMaxLength: "Trebuie să introduceți mai mult de {0} și mai puțin de {1} caractere.", + minRowCountError: "Trebuie să completați minim {0} rânduri.", + minSelectError: "Trebuie să selectați minim {0} opţiuni.", + maxSelectError: "Trebuie să selectați maxim {0} opţiuni.", + numericMinMax: "Răspunsul '{0}' trebuie să fie mai mare sau egal ca {1} şî mai mic sau egal cu {2}", + numericMin: "Răspunsul '{0}' trebuie să fie mai mare sau egal ca {1}", + numericMax: "Răspunsul '{0}' trebuie să fie mai mic sau egal ca {1}", + invalidEmail: "Trebuie să introduceţi o adresa de email validă.", + invalidExpression: "Expresia: {0} ar trebui să returneze „adevărat”.", + urlRequestError: "Request-ul a returnat eroarea '{0}'. {1}", + urlGetChoicesError: "Request-ul nu a returnat date sau proprietatea 'path' este incorectă", + exceedMaxSize: "Dimensiunea fişierului nu trebuie să depăşească {0}.", + otherRequiredError: "Trebuie să completați câmpul 'Altul'.", + uploadingFile: "Fișierul dumneavoastră este în curs de încărcare. Vă rugăm așteptați câteva secunde și reveniți apoi.", + loadingFile: "Se încarcă...", + chooseFile: "Alege fisierele...", + noFileChosen: "Niciun fișier ales", + confirmDelete: "Sunteți sigur că doriți să ștergeți înregistrarea?", + keyDuplicationError: "Valoarea trebuie să fie unică.", + addColumn: "Adăugați coloană", + addRow: "Adăugare rând", + removeRow: "Ștergere", + addPanel: "Adăugare", + removePanel: "Ștergere", + choices_Item: "opțiune", + matrix_column: "Coloană", + matrix_row: "Rând", + savingData: "Rezultatele sunt în curs de salvare...", + savingDataError: "A intervenit o eroare, rezultatele nu au putut fi salvate.", + savingDataSuccess: "Rezultatele au fost salvate cu succes!", + saveAgainButton: "Încercați din nou", + timerMin: "min", + timerSec: "sec", + timerSpentAll: "Ați petrecut {0} pe această pagină și {1} în total.", + timerSpentPage: "Ați petrecut {0} pe această pagină.", + timerSpentSurvey: "Ați petrecut {0} în total.", + timerLimitAll: "Ați petrecut {0} din {1} pe această pagină și {2} din {3} în total.", + timerLimitPage: "Ați petrecut {0} din {1} pe această pagină.", + timerLimitSurvey: "Ați petrecut {0} din {1} în total.", + cleanCaption: "Curat", + clearCaption: "clar", + chooseFileCaption: "Alege fișierul", + removeFileCaption: "Eliminați acest fișier", + booleanCheckedLabel: "da", + booleanUncheckedLabel: "Nu", + confirmRemoveFile: "Sigur doriți să eliminați acest fișier: {0}?", + confirmRemoveAllFiles: "Sigur doriți să eliminați toate fișierele?", + questionTitlePatternText: "Titlul intrebarii", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ro"] = romanianSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ro"] = "română"; + + + /***/ }), + + /***/ "./src/localization/russian.ts": + /*!*************************************!*\ + !*** ./src/localization/russian.ts ***! + \*************************************/ + /*! exports provided: russianSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "russianSurveyStrings", function() { return russianSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var russianSurveyStrings = { + pagePrevText: "Назад", + pageNextText: "Далее", + completeText: "Готово", + previewText: "Предварительный просмотр", + editText: "Редактирование", + startSurveyText: "Начать", + otherItemText: "Другое (пожалуйста, опишите)", + noneItemText: "Нет", + selectAllItemText: "Выбрать всё", + progressText: "Страница {0} из {1}", + panelDynamicProgressText: "Запись {0} из {1}", + questionsProgressText: "Oтвечено на {0}/{1} вопросов", + emptySurvey: "Нет ни одного вопроса.", + completingSurvey: "Благодарим Вас за заполнение анкеты!", + completingSurveyBefore: "Вы уже проходили этот опрос.", + loadingSurvey: "Загрузка с сервера...", + optionsCaption: "Выбрать...", + value: "значение", + requiredError: "Пожалуйста, ответьте на вопрос.", + requiredErrorInPanel: "Пожалуйста, ответьте по крайней мере на один вопрос.", + requiredInAllRowsError: "Пожалуйста, ответьте на вопросы в каждой строке.", + numericError: "Ответ должен быть числом.", + textMinLength: "Пожалуйста введите больше {0} символов.", + textMaxLength: "Пожалуйста введите меньше {0} символов.", + textMinMaxLength: "Пожалуйста введите больше {0} и меньше {1} символов.", + minRowCountError: "Пожалуйста, заполните не меньше {0} строк.", + minSelectError: "Пожалуйста, выберите хотя бы {0} вариантов.", + maxSelectError: "Пожалуйста, выберите не более {0} вариантов.", + numericMinMax: "'{0}' должно быть не меньше чем {1}, и не больше чем {2}", + numericMin: "'{0}' должно быть не меньше чем {1}", + numericMax: "'{0}' должно быть не больше чем {1}", + invalidEmail: "Пожалуйста, введите действительный адрес электронной почты.", + invalidExpression: "Выражение {0} должно возвращать 'true'.", + urlRequestError: "Запрос вернул ошибку '{0}'. {1}", + urlGetChoicesError: "Ответ на запрос пришел пустой или свойство 'path' указано неверно", + exceedMaxSize: "Размер файла не должен превышать {0}.", + otherRequiredError: "Пожалуйста, введите данные в поле 'Другое'", + uploadingFile: "Ваш файл загружается. Подождите несколько секунд и попробуйте снова.", + loadingFile: "Загрузка...", + chooseFile: "Выберите файл(ы)...", + fileDragAreaPlaceholder: "Перетащите файл сюда или нажмите кнопку ниже, чтобы загрузить файл.", + noFileChosen: "Файл не выбран", + confirmDelete: "Вы точно хотите удалить запись?", + keyDuplicationError: "Это значение должно быть уникальным.", + addColumn: "Добавить колонку", + addRow: "Добавить строку", + removeRow: "Удалить", + addPanel: "Добавить новую", + removePanel: "Удалить", + choices_Item: "Вариант", + matrix_column: "Колонка", + matrix_row: "Строка", + savingData: "Результаты сохраняются на сервер...", + savingDataError: "Произошла ошибка, результат не был сохранён.", + savingDataSuccess: "Результат успешно сохранён!", + saveAgainButton: "Попробовать снова", + timerMin: "мин", + timerSec: "сек", + timerSpentAll: "Вы потратили {0} на этой странице и {1} всего.", + timerSpentPage: "Вы потратили {0} на этой странице.", + timerSpentSurvey: "Вы потратили {0} в течение теста.", + timerLimitAll: "Вы потратили {0} из {1} на этой странице и {2} из {3} для всего теста.", + timerLimitPage: "Вы потратили {0} из {1} на этой странице.", + timerLimitSurvey: "Вы потратили {0} из {1} для всего теста.", + cleanCaption: "Очистить", + clearCaption: "Очистить", + chooseFileCaption: "Выберите файл", + removeFileCaption: "Удалить файл", + booleanCheckedLabel: "Да", + booleanUncheckedLabel: "Нет", + confirmRemoveFile: "Вы уверены, что хотите удалить этот файл: {0}?", + confirmRemoveAllFiles: "Вы уверены, что хотите удалить все файлы?", + questionTitlePatternText: "Название вопроса", + ratingOptionsCaption: "Нажмите здесь, чтобы оценить...", + emptyRowsText: "Рядов нет.", + filteredTextPlaceholder: "Введите для поиска...", + indexText: "{0} из {1}", + minError: "Значение не должно быть меньше {0}.", + maxError: "Значение не должно превышать {0}.", + modalApplyButtonText: "Применять", + modalCancelButtonText: "Отменить", + multipletext_itemname: "текст", + noEntriesText: "Пока нет записей.\nНажмите кнопку ниже, чтобы добавить новую запись.", + signaturePlaceHolder: "Подпишите здесь", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ru"] = russianSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ru"] = "русский"; + + + /***/ }), + + /***/ "./src/localization/serbian.ts": + /*!*************************************!*\ + !*** ./src/localization/serbian.ts ***! + \*************************************/ + /*! exports provided: serbianStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serbianStrings", function() { return serbianStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + //Uncomment this line on creating a translation file + + var serbianStrings = { + pagePrevText: "Nazad", + pageNextText: "Dalje", + completeText: "Završi", + previewText: "Pregledaj", + editText: "Izmeni", + startSurveyText: "Započni", + otherItemText: "Drugo (upiši)", + noneItemText: "Ništa", + selectAllItemText: "Izaberi sve", + progressText: "Stranica {0} od {1}", + panelDynamicProgressText: "Upis {0} od {1}", + questionsProgressText: "Odgovoreno na {0}/{1} pitanja", + emptySurvey: "Nema vidljivih stranica ili pitanja u anketi.", + completingSurvey: "Hvala na popunjavanju ankete!", + completingSurveyBefore: "Prema našim podacima, već ste popunili ovu anketu.", + loadingSurvey: "Učitavam anketu...", + optionsCaption: "Izaberi...", + value: "vrednost", + requiredError: "Molimo odgovorite na ovo pitanje.", + requiredErrorInPanel: "Molimo odgovorite na bar jedno pitanje.", + requiredInAllRowsError: "Molimo odgovorite na pitanja u svim redovima.", + numericError: "Vrednost bi trebalo da bude numerička.", + minError: "Vrednost ne bi trebalo da bude manja od {0}", + maxError: "Vrednost ne bi trebalo da bude veća od {0}", + textMinLength: "Molimo unesite bar {0} znak(ov)a.", + textMaxLength: "Molimo unesite najviše {0} znak(ov)a.", + textMinMaxLength: "Molimo unesite najmanje {0} i ne više od {1} znak(ov)a.", + minRowCountError: "Molimo popunite najmanje {0} red(ova).", + minSelectError: "Molimo izaberite najmanje {0} opcija/e.", + maxSelectError: "Molimo izaberite najviše {0} opcija/e.", + numericMinMax: "'{0}' bi trebalo da bude najmanje {1} i najviše {2}", + numericMin: "'{0}' bi trebalo da bude najmanje {1}", + numericMax: "'{0}' bi trebalo da bude najviše {1}", + invalidEmail: "Molimo unesite ispravnu e-mail adresu.", + // vratiti "true" ? + invalidExpression: "Izraz: {0} bi trebalo da bude tačan.", + urlRequestError: "Zahtev je naišao na grešku '{0}'. {1}", + urlGetChoicesError: "Zahtev nije pronašao podatke, ili je putanja netačna", + exceedMaxSize: "Veličina fajla ne bi trebalo da prelazi {0}.", + otherRequiredError: "Molimo unesite drugu vrednost.", + uploadingFile: "Fajl se šalje. Molimo sačekajte neko vreme i pokušajte ponovo.", + loadingFile: "Učitavanje...", + chooseFile: "Izaberite fajlove...", + noFileChosen: "Nije izabran nijedan fajl", + confirmDelete: "Da li želite da izbrišete unos?", + keyDuplicationError: "Ova vrednost treba da bude jedinstvena.", + addColumn: "Dodaj kolonu", + addRow: "Dodaj red", + removeRow: "Ukloni", + emptyRowsText: "Nema redova.", + addPanel: "Dodaj novo", + removePanel: "Ukloni", + choices_Item: "stavka", + matrix_column: "Kolona", + matrix_row: "Red", + multipletext_itemname: "tekst", + savingData: "U toku je čuvanje podataka na serveru...", + savingDataError: "Došlo je do greške i rezultati nisu sačuvani.", + savingDataSuccess: "Rezultati su uspešno sačuvani!", + saveAgainButton: "Pokušajte ponovo", + timerMin: "min", + timerSec: "sek", + timerSpentAll: "Proveli ste {0} na ovoj stranici i {1} ukupno.", + timerSpentPage: "Proveli ste {0} na ovoj stranici.", + timerSpentSurvey: "Proveli ste {0} ukupno.", + timerLimitAll: "Proveli ste {0} od {1} na ovoj stranici i {2} od {3} ukupno.", + timerLimitPage: "Proveli ste {0} od {1} na ovoj stranici.", + timerLimitSurvey: "Proveli ste {0} od {1} ukupno.", + cleanCaption: "Očisti", + clearCaption: "Poništi", + chooseFileCaption: "Izaberi fajl", + removeFileCaption: "Ukloni ovaj fajl", + booleanCheckedLabel: "Da", + booleanUncheckedLabel: "Ne", + confirmRemoveFile: "Da li ste sigurni da želite da uklonite ovaj fajl: {0}?", + confirmRemoveAllFiles: "Da li ste sigurni da želite da uklonite sve fajlove?", + questionTitlePatternText: "Naslov pitanja", + modalCancelButtonText: "Otkaži", + modalApplyButtonText: "Primeni", + }; + //Uncomment these two lines on creating a translation file. You should replace "en" and enStrings with your locale ("fr", "de" and so on) and your variable. + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["rs"] = serbianStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["rs"] = "Srpski"; + + + /***/ }), + + /***/ "./src/localization/simplified-chinese.ts": + /*!************************************************!*\ + !*** ./src/localization/simplified-chinese.ts ***! + \************************************************/ + /*! exports provided: simplifiedChineseSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "simplifiedChineseSurveyStrings", function() { return simplifiedChineseSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var simplifiedChineseSurveyStrings = { + pagePrevText: "上一页", + pageNextText: "下一页", + completeText: "提交问卷", + previewText: "预览", + editText: "编辑", + startSurveyText: "开始问卷", + otherItemText: "填写其他答案", + noneItemText: "无", + selectAllItemText: "选择全部", + progressText: "第 {0} 页, 共 {1} 页", + panelDynamicProgressText: "{0} of {1}", + questionsProgressText: "第 {0}/{1} 题", + emptySurvey: "问卷中没有问题或页面", + completingSurvey: "感谢您的参与!", + completingSurveyBefore: "你已完成问卷.", + loadingSurvey: "问卷正在加载中...", + optionsCaption: "请选择...", + value: "值", + requiredError: "请填写此问题", + requiredErrorInPanel: "至少回答一题.", + requiredInAllRowsError: "请填写所有行中问题", + numericError: "答案必须是个数字", + minError: "该值不能小于 {0}", + maxError: "该值不能大于 {0}", + textMinLength: "答案长度至少 {0} 个字符", + textMaxLength: "答案长度不能超过 {0} 个字符", + textMinMaxLength: "答案长度必须在 {0} - {1} 个字符之间", + minRowCountError: "最少需要填写 {0} 行答案", + minSelectError: "最少需要选择 {0} 项答案", + maxSelectError: "最多只能选择 {0} 项答案", + numericMinMax: "答案 '{0}' 必须大于等于 {1} 且小于等于 {2}", + numericMin: "答案 '{0}' 必须大于等于 {1}", + numericMax: "答案 '{0}' 必须小于等于 {1}", + invalidEmail: "请输入有效的 Email 地址", + invalidExpression: "公式: {0} 无效.", + urlRequestError: "载入选项时发生错误 '{0}': {1}", + urlGetChoicesError: "未能载入有效的选项或请求参数路径有误", + exceedMaxSize: "文件大小不能超过 {0}", + otherRequiredError: "请完成其他问题", + uploadingFile: "文件上传中... 请耐心等待几秒后重试", + loadingFile: "加载...", + chooseFile: "选择文件...", + noFileChosen: "未选择文件", + confirmDelete: "删除记录?", + keyDuplicationError: "主键不能重复", + addColumn: "添加列", + addRow: "添加行", + removeRow: "删除答案", + emptyRowsText: "无内容", + addPanel: "新添", + removePanel: "删除", + choices_Item: "选项", + matrix_column: "列", + matrix_row: "行", + multipletext_itemname: "文本", + savingData: "正在将结果保存到服务器...", + savingDataError: "在保存结果过程中发生了错误,结果未能保存", + savingDataSuccess: "结果保存成功!", + saveAgainButton: "请重试", + timerMin: "分", + timerSec: "秒", + timerSpentAll: "本页用时 {0} 总计用时{1} .", + timerSpentPage: "本页用时{0} .", + timerSpentSurvey: "总计用时 {0} .", + timerLimitAll: "本页用时 {0} 共 {1}, 总计用时 {2} 共 {3} .", + timerLimitPage: "本页用时 {0} 共 {1} .", + timerLimitSurvey: "总计用时 {0} 共 {1}.", + cleanCaption: "清理", + clearCaption: "清除", + chooseFileCaption: "选择文件", + removeFileCaption: "移除文件", + booleanCheckedLabel: "是", + booleanUncheckedLabel: "否", + confirmRemoveFile: "删除文件: {0}?", + confirmRemoveAllFiles: "删除所有文件?", + questionTitlePatternText: "标题", + modalCancelButtonText: "取消", + modalApplyButtonText: "确定", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["zh-cn"] = simplifiedChineseSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["zh-cn"] = "简体中文"; + + + /***/ }), + + /***/ "./src/localization/slovak.ts": + /*!************************************!*\ + !*** ./src/localization/slovak.ts ***! + \************************************/ + /*! exports provided: slovakSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "slovakSurveyStrings", function() { return slovakSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var slovakSurveyStrings = { + pagePrevText: "Predchádzajúca", + pageNextText: "Ďalej", + completeText: "Dokončené", + previewText: "Ukážka", + editText: "Upraviť", + startSurveyText: "Spustiť", + otherItemText: "Iné (opíšte)", + noneItemText: "Žiadne", + selectAllItemText: "Vybrať všetky", + progressText: "Strana {0} z {1}", + panelDynamicProgressText: "Záznam {0} z {1}", + questionsProgressText: "Zodpovedané otázky {0}/{1}", + emptySurvey: "V prieskume nie je žiadna vidieľná stránka ani otázka.", + completingSurvey: "Ďakujeme vám za dokončenie prieskumu.", + completingSurveyBefore: "Podľa našich záznamov ste už tento prieskum dokončili.", + loadingSurvey: "Načítanie prieskumu...", + optionsCaption: "Vybrať...", + value: "hodnota", + requiredError: "Požaduje sa odozva.", + requiredErrorInPanel: "Požaduje sa odozva: zodpovedajte aspoň jednu otázku.", + requiredInAllRowsError: "Požaduje sa odozva: zodpovedajte otázky vo všetkých riadkoch.", + numericError: "Hodnota má byť číselná.", + minError: "Hodnota nemá byť nižšia než {0}", + maxError: "Hodnota nemá byť vyššia než {0}", + textMinLength: "Zadajte aspoň {0} znak(-y/-ov).", + textMaxLength: "Nezadávajte viac než {0} znak(-y/-ov).", + textMinMaxLength: "Zadajte aspoň {0} a nie viac než {1} znaky(-ov).", + minRowCountError: "Vyplňte aspoň {0} riadok(-y/-ov).", + minSelectError: "Vyberte aspoň {0} variant(-y/-ov).", + maxSelectError: "Nevyberajte viac než {0} variant(-y/-ov).", + numericMinMax: "„{0}“ má byť minimálne {1} a maximálne {2}", + numericMin: "„{0}“ má byť minimálne {1}", + numericMax: "„{0}“ má byť maximálne {1}", + invalidEmail: "Zadajte platnú e-mailovú adresu.", + invalidExpression: "Výraz: {0} má vrátiť hodnotu „true“.", + urlRequestError: "Požiadavky vrátila hodnotu „{0}“. {1}", + urlGetChoicesError: "Požiadavka vrátila prázdne údaje alebo je vlastnosť „cesta“ nesprávna", + exceedMaxSize: "Veľkosť súboru nemá prekročiť {0}.", + otherRequiredError: "Požaduje sa odozva: zadajte inú hodnotu.", + uploadingFile: "Súbor sa odovzdáva. Počkajte niekoľko sekúnd a skúste to znova.", + loadingFile: "Načítanie...", + chooseFile: "Vyberte súbor(-y)...", + noFileChosen: "Žiadny vybratý súbor", + fileDragAreaPlaceholder: "Presuňte súbor sem alebo kliknite na nasledujúce tlačidlo a načítajte súbor.", + confirmDelete: "Chcete záznam odstrániť?", + keyDuplicationError: "Táto hodnota má byť jedinečná.", + addColumn: "Pridať stĺpec", + addRow: "Pridať riadok", + removeRow: "Odstrániť", + emptyRowsText: "K dispozícii nie sú žiadne riadky.", + addPanel: "Pridať nové", + removePanel: "Odstrániť", + choices_Item: "položka", + matrix_column: "Stĺpec", + matrix_row: "Riadok", + multipletext_itemname: "text", + savingData: "Výsledky sa ukladajú na server...", + savingDataError: "V dôsledku chyby sa nepodarilo výsledky uložiť.", + savingDataSuccess: "Výsledky sa úspešne uložili.", + saveAgainButton: "Skúste to znova", + timerMin: "min", + timerSec: "s", + timerSpentAll: "Na tejto stránke ste strávili {0} a celkovo {1}.", + timerSpentPage: "Na tejto stránke ste strávili {0}.", + timerSpentSurvey: "Celkovo ste strávili {0}.", + timerLimitAll: "Na tejto stránke ste strávili {0} z {1} a celkovo {2} z {3}.", + timerLimitPage: "Na tejto stránke ste strávili {0} z {1}.", + timerLimitSurvey: "Celkovo ste strávili {0} z {1}.", + cleanCaption: "Vyčistiť", + clearCaption: "Vymazať", + signaturePlaceHolder: "Podpísať tu", + chooseFileCaption: "Vybrať súbor", + removeFileCaption: "Odstrániť tento súbor", + booleanCheckedLabel: "Áno", + booleanUncheckedLabel: "Nie", + confirmRemoveFile: "Naozaj chcete odstrániť tento súbor: {0}?", + confirmRemoveAllFiles: "Naozaj chcete odstrániť všetky súbory?", + questionTitlePatternText: "Titul otázky", + modalCancelButtonText: "Zrušiť", + modalApplyButtonText: "Použiť", + filteredTextPlaceholder: "Vyhľadávanie písaním...", + noEntriesText: "K dispozícii ešte nie sú žiadne zadania.\nKliknutím na nasledujúce tlačidlo pridajte nové zadanie." + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["sk"] = slovakSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["sk"] = "slovenčina"; + + + /***/ }), + + /***/ "./src/localization/spanish.ts": + /*!*************************************!*\ + !*** ./src/localization/spanish.ts ***! + \*************************************/ + /*! exports provided: spanishSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spanishSurveyStrings", function() { return spanishSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var spanishSurveyStrings = { + pagePrevText: "Anterior", + pageNextText: "Siguiente", + completeText: "Completar", + previewText: "Vista previa", + editText: "Edita", + startSurveyText: "Comienza", + otherItemText: "Otro (describa)", + noneItemText: "Ninguno", + selectAllItemText: "Seleccionar todo", + progressText: "Página {0} de {1}", + panelDynamicProgressText: "Registro {0} de {1}", + questionsProgressText: "Respondió a {0}/{1} preguntas", + emptySurvey: "No hay página visible o pregunta en la encuesta.", + completingSurvey: "Gracias por completar la encuesta!", + completingSurveyBefore: "Nuestros registros muestran que ya ha completado esta encuesta.", + loadingSurvey: "La encuesta está cargando...", + optionsCaption: "Seleccione...", + value: "valor", + requiredError: "Por favor conteste la pregunta.", + requiredErrorInPanel: "Por favor, responda al menos una pregunta.", + requiredInAllRowsError: "Por favor conteste las preguntas en cada hilera.", + numericError: "La estimación debe ser numérica.", + minError: "La estimación no debe ser menor que {0}", + maxError: "La estimación no debe ser mayor que {0}", + textMinLength: "Por favor entre por lo menos {0} símbolos.", + textMaxLength: "Por favor entre menos de {0} símbolos.", + textMinMaxLength: "Por favor entre más de {0} y menos de {1} símbolos.", + minRowCountError: "Por favor llene por lo menos {0} hileras.", + minSelectError: "Por favor seleccione por lo menos {0} variantes.", + maxSelectError: "Por favor seleccione no más de {0} variantes.", + numericMinMax: "El '{0}' debe de ser igual o más de {1} y igual o menos de {2}", + numericMin: "El '{0}' debe ser igual o más de {1}", + numericMax: "El '{0}' debe ser igual o menos de {1}", + invalidEmail: "Por favor agregue un correo electrónico válido.", + invalidExpression: "La expresión: {0} debería devolver 'verdadero'.", + urlRequestError: "La solicitud regresó error '{0}'. {1}", + urlGetChoicesError: "La solicitud regresó vacío de data o la propiedad 'trayectoria' no es correcta", + exceedMaxSize: "El tamaño del archivo no debe de exceder {0}.", + otherRequiredError: "Por favor agregue la otra estimación.", + uploadingFile: "Su archivo se está subiendo. Por favor espere unos segundos e intente de nuevo.", + loadingFile: "Cargando...", + chooseFile: "Elija archivo(s)...", + fileDragAreaPlaceholder: "Suelte un archivo aquí o haga clic en el botón de abajo para cargar el archivo", + noFileChosen: "No se ha elegido ningún archivo", + confirmDelete: "¿Quieres borrar el registro?", + keyDuplicationError: "Este valor debe ser único.", + addColumn: "Añadir columna", + addRow: "Agregue una hilera", + removeRow: "Eliminar una hilera", + emptyRowsText: "No hay hileras.", + addPanel: "Añadir nuevo", + removePanel: "Retire", + choices_Item: "artículo", + matrix_column: "Columna", + matrix_row: "Hilera", + multipletext_itemname: "texto", + savingData: "Los resultados se están guardando en el servidor...", + savingDataError: "Los resultados se están guardando en el servidor...", + savingDataSuccess: "¡Los resultados se guardaron con éxito!", + saveAgainButton: "Inténtalo de nuevo.", + timerMin: "min", + timerSec: "sec", + timerSpentAll: "Has gastado {0} en esta página y {1} en total.", + timerSpentPage: "Usted ha pasado {0} en esta página.", + timerSpentSurvey: "Has gastado en total.", + timerLimitAll: "Has gastado {0} de {1} en esta página y {2} de {3} en total.", + timerLimitPage: "Has gastado {0} de {1} en esta página.", + timerLimitSurvey: "Usted ha gastado {0} de {1} en total.", + cleanCaption: "Limpia", + clearCaption: "Despejen", + signaturePlaceHolder: "Firma aqui", + chooseFileCaption: "Elija el archivo", + removeFileCaption: "Elimina este archivo", + booleanCheckedLabel: "Sí", + booleanUncheckedLabel: "No", + confirmRemoveFile: "¿Estás seguro de que quieres eliminar este archivo: {0}?", + confirmRemoveAllFiles: "¿Estás seguro de que quieres eliminar todos los archivos?", + questionTitlePatternText: "Título de la pregunta", + modalCancelButtonText: "Anular", + modalApplyButtonText: "Aplicar", + ratingOptionsCaption: "Toca aquí para calificar...", + filteredTextPlaceholder: "Escribe para buscar...", + indexText: "{0} de {1}", + noEntriesText: "Aún no hay entradas.\nHaga clic en el botón de abajo para agregar una nueva entrada.", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["es"] = spanishSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["es"] = "español"; + + + /***/ }), + + /***/ "./src/localization/swahili.ts": + /*!*************************************!*\ + !*** ./src/localization/swahili.ts ***! + \*************************************/ + /*! exports provided: swahiliStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "swahiliStrings", function() { return swahiliStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var swahiliStrings = { + pagePrevText: "Iliyotangulia", + pageNextText: "Ifuatayo", + completeText: "Kamili", + previewText: "Hakiki", + editText: "Hariri", + startSurveyText: "Anza", + otherItemText: "Nyingine (eleza)", + noneItemText: "Hakuna", + selectAllItemText: "Chagua Zote", + progressText: "Ukurasa {0} wa {1}", + panelDynamicProgressText: "Rekodi {0} ya {1}", + questionsProgressText: "Yaliyojibiwa {0}/{1} maswali", + emptySurvey: "Hakuna ukurasa unaoonekana au swali katika utafiti.", + completingSurvey: "Asanti kwa kukamilisha utafiti!", + completingSurveyBefore: "Recodi zetu zinatuonyesha tayari umekamilisha utafiti.", + loadingSurvey: "Tunaandaa utafiti...", + optionsCaption: "Chagua...", + value: "thamani", + requiredError: "Tafadhali jibu hili swali.", + requiredErrorInPanel: "Tafadhali jibu swali angalau moja.", + requiredInAllRowsError: "Tafadhali jibu maswali katika safu zote.", + numericError: "Thamani inapaswa kuwa ya nambari.", + textMinLength: "Tafadhali ingiza angalau{0} husika.", + textMaxLength: "Tafadhali ingiza isiozidi {0} husika.", + textMinMaxLength: "Tafadhali ingiza kiwango zaidi ya {0} na kisichopungua {1} husika.", + minRowCountError: "Tafadhali jaza isiopungua {0} safu.", + minSelectError: "Tafadhali chagua angalau {0} lahaja.", + maxSelectError: "Tafadhali changua isiozidi {0} lahaja.", + numericMinMax: " '{0}' inapaswa kuwa sawa au zaidi ya {1} na sawa au chini ya {2}", + numericMin: " '{0}'inapaswa kuwa sawa au zaidi ya {1}", + numericMax: " '{0}'inapaswa kuwa sawa au chini ya {1}", + invalidEmail: "Tafadhali ingiza anwani halali ya barua-pepe.", + invalidExpression: "Usemi:{0} inapaswa kurudi 'kweli'.", + urlRequestError: "Ombi lina kosa '{0}'. {1}", + urlGetChoicesError: "Ombi lilirudisha data tupu au the 'path' mali ya njia sio sahihi", + exceedMaxSize: "Saizi ya faili haipaswi kuzidi {0}.", + otherRequiredError: "Tafadhali ingiza thamani nyingine.", + uploadingFile: "Faili yako inapakia.Tafadhali subiri sekunde kadhaa na ujaribu tena.", + loadingFile: "Inapakia...", + chooseFile: "Chagua faili...", + noFileChosen: "Hujachagua faili", + confirmDelete: "Je! Unataka kufuta rekodi?", + keyDuplicationError: "Thamani hii inapaswa kuwa ya kipekee.", + addColumn: "Ongeza Kolamu", + addRow: "Ongeza safu", + removeRow: "Toa", + addPanel: "Ongeza mpya", + removePanel: "Toa", + choices_Item: "kitu", + matrix_column: "Kolamu", + matrix_row: "Safu", + savingData: "Matokeo yamehifadhiwa kwa seva...", + savingDataError: "Kosa limetokea na hatukuweza kuhifadhi matokeo.", + savingDataSuccess: "Matokeo yamehifadhiwa!", + saveAgainButton: "Jaribu tena", + timerMin: "dakika", + timerSec: "sekunde", + timerSpentAll: "Umetumia {0} kwenye ukurasa huu na {1} kwa jumla.", + timerSpentPage: "Umetumia {0} kwenye ukurasa huu.", + timerSpentSurvey: "Umetumia {0} kwa jumla.", + timerLimitAll: "Umetumia {0} ya {1} kwenye ukurasa huu {2} wa {3} kwa jumla.", + timerLimitPage: "Umetumia {0} ya {1} kwenye ukurasa huu.", + timerLimitSurvey: "Umetumia {0} ya {1} kwa jumla.", + cleanCaption: "Safisha", + clearCaption: "Ondoa", + chooseFileCaption: "Chagua faili", + removeFileCaption: "Ondoa faili", + booleanCheckedLabel: "Ndio", + booleanUncheckedLabel: "Hapana", + confirmRemoveFile: "Je! Una uhakika kuwa unataka kuondoa faili hii: {0}?", + confirmRemoveAllFiles: "Je! Una uhakika kuwa unataka kuondoa faili zote?", + questionTitlePatternText: "Kichwa cha Swali", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["sw"] = swahiliStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["sw"] = "swahili"; + + + /***/ }), + + /***/ "./src/localization/swedish.ts": + /*!*************************************!*\ + !*** ./src/localization/swedish.ts ***! + \*************************************/ + /*! exports provided: swedishSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "swedishSurveyStrings", function() { return swedishSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + //Create by Mattias Asplund + + var swedishSurveyStrings = { + pagePrevText: "Föregående", + pageNextText: "Nästa", + completeText: "Färdig", + previewText: "Förhandsvisning", + editText: "Redigera", + startSurveyText: "Start", + otherItemText: "Annat (beskriv)", + noneItemText: "Ingen", + selectAllItemText: "Välj alla", + progressText: "Sida {0} av {1}", + panelDynamicProgressText: "Spela in {0} av {1}", + questionsProgressText: "Besvarade {0} / {1} frågor", + emptySurvey: "Det finns ingen synlig sida eller fråga i enkäten.", + completingSurvey: "Tack för att du genomfört enkäten!!", + completingSurveyBefore: "Våra register visar att du redan har slutfört denna undersökning.", + loadingSurvey: "Enkäten laddas...", + optionsCaption: "Välj...", + value: "värde", + requiredError: "Var vänlig besvara frågan.", + requiredErrorInPanel: "Vänligen svara på minst en fråga.", + requiredInAllRowsError: "Var vänlig besvara frågorna på alla rader.", + numericError: "Värdet ska vara numeriskt.", + textMinLength: "Var vänlig ange minst {0} tecken.", + textMaxLength: "Ange färre än {0} tecken.", + textMinMaxLength: "Ange mer än {0} och färre än {1} tecken.", + minRowCountError: "Var vänlig fyll i minst {0} rader.", + minSelectError: "Var vänlig välj åtminstone {0} varianter.", + maxSelectError: "Var vänlig välj inte fler än {0} varianter.", + numericMinMax: "'{0}' ska vara lika med eller mer än {1} samt lika med eller mindre än {2}", + numericMin: "'{0}' ska vara lika med eller mer än {1}", + numericMax: "'{0}' ska vara lika med eller mindre än {1}", + invalidEmail: "Var vänlig ange en korrekt e-postadress.", + invalidExpression: "Uttrycket: {0} ska returnera 'true'.", + urlRequestError: "Förfrågan returnerade felet '{0}'. {1}", + urlGetChoicesError: "Antingen returnerade förfrågan ingen data eller så är egenskapen 'path' inte korrekt", + exceedMaxSize: "Filstorleken får ej överstiga {0}.", + otherRequiredError: "Var vänlig ange det andra värdet.", + uploadingFile: "Din fil laddas upp. Var vänlig vänta några sekunder och försök sedan igen.", + loadingFile: "Läser in...", + chooseFile: "Välj fil (er) ...", + noFileChosen: "Ingen fil vald", + confirmDelete: "Vill du radera posten?", + keyDuplicationError: "Detta värde ska vara unikt.", + addColumn: "Lägg till kolumn", + addRow: "Lägg till rad", + removeRow: "Ta bort", + addPanel: "Lägg till ny", + removePanel: "Ta bort", + choices_Item: "Artikel", + matrix_column: "Kolumn", + matrix_row: "Rad", + savingData: "Resultaten sparas på servern ...", + savingDataError: "Ett fel inträffade och vi kunde inte spara resultaten.", + savingDataSuccess: "Resultaten sparades framgångsrikt!", + saveAgainButton: "Försök igen", + timerMin: "min", + timerSec: "sek", + timerSpentAll: "Du har spenderat {0} på den här sidan och {1} totalt.", + timerSpentPage: "Du har spenderat {0} på den här sidan.", + timerSpentSurvey: "Du har spenderat {0} totalt.", + timerLimitAll: "Du har spenderat {0} av {1} på den här sidan och {2} av {3} totalt.", + timerLimitPage: "Du har spenderat {0} av {1} på den här sidan.", + timerLimitSurvey: "Du har spenderat {0} av {1} totalt.", + cleanCaption: "Rena", + clearCaption: "Klar", + chooseFileCaption: "Välj FIL", + removeFileCaption: "Ta bort den här filen", + booleanCheckedLabel: "Ja", + booleanUncheckedLabel: "Nej", + confirmRemoveFile: "Är du säker på att du vill ta bort den här filen: {0}?", + confirmRemoveAllFiles: "Är du säker på att du vill ta bort alla filer?", + questionTitlePatternText: "Frågetitel", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["sv"] = swedishSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["sv"] = "svenska"; + + + /***/ }), + + /***/ "./src/localization/tajik.ts": + /*!***********************************!*\ + !*** ./src/localization/tajik.ts ***! + \***********************************/ + /*! exports provided: tajikSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tajikSurveyStrings", function() { return tajikSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var tajikSurveyStrings = { + pagePrevText: "Бозгашт", + pageNextText: "Оянда", + completeText: "Иҷро шуд", + startSurveyText: "Оғоз", + otherItemText: "Дигар (лутфан тавсиф кунед)", + noneItemText: "Не", + selectAllItemText: "Ҳамаро интихоб кардан", + progressText: "Саҳифаи {0} аз {1}", + emptySurvey: "Ягон савол вуҷуд надорад.", + completingSurvey: "Ташаккур барои пур кардани саволнома!", + completingSurveyBefore: "Шумо аллакай ин пурсишро анҷом додаед.", + loadingSurvey: "Боргирӣ аз сервер...", + optionsCaption: "Интихоб кардан...", + value: "қиммат", + requiredError: "Илтимос, ба савол ҷавоб диҳед.", + requiredErrorInPanel: "Илтимос, ақалан ба як савол ҷавоб диҳед.", + requiredInAllRowsError: "Илтимос, ба ҳамаи саволҳо дар ҳамаи сатрҳо ҷавоб диҳед.", + numericError: "Ҷавоб бояд рақам бошад.", + textMinLength: "Илтимос, аз {0} зиёдтар рамз ворид кунед.", + textMaxLength: "Илтимос, аз {0} камтар рамз ворид кунед.", + textMinMaxLength: "Илтимос, аз {0} зиёдтар ва аз {1} камтар рамз ворид кунед.", + minRowCountError: "Илтимос, на камтар аз {0} сатр пур кунед.", + minSelectError: "Илтимос, ақалан {0} вариант интихоб кунед.", + maxSelectError: "Илтимос, на зиёдтар аз {0} вариант интихоб кунед.", + numericMinMax: "'{0}' бояд на кам аз {1} ва на бисёр аз {2} бошад", + numericMin: "'{0}' бояд на кам аз {1} бошад", + numericMax: "'{0}' бояд на зиёд аз {1} бошад", + invalidEmail: "Илтимос, почтаи электронии воқеиро ворид кунед.", + invalidExpression: "Ифодаи {0} бояд 'true' баргардонад.", + urlRequestError: "Дархост хатогӣ бозгардонд '{0}'. {1}", + urlGetChoicesError: "Ҷавоб ба дархост холӣ омад ё хосияти 'path' нодуруст муайян карда шудааст", + exceedMaxSize: "Андозаи файл бояд на калон аз {0} бошад.", + otherRequiredError: "Илтимос, ба майдони 'Дигар' додаҳоро ворид кунед", + uploadingFile: "Файли шумо бор шуда истодааст. Якчанд сония интизор шавед ва бори дигар кӯшиш кунед.", + loadingFile: "Боркунӣ...", + chooseFile: "Файл(ҳо)-ро интихоб кунед...", + confirmDelete: "Шумо мутмаин ҳастед, ки мехоҳед воридро тоза кунед?", + keyDuplicationError: "Ин арзиш бояд беназир бошад.", + addColumn: "Иловаи сутун", + addRow: "Иловаи сатр", + removeRow: "Нест кардан", + addPanel: "Илова кардан", + removePanel: "Нест кардан", + choices_Item: "Вариант", + matrix_column: "Сутун", + matrix_row: "Сатр", + savingData: "Натиҷа ба сервер сабт шуда истодаанд...", + savingDataError: "Хатогӣ ба амал омад, натиҷа сабт нашуд.", + savingDataSuccess: "Натиҷа бомуваффакият сабт шуд!", + saveAgainButton: "Бори дигар кӯшиш карданд", + timerMin: "дақ", + timerSec: "сон", + timerSpentAll: "Шумо {0} дар ин саҳифа ва {1} дар умум сарф кардед.", + timerSpentPage: "Шумо {0} дар ин саҳифа сарф кардед.", + timerSpentSurvey: "Шумо {0} дар ин тест сарф намудед.", + timerLimitAll: "Шумо {0} аз {1} дар ин саҳифа ва {2} аз {3} дар умум сарф кардед дар дохили ин тест.", + timerLimitPage: "Шумо {0} аз {1} дар ин саҳифа сарф кардед.", + timerLimitSurvey: "Шумо {0} аз {1} дар ҳамаи тест сарф кардед.", + cleanCaption: "Тоза кардан", + clearCaption: "Тоза кардан", + removeFileCaption: "Файлро нест кардан" + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["tg"] = tajikSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["tg"] = "тоҷикӣ"; + + + /***/ }), + + /***/ "./src/localization/thai.ts": + /*!**********************************!*\ + !*** ./src/localization/thai.ts ***! + \**********************************/ + /*! exports provided: thaiStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "thaiStrings", function() { return thaiStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + //Created by Padet Taweekunkan + + var thaiStrings = { + pagePrevText: "ก่อนหน้า", + pageNextText: "ถัดไป", + completeText: "สำเร็จ", + previewText: "ดูตัวอย่าง", + editText: "แก้ไข", + startSurveyText: "เริ่ม", + otherItemText: "อื่นๆ (โปรดระบุ)", + noneItemText: "ไม่มี", + selectAllItemText: "เลือกทั้งหมด", + progressText: "หน้าที่ {0} จาก {1}", + panelDynamicProgressText: "รายการที่ {0} จาก {1}", + questionsProgressText: "คำตอบที่ {0}/{1} จำนวนคำถาม", + emptySurvey: "ไม่มีหน้าเพจที่มองเห็น หรือ คำถามใน survey นี้", + completingSurvey: "ขอบคุณที่ทำ survey จนเสร็จ", + completingSurveyBefore: "รายการของเราแสดงว่าคุณได้ทำ survey เสร็จเรียบร้อยแล้ว", + loadingSurvey: "กำลังโหลด Survey...", + optionsCaption: "เลือก...", + value: "ข้อมูล", + requiredError: "กรุณาตอบคำถาม", + requiredErrorInPanel: "กรุณาตอบขั้นต่ำหนึ่งคำถาม", + requiredInAllRowsError: "กรุณาตอบคำถามในทุกๆแถว", + numericError: "ข้อมูลที่ใส่ต้องเป็นตัวเลข", + textMinLength: "กรุณาใส่ขั้นต่ำจำนวน {0} ตัวอักษร", + textMaxLength: "กรุณาใส่ไม่เกินจำนวน {0} ตัวอักษร", + textMinMaxLength: "กรุณาใส่ขั้นต่ำจำนวน {0} และไม่เกินจำนวน {1} ตัวอักษร", + minRowCountError: "กรุณาใส่ขั้นต่ำจำนวน {0} แถว", + minSelectError: "กรุณาเลือกอย่างน้อย {0} รายการ", + maxSelectError: "กรุณาเลือกไม่เกิน {0} รายการ", + numericMinMax: "'{0}' ต้องมากกว่าหรือเท่ากับ {1} และน้อยกว่าหรือเท่ากับ {2}", + numericMin: "'{0}' ต้องมากกว่าหรือเท่ากับ {1}", + numericMax: "'{0}' น้อยกว่าหรือเท่ากับ {1}", + invalidEmail: "กรุณาใส่อีเมล์แอดเดรสที่ถูกต้อง", + invalidExpression: "The expression: {0} ต้องรีเทิร์น 'true'.", + urlRequestError: "รีเควสรีเทิร์น error '{0}'. {1}", + urlGetChoicesError: "รีเควสรีเทิร์นข้อมูลว่างเปล่า หรือ 'path' property ไม่ถูกต้อง", + exceedMaxSize: "ขนาดไฟล์ต้องไม่เกิน {0}.", + otherRequiredError: "กรุณาใส่ค่าอื่น", + uploadingFile: "ไฟล์ของคุณกำลังอัพโหลดอยู่. กรุณารอสักครู่แล้วทำการลองอีกครั้ง", + loadingFile: "กำลังโหลด...", + chooseFile: "เลือกไฟล์...", + noFileChosen: "ไม่ไฟล์ที่เลือก", + confirmDelete: "คุณต้องการลบรายการนี้จริงหรือไม่?", + keyDuplicationError: "ข้อมูลนี้ต้องเป็น unique.", + addColumn: "เพิ่มคอลัมน์", + addRow: "เพิ่มแถว", + removeRow: "ลบ", + addPanel: "เพิ่ม", + removePanel: "ลบ", + choices_Item: "ชิ้น", + matrix_column: "คอลัมน์", + matrix_row: "แถว", + savingData: "ผลลัพท์กำลังบันทึกลงที่เซิร์ฟเวอร์...", + savingDataError: "มีความผิดพลาดเกิดขึ้นส่งผลให้ไม่สามารถบันทึกผลได้", + savingDataSuccess: "บันทึกสำเร็จแล้ว", + saveAgainButton: "รบกวนลองอีกครั้ง", + timerMin: "นาที", + timerSec: "วินาที", + timerSpentAll: "คุณใช้เวลา {0} บนหน้านี้และ {1} รวมทั้งหมด", + timerSpentPage: "คุณใช้เวลา {0} บนหน้านี้", + timerSpentSurvey: "คุณใช้เวลา {0} รวมทั้งหมด", + timerLimitAll: "คุณใช้เวลา {0} ของ {1} บนหน้านี้และ {2} ของ {3} รวมทั้งหมด", + timerLimitPage: "คุณใช้เวลา {0} ของ {1} บนหน้านี้", + timerLimitSurvey: "คุณใช้เวลา {0} ของ {1} รวมทั้งหมด", + cleanCaption: "คลีน", + clearCaption: "เคลียร์", + chooseFileCaption: "เลือกไฟล์", + removeFileCaption: "นำไฟล์นี้ออก", + booleanCheckedLabel: "ใช่", + booleanUncheckedLabel: "ไม่ใช่", + confirmRemoveFile: "คุณแน่ใจที่จะนำไฟล์นี้ออกใช่หรือไม่: {0}?", + confirmRemoveAllFiles: "คุณแน่ใจที่จะนำไฟล์ทั้งหมดออกใช่หรือไม่", + questionTitlePatternText: "ชื่อคำถาม", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["th"] = thaiStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["th"] = "ไทย"; + + + /***/ }), + + /***/ "./src/localization/traditional-chinese.ts": + /*!*************************************************!*\ + !*** ./src/localization/traditional-chinese.ts ***! + \*************************************************/ + /*! exports provided: traditionalChineseSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "traditionalChineseSurveyStrings", function() { return traditionalChineseSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var traditionalChineseSurveyStrings = { + pagePrevText: "上一頁", + pageNextText: "下一頁", + completeText: "提交問卷", + otherItemText: "填寫其他答案", + progressText: "第 {0} 頁, 共 {1} 頁", + emptySurvey: "問卷中沒有問題或頁面", + completingSurvey: "感謝您的參與!", + loadingSurvey: "問卷載入中...", + optionsCaption: "請選擇...", + requiredError: "請填寫此問題", + requiredInAllRowsError: "請填寫所有行中問題", + numericError: "答案必須是個數字", + textMinLength: "答案長度至少 {0} 個字元", + textMaxLength: "答案長度不能超過 {0} 個字元", + textMinMaxLength: "答案長度必須在 {0} - {1} 個字元之間", + minRowCountError: "最少需要填寫 {0} 行答案", + minSelectError: "最少需要選擇 {0} 項答案", + maxSelectError: "最多只能選擇 {0} 項答案", + numericMinMax: "答案 '{0}' 必須大於等於 {1} 且小於等於 {2}", + numericMin: "答案 '{0}' 必須大於等於 {1}", + numericMax: "答案 '{0}' 必須小於等於 {1}", + invalidEmail: "請輸入有效的 Email 地址", + urlRequestError: "載入選項時發生錯誤 '{0}': {1}", + urlGetChoicesError: "未能載入有效的選項或請求參數路徑有誤", + exceedMaxSize: "文件大小不能超過 {0}", + otherRequiredError: "請完成其他問題", + uploadingFile: "文件上傳中... 請耐心等待幾秒後重試", + addRow: "添加答案", + removeRow: "刪除答案", + choices_Item: "選項", + matrix_column: "列", + matrix_row: "行", + savingData: "正在將結果保存到服務器...", + savingDataError: "在保存結果過程中發生了錯誤,結果未能保存", + savingDataSuccess: "結果保存成功!", + saveAgainButton: "請重試" + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["zh-tw"] = traditionalChineseSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["zh-tw"] = "繁體中文"; + + + /***/ }), + + /***/ "./src/localization/turkish.ts": + /*!*************************************!*\ + !*** ./src/localization/turkish.ts ***! + \*************************************/ + /*! exports provided: turkishSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "turkishSurveyStrings", function() { return turkishSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var turkishSurveyStrings = { + pagePrevText: "Geri", + pageNextText: "İleri", + completeText: "Anketi Tamamla", + previewText: "Ön izleme", + editText: "Düzenle", + startSurveyText: "Başlat", + otherItemText: "Diğer (açıklayınız)", + noneItemText: "Yok", + selectAllItemText: "Hepsini seç", + progressText: "Sayfa {0} / {1}", + panelDynamicProgressText: "Kayıt {0} / {1}", + questionsProgressText: "Soruları cevapladı {0} / {1}", + emptySurvey: "Ankette görüntülenecek sayfa ya da soru mevcut değil.", + completingSurvey: "Anketimizi tamamladığınız için teşekkür ederiz.", + completingSurveyBefore: "Kayıtlarımız, bu anketi zaten tamamladığınızı gösteriyor.", + loadingSurvey: "Anket sunucudan yükleniyor ...", + optionsCaption: "Seçiniz ...", + value: "değer", + requiredError: "Lütfen soruya cevap veriniz", + requiredErrorInPanel: "Lütfen en az bir soruyu yanıtlayın.", + requiredInAllRowsError: "Lütfen tüm satırlardaki soruları cevaplayınız.", + numericError: "Girilen değer numerik olmalıdır", + textMinLength: "En az {0} sembol giriniz.", + textMaxLength: "Lütfen {0} karakterden az girin.", + textMinMaxLength: "Lütfen {0} ’den fazla ve {1} ’den az karakter girin.", + minRowCountError: "Lütfen en az {0} satırı doldurun.", + minSelectError: "Lütfen en az {0} seçeneği seçiniz.", + maxSelectError: "Lütfen {0} adetten fazla seçmeyiniz.", + numericMinMax: "The '{0}' should be equal or more than {1} and equal or less than {2}", + numericMin: "'{0}' değeri {1} değerine eşit veya büyük olmalıdır", + numericMax: "'{0}' değeri {1} değerine eşit ya da küçük olmalıdır.", + invalidEmail: "Lütfen geçerli bir eposta adresi giriniz.", + invalidExpression: "İfade: {0} 'true' döndürmelidir.", + urlRequestError: "Talebi şu hatayı döndü '{0}'. {1}", + urlGetChoicesError: "Talep herhangi bir veri dönmedi ya da 'path' özelliği hatalı.", + exceedMaxSize: "Dosya boyutu {0} değerini geçemez.", + otherRequiredError: "Lütfen diğer değerleri giriniz.", + uploadingFile: "Dosyanız yükleniyor. LÜtfen birkaç saniye bekleyin ve tekrar deneyin.", + loadingFile: "Yükleniyor...", + chooseFile: "Dosyaları seçin ...", + noFileChosen: "Dosya seçili değil", + confirmDelete: "Kaydı silmek istiyor musunuz?", + keyDuplicationError: "Bu değer benzersiz olmalıdır.", + addColumn: "Sütun ekleyin", + addRow: "Satır Ekle", + removeRow: "Kaldır", + addPanel: "Yeni ekle", + removePanel: "Kaldırmak", + choices_Item: "eşya", + matrix_column: "Sütun", + matrix_row: "Kürek çekmek", + savingData: "Sonuçlar sunucuya kaydediliyor ...", + savingDataError: "Bir hata oluştu ve sonuçları kaydedemedik.", + savingDataSuccess: "Sonuçlar başarıyla kaydedildi!", + saveAgainButton: "Tekrar deneyin", + timerMin: "min", + timerSec: "saniye", + timerSpentAll: "Bu sayfada {0} ve toplamda {1} harcadınız.", + timerSpentPage: "Bu sayfaya {0} harcadınız.", + timerSpentSurvey: "Toplamda {0} harcadınız.", + timerLimitAll: "Bu sayfaya {0} / {1} ve toplamda {2} / {3} harcadınız.", + timerLimitPage: "Bu sayfaya {0} / {1} harcadınız.", + timerLimitSurvey: "Toplamda {0} / {1} harcadınız.", + cleanCaption: "Temiz", + clearCaption: "Açık", + chooseFileCaption: "Dosya seçin", + removeFileCaption: "Bu dosyayı kaldır", + booleanCheckedLabel: "Evet", + booleanUncheckedLabel: "Hayır", + confirmRemoveFile: "Bu dosyayı kaldırmak istediğinizden emin misiniz: {0}?", + confirmRemoveAllFiles: "Tüm dosyaları kaldırmak istediğinizden emin misiniz?", + questionTitlePatternText: "Soru başlığı", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["tr"] = turkishSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["tr"] = "türkçe"; + + + /***/ }), + + /***/ "./src/localization/ukrainian.ts": + /*!***************************************!*\ + !*** ./src/localization/ukrainian.ts ***! + \***************************************/ + /*! exports provided: ukrainianSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ukrainianSurveyStrings", function() { return ukrainianSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var ukrainianSurveyStrings = { + pagePrevText: "Назад", + pageNextText: "Далі", + completeText: "Завершити", + previewText: "Попередній перегляд", + editText: "Редагувати", + startSurveyText: "Почати", + otherItemText: "Інше (будь ласка, опишіть)", + noneItemText: "Жоден", + selectAllItemText: "Вибрати все", + progressText: "Сторінка {0} з {1}", + panelDynamicProgressText: "Запис {0} із {1}", + questionsProgressText: "Відповіли на {0}/{1} питань", + emptySurvey: "Немає жодного питання.", + completingSurvey: "Дякуємо Вам за заповнення анкети!", + completingSurveyBefore: "Ви вже проходили це опитування.", + loadingSurvey: "Завантаження опитування...", + optionsCaption: "Вибрати...", + value: "значення", + requiredError: "Будь ласка, дайте відповідь.", + requiredErrorInPanel: "Будь ласка, дайте відповідь хоча б на одне питання.", + requiredInAllRowsError: "Будь ласка, дайте відповідь на питання в кожному рядку.", + numericError: "Відповідь повинна бути числом.", + textMinLength: "Будь ласка введіть більше {0} символів.", + textMaxLength: "Будь ласка введіть менше {0} символів.", + textMinMaxLength: "Будь ласка введіть більше {0} и менше {1} символів.", + minRowCountError: "Будь ласка, заповніть не менше {0} рядків.", + minSelectError: "Будь ласка, виберіть хоча б {0} варіантів.", + maxSelectError: "Будь ласка, виберіть не більше {0} варіантів.", + numericMinMax: "'{0}' повинно бути не менше ніж {1}, і не більше ніж {2}", + numericMin: "'{0}' повинно бути не менше ніж {1}", + numericMax: "'{0}' повинно бути не більше ніж {1}", + invalidEmail: "Будь ласка, введіть дійсну адресу електронної пошти.", + invalidExpression: "Вираз {0} повинен повертати 'true'.", + urlRequestError: "Запит повернув помилку '{0}'. {1}", + urlGetChoicesError: "Відповідь на запит повернулась порожньою або властивіть 'path' вказано невірно", + exceedMaxSize: "Розмір файлу не повинен перевищувати {0}.", + otherRequiredError: "Будь ласка, введіть дані в поле 'Інше'", + uploadingFile: "Ваш файл завантажується. Зачекайте декілька секунд і спробуйте знову.", + loadingFile: "Завантаження...", + chooseFile: "Виберіть файл(и)...", + noFileChosen: "Файл не вибрано", + confirmDelete: "Ви хочете видалити запис?", + keyDuplicationError: "Це значення повинно бути унікальним.", + addColumn: "Додати колонку", + addRow: "Додати рядок", + removeRow: "Видалити", + addPanel: "Додати нову", + removePanel: "Видалити", + choices_Item: "Варіант", + matrix_column: "Колонка", + matrix_row: "Рядок", + savingData: "Результати зберігаються на сервер...", + savingDataError: "Відбулася помилка, результат не був збережений.", + savingDataSuccess: "Резвультат успішно збережений!", + saveAgainButton: "Спробувати знову", + timerMin: "хв", + timerSec: "сек", + timerSpentAll: "Ви витратили {0} на цій сторінці і {1} загалом.", + timerSpentPage: "Ви витратили {0} на цій сторінці.", + timerSpentSurvey: "Ви витратили {0} протягом тесту.", + timerLimitAll: "Ви витратили {0} з {1} на цій сторінці і {2} з {3} для всього тесту.", + timerLimitPage: "Ви витратили {0} з {1} на цій сторінці.", + timerLimitSurvey: "Ви витратили {0} з {1} для всього тесту.", + cleanCaption: "Очистити", + clearCaption: "Очистити", + chooseFileCaption: "Виберіть файл", + removeFileCaption: "Видалити файл", + booleanCheckedLabel: "Так", + booleanUncheckedLabel: "Ні", + confirmRemoveFile: "Ви впевнені, що хочете видалити цей файл: {0}?", + confirmRemoveAllFiles: "Ви впевнені, що хочете видалити всі файли?", + questionTitlePatternText: "Назва запитання", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["ua"] = ukrainianSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["ua"] = "українська"; + + + /***/ }), + + /***/ "./src/localization/vietnamese.ts": + /*!****************************************!*\ + !*** ./src/localization/vietnamese.ts ***! + \****************************************/ + /*! exports provided: vietnameseSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "vietnameseSurveyStrings", function() { return vietnameseSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + //Uncomment this line on creating a translation file + + var vietnameseSurveyStrings = { + pagePrevText: "Trở về", + pageNextText: "Tiếp theo", + completeText: "Hoàn thành", + previewText: "Xem trước", + editText: "Chỉnh sửa", + startSurveyText: "Bắt đầu", + otherItemText: "Khác (mô tả)", + noneItemText: "Trống", + selectAllItemText: "Chọn tất cả", + progressText: "Trang {0} / {1}", + panelDynamicProgressText: "Dòng {0} / {1}", + questionsProgressText: "Đã trả lời {0}/{1} câu hỏi", + emptySurvey: "Không có trang hoặc câu hỏi nào được hiển thị trong cuộc khảo sát này.", + completingSurvey: "Cảm ơn đã hoàn thành khảo sát!", + completingSurveyBefore: "Hồ sơ chúng tôi cho thấy rằng bạn đã hoàn thành cuộc khảo sát này.", + loadingSurvey: "Đang tải khảo sát...", + optionsCaption: "Chọn...", + value: "Giá trị", + requiredError: "Vui lòng trả lời câu hỏi.", + requiredErrorInPanel: "Vui lòng trả lời ít nhất một câu hỏi.", + requiredInAllRowsError: "Vui lòng trả lời các câu hỏi trên tất cả các dòng.", + numericError: "Giá trị nên là kiểu số.", + textMinLength: "Vui lòng nhập ít nhất {0} kí tự.", + textMaxLength: "Vui lòng nhập ít hơn {0} kí tự.", + textMinMaxLength: "Vui lòng nhập nhiều hơn {0} hoặc ít hơn {1} kí tự.", + minRowCountError: "Vui lòng nhập ít nhất {0} dòng.", + minSelectError: "Vui lòng chọn ít nhất {0} loại.", + maxSelectError: "Vui lòng không chọn nhiều hơn {0} loại.", + numericMinMax: "Giá trị '{0}' nên bằng hoặc lớn hơn {1} và bằng hoặc nhỏ hơn {2}", + numericMin: "Giá trị '{0}' nên bằng hoặc lớn hơn {1}", + numericMax: "Giá trị '{0}' nên bằng hoặc nhỏ hơn {1}", + invalidEmail: "Vui lòng điền địa chỉ email hợp lệ.", + invalidExpression: "Biểu thức: {0} nên trả về 'true'.", + urlRequestError: "Yêu cầu trả về lỗi '{0}'. {1}", + urlGetChoicesError: "Yêu cầu trả về dữ liệu trống hoặc thuộc tính 'path' không đúng", + exceedMaxSize: "Kích thước tập tin không nên vượt quá {0}.", + otherRequiredError: "Vui lòng điền giá trị khác.", + uploadingFile: "Tập tin đang được tải lên. Vui lòng chờ một lúc và thử lại.", + loadingFile: "Đang tải...", + chooseFile: "Chọn các tập tin...", + noFileChosen: "Không có tập tin nào được chọn", + confirmDelete: "Bạn muốn xóa dòng này?", + keyDuplicationError: "Giá trị này không nên bị trùng lặp.", + addColumn: "Thêm cột", + addRow: "Thêm dòng", + removeRow: "Xóa", + addPanel: "Thêm mới", + removePanel: "Xóa", + choices_Item: "mục", + matrix_column: "Cột", + matrix_row: "Dòng", + savingData: "Kết quả đang lưu lại trên hệ thống...", + savingDataError: "Có lỗi xảy ra và chúng ta không thể lưu kết quả.", + savingDataSuccess: "Kết quả đã được lưu thành công!", + saveAgainButton: "Thử lại", + timerMin: "phút", + timerSec: "giây", + timerSpentAll: "Bạn đã sử dụng {0} trên trang này và {1} trên toàn bộ.", + timerSpentPage: "Bạn đã sử dụng {0} trên trang.", + timerSpentSurvey: "Bạn đã sử dụng {0} trên toàn bộ.", + timerLimitAll: "Bạn đã sử dụng {0} / {1} trên trang này và {2} / {3} trên toàn bộ.", + timerLimitPage: "Bạn đã sử dụng {0} / {1} trên trang này.", + timerLimitSurvey: "Bạn đã sử dụng {0} / {1} trên toàn bộ.", + cleanCaption: "Xóa tất cả", + clearCaption: "Xóa", + chooseFileCaption: "Chọn tập tin", + removeFileCaption: "Xóa tập tin", + booleanCheckedLabel: "Có", + booleanUncheckedLabel: "Không", + confirmRemoveFile: "Bạn có chắc chắn muốn xóa tập tin này: {0}?", + confirmRemoveAllFiles: "Bạn có chắc chắn muốn xóa toàn bộ tập tin?", + questionTitlePatternText: "Tiêu đề câu hỏi", + }; + //Uncomment these two lines on creating a translation file. You should replace "en" and enStrings with your locale ("fr", "de" and so on) and your variable. + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["vi"] = vietnameseSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["vi"] = "Việt Nam"; + + + /***/ }), + + /***/ "./src/localization/welsh.ts": + /*!***********************************!*\ + !*** ./src/localization/welsh.ts ***! + \***********************************/ + /*! exports provided: welshSurveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "welshSurveyStrings", function() { return welshSurveyStrings; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var welshSurveyStrings = { + pagePrevText: "Blaenorol", + pageNextText: "Nesaf", + completeText: "Cwblhau", + previewText: "Rhagolwg", + editText: "Golygu", + startSurveyText: "Dechrau", + otherItemText: "Arall (disgrifiwch)", + noneItemText: "Dim", + selectAllItemText: "Dewis y Cyfan ", + progressText: "Tudalen {0} o {1}", + panelDynamicProgressText: "Cofnod {0} o {1}", + questionsProgressText: "Wedi ateb {0}/{1} cwestiwn", + emptySurvey: "Does dim modd gweld tudalen na chwestiwn yn yr arolwg.", + completingSurvey: "Diolch am lenwi’r holiadur!", + completingSurveyBefore: "Rydych chi wedi llenwi’r arolwg hwn yn barod yn ôl ein cofnodion.", + loadingSurvey: "Wrthi’n Llwytho’r Arolwg...", + optionsCaption: "Dewiswch...", + value: "gwerth", + requiredError: "Atebwch y cwestiwn.", + requiredErrorInPanel: "Atebwch o leiaf un cwestiwn.", + requiredInAllRowsError: "Atebwch y cwestiynau ym mhob rhes.", + numericError: "Dylai’r gwerth fod yn rhif.", + textMinLength: "Rhowch o leiaf {0} nod.", + textMaxLength: "Rhowch lai na {0} nod.", + textMinMaxLength: "Rhowch o leiaf {0} nod ond dim mwy na {1}.", + minRowCountError: "Llenwch o leiaf {0} rhes.", + minSelectError: "Dewiswch o leiaf {0} amrywiolyn.", + maxSelectError: "Peidiwch â dewis mwy na {0} amrywiolyn.", + numericMinMax: "Dylai’r '{0}' fod yr un fath â {1} neu’n fwy, a’r fath â {2} neu’n llai", + numericMin: "Dylai’r '{0}' fod yr un fath â {1} neu’n fwy", + numericMax: "Dylai’r '{0}' fod yr un fath â {1} neu’n llai", + invalidEmail: "Rhowch gyfeiriad e-bost dilys.", + invalidExpression: "Dylai’r mynegiad {0} arwain at 'true'.", + urlRequestError: "Roedd y cais wedi arwain at y gwall '{0}'. {1}", + urlGetChoicesError: "Roedd y cais wedi arwain at ddata gwag neu mae priodwedd y ‘path’ yn anghywir ", + exceedMaxSize: "Ddylai’r ffeil ddim bod yn fwy na {0}.", + otherRequiredError: "Rhowch y gwerth arall.", + uploadingFile: "Mae eich ffeil wrthi’n llwytho i fyny. Arhoswch ychydig o eiliadau a rhoi cynnig arall arni.", + loadingFile: "Wrthi’n llwytho...", + chooseFile: "Dewiswch ffeil(iau)...", + noFileChosen: "Heb ddewis ffeil ", + confirmDelete: "Ydych chi am ddileu’r cofnod?", + keyDuplicationError: "Dylai’r gwerth hwn fod yn unigryw.", + addColumn: "Ychwanegu colofn ", + addRow: "Ychwanegu rhes", + removeRow: "Tynnu", + addPanel: "Ychwanegu o’r newydd", + removePanel: "Tynnu", + choices_Item: "eitem", + matrix_column: "Colofn", + matrix_row: "Rhes", + savingData: "Mae’r canlyniadau’n cael eu cadw ar y gweinydd...", + savingDataError: "Roedd gwall a doedd dim modd cadw’r canlyniadau.", + savingDataSuccess: "Wedi llwyddo i gadw’r canlyniadau!", + saveAgainButton: "Rhowch gynnig arall arni", + timerMin: "mun", + timerSec: "eil", + timerSpentAll: "Rydych chi wedi treulio {0} ar y dudalen hon a {1} gyda’i gilydd.", + timerSpentPage: "Rydych chi wedi treulio {0} ar y dudalen hon.", + timerSpentSurvey: "Rydych chi wedi treulio {0} gyda’i gilydd.", + timerLimitAll: "Rydych chi wedi treulio {0} o {1} ar y dudalen hon a {2} o {3} gyda’i gilydd.", + timerLimitPage: "Rydych chi wedi treulio {0} o {1} ar y dudalen hon.", + timerLimitSurvey: "Rydych chi wedi treulio {0} o {1} gyda’i gilydd.", + cleanCaption: "Glanhau", + clearCaption: "Clirio", + chooseFileCaption: "Dewiswch ffeil ", + removeFileCaption: "Tynnu’r ffeil hon ", + booleanCheckedLabel: "Iawn", + booleanUncheckedLabel: "Na", + confirmRemoveFile: "Ydych chi’n siŵr eich bod am dynnu’r ffeil hon: {0}?", + confirmRemoveAllFiles: "Ydych chi’n siŵr eich bod am dynnu pob ffeil?", + questionTitlePatternText: "Teitl y Cwestiwn ", + }; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].locales["cy"] = welshSurveyStrings; + survey_core__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].localeNames["cy"] = "cymraeg"; + + + /***/ }), + + /***/ "./src/main.scss": + /*!***********************!*\ + !*** ./src/main.scss ***! + \***********************/ + /*! no static exports found */ + /***/ (function(module, exports, __webpack_require__) { + + // extracted by mini-css-extract-plugin + + /***/ }), + + /***/ "./src/martixBase.ts": + /*!***************************!*\ + !*** ./src/martixBase.ts ***! + \***************************/ + /*! exports provided: QuestionMatrixBaseModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixBaseModel", function() { return QuestionMatrixBaseModel; }); + /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + /** + * A Model for a matrix base question. + */ + var QuestionMatrixBaseModel = /** @class */ (function (_super) { + __extends(QuestionMatrixBaseModel, _super); + function QuestionMatrixBaseModel(name) { + var _this = _super.call(this, name) || this; + _this.generatedVisibleRows = null; + _this.generatedTotalRow = null; + _this.filteredRows = null; + _this.filteredColumns = null; + _this.columns = _this.createColumnValues(); + _this.rows = _this.createItemValues("rows"); + return _this; + } + QuestionMatrixBaseModel.prototype.createColumnValues = function () { + return this.createItemValues("columns"); + }; + QuestionMatrixBaseModel.prototype.getType = function () { + return "matrixbase"; + }; + Object.defineProperty(QuestionMatrixBaseModel.prototype, "isCompositeQuestion", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixBaseModel.prototype, "showHeader", { + /** + * Set this property to false, to hide table header. The default value is true. + */ + get: function () { + return this.getPropertyValue("showHeader"); + }, + set: function (val) { + this.setPropertyValue("showHeader", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixBaseModel.prototype, "columns", { + /** + * The list of columns. A column has a value and an optional text + */ + get: function () { + return this.getPropertyValue("columns"); + }, + set: function (newValue) { + this.setPropertyValue("columns", newValue); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixBaseModel.prototype, "visibleColumns", { + get: function () { + return !!this.filteredColumns ? this.filteredColumns : this.columns; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixBaseModel.prototype, "rows", { + /** + * The list of rows. A row has a value and an optional text + */ + get: function () { + return this.getPropertyValue("rows"); + }, + set: function (newValue) { + var newRows = this.processRowsOnSet(newValue); + this.setPropertyValue("rows", newRows); + this.filterItems(); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixBaseModel.prototype.processRowsOnSet = function (newRows) { + return newRows; + }; + QuestionMatrixBaseModel.prototype.getVisibleRows = function () { + return []; + }; + Object.defineProperty(QuestionMatrixBaseModel.prototype, "visibleRows", { + /** + * Returns the list of visible rows as model objects. + * @see rowsVisibleIf + */ + get: function () { + return this.getVisibleRows(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixBaseModel.prototype, "rowsVisibleIf", { + /** + * An expression that returns true or false. It runs against each row item and if for this item it returns true, then the item is visible otherwise the item becomes invisible. Please use {item} to get the current item value in the expression. + * @see visibleIf + */ + get: function () { + return this.getPropertyValue("rowsVisibleIf", ""); + }, + set: function (val) { + this.setPropertyValue("rowsVisibleIf", val); + this.filterItems(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixBaseModel.prototype, "columnsVisibleIf", { + /** + * An expression that returns true or false. It runs against each column item and if for this item it returns true, then the item is visible otherwise the item becomes invisible. Please use {item} to get the current item value in the expression. + * @see rowsVisibleIf + */ + get: function () { + return this.getPropertyValue("columnsVisibleIf", ""); + }, + set: function (val) { + this.setPropertyValue("columnsVisibleIf", val); + this.filterItems(); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixBaseModel.prototype.runCondition = function (values, properties) { + _super.prototype.runCondition.call(this, values, properties); + this.runItemsCondition(values, properties); + }; + QuestionMatrixBaseModel.prototype.filterItems = function () { + if (this.areInvisibleElementsShowing) { + this.onRowsChanged(); + return false; + } + if (this.isLoadingFromJson || !this.data) + return false; + return this.runItemsCondition(this.getDataFilteredValues(), this.getDataFilteredProperties()); + }; + QuestionMatrixBaseModel.prototype.onColumnsChanged = function () { }; + QuestionMatrixBaseModel.prototype.onRowsChanged = function () { + this.fireCallback(this.visibleRowsChangedCallback); + }; + QuestionMatrixBaseModel.prototype.shouldRunColumnExpression = function () { + return !this.survey || !this.survey.areInvisibleElementsShowing; + }; + QuestionMatrixBaseModel.prototype.hasRowsAsItems = function () { + return true; + }; + QuestionMatrixBaseModel.prototype.runItemsCondition = function (values, properties) { + var oldVisibleRows = null; + if (!!this.filteredRows && !_helpers__WEBPACK_IMPORTED_MODULE_4__["Helpers"].isValueEmpty(this.defaultValue)) { + oldVisibleRows = []; + for (var i = 0; i < this.filteredRows.length; i++) { + oldVisibleRows.push(this.filteredRows[i]); + } + } + var hasChanges = this.hasRowsAsItems() && this.runConditionsForRows(values, properties); + var hasColumnsChanged = this.runConditionsForColumns(values, properties); + hasChanges = hasColumnsChanged || hasChanges; + if (hasChanges) { + if (this.isClearValueOnHidden && (!!this.filteredColumns || !!this.filteredRows)) { + this.clearIncorrectValues(); + } + if (!!oldVisibleRows) { + this.restoreNewVisibleRowsValues(oldVisibleRows); + } + this.clearGeneratedRows(); + if (hasColumnsChanged) { + this.onColumnsChanged(); + } + this.onRowsChanged(); + } + return hasChanges; + }; + QuestionMatrixBaseModel.prototype.clearGeneratedRows = function () { + this.generatedVisibleRows = null; + }; + QuestionMatrixBaseModel.prototype.runConditionsForRows = function (values, properties) { + var showInvisibile = !!this.survey && this.survey.areInvisibleElementsShowing; + var runner = !showInvisibile && !!this.rowsVisibleIf + ? new _conditions__WEBPACK_IMPORTED_MODULE_3__["ConditionRunner"](this.rowsVisibleIf) + : null; + this.filteredRows = []; + var hasChanged = _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].runConditionsForItems(this.rows, this.filteredRows, runner, values, properties, !showInvisibile); + if (this.filteredRows.length === this.rows.length) { + this.filteredRows = null; + } + return hasChanged; + }; + QuestionMatrixBaseModel.prototype.runConditionsForColumns = function (values, properties) { + var useColumnsExpression = !!this.survey && !this.survey.areInvisibleElementsShowing; + var runner = useColumnsExpression && !!this.columnsVisibleIf + ? new _conditions__WEBPACK_IMPORTED_MODULE_3__["ConditionRunner"](this.columnsVisibleIf) + : null; + this.filteredColumns = []; + var hasChanged = _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].runConditionsForItems(this.columns, this.filteredColumns, runner, values, properties, this.shouldRunColumnExpression()); + if (this.filteredColumns.length === this.columns.length) { + this.filteredColumns = null; + } + return hasChanged; + }; + QuestionMatrixBaseModel.prototype.clearIncorrectValues = function () { + var val = this.value; + if (!val) + return; + var newVal = null; + var isChanged = false; + var rows = !!this.filteredRows ? this.filteredRows : this.rows; + var columns = !!this.filteredColumns ? this.filteredColumns : this.columns; + for (var key in val) { + if (_itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getItemByValue(rows, key) && + _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getItemByValue(columns, val[key])) { + if (newVal == null) + newVal = {}; + newVal[key] = val[key]; + } + else { + isChanged = true; + } + } + if (isChanged) { + this.value = newVal; + } + _super.prototype.clearIncorrectValues.call(this); + }; + QuestionMatrixBaseModel.prototype.clearInvisibleValuesInRows = function () { + if (this.isEmpty()) + return; + var newData = this.getUnbindValue(this.value); + var rows = this.rows; + for (var i = 0; i < rows.length; i++) { + var key = rows[i].value; + if (!!newData[key] && !rows[i].isVisible) { + delete newData[key]; + } + } + if (this.isTwoValueEquals(newData, this.value)) + return; + this.value = newData; + }; + QuestionMatrixBaseModel.prototype.restoreNewVisibleRowsValues = function (oldVisibleRows) { + var rows = !!this.filteredRows ? this.filteredRows : this.rows; + var val = this.defaultValue; + var newValue = this.getUnbindValue(this.value); + var isChanged = false; + for (var key in val) { + if (_itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getItemByValue(rows, key) && + !_itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getItemByValue(oldVisibleRows, key)) { + if (newValue == null) + newValue = {}; + newValue[key] = val[key]; + isChanged = true; + } + } + if (isChanged) { + this.value = newValue; + } + }; + QuestionMatrixBaseModel.prototype.needResponsiveWidth = function () { + //TODO: make it mor intelligent + return true; + }; + return QuestionMatrixBaseModel; + }(_question__WEBPACK_IMPORTED_MODULE_1__["Question"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_2__["Serializer"].addClass("matrixbase", [ + "columnsVisibleIf:condition", + "rowsVisibleIf:condition", + { name: "showHeader:boolean", default: true } + ], undefined, "question"); + + + /***/ }), + + /***/ "./src/page.ts": + /*!*********************!*\ + !*** ./src/page.ts ***! + \*********************/ + /*! exports provided: PageModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PageModel", function() { return PageModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _panel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./panel */ "./src/panel.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + /** + * The page object. It has elements collection, that contains questions and panels. + */ + var PageModel = /** @class */ (function (_super) { + __extends(PageModel, _super); + function PageModel(name) { + if (name === void 0) { name = ""; } + var _this = _super.call(this, name) || this; + _this.hasShownValue = false; + /** + * Time in seconds end-user spent on this page + */ + _this.timeSpent = 0; + _this.locTitle.onGetTextCallback = function (text) { + if (_this.canShowPageNumber() && text) + return _this.num + ". " + text; + return text; + }; + _this.createLocalizableString("navigationTitle", _this, true); + _this.createLocalizableString("navigationDescription", _this, true); + return _this; + } + PageModel.prototype.getType = function () { + return "page"; + }; + PageModel.prototype.toString = function () { + return this.name; + }; + Object.defineProperty(PageModel.prototype, "isPage", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + PageModel.prototype.canShowPageNumber = function () { + return this.survey && this.survey.showPageNumbers; + }; + PageModel.prototype.canShowTitle = function () { + return this.survey && this.survey.showPageTitles; + }; + Object.defineProperty(PageModel.prototype, "navigationTitle", { + /** + * Use this property to show title in navigation buttons. If the value is empty then page name is used. + * @see survey.progressBarType + */ + get: function () { + return this.getLocalizableStringText("navigationTitle"); + }, + set: function (val) { + this.setLocalizableStringText("navigationTitle", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PageModel.prototype, "locNavigationTitle", { + get: function () { + return this.getLocalizableString("navigationTitle"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PageModel.prototype, "navigationDescription", { + get: function () { + return this.getLocalizableStringText("navigationDescription"); + }, + set: function (val) { + this.setLocalizableStringText("navigationDescription", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PageModel.prototype, "locNavigationDescription", { + get: function () { + return this.getLocalizableString("navigationDescription"); + }, + enumerable: false, + configurable: true + }); + PageModel.prototype.navigationLocStrChanged = function () { + this.locNavigationTitle.strChanged(); + this.locNavigationDescription.strChanged(); + }; + Object.defineProperty(PageModel.prototype, "passed", { + get: function () { + return this.getPropertyValue("passed", false); + }, + set: function (val) { + this.setPropertyValue("passed", val); + }, + enumerable: false, + configurable: true + }); + PageModel.prototype.delete = function () { + if (!!this.survey) { + this.removeSelfFromList(this.survey.pages); + } + }; + PageModel.prototype.onFirstRendering = function () { + if (this.wasShown) + return; + _super.prototype.onFirstRendering.call(this); + }; + Object.defineProperty(PageModel.prototype, "visibleIndex", { + /** + * The visible index of the page. It has values from 0 to visible page count - 1. + * @see SurveyModel.visiblePages + * @see SurveyModel.pages + */ + get: function () { + return this.getPropertyValue("visibleIndex", -1); + }, + set: function (val) { + this.setPropertyValue("visibleIndex", val); + }, + enumerable: false, + configurable: true + }); + PageModel.prototype.canRenderFirstRows = function () { + return !this.isDesignMode || this.visibleIndex == 0; + }; + Object.defineProperty(PageModel.prototype, "isStarted", { + /** + * Returns true, if the page is started page in the survey. It can be shown on the start only and the end-user could not comeback to it after it passed it. + */ + get: function () { + return this.survey && this.survey.isPageStarted(this); + }, + enumerable: false, + configurable: true + }); + PageModel.prototype.calcCssClasses = function (css) { + var classes = { page: {}, pageTitle: "", pageDescription: "", row: "", rowMultiple: "" }; + this.copyCssClasses(classes.page, css.page); + if (!!css.pageTitle) { + classes.pageTitle = css.pageTitle; + } + if (!!css.pageDescription) { + classes.pageDescription = css.pageDescription; + } + if (!!css.row) { + classes.row = css.row; + } + if (!!css.rowMultiple) { + classes.rowMultiple = css.rowMultiple; + } + if (this.survey) { + this.survey.updatePageCssClasses(this, classes); + } + return classes; + }; + Object.defineProperty(PageModel.prototype, "cssTitle", { + get: function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_2__["CssClassBuilder"]() + .append(this.cssClasses.page.title) + .toString(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PageModel.prototype, "navigationButtonsVisibility", { + /** + * Set this property to "hide" to make "Prev", "Next" and "Complete" buttons are invisible for this page. Set this property to "show" to make these buttons visible, even if survey showNavigationButtons property is false. + * @see SurveyMode.showNavigationButtons + */ + get: function () { + return this.getPropertyValue("navigationButtonsVisibility"); + }, + set: function (val) { + this.setPropertyValue("navigationButtonsVisibility", val.toLowerCase()); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PageModel.prototype, "wasShown", { + /** + * The property returns true, if the page has been shown to the end-user. + */ + get: function () { + return this.hasShownValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PageModel.prototype, "hasShown", { + get: function () { + return this.wasShown; + }, + enumerable: false, + configurable: true + }); + PageModel.prototype.setWasShown = function (val) { + if (val == this.hasShownValue) + return; + this.hasShownValue = val; + if (this.isDesignMode || val !== true) + return; + var els = this.elements; + for (var i = 0; i < els.length; i++) { + if (els[i].isPanel) { + els[i].randomizeElements(this.areQuestionsRandomized); + } + } + this.randomizeElements(this.areQuestionsRandomized); + }; + Object.defineProperty(PageModel.prototype, "areQuestionsRandomized", { + /** + * The property returns true, if the elements are randomized on the page + * @see hasShown + * @see questionsOrder + * @see SurveyModel.questionsOrder + */ + get: function () { + var order = this.questionsOrder == "default" && this.survey + ? this.survey.questionsOrder + : this.questionsOrder; + return order == "random"; + }, + enumerable: false, + configurable: true + }); + /** + * Call it to scroll to the page top. + */ + PageModel.prototype.scrollToTop = function () { + if (!!this.survey) { + this.survey.scrollElementToTop(this, null, this, this.id); + } + }; + // public get timeSpent(): number { + // return this.getPropertyValue("timeSpent", 0); + // } + // public set timeSpent(val: number) { + // this.setPropertyValue("timeSpent", val); + // } + /** + * Returns the list of all panels in the page + */ + PageModel.prototype.getPanels = function (visibleOnly, includingDesignTime) { + if (visibleOnly === void 0) { visibleOnly = false; } + if (includingDesignTime === void 0) { includingDesignTime = false; } + var result = new Array(); + this.addPanelsIntoList(result, visibleOnly, includingDesignTime); + return result; + }; + Object.defineProperty(PageModel.prototype, "maxTimeToFinish", { + /** + * The maximum time in seconds that end-user has to complete the page. If the value is 0 or less, the end-user has unlimited number of time to finish the page. + * @see startTimer + * @see SurveyModel.maxTimeToFinishPage + */ + get: function () { + return this.getPropertyValue("maxTimeToFinish", 0); + }, + set: function (val) { + this.setPropertyValue("maxTimeToFinish", val); + }, + enumerable: false, + configurable: true + }); + PageModel.prototype.onNumChanged = function (value) { }; + PageModel.prototype.onVisibleChanged = function () { + if (this.isRandomizing) + return; + _super.prototype.onVisibleChanged.call(this); + if (this.survey != null) { + this.survey.pageVisibilityChanged(this, this.isVisible); + } + }; + PageModel.prototype.dragDropStart = function (src, target, nestedPanelDepth) { + if (nestedPanelDepth === void 0) { nestedPanelDepth = -1; } + this.dragDropInfo = new _panel__WEBPACK_IMPORTED_MODULE_1__["DragDropInfo"](src, target, nestedPanelDepth); + }; + PageModel.prototype.dragDropMoveTo = function (destination, isBottom, isEdge) { + if (isBottom === void 0) { isBottom = false; } + if (isEdge === void 0) { isEdge = false; } + if (!this.dragDropInfo) + return false; + this.dragDropInfo.destination = destination; + this.dragDropInfo.isBottom = isBottom; + this.dragDropInfo.isEdge = isEdge; + this.correctDragDropInfo(this.dragDropInfo); + if (!this.dragDropCanDropTagert()) + return false; + if (!this.dragDropCanDropSource() || !this.dragDropAllowFromSurvey()) { + if (!!this.dragDropInfo.source) { + var row = this.dragDropFindRow(this.dragDropInfo.target); + this.updateRowsRemoveElementFromRow(this.dragDropInfo.target, row); + } + return false; + } + this.dragDropAddTarget(this.dragDropInfo); + return true; + }; + PageModel.prototype.correctDragDropInfo = function (dragDropInfo) { + if (!dragDropInfo.destination) + return; + var panel = dragDropInfo.destination.isPanel + ? dragDropInfo.destination + : null; + if (!panel) + return; + if (!dragDropInfo.target.isLayoutTypeSupported(panel.getChildrenLayoutType())) { + dragDropInfo.isEdge = true; + } + }; + PageModel.prototype.dragDropAllowFromSurvey = function () { + var dest = this.dragDropInfo.destination; + if (!dest || !this.survey) + return true; + var insertBefore = null; + var insertAfter = null; + var parent = dest.isPage || (!this.dragDropInfo.isEdge && dest.isPanel) + ? dest + : dest.parent; + if (!dest.isPage) { + var container = dest.parent; + if (!!container) { + var elements = container.elements; + var index = elements.indexOf(dest); + if (index > -1) { + insertBefore = dest; + insertAfter = dest; + if (this.dragDropInfo.isBottom) { + insertBefore = + index < elements.length - 1 ? elements[index + 1] : null; + } + else { + insertAfter = index > 0 ? elements[index - 1] : null; + } + } + } + } + var options = { + target: this.dragDropInfo.target, + source: this.dragDropInfo.source, + parent: parent, + insertAfter: insertAfter, + insertBefore: insertBefore, + }; + return this.survey.dragAndDropAllow(options); + }; + PageModel.prototype.dragDropFinish = function (isCancel) { + if (isCancel === void 0) { isCancel = false; } + if (!this.dragDropInfo) + return; + var target = this.dragDropInfo.target; + var src = this.dragDropInfo.source; + var row = this.dragDropFindRow(target); + var targetIndex = this.dragDropGetElementIndex(target, row); + this.updateRowsRemoveElementFromRow(target, row); + var elementsToSetSWNL = []; + var elementsToResetSWNL = []; + if (!isCancel && !!row) { + var isSamePanel = false; + if (this.isDesignMode && _settings__WEBPACK_IMPORTED_MODULE_3__["settings"].supportCreatorV2) { + var srcRow = src && src.parent && src.parent.dragDropFindRow(src); + if (row.panel.elements[targetIndex] && row.panel.elements[targetIndex].startWithNewLine && row.elements.length > 1) { + elementsToSetSWNL.push(target); + elementsToResetSWNL.push(row.panel.elements[targetIndex]); + } + if (target.startWithNewLine && row.elements.length > 1 && (!row.panel.elements[targetIndex] || !row.panel.elements[targetIndex].startWithNewLine)) { + elementsToResetSWNL.push(target); + } + if (srcRow && srcRow.elements[0] === src && srcRow.elements[1]) { + elementsToSetSWNL.push(srcRow.elements[1]); + } + if (row.elements.length <= 1) { + elementsToSetSWNL.push(target); + } + } + if (!!src && !!src.parent) { + this.survey.startMovingQuestion(); + isSamePanel = row.panel == src.parent; + if (isSamePanel) { + row.panel.dragDropMoveElement(src, target, targetIndex); + targetIndex = -1; + } + else { + src.parent.removeElement(src); + } + } + if (targetIndex > -1) { + row.panel.addElement(target, targetIndex); + } + this.survey.stopMovingQuestion(); + } + elementsToSetSWNL.map(function (e) { e.startWithNewLine = true; }); + elementsToResetSWNL.map(function (e) { e.startWithNewLine = false; }); + this.dragDropInfo = null; + return !isCancel ? target : null; + }; + PageModel.prototype.dragDropGetElementIndex = function (target, row) { + if (!row) + return -1; + var index = row.elements.indexOf(target); + if (row.index == 0) + return index; + var prevRow = row.panel.rows[row.index - 1]; + var prevElement = prevRow.elements[prevRow.elements.length - 1]; + return index + row.panel.elements.indexOf(prevElement) + 1; + }; + PageModel.prototype.dragDropCanDropTagert = function () { + var destination = this.dragDropInfo.destination; + if (!destination || destination.isPage) + return true; + return this.dragDropCanDropCore(this.dragDropInfo.target, destination); + }; + PageModel.prototype.dragDropCanDropSource = function () { + var source = this.dragDropInfo.source; + if (!source) + return true; + var destination = this.dragDropInfo.destination; + if (!this.dragDropCanDropCore(source, destination)) + return false; + if (this.isDesignMode && _settings__WEBPACK_IMPORTED_MODULE_3__["settings"].supportCreatorV2) { + if (!source.startWithNewLine && destination.startWithNewLine) + return true; + var row = this.dragDropFindRow(destination); + if (row && row.elements.length == 1) + return true; + } + return this.dragDropCanDropNotNext(source, destination, this.dragDropInfo.isEdge, this.dragDropInfo.isBottom); + }; + PageModel.prototype.dragDropCanDropCore = function (target, destination) { + if (!destination) + return true; + if (this.dragDropIsSameElement(destination, target)) + return false; + if (target.isPanel) { + var pnl = target; + if (pnl.containsElement(destination) || + !!pnl.getElementByName(destination.name)) + return false; + } + return true; + }; + PageModel.prototype.dragDropCanDropNotNext = function (source, destination, isEdge, isBottom) { + if (!destination || (destination.isPanel && !isEdge)) + return true; + if (typeof source.parent === "undefined" || source.parent !== destination.parent) + return true; + var pnl = source.parent; + var srcIndex = pnl.elements.indexOf(source); + var destIndex = pnl.elements.indexOf(destination); + if (destIndex < srcIndex && !isBottom) + destIndex--; + if (isBottom) + destIndex++; + return srcIndex < destIndex + ? destIndex - srcIndex > 1 + : srcIndex - destIndex > 0; + }; + PageModel.prototype.dragDropIsSameElement = function (el1, el2) { + return el1 == el2 || el1.name == el2.name; + }; + PageModel.prototype.ensureRowsVisibility = function () { + _super.prototype.ensureRowsVisibility.call(this); + this.getPanels().forEach(function (panel) { return panel.ensureRowsVisibility(); }); + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: -1, onSet: function (val, target) { return target.onNumChanged(val); } }) + ], PageModel.prototype, "num", void 0); + return PageModel; + }(_panel__WEBPACK_IMPORTED_MODULE_1__["PanelModelBase"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("page", [ + { + name: "navigationButtonsVisibility", + default: "inherit", + choices: ["inherit", "show", "hide"], + }, + { name: "maxTimeToFinish:number", default: 0, minValue: 0 }, + { + name: "navigationTitle", + visibleIf: function (obj) { + return !!obj.survey && obj.survey.progressBarType === "buttons"; + }, + serializationProperty: "locNavigationTitle", + }, + { + name: "navigationDescription", + visibleIf: function (obj) { + return !!obj.survey && obj.survey.progressBarType === "buttons"; + }, + serializationProperty: "locNavigationDescription", + }, + { name: "title:text", serializationProperty: "locTitle" }, + { name: "description:text", serializationProperty: "locDescription" }, + ], function () { + return new PageModel(); + }, "panelbase"); + + + /***/ }), + + /***/ "./src/panel.ts": + /*!**********************!*\ + !*** ./src/panel.ts ***! + \**********************/ + /*! exports provided: DragDropInfo, QuestionRowModel, PanelModelBase, PanelModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DragDropInfo", function() { return DragDropInfo; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRowModel", function() { return QuestionRowModel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PanelModelBase", function() { return PanelModelBase; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PanelModel", function() { return PanelModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./error */ "./src/error.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + + + + + + var DragDropInfo = /** @class */ (function () { + function DragDropInfo(source, target, nestedPanelDepth) { + if (nestedPanelDepth === void 0) { nestedPanelDepth = -1; } + this.source = source; + this.target = target; + this.nestedPanelDepth = nestedPanelDepth; + } + return DragDropInfo; + }()); + + var QuestionRowModel = /** @class */ (function (_super) { + __extends(QuestionRowModel, _super); + function QuestionRowModel(panel) { + var _this = _super.call(this) || this; + _this.panel = panel; + _this._scrollableParent = undefined; + _this._updateVisibility = undefined; + _this.idValue = QuestionRowModel.getRowId(); + _this.visible = panel.areInvisibleElementsShowing; + _this.createNewArray("elements"); + _this.createNewArray("visibleElements"); + return _this; + } + QuestionRowModel.getRowId = function () { + return "pr_" + QuestionRowModel.rowCounter++; + }; + QuestionRowModel.prototype.startLazyRendering = function (rowContainerDiv, findScrollableContainer) { + var _this = this; + if (findScrollableContainer === void 0) { findScrollableContainer = _utils_utils__WEBPACK_IMPORTED_MODULE_8__["findScrollableParent"]; } + this._scrollableParent = findScrollableContainer(rowContainerDiv); + // if this._scrollableParent is html the scroll event isn't fired, so we should use window + if (this._scrollableParent === document.documentElement) { + this._scrollableParent = window; + } + var hasScroll = this._scrollableParent.scrollHeight > this._scrollableParent.clientHeight; + this.isNeedRender = !hasScroll; + if (hasScroll) { + this._updateVisibility = function () { + var isRowContainerDivVisible = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_8__["isElementVisible"])(rowContainerDiv, 50); + if (!_this.isNeedRender && isRowContainerDivVisible) { + _this.isNeedRender = true; + _this.stopLazyRendering(); + } + }; + setTimeout(function () { + if (!!_this._scrollableParent && + !!_this._scrollableParent.addEventListener) { + _this._scrollableParent.addEventListener("scroll", _this._updateVisibility); + } + _this.ensureVisibility(); + }, 10); + } + }; + QuestionRowModel.prototype.ensureVisibility = function () { + if (!!this._updateVisibility) { + this._updateVisibility(); + } + }; + QuestionRowModel.prototype.stopLazyRendering = function () { + if (!!this._scrollableParent && + !!this._updateVisibility && + !!this._scrollableParent.removeEventListener) { + this._scrollableParent.removeEventListener("scroll", this._updateVisibility); + } + this._scrollableParent = undefined; + this._updateVisibility = undefined; + }; + QuestionRowModel.prototype.setIsLazyRendering = function (val) { + this.isLazyRenderingValue = val; + this.isNeedRender = !val; + }; + QuestionRowModel.prototype.isLazyRendering = function () { + return this.isLazyRenderingValue === true; + }; + Object.defineProperty(QuestionRowModel.prototype, "id", { + get: function () { + return this.idValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRowModel.prototype, "elements", { + get: function () { + return this.getPropertyValue("elements"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRowModel.prototype, "visibleElements", { + get: function () { + return this.getPropertyValue("visibleElements"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRowModel.prototype, "visible", { + get: function () { + return this.getPropertyValue("visible", true); + }, + set: function (val) { + this.setPropertyValue("visible", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRowModel.prototype, "isNeedRender", { + get: function () { + return this.getPropertyValue("isneedrender", true); + }, + set: function (val) { + this.setPropertyValue("isneedrender", val); + }, + enumerable: false, + configurable: true + }); + QuestionRowModel.prototype.updateVisible = function () { + var isVisible = this.calcVisible(); + this.setWidth(); + this.visible = isVisible; + }; + QuestionRowModel.prototype.addElement = function (q) { + this.elements.push(q); + this.updateVisible(); + }; + Object.defineProperty(QuestionRowModel.prototype, "index", { + get: function () { + return this.panel.rows.indexOf(this); + }, + enumerable: false, + configurable: true + }); + QuestionRowModel.prototype.setWidth = function () { + var visCount = this.visibleElements.length; + if (visCount == 0) + return; + var counter = 0; + var preSetWidthElements = []; + for (var i = 0; i < this.elements.length; i++) { + var el = this.elements[i]; + this.setElementMaxMinWidth(el); + if (el.isVisible) { + var width = this.getElementWidth(el); + if (!!width) { + el.renderWidth = this.getRenderedWidthFromWidth(width); + preSetWidthElements.push(el); + } + el.rightIndent = counter < visCount - 1 ? 1 : 0; + counter++; + } + else { + el.renderWidth = ""; + } + } + for (var i = 0; i < this.elements.length; i++) { + var el = this.elements[i]; + if (!el.isVisible || preSetWidthElements.indexOf(el) > -1) + continue; + if (preSetWidthElements.length == 0) { + el.renderWidth = (100 / visCount).toFixed(6) + "%"; + } + else { + el.renderWidth = this.getRenderedCalcWidth(el, preSetWidthElements, visCount); + } + } + }; + QuestionRowModel.prototype.setElementMaxMinWidth = function (el) { + if (el.width && + typeof el.width === "string" && + el.width.indexOf("%") === -1) { + el.minWidth = el.width; + el.maxWidth = el.width; + } + }; + QuestionRowModel.prototype.getRenderedCalcWidth = function (el, preSetWidthElements, visCount) { + var expression = "100%"; + for (var i = 0; i < preSetWidthElements.length; i++) { + expression += " - " + preSetWidthElements[i].renderWidth; + } + var calcWidthEl = visCount - preSetWidthElements.length; + if (calcWidthEl > 1) { + expression = "(" + expression + ")/" + calcWidthEl.toString(); + } + return "calc(" + expression + ")"; + }; + QuestionRowModel.prototype.getElementWidth = function (el) { + var width = el.width; + if (!width || typeof width !== "string") + return ""; + return width.trim(); + }; + QuestionRowModel.prototype.getRenderedWidthFromWidth = function (width) { + return _helpers__WEBPACK_IMPORTED_MODULE_1__["Helpers"].isNumber(width) ? width + "px" : width; + }; + QuestionRowModel.prototype.calcVisible = function () { + var visElements = []; + for (var i = 0; i < this.elements.length; i++) { + if (this.elements[i].isVisible) { + visElements.push(this.elements[i]); + } + } + if (this.needToUpdateVisibleElements(visElements)) { + this.setPropertyValue("visibleElements", visElements); + } + return visElements.length > 0; + }; + QuestionRowModel.prototype.needToUpdateVisibleElements = function (visElements) { + if (visElements.length !== this.visibleElements.length) + return true; + for (var i = 0; i < visElements.length; i++) { + if (visElements[i] !== this.visibleElements[i]) + return true; + } + return false; + }; + QuestionRowModel.prototype.dispose = function () { + _super.prototype.dispose.call(this); + this.stopLazyRendering(); + }; + QuestionRowModel.prototype.getRowCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_9__["CssClassBuilder"]() + .append(this.panel.cssClasses.row) + .append(this.panel.cssClasses.rowMultiple, this.visibleElements.length > 1) + .toString(); + }; + QuestionRowModel.rowCounter = 100; + return QuestionRowModel; + }(_base__WEBPACK_IMPORTED_MODULE_2__["Base"])); + + /** + * A base class for a Panel and Page objects. + */ + var PanelModelBase = /** @class */ (function (_super) { + __extends(PanelModelBase, _super); + function PanelModelBase(name) { + if (name === void 0) { name = ""; } + var _this = _super.call(this, name) || this; + _this.isQuestionsReady = false; + _this.questionsValue = new Array(); + _this.isRandomizing = false; + _this.createNewArray("rows"); + _this.elementsValue = _this.createNewArray("elements", _this.onAddElement.bind(_this), _this.onRemoveElement.bind(_this)); + _this.id = PanelModelBase.getPanelId(); + _this.addExpressionProperty("visibleIf", function (obj, res) { _this.visible = res === true; }, function (obj) { return !_this.areInvisibleElementsShowing; }); + _this.addExpressionProperty("enableIf", function (obj, res) { _this.readOnly = res === false; }); + _this.addExpressionProperty("requiredIf", function (obj, res) { _this.isRequired = res === true; }); + _this.createLocalizableString("requiredErrorText", _this); + _this.registerFunctionOnPropertyValueChanged("questionTitleLocation", function () { + _this.onVisibleChanged.bind(_this); + _this.updateElementCss(true); + }); + _this.registerFunctionOnPropertiesValueChanged(["questionStartIndex", "showQuestionNumbers"], function () { + _this.updateVisibleIndexes(); + }); + return _this; + } + PanelModelBase.getPanelId = function () { + return "sp_" + PanelModelBase.panelCounter++; + }; + PanelModelBase.prototype.getType = function () { + return "panelbase"; + }; + PanelModelBase.prototype.setSurveyImpl = function (value, isLight) { + _super.prototype.setSurveyImpl.call(this, value, isLight); + if (this.isDesignMode) + this.onVisibleChanged(); + for (var i = 0; i < this.elements.length; i++) { + this.elements[i].setSurveyImpl(value, isLight); + } + }; + PanelModelBase.prototype.endLoadingFromJson = function () { + _super.prototype.endLoadingFromJson.call(this); + this.updateDescriptionVisibility(this.description); + this.markQuestionListDirty(); + this.onRowsChanged(); + }; + Object.defineProperty(PanelModelBase.prototype, "hasTitle", { + get: function () { + return ((this.canShowTitle() && this.title.length > 0) || + (this.showTitle && this.isDesignMode && _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].allowShowEmptyTitleInDesignMode)); + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.canShowTitle = function () { return true; }; + Object.defineProperty(PanelModelBase.prototype, "_showDescription", { + get: function () { + return this.survey && this.survey.showPageTitles && this.hasDescription || + (this.showDescription && this.isDesignMode && + _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].allowShowEmptyTitleInDesignMode && + _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].allowShowEmptyDescriptionInDesignMode); + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.localeChanged = function () { + _super.prototype.localeChanged.call(this); + for (var i = 0; i < this.elements.length; i++) { + this.elements[i].localeChanged(); + } + }; + PanelModelBase.prototype.locStrsChanged = function () { + _super.prototype.locStrsChanged.call(this); + for (var i = 0; i < this.elements.length; i++) { + this.elements[i].locStrsChanged(); + } + }; + Object.defineProperty(PanelModelBase.prototype, "requiredText", { + /** + * Returns the char/string for a required panel. + * @see SurveyModel.requiredText + */ + get: function () { + return this.survey != null && this.isRequired + ? this.survey.requiredText + : ""; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "titlePattern", { + get: function () { + return !!this.survey ? this.survey.questionTitlePattern : "numTitleRequire"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "isRequireTextOnStart", { + get: function () { + return this.isRequired && this.titlePattern == "requireNumTitle"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "isRequireTextBeforeTitle", { + get: function () { + return this.isRequired && this.titlePattern == "numRequireTitle"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "isRequireTextAfterTitle", { + get: function () { + return this.isRequired && this.titlePattern == "numTitleRequire"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "requiredErrorText", { + /** + * The custom text that will be shown on required error. Use this property, if you do not want to show the default text. + */ + get: function () { + return this.getLocalizableStringText("requiredErrorText"); + }, + set: function (val) { + this.setLocalizableStringText("requiredErrorText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "locRequiredErrorText", { + get: function () { + return this.getLocalizableString("requiredErrorText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "questionsOrder", { + /** + * Use this property to randomize questions. Set it to 'random' to randomize questions, 'initial' to keep them in the same order or 'default' to use the Survey questionsOrder property + * @see SurveyModel.questionsOrder + * @see areQuestionsRandomized + */ + get: function () { + return this.getPropertyValue("questionsOrder"); + }, + set: function (val) { + this.setPropertyValue("questionsOrder", val); + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.canRandomize = function (isRandom) { + return isRandom && (this.questionsOrder !== "initial") || this.questionsOrder === "random"; + }; + PanelModelBase.prototype.randomizeElements = function (isRandom) { + if (!this.canRandomize(isRandom) || this.isRandomizing) + return; + this.isRandomizing = true; + var oldElements = []; + var elements = this.elements; + for (var i = 0; i < elements.length; i++) { + oldElements.push(elements[i]); + } + var newElements = _helpers__WEBPACK_IMPORTED_MODULE_1__["Helpers"].randomizeArray(oldElements); + this.setArrayPropertyDirectly("elements", newElements, false); + this.updateRows(); + this.updateVisibleIndexes(); + this.isRandomizing = false; + }; + Object.defineProperty(PanelModelBase.prototype, "parent", { + /** + * A parent element. It is always null for the Page object and always not null for the Panel object. Panel object may contain Questions and other Panels. + */ + get: function () { + return this.getPropertyValue("parent", null); + }, + set: function (val) { + this.setPropertyValue("parent", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "depth", { + get: function () { + if (this.parent == null) + return 0; + return this.parent.depth + 1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "visibleIf", { + /** + * An expression that returns true or false. If it returns true the Panel becomes visible and if it returns false the Panel becomes invisible. The library runs the expression on survey start and on changing a question value. If the property is empty then visible property is used. + * @see visible + */ + get: function () { + return this.getPropertyValue("visibleIf", ""); + }, + set: function (val) { + this.setPropertyValue("visibleIf", val); + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.calcCssClasses = function (css) { + var classes = { panel: {}, error: {}, row: "", rowMultiple: "" }; + this.copyCssClasses(classes.panel, css.panel); + this.copyCssClasses(classes.error, css.error); + if (!!css.row) { + classes.row = css.row; + } + if (!!css.rowMultiple) { + classes.rowMultiple = css.rowMultiple; + } + if (this.survey) { + this.survey.updatePanelCssClasses(this, classes); + } + return classes; + }; + Object.defineProperty(PanelModelBase.prototype, "id", { + /** + * A unique element identificator. It is generated automatically. + */ + get: function () { + return this.getPropertyValue("id"); + }, + set: function (val) { + this.setPropertyValue("id", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "isPanel", { + /** + * Returns true if the current object is Panel. Returns false if the current object is Page (a root Panel). + */ + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.getPanel = function () { + return this; + }; + PanelModelBase.prototype.getLayoutType = function () { + return "row"; + }; + PanelModelBase.prototype.isLayoutTypeSupported = function (layoutType) { + return layoutType !== "flow"; + }; + Object.defineProperty(PanelModelBase.prototype, "questions", { + /** + * Returns the list of all questions located in the Panel/Page, including in the nested Panels. + * @see Question + * @see elements + */ + get: function () { + if (!this.isQuestionsReady) { + this.questionsValue = []; + for (var i = 0; i < this.elements.length; i++) { + var el = this.elements[i]; + if (el.isPanel) { + var qs = el.questions; + for (var j = 0; j < qs.length; j++) { + this.questionsValue.push(qs[j]); + } + } + else { + this.questionsValue.push(el); + } + } + this.isQuestionsReady = true; + } + return this.questionsValue; + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.getValidName = function (name) { + if (!!name) + return name.trim(); + return name; + }; + /** + * Returns the question by its name + * @param name the question name + */ + PanelModelBase.prototype.getQuestionByName = function (name) { + var questions = this.questions; + for (var i = 0; i < questions.length; i++) { + if (questions[i].name == name) + return questions[i]; + } + return null; + }; + /** + * Returns the element by its name. It works recursively. + * @param name the element name + */ + PanelModelBase.prototype.getElementByName = function (name) { + var elements = this.elements; + for (var i = 0; i < elements.length; i++) { + var el = elements[i]; + if (el.name == name) + return el; + var pnl = el.getPanel(); + if (!!pnl) { + var res = pnl.getElementByName(name); + if (!!res) + return res; + } + } + return null; + }; + PanelModelBase.prototype.getQuestionByValueName = function (valueName) { + var questions = this.questions; + for (var i = 0; i < questions.length; i++) { + if (questions[i].getValueName() == valueName) + return questions[i]; + } + return null; + }; + /** + * Returns question values on the current page + */ + PanelModelBase.prototype.getValue = function () { + var data = {}; + var questions = this.questions; + for (var i = 0; i < questions.length; i++) { + var q = questions[i]; + if (q.isEmpty()) + continue; + var valueName = q.getValueName(); + data[valueName] = q.value; + if (!!this.data) { + var comment = this.data.getComment(valueName); + if (!!comment) { + data[valueName + _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].commentPrefix] = comment; + } + } + } + return data; + }; + /** + * Return questions values as a JSON object with display text. For example, for dropdown, it would return the item text instead of item value. + * @param keysAsText Set this value to true, to return key (in matrices questions) as display text as well. + */ + PanelModelBase.prototype.getDisplayValue = function (keysAsText) { + var data = {}; + var questions = this.questions; + for (var i = 0; i < questions.length; i++) { + var q = questions[i]; + if (q.isEmpty()) + continue; + var valueName = keysAsText ? q.title : q.getValueName(); + data[valueName] = q.getDisplayValue(keysAsText); + } + return data; + }; + /** + * Returns question comments on the current page + */ + PanelModelBase.prototype.getComments = function () { + var comments = {}; + if (!this.data) + return comments; + var questions = this.questions; + for (var i = 0; i < questions.length; i++) { + var q = questions[i]; + var comment = this.data.getComment(q.getValueName()); + if (!!comment) { + comments[q.getValueName()] = comment; + } + } + return comments; + }; + /** + * Call this function to remove all question values from the current page/panel, that end-user will not be able to enter. + * For example the value that doesn't exists in a radigroup/dropdown/checkbox choices or matrix rows/columns. + * Please note, this function doesn't clear values for invisible questions or values that doesn't associated with questions. + * @see Question.clearIncorrectValues + */ + PanelModelBase.prototype.clearIncorrectValues = function () { + for (var i = 0; i < this.elements.length; i++) { + this.elements[i].clearIncorrectValues(); + } + }; + /** + * Call this function to clear all errors in the panel / page and all its child elements (panels and questions) + */ + PanelModelBase.prototype.clearErrors = function () { + for (var i = 0; i < this.elements.length; i++) { + this.elements[i].clearErrors(); + } + this.errors = []; + }; + PanelModelBase.prototype.markQuestionListDirty = function () { + this.isQuestionsReady = false; + if (this.parent) + this.parent.markQuestionListDirty(); + }; + Object.defineProperty(PanelModelBase.prototype, "elements", { + /** + * Returns the list of the elements in the object, Panel/Page. Elements can be questions or panels. The function doesn't return elements in the nested Panels. + */ + get: function () { + return this.elementsValue; + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.getElementsInDesign = function (includeHidden) { + return this.elements; + }; + /** + * Returns true if the current element belongs to the Panel/Page. It looks in nested Panels as well. + * @param element + * @see PanelModel + */ + PanelModelBase.prototype.containsElement = function (element) { + for (var i = 0; i < this.elements.length; i++) { + var el = this.elements[i]; + if (el == element) + return true; + var pnl = el.getPanel(); + if (!!pnl) { + if (pnl.containsElement(element)) + return true; + } + } + return false; + }; + Object.defineProperty(PanelModelBase.prototype, "isRequired", { + /** + * Set this property to true, to require the answer at least in one question in the panel. + */ + get: function () { + return this.getPropertyValue("isRequired", false); + }, + set: function (val) { + this.setPropertyValue("isRequired", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "requiredIf", { + /** + * An expression that returns true or false. If it returns true the Panel/Page becomes required. + * The library runs the expression on survey start and on changing a question value. If the property is empty then isRequired property is used. + * @see isRequired + */ + get: function () { + return this.getPropertyValue("requiredIf", ""); + }, + set: function (val) { + this.setPropertyValue("requiredIf", val); + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.searchText = function (text, founded) { + _super.prototype.searchText.call(this, text, founded); + for (var i = 0; i < this.elements.length; i++) { + this.elements[i].searchText(text, founded); + } + }; + /** + * Returns true, if there is an error on this Page or inside the current Panel + * @param fireCallback set it to true, to show errors in UI + * @param focusOnFirstError set it to true to focus on the first question that doesn't pass the validation + */ + PanelModelBase.prototype.hasErrors = function (fireCallback, focusOnFirstError, rec) { + if (fireCallback === void 0) { fireCallback = true; } + if (focusOnFirstError === void 0) { focusOnFirstError = false; } + if (rec === void 0) { rec = null; } + rec = !!rec + ? rec + : { + fireCallback: fireCallback, + focuseOnFirstError: focusOnFirstError, + firstErrorQuestion: null, + result: false, + }; + this.hasErrorsCore(rec); + if (rec.firstErrorQuestion) { + rec.firstErrorQuestion.focus(true); + } + return rec.result; + }; + PanelModelBase.prototype.hasErrorsInPanels = function (rec) { + var errors = []; + this.hasRequiredError(rec, errors); + if (this.survey) { + var customError = this.survey.validatePanel(this); + if (customError) { + errors.push(customError); + rec.result = true; + } + } + if (!!rec.fireCallback) { + if (!!this.survey) { + this.survey.beforeSettingPanelErrors(this, errors); + } + this.errors = errors; + } + }; + //ISurveyErrorOwner + PanelModelBase.prototype.getErrorCustomText = function (text, error) { + if (!!this.survey) + return this.survey.getSurveyErrorCustomText(this, text, error); + return text; + }; + PanelModelBase.prototype.hasRequiredError = function (rec, errors) { + if (!this.isRequired) + return; + var visQuestions = []; + this.addQuestionsToList(visQuestions, true); + if (visQuestions.length == 0) + return; + for (var i = 0; i < visQuestions.length; i++) { + if (!visQuestions[i].isEmpty()) + return; + } + rec.result = true; + errors.push(new _error__WEBPACK_IMPORTED_MODULE_6__["OneAnswerRequiredError"](this.requiredErrorText, this)); + if (rec.focuseOnFirstError && !rec.firstErrorQuestion) { + rec.firstErrorQuestion = visQuestions[0]; + } + }; + PanelModelBase.prototype.hasErrorsCore = function (rec) { + var elements = this.elements; + var element = null; + for (var i = 0; i < elements.length; i++) { + element = elements[i]; + if (!element.isVisible) + continue; + if (element.isPanel) { + element.hasErrorsCore(rec); + } + else { + var question = element; + if (question.isReadOnly) + continue; + if (question.hasErrors(rec.fireCallback, rec)) { + if (rec.focuseOnFirstError && rec.firstErrorQuestion == null) { + rec.firstErrorQuestion = question; + } + rec.result = true; + } + } + } + this.hasErrorsInPanels(rec); + this.updateContainsErrors(); + }; + PanelModelBase.prototype.getContainsErrors = function () { + var res = _super.prototype.getContainsErrors.call(this); + if (res) + return res; + var elements = this.elements; + for (var i = 0; i < elements.length; i++) { + if (elements[i].containsErrors) + return true; + } + return false; + }; + PanelModelBase.prototype.updateElementVisibility = function () { + for (var i = 0; i < this.elements.length; i++) { + var el = this.elements[i]; + el.setPropertyValue("isVisible", el.isVisible); + if (el.isPanel) { + el.updateElementVisibility(); + } + } + }; + PanelModelBase.prototype.getFirstQuestionToFocus = function (withError) { + if (withError === void 0) { withError = false; } + var elements = this.elements; + for (var i = 0; i < elements.length; i++) { + var el = elements[i]; + if (!el.isVisible) + continue; + if (el.isPanel) { + var res = el.getFirstQuestionToFocus(withError); + if (!!res) + return res; + } + else { + var q = el; + if (q.hasInput && (!withError || q.currentErrorCount > 0)) + return q; + } + } + return null; + }; + /** + * Call it to focus the input on the first question + */ + PanelModelBase.prototype.focusFirstQuestion = function () { + var q = this.getFirstQuestionToFocus(); + if (!!q) { + q.focus(); + } + }; + /** + * Call it to focus the input of the first question that has an error. + */ + PanelModelBase.prototype.focusFirstErrorQuestion = function () { + var q = this.getFirstQuestionToFocus(true); + if (!!q) { + q.focus(); + } + }; + /** + * Fill list array with the questions. + * @param list + * @param visibleOnly set it to true to get visible questions only + */ + PanelModelBase.prototype.addQuestionsToList = function (list, visibleOnly, includingDesignTime) { + if (visibleOnly === void 0) { visibleOnly = false; } + if (includingDesignTime === void 0) { includingDesignTime = false; } + this.addElementsToList(list, visibleOnly, includingDesignTime, false); + }; + /** + * Fill list array with the panels. + * @param list + */ + PanelModelBase.prototype.addPanelsIntoList = function (list, visibleOnly, includingDesignTime) { + if (visibleOnly === void 0) { visibleOnly = false; } + if (includingDesignTime === void 0) { includingDesignTime = false; } + this.addElementsToList(list, visibleOnly, includingDesignTime, true); + }; + PanelModelBase.prototype.addElementsToList = function (list, visibleOnly, includingDesignTime, isPanel) { + if (visibleOnly && !this.visible) + return; + this.addElementsToListCore(list, this.elements, visibleOnly, includingDesignTime, isPanel); + }; + PanelModelBase.prototype.addElementsToListCore = function (list, elements, visibleOnly, includingDesignTime, isPanel) { + for (var i = 0; i < elements.length; i++) { + var el = elements[i]; + if (visibleOnly && !el.visible) + continue; + if ((isPanel && el.isPanel) || (!isPanel && !el.isPanel)) { + list.push(el); + } + if (el.isPanel) { + el.addElementsToListCore(list, el.elements, visibleOnly, includingDesignTime, isPanel); + } + else { + if (includingDesignTime) { + this.addElementsToListCore(list, el.getElementsInDesign(false), visibleOnly, includingDesignTime, isPanel); + } + } + } + }; + Object.defineProperty(PanelModelBase.prototype, "isActive", { + /** + * Returns true if the current object is Page and it is the current page. + */ + get: function () { + return !this.survey || this.survey.currentPage == this.root; + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.updateCustomWidgets = function () { + for (var i = 0; i < this.elements.length; i++) { + this.elements[i].updateCustomWidgets(); + } + }; + Object.defineProperty(PanelModelBase.prototype, "questionTitleLocation", { + /** + * Set this property different from "default" to set the specific question title location for this panel/page. + * @see SurveyModel.questionTitleLocation + */ + get: function () { + return this.getPropertyValue("questionTitleLocation"); + }, + set: function (value) { + this.setPropertyValue("questionTitleLocation", value.toLowerCase()); + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.getQuestionTitleLocation = function () { + if (this.onGetQuestionTitleLocation) + return this.onGetQuestionTitleLocation(); + if (this.questionTitleLocation != "default") + return this.questionTitleLocation; + if (this.parent) + return this.parent.getQuestionTitleLocation(); + return this.survey ? this.survey.questionTitleLocation : "top"; + }; + PanelModelBase.prototype.getStartIndex = function () { + if (!!this.parent) + return this.parent.getQuestionStartIndex(); + if (!!this.survey) + return this.survey.questionStartIndex; + return ""; + }; + PanelModelBase.prototype.getQuestionStartIndex = function () { + return this.getStartIndex(); + }; + PanelModelBase.prototype.getChildrenLayoutType = function () { + return "row"; + }; + PanelModelBase.prototype.getProgressInfo = function () { + return _survey_element__WEBPACK_IMPORTED_MODULE_3__["SurveyElement"].getProgressInfoByElements(this.elements, this.isRequired); + }; + Object.defineProperty(PanelModelBase.prototype, "root", { + get: function () { + var res = this; + while (res.parent) + res = res.parent; + return res; + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.childVisibilityChanged = function () { + var newIsVisibleValue = this.getIsPageVisible(null); + var oldIsVisibleValue = this.getPropertyValue("isVisible", true); + if (newIsVisibleValue !== oldIsVisibleValue) { + this.onVisibleChanged(); + } + }; + PanelModelBase.prototype.createRowAndSetLazy = function (index) { + var row = this.createRow(); + row.setIsLazyRendering(this.isLazyRenderInRow(index)); + return row; + }; + PanelModelBase.prototype.createRow = function () { + return new QuestionRowModel(this); + }; + PanelModelBase.prototype.onSurveyLoad = function () { + for (var i = 0; i < this.elements.length; i++) { + this.elements[i].onSurveyLoad(); + } + this.onElementVisibilityChanged(this); + }; + PanelModelBase.prototype.onFirstRendering = function () { + _super.prototype.onFirstRendering.call(this); + for (var i = 0; i < this.elements.length; i++) { + this.elements[i].onFirstRendering(); + } + this.onRowsChanged(); + }; + PanelModelBase.prototype.updateRows = function () { + if (this.isLoadingFromJson) + return; + for (var i = 0; i < this.elements.length; i++) { + if (this.elements[i].isPanel) { + this.elements[i].updateRows(); + } + } + this.onRowsChanged(); + }; + Object.defineProperty(PanelModelBase.prototype, "rows", { + get: function () { + return this.getPropertyValue("rows"); + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.ensureRowsVisibility = function () { + this.rows.forEach(function (row) { + row.ensureVisibility(); + }); + }; + PanelModelBase.prototype.onRowsChanged = function () { + if (this.isLoadingFromJson) + return; + this.setArrayPropertyDirectly("rows", this.buildRows()); + }; + PanelModelBase.prototype.onAddElement = function (element, index) { + element.setSurveyImpl(this.surveyImpl); + element.parent = this; + this.markQuestionListDirty(); + this.updateRowsOnElementAdded(element, index); + if (element.isPanel) { + var p = element; + if (this.survey) { + this.survey.panelAdded(p, index, this, this.root); + } + } + else { + if (this.survey) { + var q = element; + this.survey.questionAdded(q, index, this, this.root); + } + } + if (!!this.addElementCallback) + this.addElementCallback(element); + var self = this; + element.registerFunctionOnPropertiesValueChanged(["visible", "isVisible"], function () { + self.onElementVisibilityChanged(element); + }, this.id); + element.registerFunctionOnPropertyValueChanged("startWithNewLine", function () { + self.onElementStartWithNewLineChanged(element); + }, this.id); + this.onElementVisibilityChanged(this); + }; + PanelModelBase.prototype.onRemoveElement = function (element) { + element.parent = null; + this.markQuestionListDirty(); + element.unRegisterFunctionOnPropertiesValueChanged(["visible", "isVisible", "startWithNewLine"], this.id); + this.updateRowsOnElementRemoved(element); + if (this.isRandomizing) + return; + if (!element.isPanel) { + if (this.survey) + this.survey.questionRemoved(element); + } + else { + if (this.survey) + this.survey.panelRemoved(element); + } + if (!!this.removeElementCallback) + this.removeElementCallback(element); + this.onElementVisibilityChanged(this); + }; + PanelModelBase.prototype.onElementVisibilityChanged = function (element) { + if (this.isLoadingFromJson || this.isRandomizing) + return; + this.updateRowsVisibility(element); + this.childVisibilityChanged(); + if (!!this.parent) { + this.parent.onElementVisibilityChanged(this); + } + }; + PanelModelBase.prototype.onElementStartWithNewLineChanged = function (element) { + this.onRowsChanged(); + }; + PanelModelBase.prototype.updateRowsVisibility = function (element) { + var rows = this.rows; + for (var i = 0; i < rows.length; i++) { + var row = rows[i]; + if (row.elements.indexOf(element) > -1) { + row.updateVisible(); + if (row.visible && !row.isNeedRender) { + row.isNeedRender = true; + } + break; + } + } + }; + PanelModelBase.prototype.canBuildRows = function () { + return !this.isLoadingFromJson && this.getChildrenLayoutType() == "row"; + }; + PanelModelBase.prototype.buildRows = function () { + if (!this.canBuildRows()) + return []; + var result = new Array(); + for (var i = 0; i < this.elements.length; i++) { + var el = this.elements[i]; + var isNewRow = i == 0 || el.startWithNewLine; + var row = isNewRow ? this.createRowAndSetLazy(result.length) : result[result.length - 1]; + if (isNewRow) + result.push(row); + row.addElement(el); + } + for (var i = 0; i < result.length; i++) { + result[i].updateVisible(); + } + return result; + }; + PanelModelBase.prototype.isLazyRenderInRow = function (rowIndex) { + if (!this.survey || !this.survey.isLazyRendering) + return false; + return (rowIndex >= _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].lazyRowsRenderingStartRow || + !this.canRenderFirstRows()); + }; + PanelModelBase.prototype.canRenderFirstRows = function () { + return this.isPage; + }; + PanelModelBase.prototype.updateRowsOnElementAdded = function (element, index) { + if (!this.canBuildRows()) + return; + var dragDropInfo = new DragDropInfo(null, element); + dragDropInfo.target = element; + dragDropInfo.isEdge = this.elements.length > 1; + if (this.elements.length < 2) { + dragDropInfo.destination = this; + } + else { + dragDropInfo.isBottom = index > 0; + if (index == 0) { + dragDropInfo.destination = this.elements[1]; + } + else { + dragDropInfo.destination = this.elements[index - 1]; + } + } + this.dragDropAddTargetToRow(dragDropInfo, null); + }; + PanelModelBase.prototype.updateRowsOnElementRemoved = function (element) { + if (!this.canBuildRows()) + return; + this.updateRowsRemoveElementFromRow(element, this.findRowByElement(element)); + }; + PanelModelBase.prototype.updateRowsRemoveElementFromRow = function (element, row) { + if (!row || !row.panel) + return; + var elIndex = row.elements.indexOf(element); + if (elIndex < 0) + return; + row.elements.splice(elIndex, 1); + if (row.elements.length > 0) { + row.updateVisible(); + } + else { + if (row.index >= 0) { + row.panel.rows.splice(row.index, 1); + } + } + }; + PanelModelBase.prototype.findRowByElement = function (el) { + var rows = this.rows; + for (var i = 0; i < rows.length; i++) { + if (rows[i].elements.indexOf(el) > -1) + return rows[i]; + } + return null; + }; + PanelModelBase.prototype.elementWidthChanged = function (el) { + if (this.isLoadingFromJson) + return; + var row = this.findRowByElement(el); + if (!!row) { + row.updateVisible(); + } + }; + Object.defineProperty(PanelModelBase.prototype, "processedTitle", { + /** + * Returns rendered title text or html. + */ + get: function () { + return this.getRenderedTitle(this.locTitle.textOrHtml); + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.getRenderedTitle = function (str) { + return this.textProcessor != null + ? this.textProcessor.processText(str, true) + : str; + }; + Object.defineProperty(PanelModelBase.prototype, "visible", { + /** + * Use it to get/set the object visibility. + * @see visibleIf + */ + get: function () { + return this.getPropertyValue("visible", true); + }, + set: function (value) { + if (value === this.visible) + return; + this.setPropertyValue("visible", value); + this.setPropertyValue("isVisible", this.isVisible); + if (!this.isLoadingFromJson) + this.onVisibleChanged(); + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.onVisibleChanged = function () { + if (this.isRandomizing) + return; + this.setPropertyValue("isVisible", this.isVisible); + if (!!this.survey && + this.survey.isClearValueOnHiddenContainer && + !this.isLoadingFromJson) { + var questions = this.questions; + for (var i = 0; i < questions.length; i++) { + if (!this.isVisible) { + questions[i].clearValueIfInvisible(); + } + else { + questions[i].updateValueWithDefaults(); + } + } + } + }; + Object.defineProperty(PanelModelBase.prototype, "isVisible", { + /** + * Returns true if object is visible or survey is in design mode right now. + */ + get: function () { + return this.areInvisibleElementsShowing || this.getIsPageVisible(null); + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.getIsPageVisible = function (exceptionQuestion) { + if (!this.visible) + return false; + for (var i = 0; i < this.elements.length; i++) { + if (this.elements[i] == exceptionQuestion) + continue; + if (this.elements[i].isVisible) + return true; + } + return false; + }; + PanelModelBase.prototype.setVisibleIndex = function (index) { + if (!this.isVisible || index < 0) { + this.resetVisibleIndexes(); + return 0; + } + this.lastVisibleIndex = index; + var startIndex = index; + index += this.beforeSetVisibleIndex(index); + var panelStartIndex = this.getPanelStartIndex(index); + var panelIndex = panelStartIndex; + for (var i = 0; i < this.elements.length; i++) { + panelIndex += this.elements[i].setVisibleIndex(panelIndex); + } + if (this.isContinueNumbering()) { + index += panelIndex - panelStartIndex; + } + return index - startIndex; + }; + PanelModelBase.prototype.updateVisibleIndexes = function () { + if (this.lastVisibleIndex === undefined) + return; + this.resetVisibleIndexes(); + this.setVisibleIndex(this.lastVisibleIndex); + }; + PanelModelBase.prototype.resetVisibleIndexes = function () { + for (var i = 0; i < this.elements.length; i++) { + this.elements[i].setVisibleIndex(-1); + } + }; + PanelModelBase.prototype.beforeSetVisibleIndex = function (index) { + return 0; + }; + PanelModelBase.prototype.getPanelStartIndex = function (index) { + return index; + }; + PanelModelBase.prototype.isContinueNumbering = function () { + return true; + }; + Object.defineProperty(PanelModelBase.prototype, "isReadOnly", { + /** + * Returns true if readOnly property is true or survey is in display mode or parent panel/page is readOnly. + * @see SurveyModel.model + * @see readOnly + */ + get: function () { + var isParentReadOnly = !!this.parent && this.parent.isReadOnly; + var isSurveyReadOnly = !!this.survey && this.survey.isDisplayMode; + return this.readOnly || isParentReadOnly || isSurveyReadOnly; + }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.onReadOnlyChanged = function () { + for (var i = 0; i < this.elements.length; i++) { + var el = this.elements[i]; + el.setPropertyValue("isReadOnly", el.isReadOnly); + } + _super.prototype.onReadOnlyChanged.call(this); + }; + PanelModelBase.prototype.updateElementCss = function (reNew) { + _super.prototype.updateElementCss.call(this, reNew); + for (var i = 0; i < this.elements.length; i++) { + var el = this.elements[i]; + el.updateElementCss(reNew); + } + }; + Object.defineProperty(PanelModelBase.prototype, "enableIf", { + /** + * An expression that returns true or false. If it returns false the Panel/Page becomes read only and an end-user will not able to answer on qustions inside it. + * The library runs the expression on survey start and on changing a question value. If the property is empty then readOnly property is used. + * @see readOnly + * @see isReadOnly + */ + get: function () { + return this.getPropertyValue("enableIf", ""); + }, + set: function (val) { + this.setPropertyValue("enableIf", val); + }, + enumerable: false, + configurable: true + }); + /** + * Add an element into Panel or Page. Returns true if the element added successfully. Otherwise returns false. + * @param element + * @param index element index in the elements array + */ + PanelModelBase.prototype.addElement = function (element, index) { + if (index === void 0) { index = -1; } + if (!this.canAddElement(element)) + return false; + if (index < 0 || index >= this.elements.length) { + this.elements.push(element); + } + else { + this.elements.splice(index, 0, element); + } + return true; + }; + PanelModelBase.prototype.insertElementAfter = function (element, after) { + var index = this.elements.indexOf(after); + if (index >= 0) + this.addElement(element, index + 1); + }; + PanelModelBase.prototype.insertElementBefore = function (element, before) { + var index = this.elements.indexOf(before); + if (index >= 0) + this.addElement(element, index); + }; + PanelModelBase.prototype.canAddElement = function (element) { + return (!!element && element.isLayoutTypeSupported(this.getChildrenLayoutType())); + }; + /** + * Add a question into Panel or Page. Returns true if the question added successfully. Otherwise returns false. + * @param question + * @param index element index in the elements array + */ + PanelModelBase.prototype.addQuestion = function (question, index) { + if (index === void 0) { index = -1; } + return this.addElement(question, index); + }; + /** + * Add a panel into Panel or Page. Returns true if the panel added successfully. Otherwise returns false. + * @param panel + * @param index element index in the elements array + */ + PanelModelBase.prototype.addPanel = function (panel, index) { + if (index === void 0) { index = -1; } + return this.addElement(panel, index); + }; + /** + * Creates a new question and adds it at location of index, by default the end of the elements list. Returns null, if the question could not be created or could not be added into page or panel. + * @param questionType the possible values are: "text", "checkbox", "dropdown", "matrix", "html", "matrixdynamic", "matrixdropdown" and so on. + * @param name a question name + * @param index element index in the elements array + */ + PanelModelBase.prototype.addNewQuestion = function (questionType, name, index) { + if (name === void 0) { name = null; } + if (index === void 0) { index = -1; } + var question = _questionfactory__WEBPACK_IMPORTED_MODULE_5__["QuestionFactory"].Instance.createQuestion(questionType, name); + if (!this.addQuestion(question, index)) + return null; + return question; + }; + /** + * Creates a new panel and adds it into the end of the elements list. Returns null, if the panel could not be created or could not be added into page or panel. + * @param name a panel name + */ + PanelModelBase.prototype.addNewPanel = function (name) { + if (name === void 0) { name = null; } + var panel = this.createNewPanel(name); + if (!this.addPanel(panel)) + return null; + return panel; + }; + /** + * Returns the index of element parameter in the elements list. + * @param element question or panel + */ + PanelModelBase.prototype.indexOf = function (element) { + return this.elements.indexOf(element); + }; + PanelModelBase.prototype.createNewPanel = function (name) { + var res = _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].createClass("panel"); + res.name = name; + return res; + }; + /** + * Remove an element (Panel or Question) from the elements list. + * @param element + * @see elements + */ + PanelModelBase.prototype.removeElement = function (element) { + var index = this.elements.indexOf(element); + if (index < 0) { + for (var i = 0; i < this.elements.length; i++) { + if (this.elements[i].removeElement(element)) + return true; + } + return false; + } + this.elements.splice(index, 1); + return true; + }; + /** + * Remove question from the elements list. + * @param question + * @see elements + * @see removeElement + */ + PanelModelBase.prototype.removeQuestion = function (question) { + this.removeElement(question); + }; + PanelModelBase.prototype.runCondition = function (values, properties) { + if (this.isDesignMode || this.isLoadingFromJson) + return; + var elements = this.elements.slice(); + for (var i = 0; i < elements.length; i++) { + elements[i].runCondition(values, properties); + } + this.runConditionCore(values, properties); + }; + PanelModelBase.prototype.onAnyValueChanged = function (name) { + var els = this.elements; + for (var i = 0; i < els.length; i++) { + els[i].onAnyValueChanged(name); + } + }; + PanelModelBase.prototype.checkBindings = function (valueName, value) { + var els = this.elements; + for (var i = 0; i < els.length; i++) { + els[i].checkBindings(valueName, value); + } + }; + PanelModelBase.prototype.dragDropAddTarget = function (dragDropInfo) { + var prevRow = this.dragDropFindRow(dragDropInfo.target); + if (this.dragDropAddTargetToRow(dragDropInfo, prevRow)) { + this.updateRowsRemoveElementFromRow(dragDropInfo.target, prevRow); + } + }; + PanelModelBase.prototype.dragDropFindRow = function (findElement) { + if (!findElement || findElement.isPage) + return null; + var element = findElement; + var rows = this.rows; + for (var i = 0; i < rows.length; i++) { + if (rows[i].elements.indexOf(element) > -1) + return rows[i]; + } + for (var i = 0; i < this.elements.length; i++) { + var pnl = this.elements[i].getPanel(); + if (!pnl) + continue; + var row = pnl.dragDropFindRow(element); + if (!!row) + return row; + } + return null; + }; + PanelModelBase.prototype.dragDropAddTargetToRow = function (dragDropInfo, prevRow) { + if (!dragDropInfo.destination) + return true; + if (this.dragDropAddTargetToEmptyPanel(dragDropInfo)) + return true; + var dest = dragDropInfo.destination; + var destRow = this.dragDropFindRow(dest); + if (!destRow) + return true; + if (_settings__WEBPACK_IMPORTED_MODULE_7__["settings"].supportCreatorV2 && this.isDesignMode) { + if (destRow.elements.length > 1) + return this.dragDropAddTargetToExistingRow(dragDropInfo, destRow, prevRow); + else + return this.dragDropAddTargetToNewRow(dragDropInfo, destRow, prevRow); + } + if (!dragDropInfo.target.startWithNewLine) + return this.dragDropAddTargetToExistingRow(dragDropInfo, destRow, prevRow); + return this.dragDropAddTargetToNewRow(dragDropInfo, destRow, prevRow); + }; + PanelModelBase.prototype.dragDropAddTargetToEmptyPanel = function (dragDropInfo) { + if (dragDropInfo.destination.isPage) { + this.dragDropAddTargetToEmptyPanelCore(this.root, dragDropInfo.target, dragDropInfo.isBottom); + return true; + } + var dest = dragDropInfo.destination; + if (dest.isPanel && !dragDropInfo.isEdge) { + var panel = dest; + if (dragDropInfo.target["template"] === dest) { + return false; + } + if (dragDropInfo.nestedPanelDepth < 0 || + dragDropInfo.nestedPanelDepth >= panel.depth) { + this.dragDropAddTargetToEmptyPanelCore(dest, dragDropInfo.target, dragDropInfo.isBottom); + return true; + } + } + return false; + }; + PanelModelBase.prototype.dragDropAddTargetToExistingRow = function (dragDropInfo, destRow, prevRow) { + var index = destRow.elements.indexOf(dragDropInfo.destination); + if (index == 0 && + !dragDropInfo.isBottom) { + if (this.isDesignMode && _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].supportCreatorV2) ; + else if (destRow.elements[0].startWithNewLine) { + if (destRow.index > 0) { + dragDropInfo.isBottom = true; + destRow = destRow.panel.rows[destRow.index - 1]; + dragDropInfo.destination = + destRow.elements[destRow.elements.length - 1]; + return this.dragDropAddTargetToExistingRow(dragDropInfo, destRow, prevRow); + } + else { + return this.dragDropAddTargetToNewRow(dragDropInfo, destRow, prevRow); + } + } + } + var prevRowIndex = -1; + if (prevRow == destRow) { + prevRowIndex = destRow.elements.indexOf(dragDropInfo.target); + } + if (dragDropInfo.isBottom) + index++; + var srcRow = this.findRowByElement(dragDropInfo.source); + if (srcRow == destRow && + srcRow.elements.indexOf(dragDropInfo.source) == index) + return false; + if (index == prevRowIndex) + return false; + if (prevRowIndex > -1) { + destRow.elements.splice(prevRowIndex, 1); + if (prevRowIndex < index) + index--; + } + destRow.elements.splice(index, 0, dragDropInfo.target); + destRow.updateVisible(); + return prevRowIndex < 0; + }; + PanelModelBase.prototype.dragDropAddTargetToNewRow = function (dragDropInfo, destRow, prevRow) { + var targetRow = destRow.panel.createRowAndSetLazy(destRow.panel.rows.length); + if (this.isDesignMode && _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].supportCreatorV2) { + targetRow.setIsLazyRendering(false); + } + targetRow.addElement(dragDropInfo.target); + var index = destRow.index; + if (dragDropInfo.isBottom) { + index++; + } + //same row + if (!!prevRow && prevRow.panel == targetRow.panel && prevRow.index == index) + return false; + var srcRow = this.findRowByElement(dragDropInfo.source); + if (!!srcRow && + srcRow.panel == targetRow.panel && + srcRow.elements.length == 1 && + srcRow.index == index) + return false; + destRow.panel.rows.splice(index, 0, targetRow); + return true; + }; + PanelModelBase.prototype.dragDropAddTargetToEmptyPanelCore = function (panel, target, isBottom) { + var targetRow = panel.createRow(); + targetRow.addElement(target); + if (panel.elements.length == 0 || isBottom) { + panel.rows.push(targetRow); + } + else { + panel.rows.splice(0, 0, targetRow); + } + }; + PanelModelBase.prototype.dragDropMoveElement = function (src, target, targetIndex) { + var srcIndex = src.parent.elements.indexOf(src); + if (targetIndex > srcIndex) { + targetIndex--; + } + this.removeElement(src); + this.addElement(target, targetIndex); + }; + PanelModelBase.prototype.needResponsiveWidth = function () { + var result = false; + this.elements.forEach(function (e) { + if (e.needResponsiveWidth()) + result = true; + }); + this.rows.forEach(function (r) { + if (r.elements.length > 1) + result = true; + }); + return result; + }; + Object.defineProperty(PanelModelBase.prototype, "hasDescriptionUnderTitle", { + get: function () { + return this.hasDescription; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "cssHeader", { + get: function () { + return this.cssClasses.panel.header; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "cssDescription", { + get: function () { + return this.cssClasses.panel.description; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModelBase.prototype, "no", { + //ITitleOwner + get: function () { return ""; }, + enumerable: false, + configurable: true + }); + PanelModelBase.prototype.dispose = function () { + _super.prototype.dispose.call(this); + if (this.rows) { + for (var i = 0; i < this.rows.length; i++) { + this.rows[i].dispose(); + } + this.rows.splice(0, this.rows.length); + } + for (var i = 0; i < this.elements.length; i++) { + this.elements[i].dispose(); + } + this.elements.splice(0, this.elements.length); + }; + PanelModelBase.panelCounter = 100; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: true }) + ], PanelModelBase.prototype, "showTitle", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: true }) + ], PanelModelBase.prototype, "showDescription", void 0); + return PanelModelBase; + }(_survey_element__WEBPACK_IMPORTED_MODULE_3__["SurveyElement"])); + + /** + * A container element, similar to the Page objects. However, unlike the Page, Panel can't be a root. + * It may contain questions and other panels. + */ + var PanelModel = /** @class */ (function (_super) { + __extends(PanelModel, _super); + function PanelModel(name) { + if (name === void 0) { name = ""; } + var _this = _super.call(this, name) || this; + _this.focusIn = function () { + _this.survey.whenPanelFocusIn(_this); + }; + var self = _this; + _this.createNewArray("footerActions"); + _this.registerFunctionOnPropertyValueChanged("width", function () { + if (!!self.parent) { + self.parent.elementWidthChanged(self); + } + }); + _this.registerFunctionOnPropertiesValueChanged(["indent", "innerIndent", "rightIndent"], function () { + self.onIndentChanged(); + }); + return _this; + } + PanelModel.prototype.getType = function () { + return "panel"; + }; + Object.defineProperty(PanelModel.prototype, "contentId", { + get: function () { + return this.id + "_content"; + }, + enumerable: false, + configurable: true + }); + PanelModel.prototype.getSurvey = function (live) { + if (live === void 0) { live = false; } + if (live) { + return !!this.parent ? this.parent.getSurvey(live) : null; + } + return _super.prototype.getSurvey.call(this, live); + }; + PanelModel.prototype.onSurveyLoad = function () { + _super.prototype.onSurveyLoad.call(this); + this.onIndentChanged(); + }; + PanelModel.prototype.onSetData = function () { + _super.prototype.onSetData.call(this); + this.onIndentChanged(); + }; + Object.defineProperty(PanelModel.prototype, "isPanel", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModel.prototype, "page", { + /** + * Get/set the page where the panel is located. + */ + get: function () { + return this.getPage(this.parent); + }, + set: function (val) { + this.setPage(this.parent, val); + }, + enumerable: false, + configurable: true + }); + PanelModel.prototype.delete = function () { + if (!!this.parent) { + this.removeSelfFromList(this.parent.elements); + } + }; + /** + * Move panel to a new container Page/Panel. Add as a last element if insertBefore parameter is not used or inserted into the given index, + * if insert parameter is number, or before the given element, if the insertBefore parameter is a question or panel + * @param container Page or Panel to where a question is relocated. + * @param insertBefore Use it if you want to set the panel to a specific position. You may use a number (use 0 to insert int the beginning) or element, if you want to insert before this element. + */ + PanelModel.prototype.moveTo = function (container, insertBefore) { + if (insertBefore === void 0) { insertBefore = null; } + return this.moveToBase(this.parent, container, insertBefore); + }; + Object.defineProperty(PanelModel.prototype, "visibleIndex", { + /** + * Returns the visible index of the panel in the survey. Commonly it is -1 and it doesn't show. + * You have to set showNumber to true to show index/numbering for the Panel + * @see showNumber + */ + get: function () { + return this.getPropertyValue("visibleIndex", -1); + }, + enumerable: false, + configurable: true + }); + PanelModel.prototype.getTitleOwner = function () { return this; }; + Object.defineProperty(PanelModel.prototype, "showNumber", { + /** + * Set showNumber to true to start showing the number for this panel. + * @see visibleIndex + */ + get: function () { + return this.getPropertyValue("showNumber", false); + }, + set: function (val) { + this.setPropertyValue("showNumber", val); + this.notifySurveyOnVisibilityChanged(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModel.prototype, "showQuestionNumbers", { + /** + * Gets or sets a value that specifies how the elements numbers inside panel are displayed. + * + * The following options are available: + * + * - `default` - display questions numbers as defined in parent panel or survey + * - `onpanel` - display questions numbers, start numbering from beginning of this page + * - `off` - turn off the numbering for questions titles + * @see showNumber + */ + get: function () { + return this.getPropertyValue("showQuestionNumbers"); + }, + set: function (value) { + this.setPropertyValue("showQuestionNumbers", value); + this.notifySurveyOnVisibilityChanged(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModel.prototype, "questionStartIndex", { + /** + * Gets or sets the first question index for elements inside the panel. The first question index is '1.' by default and it is taken from survey.questionStartIndex property. + * You may start it from '100' or from 'A', by setting '100' or 'A' to this property. + * You can set the start index to "(1)" or "# A)" or "a)" to render question number as (1), # A) and a) accordingly. + * @see survey.questionStartIndex + */ + get: function () { + return this.getPropertyValue("questionStartIndex", ""); + }, + set: function (val) { + this.setPropertyValue("questionStartIndex", val); + }, + enumerable: false, + configurable: true + }); + PanelModel.prototype.getQuestionStartIndex = function () { + if (!!this.questionStartIndex) + return this.questionStartIndex; + return _super.prototype.getQuestionStartIndex.call(this); + }; + Object.defineProperty(PanelModel.prototype, "no", { + /** + * The property returns the question number. If question is invisible then it returns empty string. + * If visibleIndex is 1, then no is 2, or 'B' if survey.questionStartIndex is 'A'. + * @see SurveyModel.questionStartIndex + */ + get: function () { + return this.getPropertyValue("no", ""); + }, + enumerable: false, + configurable: true + }); + PanelModel.prototype.setNo = function (visibleIndex) { + this.setPropertyValue("no", _helpers__WEBPACK_IMPORTED_MODULE_1__["Helpers"].getNumberByIndex(this.visibleIndex, this.getStartIndex())); + }; + PanelModel.prototype.beforeSetVisibleIndex = function (index) { + var visibleIndex = -1; + if (this.showNumber && (this.isDesignMode || !this.locTitle.isEmpty)) { + visibleIndex = index; + } + this.setPropertyValue("visibleIndex", visibleIndex); + this.setNo(visibleIndex); + return visibleIndex < 0 ? 0 : 1; + }; + PanelModel.prototype.getPanelStartIndex = function (index) { + if (this.showQuestionNumbers == "off") + return -1; + if (this.showQuestionNumbers == "onpanel") + return 0; + return index; + }; + PanelModel.prototype.isContinueNumbering = function () { + return (this.showQuestionNumbers != "off" && this.showQuestionNumbers != "onpanel"); + }; + PanelModel.prototype.notifySurveyOnVisibilityChanged = function () { + if (this.survey != null && !this.isLoadingFromJson) { + this.survey.panelVisibilityChanged(this, this.isVisible); + } + }; + PanelModel.prototype.hasErrorsCore = function (rec) { + _super.prototype.hasErrorsCore.call(this, rec); + if (this.isCollapsed && rec.result && rec.fireCallback) { + this.expand(); + } + }; + PanelModel.prototype.getRenderedTitle = function (str) { + if (!str) { + if (this.isCollapsed || this.isExpanded) + return this.name; + if (this.isDesignMode) + return "[" + this.name + "]"; + } + return _super.prototype.getRenderedTitle.call(this, str); + }; + Object.defineProperty(PanelModel.prototype, "innerIndent", { + /** + * The inner indent. Set this property to increase the panel content margin. + */ + get: function () { + return this.getPropertyValue("innerIndent"); + }, + set: function (val) { + this.setPropertyValue("innerIndent", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModel.prototype, "startWithNewLine", { + /** + * The Panel renders on the new line if the property is true. If the property is false, the panel tries to render on the same line/row with a previous question/panel. + */ + get: function () { + return this.getPropertyValue("startWithNewLine"); + }, + set: function (value) { + this.setPropertyValue("startWithNewLine", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModel.prototype, "allowAdaptiveActions", { + /** + * The Panel toolbar gets adaptive if the property is set to true. + */ + get: function () { + return this.getPropertyValue("allowAdaptiveActions"); + }, + set: function (val) { + this.setPropertyValue("allowAdaptiveActions", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModel.prototype, "innerPaddingLeft", { + get: function () { + return this.getPropertyValue("innerPaddingLeft", ""); + }, + set: function (val) { + this.setPropertyValue("innerPaddingLeft", val); + }, + enumerable: false, + configurable: true + }); + PanelModel.prototype.onIndentChanged = function () { + if (!this.getSurvey()) + return; + this.innerPaddingLeft = this.getIndentSize(this.innerIndent); + this.paddingLeft = this.getIndentSize(this.indent); + this.paddingRight = this.getIndentSize(this.rightIndent); + }; + PanelModel.prototype.getIndentSize = function (indent) { + if (indent < 1) + return ""; + var css = this.survey["css"]; + if (!css || !css.question.indent) + return ""; + return indent * css.question.indent + "px"; + }; + PanelModel.prototype.clearOnDeletingContainer = function () { + this.elements.forEach(function (element) { + if (element instanceof _question__WEBPACK_IMPORTED_MODULE_4__["Question"] || element instanceof PanelModel) { + element.clearOnDeletingContainer(); + } + }); + }; + Object.defineProperty(PanelModel.prototype, "footerActions", { + get: function () { + return this.getPropertyValue("footerActions"); + }, + enumerable: false, + configurable: true + }); + PanelModel.prototype.getFooterToolbar = function () { + var _this = this; + if (!this.footerToolbarValue) { + var actions = this.footerActions; + if (this.hasEditButton) { + actions.push({ + id: "cancel-preview", + title: this.survey.editText, + innerCss: this.survey.cssNavigationEdit, + action: function () { _this.cancelPreview(); } + }); + } + this.footerToolbarValue = this.createActionContainer(this.allowAdaptiveActions); + if (!!this.cssClasses.panel) { + this.footerToolbarValue.containerCss = this.cssClasses.panel.footer; + } + this.footerToolbarValue.setItems(actions); + } + return this.footerToolbarValue; + }; + Object.defineProperty(PanelModel.prototype, "hasEditButton", { + get: function () { + if (this.survey && this.survey.state === "preview") + return this.depth === 1; + return false; + }, + enumerable: false, + configurable: true + }); + PanelModel.prototype.cancelPreview = function () { + if (!this.hasEditButton) + return; + this.survey.cancelPreviewByPage(this); + }; + Object.defineProperty(PanelModel.prototype, "cssTitle", { + get: function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_9__["CssClassBuilder"]() + .append(this.cssClasses.panel.title) + .append(this.cssClasses.panel.titleExpandable, this.state !== "default") + .append(this.cssClasses.panel.titleExpanded, this.isExpanded) + .append(this.cssClasses.panel.titleCollapsed, this.isCollapsed) + .append(this.cssClasses.panel.titleOnError, this.containsErrors) + .toString(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PanelModel.prototype, "cssError", { + get: function () { + return this.getCssError(this.cssClasses); + }, + enumerable: false, + configurable: true + }); + PanelModel.prototype.getCssError = function (cssClasses) { + var builder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_9__["CssClassBuilder"]().append(this.cssClasses.error.root); + return builder.append("panel-error-root", builder.isEmpty()).toString(); + }; + PanelModel.prototype.onVisibleChanged = function () { + _super.prototype.onVisibleChanged.call(this); + this.notifySurveyOnVisibilityChanged(); + }; + PanelModel.prototype.needResponsiveWidth = function () { + if (!this.startWithNewLine) { + return true; + } + else { + return _super.prototype.needResponsiveWidth.call(this); + } + }; + PanelModel.prototype.getContainerCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_9__["CssClassBuilder"]().append(this.cssClasses.panel.container) + .append(this.cssClasses.panel.withFrame, this.hasFrameV2) + .append(this.cssClasses.panel.nested, !!(this.parent && this.parent.isPanel && !this.isDesignMode)) + .append(this.cssClasses.panel.collapsed, !!this.isCollapsed) + .append(this.cssClasses.panel.invisible, !this.isDesignMode && this.areInvisibleElementsShowing && !this.visible) + .toString(); + }; + return PanelModel; + }(PanelModelBase)); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("panelbase", [ + "name", + { + name: "elements", + alternativeName: "questions", + baseClassName: "question", + visible: false, + isLightSerializable: false, + }, + { name: "visible:switch", default: true }, + "visibleIf:condition", + "enableIf:condition", + "requiredIf:condition", + "readOnly:boolean", + { + name: "questionTitleLocation", + default: "default", + choices: ["default", "top", "bottom", "left", "hidden"], + }, + { name: "title:text", serializationProperty: "locTitle" }, + { name: "description:text", serializationProperty: "locDescription" }, + { + name: "questionsOrder", + default: "default", + choices: ["default", "initial", "random"], + }, + ], function () { + return new PanelModelBase(); + }); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("panel", [ + { + name: "state", + default: "default", + choices: ["default", "collapsed", "expanded"], + }, + "isRequired:switch", + { + name: "requiredErrorText:text", + serializationProperty: "locRequiredErrorText", + }, + { name: "startWithNewLine:boolean", default: true }, + "width", + { name: "minWidth", default: _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].minWidth }, + { name: "maxWidth", default: _settings__WEBPACK_IMPORTED_MODULE_7__["settings"].maxWidth }, + { name: "innerIndent:number", default: 0, choices: [0, 1, 2, 3] }, + { name: "indent:number", default: 0, choices: [0, 1, 2, 3] }, + { + name: "page", + isSerializable: false, + visibleIf: function (obj) { + var survey = obj ? obj.survey : null; + return !survey || !survey.pages || survey.pages.length > 1; + }, + choices: function (obj) { + var survey = obj ? obj.survey : null; + return survey + ? survey.pages.map(function (p) { + return { value: p.name, text: p.title }; + }) + : []; + }, + }, + "showNumber:boolean", + { + name: "showQuestionNumbers", + default: "default", + choices: ["default", "onpanel", "off"], + }, + "questionStartIndex", + { name: "allowAdaptiveActions:boolean", default: true, visible: false }, + ], function () { + return new PanelModel(); + }, "panelbase"); + _questionfactory__WEBPACK_IMPORTED_MODULE_5__["ElementFactory"].Instance.registerElement("panel", function (name) { + return new PanelModel(name); + }); + + + /***/ }), + + /***/ "./src/popup.ts": + /*!**********************!*\ + !*** ./src/popup.ts ***! + \**********************/ + /*! exports provided: PopupModel, createPopupModalViewModel, PopupBaseViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PopupModel", function() { return PopupModel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPopupModalViewModel", function() { return createPopupModalViewModel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PopupBaseViewModel", function() { return PopupBaseViewModel; }); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _utils_popup__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/popup */ "./src/utils/popup.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + var PopupModel = /** @class */ (function (_super) { + __extends(PopupModel, _super); + function PopupModel(contentComponentName, contentComponentData, verticalPosition, horizontalPosition, showPointer, isModal, onCancel, onApply, onHide, onShow, cssClass, title) { + if (verticalPosition === void 0) { verticalPosition = "bottom"; } + if (horizontalPosition === void 0) { horizontalPosition = "left"; } + if (showPointer === void 0) { showPointer = true; } + if (isModal === void 0) { isModal = false; } + if (onCancel === void 0) { onCancel = function () { }; } + if (onApply === void 0) { onApply = function () { return true; }; } + if (onHide === void 0) { onHide = function () { }; } + if (onShow === void 0) { onShow = function () { }; } + if (cssClass === void 0) { cssClass = ""; } + if (title === void 0) { title = ""; } + var _this = _super.call(this) || this; + _this.contentComponentName = contentComponentName; + _this.contentComponentData = contentComponentData; + _this.verticalPosition = verticalPosition; + _this.horizontalPosition = horizontalPosition; + _this.showPointer = showPointer; + _this.isModal = isModal; + _this.onCancel = onCancel; + _this.onApply = onApply; + _this.onHide = onHide; + _this.onShow = onShow; + _this.cssClass = cssClass; + _this.title = title; + return _this; + } + Object.defineProperty(PopupModel.prototype, "isVisible", { + get: function () { + return this.getPropertyValue("isVisible", false); + }, + set: function (value) { + if (this.isVisible === value) { + return; + } + this.setPropertyValue("isVisible", value); + this.onVisibilityChanged && this.onVisibilityChanged(value); + if (this.isVisible) { + var innerModel = this.contentComponentData["model"]; + innerModel && innerModel.refresh && innerModel.refresh(); + this.onShow(); + } + else { + this.onHide(); + } + }, + enumerable: false, + configurable: true + }); + PopupModel.prototype.toggleVisibility = function () { + this.isVisible = !this.isVisible; + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() + ], PopupModel.prototype, "contentComponentName", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() + ], PopupModel.prototype, "contentComponentData", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "bottom" }) + ], PopupModel.prototype, "verticalPosition", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "left" }) + ], PopupModel.prototype, "horizontalPosition", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false }) + ], PopupModel.prototype, "showPointer", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false }) + ], PopupModel.prototype, "isModal", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: function () { } }) + ], PopupModel.prototype, "onCancel", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: function () { return true; } }) + ], PopupModel.prototype, "onApply", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: function () { } }) + ], PopupModel.prototype, "onHide", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: function () { } }) + ], PopupModel.prototype, "onShow", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "" }) + ], PopupModel.prototype, "cssClass", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "" }) + ], PopupModel.prototype, "title", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "popup" }) + ], PopupModel.prototype, "displayMode", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "contentWidth" }) + ], PopupModel.prototype, "widthMode", void 0); + return PopupModel; + }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); + + function createPopupModalViewModel(componentName, data, onApply, onCancel, onHide, onShow, cssClass, title, displayMode) { + if (onHide === void 0) { onHide = function () { }; } + if (onShow === void 0) { onShow = function () { }; } + if (displayMode === void 0) { displayMode = "popup"; } + var popupModel = new PopupModel(componentName, data, "top", "left", false, true, onCancel, onApply, onHide, onShow, cssClass, title); + popupModel.displayMode = displayMode; + var popupViewModel = new PopupBaseViewModel(popupModel, undefined); + popupViewModel.initializePopupContainer(); + return popupViewModel; + } + var FOCUS_INPUT_SELECTOR = "input:not(:disabled):not([readonly]):not([type=hidden]),select:not(:disabled):not([readonly]),textarea:not(:disabled):not([readonly]), button:not(:disabled):not([readonly]), [tabindex]:not([tabindex^=\"-\"])"; + var PopupBaseViewModel = /** @class */ (function (_super) { + __extends(PopupBaseViewModel, _super); + function PopupBaseViewModel(model, targetElement) { + var _this = _super.call(this) || this; + _this.targetElement = targetElement; + _this.scrollEventCallBack = function () { return _this.hidePopup(); }; + _this.model = model; + return _this; + } + PopupBaseViewModel.prototype.hidePopup = function () { + this.model.isVisible = false; + }; + Object.defineProperty(PopupBaseViewModel.prototype, "model", { + get: function () { + return this._model; + }, + set: function (model) { + var _this = this; + if (!!this.model) { + this.model.unRegisterFunctionOnPropertiesValueChanged(["isVisible"], "PopupBaseViewModel"); + } + this._model = model; + var updater = function () { + if (!model.isVisible) { + _this.updateOnHiding(); + } + _this.isVisible = model.isVisible; + }; + model.registerFunctionOnPropertyValueChanged("isVisible", updater, "PopupBaseViewModel"); + updater(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PopupBaseViewModel.prototype, "title", { + get: function () { + return this.model.title; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PopupBaseViewModel.prototype, "contentComponentName", { + get: function () { + return this.model.contentComponentName; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PopupBaseViewModel.prototype, "contentComponentData", { + get: function () { + return this.model.contentComponentData; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PopupBaseViewModel.prototype, "showPointer", { + get: function () { + return this.model.showPointer && !this.isOverlay && !this.isModal; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PopupBaseViewModel.prototype, "isModal", { + get: function () { + return this.model.isModal; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PopupBaseViewModel.prototype, "showFooter", { + get: function () { + return this.isModal || this.isOverlay; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PopupBaseViewModel.prototype, "isOverlay", { + get: function () { + return this.model.displayMode === "overlay"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PopupBaseViewModel.prototype, "styleClass", { + get: function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__["CssClassBuilder"]() + .append(this.model.cssClass) + .append("sv-popup--modal", this.isModal && !this.isOverlay) + .append("sv-popup--dropdown", !this.isModal && !this.isOverlay) + .append("sv-popup--show-pointer", !this.isModal && !this.isOverlay && this.showPointer) + .append("sv-popup--".concat(this.popupDirection), !this.isModal && !this.isOverlay && this.showPointer) + .append("sv-popup--".concat(this.model.displayMode), this.isOverlay) + .toString(); + }, + enumerable: false, + configurable: true + }); + PopupBaseViewModel.prototype.onKeyDown = function (event) { + if (event.key === "Tab" || event.keyCode === 9) { + this.trapFocus(event); + } + else if (event.key === "Escape" || event.keyCode === 27) { + if (this.isModal) { + this.model.onCancel(); + } + this.hidePopup(); + } + }; + PopupBaseViewModel.prototype.trapFocus = function (event) { + var focusableElements = this.container.querySelectorAll(FOCUS_INPUT_SELECTOR); + var firstFocusableElement = focusableElements[0]; + var lastFocusableElement = focusableElements[focusableElements.length - 1]; + if (event.shiftKey) { + if (document.activeElement === firstFocusableElement) { + lastFocusableElement.focus(); + event.preventDefault(); + } + } + else { + if (document.activeElement === lastFocusableElement) { + firstFocusableElement.focus(); + event.preventDefault(); + } + } + }; + PopupBaseViewModel.prototype.updateOnShowing = function () { + this.prevActiveElement = document.activeElement; + if (!this.isModal || this.isOverlay) { + this.updatePosition(); + } + this.focusFirstInput(); + if (!this.isModal) { + window.addEventListener("scroll", this.scrollEventCallBack); + } + }; + PopupBaseViewModel.prototype.updateOnHiding = function () { + this.prevActiveElement && this.prevActiveElement.focus(); + if (!this.isModal) { + window.removeEventListener("scroll", this.scrollEventCallBack); + } + }; + PopupBaseViewModel.prototype.updatePosition = function () { + if (this.model.displayMode !== "overlay") { + var rect = this.targetElement.getBoundingClientRect(); + var background = this.container.children[0]; + var popupContainer = background.children[0]; + var scrollContent = background.children[0].querySelector(".sv-popup__scrolling-content"); + var popupComputedStyle = window.getComputedStyle(popupContainer); + var marginLeft = (parseFloat(popupComputedStyle.marginLeft) || 0); + var marginRight = (parseFloat(popupComputedStyle.marginRight) || 0); + var margin = marginLeft + marginRight; + var height = popupContainer.offsetHeight - scrollContent.offsetHeight + scrollContent.scrollHeight; + var width = this.model.width || popupContainer.getBoundingClientRect().width; + var widthMargins = width + margin; + this.width = (this.model.widthMode === "fixedWidth" && !!this.model.width) ? (this.model.width + "px") : "auto"; + this.height = "auto"; + var verticalPosition = this.model.verticalPosition; + if (!!window) { + height = Math.ceil(Math.min(height, window.innerHeight * 0.9)); + verticalPosition = _utils_popup__WEBPACK_IMPORTED_MODULE_3__["PopupUtils"].updateVerticalPosition(rect, height, this.model.verticalPosition, this.model.showPointer, window.innerHeight); + } + this.popupDirection = _utils_popup__WEBPACK_IMPORTED_MODULE_3__["PopupUtils"].calculatePopupDirection(verticalPosition, this.model.horizontalPosition); + var pos = _utils_popup__WEBPACK_IMPORTED_MODULE_3__["PopupUtils"].calculatePosition(rect, height, widthMargins, verticalPosition, this.model.horizontalPosition, this.showPointer); + if (!!window) { + var newVerticalDimensions = _utils_popup__WEBPACK_IMPORTED_MODULE_3__["PopupUtils"].updateVerticalDimensions(pos.top, height, window.innerHeight); + if (!!newVerticalDimensions) { + this.height = newVerticalDimensions.height + "px"; + pos.top = newVerticalDimensions.top; + } + var newHorizontalDimensions = _utils_popup__WEBPACK_IMPORTED_MODULE_3__["PopupUtils"].updateHorizontalDimensions(pos.left, widthMargins, window.innerWidth, this.model.horizontalPosition); + if (!!newHorizontalDimensions) { + pos.left = newHorizontalDimensions.left; + } + } + this.left = pos.left + "px"; + this.top = pos.top + "px"; + if (this.showPointer) { + this.pointerTarget = _utils_popup__WEBPACK_IMPORTED_MODULE_3__["PopupUtils"].calculatePointerTarget(rect, pos.top, pos.left, verticalPosition, this.model.horizontalPosition, marginLeft, marginRight); + } + this.pointerTarget.top += "px"; + this.pointerTarget.left += "px"; + } + else { + this.left = null; + this.top = null; + this.height = null; + this.width = null; + } + }; + PopupBaseViewModel.prototype.focusFirstInput = function () { + var _this = this; + setTimeout(function () { + var el = _this.container.querySelector(FOCUS_INPUT_SELECTOR); + if (!!el) + el.focus(); + else + _this.container.children[0].focus(); + }, 100); + }; + PopupBaseViewModel.prototype.clickOutside = function () { + if (this.isModal) { + return; + } + this.hidePopup(); + }; + PopupBaseViewModel.prototype.cancel = function () { + this.model.onCancel(); + this.hidePopup(); + }; + PopupBaseViewModel.prototype.apply = function () { + if (!!this.model.onApply && !this.model.onApply()) + return; + this.hidePopup(); + }; + Object.defineProperty(PopupBaseViewModel.prototype, "cancelButtonText", { + get: function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("modalCancelButtonText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(PopupBaseViewModel.prototype, "applyButtonText", { + get: function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("modalApplyButtonText"); + }, + enumerable: false, + configurable: true + }); + PopupBaseViewModel.prototype.dispose = function () { + _super.prototype.dispose.call(this); + this.unmountPopupContainer(); + this.container = undefined; + this.model.onVisibilityChanged = undefined; + }; + PopupBaseViewModel.prototype.initializePopupContainer = function () { + if (!this.container) { + var container = document.createElement("div"); + this.container = container; + } + document.body.appendChild(this.container); + }; + PopupBaseViewModel.prototype.unmountPopupContainer = function () { + this.container.remove(); + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "0px" }) + ], PopupBaseViewModel.prototype, "top", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "0px" }) + ], PopupBaseViewModel.prototype, "left", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "auto" }) + ], PopupBaseViewModel.prototype, "height", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "auto" }) + ], PopupBaseViewModel.prototype, "width", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false }) + ], PopupBaseViewModel.prototype, "isVisible", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "left" }) + ], PopupBaseViewModel.prototype, "popupDirection", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: { left: "0px", top: "0px" } }) + ], PopupBaseViewModel.prototype, "pointerTarget", void 0); + return PopupBaseViewModel; + }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); + + + + /***/ }), + + /***/ "./src/question.ts": + /*!*************************!*\ + !*** ./src/question.ts ***! + \*************************/ + /*! exports provided: Question */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Question", function() { return Question; }); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); + /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./error */ "./src/error.ts"); + /* harmony import */ var _validator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./validator */ "./src/validator.ts"); + /* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts"); + /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); + /* harmony import */ var _questionCustomWidgets__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./questionCustomWidgets */ "./src/questionCustomWidgets.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + /* harmony import */ var _rendererFactory__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./rendererFactory */ "./src/rendererFactory.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + + + + + + + + /** + * A base class for all questions. + */ + var Question = /** @class */ (function (_super) { + __extends(Question, _super); + function Question(name) { + var _this = _super.call(this, name) || this; + _this.customWidgetData = { isNeedRender: true }; + _this.isReadyValue = true; + /** + * The event is fired when isReady property of question is changed. + *
options.question - the question + *
options.isReady - current value of isReady + *
options.oldIsReady - old value of isReady + */ + _this.onReadyChanged = _this.addEvent(); + _this.parentQuestionValue = null; + _this.focusIn = function () { + _this.survey.whenQuestionFocusIn(_this); + }; + _this.isRunningValidatorsValue = false; + _this.isValueChangedInSurvey = false; + _this.allowNotifyValueChanged = true; + _this.id = Question.getQuestionId(); + _this.onCreating(); + _this.createNewArray("validators", function (validator) { + validator.errorOwner = _this; + }); + _this.addExpressionProperty("visibleIf", function (obj, res) { _this.visible = res === true; }, function (obj) { return !_this.areInvisibleElementsShowing; }); + _this.addExpressionProperty("enableIf", function (obj, res) { _this.readOnly = res === false; }); + _this.addExpressionProperty("requiredIf", function (obj, res) { _this.isRequired = res === true; }); + _this.createLocalizableString("commentText", _this, true, "otherItemText"); + _this.createLocalizableString("comment,Text", _this, true, "otherItemText"); + _this.locTitle.onGetDefaultTextCallback = function () { + return _this.name; + }; + _this.createLocalizableString("requiredErrorText", _this); + _this.registerFunctionOnPropertyValueChanged("width", function () { + _this.updateQuestionCss(); + if (!!_this.parent) { + _this.parent.elementWidthChanged(_this); + } + }); + _this.registerFunctionOnPropertyValueChanged("isRequired", function () { + _this.locTitle.onChanged(); + _this.clearCssClasses(); + }); + _this.registerFunctionOnPropertiesValueChanged(["indent", "rightIndent"], function () { + _this.onIndentChanged(); + }); + _this.registerFunctionOnPropertiesValueChanged(["hasComment", "hasOther"], function () { + _this.initCommentFromSurvey(); + }); + _this.registerFunctionOnPropertyValueChanged("isMobile", function () { + _this.onMobileChanged(); + }); + return _this; + } + Question.getQuestionId = function () { + return "sq_" + Question.questionCounter++; + }; + Question.prototype.isReadOnlyRenderDiv = function () { + return this.isReadOnly && _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].readOnlyCommentRenderMode === "div"; + }; + Question.prototype.createLocTitleProperty = function () { + var _this = this; + var locTitleValue = _super.prototype.createLocTitleProperty.call(this); + locTitleValue.onGetTextCallback = function (text) { + if (!text) { + text = _this.name; + } + if (!_this.survey) + return text; + return _this.survey.getUpdatedQuestionTitle(_this, text); + }; + this.locProcessedTitle = new _localizablestring__WEBPACK_IMPORTED_MODULE_5__["LocalizableString"](this, true); + this.locProcessedTitle.sharedData = locTitleValue; + return locTitleValue; + }; + Question.prototype.getSurvey = function (live) { + if (live === void 0) { live = false; } + if (live) { + return !!this.parent ? this.parent.getSurvey(live) : null; + } + if (!!this.onGetSurvey) + return this.onGetSurvey(); + return _super.prototype.getSurvey.call(this); + }; + Question.prototype.getValueName = function () { + if (!!this.valueName) + return this.valueName.toString(); + return this.name; + }; + Object.defineProperty(Question.prototype, "valueName", { + /** + * Use this property if you want to store the question result in the name different from the question name. + * Question name should be unique in the survey and valueName could be not unique. It allows to share data between several questions with the same valueName. + * The library set the value automatically if the question.name property is not valid. For example, if it contains the period '.' symbol. + * In this case if you set the question.name property to 'x.y' then the valueName becomes 'x y'. + * Please note, this property is hidden for questions without input, for example html question. + * @see name + */ + get: function () { + return this.getPropertyValue("valueName", ""); + }, + set: function (val) { + var oldValueName = this.getValueName(); + this.setPropertyValue("valueName", val); + this.onValueNameChanged(oldValueName); + }, + enumerable: false, + configurable: true + }); + Question.prototype.onValueNameChanged = function (oldValue) { + if (!this.survey) + return; + this.survey.questionRenamed(this, this.name, !!oldValue ? oldValue : this.name); + this.initDataFromSurvey(); + }; + Question.prototype.onNameChanged = function (oldValue) { + this.locTitle.onChanged(); + if (!this.survey) + return; + this.survey.questionRenamed(this, oldValue, this.valueName ? this.valueName : oldValue); + }; + Object.defineProperty(Question.prototype, "isReady", { + get: function () { + return this.isReadyValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "ariaRequired", { + /** + * A11Y properties + */ + get: function () { + return this.isRequired ? "true" : "false"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "ariaLabel", { + get: function () { + return this.locTitle.renderedHtml; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "ariaInvalid", { + get: function () { + return this.errors.length > 0 ? "true" : "false"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "ariaDescribedBy", { + get: function () { + return this.errors.length > 0 ? this.id + "_errors" : null; + }, + enumerable: false, + configurable: true + }); + /** + * Get is question ready to use + */ + Question.prototype.choicesLoaded = function () { }; + Object.defineProperty(Question.prototype, "page", { + /** + * Get/set the page where the question is located. + */ + get: function () { + return this.getPage(this.parent); + }, + set: function (val) { + this.setPage(this.parent, val); + }, + enumerable: false, + configurable: true + }); + Question.prototype.getPanel = function () { + return null; + }; + Question.prototype.delete = function () { + if (!!this.parent) { + this.removeSelfFromList(this.parent.elements); + } + }; + Object.defineProperty(Question.prototype, "isFlowLayout", { + get: function () { + return this.getLayoutType() === "flow"; + }, + enumerable: false, + configurable: true + }); + Question.prototype.getLayoutType = function () { + if (!!this.parent) + return this.parent.getChildrenLayoutType(); + return "row"; + }; + Question.prototype.isLayoutTypeSupported = function (layoutType) { + return layoutType !== "flow"; + }; + Object.defineProperty(Question.prototype, "visible", { + /** + * Use it to get/set the question visibility. + * @see visibleIf + */ + get: function () { + return this.getPropertyValue("visible", true); + }, + set: function (val) { + if (val == this.visible) + return; + this.setPropertyValue("visible", val); + this.onVisibleChanged(); + this.notifySurveyVisibilityChanged(); + }, + enumerable: false, + configurable: true + }); + Question.prototype.onVisibleChanged = function () { + this.setPropertyValue("isVisible", this.isVisible); + if (!this.isVisible && this.errors && this.errors.length > 0) { + this.errors = []; + } + }; + Object.defineProperty(Question.prototype, "useDisplayValuesInTitle", { + /** + * Use it to choose how other question values will be rendered in title if referenced in {}. + * Please note, this property is hidden for question without input, for example html question. + */ + get: function () { + return this.getPropertyValue("useDisplayValuesInTitle"); + }, + set: function (val) { + this.setPropertyValue("useDisplayValuesInTitle", val); + }, + enumerable: false, + configurable: true + }); + Question.prototype.getUseDisplayValuesInTitle = function () { return this.useDisplayValuesInTitle; }; + Object.defineProperty(Question.prototype, "visibleIf", { + /** + * An expression that returns true or false. If it returns true the Question becomes visible and if it returns false the Question becomes invisible. The library runs the expression on survey start and on changing a question value. If the property is empty then visible property is used. + * @see visible + */ + get: function () { + return this.getPropertyValue("visibleIf", ""); + }, + set: function (val) { + this.setPropertyValue("visibleIf", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "isVisible", { + /** + * Returns true if the question is visible or survey is in design mode right now. + */ + get: function () { + if (this.survey && this.survey.areEmptyElementsHidden && this.isEmpty()) + return false; + return this.visible || this.areInvisibleElementsShowing; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "visibleIndex", { + /** + * Returns the visible index of the question in the survey. It can be from 0 to all visible questions count - 1 + * The visibleIndex is -1 if the title is 'hidden' or hideNumber is true + * @see titleLocation + * @see hideNumber + */ + get: function () { + return this.getPropertyValue("visibleIndex", -1); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "hideNumber", { + /** + * Set hideNumber to true to stop showing the number for this question. The question will not be counter + * @see visibleIndex + * @see titleLocation + */ + get: function () { + return this.getPropertyValue("hideNumber"); + }, + set: function (val) { + this.setPropertyValue("hideNumber", val); + this.notifySurveyVisibilityChanged(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "isAllowTitleLeft", { + /** + * Returns true if the question may have a title located on the left + */ + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + /** + * Returns the type of the object as a string as it represents in the json. + */ + Question.prototype.getType = function () { + return "question"; + }; + Object.defineProperty(Question.prototype, "isQuestion", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + /** + * Move question to a new container Page/Panel. Add as a last element if insertBefore parameter is not used or inserted into the given index, + * if insert parameter is number, or before the given element, if the insertBefore parameter is a question or panel + * @param container Page or Panel to where a question is relocated. + * @param insertBefore Use it if you want to set the question to a specific position. You may use a number (use 0 to insert int the beginning) or element, if you want to insert before this element. + */ + Question.prototype.moveTo = function (container, insertBefore) { + if (insertBefore === void 0) { insertBefore = null; } + return this.moveToBase(this.parent, container, insertBefore); + }; + Question.prototype.getProgressInfo = function () { + if (!this.hasInput) + return _super.prototype.getProgressInfo.call(this); + return { + questionCount: 1, + answeredQuestionCount: !this.isEmpty() ? 1 : 0, + requiredQuestionCount: this.isRequired ? 1 : 0, + requiredAnsweredQuestionCount: !this.isEmpty() && this.isRequired ? 1 : 0, + }; + }; + Question.prototype.runConditions = function () { + if (this.data && !this.isLoadingFromJson) { + if (!this.isDesignMode) { + this.runCondition(this.getDataFilteredValues(), this.getDataFilteredProperties()); + } + this.locStrsChanged(); + } + }; + Question.prototype.setSurveyImpl = function (value, isLight) { + _super.prototype.setSurveyImpl.call(this, value); + if (!this.survey) + return; + this.survey.questionCreated(this); + if (isLight !== true) { + this.runConditions(); + } + }; + Object.defineProperty(Question.prototype, "parent", { + /** + * A parent element. It can be panel or page. + */ + get: function () { + return this.getPropertyValue("parent", null); + }, + set: function (val) { + if (this.parent === val) + return; + this.delete(); + this.setPropertyValue("parent", val); + this.updateQuestionCss(); + this.onParentChanged(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "parentQuestion", { + /** + * A parent question. It can be a dynamic panel or dynamic/dropdown matrices. If the value is a matrix, it means that question is a cell question. + * This property is null for a stand alone question. + */ + get: function () { + return this.parentQuestionValue; + }, + enumerable: false, + configurable: true + }); + Question.prototype.setParentQuestion = function (val) { + this.parentQuestionValue = val; + this.onParentQuestionChanged(); + }; + Question.prototype.onParentQuestionChanged = function () { }; + Question.prototype.onParentChanged = function () { }; + Object.defineProperty(Question.prototype, "hasTitle", { + /** + * Returns false if the question doesn't have a title property, for example: QuestionHtmlModel, or titleLocation property equals to "hidden" + * @see titleLocation + */ + get: function () { + return this.getTitleLocation() !== "hidden"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "titleLocation", { + /** + * Set this property different from "default" to set the specific question title location for this panel/page. + * Please note, this property is hidden for questions without input, for example html question. + * @see SurveyModel.questionTitleLocation + */ + get: function () { + return this.getPropertyValue("titleLocation"); + }, + set: function (value) { + var isVisibilityChanged = this.titleLocation == "hidden" || value == "hidden"; + this.setPropertyValue("titleLocation", value.toLowerCase()); + this.updateQuestionCss(); + if (isVisibilityChanged) { + this.notifySurveyVisibilityChanged(); + } + }, + enumerable: false, + configurable: true + }); + Question.prototype.getTitleOwner = function () { return this; }; + Question.prototype.notifySurveyVisibilityChanged = function () { + if (!this.survey || this.isLoadingFromJson) + return; + this.survey.questionVisibilityChanged(this, this.isVisible); + if (this.isClearValueOnHidden) { + if (!this.visible) { + this.clearValueIfInvisible(); + } + if (this.isVisible) { + this.updateValueWithDefaults(); + } + } + }; + /** + * Return the title location based on question titleLocation property and QuestionTitleLocation of it's parents + * @see titleLocation + * @see PanelModelBase.QuestionTitleLocation + * @see SurveyModel.QuestionTitleLocation + */ + Question.prototype.getTitleLocation = function () { + if (this.isFlowLayout) + return "hidden"; + var location = this.getTitleLocationCore(); + if (location === "left" && !this.isAllowTitleLeft) + location = "top"; + return location; + }; + Question.prototype.getTitleLocationCore = function () { + if (this.titleLocation !== "default") + return this.titleLocation; + if (!!this.parent) + return this.parent.getQuestionTitleLocation(); + if (!!this.survey) + return this.survey.questionTitleLocation; + return "top"; + }; + Object.defineProperty(Question.prototype, "hasTitleOnLeft", { + get: function () { + return this.hasTitle && this.getTitleLocation() === "left"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "hasTitleOnTop", { + get: function () { + return this.hasTitle && this.getTitleLocation() === "top"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "hasTitleOnBottom", { + get: function () { + return this.hasTitle && this.getTitleLocation() === "bottom"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "hasTitleOnLeftTop", { + get: function () { + if (!this.hasTitle) + return false; + var location = this.getTitleLocation(); + return location === "left" || location === "top"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "errorLocation", { + get: function () { + return this.survey ? this.survey.questionErrorLocation : "top"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "hasInput", { + /** + * Returns false if the question doesn't have an input element, for example: QuestionHtmlModel + * @see hasSingleInput + */ + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "hasSingleInput", { + /** + * Returns false if the question doesn't have an input element or have multiple inputs: matrices or panel dynamic + * @see hasInput + */ + get: function () { + return this.hasInput; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "inputId", { + get: function () { + return this.id + "i"; + }, + enumerable: false, + configurable: true + }); + Question.prototype.getDefaultTitleValue = function () { return this.name; }; + Question.prototype.getDefaultTitleTagName = function () { + return _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].titleTags.question; + }; + Object.defineProperty(Question.prototype, "descriptionLocation", { + /** + * Question description location. By default, value is "default" and it depends on survey questionDescriptionLocation property + * You may change it to "underInput" to render it under question input or "underTitle" to rendered it under title. + * @see description + * @see Survey.questionDescriptionLocation + */ + get: function () { + return this.getPropertyValue("descriptionLocation"); + }, + set: function (val) { + this.setPropertyValue("descriptionLocation", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "hasDescriptionUnderTitle", { + get: function () { + return this.getDescriptionLocation() == "underTitle"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "hasDescriptionUnderInput", { + get: function () { + return this.getDescriptionLocation() == "underInput"; + }, + enumerable: false, + configurable: true + }); + Question.prototype.getDescriptionLocation = function () { + if (this.descriptionLocation !== "default") + return this.descriptionLocation; + return !!this.survey + ? this.survey.questionDescriptionLocation + : "underTitle"; + }; + Question.prototype.needClickTitleFunction = function () { + return _super.prototype.needClickTitleFunction.call(this) || this.hasInput; + }; + Question.prototype.processTitleClick = function () { + var _this = this; + _super.prototype.processTitleClick.call(this); + if (this.isCollapsed) + return; + setTimeout(function () { + _this.focus(); + }, 1); + return true; + }; + Object.defineProperty(Question.prototype, "requiredErrorText", { + /** + * The custom text that will be shown on required error. Use this property, if you do not want to show the default text. + * Please note, this property is hidden for question without input, for example html question. + */ + get: function () { + return this.getLocalizableStringText("requiredErrorText"); + }, + set: function (val) { + this.setLocalizableStringText("requiredErrorText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "locRequiredErrorText", { + get: function () { + return this.getLocalizableString("requiredErrorText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "commentText", { + /** + * Use it to get or set the comment value. + */ + get: function () { + return this.getLocalizableStringText("commentText"); + }, + set: function (val) { + this.setLocalizableStringText("commentText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "locCommentText", { + get: function () { + return this.getLocalizableString("commentText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "commentOrOtherPlaceHolder", { + get: function () { + return this.otherPlaceHolder || this.commentPlaceHolder; + }, + enumerable: false, + configurable: true + }); + /** + * Returns a copy of question errors survey. For some questions like matrix and panel dynamic it includes the errors of nested questions. + */ + Question.prototype.getAllErrors = function () { + return this.errors.slice(); + }; + Question.prototype.getErrorByType = function (errorType) { + for (var i = 0; i < this.errors.length; i++) { + if (this.errors[i].getErrorType() === errorType) + return this.errors[i]; + } + return null; + }; + Object.defineProperty(Question.prototype, "customWidget", { + /** + * The link to the custom widget. + */ + get: function () { + if (!this.isCustomWidgetRequested && !this.customWidgetValue) { + this.isCustomWidgetRequested = true; + this.updateCustomWidget(); + } + return this.customWidgetValue; + }, + enumerable: false, + configurable: true + }); + Question.prototype.updateCustomWidget = function () { + this.customWidgetValue = _questionCustomWidgets__WEBPACK_IMPORTED_MODULE_7__["CustomWidgetCollection"].Instance.getCustomWidget(this); + }; + Question.prototype.localeChanged = function () { + _super.prototype.localeChanged.call(this); + if (!!this.localeChangedCallback) { + this.localeChangedCallback(); + } + }; + Object.defineProperty(Question.prototype, "isCompositeQuestion", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Question.prototype.updateCommentElement = function () { + if (this.commentElement && this.autoGrowComment) + Object(_utils_utils__WEBPACK_IMPORTED_MODULE_11__["increaseHeightByContent"])(this.commentElement); + }; + Question.prototype.onCommentInput = function (event) { + if (this.isInputTextUpdate) { + if (event.target) { + this.comment = event.target.value; + } + } + else { + this.updateCommentElement(); + } + }; + Question.prototype.onCommentChange = function (event) { + this.comment = event.target.value; + if (this.comment !== event.target.value) { + event.target.value = this.comment; + } + }; + Question.prototype.afterRenderQuestionElement = function (el) { + if (!this.survey || !this.hasSingleInput) + return; + this.survey.afterRenderQuestionInput(this, el); + }; + Question.prototype.afterRender = function (el) { + if (!this.survey) + return; + this.survey.afterRenderQuestion(this, el); + if (!!this.afterRenderQuestionCallback) { + this.afterRenderQuestionCallback(this, el); + } + if (this.supportComment() || this.supportOther()) { + this.commentElement = (document.getElementById(this.id) && document.getElementById(this.id).querySelector("textarea")) || null; + this.updateCommentElement(); + } + this.checkForResponsiveness(el); + }; + Question.prototype.beforeDestroyQuestionElement = function (el) { }; + Object.defineProperty(Question.prototype, "processedTitle", { + /** + * Returns the rendred question title. + */ + get: function () { + var res = this.locProcessedTitle.textOrHtml; + return res ? res : this.name; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "fullTitle", { + /** + * Returns the title after processing the question template. + * @see SurveyModel.questionTitleTemplate + */ + get: function () { + return this.locTitle.renderedHtml; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "titlePattern", { + get: function () { + return !!this.survey ? this.survey.questionTitlePattern : "numTitleRequire"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "isRequireTextOnStart", { + get: function () { + return this.isRequired && this.titlePattern == "requireNumTitle"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "isRequireTextBeforeTitle", { + get: function () { + return this.isRequired && this.titlePattern == "numRequireTitle" && this.requiredText !== ""; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "isRequireTextAfterTitle", { + get: function () { + return this.isRequired && this.titlePattern == "numTitleRequire" && this.requiredText !== ""; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "startWithNewLine", { + /** + * The Question renders on the new line if the property is true. If the property is false, the question tries to render on the same line/row with a previous question/panel. + */ + get: function () { + return this.getPropertyValue("startWithNewLine"); + }, + set: function (val) { + if (this.startWithNewLine == val) + return; + this.setPropertyValue("startWithNewLine", val); + }, + enumerable: false, + configurable: true + }); + Question.prototype.calcCssClasses = function (css) { + var classes = { error: {} }; + this.copyCssClasses(classes, css.question); + this.copyCssClasses(classes.error, css.error); + this.updateCssClasses(classes, css); + if (this.survey) { + this.survey.updateQuestionCssClasses(this, classes); + } + return classes; + }; + Object.defineProperty(Question.prototype, "cssRoot", { + get: function () { + this.ensureElementCss(); + return this.getPropertyValue("cssRoot", ""); + }, + enumerable: false, + configurable: true + }); + Question.prototype.setCssRoot = function (val) { + this.setPropertyValue("cssRoot", val); + }; + Question.prototype.getCssRoot = function (cssClasses) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(this.isFlowLayout && !this.isDesignMode + ? cssClasses.flowRoot + : cssClasses.mainRoot) + .append(cssClasses.titleLeftRoot, !this.isFlowLayout && this.hasTitleOnLeft) + .append(cssClasses.hasError, this.errors.length > 0) + .append(cssClasses.small, !this.width) + .append(cssClasses.answered, this.isAnswered) + .append(cssClasses.collapsed, !!this.isCollapsed) + .append(cssClasses.withFrame, this.hasFrameV2) + .append(cssClasses.nested, !this.hasFrameV2 && !this.isDesignMode) + .append(cssClasses.invisible, !this.isDesignMode && this.areInvisibleElementsShowing && !this.visible) + .toString(); + }; + Object.defineProperty(Question.prototype, "cssHeader", { + get: function () { + this.ensureElementCss(); + return this.getPropertyValue("cssHeader", ""); + }, + enumerable: false, + configurable: true + }); + Question.prototype.setCssHeader = function (val) { + this.setPropertyValue("cssHeader", val); + }; + Question.prototype.getCssHeader = function (cssClasses) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(cssClasses.header) + .append(cssClasses.headerTop, this.hasTitleOnTop) + .append(cssClasses.headerLeft, this.hasTitleOnLeft) + .append(cssClasses.headerBottom, this.hasTitleOnBottom) + .toString(); + }; + Object.defineProperty(Question.prototype, "cssContent", { + get: function () { + this.ensureElementCss(); + return this.getPropertyValue("cssContent", ""); + }, + enumerable: false, + configurable: true + }); + Question.prototype.setCssContent = function (val) { + this.setPropertyValue("cssContent", val); + }; + Question.prototype.getCssContent = function (cssClasses) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(cssClasses.content) + .append(cssClasses.contentLeft, this.hasTitleOnLeft) + .toString(); + }; + Object.defineProperty(Question.prototype, "cssTitle", { + get: function () { + this.ensureElementCss(); + return this.getPropertyValue("cssTitle", ""); + }, + enumerable: false, + configurable: true + }); + Question.prototype.setCssTitle = function (val) { + this.setPropertyValue("cssTitle", val); + }; + Question.prototype.getCssTitle = function (cssClasses) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(cssClasses.title) + .append(cssClasses.titleExpandable, this.isCollapsed || this.isExpanded) + .append(cssClasses.titleExpanded, this.isExpanded) + .append(cssClasses.titleCollapsed, this.isCollapsed) + .append(cssClasses.titleOnError, this.containsErrors) + .append(cssClasses.titleOnAnswer, !this.containsErrors && this.isAnswered) + .toString(); + }; + Object.defineProperty(Question.prototype, "cssDescription", { + get: function () { + this.ensureElementCss(); + return this.cssClasses.description; + }, + enumerable: false, + configurable: true + }); + Question.prototype.setCssDescription = function (val) { + this.setPropertyValue("cssDescription", ""); + }; + Question.prototype.getCssDescription = function (cssClasses) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(this.cssClasses.descriptionUnderInput, this.hasDescriptionUnderInput) + .append(this.cssClasses.description, this.hasDescriptionUnderTitle) + .toString(); + }; + Object.defineProperty(Question.prototype, "cssError", { + get: function () { + this.ensureElementCss(); + return this.getPropertyValue("cssError", ""); + }, + enumerable: false, + configurable: true + }); + Question.prototype.setCssError = function (val) { + this.setPropertyValue("cssError", val); + }; + Question.prototype.getCssError = function (cssClasses) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(cssClasses.error.root) + .append(cssClasses.error.aboveQuestion, this.isErrorsModeTooltip && !this.hasParent) + .append(cssClasses.error.tooltip, this.isErrorsModeTooltip && this.hasParent) + .append(cssClasses.error.locationTop, !this.isErrorsModeTooltip && this.errorLocation === "top") + .append(cssClasses.error.locationBottom, !this.isErrorsModeTooltip && this.errorLocation === "bottom") + .toString(); + }; + Question.prototype.getRootCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(this.cssRoot) + .append(this.cssClasses.disabled, this.isReadOnly) + .toString(); + }; + Question.prototype.updateElementCss = function (reNew) { + _super.prototype.updateElementCss.call(this, reNew); + if (reNew) { + this.updateQuestionCss(true); + } + this.onIndentChanged(); + }; + Question.prototype.updateQuestionCss = function (reNew) { + if (this.isLoadingFromJson || + !this.survey || + (reNew !== true && !this.cssClassesValue)) + return; + this.updateElementCssCore(this.cssClasses); + }; + Question.prototype.ensureElementCss = function () { + if (!this.cssClassesValue) { + this.updateQuestionCss(true); + } + }; + Question.prototype.updateElementCssCore = function (cssClasses) { + this.setCssRoot(this.getCssRoot(cssClasses)); + this.setCssHeader(this.getCssHeader(cssClasses)); + this.setCssContent(this.getCssContent(cssClasses)); + this.setCssTitle(this.getCssTitle(cssClasses)); + this.setCssDescription(this.getCssDescription(cssClasses)); + this.setCssError(this.getCssError(cssClasses)); + }; + Question.prototype.updateCssClasses = function (res, css) { + if (!css.question) + return; + var objCss = css[this.getCssType()]; + var titleBuilder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]().append(res.title) + .append(css.question.titleRequired, this.isRequired); + res.title = titleBuilder.toString(); + var rootBuilder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]().append(res.root) + .append(objCss, this.isRequired && !!css.question.required); + if (objCss === undefined || objCss === null) { + res.root = rootBuilder.toString(); + } + else if (typeof objCss === "string" || objCss instanceof String) { + res.root = rootBuilder.append(objCss.toString()).toString(); + } + else { + res.root = rootBuilder.toString(); + for (var key in objCss) { + res[key] = objCss[key]; + } + } + }; + Question.prototype.getCssType = function () { + return this.getType(); + }; + Object.defineProperty(Question.prototype, "renderCssRoot", { + get: function () { + return this.cssClasses.root || undefined; + }, + enumerable: false, + configurable: true + }); + Question.prototype.onIndentChanged = function () { + this.paddingLeft = this.getIndentSize(this.indent); + this.paddingRight = this.getIndentSize(this.rightIndent); + }; + Question.prototype.getIndentSize = function (indent) { + if (indent < 1 || !this.getSurvey() || !this.cssClasses || !this.cssClasses.indent) + return ""; + return indent * this.cssClasses.indent + "px"; + }; + /** + * Move the focus to the input of this question. + * @param onError set this parameter to true, to focus the input with the first error, other wise the first input will be focused. + */ + Question.prototype.focus = function (onError) { + if (onError === void 0) { onError = false; } + if (this.isDesignMode) + return; + if (!!this.survey) { + this.survey.scrollElementToTop(this, this, null, this.id); + } + var id = !onError + ? this.getFirstInputElementId() + : this.getFirstErrorInputElementId(); + if (_survey_element__WEBPACK_IMPORTED_MODULE_2__["SurveyElement"].FocusElement(id)) { + this.fireCallback(this.focusCallback); + } + }; + Question.prototype.fireCallback = function (callback) { + if (callback) + callback(); + }; + Question.prototype.getOthersMaxLength = function () { + if (!this.survey) + return null; + return this.survey.maxOthersLength > 0 ? this.survey.maxOthersLength : null; + }; + Question.prototype.onCreating = function () { }; + Question.prototype.getFirstInputElementId = function () { + return this.inputId; + }; + Question.prototype.getFirstErrorInputElementId = function () { + return this.getFirstInputElementId(); + }; + Question.prototype.getProcessedTextValue = function (textValue) { + var name = textValue.name.toLocaleLowerCase(); + textValue.isExists = + Object.keys(Question.TextPreprocessorValuesMap).indexOf(name) !== -1 || + this[textValue.name] !== undefined; + textValue.value = this[Question.TextPreprocessorValuesMap[name] || textValue.name]; + }; + Question.prototype.supportComment = function () { + return false; + }; + Question.prototype.supportOther = function () { + return false; + }; + Object.defineProperty(Question.prototype, "isRequired", { + /** + * Set this property to true, to make the question a required. If a user doesn't answer the question then a validation error will be generated. + * Please note, this property is hidden for question without input, for example html question. + */ + get: function () { + return this.getPropertyValue("isRequired"); + }, + set: function (val) { + this.setPropertyValue("isRequired", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "requiredIf", { + /** + * An expression that returns true or false. If it returns true the Question becomes required and an end-user has to answer it. + * If it returns false the Question then an end-user may not answer it the Question maybe empty. + * The library runs the expression on survey start and on changing a question value. If the property is empty then isRequired property is used. + * Please note, this property is hidden for question without input, for example html question. + * @see isRequired + */ + get: function () { + return this.getPropertyValue("requiredIf", ""); + }, + set: function (val) { + this.setPropertyValue("requiredIf", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "hasComment", { + /** + * Set it to true, to add a comment for the question. + */ + get: function () { + return this.getPropertyValue("hasComment", false); + }, + set: function (val) { + if (!this.supportComment()) + return; + this.setPropertyValue("hasComment", val); + if (this.hasComment) + this.hasOther = false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "id", { + /** + * The unique identificator. It is generated automatically. + */ + get: function () { + return this.getPropertyValue("id"); + }, + set: function (val) { + this.setPropertyValue("id", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "ariaTitleId", { + get: function () { + return this.id + "_ariaTitle"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "ariaRole", { + get: function () { + return null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "hasOther", { + get: function () { + return this.getPropertyValue("hasOther", false); + }, + set: function (val) { + if (!this.supportOther() || this.hasOther == val) + return; + this.setPropertyValue("hasOther", val); + if (this.hasOther) + this.hasComment = false; + this.hasOtherChanged(); + }, + enumerable: false, + configurable: true + }); + Question.prototype.hasOtherChanged = function () { }; + Object.defineProperty(Question.prototype, "requireUpdateCommentValue", { + get: function () { + return this.hasComment || this.hasOther; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "isReadOnly", { + /** + * Returns true if readOnly property is true or survey is in display mode or parent panel/page is readOnly. + * @see SurveyModel.model + * @see readOnly + */ + get: function () { + var isParentReadOnly = !!this.parent && this.parent.isReadOnly; + var isPareQuestionReadOnly = !!this.parentQuestion && this.parentQuestion.isReadOnly; + var isSurveyReadOnly = !!this.survey && this.survey.isDisplayMode; + return this.readOnly || isParentReadOnly || isSurveyReadOnly || isPareQuestionReadOnly; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "isInputReadOnly", { + get: function () { + var isDesignModeV2 = _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].supportCreatorV2 && this.isDesignMode; + return this.isReadOnly || isDesignModeV2; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "renderedInputReadOnly", { + get: function () { + return this.isInputReadOnly ? "" : undefined; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "renderedInputDisabled", { + get: function () { + return this.isInputReadOnly ? "" : undefined; + }, + enumerable: false, + configurable: true + }); + Question.prototype.onReadOnlyChanged = function () { + this.setPropertyValue("isInputReadOnly", this.isInputReadOnly); + _super.prototype.onReadOnlyChanged.call(this); + }; + Object.defineProperty(Question.prototype, "enableIf", { + /** + * An expression that returns true or false. If it returns false the Question becomes read only and an end-user will not able to answer on the qustion. The library runs the expression on survey start and on changing a question value. If the property is empty then readOnly property is used. + * Please note, this property is hidden for question without input, for example html question. + * @see readOnly + * @see isReadOnly + */ + get: function () { + return this.getPropertyValue("enableIf", ""); + }, + set: function (val) { + this.setPropertyValue("enableIf", val); + }, + enumerable: false, + configurable: true + }); + Question.prototype.surveyChoiceItemVisibilityChange = function () { }; + /** + * Run visibleIf and enableIf expressions. If visibleIf or/and enabledIf are not empty, then the results of performing the expression (true or false) set to the visible/readOnly properties. + * @param values Typically survey results + * @see visible + * @see visibleIf + * @see readOnly + * @see enableIf + */ + Question.prototype.runCondition = function (values, properties) { + if (this.isDesignMode) + return; + if (!properties) + properties = {}; + properties["question"] = this; + this.runConditionCore(values, properties); + if (!this.isValueChangedDirectly) { + this.defaultValueRunner = this.getDefaultRunner(this.defaultValueRunner, this.defaultValueExpression); + this.runDefaultValueExpression(this.defaultValueRunner, values, properties); + } + }; + Object.defineProperty(Question.prototype, "no", { + /** + * The property returns the question number. If question is invisible then it returns empty string. + * If visibleIndex is 1, then no is 2, or 'B' if survey.questionStartIndex is 'A'. + * @see SurveyModel.questionStartIndex + */ + get: function () { + return this.getPropertyValue("no"); + }, + enumerable: false, + configurable: true + }); + Question.prototype.calcNo = function () { + if (!this.hasTitle || this.hideNumber) + return ""; + var no = _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].getNumberByIndex(this.visibleIndex, this.getStartIndex()); + if (!!this.survey) { + no = this.survey.getUpdatedQuestionNo(this, no); + } + return no; + }; + Question.prototype.getStartIndex = function () { + if (!!this.parent) + return this.parent.getQuestionStartIndex(); + if (!!this.survey) + return this.survey.questionStartIndex; + return ""; + }; + Question.prototype.onSurveyLoad = function () { + this.fireCallback(this.surveyLoadCallback); + this.updateValueWithDefaults(); + if (this.isEmpty()) { + this.initDataFromSurvey(); + } + }; + Question.prototype.onSetData = function () { + _super.prototype.onSetData.call(this); + if (!this.survey) + return; + this.initDataFromSurvey(); + this.onSurveyValueChanged(this.value); + this.updateValueWithDefaults(); + this.onIndentChanged(); + this.updateQuestionCss(); + this.updateIsAnswered(); + }; + Question.prototype.initDataFromSurvey = function () { + if (!!this.data) { + var val = this.data.getValue(this.getValueName()); + if (!_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(val) || !this.isLoadingFromJson) { + this.updateValueFromSurvey(val); + } + this.initCommentFromSurvey(); + } + }; + Question.prototype.initCommentFromSurvey = function () { + if (!!this.data && this.requireUpdateCommentValue) { + this.updateCommentFromSurvey(this.data.getComment(this.getValueName())); + } + else { + this.updateCommentFromSurvey(""); + } + }; + Question.prototype.runExpression = function (expression) { + if (!this.survey || !expression) + return undefined; + return this.survey.runExpression(expression); + }; + Object.defineProperty(Question.prototype, "autoGrowComment", { + get: function () { + return this.survey && this.survey.autoGrowComment; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "questionValue", { + get: function () { + return this.getPropertyValue("value"); + }, + set: function (val) { + this.setPropertyValue("value", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "questionComment", { + get: function () { + return this.getPropertyValue("comment"); + }, + set: function (val) { + this.setPropertyValue("comment", val); + this.fireCallback(this.commentChangedCallback); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "value", { + /** + * Get/Set the question value. + * @see SurveyMode.setValue + * @see SurveyMode.getValue + */ + get: function () { + return this.getValueCore(); + }, + set: function (newValue) { + this.setNewValue(newValue); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "valueForSurvey", { + get: function () { + if (!!this.valueToDataCallback) { + return this.valueToDataCallback(this.value); + } + return this.value; + }, + enumerable: false, + configurable: true + }); + /** + * Clear the question value. It clears the question comment as well. + */ + Question.prototype.clearValue = function () { + if (this.value !== undefined) { + this.value = undefined; + } + this.comment = undefined; + }; + Question.prototype.unbindValue = function () { + this.clearValue(); + }; + Question.prototype.createValueCopy = function () { + return this.getUnbindValue(this.value); + }; + Question.prototype.getUnbindValue = function (value) { + if (this.isValueSurveyElement(value)) + return value; + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].getUnbindValue(value); + }; + Question.prototype.isValueSurveyElement = function (val) { + if (!val) + return false; + if (Array.isArray(val)) + return val.length > 0 ? this.isValueSurveyElement(val[0]) : false; + return !!val.getType && !!val.onPropertyChanged; + }; + Question.prototype.canClearValueAsInvisible = function () { + if (this.isVisible && this.isParentVisible) + return false; + if (!!this.page && this.page.isStarted) + return false; + if (!this.survey || !this.valueName) + return true; + return !this.survey.hasVisibleQuestionByValueName(this.valueName); + }; + Object.defineProperty(Question.prototype, "isParentVisible", { + /** + * Return true if there is a parent (page or panel) and it is visible + */ + get: function () { + var parent = this.parent; + while (parent) { + if (!parent.isVisible) + return false; + parent = parent.parent; + } + return true; + }, + enumerable: false, + configurable: true + }); + Question.prototype.clearValueIfInvisible = function (reason) { + if (reason === void 0) { reason = "onHidden"; } + if (this.clearIfInvisible === "none") + return; + if (reason === "onHidden" && this.clearIfInvisible === "onComplete") + return; + if (reason === "none" && (this.clearIfInvisible === "default" || this.clearIfInvisible === "none")) + return; + this.clearValueIfInvisibleCore(); + }; + Question.prototype.clearValueIfInvisibleCore = function () { + if (this.canClearValueAsInvisible()) { + this.clearValue(); + } + }; + Object.defineProperty(Question.prototype, "clearIfInvisible", { + /** + * Gets or sets a value that specifies how invisible question clears the value. By default the behavior is define by Survey "clearInvisibleValues" property. + * + * The following options are available: + * + * - `default` (default) - Survey "clearInvisibleValues" property defines the behavior. + * - `none` - do not clear invisible value. + * - `onHidden` - clear the question value when it becomes invisible. If a question has value and it was invisible initially then survey clears the value on completing. + * - `onComplete` - clear invisible question value on survey complete. + * @see SurveyModel.clearInvisibleValues + * @see Question.visible + * @see onComplete + */ + get: function () { + return this.getPropertyValue("clearIfInvisible"); + }, + set: function (val) { + this.setPropertyValue("clearIfInvisible", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "displayValue", { + get: function () { + if (this.isLoadingFromJson) + return ""; + return this.getDisplayValue(true); + }, + enumerable: false, + configurable: true + }); + /** + * Return the question value as a display text. For example, for dropdown, it would return the item text instead of item value. + * @param keysAsText Set this value to true, to return key (in matrices questions) as display text as well. + * @param value use this parameter, if you want to get display value for this value and not question.value. It is undefined by default. + */ + Question.prototype.getDisplayValue = function (keysAsText, value) { + if (value === void 0) { value = undefined; } + var res = this.calcDisplayValue(keysAsText, value); + return !!this.displayValueCallback ? this.displayValueCallback(res) : res; + }; + Question.prototype.calcDisplayValue = function (keysAsText, value) { + if (value === void 0) { value = undefined; } + if (this.customWidget) { + var res = this.customWidget.getDisplayValue(this, value); + if (res) + return res; + } + value = value == undefined ? this.createValueCopy() : value; + if (this.isValueEmpty(value)) + return this.getDisplayValueEmpty(); + return this.getDisplayValueCore(keysAsText, value); + }; + Question.prototype.getDisplayValueCore = function (keyAsText, value) { + return value; + }; + Question.prototype.getDisplayValueEmpty = function () { + return ""; + }; + Object.defineProperty(Question.prototype, "defaultValue", { + /** + * A default value for the question. Ignored for question types that cannot have a [value](https://surveyjs.io/Documentation/Library?id=Question#value) (for example, HTML). + * + * The default value is used as a question value in the following cases: + * + * - While the survey is being loaded from JSON. + * - The question is just added to the survey and does not yet have an answer. + * - The respondent left the answer empty. + * @see defaultValueExpression + */ + get: function () { + return this.getPropertyValue("defaultValue"); + }, + set: function (val) { + if (this.isValueExpression(val)) { + this.defaultValueExpression = val.substr(1); + return; + } + this.setPropertyValue("defaultValue", this.convertDefaultValue(val)); + this.updateValueWithDefaults(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "defaultValueExpression", { + /** + * An expression used to calculate the [defaultValue](https://surveyjs.io/Documentation/Library?id=Question#defaultValue). + * + * This expression applies until the question [value](https://surveyjs.io/Documentation/Library?id=Question#value) is specified by an end user or programmatically. + * + * An expression can reference other questions as follows: + * + * - `{other_question_name}` + * - `{panel.other_question_name}` (to access questions inside the same dynamic panel) + * - `{row.other_question_name}` (to access questions inside the same dynamic matrix or multi-column dropdown) + * + * An expression can also include built-in and custom functions for advanced calculations. For example, if the `defaultValue` should be today's date, set the `defaultValueExpression` to `"today()"`, and the corresponding built-in function will be executed each time the survey is loaded. Refer to the following help topic for more information: [Use Functions in Expressions](https://surveyjs.io/Documentation/Library#conditions-functions). + * @see defaultValue + */ + get: function () { + return this.getPropertyValue("defaultValueExpression"); + }, + set: function (val) { + this.setPropertyValue("defaultValueExpression", val); + this.defaultValueRunner = undefined; + this.updateValueWithDefaults(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "resizeStyle", { + get: function () { + return this.autoGrowComment ? "none" : "both"; + }, + enumerable: false, + configurable: true + }); + /** + * Returns question answer data as a plain object: with question title, name, value and displayValue. + * For complex questions (like matrix, etc.) isNode flag is set to true and data contains array of nested objects (rows) + * set options.includeEmpty to false if you want to skip empty answers + */ + Question.prototype.getPlainData = function (options) { + var _this = this; + if (!options) { + options = { includeEmpty: true, includeQuestionTypes: false }; + } + if (options.includeEmpty || !this.isEmpty()) { + var questionPlainData = { + name: this.name, + title: this.locTitle.renderedHtml, + value: this.value, + displayValue: this.displayValue, + isNode: false, + getString: function (val) { + return typeof val === "object" ? JSON.stringify(val) : val; + }, + }; + if (options.includeQuestionTypes === true) { + questionPlainData.questionType = this.getType(); + } + (options.calculations || []).forEach(function (calculation) { + questionPlainData[calculation.propertyName] = _this[calculation.propertyName]; + }); + if (this.hasComment) { + questionPlainData.isNode = true; + questionPlainData.data = [ + { + name: 0, + isComment: true, + title: "Comment", + value: _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].commentPrefix, + displayValue: this.comment, + getString: function (val) { + return typeof val === "object" ? JSON.stringify(val) : val; + }, + isNode: false, + }, + ]; + } + return questionPlainData; + } + return undefined; + }; + Object.defineProperty(Question.prototype, "correctAnswer", { + /** + * The correct answer on the question. Set this value if you are doing a quiz. + * Please note, this property is hidden for question without input, for example html question. + * @see SurveyModel.getCorrectAnswerCount + * @see SurveyModel.getInCorrectAnswerCount + */ + get: function () { + return this.getPropertyValue("correctAnswer"); + }, + set: function (val) { + this.setPropertyValue("correctAnswer", this.convertDefaultValue(val)); + }, + enumerable: false, + configurable: true + }); + Question.prototype.convertDefaultValue = function (val) { + return val; + }; + Object.defineProperty(Question.prototype, "quizQuestionCount", { + /** + * Returns questions count: 1 for the non-matrix questions and all inner visible questions that has input(s) widgets for question of matrix types. + * @see getQuizQuestions + */ + get: function () { + if (this.isVisible && + this.hasInput && + !this.isValueEmpty(this.correctAnswer)) + return this.getQuizQuestionCount(); + return 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "correctAnswerCount", { + get: function () { + if (!this.isEmpty() && !this.isValueEmpty(this.correctAnswer)) + return this.getCorrectAnswerCount(); + return 0; + }, + enumerable: false, + configurable: true + }); + Question.prototype.getQuizQuestionCount = function () { + return 1; + }; + Question.prototype.getCorrectAnswerCount = function () { + return this.isTwoValueEquals(this.value, this.correctAnswer, true, true) + ? 1 + : 0; + }; + Question.prototype.isAnswerCorrect = function () { + return this.correctAnswerCount == this.quizQuestionCount; + }; + Question.prototype.updateValueWithDefaults = function () { + if (this.isLoadingFromJson || (!this.isDesignMode && this.isDefaultValueEmpty())) + return; + if (!this.isDesignMode && !this.isEmpty()) + return; + if (this.isEmpty() && this.isDefaultValueEmpty()) + return; + if (this.isClearValueOnHidden && !this.isVisible) + return; + if (this.isDesignMode && this.isContentElement && this.isDefaultValueEmpty()) + return; + this.setDefaultValue(); + }; + Object.defineProperty(Question.prototype, "isClearValueOnHidden", { + get: function () { + if (this.clearIfInvisible === "none" || this.clearIfInvisible === "onComplete") + return false; + if (this.clearIfInvisible === "onHidden") + return true; + return !!this.survey && this.survey.isClearValueOnHidden; + }, + enumerable: false, + configurable: true + }); + Question.prototype.getQuestionFromArray = function (name, index) { + return null; + }; + Question.prototype.getDefaultValue = function () { + return this.defaultValue; + }; + Question.prototype.isDefaultValueEmpty = function () { + return !this.defaultValueExpression && this.isValueEmpty(this.defaultValue); + }; + Question.prototype.getDefaultRunner = function (runner, expression) { + if (!runner && !!expression) { + runner = new _conditions__WEBPACK_IMPORTED_MODULE_6__["ExpressionRunner"](expression); + } + if (!!runner) { + runner.expression = expression; + } + return runner; + }; + Question.prototype.setDefaultValue = function () { + var _this = this; + this.defaultValueRunner = this.getDefaultRunner(this.defaultValueRunner, this.defaultValueExpression); + this.setValueAndRunExpression(this.defaultValueRunner, this.getUnbindValue(this.defaultValue), function (val) { + _this.value = val; + }); + }; + Question.prototype.isValueExpression = function (val) { + return !!val && typeof val == "string" && val.length > 0 && val[0] == "="; + }; + Question.prototype.setValueAndRunExpression = function (runner, defaultValue, setFunc, values, properties) { + var _this = this; + if (values === void 0) { values = null; } + if (properties === void 0) { properties = null; } + var func = function (val) { + _this.runExpressionSetValue(val, setFunc); + }; + if (!this.runDefaultValueExpression(runner, values, properties, func)) { + func(defaultValue); + } + }; + Question.prototype.runExpressionSetValue = function (val, setFunc) { + if (val instanceof Date) { + val = val.toISOString().slice(0, 10); + } + setFunc(val); + }; + Question.prototype.runDefaultValueExpression = function (runner, values, properties, setFunc) { + var _this = this; + if (values === void 0) { values = null; } + if (properties === void 0) { properties = null; } + if (!runner || !this.data) + return false; + if (!setFunc) { + setFunc = function (val) { + _this.runExpressionSetValue(val, function (val) { _this.value = val; }); + }; + } + if (!values) + values = this.data.getFilteredValues(); + if (!properties) + properties = this.data.getFilteredProperties(); + if (!!runner && runner.canRun) { + runner.onRunComplete = function (res) { + if (res == undefined) + res = _this.defaultValue; + _this.isChangingViaDefaultValue = true; + setFunc(res); + _this.isChangingViaDefaultValue = false; + }; + runner.run(values, properties); + } + return true; + }; + Object.defineProperty(Question.prototype, "comment", { + /** + * The question comment value. + */ + get: function () { + return this.getQuestionComment(); + }, + set: function (newValue) { + if (!!newValue) { + var trimmedValue = newValue.toString().trim(); + if (trimmedValue !== newValue) { + newValue = trimmedValue; + if (newValue === this.comment) { + this.setPropertyValueDirectly("comment", newValue); + } + } + } + if (this.comment == newValue) + return; + this.setQuestionComment(newValue); + this.updateCommentElement(); + }, + enumerable: false, + configurable: true + }); + Question.prototype.getQuestionComment = function () { + return this.questionComment; + }; + Question.prototype.setQuestionComment = function (newValue) { + this.setNewComment(newValue); + }; + /** + * Returns true if the question value is empty + */ + Question.prototype.isEmpty = function () { + return this.isValueEmpty(this.value); + }; + Object.defineProperty(Question.prototype, "isAnswered", { + get: function () { + return this.getPropertyValue("isAnswered"); + }, + set: function (val) { + this.setPropertyValue("isAnswered", val); + }, + enumerable: false, + configurable: true + }); + Question.prototype.updateIsAnswered = function () { + var oldVal = this.isAnswered; + this.setPropertyValue("isAnswered", this.getIsAnswered()); + if (oldVal !== this.isAnswered) { + this.updateQuestionCss(); + } + }; + Question.prototype.getIsAnswered = function () { + return !this.isEmpty(); + }; + Object.defineProperty(Question.prototype, "validators", { + /** + * The list of question validators. + * Please note, this property is hidden for question without input, for example html question. + */ + get: function () { + return this.getPropertyValue("validators"); + }, + set: function (val) { + this.setPropertyValue("validators", val); + }, + enumerable: false, + configurable: true + }); + Question.prototype.getValidators = function () { + return this.validators; + }; + Question.prototype.getSupportedValidators = function () { + var res = []; + var className = this.getType(); + while (!!className) { + var classValidators = _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].supportedValidators[className]; + if (!!classValidators) { + for (var i = classValidators.length - 1; i >= 0; i--) { + res.splice(0, 0, classValidators[i]); + } + } + var classInfo = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].findClass(className); + className = classInfo.parentName; + } + return res; + }; + Question.prototype.addSupportedValidators = function (supportedValidators, classValidators) { }; + Question.prototype.addConditionObjectsByContext = function (objects, context) { + objects.push({ + name: this.getValueName(), + text: this.processedTitle, + question: this, + }); + }; + Question.prototype.getConditionJson = function (operator, path) { + var json = new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"]().toJsonObject(this); + json["type"] = this.getType(); + return json; + }; + /** + * Returns true if there is a validation error(s) in the question. + * @param fireCallback set it to true to show an error in UI. + */ + Question.prototype.hasErrors = function (fireCallback, rec) { + if (fireCallback === void 0) { fireCallback = true; } + if (rec === void 0) { rec = null; } + var oldHasErrors = this.errors.length > 0; + var errors = this.checkForErrors(!!rec && rec.isOnValueChanged === true); + if (fireCallback) { + if (!!this.survey) { + this.survey.beforeSettingQuestionErrors(this, errors); + } + this.errors = errors; + } + this.updateContainsErrors(); + if (oldHasErrors != errors.length > 0) { + this.updateQuestionCss(); + } + if (this.isCollapsed && rec && fireCallback && errors.length > 0) { + this.expand(); + } + return errors.length > 0; + }; + Object.defineProperty(Question.prototype, "currentErrorCount", { + /** + * Returns the validation errors count. + */ + get: function () { + return this.errors.length; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Question.prototype, "requiredText", { + /** + * Returns the char/string for a required question. + * @see SurveyModel.requiredText + */ + get: function () { + return this.survey != null && this.isRequired + ? this.survey.requiredText + : ""; + }, + enumerable: false, + configurable: true + }); + /** + * Add error into the question error list. + * @param error + */ + Question.prototype.addError = function (error) { + if (!error) + return; + var newError = null; + if (typeof error === "string" || error instanceof String) { + newError = new _error__WEBPACK_IMPORTED_MODULE_3__["CustomError"](error, this.survey); + } + else { + newError = error; + } + this.errors.push(newError); + }; + /** + * Remove a particular error from the question error list. + * @param error + */ + Question.prototype.removeError = function (error) { + var errors = this.errors; + var index = errors.indexOf(error); + if (index !== -1) + errors.splice(index, 1); + }; + Question.prototype.checkForErrors = function (isOnValueChanged) { + var qErrors = new Array(); + if (this.isVisible && this.canCollectErrors()) { + this.collectErrors(qErrors, isOnValueChanged); + } + return qErrors; + }; + Question.prototype.canCollectErrors = function () { + return !this.isReadOnly; + }; + Question.prototype.collectErrors = function (qErrors, isOnValueChanged) { + this.onCheckForErrors(qErrors, isOnValueChanged); + if (qErrors.length > 0 || !this.canRunValidators(isOnValueChanged)) + return; + var errors = this.runValidators(); + if (errors.length > 0) { + //validators may change the question value. + qErrors.length = 0; + for (var i = 0; i < errors.length; i++) { + qErrors.push(errors[i]); + } + } + if (this.survey && qErrors.length == 0) { + var error = this.fireSurveyValidation(); + if (error) { + qErrors.push(error); + } + } + }; + Question.prototype.canRunValidators = function (isOnValueChanged) { + return true; + }; + Question.prototype.fireSurveyValidation = function () { + if (this.validateValueCallback) + return this.validateValueCallback(); + return this.survey ? this.survey.validateQuestion(this) : null; + }; + Question.prototype.onCheckForErrors = function (errors, isOnValueChanged) { + if (!isOnValueChanged && this.hasRequiredError()) { + errors.push(new _error__WEBPACK_IMPORTED_MODULE_3__["AnswerRequiredError"](this.requiredErrorText, this)); + } + }; + Question.prototype.hasRequiredError = function () { + return this.isRequired && this.isEmpty(); + }; + Object.defineProperty(Question.prototype, "isRunningValidators", { + get: function () { + return this.getIsRunningValidators(); + }, + enumerable: false, + configurable: true + }); + Question.prototype.getIsRunningValidators = function () { + return this.isRunningValidatorsValue; + }; + Question.prototype.runValidators = function () { + var _this = this; + if (!!this.validatorRunner) { + this.validatorRunner.onAsyncCompleted = null; + } + this.validatorRunner = new _validator__WEBPACK_IMPORTED_MODULE_4__["ValidatorRunner"](); + this.isRunningValidatorsValue = true; + this.validatorRunner.onAsyncCompleted = function (errors) { + _this.doOnAsyncCompleted(errors); + }; + return this.validatorRunner.run(this); + }; + Question.prototype.doOnAsyncCompleted = function (errors) { + for (var i = 0; i < errors.length; i++) { + this.errors.push(errors[i]); + } + this.isRunningValidatorsValue = false; + this.raiseOnCompletedAsyncValidators(); + }; + Question.prototype.raiseOnCompletedAsyncValidators = function () { + if (!!this.onCompletedAsyncValidators && !this.isRunningValidators) { + this.onCompletedAsyncValidators(this.getAllErrors().length > 0); + this.onCompletedAsyncValidators = null; + } + }; + Question.prototype.setNewValue = function (newValue) { + var oldAnswered = this.isAnswered; + this.setNewValueInData(newValue); + this.allowNotifyValueChanged && this.onValueChanged(); + if (this.isAnswered != oldAnswered) { + this.updateQuestionCss(); + } + }; + Question.prototype.isTextValue = function () { + return false; + }; + Object.defineProperty(Question.prototype, "isSurveyInputTextUpdate", { + get: function () { + return !!this.survey ? this.survey.isUpdateValueTextOnTyping : false; + }, + enumerable: false, + configurable: true + }); + Question.prototype.getDataLocNotification = function () { + return this.isInputTextUpdate ? "text" : false; + }; + Object.defineProperty(Question.prototype, "isInputTextUpdate", { + get: function () { + return this.isSurveyInputTextUpdate && this.isTextValue(); + }, + enumerable: false, + configurable: true + }); + Question.prototype.setNewValueInData = function (newValue) { + newValue = this.valueToData(newValue); + if (!this.isValueChangedInSurvey) { + this.setValueCore(newValue); + } + }; + Question.prototype.getValueCore = function () { + return this.questionValue; + }; + Question.prototype.setValueCore = function (newValue) { + this.setQuestionValue(newValue); + if (this.data != null && this.canSetValueToSurvey()) { + newValue = this.valueForSurvey; + this.data.setValue(this.getValueName(), newValue, this.getDataLocNotification(), this.allowNotifyValueChanged); + } + }; + Question.prototype.canSetValueToSurvey = function () { + return true; + }; + Question.prototype.valueFromData = function (val) { + return val; + }; + Question.prototype.valueToData = function (val) { + return val; + }; + Question.prototype.onValueChanged = function () { }; + Question.prototype.setNewComment = function (newValue) { + if (this.questionComment === newValue) + return; + this.questionComment = newValue; + if (this.data != null) { + this.data.setComment(this.getValueName(), newValue, this.isSurveyInputTextUpdate ? "text" : false); + } + }; + Question.prototype.getValidName = function (name) { + if (!name) + return name; + return name.trim().replace(/[\{\}]+/g, ""); + }; + //IQuestion + Question.prototype.updateValueFromSurvey = function (newValue) { + newValue = this.getUnbindValue(newValue); + if (!!this.valueFromDataCallback) { + newValue = this.valueFromDataCallback(newValue); + } + this.setQuestionValue(this.valueFromData(newValue)); + this.updateIsAnswered(); + }; + Question.prototype.updateCommentFromSurvey = function (newValue) { + this.questionComment = newValue; + }; + Question.prototype.setQuestionValue = function (newValue, updateIsAnswered) { + if (updateIsAnswered === void 0) { updateIsAnswered = true; } + var isEqual = this.isTwoValueEquals(this.questionValue, newValue); + if (!isEqual && !this.isChangingViaDefaultValue) { + this.isValueChangedDirectly = true; + } + this.questionValue = newValue; + !isEqual && this.allowNotifyValueChanged && + this.fireCallback(this.valueChangedCallback); + if (updateIsAnswered) + this.updateIsAnswered(); + }; + Question.prototype.onSurveyValueChanged = function (newValue) { }; + Question.prototype.setVisibleIndex = function (val) { + if (!this.isVisible || + (!this.hasTitle && !_settings__WEBPACK_IMPORTED_MODULE_8__["settings"].setQuestionVisibleIndexForHiddenTitle) || + (this.hideNumber && !_settings__WEBPACK_IMPORTED_MODULE_8__["settings"].setQuestionVisibleIndexForHiddenNumber)) { + val = -1; + } + this.setPropertyValue("visibleIndex", val); + this.setPropertyValue("no", this.calcNo()); + return val < 0 ? 0 : 1; + }; + Question.prototype.removeElement = function (element) { + return false; + }; + Question.prototype.supportGoNextPageAutomatic = function () { + return false; + }; + Question.prototype.supportGoNextPageError = function () { + return true; + }; + /** + * Call this function to remove values from the current question, that end-user will not be able to enter. + * For example the value that doesn't exists in a radigroup/dropdown/checkbox choices or matrix rows/columns. + */ + Question.prototype.clearIncorrectValues = function () { }; + Question.prototype.clearOnDeletingContainer = function () { }; + /** + * Call this function to clear all errors in the question + */ + Question.prototype.clearErrors = function () { + this.errors = []; + }; + Question.prototype.clearUnusedValues = function () { }; + Question.prototype.onAnyValueChanged = function (name) { }; + Question.prototype.checkBindings = function (valueName, value) { + if (this.bindings.isEmpty() || !this.data) + return; + var props = this.bindings.getPropertiesByValueName(valueName); + for (var i = 0; i < props.length; i++) { + this[props[i]] = value; + } + }; + Question.prototype.getComponentName = function () { + return _rendererFactory__WEBPACK_IMPORTED_MODULE_9__["RendererFactory"].Instance.getRendererByQuestion(this); + }; + Question.prototype.isDefaultRendering = function () { + return (!!this.customWidget || + this.renderAs === "default" || + this.getComponentName() === "default"); + }; + //ISurveyErrorOwner + Question.prototype.getErrorCustomText = function (text, error) { + if (!!this.survey) + return this.survey.getSurveyErrorCustomText(this, text, error); + return text; + }; + //IValidatorOwner + Question.prototype.getValidatorTitle = function () { + return null; + }; + Object.defineProperty(Question.prototype, "validatedValue", { + get: function () { + return this.value; + }, + set: function (val) { + this.value = val; + }, + enumerable: false, + configurable: true + }); + Question.prototype.getAllValues = function () { + return !!this.data ? this.data.getAllValues() : null; + }; + Question.prototype.transformToMobileView = function () { }; + Question.prototype.transformToDesktopView = function () { }; + Question.prototype.needResponsiveWidth = function () { + return false; + }; + //responsiveness methods + Question.prototype.supportResponsiveness = function () { + return false; + }; + Question.prototype.needResponsiveness = function () { + return this.supportResponsiveness() && this.isDefaultV2Theme && !this.isDesignMode; + }; + Question.prototype.checkForResponsiveness = function (el) { + var _this = this; + if (this.needResponsiveness()) { + if (this.isCollapsed) { + var onStateChanged = function () { + if (_this.isExpanded) { + _this.initResponsiveness(el); + _this.unRegisterFunctionOnPropertyValueChanged("state", "for-responsiveness"); + } + }; + this.registerFunctionOnPropertyValueChanged("state", onStateChanged, "for-responsiveness"); + } + else { + this.initResponsiveness(el); + } + } + }; + Question.prototype.getObservedElementSelector = function () { + return ".sd-scrollable-container"; + }; + Question.prototype.onMobileChanged = function () { + this.onMobileChangedCallback && this.onMobileChangedCallback(); + }; + Question.prototype.initResponsiveness = function (el) { + var _this = this; + this.destroyResizeObserver(); + if (!!el && this.isDefaultRendering()) { + var scrollableSelector_1 = this.getObservedElementSelector(); + var defaultRootEl = el.querySelector(scrollableSelector_1); + if (!!defaultRootEl) { + var isProcessed_1 = false; + var requiredWidth_1 = undefined; + this.resizeObserver = new ResizeObserver(function () { + var rootEl = el.querySelector(scrollableSelector_1); + if (!requiredWidth_1 && _this.isDefaultRendering()) { + requiredWidth_1 = rootEl.scrollWidth; + } + if (isProcessed_1 || !Object(_utils_utils__WEBPACK_IMPORTED_MODULE_11__["isContainerVisible"])(rootEl)) { + isProcessed_1 = false; + } + else { + isProcessed_1 = _this.processResponsiveness(requiredWidth_1, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_11__["getElementWidth"])(rootEl)); + } + }); + this.onMobileChangedCallback = function () { + setTimeout(function () { + var rootEl = el.querySelector(scrollableSelector_1); + _this.processResponsiveness(requiredWidth_1, Object(_utils_utils__WEBPACK_IMPORTED_MODULE_11__["getElementWidth"])(rootEl)); + }, 0); + }; + this.resizeObserver.observe(el); + } + } + }; + Question.prototype.getCompactRenderAs = function () { + return "default"; + }; + Question.prototype.getDesktopRenderAs = function () { + return "default"; + }; + Question.prototype.processResponsiveness = function (requiredWidth, availableWidth) { + availableWidth = Math.round(availableWidth); + var oldRenderAs = this.renderAs; + if (requiredWidth > availableWidth) { + this.renderAs = this.getCompactRenderAs(); + } + else { + this.renderAs = this.getDesktopRenderAs(); + } + return oldRenderAs !== this.renderAs; + }; + Question.prototype.destroyResizeObserver = function () { + if (!!this.resizeObserver) { + this.resizeObserver.disconnect(); + this.resizeObserver = undefined; + this.onMobileChangedCallback = undefined; + this.renderAs = this.getDesktopRenderAs(); + } + }; + Question.prototype.dispose = function () { + _super.prototype.dispose.call(this); + this.destroyResizeObserver(); + }; + Question.TextPreprocessorValuesMap = { + title: "processedTitle", + require: "requiredText", + }; + Question.questionCounter = 100; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false }) + ], Question.prototype, "isMobile", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: true }) + ], Question.prototype, "commentPlaceHolder", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "default" }) + ], Question.prototype, "renderAs", void 0); + return Question; + }(_survey_element__WEBPACK_IMPORTED_MODULE_2__["SurveyElement"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("question", [ + "!name", + { + name: "state", + default: "default", + choices: ["default", "collapsed", "expanded"], + }, + { name: "visible:switch", default: true }, + { name: "useDisplayValuesInTitle:boolean", default: true, layout: "row" }, + "visibleIf:condition", + { name: "width" }, + { name: "minWidth", default: _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].minWidth }, + { name: "maxWidth", default: _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].maxWidth }, + { name: "startWithNewLine:boolean", default: true, layout: "row" }, + { name: "indent:number", default: 0, choices: [0, 1, 2, 3], layout: "row" }, + { + name: "page", + isSerializable: false, + visibleIf: function (obj) { + var survey = obj ? obj.survey : null; + return !survey || !survey.pages || survey.pages.length > 1; + }, + choices: function (obj) { + var survey = obj ? obj.survey : null; + return survey + ? survey.pages.map(function (p) { + return { value: p.name, text: p.title }; + }) + : []; + }, + }, + { name: "title:text", serializationProperty: "locTitle", layout: "row" }, + { + name: "titleLocation", + default: "default", + choices: ["default", "top", "bottom", "left", "hidden"], + layout: "row", + }, + { + name: "description:text", + serializationProperty: "locDescription", + layout: "row", + }, + { + name: "descriptionLocation", + default: "default", + choices: ["default", "underInput", "underTitle"], + }, + { + name: "hideNumber:boolean", + dependsOn: "titleLocation", + visibleIf: function (obj) { + if (!obj) { + return true; + } + if (obj.titleLocation === "hidden") { + return false; + } + var parent = obj ? obj.parent : null; + var numberingAllowedByParent = !parent || parent.showQuestionNumbers !== "off"; + if (!numberingAllowedByParent) { + return false; + } + var survey = obj ? obj.survey : null; + return (!survey || + survey.showQuestionNumbers !== "off" || + (!!parent && parent.showQuestionNumbers === "onpanel")); + }, + }, + "valueName", + "enableIf:condition", + "defaultValue:value", + { + name: "defaultValueExpression:expression", + category: "logic", + }, + "correctAnswer:value", + { + name: "clearIfInvisible", + default: "default", + choices: ["default", "none", "onComplete", "onHidden"], + }, + "isRequired:switch", + "requiredIf:condition", + { + name: "requiredErrorText:text", + serializationProperty: "locRequiredErrorText", + }, + "readOnly:switch", + { + name: "validators:validators", + baseClassName: "surveyvalidator", + classNamePart: "validator", + }, + { + name: "bindings:bindings", + serializationProperty: "bindings", + visibleIf: function (obj) { + return obj.bindings.getNames().length > 0; + }, + }, + { name: "renderAs", default: "default", visible: false }, + ]); + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addAlterNativeClassName("question", "questionbase"); + + + /***/ }), + + /***/ "./src/questionCustomWidgets.ts": + /*!**************************************!*\ + !*** ./src/questionCustomWidgets.ts ***! + \**************************************/ + /*! exports provided: QuestionCustomWidget, CustomWidgetCollection */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCustomWidget", function() { return QuestionCustomWidget; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CustomWidgetCollection", function() { return CustomWidgetCollection; }); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + + var QuestionCustomWidget = /** @class */ (function () { + function QuestionCustomWidget(name, widgetJson) { + this.name = name; + this.widgetJson = widgetJson; + this.htmlTemplate = widgetJson.htmlTemplate ? widgetJson.htmlTemplate : ""; + } + QuestionCustomWidget.prototype.afterRender = function (question, el) { + var _this = this; + if (!this.widgetJson.afterRender) + return; + question.localeChangedCallback = function () { + if (_this.widgetJson.willUnmount) { + _this.widgetJson.willUnmount(question, el); + } + _this.widgetJson.afterRender(question, el); + }; + this.widgetJson.afterRender(question, el); + }; + QuestionCustomWidget.prototype.willUnmount = function (question, el) { + if (this.widgetJson.willUnmount) + this.widgetJson.willUnmount(question, el); + }; + QuestionCustomWidget.prototype.getDisplayValue = function (question, value) { + if (value === void 0) { value = undefined; } + if (this.widgetJson.getDisplayValue) + return this.widgetJson.getDisplayValue(question, value); + return null; + }; + QuestionCustomWidget.prototype.isFit = function (question) { + if (this.isLibraryLoaded() && this.widgetJson.isFit) + return this.widgetJson.isFit(question); + return false; + }; + Object.defineProperty(QuestionCustomWidget.prototype, "canShowInToolbox", { + get: function () { + if (this.widgetJson.showInToolbox === false) + return false; + if (CustomWidgetCollection.Instance.getActivatedBy(this.name) != "customtype") + return false; + return !this.widgetJson.widgetIsLoaded || this.widgetJson.widgetIsLoaded(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionCustomWidget.prototype, "showInToolbox", { + get: function () { + return this.widgetJson.showInToolbox !== false; + }, + set: function (val) { + this.widgetJson.showInToolbox = val; + }, + enumerable: false, + configurable: true + }); + QuestionCustomWidget.prototype.init = function () { + if (this.widgetJson.init) { + this.widgetJson.init(); + } + }; + QuestionCustomWidget.prototype.activatedByChanged = function (activatedBy) { + if (this.isLibraryLoaded() && this.widgetJson.activatedByChanged) { + this.widgetJson.activatedByChanged(activatedBy); + } + }; + QuestionCustomWidget.prototype.isLibraryLoaded = function () { + if (this.widgetJson.widgetIsLoaded) + return this.widgetJson.widgetIsLoaded() == true; + return true; + }; + Object.defineProperty(QuestionCustomWidget.prototype, "isDefaultRender", { + get: function () { + return this.widgetJson.isDefaultRender; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionCustomWidget.prototype, "pdfQuestionType", { + get: function () { + return this.widgetJson.pdfQuestionType; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionCustomWidget.prototype, "pdfRender", { + get: function () { + return this.widgetJson.pdfRender; + }, + enumerable: false, + configurable: true + }); + return QuestionCustomWidget; + }()); + + var CustomWidgetCollection = /** @class */ (function () { + function CustomWidgetCollection() { + this.widgetsValues = []; + this.widgetsActivatedBy = {}; + this.onCustomWidgetAdded = new _base__WEBPACK_IMPORTED_MODULE_0__["Event"](); + } + Object.defineProperty(CustomWidgetCollection.prototype, "widgets", { + get: function () { + return this.widgetsValues; + }, + enumerable: false, + configurable: true + }); + CustomWidgetCollection.prototype.add = function (widgetJson, activatedBy) { + if (activatedBy === void 0) { activatedBy = "property"; } + this.addCustomWidget(widgetJson, activatedBy); + }; + CustomWidgetCollection.prototype.addCustomWidget = function (widgetJson, activatedBy) { + if (activatedBy === void 0) { activatedBy = "property"; } + var name = widgetJson.name; + if (!name) { + name = "widget_" + this.widgets.length + 1; + } + var customWidget = new QuestionCustomWidget(name, widgetJson); + this.widgetsValues.push(customWidget); + customWidget.init(); + this.widgetsActivatedBy[name] = activatedBy; + customWidget.activatedByChanged(activatedBy); + this.onCustomWidgetAdded.fire(customWidget, null); + return customWidget; + }; + /** + * Returns the way the custom wiget is activated. It can be activated by a property ("property"), question type ("type") or by new/custom question type ("customtype"). + * @param widgetName the custom widget name + * @see setActivatedBy + */ + CustomWidgetCollection.prototype.getActivatedBy = function (widgetName) { + var res = this.widgetsActivatedBy[widgetName]; + return res ? res : "property"; + }; + /** + * Sets the way the custom wiget is activated. The activation types are: property ("property"), question type ("type") or new/custom question type ("customtype"). A custom wiget may support all or only some of this activation types. + * @param widgetName + * @param activatedBy there are three possible variants: "property", "type" and "customtype" + */ + CustomWidgetCollection.prototype.setActivatedBy = function (widgetName, activatedBy) { + if (!widgetName || !activatedBy) + return; + var widget = this.getCustomWidgetByName(widgetName); + if (!widget) + return; + this.widgetsActivatedBy[widgetName] = activatedBy; + widget.activatedByChanged(activatedBy); + }; + CustomWidgetCollection.prototype.clear = function () { + this.widgetsValues = []; + }; + CustomWidgetCollection.prototype.getCustomWidgetByName = function (name) { + for (var i = 0; i < this.widgets.length; i++) { + if (this.widgets[i].name == name) + return this.widgets[i]; + } + return null; + }; + CustomWidgetCollection.prototype.getCustomWidget = function (question) { + for (var i = 0; i < this.widgetsValues.length; i++) { + if (this.widgetsValues[i].isFit(question)) + return this.widgetsValues[i]; + } + return null; + }; + CustomWidgetCollection.Instance = new CustomWidgetCollection(); + return CustomWidgetCollection; + }()); + + + + /***/ }), + + /***/ "./src/question_baseselect.ts": + /*!************************************!*\ + !*** ./src/question_baseselect.ts ***! + \************************************/ + /*! exports provided: QuestionSelectBase, QuestionCheckboxBase */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionSelectBase", function() { return QuestionSelectBase; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCheckboxBase", function() { return QuestionCheckboxBase; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _survey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./survey */ "./src/survey.ts"); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./error */ "./src/error.ts"); + /* harmony import */ var _choicesRestful__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./choicesRestful */ "./src/choicesRestful.ts"); + /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + + + + + + + /** + * It is a base class for checkbox, dropdown and radiogroup questions. + */ + var QuestionSelectBase = /** @class */ (function (_super) { + __extends(QuestionSelectBase, _super); + function QuestionSelectBase(name) { + var _this = _super.call(this, name) || this; + _this.otherItemValue = new _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"]("other"); + _this.dependedQuestions = []; + _this.noneItemValue = new _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"]("none"); + _this.isSettingDefaultValue = false; + _this.isSettingComment = false; + _this.isRunningChoices = false; + _this.isFirstLoadChoicesFromUrl = true; + _this.isUpdatingChoicesDependedQuestions = false; + _this.prevIsOtherSelected = false; + var noneItemText = _this.createLocalizableString("noneText", _this, true, "noneItemText"); + _this.noneItemValue.locOwner = _this; + _this.noneItemValue.setLocText(noneItemText); + _this.createItemValues("choices"); + _this.registerFunctionOnPropertyValueChanged("choices", function () { + if (!_this.filterItems()) { + _this.onVisibleChoicesChanged(); + } + }); + _this.registerFunctionOnPropertiesValueChanged(["choicesFromQuestion", "choicesFromQuestionMode", "hasNone"], function () { + _this.onVisibleChoicesChanged(); + }); + _this.registerFunctionOnPropertyValueChanged("hideIfChoicesEmpty", function () { + _this.updateVisibilityBasedOnChoices(); + }); + _this.createNewArray("visibleChoices"); + _this.setNewRestfulProperty(); + var locOtherText = _this.createLocalizableString("otherText", _this, true, "otherItemText"); + _this.createLocalizableString("otherErrorText", _this, true, "otherRequiredError"); + _this.otherItemValue.locOwner = _this; + _this.otherItemValue.setLocText(locOtherText); + _this.choicesByUrl.createItemValue = function (value) { + return _this.createItemValue(value); + }; + _this.choicesByUrl.beforeSendRequestCallback = function () { + _this.onBeforeSendRequest(); + }; + _this.choicesByUrl.getResultCallback = function (items) { + _this.onLoadChoicesFromUrl(items); + }; + _this.choicesByUrl.updateResultCallback = function (items, serverResult) { + if (_this.survey) { + return _this.survey.updateChoicesFromServer(_this, items, serverResult); + } + return items; + }; + return _this; + } + QuestionSelectBase.prototype.getType = function () { + return "selectbase"; + }; + QuestionSelectBase.prototype.dispose = function () { + _super.prototype.dispose.call(this); + for (var i = 0; i < this.dependedQuestions.length; i++) { + this.dependedQuestions[i].choicesFromQuestion = ""; + } + this.removeFromDependedQuestion(this.getQuestionWithChoices()); + }; + QuestionSelectBase.prototype.getItemValueType = function () { + return "itemvalue"; + }; + QuestionSelectBase.prototype.createItemValue = function (value) { + return _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].createClass(this.getItemValueType(), value); + }; + QuestionSelectBase.prototype.supportGoNextPageError = function () { + return !this.isOtherSelected || !!this.comment; + }; + QuestionSelectBase.prototype.isLayoutTypeSupported = function (layoutType) { + return true; + }; + QuestionSelectBase.prototype.localeChanged = function () { + _super.prototype.localeChanged.call(this); + if (this.choicesOrder !== "none") { + this.updateVisibleChoices(); + } + }; + QuestionSelectBase.prototype.locStrsChanged = function () { + _super.prototype.locStrsChanged.call(this); + if (!!this.choicesFromUrl) { + _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].locStrsChanged(this.choicesFromUrl); + _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].locStrsChanged(this.visibleChoices); + } + }; + Object.defineProperty(QuestionSelectBase.prototype, "otherItem", { + /** + * Returns the other item. By using this property, you may change programmatically it's value and text. + * @see hasOther + */ + get: function () { + return this.otherItemValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "isOtherSelected", { + /** + * Returns true if a user select the 'other' item. + */ + get: function () { + return this.hasOther && this.getHasOther(this.renderedValue); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "hasNone", { + /** + * Set this property to true, to show the "None" item on the bottom. If end-user checks this item, all other items would be unchecked. + */ + get: function () { + return this.getPropertyValue("hasNone", false); + }, + set: function (val) { + this.setPropertyValue("hasNone", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "noneItem", { + /** + * Returns the none item. By using this property, you may change programmatically it's value and text. + * @see hasNone + */ + get: function () { + return this.noneItemValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "noneText", { + /** + * Use this property to set the different text for none item. + */ + get: function () { + return this.getLocalizableStringText("noneText"); + }, + set: function (val) { + this.setLocalizableStringText("noneText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "locNoneText", { + get: function () { + return this.getLocalizableString("noneText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "choicesVisibleIf", { + /** + * An expression that returns true or false. It runs against each choices item and if for this item it returns true, then the item is visible otherwise the item becomes invisible. Please use {item} to get the current item value in the expression. + * @see visibleIf + * @see choicesEnableIf + */ + get: function () { + return this.getPropertyValue("choicesVisibleIf", ""); + }, + set: function (val) { + this.setPropertyValue("choicesVisibleIf", val); + this.filterItems(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "choicesEnableIf", { + /** + * An expression that returns true or false. It runs against each choices item and if for this item it returns true, then the item is enabled otherwise the item becomes disabled. Please use {item} to get the current item value in the expression. + * @see choicesVisibleIf + */ + get: function () { + return this.getPropertyValue("choicesEnableIf", ""); + }, + set: function (val) { + this.setPropertyValue("choicesEnableIf", val); + this.filterItems(); + }, + enumerable: false, + configurable: true + }); + QuestionSelectBase.prototype.surveyChoiceItemVisibilityChange = function () { + this.filterItems(); + }; + QuestionSelectBase.prototype.runCondition = function (values, properties) { + _super.prototype.runCondition.call(this, values, properties); + this.runItemsEnableCondition(values, properties); + this.runItemsCondition(values, properties); + }; + QuestionSelectBase.prototype.isTextValue = function () { + return true; //for comments and others + }; + QuestionSelectBase.prototype.setDefaultValue = function () { + this.isSettingDefaultValue = + !this.isValueEmpty(this.defaultValue) && + this.hasUnknownValue(this.defaultValue); + this.prevCommentValue = undefined; + _super.prototype.setDefaultValue.call(this); + this.isSettingDefaultValue = false; + }; + QuestionSelectBase.prototype.getIsMultipleValue = function () { + return false; + }; + QuestionSelectBase.prototype.convertDefaultValue = function (val) { + if (val == null || val == undefined) + return val; + if (this.getIsMultipleValue()) { + if (!Array.isArray(val)) + return [val]; + } + else { + if (Array.isArray(val) && val.length > 0) + return val[0]; + } + return val; + }; + QuestionSelectBase.prototype.filterItems = function () { + if (this.isLoadingFromJson || + !this.data || + this.areInvisibleElementsShowing) + return false; + var values = this.getDataFilteredValues(); + var properties = this.getDataFilteredProperties(); + this.runItemsEnableCondition(values, properties); + return this.runItemsCondition(values, properties); + }; + QuestionSelectBase.prototype.runItemsCondition = function (values, properties) { + this.setConditionalChoicesRunner(); + var hasChanges = this.runConditionsForItems(values, properties); + if (!!this.filteredChoicesValue && + this.filteredChoicesValue.length === this.activeChoices.length) { + this.filteredChoicesValue = undefined; + } + if (hasChanges) { + this.onVisibleChoicesChanged(); + this.clearIncorrectValues(); + } + return hasChanges; + }; + QuestionSelectBase.prototype.runItemsEnableCondition = function (values, properties) { + var _this = this; + this.setConditionalEnableChoicesRunner(); + var hasChanged = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].runEnabledConditionsForItems(this.activeChoices, this.conditionChoicesEnableIfRunner, values, properties, function (item, val) { + return val && _this.onEnableItemCallBack(item); + }); + if (hasChanged) { + this.clearDisabledValues(); + } + this.onAfterRunItemsEnableCondition(); + }; + QuestionSelectBase.prototype.onAfterRunItemsEnableCondition = function () { }; + QuestionSelectBase.prototype.onEnableItemCallBack = function (item) { + return true; + }; + QuestionSelectBase.prototype.setConditionalChoicesRunner = function () { + if (this.choicesVisibleIf) { + if (!this.conditionChoicesVisibleIfRunner) { + this.conditionChoicesVisibleIfRunner = new _conditions__WEBPACK_IMPORTED_MODULE_7__["ConditionRunner"](this.choicesVisibleIf); + } + this.conditionChoicesVisibleIfRunner.expression = this.choicesVisibleIf; + } + else { + this.conditionChoicesVisibleIfRunner = null; + } + }; + QuestionSelectBase.prototype.setConditionalEnableChoicesRunner = function () { + if (this.choicesEnableIf) { + if (!this.conditionChoicesEnableIfRunner) { + this.conditionChoicesEnableIfRunner = new _conditions__WEBPACK_IMPORTED_MODULE_7__["ConditionRunner"](this.choicesEnableIf); + } + this.conditionChoicesEnableIfRunner.expression = this.choicesEnableIf; + } + else { + this.conditionChoicesEnableIfRunner = null; + } + }; + QuestionSelectBase.prototype.canSurveyChangeItemVisibility = function () { + return !!this.survey && this.survey.canChangeChoiceItemsVisibility(); + }; + QuestionSelectBase.prototype.changeItemVisisbility = function () { + var _this = this; + return this.canSurveyChangeItemVisibility() ? + function (item, val) { return _this.survey.getChoiceItemVisibility(_this, item, val); } + : null; + }; + QuestionSelectBase.prototype.runConditionsForItems = function (values, properties) { + this.filteredChoicesValue = []; + var calcVisibility = this.changeItemVisisbility(); + return _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].runConditionsForItems(this.activeChoices, this.getFilteredChoices(), this.areInvisibleElementsShowing + ? null + : this.conditionChoicesVisibleIfRunner, values, properties, !this.survey || !this.survey.areInvisibleElementsShowing, function (item, val) { + return !!calcVisibility ? calcVisibility(item, val) : val; + }); + }; + QuestionSelectBase.prototype.getHasOther = function (val) { + return val === this.otherItem.value; + }; + Object.defineProperty(QuestionSelectBase.prototype, "validatedValue", { + get: function () { + return this.rendredValueToDataCore(this.value); + }, + enumerable: false, + configurable: true + }); + QuestionSelectBase.prototype.createRestful = function () { + return new _choicesRestful__WEBPACK_IMPORTED_MODULE_6__["ChoicesRestful"](); + }; + QuestionSelectBase.prototype.setNewRestfulProperty = function () { + this.setPropertyValue("choicesByUrl", this.createRestful()); + this.choicesByUrl.owner = this; + this.choicesByUrl.loadingOwner = this; + }; + QuestionSelectBase.prototype.getQuestionComment = function () { + if (!!this.commentValue) + return this.commentValue; + if (this.hasComment || this.getStoreOthersAsComment()) + return _super.prototype.getQuestionComment.call(this); + return this.commentValue; + }; + QuestionSelectBase.prototype.setQuestionComment = function (newValue) { + if (this.hasComment || this.getStoreOthersAsComment()) + _super.prototype.setQuestionComment.call(this, newValue); + else { + if (!this.isSettingComment && newValue != this.commentValue) { + this.isSettingComment = true; + this.commentValue = newValue; + if (this.isOtherSelected && !this.isRenderedValueSetting) { + this.value = this.rendredValueToData(this.renderedValue); + } + this.isSettingComment = false; + } + } + }; + QuestionSelectBase.prototype.clearValue = function () { + _super.prototype.clearValue.call(this); + this.prevCommentValue = undefined; + }; + QuestionSelectBase.prototype.updateCommentFromSurvey = function (newValue) { + _super.prototype.updateCommentFromSurvey.call(this, newValue); + this.prevCommentValue = undefined; + }; + Object.defineProperty(QuestionSelectBase.prototype, "renderedValue", { + get: function () { + return this.getPropertyValue("renderedValue", null); + }, + set: function (val) { + this.setPropertyValue("renderedValue", val); + var val = this.rendredValueToData(val); + if (!this.isTwoValueEquals(val, this.value)) { + this.value = val; + } + }, + enumerable: false, + configurable: true + }); + QuestionSelectBase.prototype.setQuestionValue = function (newValue, updateIsAnswered, updateComment) { + if (updateIsAnswered === void 0) { updateIsAnswered = true; } + if (updateComment === void 0) { updateComment = true; } + if (this.isLoadingFromJson || + this.isTwoValueEquals(this.value, newValue)) + return; + _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); + this.setPropertyValue("renderedValue", this.rendredValueFromData(newValue)); + if (this.hasComment || !updateComment) + return; + var isOtherSel = this.isOtherSelected; + if (isOtherSel && !!this.prevCommentValue) { + var oldComment = this.prevCommentValue; + this.prevCommentValue = undefined; + this.comment = oldComment; + } + if (!isOtherSel && !!this.comment) { + if (this.getStoreOthersAsComment()) { + this.prevCommentValue = this.comment; + } + this.comment = ""; + } + }; + QuestionSelectBase.prototype.setNewValue = function (newValue) { + newValue = this.valueFromData(newValue); + if ((!this.choicesByUrl.isRunning && + !this.choicesByUrl.isWaitingForParameters) || + !this.isValueEmpty(newValue)) { + this.cachedValueForUrlRequests = newValue; + } + _super.prototype.setNewValue.call(this, newValue); + }; + QuestionSelectBase.prototype.valueFromData = function (val) { + var choiceitem = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(this.activeChoices, val); + if (!!choiceitem) { + return choiceitem.value; + } + return _super.prototype.valueFromData.call(this, val); + }; + QuestionSelectBase.prototype.rendredValueFromData = function (val) { + if (this.getStoreOthersAsComment()) + return val; + return this.renderedValueFromDataCore(val); + }; + QuestionSelectBase.prototype.rendredValueToData = function (val) { + if (this.getStoreOthersAsComment()) + return val; + return this.rendredValueToDataCore(val); + }; + QuestionSelectBase.prototype.renderedValueFromDataCore = function (val) { + if (!this.hasUnknownValue(val, true, false)) + return this.valueFromData(val); + this.comment = val; + return this.otherItem.value; + }; + QuestionSelectBase.prototype.rendredValueToDataCore = function (val) { + if (val == this.otherItem.value && this.getQuestionComment()) { + val = this.getQuestionComment(); + } + return val; + }; + QuestionSelectBase.prototype.hasUnknownValue = function (val, includeOther, isFilteredChoices, checkEmptyValue) { + if (includeOther === void 0) { includeOther = false; } + if (isFilteredChoices === void 0) { isFilteredChoices = true; } + if (checkEmptyValue === void 0) { checkEmptyValue = false; } + if (!checkEmptyValue && this.isValueEmpty(val)) + return false; + if (includeOther && val == this.otherItem.value) + return false; + if (this.hasNone && val == this.noneItem.value) + return false; + var choices = isFilteredChoices + ? this.getFilteredChoices() + : this.activeChoices; + return _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(choices, val) == null; + }; + QuestionSelectBase.prototype.isValueDisabled = function (val) { + var itemValue = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(this.getFilteredChoices(), val); + return !!itemValue && !itemValue.isEnabled; + }; + Object.defineProperty(QuestionSelectBase.prototype, "choicesByUrl", { + /** + * Use this property to fill the choices from a RESTful service. + * @see choices + * @see ChoicesRestful + * @see [Example: RESTful Dropdown](https://surveyjs.io/Examples/Library/?id=questiontype-dropdownrestfull) + * @see [Docs: Fill Choices from a RESTful Service](https://surveyjs.io/Documentation/Library/?id=LibraryOverview#fill-the-choices-from-a-restful-service) + */ + get: function () { + return this.getPropertyValue("choicesByUrl"); + }, + set: function (val) { + if (!val) + return; + this.setNewRestfulProperty(); + this.choicesByUrl.fromJSON(val.toJSON()); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "choices", { + /** + * The list of items. Every item has value and text. If text is empty, the value is rendered. The item text supports markdown. + * @see choicesByUrl + * @see choicesFromQuestion + */ + get: function () { + return this.getPropertyValue("choices"); + }, + set: function (newValue) { + this.setPropertyValue("choices", newValue); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "choicesFromQuestion", { + /** + * Set this property to get choices from the specified question instead of defining them in the current question. This avoids duplication of choices declaration in your survey definition. + * By setting this property, the "choices", "choicesVisibleIf", "choicesEnableIf" and "choicesOrder" properties become invisible, because these question characteristics depend on actions in another (specified) question. + * Use the `choicesFromQuestionMode` property to filter choices obtained from the specified question. + * @see choices + * @see choicesFromQuestionMode + */ + get: function () { + return this.getPropertyValue("choicesFromQuestion"); + }, + set: function (val) { + var question = this.getQuestionWithChoices(); + if (!!question) { + question.removeFromDependedQuestion(this); + } + this.setPropertyValue("choicesFromQuestion", val); + }, + enumerable: false, + configurable: true + }); + QuestionSelectBase.prototype.addIntoDependedQuestion = function (question) { + if (!question || question.dependedQuestions.indexOf(this) > -1) + return; + question.dependedQuestions.push(this); + }; + QuestionSelectBase.prototype.removeFromDependedQuestion = function (question) { + if (!question) + return; + var index = question.dependedQuestions.indexOf(this); + if (index > -1) { + question.dependedQuestions.splice(index, 1); + } + }; + Object.defineProperty(QuestionSelectBase.prototype, "choicesFromQuestionMode", { + /** + * This property becomes visible when the `choicesFromQuestion` property is selected. The default value is "all" (all visible choices from another question are displayed as they are). + * You can set this property to "selected" or "unselected" to display only selected or unselected choices from the specified question. + * @see choicesFromQuestion + */ + get: function () { + return this.getPropertyValue("choicesFromQuestionMode"); + }, + set: function (val) { + this.setPropertyValue("choicesFromQuestionMode", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "hideIfChoicesEmpty", { + /** + * Set this property to true to hide the question if there is no visible choices. + */ + get: function () { + return this.getPropertyValue("hideIfChoicesEmpty", false); + }, + set: function (val) { + this.setPropertyValue("hideIfChoicesEmpty", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "keepIncorrectValues", { + get: function () { + return this.getPropertyValue("keepIncorrectValues", false); + }, + set: function (val) { + this.setPropertyValue("keepIncorrectValues", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "storeOthersAsComment", { + /** + * Please use survey.storeOthersAsComment to change the behavior on the survey level. This property is depricated and invisible in Survey Creator. + * By default the entered text in the others input in the checkbox/radiogroup/dropdown are stored as "question name " + "-Comment". The value itself is "question name": "others". Set this property to false, to store the entered text directly in the "question name" key. + * Possible values are: "default", true, false + * @see SurveyModel.storeOthersAsComment + */ + get: function () { + return this.getPropertyValue("storeOthersAsComment"); + }, + set: function (val) { + this.setPropertyValue("storeOthersAsComment", val); + }, + enumerable: false, + configurable: true + }); + QuestionSelectBase.prototype.hasOtherChanged = function () { + this.onVisibleChoicesChanged(); + }; + Object.defineProperty(QuestionSelectBase.prototype, "choicesOrder", { + /** + * Use this property to render items in a specific order: "asc", "desc", "random". Default value is "none". + */ + get: function () { + return this.getPropertyValue("choicesOrder"); + }, + set: function (val) { + val = val.toLowerCase(); + if (val == this.choicesOrder) + return; + this.setPropertyValue("choicesOrder", val); + this.onVisibleChoicesChanged(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "otherText", { + /** + * Use this property to set the different text for other item. + */ + get: function () { + return this.getLocalizableStringText("otherText"); + }, + set: function (val) { + this.setLocalizableStringText("otherText", val); + this.onVisibleChoicesChanged(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "locOtherText", { + get: function () { + return this.getLocalizableString("otherText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "otherErrorText", { + /** + * The text that shows when the other item is choosed by the other input is empty. + */ + get: function () { + return this.getLocalizableStringText("otherErrorText"); + }, + set: function (val) { + this.setLocalizableStringText("otherErrorText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "locOtherErrorText", { + get: function () { + return this.getLocalizableString("otherErrorText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "visibleChoices", { + /** + * The list of items as they will be rendered. If needed items are sorted and the other item is added. + * @see hasOther + * @see choicesOrder + * @see enabledChoices + */ + get: function () { + return this.getPropertyValue("visibleChoices"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "enabledChoices", { + /** + * The list of enabled items as they will be rendered. The disabled items are not included + * @see hasOther + * @see choicesOrder + * @see visibleChoices + */ + get: function () { + var res = []; + var items = this.visibleChoices; + for (var i = 0; i < items.length; i++) { + if (items[i].isEnabled) + res.push(items[i]); + } + return res; + }, + enumerable: false, + configurable: true + }); + QuestionSelectBase.prototype.updateVisibleChoices = function () { + if (this.isLoadingFromJson) + return; + var newValue = new Array(); + var calcValue = this.calcVisibleChoices(); + if (!calcValue) + calcValue = []; + for (var i = 0; i < calcValue.length; i++) { + newValue.push(calcValue[i]); + } + this.setPropertyValue("visibleChoices", newValue); + }; + QuestionSelectBase.prototype.calcVisibleChoices = function () { + if (this.canUseFilteredChoices()) + return this.getFilteredChoices(); + var res = this.sortVisibleChoices(this.getFilteredChoices().slice()); + this.addToVisibleChoices(res, this.isAddDefaultItems); + return res; + }; + QuestionSelectBase.prototype.canUseFilteredChoices = function () { + return (!this.isAddDefaultItems && + !this.hasNone && + !this.hasOther && + this.choicesOrder == "none"); + }; + QuestionSelectBase.prototype.setCanShowOptionItemCallback = function (func) { + this.canShowOptionItemCallback = func; + if (!!func) { + this.onVisibleChoicesChanged(); + } + }; + QuestionSelectBase.prototype.addToVisibleChoices = function (items, isAddAll) { + if (isAddAll) { + if (!this.newItemValue) { + this.newItemValue = new _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"]("newitem"); //TODO + } + if (this.canShowOptionItem(this.newItemValue, isAddAll, false)) { + items.push(this.newItemValue); + } + } + if (this.supportNone() && this.canShowOptionItem(this.noneItem, isAddAll, this.hasNone)) { + items.push(this.noneItem); + } + if (this.supportOther() && this.canShowOptionItem(this.otherItem, isAddAll, this.hasOther)) { + items.push(this.otherItem); + } + }; + QuestionSelectBase.prototype.canShowOptionItem = function (item, isAddAll, hasItem) { + var res = (isAddAll && (!!this.canShowOptionItemCallback ? this.canShowOptionItemCallback(item) : true)) || hasItem; + if (this.canSurveyChangeItemVisibility()) { + var calc = this.changeItemVisisbility(); + return calc(item, res); + } + return res; + }; + /** + * For internal use in SurveyJS Creator V2. + */ + QuestionSelectBase.prototype.isItemInList = function (item) { + if (item === this.otherItem) + return this.hasOther; + if (item === this.noneItem) + return this.hasNone; + if (item === this.newItemValue) + return false; + return true; + }; + Object.defineProperty(QuestionSelectBase.prototype, "isAddDefaultItems", { + get: function () { + return (_settings__WEBPACK_IMPORTED_MODULE_9__["settings"].supportCreatorV2 && _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].showDefaultItemsInCreatorV2 && this.isDesignMode && !this.isContentElement); + }, + enumerable: false, + configurable: true + }); + QuestionSelectBase.prototype.getPlainData = function (options) { + var _this = this; + if (options === void 0) { options = { + includeEmpty: true, + includeQuestionTypes: false, + }; } + var questionPlainData = _super.prototype.getPlainData.call(this, options); + if (!!questionPlainData) { + var values = Array.isArray(this.value) ? this.value : [this.value]; + questionPlainData.isNode = true; + questionPlainData.data = (questionPlainData.data || []).concat(values.map(function (dataValue, index) { + var choice = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(_this.visibleChoices, dataValue); + var choiceDataItem = { + name: index, + title: "Choice", + value: dataValue, + displayValue: _this.getChoicesDisplayValue(_this.visibleChoices, dataValue), + getString: function (val) { + return typeof val === "object" ? JSON.stringify(val) : val; + }, + isNode: false, + }; + if (!!choice) { + (options.calculations || []).forEach(function (calculation) { + choiceDataItem[calculation.propertyName] = + choice[calculation.propertyName]; + }); + } + if (_this.isOtherSelected && _this.otherItemValue === choice) { + choiceDataItem.isOther = true; + choiceDataItem.displayValue = _this.comment; + } + return choiceDataItem; + })); + } + return questionPlainData; + }; + /** + * Returns the text for the current value. If the value is null then returns empty string. If 'other' is selected then returns the text for other value. + */ + QuestionSelectBase.prototype.getDisplayValueCore = function (keysAsText, value) { + return this.getChoicesDisplayValue(this.visibleChoices, value); + }; + QuestionSelectBase.prototype.getDisplayValueEmpty = function () { + return _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getTextOrHtmlByValue(this.visibleChoices, undefined); + }; + QuestionSelectBase.prototype.getChoicesDisplayValue = function (items, val) { + if (val == this.otherItemValue.value) + return this.comment ? this.comment : this.locOtherText.textOrHtml; + var str = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getTextOrHtmlByValue(items, val); + return str == "" && val ? val : str; + }; + QuestionSelectBase.prototype.getFilteredChoices = function () { + return this.filteredChoicesValue + ? this.filteredChoicesValue + : this.activeChoices; + }; + Object.defineProperty(QuestionSelectBase.prototype, "activeChoices", { + get: function () { + var question = this.getQuestionWithChoices(); + if (!!question) { + this.addIntoDependedQuestion(question); + return this.getChoicesFromQuestion(question); + } + return this.choicesFromUrl ? this.choicesFromUrl : this.getChoices(); + }, + enumerable: false, + configurable: true + }); + QuestionSelectBase.prototype.getQuestionWithChoices = function () { + if (!this.choicesFromQuestion || !this.survey) + return null; + var res = this.survey.getQuestionByName(this.choicesFromQuestion); + return !!res && !!res.visibleChoices && res !== this ? res : null; + }; + QuestionSelectBase.prototype.getChoicesFromQuestion = function (question) { + var res = []; + var isSelected = this.choicesFromQuestionMode == "selected" + ? true + : this.choicesFromQuestionMode == "unselected" + ? false + : undefined; + var choices = question.visibleChoices; + for (var i = 0; i < choices.length; i++) { + if (this.isBuiltInChoice(choices[i], question)) + continue; + if (isSelected === undefined) { + res.push(choices[i]); + continue; + } + var itemsSelected = question.isItemSelected(choices[i]); + if ((itemsSelected && isSelected) || (!itemsSelected && !isSelected)) { + res.push(choices[i]); + } + } + return res; + }; + Object.defineProperty(QuestionSelectBase.prototype, "hasActiveChoices", { + get: function () { + var choices = this.visibleChoices; + if (!choices || choices.length == 0) { + this.onVisibleChoicesChanged(); + choices = this.visibleChoices; + } + for (var i = 0; i < choices.length; i++) { + if (!this.isBuiltInChoice(choices[i], this)) + return true; + } + return false; + }, + enumerable: false, + configurable: true + }); + QuestionSelectBase.prototype.isHeadChoice = function (item, question) { + return false; + }; + QuestionSelectBase.prototype.isFootChoice = function (item, question) { + return (item === question.noneItem || + item === question.otherItem || + item === question.newItemValue); + }; + QuestionSelectBase.prototype.isBuiltInChoice = function (item, question) { + return this.isHeadChoice(item, question) || this.isFootChoice(item, question); + }; + QuestionSelectBase.prototype.getChoices = function () { + return this.choices; + }; + QuestionSelectBase.prototype.supportComment = function () { + return true; + }; + QuestionSelectBase.prototype.supportOther = function () { + return this.isSupportProperty("hasOther"); + }; + QuestionSelectBase.prototype.supportNone = function () { + return this.isSupportProperty("hasNone"); + }; + QuestionSelectBase.prototype.isSupportProperty = function (propName) { + return (!this.isDesignMode || + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].findProperty(this.getType(), propName).visible); + }; + QuestionSelectBase.prototype.onCheckForErrors = function (errors, isOnValueChanged) { + _super.prototype.onCheckForErrors.call(this, errors, isOnValueChanged); + if (!this.hasOther || !this.isOtherSelected || this.comment) + return; + errors.push(new _error__WEBPACK_IMPORTED_MODULE_5__["OtherEmptyError"](this.otherErrorText, this)); + }; + QuestionSelectBase.prototype.setSurveyImpl = function (value, isLight) { + _super.prototype.setSurveyImpl.call(this, value, isLight); + this.runChoicesByUrl(); + if (this.isAddDefaultItems) { + this.updateVisibleChoices(); + } + }; + QuestionSelectBase.prototype.setSurveyCore = function (value) { + _super.prototype.setSurveyCore.call(this, value); + if (!!value && !!this.choicesFromQuestion) { + this.onVisibleChoicesChanged(); + } + }; + QuestionSelectBase.prototype.getStoreOthersAsComment = function () { + if (this.isSettingDefaultValue) + return false; + return (this.storeOthersAsComment === true || + (this.storeOthersAsComment == "default" && + (this.survey != null ? this.survey.storeOthersAsComment : true)) || + (!this.choicesByUrl.isEmpty && !this.choicesFromUrl)); + }; + QuestionSelectBase.prototype.onSurveyLoad = function () { + this.runChoicesByUrl(); + this.onVisibleChoicesChanged(); + _super.prototype.onSurveyLoad.call(this); + }; + QuestionSelectBase.prototype.onAnyValueChanged = function (name) { + _super.prototype.onAnyValueChanged.call(this, name); + if (name != this.getValueName()) { + this.runChoicesByUrl(); + } + if (!!name && name == this.choicesFromQuestion) { + this.onVisibleChoicesChanged(); + } + }; + QuestionSelectBase.prototype.updateValueFromSurvey = function (newValue) { + var newComment = ""; + if (this.hasOther && + !this.isRunningChoices && + !this.choicesByUrl.isRunning && + this.getStoreOthersAsComment()) { + if (this.hasUnknownValue(newValue) && !this.getHasOther(newValue)) { + newComment = this.getCommentFromValue(newValue); + newValue = this.setOtherValueIntoValue(newValue); + } + else { + newComment = this.data.getComment(this.getValueName()); + } + } + _super.prototype.updateValueFromSurvey.call(this, newValue); + if (!!newComment) { + this.setNewComment(newComment); + } + }; + QuestionSelectBase.prototype.getCommentFromValue = function (newValue) { + return newValue; + }; + QuestionSelectBase.prototype.setOtherValueIntoValue = function (newValue) { + return this.otherItem.value; + }; + QuestionSelectBase.prototype.runChoicesByUrl = function () { + if (!this.choicesByUrl || this.isLoadingFromJson || this.isRunningChoices) + return; + var processor = this.surveyImpl + ? this.surveyImpl.getTextProcessor() + : this.textProcessor; + if (!processor) + processor = this.survey; + if (!processor) + return; + this.isReadyValue = this.isChoicesLoaded || this.choicesByUrl.isEmpty; + this.isRunningChoices = true; + this.choicesByUrl.run(processor); + this.isRunningChoices = false; + }; + QuestionSelectBase.prototype.onBeforeSendRequest = function () { + if (_settings__WEBPACK_IMPORTED_MODULE_9__["settings"].disableOnGettingChoicesFromWeb === true && !this.isReadOnly) { + this.enableOnLoadingChoices = true; + this.readOnly = true; + } + }; + QuestionSelectBase.prototype.onLoadChoicesFromUrl = function (array) { + if (this.enableOnLoadingChoices) { + this.readOnly = false; + } + if (!this.isReadOnly) { + var errors = []; + if (this.choicesByUrl && this.choicesByUrl.error) { + errors.push(this.choicesByUrl.error); + } + this.errors = errors; + } + var newChoices = null; + var checkCachedValuesOnExisting = true; + if (this.isFirstLoadChoicesFromUrl && + !this.cachedValueForUrlRequests && + this.defaultValue) { + this.cachedValueForUrlRequests = this.defaultValue; + checkCachedValuesOnExisting = false; + } + if (this.isValueEmpty(this.cachedValueForUrlRequests)) { + this.cachedValueForUrlRequests = this.value; + } + this.isFirstLoadChoicesFromUrl = false; + var cachedValues = this.createCachedValueForUrlRequests(this.cachedValueForUrlRequests, checkCachedValuesOnExisting); + if (array && (array.length > 0 || this.choicesByUrl.allowEmptyResponse)) { + newChoices = new Array(); + _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].setData(newChoices, array); + } + if (!!newChoices) { + for (var i = 0; i < newChoices.length; i++) { + newChoices[i].locOwner = this; + } + } + this.choicesFromUrl = newChoices; + this.filterItems(); + this.onVisibleChoicesChanged(); + if (newChoices) { + var newValue = this.updateCachedValueForUrlRequests(cachedValues, newChoices); + if (!!newValue && !this.isReadOnly) { + var hasChanged = !this.isTwoValueEquals(this.value, newValue.value); + try { + if (!this.isValueEmpty(newValue.value)) { + this.allowNotifyValueChanged = false; + this.setQuestionValue(undefined, true, false); + } + this.allowNotifyValueChanged = hasChanged; + if (hasChanged) { + this.value = newValue.value; + } + else { + this.setQuestionValue(newValue.value); + } + } + finally { + this.allowNotifyValueChanged = true; + } + } + } + this.choicesLoaded(); + }; + QuestionSelectBase.prototype.createCachedValueForUrlRequests = function (val, checkOnExisting) { + if (this.isValueEmpty(val)) + return null; + if (Array.isArray(val)) { + var res = []; + for (var i = 0; i < val.length; i++) { + res.push(this.createCachedValueForUrlRequests(val[i], true)); + } + return res; + } + var isExists = checkOnExisting ? !this.hasUnknownValue(val) : true; + return { value: val, isExists: isExists }; + }; + QuestionSelectBase.prototype.updateCachedValueForUrlRequests = function (val, newChoices) { + if (this.isValueEmpty(val)) + return null; + if (Array.isArray(val)) { + var res = []; + for (var i = 0; i < val.length; i++) { + var updatedValue = this.updateCachedValueForUrlRequests(val[i], newChoices); + if (updatedValue && !this.isValueEmpty(updatedValue.value)) { + var newValue = updatedValue.value; + var item = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(newChoices, updatedValue.value); + if (!!item) { + newValue = item.value; + } + res.push(newValue); + } + } + return { value: res }; + } + var value = val.isExists && this.hasUnknownValue(val.value) ? null : val.value; + var item = _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(newChoices, value); + if (!!item) { + value = item.value; + } + return { value: value }; + }; + QuestionSelectBase.prototype.updateChoicesDependedQuestions = function () { + if (this.isUpdatingChoicesDependedQuestions) + return; + this.isUpdatingChoicesDependedQuestions = true; + for (var i = 0; i < this.dependedQuestions.length; i++) { + this.dependedQuestions[i].onVisibleChoicesChanged(); + this.dependedQuestions[i].updateChoicesDependedQuestions(); + } + this.isUpdatingChoicesDependedQuestions = false; + }; + QuestionSelectBase.prototype.onSurveyValueChanged = function (newValue) { + _super.prototype.onSurveyValueChanged.call(this, newValue); + if (this.isLoadingFromJson) + return; + this.updateChoicesDependedQuestions(); + }; + QuestionSelectBase.prototype.onVisibleChoicesChanged = function () { + if (this.isLoadingFromJson) + return; + this.updateVisibleChoices(); + this.updateVisibilityBasedOnChoices(); + if (!!this.visibleChoicesChangedCallback) { + this.visibleChoicesChangedCallback(); + } + this.updateChoicesDependedQuestions(); + }; + QuestionSelectBase.prototype.updateVisibilityBasedOnChoices = function () { + if (this.hideIfChoicesEmpty) { + var filteredChoices = this.getFilteredChoices(); + this.visible = !filteredChoices || filteredChoices.length > 0; + } + }; + QuestionSelectBase.prototype.sortVisibleChoices = function (array) { + var order = this.choicesOrder.toLowerCase(); + if (order == "asc") + return this.sortArray(array, 1); + if (order == "desc") + return this.sortArray(array, -1); + if (order == "random") + return this.randomizeArray(array); + return array; + }; + QuestionSelectBase.prototype.sortArray = function (array, mult) { + return array.sort(function (a, b) { + if (a.calculatedText < b.calculatedText) + return -1 * mult; + if (a.calculatedText > b.calculatedText) + return 1 * mult; + return 0; + }); + }; + QuestionSelectBase.prototype.randomizeArray = function (array) { + return _helpers__WEBPACK_IMPORTED_MODULE_8__["Helpers"].randomizeArray(array); + }; + QuestionSelectBase.prototype.clearIncorrectValues = function () { + if (!this.hasValueToClearIncorrectValues()) + return; + if (!!this.survey && + this.survey.questionCountByValueName(this.getValueName()) > 1) + return; + if (!!this.choicesByUrl && + !this.choicesByUrl.isEmpty && + (!this.choicesFromUrl || this.choicesFromUrl.length == 0)) + return; + if (this.clearIncorrectValuesCallback) { + this.clearIncorrectValuesCallback(); + } + else { + this.clearIncorrectValuesCore(); + } + }; + QuestionSelectBase.prototype.hasValueToClearIncorrectValues = function () { + return !this.keepIncorrectValues && !this.isEmpty(); + }; + QuestionSelectBase.prototype.clearValueIfInvisibleCore = function () { + _super.prototype.clearValueIfInvisibleCore.call(this); + this.clearIncorrectValues(); + }; + /** + * Returns true if item is selected + * @param item checkbox or radio item value + */ + QuestionSelectBase.prototype.isItemSelected = function (item) { + return item.value === this.value; + }; + QuestionSelectBase.prototype.clearDisabledValues = function () { + if (!this.survey || !this.survey.clearValueOnDisableItems) + return; + this.clearDisabledValuesCore(); + }; + QuestionSelectBase.prototype.clearIncorrectValuesCore = function () { + var val = this.value; + if (this.canClearValueAnUnknow(val)) { + this.clearValue(); + } + }; + QuestionSelectBase.prototype.canClearValueAnUnknow = function (val) { + if (!this.getStoreOthersAsComment() && this.isOtherSelected) + return false; + return this.hasUnknownValue(val, true, true, true); + }; + QuestionSelectBase.prototype.clearDisabledValuesCore = function () { + if (this.isValueDisabled(this.value)) { + this.clearValue(); + } + }; + QuestionSelectBase.prototype.clearUnusedValues = function () { + _super.prototype.clearUnusedValues.call(this); + if (!this.isOtherSelected && !this.hasComment) { + this.comment = ""; + } + }; + QuestionSelectBase.prototype.getColumnClass = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(this.cssClasses.column) + .append("sv-q-column-" + this.colCount, this.hasColumns) + .toString(); + }; + QuestionSelectBase.prototype.getItemIndex = function (item) { + return this.visibleChoices.indexOf(item); + }; + QuestionSelectBase.prototype.getItemClass = function (item) { + var options = { item: item }; + var res = this.getItemClassCore(item, options); + options.css = res; + if (!!this.survey) { + this.survey.updateChoiceItemCss(this, options); + } + return options.css; + }; + QuestionSelectBase.prototype.getCurrentColCount = function () { + return this.colCount; + }; + QuestionSelectBase.prototype.getItemClassCore = function (item, options) { + var builder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(this.cssClasses.item) + .append(this.cssClasses.itemInline, !this.hasColumns && this.colCount === 0) + .append("sv-q-col-" + this.getCurrentColCount(), !this.hasColumns && this.colCount !== 0) + .append(this.cssClasses.itemOnError, this.errors.length > 0); + var isDisabled = this.isReadOnly || !item.isEnabled; + var isChecked = this.isItemSelected(item) || + (this.isOtherSelected && this.otherItem.value === item.value); + var allowHover = !isDisabled && !isChecked && !(!!this.survey && this.survey.isDesignMode); + var isNone = item === this.noneItem; + options.isDisabled = isDisabled; + options.isChecked = isChecked; + options.isNone = isNone; + return builder.append(this.cssClasses.itemDisabled, isDisabled) + .append(this.cssClasses.itemChecked, isChecked) + .append(this.cssClasses.itemHover, allowHover) + .append(this.cssClasses.itemNone, isNone) + .toString(); + }; + QuestionSelectBase.prototype.getLabelClass = function (item) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(this.cssClasses.label) + .append(this.cssClasses.labelChecked, this.isItemSelected(item)) + .toString(); + }; + QuestionSelectBase.prototype.getControlLabelClass = function (item) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(this.cssClasses.controlLabel) + .append(this.cssClasses.controlLabelChecked, this.isItemSelected(item)) + .toString() || undefined; + }; + Object.defineProperty(QuestionSelectBase.prototype, "headItems", { + get: function () { + var _this = this; + return (this.separateSpecialChoices || this.isDesignMode) ? + this.visibleChoices.filter(function (choice) { return _this.isHeadChoice(choice, _this); }) : []; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "footItems", { + get: function () { + var _this = this; + return (this.separateSpecialChoices || this.isDesignMode) ? + this.visibleChoices.filter(function (choice) { return _this.isFootChoice(choice, _this); }) : []; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "hasHeadItems", { + get: function () { + return this.headItems.length > 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "hasFootItems", { + get: function () { + return this.footItems.length > 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "columns", { + get: function () { + var _this = this; + var columns = []; + var colCount = this.getCurrentColCount(); + if (this.hasColumns && this.visibleChoices.length > 0) { + var choicesToBuildColumns = (!this.separateSpecialChoices && !this.isDesignMode) ? + this.visibleChoices : + this.visibleChoices.filter(function (item) { return !_this.isBuiltInChoice(item, _this); }); + if (_settings__WEBPACK_IMPORTED_MODULE_9__["settings"].showItemsInOrder == "column") { + var prevIndex = 0; + var leftElementsCount = choicesToBuildColumns.length % colCount; + for (var i = 0; i < colCount; i++) { + var column = []; + for (var j = prevIndex; j < prevIndex + Math.floor(choicesToBuildColumns.length / colCount); j++) { + column.push(choicesToBuildColumns[j]); + } + if (leftElementsCount > 0) { + leftElementsCount--; + column.push(choicesToBuildColumns[j]); + j++; + } + prevIndex = j; + columns.push(column); + } + } + else { + for (var i = 0; i < colCount; i++) { + var column = []; + for (var j = i; j < choicesToBuildColumns.length; j += colCount) { + column.push(choicesToBuildColumns[j]); + } + columns.push(column); + } + } + } + return columns; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSelectBase.prototype, "hasColumns", { + get: function () { + return !this.isMobile && this.getCurrentColCount() > 1; + }, + enumerable: false, + configurable: true + }); + QuestionSelectBase.prototype.choicesLoaded = function () { + this.isChoicesLoaded = true; + var oldIsReady = this.isReadyValue; + this.isReadyValue = true; + this.onReadyChanged && + this.onReadyChanged.fire(this, { + question: this, + isReady: true, + oldIsReady: oldIsReady, + }); + if (this.survey) { + this.survey.loadedChoicesFromServer(this); + } + if (this.loadedChoicesFromServerCallback) { + this.loadedChoicesFromServerCallback(); + } + }; + QuestionSelectBase.prototype.getItemValueWrapperComponentName = function (item) { + var survey = this.survey; + if (survey) { + return survey.getItemValueWrapperComponentName(item, this); + } + return _survey__WEBPACK_IMPORTED_MODULE_1__["SurveyModel"].TemplateRendererComponentName; + }; + QuestionSelectBase.prototype.getItemValueWrapperComponentData = function (item) { + var survey = this.survey; + if (survey) { + return survey.getItemValueWrapperComponentData(item, this); + } + return item; + }; + QuestionSelectBase.prototype.ariaItemChecked = function (item) { + return this.renderedValue === item.value ? "true" : "false"; + }; + QuestionSelectBase.prototype.isOtherItem = function (item) { + return this.hasOther && item.value == this.otherItem.value; + }; + Object.defineProperty(QuestionSelectBase.prototype, "itemSvgIcon", { + get: function () { + return this.cssClasses.itemSvgIconId; + }, + enumerable: false, + configurable: true + }); + QuestionSelectBase.prototype.getSelectBaseRootCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]().append(this.cssClasses.root).toString(); + }; + QuestionSelectBase.prototype.getAriaItemLabel = function (item) { + return item.locText.renderedHtml; + }; + QuestionSelectBase.prototype.getItemId = function (item) { + return this.inputId + "_" + this.getItemIndex(item); + }; + Object.defineProperty(QuestionSelectBase.prototype, "questionName", { + get: function () { + return this.name + "_" + this.id; + }, + enumerable: false, + configurable: true + }); + QuestionSelectBase.prototype.getItemEnabled = function (item) { + return !this.isInputReadOnly && item.isEnabled; + }; + QuestionSelectBase.prototype.afterRender = function (el) { + _super.prototype.afterRender.call(this, el); + this.rootElement = el; + }; + QuestionSelectBase.prototype.focusOtherComment = function () { + var _this = this; + if (!!this.rootElement) { + setTimeout(function () { + var commentEl = _this.rootElement.querySelector("textarea"); + if (!!commentEl) { + commentEl.focus(); + } + }, 10); + } + }; + QuestionSelectBase.prototype.onValueChanged = function () { + _super.prototype.onValueChanged.call(this); + if (!this.isDesignMode && !this.prevIsOtherSelected && this.isOtherSelected) { + this.focusOtherComment(); + } + this.prevIsOtherSelected = this.isOtherSelected; + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) + ], QuestionSelectBase.prototype, "separateSpecialChoices", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ localizable: true }) + ], QuestionSelectBase.prototype, "otherPlaceHolder", void 0); + return QuestionSelectBase; + }(_question__WEBPACK_IMPORTED_MODULE_2__["Question"])); + + /** + * A base class for checkbox and radiogroup questions. It introduced a colCount property. + */ + var QuestionCheckboxBase = /** @class */ (function (_super) { + __extends(QuestionCheckboxBase, _super); + function QuestionCheckboxBase(name) { + return _super.call(this, name) || this; + } + Object.defineProperty(QuestionCheckboxBase.prototype, "colCount", { + /** + * The number of columns for radiogroup and checkbox questions. Items are rendred in one line if the value is 0. + */ + get: function () { + return this.getPropertyValue("colCount", this.isFlowLayout ? 0 : 1); + }, + set: function (value) { + if (value < 0 || value > 5 || this.isFlowLayout) + return; + this.setPropertyValue("colCount", value); + this.fireCallback(this.colCountChangedCallback); + }, + enumerable: false, + configurable: true + }); + QuestionCheckboxBase.prototype.onParentChanged = function () { + _super.prototype.onParentChanged.call(this); + if (this.isFlowLayout) { + this.setPropertyValue("colCount", null); + } + }; + QuestionCheckboxBase.prototype.onParentQuestionChanged = function () { + this.onVisibleChoicesChanged(); + }; + QuestionCheckboxBase.prototype.getSearchableItemValueKeys = function (keys) { + keys.push("choices"); + }; + return QuestionCheckboxBase; + }(QuestionSelectBase)); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("selectbase", [ + { name: "hasComment:switch", layout: "row" }, + { + name: "commentText", + dependsOn: "hasComment", + visibleIf: function (obj) { + return obj.hasComment; + }, + serializationProperty: "locCommentText", + layout: "row", + }, + "choicesFromQuestion:question_selectbase", + { + name: "choices:itemvalue[]", + baseValue: function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_4__["surveyLocalization"].getString("choices_Item"); + }, + dependsOn: "choicesFromQuestion", + visibleIf: function (obj) { + return !obj.choicesFromQuestion; + }, + }, + { + name: "choicesFromQuestionMode", + default: "all", + choices: ["all", "selected", "unselected"], + dependsOn: "choicesFromQuestion", + visibleIf: function (obj) { + return !!obj.choicesFromQuestion; + }, + }, + { + name: "choicesOrder", + default: "none", + choices: ["none", "asc", "desc", "random"], + dependsOn: "choicesFromQuestion", + visibleIf: function (obj) { + return !obj.choicesFromQuestion; + }, + }, + { + name: "choicesByUrl:restfull", + className: "ChoicesRestful", + onGetValue: function (obj) { + return obj.choicesByUrl.getData(); + }, + onSetValue: function (obj, value) { + obj.choicesByUrl.setData(value); + }, + }, + "hideIfChoicesEmpty:boolean", + { + name: "choicesVisibleIf:condition", + dependsOn: "choicesFromQuestion", + visibleIf: function (obj) { + return !obj.choicesFromQuestion; + }, + }, + { + name: "choicesEnableIf:condition", + dependsOn: "choicesFromQuestion", + visibleIf: function (obj) { + return !obj.choicesFromQuestion; + }, + }, + { name: "separateSpecialChoices:boolean", visible: false }, + "hasOther:boolean", + "hasNone:boolean", + { + name: "otherPlaceHolder", + serializationProperty: "locOtherPlaceHolder", + dependsOn: "hasOther", + visibleIf: function (obj) { + return obj.hasOther; + }, + }, + { + name: "commentPlaceHolder", + serializationProperty: "locCommentPlaceHolder", + dependsOn: "hasComment", + visibleIf: function (obj) { + return obj.hasComment; + }, + }, + { + name: "noneText", + serializationProperty: "locNoneText", + dependsOn: "hasNone", + visibleIf: function (obj) { + return obj.hasNone; + }, + }, + { + name: "otherText", + serializationProperty: "locOtherText", + dependsOn: "hasOther", + visibleIf: function (obj) { + return obj.hasOther; + }, + }, + { + name: "otherErrorText", + serializationProperty: "locOtherErrorText", + dependsOn: "hasOther", + visibleIf: function (obj) { + return obj.hasOther; + }, + }, + { + name: "storeOthersAsComment", + default: "default", + choices: ["default", true, false], + visible: false, + }, + ], null, "question"); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("checkboxbase", [ + { + name: "colCount:number", + default: 1, + choices: [0, 1, 2, 3, 4, 5], + layout: "row", + }, + ], null, "selectbase"); + + + /***/ }), + + /***/ "./src/question_boolean.ts": + /*!*********************************!*\ + !*** ./src/question_boolean.ts ***! + \*********************************/ + /*! exports provided: QuestionBooleanModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionBooleanModel", function() { return QuestionBooleanModel; }); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + /** + * A Model for a boolean question. + */ + var QuestionBooleanModel = /** @class */ (function (_super) { + __extends(QuestionBooleanModel, _super); + function QuestionBooleanModel(name) { + var _this = _super.call(this, name) || this; + _this.createLocalizableString("labelFalse", _this, true, "booleanUncheckedLabel"); + _this.createLocalizableString("labelTrue", _this, true, "booleanCheckedLabel"); + return _this; + } + QuestionBooleanModel.prototype.getType = function () { + return "boolean"; + }; + QuestionBooleanModel.prototype.isLayoutTypeSupported = function (layoutType) { + return true; + }; + QuestionBooleanModel.prototype.supportGoNextPageAutomatic = function () { + return this.renderAs !== "checkbox"; + }; + Object.defineProperty(QuestionBooleanModel.prototype, "isIndeterminate", { + /** + * Returns true if the question check will be rendered in indeterminate mode. value is empty. + */ + get: function () { + return this.isEmpty(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionBooleanModel.prototype, "hasTitle", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionBooleanModel.prototype, "checkedValue", { + /** + * Get/set question value in 3 modes: indeterminate (value is empty), true (check is set) and false (check is unset). + * @see valueTrue + * @see valueFalse + */ + get: function () { + if (this.isEmpty()) + return null; + return this.value == this.getValueTrue(); + }, + set: function (val) { + if (this.isReadOnly) { + return; + } + this.setCheckedValue(val); + }, + enumerable: false, + configurable: true + }); + QuestionBooleanModel.prototype.setCheckedValue = function (val) { + if (this.isValueEmpty(val)) { + this.value = null; + } + else { + this.value = val == true ? this.getValueTrue() : this.getValueFalse(); + } + }; + Object.defineProperty(QuestionBooleanModel.prototype, "defaultValue", { + /** + * Set the default state of the check: "indeterminate" - default (value is empty/null), "true" - value equals valueTrue or true, "false" - value equals valueFalse or false. + */ + get: function () { + return this.getPropertyValue("defaultValue"); + }, + set: function (val) { + if (val === true) + val = "true"; + if (val === false) + val = "false"; + if (val === undefined) + val = "indeterminate"; + this.setPropertyValue("defaultValue", val); + this.updateValueWithDefaults(); + }, + enumerable: false, + configurable: true + }); + QuestionBooleanModel.prototype.getDefaultValue = function () { + if (this.defaultValue == "indeterminate") + return null; + if (this.defaultValue === undefined) + return null; + return this.defaultValue == "true" + ? this.getValueTrue() + : this.getValueFalse(); + }; + Object.defineProperty(QuestionBooleanModel.prototype, "locTitle", { + get: function () { + return this.showTitle || this.isValueEmpty(this.locLabel.text) + ? this.getLocalizableString("title") + : this.locLabel; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionBooleanModel.prototype, "locDisplayLabel", { + get: function () { + if (this.locLabel.text) + return this.locLabel; + return this.showTitle ? this.locLabel : this.locTitle; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionBooleanModel.prototype, "labelTrue", { + /** + * Set this property, if you want to have a different label for state when check is set. + */ + get: function () { + return this.getLocalizableStringText("labelTrue"); + }, + set: function (val) { + this.setLocalizableStringText("labelTrue", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionBooleanModel.prototype, "locLabelTrue", { + get: function () { + return this.getLocalizableString("labelTrue"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionBooleanModel.prototype, "isDeterminated", { + get: function () { + return this.checkedValue !== null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionBooleanModel.prototype, "labelFalse", { + /** + * Set this property, if you want to have a different label for state when check is unset. + */ + get: function () { + return this.getLocalizableStringText("labelFalse"); + }, + set: function (val) { + this.setLocalizableStringText("labelFalse", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionBooleanModel.prototype, "locLabelFalse", { + get: function () { + return this.getLocalizableString("labelFalse"); + }, + enumerable: false, + configurable: true + }); + QuestionBooleanModel.prototype.getValueTrue = function () { + return this.valueTrue ? this.valueTrue : true; + }; + QuestionBooleanModel.prototype.getValueFalse = function () { + return this.valueFalse ? this.valueFalse : false; + }; + QuestionBooleanModel.prototype.setDefaultValue = function () { + if (this.isDefaultValueSet("true", this.valueTrue)) + this.setCheckedValue(true); + if (this.isDefaultValueSet("false", this.valueFalse)) + this.setCheckedValue(false); + if (this.defaultValue == "indeterminate") + this.setCheckedValue(null); + }; + QuestionBooleanModel.prototype.isDefaultValueSet = function (defaultValueCheck, valueTrueOrFalse) { + return this.defaultValue == defaultValueCheck || (valueTrueOrFalse !== undefined && this.defaultValue === valueTrueOrFalse); + }; + QuestionBooleanModel.prototype.getDisplayValueCore = function (keysAsText, value) { + if (value == this.getValueTrue()) + return this.locLabelTrue.textOrHtml; + return this.locLabelFalse.textOrHtml; + }; + QuestionBooleanModel.prototype.getItemCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__["CssClassBuilder"]() + .append(this.cssClasses.item) + .append(this.cssClasses.itemOnError, this.errors.length > 0) + .append(this.cssClasses.itemDisabled, this.isReadOnly) + .append(this.cssClasses.itemChecked, !!this.checkedValue) + .append(this.cssClasses.itemIndeterminate, this.checkedValue === null) + .toString(); + }; + QuestionBooleanModel.prototype.getLabelCss = function (checked) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__["CssClassBuilder"]() + .append(this.cssClasses.label) + .append(this.cssClasses.disabledLabel, this.checkedValue === !checked || this.isReadOnly) + .toString(); + }; + Object.defineProperty(QuestionBooleanModel.prototype, "svgIcon", { + get: function () { + return this.cssClasses.svgIconId; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionBooleanModel.prototype, "allowClick", { + get: function () { + return this.isIndeterminate && !this.isInputReadOnly; + }, + enumerable: false, + configurable: true + }); + QuestionBooleanModel.prototype.getCheckedLabel = function () { + if (this.checkedValue === true) { + return this.locLabelTrue; + } + else if (this.checkedValue === false) { + return this.locLabelFalse; + } + }; + QuestionBooleanModel.prototype.setQuestionValue = function (newValue, updateIsAnswered) { + if (updateIsAnswered === void 0) { updateIsAnswered = true; } + if (newValue === "true" && this.valueTrue !== "true") + newValue = true; + if (newValue === "false" && this.valueFalse !== "false") + newValue = false; + if (newValue === "indeterminate") + newValue = null; + _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); + }; + /* #region web-based methods */ + QuestionBooleanModel.prototype.onLabelClick = function (event, value) { + if (this.allowClick) { + Object(_utils_utils__WEBPACK_IMPORTED_MODULE_4__["preventDefaults"])(event); + this.checkedValue = value; + } + return true; + }; + QuestionBooleanModel.prototype.calculateCheckedValueByEvent = function (event, isRightClick) { + var isRtl = document.defaultView.getComputedStyle(event.target).direction == "rtl"; + this.checkedValue = isRtl ? !isRightClick : isRightClick; + }; + QuestionBooleanModel.prototype.onSwitchClickModel = function (event) { + if (this.allowClick) { + Object(_utils_utils__WEBPACK_IMPORTED_MODULE_4__["preventDefaults"])(event); + var isRightClick = event.offsetX / event.target.offsetWidth > 0.5; + this.calculateCheckedValueByEvent(event, isRightClick); + return; + } + return true; + }; + QuestionBooleanModel.prototype.onKeyDownCore = function (event) { + if (event.key === "ArrowLeft" || event.key === "ArrowRight") { + Object(_utils_utils__WEBPACK_IMPORTED_MODULE_4__["preventDefaults"])(event); + this.calculateCheckedValueByEvent(event, event.key === "ArrowRight"); + return; + } + return true; + }; + /* #endregion */ + QuestionBooleanModel.prototype.getRadioItemClass = function (css, value) { + var className = undefined; + if (css.radioItem) { + className = css.radioItem; + } + if (css.radioItemChecked && value === this.value) { + className = (className ? className + " " : "") + css.radioItemChecked; + } + return className; + }; + QuestionBooleanModel.prototype.supportResponsiveness = function () { + return true; + }; + QuestionBooleanModel.prototype.getCompactRenderAs = function () { + return "radio"; + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: true }) + ], QuestionBooleanModel.prototype, "label", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() + ], QuestionBooleanModel.prototype, "showTitle", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() + ], QuestionBooleanModel.prototype, "valueTrue", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() + ], QuestionBooleanModel.prototype, "valueFalse", void 0); + return QuestionBooleanModel; + }(_question__WEBPACK_IMPORTED_MODULE_2__["Question"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("boolean", [ + { name: "label:text", serializationProperty: "locLabel" }, + { + name: "labelTrue:text", + serializationProperty: "locLabelTrue", + }, + { + name: "labelFalse:text", + serializationProperty: "locLabelFalse", + }, + "showTitle:boolean", + "valueTrue", + "valueFalse", + { name: "renderAs", default: "default", visible: false }, + ], function () { + return new QuestionBooleanModel(""); + }, "question"); + _questionfactory__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("boolean", function (name) { + return new QuestionBooleanModel(name); + }); + + + /***/ }), + + /***/ "./src/question_buttongroup.ts": + /*!*************************************!*\ + !*** ./src/question_buttongroup.ts ***! + \*************************************/ + /*! exports provided: ButtonGroupItemValue, QuestionButtonGroupModel, ButtonGroupItemModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ButtonGroupItemValue", function() { return ButtonGroupItemValue; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionButtonGroupModel", function() { return QuestionButtonGroupModel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ButtonGroupItemModel", function() { return ButtonGroupItemModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); + /* harmony import */ var _question_baseselect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_baseselect */ "./src/question_baseselect.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + var ButtonGroupItemValue = /** @class */ (function (_super) { + __extends(ButtonGroupItemValue, _super); + function ButtonGroupItemValue(value, text, typeName) { + if (text === void 0) { text = null; } + if (typeName === void 0) { typeName = "buttongroupitemvalue"; } + var _this = _super.call(this, value, text, typeName) || this; + _this.typeName = typeName; + return _this; + } + ButtonGroupItemValue.prototype.getType = function () { + return !!this.typeName ? this.typeName : "buttongroupitemvalue"; + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])() + ], ButtonGroupItemValue.prototype, "iconName", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])() + ], ButtonGroupItemValue.prototype, "iconSize", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])() + ], ButtonGroupItemValue.prototype, "showCaption", void 0); + return ButtonGroupItemValue; + }(_itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"])); + + /** + * A Model for a button group question. + */ + var QuestionButtonGroupModel = /** @class */ (function (_super) { + __extends(QuestionButtonGroupModel, _super); + function QuestionButtonGroupModel(name) { + return _super.call(this, name) || this; + } + QuestionButtonGroupModel.prototype.getType = function () { + return "buttongroup"; + }; + QuestionButtonGroupModel.prototype.getItemValueType = function () { + return "buttongroupitemvalue"; + }; + QuestionButtonGroupModel.prototype.supportOther = function () { + return false; + }; + return QuestionButtonGroupModel; + }(_question_baseselect__WEBPACK_IMPORTED_MODULE_2__["QuestionCheckboxBase"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("buttongroup", [ + { + name: "choices:buttongroupitemvalue[]", + }, + ], function () { + return new QuestionButtonGroupModel(""); + }, "checkboxbase"); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("buttongroupitemvalue", [ + { name: "showCaption:boolean", default: true }, + { name: "iconName:text" }, + { name: "iconSize:number" }, + ], function (value) { return new ButtonGroupItemValue(value); }, "itemvalue"); + // QuestionFactory.Instance.registerQuestion("buttongroup", name => { + // var q = new QuestionButtonGroupModel(name); + // q.choices = QuestionFactory.DefaultChoices; + // return q; + // }); + var ButtonGroupItemModel = /** @class */ (function () { + function ButtonGroupItemModel(question, item, index) { + this.question = question; + this.item = item; + this.index = index; + } + Object.defineProperty(ButtonGroupItemModel.prototype, "value", { + get: function () { + return this.item.value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "iconName", { + get: function () { + return this.item.iconName; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "iconSize", { + get: function () { + return this.item.iconSize || 24; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "caption", { + get: function () { + return this.item.locText; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "showCaption", { + get: function () { + return this.item.showCaption || this.item.showCaption === undefined; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "isRequired", { + get: function () { + return this.question.isRequired; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "selected", { + get: function () { + return this.question.isItemSelected(this.item); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "readOnly", { + get: function () { + return this.question.isInputReadOnly || !this.item.isEnabled; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "name", { + get: function () { + return this.question.name + "_" + this.question.id; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "id", { + get: function () { + return this.question.inputId + "_" + this.index; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "hasErrors", { + get: function () { + return this.question.errors.length > 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "describedBy", { + get: function () { + return this.question.errors.length > 0 + ? this.question.id + "_errors" + : null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "labelClass", { + get: function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__["CssClassBuilder"]() + .append(this.question.cssClasses.item) + .append(this.question.cssClasses.itemSelected, this.selected) + .append(this.question.cssClasses.itemHover, !this.readOnly && !this.selected) + .append(this.question.cssClasses.itemDisabled, this.question.isReadOnly || !this.item.isEnabled) + .toString(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ButtonGroupItemModel.prototype, "css", { + get: function () { + return { + label: this.labelClass, + icon: this.question.cssClasses.itemIcon, + control: this.question.cssClasses.itemControl, + caption: this.question.cssClasses.itemCaption, + decorator: this.question.cssClasses.itemDecorator, + }; + }, + enumerable: false, + configurable: true + }); + ButtonGroupItemModel.prototype.onChange = function () { + this.question.renderedValue = this.item.value; + }; + return ButtonGroupItemModel; + }()); + + + + /***/ }), + + /***/ "./src/question_checkbox.ts": + /*!**********************************!*\ + !*** ./src/question_checkbox.ts ***! + \**********************************/ + /*! exports provided: QuestionCheckboxModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCheckboxModel", function() { return QuestionCheckboxModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _question_baseselect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_baseselect */ "./src/question_baseselect.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + /** + * A Model for a checkbox question + */ + var QuestionCheckboxModel = /** @class */ (function (_super) { + __extends(QuestionCheckboxModel, _super); + function QuestionCheckboxModel(name) { + var _this = _super.call(this, name) || this; + _this.selectAllItemValue = new _itemvalue__WEBPACK_IMPORTED_MODULE_4__["ItemValue"]("selectall"); + _this.invisibleOldValues = {}; + _this.isChangingValueOnClearIncorrect = false; + var selectAllItemText = _this.createLocalizableString("selectAllText", _this, true, "selectAllItemText"); + _this.selectAllItem.locOwner = _this; + _this.selectAllItem.setLocText(selectAllItemText); + _this.registerFunctionOnPropertiesValueChanged(["hasSelectAll", "selectAllText"], function () { + _this.onVisibleChoicesChanged(); + }); + return _this; + } + Object.defineProperty(QuestionCheckboxModel.prototype, "ariaRole", { + get: function () { + return "listbox"; + }, + enumerable: false, + configurable: true + }); + QuestionCheckboxModel.prototype.getType = function () { + return "checkbox"; + }; + QuestionCheckboxModel.prototype.onCreating = function () { + _super.prototype.onCreating.call(this); + this.createNewArray("renderedValue"); + this.createNewArray("value"); + }; + QuestionCheckboxModel.prototype.getFirstInputElementId = function () { + return this.inputId + "_0"; + }; + Object.defineProperty(QuestionCheckboxModel.prototype, "selectAllItem", { + /** + * Returns the select all item. By using this property, you may change programmatically it's value and text. + * @see hasSelectAll + */ + get: function () { + return this.selectAllItemValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionCheckboxModel.prototype, "selectAllText", { + /** + * Use this property to set the different text for Select All item. + */ + get: function () { + return this.getLocalizableStringText("selectAllText"); + }, + set: function (val) { + this.setLocalizableStringText("selectAllText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionCheckboxModel.prototype, "locSelectAllText", { + get: function () { + return this.getLocalizableString("selectAllText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionCheckboxModel.prototype, "hasSelectAll", { + /** + * Set this property to true, to show the "Select All" item on the top. If end-user checks this item, then all items are checked. + */ + get: function () { + return this.getPropertyValue("hasSelectAll", false); + }, + set: function (val) { + this.setPropertyValue("hasSelectAll", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionCheckboxModel.prototype, "isAllSelected", { + /** + * Returns true if all items are selected + * @see toggleSelectAll + */ + get: function () { + var val = this.value; + if (!val || !Array.isArray(val)) + return false; + if (this.isItemSelected(this.noneItem)) + return false; + var allItemCount = this.visibleChoices.length; + if (this.hasOther) + allItemCount--; + if (this.hasNone) + allItemCount--; + if (this.hasSelectAll) + allItemCount--; + var selectedCount = val.length; + if (this.isItemSelected(this.otherItem)) + selectedCount--; + return selectedCount === allItemCount; + }, + set: function (val) { + if (val) { + this.selectAll(); + } + else { + this.clearValue(); + } + }, + enumerable: false, + configurable: true + }); + /** + * It will select all items, except other and none. If all items have been already selected then it will clear the value + * @see isAllSelected + * @see selectAll + */ + QuestionCheckboxModel.prototype.toggleSelectAll = function () { + this.isAllSelected = !this.isAllSelected; + }; + /** + * Select all items, except other and none. + */ + QuestionCheckboxModel.prototype.selectAll = function () { + var val = []; + for (var i = 0; i < this.visibleChoices.length; i++) { + var item = this.visibleChoices[i]; + if (item === this.noneItem || + item === this.otherItem || + item === this.selectAllItem) + continue; + val.push(item.value); + } + this.value = val; + }; + /** + * Returns true if item is checked + * @param item checkbox item value + */ + QuestionCheckboxModel.prototype.isItemSelected = function (item) { + if (item === this.selectAllItem) + return this.isAllSelected; + var val = this.renderedValue; + if (!val || !Array.isArray(val)) + return false; + for (var i = 0; i < val.length; i++) { + if (this.isTwoValueEquals(val[i], item.value)) + return true; + } + return false; + }; + Object.defineProperty(QuestionCheckboxModel.prototype, "maxSelectedChoices", { + /** + * Set this property different to 0 to limit the number of selected choices in the checkbox. + */ + get: function () { + return this.getPropertyValue("maxSelectedChoices"); + }, + set: function (val) { + if (val < 0) + val = 0; + this.setPropertyValue("maxSelectedChoices", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionCheckboxModel.prototype, "selectedItems", { + /** + * Return the selected items in the checkbox. Returns empty array if the value is empty + */ + get: function () { + if (this.isEmpty()) + return []; + var val = this.value; + var res = []; + for (var i = 0; i < val.length; i++) { + res.push(_itemvalue__WEBPACK_IMPORTED_MODULE_4__["ItemValue"].getItemByValue(this.visibleChoices, val[i])); + } + return res; + }, + enumerable: false, + configurable: true + }); + QuestionCheckboxModel.prototype.onEnableItemCallBack = function (item) { + if (!this.shouldCheckMaxSelectedChoices()) + return true; + return this.isItemSelected(item); + }; + QuestionCheckboxModel.prototype.onAfterRunItemsEnableCondition = function () { + if (this.maxSelectedChoices < 1) + return; + if (this.hasSelectAll) { + this.selectAllItem.setIsEnabled(this.maxSelectedChoices >= this.activeChoices.length); + } + if (this.hasOther) { + this.otherItem.setIsEnabled(!this.shouldCheckMaxSelectedChoices() || this.isOtherSelected); + } + }; + QuestionCheckboxModel.prototype.shouldCheckMaxSelectedChoices = function () { + if (this.maxSelectedChoices < 1) + return false; + var val = this.value; + var len = !Array.isArray(val) ? 0 : val.length; + return len >= this.maxSelectedChoices; + }; + QuestionCheckboxModel.prototype.getItemClassCore = function (item, options) { + this.value; //trigger dependencies from koValue for knockout + options.isSelectAllItem = item === this.selectAllItem; + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() + .append(_super.prototype.getItemClassCore.call(this, item, options)) + .append(this.cssClasses.itemSelectAll, options.isSelectAllItem) + .toString(); + }; + QuestionCheckboxModel.prototype.updateValueFromSurvey = function (newValue) { + _super.prototype.updateValueFromSurvey.call(this, newValue); + this.invisibleOldValues = {}; + }; + QuestionCheckboxModel.prototype.setDefaultValue = function () { + _super.prototype.setDefaultValue.call(this); + var val = this.defaultValue; + if (Array.isArray(val)) { + for (var i = 0; i < val.length; i++) { + if (this.canClearValueAnUnknow(val[i])) { + this.addIntoInvisibleOldValues(val[i]); + } + } + } + }; + QuestionCheckboxModel.prototype.addIntoInvisibleOldValues = function (val) { + this.invisibleOldValues[val] = val; + }; + QuestionCheckboxModel.prototype.hasValueToClearIncorrectValues = function () { + return _super.prototype.hasValueToClearIncorrectValues.call(this) || !_helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].isValueEmpty(this.invisibleOldValues); + }; + QuestionCheckboxModel.prototype.setNewValue = function (newValue) { + if (!this.isChangingValueOnClearIncorrect) { + this.invisibleOldValues = {}; + } + newValue = this.valueFromData(newValue); + var value = this.value; + if (!newValue) + newValue = []; + if (!value) + value = []; + if (this.isTwoValueEquals(value, newValue)) + return; + if (this.hasNone) { + var prevNoneIndex = this.noneIndexInArray(value); + var newNoneIndex = this.noneIndexInArray(newValue); + if (prevNoneIndex > -1) { + if (newNoneIndex > -1 && newValue.length > 1) { + newValue.splice(newNoneIndex, 1); + } + } + else { + if (newNoneIndex > -1) { + newValue.splice(0, newValue.length); + newValue.push(this.noneItem.value); + } + } + } + _super.prototype.setNewValue.call(this, this.rendredValueToData(newValue)); + }; + QuestionCheckboxModel.prototype.getIsMultipleValue = function () { + return true; + }; + QuestionCheckboxModel.prototype.getCommentFromValue = function (newValue) { + var ind = this.getFirstUnknownIndex(newValue); + if (ind < 0) + return ""; + return newValue[ind]; + }; + QuestionCheckboxModel.prototype.setOtherValueIntoValue = function (newValue) { + var ind = this.getFirstUnknownIndex(newValue); + if (ind < 0) + return newValue; + newValue.splice(ind, 1, this.otherItem.value); + return newValue; + }; + QuestionCheckboxModel.prototype.getFirstUnknownIndex = function (newValue) { + if (!Array.isArray(newValue)) + return -1; + for (var i = 0; i < newValue.length; i++) { + if (this.hasUnknownValue(newValue[i], false, false)) + return i; + } + return -1; + }; + QuestionCheckboxModel.prototype.noneIndexInArray = function (val) { + if (!val || !Array.isArray(val)) + return -1; + var noneValue = this.noneItem.value; + for (var i = 0; i < val.length; i++) { + if (val[i] == noneValue) + return i; + } + return -1; + }; + QuestionCheckboxModel.prototype.canUseFilteredChoices = function () { + return !this.hasSelectAll && _super.prototype.canUseFilteredChoices.call(this); + }; + QuestionCheckboxModel.prototype.supportSelectAll = function () { + return this.isSupportProperty("hasSelectAll"); + }; + QuestionCheckboxModel.prototype.addToVisibleChoices = function (items, isAddAll) { + if (this.supportSelectAll() && this.canShowOptionItem(this.selectAllItem, isAddAll, this.hasSelectAll)) { + items.unshift(this.selectAllItem); + } + _super.prototype.addToVisibleChoices.call(this, items, isAddAll); + }; + QuestionCheckboxModel.prototype.isHeadChoice = function (item, question) { + return (item === question.selectAllItem); + }; + /** + * For internal use in SurveyJS Creator V2. + */ + QuestionCheckboxModel.prototype.isItemInList = function (item) { + if (item == this.selectAllItem) + return this.hasSelectAll; + return _super.prototype.isItemInList.call(this, item); + }; + QuestionCheckboxModel.prototype.getDisplayValueCore = function (keysAsText, value) { + if (!Array.isArray(value)) + return _super.prototype.getDisplayValueCore.call(this, keysAsText, value); + var items = this.visibleChoices; + var str = ""; + for (var i = 0; i < value.length; i++) { + var valStr = this.getChoicesDisplayValue(items, value[i]); + if (valStr) { + if (str) + str += ", "; + str += valStr; + } + } + return str; + }; + QuestionCheckboxModel.prototype.clearIncorrectValuesCore = function () { + this.clearIncorrectAndDisabledValues(false); + }; + QuestionCheckboxModel.prototype.clearDisabledValuesCore = function () { + this.clearIncorrectAndDisabledValues(true); + }; + QuestionCheckboxModel.prototype.clearIncorrectAndDisabledValues = function (clearDisabled) { + var val = this.value; + var hasChanged = false; + var restoredValues = this.restoreValuesFromInvisible(); + if (!val && restoredValues.length == 0) + return; + if (!Array.isArray(val) || val.length == 0) { + this.isChangingValueOnClearIncorrect = true; + if (!clearDisabled) { + if (this.hasComment) { + this.value = null; + } + else { + this.clearValue(); + } + } + this.isChangingValueOnClearIncorrect = false; + if (restoredValues.length == 0) + return; + val = []; + } + var newValue = []; + for (var i = 0; i < val.length; i++) { + var isUnkown = this.canClearValueAnUnknow(val[i]); + if ((!clearDisabled && !isUnkown) || + (clearDisabled && !this.isValueDisabled(val[i]))) { + newValue.push(val[i]); + } + else { + hasChanged = true; + if (isUnkown) { + this.addIntoInvisibleOldValues(val[i]); + } + } + } + for (var i = 0; i < restoredValues.length; i++) { + newValue.push(restoredValues[i]); + hasChanged = true; + } + if (!hasChanged) + return; + this.isChangingValueOnClearIncorrect = true; + if (newValue.length == 0) { + this.clearValue(); + } + else { + this.value = newValue; + } + this.isChangingValueOnClearIncorrect = false; + }; + QuestionCheckboxModel.prototype.restoreValuesFromInvisible = function () { + var res = []; + var visItems = this.visibleChoices; + for (var i = 0; i < visItems.length; i++) { + var val = visItems[i].value; + if (_helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].isTwoValueEquals(val, this.invisibleOldValues[val])) { + if (!this.isItemSelected(visItems[i])) { + res.push(val); + } + delete this.invisibleOldValues[val]; + } + } + return res; + }; + QuestionCheckboxModel.prototype.getConditionJson = function (operator, path) { + if (operator === void 0) { operator = null; } + var json = _super.prototype.getConditionJson.call(this); + if (operator == "contains" || operator == "notcontains") { + json["type"] = "radiogroup"; + } + return json; + }; + QuestionCheckboxModel.prototype.isAnswerCorrect = function () { + return _helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].isArrayContainsEqual(this.value, this.correctAnswer); + }; + QuestionCheckboxModel.prototype.setDefaultValueWithOthers = function () { + this.value = this.renderedValueFromDataCore(this.defaultValue); + }; + QuestionCheckboxModel.prototype.getHasOther = function (val) { + if (!val || !Array.isArray(val)) + return false; + return val.indexOf(this.otherItem.value) >= 0; + }; + QuestionCheckboxModel.prototype.valueFromData = function (val) { + if (!val) + return val; + if (!Array.isArray(val)) + return [_super.prototype.valueFromData.call(this, val)]; + var value = []; + for (var i = 0; i < val.length; i++) { + var choiceitem = _itemvalue__WEBPACK_IMPORTED_MODULE_4__["ItemValue"].getItemByValue(this.activeChoices, val[i]); + if (!!choiceitem) { + value.push(choiceitem.value); + } + else { + value.push(val[i]); + } + } + return value; + }; + QuestionCheckboxModel.prototype.renderedValueFromDataCore = function (val) { + if (!val || !Array.isArray(val)) + val = []; + if (!this.hasActiveChoices) + return val; + for (var i = 0; i < val.length; i++) { + if (val[i] == this.otherItem.value) + return val; + if (this.hasUnknownValue(val[i], true, false)) { + this.comment = val[i]; + var newVal = val.slice(); + newVal[i] = this.otherItem.value; + return newVal; + } + } + return val; + }; + QuestionCheckboxModel.prototype.rendredValueToDataCore = function (val) { + if (!val || !val.length) + return val; + for (var i = 0; i < val.length; i++) { + if (val[i] == this.otherItem.value) { + if (this.getQuestionComment()) { + var newVal = val.slice(); + newVal[i] = this.getQuestionComment(); + return newVal; + } + } + } + return val; + }; + Object.defineProperty(QuestionCheckboxModel.prototype, "checkBoxSvgPath", { + get: function () { + return "M5,13l2-2l3,3l7-7l2,2l-9,9L5,13z"; + }, + enumerable: false, + configurable: true + }); + return QuestionCheckboxModel; + }(_question_baseselect__WEBPACK_IMPORTED_MODULE_2__["QuestionCheckboxBase"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("checkbox", [ + "hasSelectAll:boolean", + { name: "separateSpecialChoices", visible: true }, + { name: "maxSelectedChoices:number", default: 0 }, + { + name: "selectAllText", + serializationProperty: "locSelectAllText", + dependsOn: "hasSelectAll", + visibleIf: function (obj) { + return obj.hasSelectAll; + } + } + ], function () { + return new QuestionCheckboxModel(""); + }, "checkboxbase"); + _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("checkbox", function (name) { + var q = new QuestionCheckboxModel(name); + q.choices = _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].DefaultChoices; + return q; + }); + + + /***/ }), + + /***/ "./src/question_comment.ts": + /*!*********************************!*\ + !*** ./src/question_comment.ts ***! + \*********************************/ + /*! exports provided: QuestionCommentModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCommentModel", function() { return QuestionCommentModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _question_textbase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_textbase */ "./src/question_textbase.ts"); + /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + /** + * A Model for a comment question + */ + var QuestionCommentModel = /** @class */ (function (_super) { + __extends(QuestionCommentModel, _super); + function QuestionCommentModel() { + return _super !== null && _super.apply(this, arguments) || this; + } + Object.defineProperty(QuestionCommentModel.prototype, "rows", { + /** + * The html rows attribute. + */ + get: function () { + return this.getPropertyValue("rows"); + }, + set: function (val) { + this.setPropertyValue("rows", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionCommentModel.prototype, "cols", { + /** + * The html cols attribute. + */ + get: function () { + return this.getPropertyValue("cols"); + }, + set: function (val) { + this.setPropertyValue("cols", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionCommentModel.prototype, "acceptCarriageReturn", { + /** + * Accepts pressing the Enter key by end-users and accepts carriage return symbols - \n - in the question value assigned. + */ + get: function () { + return this.getPropertyValue("acceptCarriageReturn"); + }, + set: function (val) { + this.setPropertyValue("acceptCarriageReturn", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionCommentModel.prototype, "autoGrow", { + /** + * Specifies whether the question's text area automatically expands its height to avoid the vertical scrollbar and to display the entire multi-line contents entered by respondents. + * Default value is false. + * @see SurveyModel.autoGrowComment + */ + get: function () { + return this.getPropertyValue("autoGrow") || (this.survey && this.survey.autoGrowComment); + }, + set: function (val) { + this.setPropertyValue("autoGrow", val); + }, + enumerable: false, + configurable: true + }); + QuestionCommentModel.prototype.getType = function () { + return "comment"; + }; + QuestionCommentModel.prototype.afterRenderQuestionElement = function (el) { + this.element = document.getElementById(this.inputId) || el; + this.updateElement(); + _super.prototype.afterRenderQuestionElement.call(this, el); + }; + QuestionCommentModel.prototype.updateElement = function () { + var _this = this; + if (this.element && this.autoGrow) { + setTimeout(function () { return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["increaseHeightByContent"])(_this.element); }, 1); + } + }; + QuestionCommentModel.prototype.onInput = function (event) { + if (this.isInputTextUpdate) + this.value = event.target.value; + else + this.updateElement(); + }; + QuestionCommentModel.prototype.onKeyDown = function (event) { + if (!this.acceptCarriageReturn && (event.key === "Enter" || event.keyCode === 13)) { + event.preventDefault(); + event.stopPropagation(); + } + }; + QuestionCommentModel.prototype.onValueChanged = function () { + _super.prototype.onValueChanged.call(this); + this.updateElement(); + }; + QuestionCommentModel.prototype.setNewValue = function (newValue) { + if (!this.acceptCarriageReturn && !!newValue) { + // eslint-disable-next-line no-control-regex + newValue = newValue.replace(new RegExp("(\r\n|\n|\r)", "gm"), ""); + } + _super.prototype.setNewValue.call(this, newValue); + }; + Object.defineProperty(QuestionCommentModel.prototype, "className", { + get: function () { + return (this.cssClasses ? this.getControlClass() : "panel-comment-root") || undefined; + }, + enumerable: false, + configurable: true + }); + return QuestionCommentModel; + }(_question_textbase__WEBPACK_IMPORTED_MODULE_2__["QuestionTextBase"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("comment", [ + { name: "maxLength:number", default: -1 }, + { name: "cols:number", default: 50 }, + { name: "rows:number", default: 4 }, + { name: "placeHolder", serializationProperty: "locPlaceHolder" }, + { + name: "textUpdateMode", + default: "default", + choices: ["default", "onBlur", "onTyping"], + }, + { name: "autoGrow:boolean" }, + { name: "acceptCarriageReturn:boolean", default: true, visible: false } + ], function () { + return new QuestionCommentModel(""); + }, "textbase"); + _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("comment", function (name) { + return new QuestionCommentModel(name); + }); + + + /***/ }), + + /***/ "./src/question_custom.ts": + /*!********************************!*\ + !*** ./src/question_custom.ts ***! + \********************************/ + /*! exports provided: ComponentQuestionJSON, ComponentCollection, QuestionCustomModelBase, QuestionCustomModel, QuestionCompositeModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentQuestionJSON", function() { return ComponentQuestionJSON; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentCollection", function() { return ComponentCollection; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCustomModelBase", function() { return QuestionCustomModelBase; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCustomModel", function() { return QuestionCustomModel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionCompositeModel", function() { return QuestionCompositeModel; }); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _textPreProcessor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./textPreProcessor */ "./src/textPreProcessor.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + var ComponentQuestionJSON = /** @class */ (function () { + function ComponentQuestionJSON(name, json) { + this.name = name; + this.json = json; + var self = this; + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass(name, [], function (json) { + return ComponentCollection.Instance.createQuestion(!!json ? json.name : "", self); + }, "question"); + this.onInit(); + } + ComponentQuestionJSON.prototype.onInit = function () { + if (!this.json.onInit) + return; + this.json.onInit(); + }; + ComponentQuestionJSON.prototype.onCreated = function (question) { + if (!this.json.onCreated) + return; + this.json.onCreated(question); + }; + ComponentQuestionJSON.prototype.onLoaded = function (question) { + if (!this.json.onLoaded) + return; + this.json.onLoaded(question); + }; + ComponentQuestionJSON.prototype.onAfterRender = function (question, htmlElement) { + if (!this.json.onAfterRender) + return; + this.json.onAfterRender(question, htmlElement); + }; + ComponentQuestionJSON.prototype.onAfterRenderContentElement = function (question, element, htmlElement) { + if (!this.json.onAfterRenderContentElement) + return; + this.json.onAfterRenderContentElement(question, element, htmlElement); + }; + ComponentQuestionJSON.prototype.onPropertyChanged = function (question, propertyName, newValue) { + if (!this.json.onPropertyChanged) + return; + this.json.onPropertyChanged(question, propertyName, newValue); + }; + ComponentQuestionJSON.prototype.onValueChanged = function (question, name, newValue) { + if (!this.json.onValueChanged) + return; + this.json.onValueChanged(question, name, newValue); + }; + ComponentQuestionJSON.prototype.onItemValuePropertyChanged = function (question, item, propertyName, name, newValue) { + if (!this.json.onItemValuePropertyChanged) + return; + this.json.onItemValuePropertyChanged(question, { + obj: item, + propertyName: propertyName, + name: name, + newValue: newValue, + }); + }; + ComponentQuestionJSON.prototype.getDisplayValue = function (keyAsText, value, question) { + if (!this.json.getDisplayValue) + return question.getDisplayValue(keyAsText, value); + return this.json.getDisplayValue(question); + }; + Object.defineProperty(ComponentQuestionJSON.prototype, "isComposite", { + get: function () { + return !!this.json.elementsJSON || !!this.json.createElements; + }, + enumerable: false, + configurable: true + }); + return ComponentQuestionJSON; + }()); + + var ComponentCollection = /** @class */ (function () { + function ComponentCollection() { + this.customQuestionValues = []; + } + ComponentCollection.prototype.add = function (json) { + if (!json) + return; + var name = json.name; + if (!name) { + throw "Attribute name is missed"; + } + name = name.toLowerCase(); + if (!!this.getCustomQuestionByName(name)) { + throw "There is already registered custom question with name '" + + name + + "'"; + } + if (!!_jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].findClass(name)) { + throw "There is already class with name '" + name + "'"; + } + var customQuestion = new ComponentQuestionJSON(name, json); + if (!!this.onAddingJson) + this.onAddingJson(name, customQuestion.isComposite); + this.customQuestionValues.push(customQuestion); + }; + Object.defineProperty(ComponentCollection.prototype, "items", { + get: function () { + return this.customQuestionValues; + }, + enumerable: false, + configurable: true + }); + ComponentCollection.prototype.getCustomQuestionByName = function (name) { + for (var i = 0; i < this.customQuestionValues.length; i++) { + if (this.customQuestionValues[i].name == name) + return this.customQuestionValues[i]; + } + return null; + }; + ComponentCollection.prototype.clear = function () { + for (var i = 0; i < this.customQuestionValues.length; i++) { + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].removeClass(this.customQuestionValues[i].name); + } + this.customQuestionValues = []; + }; + ComponentCollection.prototype.createQuestion = function (name, questionJSON) { + if (!!questionJSON.isComposite) + return this.createCompositeModel(name, questionJSON); + return this.createCustomModel(name, questionJSON); + }; + ComponentCollection.prototype.createCompositeModel = function (name, questionJSON) { + if (!!this.onCreateComposite) + return this.onCreateComposite(name, questionJSON); + return new QuestionCompositeModel(name, questionJSON); + }; + ComponentCollection.prototype.createCustomModel = function (name, questionJSON) { + if (!!this.onCreateCustom) + return this.onCreateCustom(name, questionJSON); + return new QuestionCustomModel(name, questionJSON); + }; + ComponentCollection.Instance = new ComponentCollection(); + return ComponentCollection; + }()); + + var QuestionCustomModelBase = /** @class */ (function (_super) { + __extends(QuestionCustomModelBase, _super); + function QuestionCustomModelBase(name, customQuestion) { + var _this = _super.call(this, name) || this; + _this.customQuestion = customQuestion; + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["CustomPropertiesCollection"].createProperties(_this); + _survey_element__WEBPACK_IMPORTED_MODULE_2__["SurveyElement"].CreateDisabledDesignElements = true; + _this.createWrapper(); + _survey_element__WEBPACK_IMPORTED_MODULE_2__["SurveyElement"].CreateDisabledDesignElements = false; + if (!!_this.customQuestion) { + _this.customQuestion.onCreated(_this); + } + return _this; + } + QuestionCustomModelBase.prototype.getType = function () { + return !!this.customQuestion ? this.customQuestion.name : "custom"; + }; + QuestionCustomModelBase.prototype.locStrsChanged = function () { + _super.prototype.locStrsChanged.call(this); + if (!!this.getElement()) { + this.getElement().locStrsChanged(); + } + }; + QuestionCustomModelBase.prototype.createWrapper = function () { }; + QuestionCustomModelBase.prototype.onPropertyValueChanged = function (name, oldValue, newValue) { + _super.prototype.onPropertyValueChanged.call(this, name, oldValue, newValue); + if (!!this.customQuestion && !this.isLoadingFromJson) { + this.customQuestion.onPropertyChanged(this, name, newValue); + } + }; + QuestionCustomModelBase.prototype.itemValuePropertyChanged = function (item, name, oldValue, newValue) { + _super.prototype.itemValuePropertyChanged.call(this, item, name, oldValue, newValue); + if (!!this.customQuestion && !this.isLoadingFromJson) { + this.customQuestion.onItemValuePropertyChanged(this, item, item.ownerPropertyName, name, newValue); + } + }; + QuestionCustomModelBase.prototype.onFirstRendering = function () { + var el = this.getElement(); + if (!!el) { + el.onFirstRendering(); + } + _super.prototype.onFirstRendering.call(this); + }; + QuestionCustomModelBase.prototype.initElement = function (el) { + if (!el) + return; + el.setSurveyImpl(this); + el.disableDesignActions = true; + }; + QuestionCustomModelBase.prototype.setSurveyImpl = function (value, isLight) { + _super.prototype.setSurveyImpl.call(this, value, isLight); + this.initElement(this.getElement()); + }; + QuestionCustomModelBase.prototype.onSurveyLoad = function () { + _super.prototype.onSurveyLoad.call(this); + if (!!this.getElement()) { + this.getElement().onSurveyLoad(); + this.customQuestion.onLoaded(this); + } + }; + QuestionCustomModelBase.prototype.afterRenderQuestionElement = function (el) { + //Do nothing + }; + QuestionCustomModelBase.prototype.afterRender = function (el) { + _super.prototype.afterRender.call(this, el); + if (!!this.customQuestion) { + this.customQuestion.onAfterRender(this, el); + } + }; + QuestionCustomModelBase.prototype.setQuestionValue = function (newValue, updateIsAnswered) { + if (updateIsAnswered === void 0) { updateIsAnswered = true; } + _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); + this.updateElementCss(); + }; + QuestionCustomModelBase.prototype.setNewValue = function (newValue) { + _super.prototype.setNewValue.call(this, newValue); + this.updateElementCss(); + }; + //ISurveyImpl + QuestionCustomModelBase.prototype.getSurveyData = function () { + return this; + }; + // getSurvey(): ISurvey { + // return this.survey; + // } + QuestionCustomModelBase.prototype.getTextProcessor = function () { + return this.textProcessor; + }; + //ISurveyData + QuestionCustomModelBase.prototype.getValue = function (name) { + return this.value; + }; + QuestionCustomModelBase.prototype.setValue = function (name, newValue, locNotification, allowNotifyValueChanged) { + if (!this.data) + return; + var newName = this.convertDataName(name); + this.data.setValue(newName, this.convertDataValue(name, newValue), locNotification, allowNotifyValueChanged); + this.updateIsAnswered(); + this.updateElementCss(); + if (!!this.customQuestion) { + this.customQuestion.onValueChanged(this, name, newValue); + } + }; + QuestionCustomModelBase.prototype.convertDataName = function (name) { + return this.getValueName(); + }; + QuestionCustomModelBase.prototype.convertDataValue = function (name, newValue) { + return newValue; + }; + QuestionCustomModelBase.prototype.getVariable = function (name) { + return !!this.data ? this.data.getVariable(name) : null; + }; + QuestionCustomModelBase.prototype.setVariable = function (name, newValue) { + if (!this.data) + return; + this.data.setVariable(name, newValue); + }; + QuestionCustomModelBase.prototype.getComment = function (name) { + return !!this.data ? this.data.getComment(this.getValueName()) : ""; + }; + QuestionCustomModelBase.prototype.setComment = function (name, newValue, locNotification) { + if (!this.data) + return; + this.data.setComment(this.getValueName(), newValue, locNotification); + }; + QuestionCustomModelBase.prototype.getAllValues = function () { + return !!this.data ? this.data.getAllValues() : {}; + }; + QuestionCustomModelBase.prototype.getFilteredValues = function () { + return !!this.data ? this.data.getFilteredValues() : {}; + }; + QuestionCustomModelBase.prototype.getFilteredProperties = function () { + return !!this.data ? this.data.getFilteredProperties() : {}; + }; + //IPanel + QuestionCustomModelBase.prototype.addElement = function (element, index) { }; + QuestionCustomModelBase.prototype.removeElement = function (element) { + return false; + }; + QuestionCustomModelBase.prototype.getQuestionTitleLocation = function () { + return "left"; + }; + QuestionCustomModelBase.prototype.getQuestionStartIndex = function () { + return this.getStartIndex(); + }; + QuestionCustomModelBase.prototype.getChildrenLayoutType = function () { + return "row"; + }; + QuestionCustomModelBase.prototype.elementWidthChanged = function (el) { }; + Object.defineProperty(QuestionCustomModelBase.prototype, "elements", { + get: function () { + return []; + }, + enumerable: false, + configurable: true + }); + QuestionCustomModelBase.prototype.indexOf = function (el) { + return -1; + }; + QuestionCustomModelBase.prototype.ensureRowsVisibility = function () { + // do nothing + }; + QuestionCustomModelBase.prototype.getContentDisplayValueCore = function (keyAsText, value, question) { + if (!question) + return _super.prototype.getDisplayValueCore.call(this, keyAsText, value); + return this.customQuestion.getDisplayValue(keyAsText, value, question); + }; + return QuestionCustomModelBase; + }(_question__WEBPACK_IMPORTED_MODULE_0__["Question"])); + + var QuestionCustomModel = /** @class */ (function (_super) { + __extends(QuestionCustomModel, _super); + function QuestionCustomModel() { + return _super !== null && _super.apply(this, arguments) || this; + } + QuestionCustomModel.prototype.getTemplate = function () { + return "custom"; + }; + QuestionCustomModel.prototype.createWrapper = function () { + this.questionWrapper = this.createQuestion(); + }; + QuestionCustomModel.prototype.getElement = function () { + return this.contentQuestion; + }; + QuestionCustomModel.prototype.onAnyValueChanged = function (name) { + _super.prototype.onAnyValueChanged.call(this, name); + if (!!this.contentQuestion) { + this.contentQuestion.onAnyValueChanged(name); + } + }; + QuestionCustomModel.prototype.hasErrors = function (fireCallback, rec) { + if (fireCallback === void 0) { fireCallback = true; } + if (rec === void 0) { rec = null; } + if (!this.contentQuestion) + return false; + var res = this.contentQuestion.hasErrors(fireCallback, rec); + this.errors = []; + for (var i = 0; i < this.contentQuestion.errors.length; i++) { + this.errors.push(this.contentQuestion.errors[i]); + } + if (!res) { + res = _super.prototype.hasErrors.call(this, fireCallback, rec); + } + this.updateElementCss(); + return res; + }; + QuestionCustomModel.prototype.focus = function (onError) { + if (onError === void 0) { onError = false; } + if (!!this.contentQuestion) { + this.contentQuestion.focus(onError); + } + else { + _super.prototype.focus.call(this, onError); + } + }; + Object.defineProperty(QuestionCustomModel.prototype, "contentQuestion", { + get: function () { + return this.questionWrapper; + }, + enumerable: false, + configurable: true + }); + QuestionCustomModel.prototype.createQuestion = function () { + var json = this.customQuestion.json; + var res = null; + if (!!json.questionJSON) { + var qType = json.questionJSON.type; + if (!qType || !_jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].findClass(qType)) + throw "type attribute in questionJSON is empty or incorrect"; + res = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass(qType); + this.initElement(res); + res.fromJSON(json.questionJSON); + } + else { + if (!!json.createQuestion) { + res = json.createQuestion(); + this.initElement(res); + } + } + if (!!res && !res.name) { + res.name = "question"; + } + return res; + }; + QuestionCustomModel.prototype.onSurveyLoad = function () { + _super.prototype.onSurveyLoad.call(this); + if (!this.contentQuestion) + return; + if (this.isEmpty() && !this.contentQuestion.isEmpty()) { + this.value = this.contentQuestion.value; + } + }; + QuestionCustomModel.prototype.runCondition = function (values, properties) { + _super.prototype.runCondition.call(this, values, properties); + if (!!this.contentQuestion) { + this.contentQuestion.runCondition(values, properties); + } + }; + QuestionCustomModel.prototype.convertDataName = function (name) { + if (!this.contentQuestion) + return _super.prototype.convertDataName.call(this, name); + var newName = name.replace(this.contentQuestion.getValueName(), this.getValueName()); + return newName.indexOf(this.getValueName()) == 0 + ? newName + : _super.prototype.convertDataName.call(this, name); + }; + QuestionCustomModel.prototype.convertDataValue = function (name, newValue) { + return this.convertDataName(name) == _super.prototype.convertDataName.call(this, name) + ? this.contentQuestion.value + : newValue; + }; + QuestionCustomModel.prototype.canSetValueToSurvey = function () { + return false; + }; + QuestionCustomModel.prototype.setQuestionValue = function (newValue, updateIsAnswered) { + if (updateIsAnswered === void 0) { updateIsAnswered = true; } + _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); + if (!!this.contentQuestion && + !this.isTwoValueEquals(this.contentQuestion.value, newValue)) { + this.contentQuestion.value = this.getUnbindValue(newValue); + } + }; + QuestionCustomModel.prototype.onSurveyValueChanged = function (newValue) { + _super.prototype.onSurveyValueChanged.call(this, newValue); + if (!!this.contentQuestion) { + this.contentQuestion.onSurveyValueChanged(newValue); + } + }; + QuestionCustomModel.prototype.getValueCore = function () { + if (!!this.contentQuestion) + return this.contentQuestion.value; + return _super.prototype.getValueCore.call(this); + }; + QuestionCustomModel.prototype.initElement = function (el) { + var _this = this; + _super.prototype.initElement.call(this, el); + if (!!el) { + el.parent = this; + el.afterRenderQuestionCallback = function (question, element) { + if (!!_this.customQuestion) { + _this.customQuestion.onAfterRenderContentElement(_this, question, element); + } + }; + } + }; + QuestionCustomModel.prototype.updateElementCss = function (reNew) { + if (!!this.contentQuestion) { + this.questionWrapper.updateElementCss(reNew); + } + _super.prototype.updateElementCss.call(this, reNew); + }; + QuestionCustomModel.prototype.updateElementCssCore = function (cssClasses) { + if (!!this.contentQuestion) { + cssClasses = this.contentQuestion.cssClasses; + } + _super.prototype.updateElementCssCore.call(this, cssClasses); + }; + QuestionCustomModel.prototype.getDisplayValueCore = function (keyAsText, value) { + return _super.prototype.getContentDisplayValueCore.call(this, keyAsText, value, this.contentQuestion); + }; + return QuestionCustomModel; + }(QuestionCustomModelBase)); + + var QuestionCompositeTextProcessor = /** @class */ (function (_super) { + __extends(QuestionCompositeTextProcessor, _super); + function QuestionCompositeTextProcessor(composite, variableName) { + var _this = _super.call(this, variableName) || this; + _this.composite = composite; + _this.variableName = variableName; + return _this; + } + Object.defineProperty(QuestionCompositeTextProcessor.prototype, "survey", { + get: function () { + return this.composite.survey; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionCompositeTextProcessor.prototype, "panel", { + get: function () { + return this.composite.contentPanel; + }, + enumerable: false, + configurable: true + }); + return QuestionCompositeTextProcessor; + }(_textPreProcessor__WEBPACK_IMPORTED_MODULE_4__["QuestionTextProcessor"])); + var QuestionCompositeModel = /** @class */ (function (_super) { + __extends(QuestionCompositeModel, _super); + function QuestionCompositeModel(name, customQuestion) { + var _this = _super.call(this, name, customQuestion) || this; + _this.customQuestion = customQuestion; + _this.settingNewValue = false; + _this.textProcessing = new QuestionCompositeTextProcessor(_this, QuestionCompositeModel.ItemVariableName); + return _this; + } + QuestionCompositeModel.prototype.createWrapper = function () { + this.panelWrapper = this.createPanel(); + }; + QuestionCompositeModel.prototype.getTemplate = function () { + return "composite"; + }; + QuestionCompositeModel.prototype.getCssType = function () { + return "composite"; + }; + QuestionCompositeModel.prototype.getElement = function () { + return this.contentPanel; + }; + Object.defineProperty(QuestionCompositeModel.prototype, "contentPanel", { + get: function () { + return this.panelWrapper; + }, + enumerable: false, + configurable: true + }); + QuestionCompositeModel.prototype.hasErrors = function (fireCallback, rec) { + if (fireCallback === void 0) { fireCallback = true; } + if (rec === void 0) { rec = null; } + var res = _super.prototype.hasErrors.call(this, fireCallback, rec); + if (!this.contentPanel) + return res; + return this.contentPanel.hasErrors(fireCallback, false, rec) || res; + }; + QuestionCompositeModel.prototype.updateElementCss = function (reNew) { + _super.prototype.updateElementCss.call(this, reNew); + if (this.contentPanel) { + this.contentPanel.updateElementCss(reNew); + } + }; + QuestionCompositeModel.prototype.getTextProcessor = function () { + return this.textProcessing; + }; + QuestionCompositeModel.prototype.clearValueIfInvisibleCore = function () { + _super.prototype.clearValueIfInvisibleCore.call(this); + var questions = this.contentPanel.questions; + for (var i = 0; i < questions.length; i++) { + questions[i].clearValueIfInvisible(); + } + }; + QuestionCompositeModel.prototype.onAnyValueChanged = function (name) { + _super.prototype.onAnyValueChanged.call(this, name); + var questions = this.contentPanel.questions; + for (var i = 0; i < questions.length; i++) { + questions[i].onAnyValueChanged(name); + } + }; + QuestionCompositeModel.prototype.createPanel = function () { + var res = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass("panel"); + res.showQuestionNumbers = "off"; + res.renderWidth = "100%"; + var json = this.customQuestion.json; + if (!!json.elementsJSON) { + res.fromJSON({ elements: json.elementsJSON }); + } + if (!!json.createElements) { + json.createElements(res, this); + } + this.initElement(res); + res.readOnly = this.isReadOnly; + this.setAfterRenderCallbacks(res); + return res; + }; + QuestionCompositeModel.prototype.onReadOnlyChanged = function () { + if (!!this.contentPanel) { + this.contentPanel.readOnly = this.isReadOnly; + } + _super.prototype.onReadOnlyChanged.call(this); + }; + QuestionCompositeModel.prototype.onSurveyLoad = function () { + if (!!this.contentPanel) { + this.contentPanel.readOnly = this.isReadOnly; + this.setIsContentElement(this.contentPanel); + } + _super.prototype.onSurveyLoad.call(this); + if (!!this.contentPanel) { + var val = this.contentPanel.getValue(); + if (!_helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].isValueEmpty(val)) { + this.value = val; + } + } + }; + QuestionCompositeModel.prototype.setIsContentElement = function (panel) { + panel.isContentElement = true; + var elements = panel.elements; + for (var i = 0; i < elements.length; i++) { + var el = elements[i]; + if (el.isPanel) { + this.setIsContentElement(el); + } + else { + el.isContentElement = true; + } + } + }; + QuestionCompositeModel.prototype.setVisibleIndex = function (val) { + var res = _super.prototype.setVisibleIndex.call(this, val); + if (this.isVisible && !!this.contentPanel) { + res += this.contentPanel.setVisibleIndex(val); + } + return res; + }; + QuestionCompositeModel.prototype.runCondition = function (values, properties) { + _super.prototype.runCondition.call(this, values, properties); + if (!!this.contentPanel) { + var oldComposite = values[QuestionCompositeModel.ItemVariableName]; + values[QuestionCompositeModel.ItemVariableName] = this.contentPanel.getValue(); + this.contentPanel.runCondition(values, properties); + delete values[QuestionCompositeModel.ItemVariableName]; + if (!!oldComposite) { + values[QuestionCompositeModel.ItemVariableName] = oldComposite; + } + } + }; + QuestionCompositeModel.prototype.getValue = function (name) { + var val = this.value; + return !!val ? val[name] : null; + }; + QuestionCompositeModel.prototype.setValue = function (name, newValue, locNotification, allowNotifyValueChanged) { + if (this.settingNewValue) + return; + _super.prototype.setValue.call(this, name, newValue, locNotification, allowNotifyValueChanged); + if (!this.contentPanel) + return; + var q = this.contentPanel.getQuestionByName(name); + if (!!q && !this.isTwoValueEquals(newValue, q.value)) { + this.settingNewValue = true; + q.value = newValue; + this.settingNewValue = false; + } + }; + QuestionCompositeModel.prototype.addConditionObjectsByContext = function (objects, context) { + if (!this.contentPanel) + return; + var questions = this.contentPanel.questions; + var prefixName = this.name; + var prefixText = this.title; + for (var i = 0; i < questions.length; i++) { + objects.push({ + name: prefixName + "." + questions[i].name, + text: prefixText + "." + questions[i].title, + question: questions[i], + }); + } + }; + QuestionCompositeModel.prototype.convertDataValue = function (name, newValue) { + var val = this.value; + if (!val) + val = {}; + if (this.isValueEmpty(newValue) && !this.isEditingSurveyElement) { + delete val[name]; + } + else { + val[name] = newValue; + } + return val; + }; + QuestionCompositeModel.prototype.setQuestionValue = function (newValue, updateIsAnswered) { + if (updateIsAnswered === void 0) { updateIsAnswered = true; } + _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); + this.settingNewValue = true; + var questions = this.contentPanel.questions; + for (var i = 0; i < questions.length; i++) { + var key = questions[i].getValueName(); + questions[i].value = !!newValue ? newValue[key] : undefined; + } + this.settingNewValue = false; + }; + QuestionCompositeModel.prototype.getDisplayValueCore = function (keyAsText, value) { + return _super.prototype.getContentDisplayValueCore.call(this, keyAsText, value, this.contentPanel); + }; + QuestionCompositeModel.prototype.setAfterRenderCallbacks = function (panel) { + var _this = this; + if (!panel || !this.customQuestion) + return; + var questions = panel.questions; + for (var i = 0; i < questions.length; i++) { + questions[i].afterRenderQuestionCallback = function (question, element) { + _this.customQuestion.onAfterRenderContentElement(_this, question, element); + }; + } + }; + QuestionCompositeModel.ItemVariableName = "composite"; + return QuestionCompositeModel; + }(QuestionCustomModelBase)); + + + + /***/ }), + + /***/ "./src/question_dropdown.ts": + /*!**********************************!*\ + !*** ./src/question_dropdown.ts ***! + \**********************************/ + /*! exports provided: QuestionDropdownModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionDropdownModel", function() { return QuestionDropdownModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _question_baseselect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_baseselect */ "./src/question_baseselect.ts"); + /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _popup__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./popup */ "./src/popup.ts"); + /* harmony import */ var _list__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./list */ "./src/list.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + + + /** + * A Model for a dropdown question + */ + var QuestionDropdownModel = /** @class */ (function (_super) { + __extends(QuestionDropdownModel, _super); + function QuestionDropdownModel(name) { + var _this = _super.call(this, name) || this; + _this.minMaxChoices = []; + _this.createLocalizableString("optionsCaption", _this, false, true); + var self = _this; + _this.registerFunctionOnPropertiesValueChanged(["choicesMin", "choicesMax", "choicesStep"], function () { + self.onVisibleChoicesChanged(); + }); + return _this; + } + QuestionDropdownModel.prototype.getVisibleListItems = function () { + return this.visibleChoices.map(function (choice) { return ({ + id: choice.value, + title: choice.text, + visible: choice.isVisible, + enabled: choice.isEnabled, + }); }); + }; + Object.defineProperty(QuestionDropdownModel.prototype, "showOptionsCaption", { + /** + * This flag controls whether to show options caption item ('Choose...'). + */ + get: function () { + return this.getPropertyValue("showOptionsCaption"); + }, + set: function (val) { + this.setPropertyValue("showOptionsCaption", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionDropdownModel.prototype, "optionsCaption", { + /** + * Use this property to set the options caption different from the default value. The default value is taken from localization strings. + */ + get: function () { + return this.getLocalizableStringText("optionsCaption"); + }, + set: function (val) { + this.setLocalizableStringText("optionsCaption", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionDropdownModel.prototype, "locOptionsCaption", { + get: function () { + return this.getLocalizableString("optionsCaption"); + }, + enumerable: false, + configurable: true + }); + QuestionDropdownModel.prototype.getType = function () { + return "dropdown"; + }; + Object.defineProperty(QuestionDropdownModel.prototype, "selectedItem", { + get: function () { + if (this.isEmpty()) + return null; + return _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"].getItemByValue(this.visibleChoices, this.value); + }, + enumerable: false, + configurable: true + }); + QuestionDropdownModel.prototype.supportGoNextPageAutomatic = function () { + return true; + }; + QuestionDropdownModel.prototype.getChoices = function () { + var items = _super.prototype.getChoices.call(this); + if (this.choicesMax <= this.choicesMin) + return items; + var res = []; + for (var i = 0; i < items.length; i++) { + res.push(items[i]); + } + if (this.minMaxChoices.length === 0 || + this.minMaxChoices.length !== + (this.choicesMax - this.choicesMin) / this.choicesStep + 1) { + this.minMaxChoices = []; + for (var i = this.choicesMin; i <= this.choicesMax; i += this.choicesStep) { + this.minMaxChoices.push(new _itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"](i)); + } + } + res = res.concat(this.minMaxChoices); + return res; + }; + Object.defineProperty(QuestionDropdownModel.prototype, "choicesMin", { + /** + * Use this and choicesMax property to automatically add choices. For example choicesMin = 1 and choicesMax = 10 will generate ten additional choices from 1 to 10. + * @see choicesMax + * @see choicesStep + */ + get: function () { + return this.getPropertyValue("choicesMin"); + }, + set: function (val) { + this.setPropertyValue("choicesMin", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionDropdownModel.prototype, "choicesMax", { + /** + * Use this and choicesMax property to automatically add choices. For example choicesMin = 1 and choicesMax = 10 will generate ten additional choices from 1 to 10. + * @see choicesMin + * @see choicesStep + */ + get: function () { + return this.getPropertyValue("choicesMax"); + }, + set: function (val) { + this.setPropertyValue("choicesMax", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionDropdownModel.prototype, "choicesStep", { + /** + * The default value is 1. It tells the value of the iterator between choicesMin and choicesMax properties. + * If choicesMin = 10, choicesMax = 30 and choicesStep = 10 then you will have only three additional choices: [10, 20, 30]. + * @see choicesMin + * @see choicesMax + */ + get: function () { + return this.getPropertyValue("choicesStep"); + }, + set: function (val) { + if (val < 1) + val = 1; + this.setPropertyValue("choicesStep", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionDropdownModel.prototype, "autoComplete", { + /** + * Dropdown auto complete + */ + get: function () { + return this.getPropertyValue("autoComplete", ""); + }, + set: function (val) { + this.setPropertyValue("autoComplete", val); + }, + enumerable: false, + configurable: true + }); + QuestionDropdownModel.prototype.getControlClass = function () { + this.isEmpty(); + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__["CssClassBuilder"]() + .append(this.cssClasses.control) + .append(this.cssClasses.controlEmpty, this.isEmpty()) + .append(this.cssClasses.onError, this.errors.length > 0) + .append(this.cssClasses.controlDisabled, this.isReadOnly) + .toString(); + }; + Object.defineProperty(QuestionDropdownModel.prototype, "readOnlyText", { + get: function () { + return this.hasOther && this.isOtherSelected ? this.otherText : (this.displayValue || this.showOptionsCaption && this.optionsCaption); + }, + enumerable: false, + configurable: true + }); + QuestionDropdownModel.prototype.onVisibleChoicesChanged = function () { + _super.prototype.onVisibleChoicesChanged.call(this); + if (this.popupModel) { + this.popupModel.contentComponentData.model.setItems(this.getVisibleListItems()); + } + }; + Object.defineProperty(QuestionDropdownModel.prototype, "popupModel", { + get: function () { + var _this = this; + if (this.renderAs === "select" && !this._popupModel) { + var listModel = new _list__WEBPACK_IMPORTED_MODULE_6__["ListModel"](this.getVisibleListItems(), function (item) { + _this.value = item.id; + _this.popupModel.toggleVisibility(); + }, true); + listModel.denySearch = this.denySearch; + this._popupModel = new _popup__WEBPACK_IMPORTED_MODULE_5__["PopupModel"]("sv-list", { + model: listModel, + }, "bottom", "center", false); + this._popupModel.widthMode = (this.dropdownWidthMode === "editorWidth") ? "fixedWidth" : "contentWidth"; + } + return this._popupModel; + }, + enumerable: false, + configurable: true + }); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ + defaultValue: false, + onSet: function (newValue, target) { + if (!!target.popupModel && target.popupModel.contentComponentData.model instanceof _list__WEBPACK_IMPORTED_MODULE_6__["ListModel"]) { + var listModel = target.popupModel.contentComponentData.model; + listModel.denySearch = newValue; + } + } + }) + ], QuestionDropdownModel.prototype, "denySearch", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ + defaultValue: "editorWidth", + onSet: function (newValue, target) { + if (!!target.popupModel) { + target.popupModel.widthMode = (newValue === "editorWidth") ? "fixedWidth" : "contentWidth"; + } + } + }) + ], QuestionDropdownModel.prototype, "dropdownWidthMode", void 0); + return QuestionDropdownModel; + }(_question_baseselect__WEBPACK_IMPORTED_MODULE_2__["QuestionSelectBase"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("dropdown", [ + { name: "optionsCaption", serializationProperty: "locOptionsCaption" }, + { name: "showOptionsCaption:boolean", default: true }, + { name: "choicesMin:number", default: 0 }, + { name: "choicesMax:number", default: 0 }, + { name: "choicesStep:number", default: 1, minValue: 1 }, + { + name: "autoComplete", + dataList: [ + "name", + "honorific-prefix", + "given-name", + "additional-name", + "family-name", + "honorific-suffix", + "nickname", + "organization-title", + "username", + "new-password", + "current-password", + "organization", + "street-address", + "address-line1", + "address-line2", + "address-line3", + "address-level4", + "address-level3", + "address-level2", + "address-level1", + "country", + "country-name", + "postal-code", + "cc-name", + "cc-given-name", + "cc-additional-name", + "cc-family-name", + "cc-number", + "cc-exp", + "cc-exp-month", + "cc-exp-year", + "cc-csc", + "cc-type", + "transaction-currency", + "transaction-amount", + "language", + "bday", + "bday-day", + "bday-month", + "bday-year", + "sex", + "url", + "photo", + "tel", + "tel-country-code", + "tel-national", + "tel-area-code", + "tel-local", + "tel-local-prefix", + "tel-local-suffix", + "tel-extension", + "email", + "impp", + ], + }, + { name: "renderAs", default: "default", visible: false }, + { name: "denySearch:boolean", default: false, visible: false }, + { name: "dropdownWidthMode", default: "editorWidth", visible: false }, + ], function () { + return new QuestionDropdownModel(""); + }, "selectbase"); + _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("dropdown", function (name) { + var q = new QuestionDropdownModel(name); + q.choices = _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].DefaultChoices; + return q; + }); + + + /***/ }), + + /***/ "./src/question_empty.ts": + /*!*******************************!*\ + !*** ./src/question_empty.ts ***! + \*******************************/ + /*! exports provided: QuestionEmptyModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionEmptyModel", function() { return QuestionEmptyModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + /** + * A Model for an question that renders empty "div" tag. It used as a base class for some custom widgets + */ + var QuestionEmptyModel = /** @class */ (function (_super) { + __extends(QuestionEmptyModel, _super); + function QuestionEmptyModel(name) { + return _super.call(this, name) || this; + } + QuestionEmptyModel.prototype.getType = function () { + return "empty"; + }; + return QuestionEmptyModel; + }(_question__WEBPACK_IMPORTED_MODULE_1__["Question"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("empty", [], function () { + return new QuestionEmptyModel(""); + }, "question"); + + + /***/ }), + + /***/ "./src/question_expression.ts": + /*!************************************!*\ + !*** ./src/question_expression.ts ***! + \************************************/ + /*! exports provided: QuestionExpressionModel, getCurrecyCodes */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionExpressionModel", function() { return QuestionExpressionModel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCurrecyCodes", function() { return getCurrecyCodes; }); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + /** + * A Model for expression question. It is a read-only question. It calculates value based on epxression property. + */ + var QuestionExpressionModel = /** @class */ (function (_super) { + __extends(QuestionExpressionModel, _super); + function QuestionExpressionModel(name) { + var _this = _super.call(this, name) || this; + _this.createLocalizableString("format", _this); + _this.registerFunctionOnPropertyValueChanged("expression", function () { + if (_this.expressionRunner) { + _this.expressionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_4__["ExpressionRunner"](_this.expression); + } + }); + _this.registerFunctionOnPropertiesValueChanged(["format", "currency", "displayStyle"], function () { + _this.updateFormatedValue(); + }); + return _this; + } + QuestionExpressionModel.prototype.getType = function () { + return "expression"; + }; + Object.defineProperty(QuestionExpressionModel.prototype, "hasInput", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionExpressionModel.prototype, "format", { + /** + * Use this property to display the value in your own format. Make sure you have "{0}" substring in your string, to display the actual value. + */ + get: function () { + return this.getLocalizableStringText("format", ""); + }, + set: function (val) { + this.setLocalizableStringText("format", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionExpressionModel.prototype, "locFormat", { + get: function () { + return this.getLocalizableString("format"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionExpressionModel.prototype, "expression", { + /** + * The Expression that used to calculate the question value. You may use standard operators like +, -, * and /, squares (). Here is the example of accessing the question value {questionname}. + *
Example: "({quantity} * {price}) * (100 - {discount}) / 100" + */ + get: function () { + return this.getPropertyValue("expression", ""); + }, + set: function (val) { + this.setPropertyValue("expression", val); + }, + enumerable: false, + configurable: true + }); + QuestionExpressionModel.prototype.locCalculation = function () { + this.expressionIsRunning = true; + }; + QuestionExpressionModel.prototype.unlocCalculation = function () { + this.expressionIsRunning = false; + }; + QuestionExpressionModel.prototype.runCondition = function (values, properties) { + var _this = this; + _super.prototype.runCondition.call(this, values, properties); + if (!this.expression || + this.expressionIsRunning || + (!this.runIfReadOnly && this.isReadOnly)) + return; + this.locCalculation(); + if (!this.expressionRunner) { + this.expressionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_4__["ExpressionRunner"](this.expression); + } + this.expressionRunner.onRunComplete = function (newValue) { + if (!_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isTwoValueEquals(newValue, _this.value)) { + _this.value = newValue; + } + _this.unlocCalculation(); + }; + this.expressionRunner.run(values, properties); + }; + QuestionExpressionModel.prototype.canCollectErrors = function () { + return true; + }; + QuestionExpressionModel.prototype.hasRequiredError = function () { + return false; + }; + Object.defineProperty(QuestionExpressionModel.prototype, "maximumFractionDigits", { + /** + * The maximum number of fraction digits to use if displayStyle is not "none". Possible values are from 0 to 20. The default value is -1 and it means that this property is not used. + */ + get: function () { + return this.getPropertyValue("maximumFractionDigits"); + }, + set: function (val) { + if (val < -1 || val > 20) + return; + this.setPropertyValue("maximumFractionDigits", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionExpressionModel.prototype, "minimumFractionDigits", { + /** + * The minimum number of fraction digits to use if displayStyle is not "none". Possible values are from 0 to 20. The default value is -1 and it means that this property is not used. + */ + get: function () { + return this.getPropertyValue("minimumFractionDigits"); + }, + set: function (val) { + if (val < -1 || val > 20) + return; + this.setPropertyValue("minimumFractionDigits", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionExpressionModel.prototype, "runIfReadOnly", { + get: function () { + return this.runIfReadOnlyValue === true; + }, + set: function (val) { + this.runIfReadOnlyValue = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionExpressionModel.prototype, "formatedValue", { + get: function () { + return this.getPropertyValue("formatedValue", ""); + }, + enumerable: false, + configurable: true + }); + QuestionExpressionModel.prototype.updateFormatedValue = function () { + this.setPropertyValue("formatedValue", this.getDisplayValueCore(false, this.value)); + }; + QuestionExpressionModel.prototype.onValueChanged = function () { + this.updateFormatedValue(); + }; + QuestionExpressionModel.prototype.updateValueFromSurvey = function (newValue) { + _super.prototype.updateValueFromSurvey.call(this, newValue); + this.updateFormatedValue(); + }; + QuestionExpressionModel.prototype.getDisplayValueCore = function (keysAsText, value) { + var val = this.isValueEmpty(value) ? this.defaultValue : value; + var res = ""; + if (!this.isValueEmpty(val)) { + var str = this.getValueAsStr(val); + res = !this.format ? str : this.format["format"](str); + } + if (!!this.survey) { + res = this.survey.getExpressionDisplayValue(this, val, res); + } + return res; + }; + Object.defineProperty(QuestionExpressionModel.prototype, "displayStyle", { + /** + * You may set this property to "decimal", "currency", "percent" or "date". If you set it to "currency", you may use the currency property to display the value in currency different from USD. + * @see currency + */ + get: function () { + return this.getPropertyValue("displayStyle"); + }, + set: function (val) { + this.setPropertyValue("displayStyle", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionExpressionModel.prototype, "currency", { + /** + * Use it to display the value in the currency differen from USD. The displayStype should be set to "currency". + * @see displayStyle + */ + get: function () { + return this.getPropertyValue("currency"); + }, + set: function (val) { + if (getCurrecyCodes().indexOf(val) < 0) + return; + this.setPropertyValue("currency", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionExpressionModel.prototype, "useGrouping", { + /** + * Determines whether to display grouping separators. The default value is true. + */ + get: function () { + return this.getPropertyValue("useGrouping"); + }, + set: function (val) { + this.setPropertyValue("useGrouping", val); + }, + enumerable: false, + configurable: true + }); + QuestionExpressionModel.prototype.getValueAsStr = function (val) { + if (this.displayStyle == "date") { + var d = new Date(val); + if (!!d && !!d.toLocaleDateString) + return d.toLocaleDateString(); + } + if (this.displayStyle != "none" && _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(val)) { + var locale = this.getLocale(); + if (!locale) + locale = "en"; + var options = { + style: this.displayStyle, + currency: this.currency, + useGrouping: this.useGrouping, + }; + if (this.maximumFractionDigits > -1) { + options["maximumFractionDigits"] = this.maximumFractionDigits; + } + if (this.minimumFractionDigits > -1) { + options["minimumFractionDigits"] = this.minimumFractionDigits; + } + return val.toLocaleString(locale, options); + } + return val.toString(); + }; + return QuestionExpressionModel; + }(_question__WEBPACK_IMPORTED_MODULE_1__["Question"])); + + function getCurrecyCodes() { + return [ + "AED", + "AFN", + "ALL", + "AMD", + "ANG", + "AOA", + "ARS", + "AUD", + "AWG", + "AZN", + "BAM", + "BBD", + "BDT", + "BGN", + "BHD", + "BIF", + "BMD", + "BND", + "BOB", + "BOV", + "BRL", + "BSD", + "BTN", + "BWP", + "BYN", + "BZD", + "CAD", + "CDF", + "CHE", + "CHF", + "CHW", + "CLF", + "CLP", + "CNY", + "COP", + "COU", + "CRC", + "CUC", + "CUP", + "CVE", + "CZK", + "DJF", + "DKK", + "DOP", + "DZD", + "EGP", + "ERN", + "ETB", + "EUR", + "FJD", + "FKP", + "GBP", + "GEL", + "GHS", + "GIP", + "GMD", + "GNF", + "GTQ", + "GYD", + "HKD", + "HNL", + "HRK", + "HTG", + "HUF", + "IDR", + "ILS", + "INR", + "IQD", + "IRR", + "ISK", + "JMD", + "JOD", + "JPY", + "KES", + "KGS", + "KHR", + "KMF", + "KPW", + "KRW", + "KWD", + "KYD", + "KZT", + "LAK", + "LBP", + "LKR", + "LRD", + "LSL", + "LYD", + "MAD", + "MDL", + "MGA", + "MKD", + "MMK", + "MNT", + "MOP", + "MRO", + "MUR", + "MVR", + "MWK", + "MXN", + "MXV", + "MYR", + "MZN", + "NAD", + "NGN", + "NIO", + "NOK", + "NPR", + "NZD", + "OMR", + "PAB", + "PEN", + "PGK", + "PHP", + "PKR", + "PLN", + "PYG", + "QAR", + "RON", + "RSD", + "RUB", + "RWF", + "SAR", + "SBD", + "SCR", + "SDG", + "SEK", + "SGD", + "SHP", + "SLL", + "SOS", + "SRD", + "SSP", + "STD", + "SVC", + "SYP", + "SZL", + "THB", + "TJS", + "TMT", + "TND", + "TOP", + "TRY", + "TTD", + "TWD", + "TZS", + "UAH", + "UGX", + "USD", + "USN", + "UYI", + "UYU", + "UZS", + "VEF", + "VND", + "VUV", + "WST", + "XAF", + "XAG", + "XAU", + "XBA", + "XBB", + "XBC", + "XBD", + "XCD", + "XDR", + "XOF", + "XPD", + "XPF", + "XPT", + "XSU", + "XTS", + "XUA", + "XXX", + "YER", + "ZAR", + "ZMW", + "ZWL", + ]; + } + _jsonobject__WEBPACK_IMPORTED_MODULE_2__["Serializer"].addClass("expression", [ + "expression:expression", + { name: "format", serializationProperty: "locFormat" }, + { + name: "displayStyle", + default: "none", + choices: ["none", "decimal", "currency", "percent", "date"], + }, + { + name: "currency", + choices: function () { + return getCurrecyCodes(); + }, + default: "USD", + }, + { name: "maximumFractionDigits:number", default: -1 }, + { name: "minimumFractionDigits:number", default: -1 }, + { name: "useGrouping:boolean", default: true }, + { name: "enableIf", visible: false }, + { name: "isRequired", visible: false }, + { name: "readOnly", visible: false }, + { name: "requiredErrorText", visible: false }, + { name: "defaultValueExpression", visible: false }, + { name: "defaultValue", visible: false }, + { name: "correctAnswer", visible: false }, + { name: "requiredIf", visible: false }, + ], function () { + return new QuestionExpressionModel(""); + }, "question"); + _questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].Instance.registerQuestion("expression", function (name) { + return new QuestionExpressionModel(name); + }); + + + /***/ }), + + /***/ "./src/question_file.ts": + /*!******************************!*\ + !*** ./src/question_file.ts ***! + \******************************/ + /*! exports provided: QuestionFileModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionFileModel", function() { return QuestionFileModel; }); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./error */ "./src/error.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); + /* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts"); + /* harmony import */ var _actions_action__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./actions/action */ "./src/actions/action.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + + + + + /** + * A Model for a file question + */ + var QuestionFileModel = /** @class */ (function (_super) { + __extends(QuestionFileModel, _super); + function QuestionFileModel(name) { + var _this = _super.call(this, name) || this; + _this.isUploading = false; + _this.isDragging = false; + /** + * The event is fired after question state has been changed. + *
sender the question object that fires the event + *
options.state new question state value. + */ + _this.onStateChanged = _this.addEvent(); + _this.previewValue = []; + _this.mobileFileNavigator = new _actions_container__WEBPACK_IMPORTED_MODULE_7__["ActionContainer"](); + //#region + // web-based methods + _this.onDragOver = function (event) { + if (_this.isInputReadOnly) { + event.returnValue = false; + return false; + } + _this.isDragging = true; + event.dataTransfer.dropEffect = "copy"; + event.preventDefault(); + }; + _this.onDrop = function (event) { + if (!_this.isInputReadOnly) { + _this.isDragging = false; + event.preventDefault(); + var src = event.dataTransfer; + _this.onChange(src); + } + }; + _this.onDragLeave = function (event) { + if (!_this.isInputReadOnly) { + _this.isDragging = false; + } + }; + _this.doChange = function (event) { + var src = event.target || event.srcElement; + _this.onChange(src); + }; + _this.doClean = function (event) { + var src = event.currentTarget || event.srcElement; + if (_this.needConfirmRemoveFile) { + var isConfirmed = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["confirmAction"])(_this.confirmRemoveAllMessage); + if (!isConfirmed) + return; + } + src.parentElement.querySelectorAll("input")[0].value = ""; + _this.clear(); + }; + _this.doDownloadFile = function (event, data) { + if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["detectIEOrEdge"])()) { + event.preventDefault(); + Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["loadFileFromBase64"])(data.content, data.name); + } + }; + _this.fileIndexAction = new _actions_action__WEBPACK_IMPORTED_MODULE_8__["Action"]({ + id: "fileIndex", + title: _this.getFileIndexCaption(), + enabled: false + }); + _this.prevFileAction = new _actions_action__WEBPACK_IMPORTED_MODULE_8__["Action"]({ + id: "prevPage", + iconSize: 16, + action: function () { + _this.indexToShow = _this.previewValue.length && ((_this.indexToShow - 1 + _this.previewValue.length) % _this.previewValue.length) || 0; + _this.fileIndexAction.title = _this.getFileIndexCaption(); + } + }); + _this.nextFileAction = new _actions_action__WEBPACK_IMPORTED_MODULE_8__["Action"]({ + id: "nextPage", + iconSize: 16, + action: function () { + _this.indexToShow = _this.previewValue.length && ((_this.indexToShow + 1) % _this.previewValue.length) || 0; + _this.fileIndexAction.title = _this.getFileIndexCaption(); + } + }); + _this.mobileFileNavigator.actions = [_this.prevFileAction, _this.fileIndexAction, _this.nextFileAction]; + return _this; + } + Object.defineProperty(QuestionFileModel.prototype, "mobileFileNavigatorVisible", { + get: function () { + return this.isMobile && this.containsMultiplyFiles; + }, + enumerable: false, + configurable: true + }); + QuestionFileModel.prototype.updateElementCssCore = function (cssClasses) { + _super.prototype.updateElementCssCore.call(this, cssClasses); + this.prevFileAction.iconName = this.cssClasses.leftIconId; + this.nextFileAction.iconName = this.cssClasses.rightIconId; + //this.mobileFileNavigator.cssClasses = this.survey.getCss().actionBar; + }; + QuestionFileModel.prototype.getFileIndexCaption = function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_4__["surveyLocalization"].getString("indexText")["format"]((this.indexToShow + 1), this.previewValue.length); + }; + QuestionFileModel.prototype.isPreviewVisible = function (index) { + return !this.isMobile || index === this.indexToShow; + }; + QuestionFileModel.prototype.getType = function () { + return "file"; + }; + QuestionFileModel.prototype.clearOnDeletingContainer = function () { + if (!this.survey) + return; + this.survey.clearFiles(this, this.name, this.value, null, function () { }); + }; + Object.defineProperty(QuestionFileModel.prototype, "showPreview", { + /** + * Set it to true, to show the preview for the image files. + */ + get: function () { + return this.getPropertyValue("showPreview"); + }, + set: function (val) { + this.setPropertyValue("showPreview", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionFileModel.prototype, "allowMultiple", { + /** + * Set it to true, to allow select multiple files. + */ + get: function () { + return this.getPropertyValue("allowMultiple", false); + }, + set: function (val) { + this.setPropertyValue("allowMultiple", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionFileModel.prototype, "imageHeight", { + /** + * The image height. + */ + get: function () { + return this.getPropertyValue("imageHeight"); + }, + set: function (val) { + this.setPropertyValue("imageHeight", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionFileModel.prototype, "imageWidth", { + /** + * The image width. + */ + get: function () { + return this.getPropertyValue("imageWidth"); + }, + set: function (val) { + this.setPropertyValue("imageWidth", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionFileModel.prototype, "acceptedTypes", { + /** + * Accepted file types. Passed to the 'accept' attribute of the file input tag. See https://www.w3schools.com/tags/att_input_accept.asp for more details. + */ + get: function () { + return this.getPropertyValue("acceptedTypes"); + }, + set: function (val) { + this.setPropertyValue("acceptedTypes", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionFileModel.prototype, "storeDataAsText", { + /** + * Set it to false if you do not want to serialize file content as text in the survey.data. + * In this case, you have to write the code onUploadFiles event to store the file content. + * @see SurveyModel.onUploadFiles + */ + get: function () { + return this.getPropertyValue("storeDataAsText"); + }, + set: function (val) { + this.setPropertyValue("storeDataAsText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionFileModel.prototype, "waitForUpload", { + /** + * Set it to true if you want to wait until files will be uploaded to your server. + */ + get: function () { + return this.getPropertyValue("waitForUpload"); + }, + set: function (val) { + this.setPropertyValue("waitForUpload", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionFileModel.prototype, "allowImagesPreview", { + /** + * Set it to false if you want to disable images preview. + */ + get: function () { + return this.getPropertyValue("allowImagesPreview"); + }, + set: function (val) { + this.setPropertyValue("allowImagesPreview", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionFileModel.prototype, "maxSize", { + /** + * Use this property to setup the maximum allowed file size. + */ + get: function () { + return this.getPropertyValue("maxSize"); + }, + set: function (val) { + this.setPropertyValue("maxSize", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionFileModel.prototype, "needConfirmRemoveFile", { + /** + * Use this property to setup confirmation to remove file. + */ + get: function () { + return this.getPropertyValue("needConfirmRemoveFile"); + }, + set: function (val) { + this.setPropertyValue("needConfirmRemoveFile", val); + }, + enumerable: false, + configurable: true + }); + /** + * The remove file confirmation message. + */ + QuestionFileModel.prototype.getConfirmRemoveMessage = function (fileName) { + return this.confirmRemoveMessage.format(fileName); + }; + Object.defineProperty(QuestionFileModel.prototype, "inputTitle", { + /** + * The input title value. + */ + get: function () { + if (this.isUploading) + return this.loadingFileTitle; + if (this.isEmpty()) + return this.chooseFileTitle; + return " "; + }, + enumerable: false, + configurable: true + }); + /** + * Clear value programmatically. + */ + QuestionFileModel.prototype.clear = function (doneCallback) { + var _this = this; + if (!this.survey) + return; + this.containsMultiplyFiles = false; + this.survey.clearFiles(this, this.name, this.value, null, function (status, data) { + if (status === "success") { + _this.value = undefined; + _this.errors = []; + !!doneCallback && doneCallback(); + } + }); + }; + /** + * Remove file item programmatically. + */ + QuestionFileModel.prototype.removeFile = function (content) { + var _this = this; + if (!this.survey) + return; + this.survey.clearFiles(this, this.name, this.value, content.name, function (status, data) { + if (status === "success") { + var oldValue = _this.value; + if (Array.isArray(oldValue)) { + _this.value = oldValue.filter(function (f) { return f.name !== content.name; }); + } + else { + _this.value = undefined; + } + } + }); + }; + /** + * Load multiple files programmatically. + * @param files + */ + QuestionFileModel.prototype.loadFiles = function (files) { + var _this = this; + if (!this.survey) { + return; + } + this.errors = []; + if (!this.allFilesOk(files)) { + return; + } + this.stateChanged("loading"); + var loadFilesProc = function () { + var content = []; + if (_this.storeDataAsText) { + files.forEach(function (file) { + var fileReader = new FileReader(); + fileReader.onload = function (e) { + content = content.concat([ + { name: file.name, type: file.type, content: fileReader.result }, + ]); + if (content.length === files.length) { + _this.value = (_this.value || []).concat(content); + } + }; + fileReader.readAsDataURL(file); + }); + } + else { + if (_this.survey) { + _this.survey.uploadFiles(_this, _this.name, files, function (status, data) { + if (status === "error") { + _this.stateChanged("error"); + } + if (status === "success") { + _this.value = (_this.value || []).concat(data.map(function (r) { + return { + name: r.file.name, + type: r.file.type, + content: r.content, + }; + })); + } + }); + } + } + }; + if (this.allowMultiple) { + loadFilesProc(); + } + else { + this.clear(loadFilesProc); + } + }; + QuestionFileModel.prototype.canPreviewImage = function (fileItem) { + return this.allowImagesPreview && !!fileItem && this.isFileImage(fileItem); + }; + QuestionFileModel.prototype.setQuestionValue = function (newValue, updateIsAnswered) { + var _this = this; + if (updateIsAnswered === void 0) { updateIsAnswered = true; } + _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); + this.previewValue = []; + var state = (!Array.isArray(newValue) && !!newValue) || + (Array.isArray(newValue) && newValue.length > 0) + ? this.showPreview + ? "loading" + : "loaded" + : "empty"; + this.stateChanged(state); + if (!this.showPreview || !newValue) + return; + var newValues = Array.isArray(newValue) + ? newValue + : !!newValue + ? [newValue] + : []; + if (this.storeDataAsText) { + newValues.forEach(function (value) { + var content = value.content || value; + _this.previewValue = _this.previewValue.concat([ + { + name: value.name, + type: value.type, + content: content, + }, + ]); + }); + if (state === "loading") + this.stateChanged("loaded"); + } + else { + newValues.forEach(function (value) { + value.content || value; + if (_this.survey) { + _this.survey.downloadFile(_this.name, value, function (status, data) { + if (status === "success") { + _this.previewValue = _this.previewValue.concat([ + { + content: data, + name: value.name, + type: value.type, + }, + ]); + if (_this.previewValue.length === newValues.length) { + _this.stateChanged("loaded"); + } + } + else { + _this.stateChanged("error"); + } + }); + } + }); + } + this.fileIndexAction.title = this.getFileIndexCaption(); + this.containsMultiplyFiles = this.previewValue.length > 1; + }; + QuestionFileModel.prototype.onCheckForErrors = function (errors, isOnValueChanged) { + _super.prototype.onCheckForErrors.call(this, errors, isOnValueChanged); + if (this.isUploading && this.waitForUpload) { + errors.push(new _error__WEBPACK_IMPORTED_MODULE_3__["UploadingFileError"](_surveyStrings__WEBPACK_IMPORTED_MODULE_4__["surveyLocalization"].getString("uploadingFile"), this)); + } + }; + QuestionFileModel.prototype.stateChanged = function (state) { + if (state === "loading") { + this.isUploading = true; + } + if (state === "loaded") { + this.isUploading = false; + } + if (state === "error") { + this.isUploading = false; + } + this.currentState = state; + this.onStateChanged.fire(this, { state: state }); + }; + QuestionFileModel.prototype.allFilesOk = function (files) { + var _this = this; + var errorLength = this.errors ? this.errors.length : 0; + (files || []).forEach(function (file) { + if (_this.maxSize > 0 && file.size > _this.maxSize) { + _this.errors.push(new _error__WEBPACK_IMPORTED_MODULE_3__["ExceedSizeError"](_this.maxSize, _this)); + } + }); + return errorLength === this.errors.length; + }; + QuestionFileModel.prototype.isFileImage = function (file) { + if (!file) + return false; + var imagePrefix = "data:image"; + var subStr = file.content && file.content.substr(0, imagePrefix.length); + subStr = subStr && subStr.toLowerCase(); + var result = subStr === imagePrefix || + (!!file.type && file.type.toLowerCase().indexOf("image/") === 0); + return result; + }; + QuestionFileModel.prototype.getPlainData = function (options) { + if (options === void 0) { options = { + includeEmpty: true, + }; } + var questionPlainData = _super.prototype.getPlainData.call(this, options); + if (!!questionPlainData && !this.isEmpty()) { + questionPlainData.isNode = false; + var values = Array.isArray(this.value) ? this.value : [this.value]; + questionPlainData.data = values.map(function (dataValue, index) { + return { + name: index, + title: "File", + value: (dataValue.content && dataValue.content) || dataValue, + displayValue: (dataValue.name && dataValue.name) || dataValue, + getString: function (val) { + return typeof val === "object" ? JSON.stringify(val) : val; + }, + isNode: false, + }; + }); + } + return questionPlainData; + }; + QuestionFileModel.prototype.supportComment = function () { + return true; + }; + QuestionFileModel.prototype.getChooseFileCss = function () { + var isAnswered = this.isAnswered; + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() + .append(this.cssClasses.chooseFile) + .append(this.cssClasses.controlDisabled, this.isReadOnly) + .append(this.cssClasses.chooseFileAsText, !isAnswered) + .append(this.cssClasses.chooseFileAsTextDisabled, !isAnswered && this.isInputReadOnly) + .append(this.cssClasses.chooseFileAsIcon, isAnswered) + .toString(); + }; + QuestionFileModel.prototype.getReadOnlyFileCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() + .append("form-control") + .append(this.cssClasses.placeholderInput) + .toString(); + }; + Object.defineProperty(QuestionFileModel.prototype, "fileRootCss", { + get: function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() + .append(this.cssClasses.root) + .append(this.cssClasses.single, !this.allowMultiple) + .append(this.cssClasses.singleImage, !this.allowMultiple && this.isAnswered && this.canPreviewImage(this.value[0])) + .append(this.cssClasses.mobile, this.isMobile) + .toString(); + }, + enumerable: false, + configurable: true + }); + QuestionFileModel.prototype.getFileDecoratorCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() + .append(this.cssClasses.fileDecorator) + .append(this.cssClasses.onError, this.errors.length > 0) + .append(this.cssClasses.fileDecoratorDrag, this.isDragging) + .toString(); + }; + QuestionFileModel.prototype.onChange = function (src) { + if (!window["FileReader"]) + return; + if (!src || !src.files || src.files.length < 1) + return; + var files = []; + var allowCount = this.allowMultiple ? src.files.length : 1; + for (var i = 0; i < allowCount; i++) { + files.push(src.files[i]); + } + src.value = ""; + this.loadFiles(files); + }; + QuestionFileModel.prototype.doRemoveFile = function (data) { + if (this.needConfirmRemoveFile) { + var isConfirmed = Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["confirmAction"])(this.getConfirmRemoveMessage(data.name)); + if (!isConfirmed) + return; + } + this.removeFile(data); + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() + ], QuestionFileModel.prototype, "isDragging", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: "empty" }) + ], QuestionFileModel.prototype, "currentState", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: 0 }) + ], QuestionFileModel.prototype, "indexToShow", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: false }) + ], QuestionFileModel.prototype, "containsMultiplyFiles", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "confirmRemoveFile" } }) + ], QuestionFileModel.prototype, "confirmRemoveMessage", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "confirmRemoveAllFiles" } }) + ], QuestionFileModel.prototype, "confirmRemoveAllMessage", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "noFileChosen" } }) + ], QuestionFileModel.prototype, "noFileChosenCaption", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "chooseFileCaption" } }) + ], QuestionFileModel.prototype, "chooseButtonCaption", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "cleanCaption" } }) + ], QuestionFileModel.prototype, "cleanButtonCaption", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "removeFileCaption" } }) + ], QuestionFileModel.prototype, "removeFileCaption", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "loadingFile" } }) + ], QuestionFileModel.prototype, "loadingFileTitle", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "chooseFile" } }) + ], QuestionFileModel.prototype, "chooseFileTitle", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: { defaultStr: "fileDragAreaPlaceholder" } }) + ], QuestionFileModel.prototype, "dragAreaPlaceholder", void 0); + return QuestionFileModel; + }(_question__WEBPACK_IMPORTED_MODULE_0__["Question"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("file", [ + { name: "hasComment:switch", layout: "row" }, + { + name: "commentText", + dependsOn: "hasComment", + visibleIf: function (obj) { + return obj.hasComment; + }, + serializationProperty: "locCommentText", + layout: "row", + }, + { + name: "commentPlaceHolder", + serializationProperty: "locCommentPlaceHolder", + dependsOn: "hasComment", + visibleIf: function (obj) { + return obj.hasComment; + }, + }, + { name: "showPreview:boolean", default: true }, + "allowMultiple:boolean", + { name: "allowImagesPreview:boolean", default: true }, + "imageHeight", + "imageWidth", + "acceptedTypes", + { name: "storeDataAsText:boolean", default: true }, + { name: "waitForUpload:boolean", default: false }, + { name: "maxSize:number", default: 0 }, + { name: "defaultValue", visible: false }, + { name: "correctAnswer", visible: false }, + { name: "validators", visible: false }, + { name: "needConfirmRemoveFile:boolean" }, + ], function () { + return new QuestionFileModel(""); + }, "question"); + _questionfactory__WEBPACK_IMPORTED_MODULE_2__["QuestionFactory"].Instance.registerQuestion("file", function (name) { + return new QuestionFileModel(name); + }); + + + /***/ }), + + /***/ "./src/question_html.ts": + /*!******************************!*\ + !*** ./src/question_html.ts ***! + \******************************/ + /*! exports provided: QuestionHtmlModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionHtmlModel", function() { return QuestionHtmlModel; }); + /* harmony import */ var _questionnonvalue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./questionnonvalue */ "./src/questionnonvalue.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + /** + * A Model for html question. Unlike other questions it doesn't have value and title. + */ + var QuestionHtmlModel = /** @class */ (function (_super) { + __extends(QuestionHtmlModel, _super); + function QuestionHtmlModel(name) { + var _this = _super.call(this, name) || this; + var locHtml = _this.createLocalizableString("html", _this); + locHtml.onGetTextCallback = function (str) { + return !!_this.survey && !_this.ignoreHtmlProgressing + ? _this.survey.processHtml(str) + : str; + }; + return _this; + } + QuestionHtmlModel.prototype.getType = function () { + return "html"; + }; + Object.defineProperty(QuestionHtmlModel.prototype, "isCompositeQuestion", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + QuestionHtmlModel.prototype.getProcessedText = function (text) { + if (this.ignoreHtmlProgressing) + return text; + return _super.prototype.getProcessedText.call(this, text); + }; + Object.defineProperty(QuestionHtmlModel.prototype, "html", { + /** + * Set html to display it + */ + get: function () { + return this.getLocalizableStringText("html", ""); + }, + set: function (val) { + this.setLocalizableStringText("html", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionHtmlModel.prototype, "locHtml", { + get: function () { + return this.getLocalizableString("html"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionHtmlModel.prototype, "processedHtml", { + get: function () { + return this.survey ? this.survey.processHtml(this.html) : this.html; + }, + enumerable: false, + configurable: true + }); + return QuestionHtmlModel; + }(_questionnonvalue__WEBPACK_IMPORTED_MODULE_0__["QuestionNonValue"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("html", [{ name: "html:html", serializationProperty: "locHtml" }], function () { + return new QuestionHtmlModel(""); + }, "nonvalue"); + _questionfactory__WEBPACK_IMPORTED_MODULE_2__["QuestionFactory"].Instance.registerQuestion("html", function (name) { + return new QuestionHtmlModel(name); + }); + + + /***/ }), + + /***/ "./src/question_image.ts": + /*!*******************************!*\ + !*** ./src/question_image.ts ***! + \*******************************/ + /*! exports provided: QuestionImageModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionImageModel", function() { return QuestionImageModel; }); + /* harmony import */ var _questionnonvalue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./questionnonvalue */ "./src/questionnonvalue.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + var youtubeTags = ["youtube.com", "youtu.be"]; + var videoSuffics = [".mp4", ".mov", ".wmv", ".flv", ".avi", ".mkv"]; + /** + * A Model for image question. This question hasn't any functionality and can be used to improve the appearance of the survey. + */ + var QuestionImageModel = /** @class */ (function (_super) { + __extends(QuestionImageModel, _super); + function QuestionImageModel(name) { + var _this = _super.call(this, name) || this; + _this.createLocalizableString("imageLink", _this, false); + _this.createLocalizableString("text", _this, false); + _this.registerFunctionOnPropertiesValueChanged(["contentMode", "imageLink"], function () { return _this.calculateRenderedMode(); }); + return _this; + } + QuestionImageModel.prototype.getType = function () { + return "image"; + }; + Object.defineProperty(QuestionImageModel.prototype, "isCompositeQuestion", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + QuestionImageModel.prototype.onSurveyLoad = function () { + _super.prototype.onSurveyLoad.call(this); + this.calculateRenderedMode(); + }; + Object.defineProperty(QuestionImageModel.prototype, "imageLink", { + /** + * The image URL. + */ + get: function () { + return this.getLocalizableStringText("imageLink"); + }, + set: function (val) { + this.setLocalizableStringText("imageLink", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImageModel.prototype, "locImageLink", { + get: function () { + return this.getLocalizableString("imageLink"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImageModel.prototype, "text", { + /** + * The image alt text. + */ + get: function () { + return this.getLocalizableStringText("text"); + }, + set: function (val) { + this.setLocalizableStringText("text", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImageModel.prototype, "locText", { + get: function () { + return this.getLocalizableString("text"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImageModel.prototype, "imageHeight", { + /** + * The image height. + */ + get: function () { + return this.getPropertyValue("imageHeight"); + }, + set: function (val) { + this.setPropertyValue("imageHeight", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImageModel.prototype, "renderedHeight", { + get: function () { + return this.imageHeight ? this.imageHeight + "px" : undefined; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImageModel.prototype, "imageWidth", { + /** + * The image width. + */ + get: function () { + return this.getPropertyValue("imageWidth"); + }, + set: function (val) { + this.setPropertyValue("imageWidth", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImageModel.prototype, "renderedWidth", { + get: function () { + return this.imageWidth ? this.imageWidth + "px" : undefined; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImageModel.prototype, "imageFit", { + /** + * The image fit mode. + */ + get: function () { + return this.getPropertyValue("imageFit"); + }, + set: function (val) { + this.setPropertyValue("imageFit", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImageModel.prototype, "contentMode", { + /** + * The content mode. + */ + get: function () { + return this.getPropertyValue("contentMode"); + }, + set: function (val) { + this.setPropertyValue("contentMode", val); + if (val === "video") { + this.showLabel = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImageModel.prototype, "renderedMode", { + /** + * The rendered mode. + */ + get: function () { + return this.getPropertyValue("renderedMode", "image"); + }, + enumerable: false, + configurable: true + }); + QuestionImageModel.prototype.getImageCss = function () { + var imageHeightProperty = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].findProperty("image", "imageHeight"); + var imageWidthProperty = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].findProperty("image", "imageWidth"); + var isDefaultSize = imageHeightProperty.isDefaultValue(this.imageHeight) && imageWidthProperty.isDefaultValue(this.imageWidth); + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__["CssClassBuilder"]() + .append(this.cssClasses.image) + .append(this.cssClasses.adaptive, isDefaultSize) + .toString(); + }; + QuestionImageModel.prototype.setRenderedMode = function (val) { + this.setPropertyValue("renderedMode", val); + }; + QuestionImageModel.prototype.calculateRenderedMode = function () { + if (this.contentMode !== "auto") { + this.setRenderedMode(this.contentMode); + } + else { + if (this.isYoutubeVideo()) { + this.setRenderedMode("youtube"); + } + else if (this.isVideo()) { + this.setRenderedMode("video"); + } + else { + this.setRenderedMode("image"); + } + } + }; + QuestionImageModel.prototype.isYoutubeVideo = function () { + var link = this.imageLink; + if (!link) + return false; + link = link.toLowerCase(); + for (var i = 0; i < youtubeTags.length; i++) { + if (link.indexOf(youtubeTags[i]) !== -1) + return true; + } + return false; + }; + QuestionImageModel.prototype.isVideo = function () { + var link = this.imageLink; + if (!link) + return false; + link = link.toLowerCase(); + for (var i = 0; i < videoSuffics.length; i++) { + if (link.endsWith(videoSuffics[i])) + return true; + } + return false; + }; + return QuestionImageModel; + }(_questionnonvalue__WEBPACK_IMPORTED_MODULE_0__["QuestionNonValue"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("image", [ + { name: "imageLink", serializationProperty: "locImageLink" }, + { name: "text", serializationProperty: "locText" }, + { + name: "contentMode", + default: "auto", + choices: ["auto", "image", "video", "youtube"], + }, + { + name: "imageFit", + default: "contain", + choices: ["none", "contain", "cover", "fill"], + }, + { name: "imageHeight:number", default: 150, minValue: 0 }, + { name: "imageWidth:number", default: 200, minValue: 0 }, + ], function () { + return new QuestionImageModel(""); + }, "nonvalue"); + _questionfactory__WEBPACK_IMPORTED_MODULE_2__["QuestionFactory"].Instance.registerQuestion("image", function (name) { + return new QuestionImageModel(name); + }); + + + /***/ }), + + /***/ "./src/question_imagepicker.ts": + /*!*************************************!*\ + !*** ./src/question_imagepicker.ts ***! + \*************************************/ + /*! exports provided: ImageItemValue, QuestionImagePickerModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ImageItemValue", function() { return ImageItemValue; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionImagePickerModel", function() { return QuestionImagePickerModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _question_baseselect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_baseselect */ "./src/question_baseselect.ts"); + /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + + + + var ImageItemValue = /** @class */ (function (_super) { + __extends(ImageItemValue, _super); + function ImageItemValue(value, text, typeName) { + if (text === void 0) { text = null; } + if (typeName === void 0) { typeName = "imageitemvalue"; } + var _this = _super.call(this, value, text, typeName) || this; + _this.typeName = typeName; + _this.createLocalizableString("imageLink", _this, false); + return _this; + } + ImageItemValue.prototype.getType = function () { + return !!this.typeName ? this.typeName : "itemvalue"; + }; + Object.defineProperty(ImageItemValue.prototype, "imageLink", { + /** + * The image or video link property. + */ + get: function () { + return this.getLocalizableStringText("imageLink"); + }, + set: function (val) { + this.setLocalizableStringText("imageLink", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ImageItemValue.prototype, "locImageLink", { + get: function () { + return this.getLocalizableString("imageLink"); + }, + enumerable: false, + configurable: true + }); + ImageItemValue.prototype.getLocale = function () { + return !!this.locOwner ? this.locOwner.getLocale() : ""; + }; + ImageItemValue.prototype.getMarkdownHtml = function (text, name) { + return !!this.locOwner ? this.locOwner.getMarkdownHtml(text, name) : text; + }; + ImageItemValue.prototype.getRenderer = function (name) { + return !!this.locOwner ? this.locOwner.getRenderer(name) : null; + }; + ImageItemValue.prototype.getRendererContext = function (locStr) { + return !!this.locOwner ? this.locOwner.getRendererContext(locStr) : locStr; + }; + ImageItemValue.prototype.getProcessedText = function (text) { + return !!this.locOwner ? this.locOwner.getProcessedText(text) : text; + }; + return ImageItemValue; + }(_itemvalue__WEBPACK_IMPORTED_MODULE_3__["ItemValue"])); + + /** + * A Model for a select image question. + */ + var QuestionImagePickerModel = /** @class */ (function (_super) { + __extends(QuestionImagePickerModel, _super); + function QuestionImagePickerModel(name) { + var _this = _super.call(this, name) || this; + //responsive mode + _this.isResponsiveValue = false; + _this.onContentLoaded = function (item, event) { + var content = event.target; + if (_this.contentMode == "video") { + item["aspectRatio"] = content.videoWidth / content.videoHeight; + } + else { + item["aspectRatio"] = content.naturalWidth / content.naturalHeight; + } + _this._width && _this.processResponsiveness(0, _this._width); + }; + _this.colCount = 0; + _this.registerFunctionOnPropertiesValueChanged(["minImageWidth", "maxImageWidth", "minImageHeight", "maxImageHeight", "visibleChoices", "colCount", "isResponsiveValue"], function () { + if (!!_this._width) { + _this.processResponsiveness(0, _this._width); + } + }); + _this.registerFunctionOnPropertiesValueChanged(["imageWidth", "imageHeight"], function () { + _this.calcIsResponsive(); + }); + _this.calcIsResponsive(); + return _this; + } + QuestionImagePickerModel.prototype.getType = function () { + return "imagepicker"; + }; + QuestionImagePickerModel.prototype.supportGoNextPageAutomatic = function () { + return !this.multiSelect; + }; + Object.defineProperty(QuestionImagePickerModel.prototype, "hasSingleInput", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + QuestionImagePickerModel.prototype.getItemValueType = function () { + return "imageitemvalue"; + }; + Object.defineProperty(QuestionImagePickerModel.prototype, "isCompositeQuestion", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + QuestionImagePickerModel.prototype.supportOther = function () { + return false; + }; + QuestionImagePickerModel.prototype.supportNone = function () { + return false; + }; + QuestionImagePickerModel.prototype.isAnswerCorrect = function () { + if (!this.multiSelect) + return _super.prototype.isAnswerCorrect.call(this); + return _helpers__WEBPACK_IMPORTED_MODULE_4__["Helpers"].isArrayContainsEqual(this.value, this.correctAnswer); + }; + Object.defineProperty(QuestionImagePickerModel.prototype, "multiSelect", { + /** + * Multi select option. If set to true, then allows to select multiple images. + */ + get: function () { + return this.getPropertyValue("multiSelect"); + }, + set: function (newValue) { + this.setPropertyValue("multiSelect", newValue); + }, + enumerable: false, + configurable: true + }); + /** + * Returns true if item is checked + * @param item image picker item value + */ + QuestionImagePickerModel.prototype.isItemSelected = function (item) { + var val = this.value; + if (this.isValueEmpty(val)) + return false; + if (!this.multiSelect) + return this.isTwoValueEquals(val, item.value); + if (!Array.isArray(val)) + return false; + for (var i = 0; i < val.length; i++) { + if (this.isTwoValueEquals(val[i], item.value)) + return true; + } + return false; + }; + QuestionImagePickerModel.prototype.clearIncorrectValues = function () { + if (this.multiSelect) { + var val = this.value; + if (!val) + return; + if (!Array.isArray(val) || val.length == 0) { + this.clearValue(); + return; + } + var newValue = []; + for (var i = 0; i < val.length; i++) { + if (!this.hasUnknownValue(val[i], true)) { + newValue.push(val[i]); + } + } + if (newValue.length == val.length) + return; + if (newValue.length == 0) { + this.clearValue(); + } + else { + this.value = newValue; + } + } + else { + _super.prototype.clearIncorrectValues.call(this); + } + }; + Object.defineProperty(QuestionImagePickerModel.prototype, "showLabel", { + /** + * Show label under the image. + */ + get: function () { + return this.getPropertyValue("showLabel"); + }, + set: function (newValue) { + this.setPropertyValue("showLabel", newValue); + }, + enumerable: false, + configurable: true + }); + QuestionImagePickerModel.prototype.endLoadingFromJson = function () { + _super.prototype.endLoadingFromJson.call(this); + if (!this.isDesignMode && this.multiSelect) { + this.createNewArray("renderedValue"); + this.createNewArray("value"); + } + this.calcIsResponsive(); + }; + QuestionImagePickerModel.prototype.getValueCore = function () { + var value = _super.prototype.getValueCore.call(this); + if (value !== undefined) { + return value; + } + if (this.multiSelect) { + return []; + } + return value; + }; + QuestionImagePickerModel.prototype.convertValToArrayForMultSelect = function (val) { + if (!this.multiSelect) + return val; + if (this.isValueEmpty(val) || Array.isArray(val)) + return val; + return [val]; + }; + QuestionImagePickerModel.prototype.renderedValueFromDataCore = function (val) { + return this.convertValToArrayForMultSelect(val); + }; + QuestionImagePickerModel.prototype.rendredValueToDataCore = function (val) { + return this.convertValToArrayForMultSelect(val); + }; + Object.defineProperty(QuestionImagePickerModel.prototype, "imageHeight", { + /** + * The image height. + */ + get: function () { + return this.getPropertyValue("imageHeight"); + }, + set: function (val) { + this.setPropertyValue("imageHeight", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImagePickerModel.prototype, "renderedImageHeight", { + get: function () { + var height = this.isResponsive ? this.responsiveImageHeight : this.imageHeight; + return (height ? height : 150) + "px"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImagePickerModel.prototype, "imageWidth", { + /** + * The image width. + */ + get: function () { + return this.getPropertyValue("imageWidth"); + }, + set: function (val) { + this.setPropertyValue("imageWidth", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImagePickerModel.prototype, "renderedImageWidth", { + get: function () { + var width = this.isResponsive ? this.responsiveImageWidth : this.imageWidth; + return (width ? width : 200) + "px"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImagePickerModel.prototype, "imageFit", { + /** + * The image fit mode. + */ + get: function () { + return this.getPropertyValue("imageFit"); + }, + set: function (val) { + this.setPropertyValue("imageFit", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImagePickerModel.prototype, "contentMode", { + /** + * The content mode. + */ + get: function () { + return this.getPropertyValue("contentMode"); + }, + set: function (val) { + this.setPropertyValue("contentMode", val); + if (val === "video") { + this.showLabel = true; + } + }, + enumerable: false, + configurable: true + }); + QuestionImagePickerModel.prototype.convertDefaultValue = function (val) { + return val; + }; + Object.defineProperty(QuestionImagePickerModel.prototype, "inputType", { + get: function () { + return this.multiSelect ? "checkbox" : "radio"; + }, + enumerable: false, + configurable: true + }); + QuestionImagePickerModel.prototype.isFootChoice = function (_item, _question) { + return false; + }; + QuestionImagePickerModel.prototype.getSelectBaseRootCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]().append(_super.prototype.getSelectBaseRootCss.call(this)).append(this.cssClasses.rootColumn, this.getCurrentColCount() == 1).toString(); + }; + Object.defineProperty(QuestionImagePickerModel.prototype, "isResponsive", { + get: function () { + return this.isResponsiveValue && this.isDefaultV2Theme; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionImagePickerModel.prototype, "exactSizesAreEmpty", { + get: function () { + var _this = this; + return !(["imageHeight", "imageWidth"].some(function (propName) { return _this[propName] !== undefined && _this[propName] !== null; })); + }, + enumerable: false, + configurable: true + }); + QuestionImagePickerModel.prototype.calcIsResponsive = function () { + this.isResponsiveValue = this.exactSizesAreEmpty; + }; + QuestionImagePickerModel.prototype.getObservedElementSelector = function () { + return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_7__["classesToSelector"])(this.cssClasses.root); + }; + QuestionImagePickerModel.prototype.supportResponsiveness = function () { + return true; + }; + QuestionImagePickerModel.prototype.needResponsiveness = function () { + return this.supportResponsiveness() && this.isDefaultV2Theme; + }; + QuestionImagePickerModel.prototype.getCurrentColCount = function () { + if (this.responsiveColCount === undefined || this.colCount === 0) { + return this.colCount; + } + return this.responsiveColCount; + }; + QuestionImagePickerModel.prototype.processResponsiveness = function (_, availableWidth) { + this._width = availableWidth = Math.floor(availableWidth); + var calcAvailableColumnsCount = function (availableWidth, minWidth, gap) { + var itemsInRow = Math.floor(availableWidth / (minWidth + gap)); + if ((itemsInRow + 1) * (minWidth + gap) - gap <= availableWidth) + itemsInRow++; + return itemsInRow; + }; + if (this.isResponsive) { + var itemsCount = this.choices.length + (this.isDesignMode ? 1 : 0); + var gap = this.gapBetweenItems || 0; + var minWidth = this.minImageWidth; + var maxWidth = this.maxImageWidth; + var maxHeight = this.maxImageHeight; + var minHeight = this.minImageHeight; + var colCount = this.colCount; + var width_1; + if (colCount === 0) { + if ((gap + minWidth) * itemsCount - gap > availableWidth) { + var itemsInRow = calcAvailableColumnsCount(availableWidth, minWidth, gap); + width_1 = Math.floor((availableWidth - gap * (itemsInRow - 1)) / itemsInRow); + } + else { + width_1 = Math.floor(((availableWidth - gap * (itemsCount - 1)) / itemsCount)); + } + } + else { + var availableColumnsCount = calcAvailableColumnsCount(availableWidth, minWidth, gap); + if (availableColumnsCount < colCount) { + this.responsiveColCount = availableColumnsCount >= 1 ? availableColumnsCount : 1; + colCount = this.responsiveColCount; + } + else { + this.responsiveColCount = colCount; + } + width_1 = Math.floor((availableWidth - gap * (colCount - 1)) / colCount); + } + width_1 = Math.max(minWidth, Math.min(width_1, maxWidth)); + var height_1 = Number.MIN_VALUE; + this.choices.forEach(function (item) { + var tempHeight = width_1 / item["aspectRatio"]; + height_1 = tempHeight > height_1 ? tempHeight : height_1; + }); + if (height_1 > maxHeight) { + height_1 = maxHeight; + } + else if (height_1 < minHeight) { + height_1 = minHeight; + } + var oldResponsiveImageWidth = this.responsiveImageWidth; + var oldResponsiveImageHeight = this.responsiveImageHeight; + this.responsiveImageWidth = width_1; + this.responsiveImageHeight = height_1; + return oldResponsiveImageWidth !== this.responsiveImageWidth || oldResponsiveImageHeight !== this.responsiveImageHeight; + } + return false; + }; + QuestionImagePickerModel.prototype.afterRender = function (el) { + _super.prototype.afterRender.call(this, el); + var variables = this.survey.getCss().variables; + if (!!variables) { + this.gapBetweenItems = Number.parseInt(window.getComputedStyle(el).getPropertyValue(variables.imagepickerGapBetweenItems)) || 0; + } + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({}) + ], QuestionImagePickerModel.prototype, "responsiveImageHeight", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({}) + ], QuestionImagePickerModel.prototype, "responsiveImageWidth", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({}) + ], QuestionImagePickerModel.prototype, "isResponsiveValue", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({}) + ], QuestionImagePickerModel.prototype, "maxImageWidth", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({}) + ], QuestionImagePickerModel.prototype, "minImageWidth", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({}) + ], QuestionImagePickerModel.prototype, "maxImageHeight", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({}) + ], QuestionImagePickerModel.prototype, "minImageHeight", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({}) + ], QuestionImagePickerModel.prototype, "responsiveColCount", void 0); + return QuestionImagePickerModel; + }(_question_baseselect__WEBPACK_IMPORTED_MODULE_2__["QuestionCheckboxBase"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("imageitemvalue", [], function (value) { return new ImageItemValue(value); }, "itemvalue"); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addProperty("imageitemvalue", { + name: "imageLink", + serializationProperty: "locImageLink", + }); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("responsiveImageSize", [], undefined, "number"); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("imagepicker", [ + { name: "hasOther", visible: false }, + { name: "otherText", visible: false }, + { name: "hasNone", visible: false }, + { name: "noneText", visible: false }, + { name: "optionsCaption", visible: false }, + { name: "otherErrorText", visible: false }, + { name: "storeOthersAsComment", visible: false }, + { + name: "contentMode", + default: "image", + choices: ["image", "video"], + }, + { + name: "imageFit", + default: "contain", + choices: ["none", "contain", "cover", "fill"], + }, + { name: "imageHeight:number", minValue: 0 }, + { name: "imageWidth:number", minValue: 0 }, + { name: "minImageWidth:responsiveImageSize", default: 200, minValue: 0, visibleIf: function () { return _settings__WEBPACK_IMPORTED_MODULE_6__["settings"].supportCreatorV2; } }, + { name: "minImageHeight:responsiveImageSize", default: 133, minValue: 0, visibleIf: function () { return _settings__WEBPACK_IMPORTED_MODULE_6__["settings"].supportCreatorV2; } }, + { name: "maxImageWidth:responsiveImageSize", default: 400, minValue: 0, visibleIf: function () { return _settings__WEBPACK_IMPORTED_MODULE_6__["settings"].supportCreatorV2; } }, + { name: "maxImageHeight:responsiveImageSize", default: 266, minValue: 0, visibleIf: function () { return _settings__WEBPACK_IMPORTED_MODULE_6__["settings"].supportCreatorV2; } }, + ], function () { + return new QuestionImagePickerModel(""); + }, "checkboxbase"); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addProperty("imagepicker", { + name: "showLabel:boolean", + default: false, + }); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addProperty("imagepicker", { + name: "colCount:number", + default: 0, + choices: [0, 1, 2, 3, 4, 5], + }); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addProperty("imagepicker", { + name: "multiSelect:boolean", + default: false, + }); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addProperty("imagepicker", { + name: "choices:imageitemvalue[]", + }); + _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("imagepicker", function (name) { + var q = new QuestionImagePickerModel(name); + //q.choices = QuestionFactory.DefaultChoices; + return q; + }); + + + /***/ }), + + /***/ "./src/question_matrix.ts": + /*!********************************!*\ + !*** ./src/question_matrix.ts ***! + \********************************/ + /*! exports provided: MatrixRowModel, MatrixCells, QuestionMatrixModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixRowModel", function() { return MatrixRowModel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixCells", function() { return MatrixCells; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixModel", function() { return QuestionMatrixModel; }); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); + /* harmony import */ var _martixBase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./martixBase */ "./src/martixBase.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./error */ "./src/error.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts"); + /* harmony import */ var _question_dropdown__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./question_dropdown */ "./src/question_dropdown.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + + + + + + + var MatrixRowModel = /** @class */ (function (_super) { + __extends(MatrixRowModel, _super); + function MatrixRowModel(item, fullName, data, value) { + var _this = _super.call(this) || this; + _this.fullName = fullName; + _this.item = item; + _this.data = data; + _this.value = value; + _this.cellClick = function (column) { + _this.value = column.value; + }; + _this.registerFunctionOnPropertyValueChanged("value", function () { + if (_this.data) + _this.data.onMatrixRowChanged(_this); + }); + return _this; + } + Object.defineProperty(MatrixRowModel.prototype, "name", { + get: function () { + return this.item.value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixRowModel.prototype, "text", { + get: function () { + return this.item.text; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixRowModel.prototype, "locText", { + get: function () { + return this.item.locText; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixRowModel.prototype, "value", { + get: function () { + return this.getPropertyValue("value"); + }, + set: function (newValue) { + newValue = this.data.getCorrectedRowValue(newValue); + this.setPropertyValue("value", newValue); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixRowModel.prototype, "rowClasses", { + get: function () { + var cssClasses = this.data.cssClasses; + var hasError = !!this.data.getErrorByType("requiredinallrowserror"); + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(cssClasses.row) + .append(cssClasses.rowError, hasError && this.isValueEmpty(this.value)) + .toString(); + }, + enumerable: false, + configurable: true + }); + return MatrixRowModel; + }(_base__WEBPACK_IMPORTED_MODULE_4__["Base"])); + + var MatrixCells = /** @class */ (function () { + function MatrixCells(cellsOwner) { + this.cellsOwner = cellsOwner; + this.values = {}; + } + Object.defineProperty(MatrixCells.prototype, "isEmpty", { + get: function () { + return Object.keys(this.values).length == 0; + }, + enumerable: false, + configurable: true + }); + MatrixCells.prototype.valuesChanged = function () { + if (!!this.onValuesChanged) { + this.onValuesChanged(); + } + }; + MatrixCells.prototype.setCellText = function (row, column, val) { + row = this.getCellRowColumnValue(row, this.rows); + column = this.getCellRowColumnValue(column, this.columns); + if (!row || !column) + return; + if (val) { + if (!this.values[row]) + this.values[row] = {}; + if (!this.values[row][column]) + this.values[row][column] = this.createString(); + this.values[row][column].text = val; + } + else { + if (this.values[row] && this.values[row][column]) { + var loc = this.values[row][column]; + loc.text = ""; + if (loc.isEmpty) { + delete this.values[row][column]; + if (Object.keys(this.values[row]).length == 0) { + delete this.values[row]; + } + } + } + } + this.valuesChanged(); + }; + MatrixCells.prototype.setDefaultCellText = function (column, val) { + this.setCellText(_settings__WEBPACK_IMPORTED_MODULE_10__["settings"].matrixDefaultRowName, column, val); + }; + MatrixCells.prototype.getCellLocText = function (row, column) { + row = this.getCellRowColumnValue(row, this.rows); + column = this.getCellRowColumnValue(column, this.columns); + if (!row || !column) + return null; + if (!this.values[row]) + return null; + if (!this.values[row][column]) + return null; + return this.values[row][column]; + }; + MatrixCells.prototype.getDefaultCellLocText = function (column, val) { + return this.getCellLocText(_settings__WEBPACK_IMPORTED_MODULE_10__["settings"].matrixDefaultRowName, column); + }; + MatrixCells.prototype.getCellDisplayLocText = function (row, column) { + var cellText = this.getCellLocText(row, column); + if (cellText && !cellText.isEmpty) + return cellText; + cellText = this.getCellLocText(_settings__WEBPACK_IMPORTED_MODULE_10__["settings"].matrixDefaultRowName, column); + if (cellText && !cellText.isEmpty) + return cellText; + if (typeof column == "number") { + column = + column >= 0 && column < this.columns.length + ? this.columns[column] + : null; + } + if (column && column.locText) + return column.locText; + return null; + }; + MatrixCells.prototype.getCellText = function (row, column) { + var loc = this.getCellLocText(row, column); + return loc ? loc.calculatedText : null; + }; + MatrixCells.prototype.getDefaultCellText = function (column) { + var loc = this.getCellLocText(_settings__WEBPACK_IMPORTED_MODULE_10__["settings"].matrixDefaultRowName, column); + return loc ? loc.calculatedText : null; + }; + MatrixCells.prototype.getCellDisplayText = function (row, column) { + var loc = this.getCellDisplayLocText(row, column); + return loc ? loc.calculatedText : null; + }; + Object.defineProperty(MatrixCells.prototype, "rows", { + get: function () { + return this.cellsOwner ? this.cellsOwner.getRows() : []; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixCells.prototype, "columns", { + get: function () { + return this.cellsOwner ? this.cellsOwner.getColumns() : []; + }, + enumerable: false, + configurable: true + }); + MatrixCells.prototype.getCellRowColumnValue = function (val, values) { + if (val === null || val === undefined) + return null; + if (typeof val == "number") { + if (val < 0 || val >= values.length) + return null; + val = values[val].value; + } + if (val.value) + return val.value; + return val; + }; + MatrixCells.prototype.getJson = function () { + if (this.isEmpty) + return null; + var res = {}; + for (var row in this.values) { + var resRow = {}; + var rowValues = this.values[row]; + for (var col in rowValues) { + resRow[col] = rowValues[col].getJson(); + } + res[row] = resRow; + } + return res; + }; + MatrixCells.prototype.setJson = function (value) { + this.values = {}; + if (!!value) { + for (var row in value) { + if (row == "pos") + continue; + var rowValues = value[row]; + this.values[row] = {}; + for (var col in rowValues) { + if (col == "pos") + continue; + var loc = this.createString(); + loc.setJson(rowValues[col]); + this.values[row][col] = loc; + } + } + } + this.valuesChanged(); + }; + MatrixCells.prototype.createString = function () { + return new _localizablestring__WEBPACK_IMPORTED_MODULE_8__["LocalizableString"](this.cellsOwner, true); + }; + return MatrixCells; + }()); + + /** + * A Model for a simple matrix question. + */ + var QuestionMatrixModel = /** @class */ (function (_super) { + __extends(QuestionMatrixModel, _super); + function QuestionMatrixModel(name) { + var _this = _super.call(this, name) || this; + _this.isRowChanging = false; + _this.emptyLocalizableString = new _localizablestring__WEBPACK_IMPORTED_MODULE_8__["LocalizableString"](_this); + _this.cellsValue = new MatrixCells(_this); + _this.cellsValue.onValuesChanged = function () { + _this.updateHasCellText(); + _this.propertyValueChanged("cells", _this.cells, _this.cells); + }; + _this.registerFunctionOnPropertyValueChanged("columns", function () { + _this.onColumnsChanged(); + }); + _this.registerFunctionOnPropertyValueChanged("rows", function () { + if (!_this.filterItems()) { + _this.onRowsChanged(); + } + }); + _this.registerFunctionOnPropertyValueChanged("hideIfRowsEmpty", function () { + _this.updateVisibilityBasedOnRows(); + }); + return _this; + } + QuestionMatrixModel.prototype.getType = function () { + return "matrix"; + }; + Object.defineProperty(QuestionMatrixModel.prototype, "hasSingleInput", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixModel.prototype, "isAllRowRequired", { + /** + * Set this property to true, if you want a user to answer all rows. + */ + get: function () { + return this.getPropertyValue("isAllRowRequired", false); + }, + set: function (val) { + this.setPropertyValue("isAllRowRequired", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixModel.prototype, "hasRows", { + /** + * Returns true, if there is at least one row. + */ + get: function () { + return this.rows.length > 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixModel.prototype, "rowsOrder", { + /** + * Use this property to render items in a specific order: "random" or "initial". Default is "initial". + */ + get: function () { + return this.getPropertyValue("rowsOrder"); + }, + set: function (val) { + val = val.toLowerCase(); + if (val == this.rowsOrder) + return; + this.setPropertyValue("rowsOrder", val); + this.onRowsChanged(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixModel.prototype, "hideIfRowsEmpty", { + /** + * Set this property to true to hide the question if there is no visible rows in the matrix. + */ + get: function () { + return this.getPropertyValue("hideIfRowsEmpty", false); + }, + set: function (val) { + this.setPropertyValue("hideIfRowsEmpty", val); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixModel.prototype.getRows = function () { + return this.rows; + }; + QuestionMatrixModel.prototype.getColumns = function () { + return this.visibleColumns; + }; + QuestionMatrixModel.prototype.addColumn = function (value, text) { + var col = new _itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"](value, text); + this.columns.push(col); + return col; + }; + QuestionMatrixModel.prototype.getItemClass = function (row, column) { + var isChecked = row.value == column.value; + var isDisabled = this.isReadOnly; + var allowHover = !isChecked && !isDisabled; + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]() + .append(this.cssClasses.cell, this.hasCellText) + .append(this.hasCellText ? this.cssClasses.cellText : this.cssClasses.label) + .append(this.cssClasses.itemOnError, !this.hasCellText && this.errors.length > 0) + .append(this.hasCellText ? this.cssClasses.cellTextSelected : this.cssClasses.itemChecked, isChecked) + .append(this.hasCellText ? this.cssClasses.cellTextDisabled : this.cssClasses.itemDisabled, isDisabled) + .append(this.cssClasses.itemHover, allowHover && !this.hasCellText) + .toString(); + }; + Object.defineProperty(QuestionMatrixModel.prototype, "itemSvgIcon", { + get: function () { + return this.cssClasses.itemSvgIconId; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixModel.prototype.getQuizQuestionCount = function () { + var res = 0; + for (var i = 0; i < this.rows.length; i++) { + if (!this.isValueEmpty(this.correctAnswer[this.rows[i].value])) + res++; + } + return res; + }; + QuestionMatrixModel.prototype.getCorrectAnswerCount = function () { + var res = 0; + var value = this.value; + for (var i = 0; i < this.rows.length; i++) { + var row = this.rows[i].value; + if (!this.isValueEmpty(value[row]) && + this.isTwoValueEquals(this.correctAnswer[row], value[row])) + res++; + } + return res; + }; + QuestionMatrixModel.prototype.getVisibleRows = function () { + var result = new Array(); + var val = this.value; + if (!val) + val = {}; + var rows = !!this.filteredRows ? this.filteredRows : this.rows; + for (var i = 0; i < rows.length; i++) { + var row = rows[i]; + if (this.isValueEmpty(row.value)) + continue; + result.push(this.createMatrixRow(row, this.id + "_" + row.value.toString().replace(/\s/g, "_"), val[row.value])); + } + if (result.length == 0 && !this.filteredRows) { + result.push(this.createMatrixRow(new _itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"](null), this.name.replace(/\s/g, "_"), val)); + } + this.generatedVisibleRows = result; + return result; + }; + QuestionMatrixModel.prototype.sortVisibleRows = function (array) { + var order = this.rowsOrder.toLowerCase(); + if (order === "random") + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].randomizeArray(array); + return array; + }; + QuestionMatrixModel.prototype.endLoadingFromJson = function () { + _super.prototype.endLoadingFromJson.call(this); + this.rows = this.sortVisibleRows(this.rows); + this.updateVisibilityBasedOnRows(); + }; + QuestionMatrixModel.prototype.processRowsOnSet = function (newRows) { + return this.sortVisibleRows(newRows); + }; + Object.defineProperty(QuestionMatrixModel.prototype, "visibleRows", { + /** + * Returns the list of visible rows as model objects. + * @see rowsVisibleIf + */ + get: function () { + return this.getVisibleRows(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixModel.prototype, "cells", { + get: function () { + return this.cellsValue; + }, + set: function (value) { + this.cells.setJson(value && value.getJson ? value.getJson() : null); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixModel.prototype, "hasCellText", { + get: function () { + return this.getPropertyValue("hasCellText", false); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixModel.prototype.updateHasCellText = function () { + this.setPropertyValue("hasCellText", !this.cells.isEmpty); + }; + QuestionMatrixModel.prototype.setCellText = function (row, column, val) { + this.cells.setCellText(row, column, val); + }; + QuestionMatrixModel.prototype.getCellText = function (row, column) { + return this.cells.getCellText(row, column); + }; + QuestionMatrixModel.prototype.setDefaultCellText = function (column, val) { + this.cells.setDefaultCellText(column, val); + }; + QuestionMatrixModel.prototype.getDefaultCellText = function (column) { + return this.cells.getDefaultCellText(column); + }; + QuestionMatrixModel.prototype.getCellDisplayText = function (row, column) { + return this.cells.getCellDisplayText(row, column); + }; + QuestionMatrixModel.prototype.getCellDisplayLocText = function (row, column) { + var loc = this.cells.getCellDisplayLocText(row, column); + return loc ? loc : this.emptyLocalizableString; + }; + QuestionMatrixModel.prototype.supportGoNextPageAutomatic = function () { + return this.hasValuesInAllRows(); + }; + QuestionMatrixModel.prototype.onCheckForErrors = function (errors, isOnValueChanged) { + _super.prototype.onCheckForErrors.call(this, errors, isOnValueChanged); + if ((!isOnValueChanged || this.errors.length > 0) && + this.hasErrorInRows()) { + errors.push(new _error__WEBPACK_IMPORTED_MODULE_6__["RequiredInAllRowsError"](null, this)); + } + }; + QuestionMatrixModel.prototype.hasErrorInRows = function () { + if (!this.isAllRowRequired) + return false; + return !this.hasValuesInAllRows(); + }; + QuestionMatrixModel.prototype.hasValuesInAllRows = function () { + var rows = this.generatedVisibleRows; + if (!rows) + rows = this.visibleRows; + if (!rows) + return true; + for (var i = 0; i < rows.length; i++) { + if (this.isValueEmpty(rows[i].value)) + return false; + } + return true; + }; + QuestionMatrixModel.prototype.getIsAnswered = function () { + return _super.prototype.getIsAnswered.call(this) && this.hasValuesInAllRows(); + }; + QuestionMatrixModel.prototype.createMatrixRow = function (item, fullName, value) { + var row = new MatrixRowModel(item, fullName, this, value); + this.onMatrixRowCreated(row); + return row; + }; + QuestionMatrixModel.prototype.onMatrixRowCreated = function (row) { }; + QuestionMatrixModel.prototype.setQuestionValue = function (newValue, updateIsAnswered) { + if (updateIsAnswered === void 0) { updateIsAnswered = true; } + _super.prototype.setQuestionValue.call(this, newValue, this.isRowChanging || updateIsAnswered); + if (!this.generatedVisibleRows || this.generatedVisibleRows.length == 0) + return; + this.isRowChanging = true; + var val = this.value; + if (!val) + val = {}; + if (this.rows.length == 0) { + this.generatedVisibleRows[0].value = val; + } + else { + for (var i = 0; i < this.generatedVisibleRows.length; i++) { + var row = this.generatedVisibleRows[i]; + var rowVal = val[row.name]; + if (this.isValueEmpty(rowVal)) + rowVal = null; + this.generatedVisibleRows[i].value = rowVal; + } + } + this.updateIsAnswered(); + this.isRowChanging = false; + }; + QuestionMatrixModel.prototype.getDisplayValueCore = function (keysAsText, value) { + var res = {}; + for (var key in value) { + var newKey = keysAsText + ? _itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"].getTextOrHtmlByValue(this.rows, key) + : key; + if (!newKey) + newKey = key; + var newValue = _itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"].getTextOrHtmlByValue(this.columns, value[key]); + if (!newValue) + newValue = value[key]; + res[newKey] = newValue; + } + return res; + }; + QuestionMatrixModel.prototype.getPlainData = function (options) { + var _this = this; + if (options === void 0) { options = { + includeEmpty: true, + }; } + var questionPlainData = _super.prototype.getPlainData.call(this, options); + if (!!questionPlainData) { + var values = this.createValueCopy(); + questionPlainData.isNode = true; + questionPlainData.data = Object.keys(values || {}).map(function (rowName) { + var row = _this.rows.filter(function (r) { return r.value === rowName; })[0]; + var rowDataItem = { + name: rowName, + title: !!row ? row.text : "row", + value: values[rowName], + displayValue: _itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"].getTextOrHtmlByValue(_this.visibleColumns, values[rowName]), + getString: function (val) { + return typeof val === "object" ? JSON.stringify(val) : val; + }, + isNode: false, + }; + var item = _itemvalue__WEBPACK_IMPORTED_MODULE_1__["ItemValue"].getItemByValue(_this.visibleColumns, values[rowName]); + if (!!item) { + (options.calculations || []).forEach(function (calculation) { + rowDataItem[calculation.propertyName] = + item[calculation.propertyName]; + }); + } + return rowDataItem; + }); + } + return questionPlainData; + }; + QuestionMatrixModel.prototype.addConditionObjectsByContext = function (objects, context) { + for (var i = 0; i < this.rows.length; i++) { + var row = this.rows[i]; + if (!!row.value) { + objects.push({ + name: this.getValueName() + "." + row.value, + text: this.processedTitle + "." + row.calculatedText, + question: this, + }); + } + } + }; + QuestionMatrixModel.prototype.getConditionJson = function (operator, path) { + if (path === void 0) { path = null; } + if (!path) + return _super.prototype.getConditionJson.call(this); + var question = new _question_dropdown__WEBPACK_IMPORTED_MODULE_9__["QuestionDropdownModel"](path); + question.choices = this.columns; + var json = new _jsonobject__WEBPACK_IMPORTED_MODULE_3__["JsonObject"]().toJsonObject(question); + json["type"] = question.getType(); + return json; + }; + QuestionMatrixModel.prototype.clearValueIfInvisibleCore = function () { + _super.prototype.clearValueIfInvisibleCore.call(this); + if (this.hasRows) { + this.clearInvisibleValuesInRows(); + } + }; + QuestionMatrixModel.prototype.getFirstInputElementId = function () { + var rows = this.generatedVisibleRows; + if (!rows) + rows = this.visibleRows; + if (rows.length > 0 && this.visibleColumns.length > 0) { + return this.inputId + "_" + rows[0].name + "_" + 0; + } + return _super.prototype.getFirstInputElementId.call(this); + }; + QuestionMatrixModel.prototype.onRowsChanged = function () { + this.updateVisibilityBasedOnRows(); + _super.prototype.onRowsChanged.call(this); + }; + QuestionMatrixModel.prototype.updateVisibilityBasedOnRows = function () { + if (this.hideIfRowsEmpty) { + this.visible = + this.rows.length > 0 && + (!this.filteredRows || this.filteredRows.length > 0); + } + }; + //IMatrixData + QuestionMatrixModel.prototype.onMatrixRowChanged = function (row) { + if (this.isRowChanging) + return; + this.isRowChanging = true; + if (!this.hasRows) { + this.setNewValue(row.value); + } + else { + var newValue = this.value; + if (!newValue) { + newValue = {}; + } + newValue[row.name] = row.value; + this.setNewValue(newValue); + } + this.isRowChanging = false; + }; + QuestionMatrixModel.prototype.getCorrectedRowValue = function (value) { + for (var i = 0; i < this.columns.length; i++) { + if (value === this.columns[i].value) + return value; + } + for (var i = 0; i < this.columns.length; i++) { + if (this.isTwoValueEquals(value, this.columns[i].value)) + return this.columns[i].value; + } + return value; + }; + QuestionMatrixModel.prototype.getSearchableItemValueKeys = function (keys) { + keys.push("columns"); + keys.push("rows"); + }; + Object.defineProperty(QuestionMatrixModel.prototype, "SurveyModel", { + get: function () { + return this.survey; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixModel.prototype.getColumnHeaderWrapperComponentName = function (cell) { + return this.SurveyModel.getElementWrapperComponentName({ column: cell }, "column-header"); + }; + QuestionMatrixModel.prototype.getColumnHeaderWrapperComponentData = function (cell) { + return this.SurveyModel.getElementWrapperComponentData({ column: cell }, "column-header"); + }; + QuestionMatrixModel.prototype.getRowHeaderWrapperComponentName = function (cell) { + return this.SurveyModel.getElementWrapperComponentName({ row: cell }, "row-header"); + }; + QuestionMatrixModel.prototype.getRowHeaderWrapperComponentData = function (cell) { + return this.SurveyModel.getElementWrapperComponentData({ row: cell }, "row-header"); + }; + return QuestionMatrixModel; + }(_martixBase__WEBPACK_IMPORTED_MODULE_2__["QuestionMatrixBaseModel"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("matrix", [ + { + name: "columns:itemvalue[]", + baseValue: function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_5__["surveyLocalization"].getString("matrix_column"); + }, + }, + { + name: "rows:itemvalue[]", + baseValue: function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_5__["surveyLocalization"].getString("matrix_row"); + }, + }, + { name: "cells:cells", serializationProperty: "cells" }, + { + name: "rowsOrder", + default: "initial", + choices: ["initial", "random"], + }, + "isAllRowRequired:boolean", + "hideIfRowsEmpty:boolean", + ], function () { + return new QuestionMatrixModel(""); + }, "matrixbase"); + _questionfactory__WEBPACK_IMPORTED_MODULE_7__["QuestionFactory"].Instance.registerQuestion("matrix", function (name) { + var q = new QuestionMatrixModel(name); + q.rows = _questionfactory__WEBPACK_IMPORTED_MODULE_7__["QuestionFactory"].DefaultRows; + q.columns = _questionfactory__WEBPACK_IMPORTED_MODULE_7__["QuestionFactory"].DefaultColums; + return q; + }); + + + /***/ }), + + /***/ "./src/question_matrixdropdown.ts": + /*!****************************************!*\ + !*** ./src/question_matrixdropdown.ts ***! + \****************************************/ + /*! exports provided: MatrixDropdownRowModel, QuestionMatrixDropdownModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDropdownRowModel", function() { return MatrixDropdownRowModel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDropdownModel", function() { return QuestionMatrixDropdownModel; }); + /* harmony import */ var _question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question_matrixdropdownbase */ "./src/question_matrixdropdownbase.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + var MatrixDropdownRowModel = /** @class */ (function (_super) { + __extends(MatrixDropdownRowModel, _super); + function MatrixDropdownRowModel(name, item, data, value) { + var _this = _super.call(this, data, value) || this; + _this.name = name; + _this.item = item; + _this.buildCells(value); + return _this; + } + Object.defineProperty(MatrixDropdownRowModel.prototype, "rowName", { + get: function () { + return this.name; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownRowModel.prototype, "text", { + get: function () { + return this.item.text; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownRowModel.prototype, "locText", { + get: function () { + return this.item.locText; + }, + enumerable: false, + configurable: true + }); + return MatrixDropdownRowModel; + }(_question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_0__["MatrixDropdownRowModelBase"])); + + /** + * A Model for a matrix dropdown question. You may use a dropdown, checkbox, radiogroup, text and comment questions as a cell editors. + */ + var QuestionMatrixDropdownModel = /** @class */ (function (_super) { + __extends(QuestionMatrixDropdownModel, _super); + function QuestionMatrixDropdownModel(name) { + var _this = _super.call(this, name) || this; + _this.createLocalizableString("totalText", _this, true); + var self = _this; + _this.registerFunctionOnPropertyValueChanged("rows", function () { + self.clearGeneratedRows(); + self.resetRenderedTable(); + self.filterItems(); + }); + return _this; + } + QuestionMatrixDropdownModel.prototype.getType = function () { + return "matrixdropdown"; + }; + Object.defineProperty(QuestionMatrixDropdownModel.prototype, "totalText", { + /** + * Set this property to show it on the first column for the total row. + */ + get: function () { + return this.getLocalizableStringText("totalText", ""); + }, + set: function (val) { + this.setLocalizableStringText("totalText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModel.prototype, "locTotalText", { + get: function () { + return this.getLocalizableString("totalText"); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModel.prototype.getFooterText = function () { + return this.locTotalText; + }; + Object.defineProperty(QuestionMatrixDropdownModel.prototype, "rowTitleWidth", { + /** + * The column width for the first column, row title column. + */ + get: function () { + return this.getPropertyValue("rowTitleWidth", ""); + }, + set: function (val) { + this.setPropertyValue("rowTitleWidth", val); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModel.prototype.getRowTitleWidth = function () { + return this.rowTitleWidth; + }; + QuestionMatrixDropdownModel.prototype.getDisplayValueCore = function (keysAsText, value) { + if (!value) + return value; + var rows = this.visibleRows; + var res = {}; + if (!rows) + return res; + for (var i = 0; i < rows.length; i++) { + var rowValue = rows[i].rowName; + var val = value[rowValue]; + if (!val) + continue; + if (keysAsText) { + var displayRowValue = _itemvalue__WEBPACK_IMPORTED_MODULE_2__["ItemValue"].getTextOrHtmlByValue(this.rows, rowValue); + if (!!displayRowValue) { + rowValue = displayRowValue; + } + } + res[rowValue] = this.getRowDisplayValue(keysAsText, rows[i], val); + } + return res; + }; + QuestionMatrixDropdownModel.prototype.getConditionObjectRowName = function (index) { + return "." + this.rows[index].value; + }; + QuestionMatrixDropdownModel.prototype.getConditionObjectRowText = function (index) { + return "." + this.rows[index].calculatedText; + }; + QuestionMatrixDropdownModel.prototype.getConditionObjectsRowIndeces = function () { + var res = []; + for (var i = 0; i < this.rows.length; i++) + res.push(i); + return res; + }; + QuestionMatrixDropdownModel.prototype.clearIncorrectValues = function () { + var val = this.value; + if (!val) + return; + var newVal = null; + var isChanged = false; + var rows = !!this.filteredRows ? this.filteredRows : this.rows; + for (var key in val) { + if (_itemvalue__WEBPACK_IMPORTED_MODULE_2__["ItemValue"].getItemByValue(rows, key)) { + if (newVal == null) + newVal = {}; + newVal[key] = val[key]; + } + else { + isChanged = true; + } + } + if (isChanged) { + this.value = newVal; + } + _super.prototype.clearIncorrectValues.call(this); + }; + QuestionMatrixDropdownModel.prototype.clearValueIfInvisibleCore = function () { + _super.prototype.clearValueIfInvisibleCore.call(this); + this.clearInvisibleValuesInRows(); + }; + QuestionMatrixDropdownModel.prototype.generateRows = function () { + var result = new Array(); + var rows = !!this.filteredRows ? this.filteredRows : this.rows; + if (!rows || rows.length === 0) + return result; + var val = this.value; + if (!val) + val = {}; + for (var i = 0; i < rows.length; i++) { + if (!rows[i].value) + continue; + result.push(this.createMatrixRow(rows[i], val[rows[i].value])); + } + return result; + }; + QuestionMatrixDropdownModel.prototype.createMatrixRow = function (item, value) { + return new MatrixDropdownRowModel(item.value, item, this, value); + }; + QuestionMatrixDropdownModel.prototype.getSearchableItemValueKeys = function (keys) { + keys.push("rows"); + }; + QuestionMatrixDropdownModel.prototype.updateProgressInfoByValues = function (res) { + var val = this.value; + if (!val) + val = {}; + for (var i = 0; i < this.rows.length; i++) { + var row = this.rows[i]; + var rowValue = val[row.value]; + this.updateProgressInfoByRow(res, !!rowValue ? rowValue : {}); + } + }; + return QuestionMatrixDropdownModel; + }(_question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_0__["QuestionMatrixDropdownModelBase"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("matrixdropdown", [ + { + name: "rows:itemvalue[]", + }, + "rowsVisibleIf:condition", + "rowTitleWidth", + { name: "totalText", serializationProperty: "locTotalText" }, + ], function () { + return new QuestionMatrixDropdownModel(""); + }, "matrixdropdownbase"); + _questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].Instance.registerQuestion("matrixdropdown", function (name) { + var q = new QuestionMatrixDropdownModel(name); + q.choices = [1, 2, 3, 4, 5]; + q.rows = _questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].DefaultRows; + _question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_0__["QuestionMatrixDropdownModelBase"].addDefaultColumns(q); + return q; + }); + + + /***/ }), + + /***/ "./src/question_matrixdropdownbase.ts": + /*!********************************************!*\ + !*** ./src/question_matrixdropdownbase.ts ***! + \********************************************/ + /*! exports provided: MatrixDropdownCell, MatrixDropdownTotalCell, MatrixDropdownRowModelBase, MatrixDropdownTotalRowModel, QuestionMatrixDropdownModelBase */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDropdownCell", function() { return MatrixDropdownCell; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDropdownTotalCell", function() { return MatrixDropdownTotalCell; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDropdownRowModelBase", function() { return MatrixDropdownRowModelBase; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDropdownTotalRowModel", function() { return MatrixDropdownTotalRowModel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDropdownModelBase", function() { return QuestionMatrixDropdownModelBase; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _martixBase__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./martixBase */ "./src/martixBase.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); + /* harmony import */ var _textPreProcessor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./textPreProcessor */ "./src/textPreProcessor.ts"); + /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _functionsfactory__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./functionsfactory */ "./src/functionsfactory.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./error */ "./src/error.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _question_matrixdropdowncolumn__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./question_matrixdropdowncolumn */ "./src/question_matrixdropdowncolumn.ts"); + /* harmony import */ var _question_matrixdropdownrendered__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./question_matrixdropdownrendered */ "./src/question_matrixdropdownrendered.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + + + + + + + + + var MatrixDropdownCell = /** @class */ (function () { + function MatrixDropdownCell(column, row, data) { + this.column = column; + this.row = row; + this.data = data; + this.questionValue = this.createQuestion(column, row, data); + this.questionValue.updateCustomWidget(); + } + MatrixDropdownCell.prototype.locStrsChanged = function () { + this.question.locStrsChanged(); + }; + MatrixDropdownCell.prototype.createQuestion = function (column, row, data) { + var res = data.createQuestion(this.row, this.column); + res.validateValueCallback = function () { + return data.validateCell(row, column.name, row.value); + }; + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["CustomPropertiesCollection"].getProperties(column.getType()).forEach(function (property) { + var propertyName = property.name; + if (column[propertyName] !== undefined) { + res[propertyName] = column[propertyName]; + } + }); + return res; + }; + Object.defineProperty(MatrixDropdownCell.prototype, "question", { + get: function () { + return this.questionValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownCell.prototype, "value", { + get: function () { + return this.question.value; + }, + set: function (value) { + this.question.value = value; + }, + enumerable: false, + configurable: true + }); + MatrixDropdownCell.prototype.runCondition = function (values, properties) { + this.question.runCondition(values, properties); + }; + return MatrixDropdownCell; + }()); + + var MatrixDropdownTotalCell = /** @class */ (function (_super) { + __extends(MatrixDropdownTotalCell, _super); + function MatrixDropdownTotalCell(column, row, data) { + var _this = _super.call(this, column, row, data) || this; + _this.column = column; + _this.row = row; + _this.data = data; + _this.updateCellQuestion(); + return _this; + } + MatrixDropdownTotalCell.prototype.createQuestion = function (column, row, data) { + var res = _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].createClass("expression"); + res.setSurveyImpl(row); + return res; + }; + MatrixDropdownTotalCell.prototype.locStrsChanged = function () { + this.updateCellQuestion(); + _super.prototype.locStrsChanged.call(this); + }; + MatrixDropdownTotalCell.prototype.updateCellQuestion = function () { + this.question.locCalculation(); + this.column.updateCellQuestion(this.question, null, function (json) { + delete json["defaultValue"]; + }); + this.question.expression = this.getTotalExpression(); + this.question.format = this.column.totalFormat; + this.question.currency = this.column.totalCurrency; + this.question.displayStyle = this.column.totalDisplayStyle; + this.question.maximumFractionDigits = this.column.totalMaximumFractionDigits; + this.question.minimumFractionDigits = this.column.totalMinimumFractionDigits; + this.question.unlocCalculation(); + this.question.runIfReadOnly = true; + }; + MatrixDropdownTotalCell.prototype.getTotalExpression = function () { + if (!!this.column.totalExpression) + return this.column.totalExpression; + if (this.column.totalType == "none") + return ""; + var funName = this.column.totalType + "InArray"; + if (!_functionsfactory__WEBPACK_IMPORTED_MODULE_8__["FunctionFactory"].Instance.hasFunction(funName)) + return ""; + return funName + "({self}, '" + this.column.name + "')"; + }; + return MatrixDropdownTotalCell; + }(MatrixDropdownCell)); + + var MatrixDropdownRowTextProcessor = /** @class */ (function (_super) { + __extends(MatrixDropdownRowTextProcessor, _super); + function MatrixDropdownRowTextProcessor(row, variableName, parentTextProcessor) { + var _this = _super.call(this, variableName) || this; + _this.row = row; + _this.variableName = variableName; + _this.parentTextProcessor = parentTextProcessor; + return _this; + } + MatrixDropdownRowTextProcessor.prototype.getParentTextProcessor = function () { return this.parentTextProcessor; }; + Object.defineProperty(MatrixDropdownRowTextProcessor.prototype, "survey", { + get: function () { + return this.row.getSurvey(); + }, + enumerable: false, + configurable: true + }); + MatrixDropdownRowTextProcessor.prototype.getValues = function () { + return this.row.value; + }; + MatrixDropdownRowTextProcessor.prototype.getQuestionByName = function (name) { + return this.row.getQuestionByName(name); + }; + MatrixDropdownRowTextProcessor.prototype.onCustomProcessText = function (textValue) { + if (textValue.name == MatrixDropdownRowModelBase.IndexVariableName) { + textValue.isExists = true; + textValue.value = this.row.rowIndex; + return true; + } + if (textValue.name == MatrixDropdownRowModelBase.RowValueVariableName) { + textValue.isExists = true; + textValue.value = this.row.rowName; + return true; + } + return false; + }; + return MatrixDropdownRowTextProcessor; + }(_textPreProcessor__WEBPACK_IMPORTED_MODULE_5__["QuestionTextProcessor"])); + var MatrixDropdownRowModelBase = /** @class */ (function () { + function MatrixDropdownRowModelBase(data, value) { + var _this = this; + this.isSettingValue = false; + this.detailPanelValue = null; + this.cells = []; + this.isCreatingDetailPanel = false; + this.data = data; + this.subscribeToChanges(value); + this.textPreProcessor = new MatrixDropdownRowTextProcessor(this, MatrixDropdownRowModelBase.RowVariableName, !!data ? data.getParentTextProcessor() : null); + this.showHideDetailPanelClick = function () { + if (_this.getSurvey().isDesignMode) + return true; + _this.showHideDetailPanel(); + }; + this.idValue = MatrixDropdownRowModelBase.getId(); + } + MatrixDropdownRowModelBase.getId = function () { + return "srow_" + MatrixDropdownRowModelBase.idCounter++; + }; + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "id", { + get: function () { + return this.idValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "rowName", { + get: function () { + return null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "text", { + get: function () { + return this.rowName; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "value", { + get: function () { + var result = {}; + var questions = this.questions; + for (var i = 0; i < questions.length; i++) { + var question = questions[i]; + if (!question.isEmpty()) { + result[question.getValueName()] = question.value; + } + if (!!question.comment && + !!this.getSurvey() && + this.getSurvey().storeOthersAsComment) { + result[question.getValueName() + _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].commentPrefix] = + question.comment; + } + } + return result; + }, + set: function (value) { + this.isSettingValue = true; + this.subscribeToChanges(value); + var questions = this.questions; + for (var i = 0; i < questions.length; i++) { + var question = questions[i]; + var val = this.getCellValue(value, question.getValueName()); + var oldComment = question.comment; + var comment = !!value + ? value[question.getValueName() + _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].commentPrefix] + : ""; + if (comment == undefined) + comment = ""; + question.updateValueFromSurvey(val); + if (!!comment || this.isTwoValueEquals(oldComment, question.comment)) { + question.updateCommentFromSurvey(comment); + } + question.onSurveyValueChanged(val); + } + this.isSettingValue = false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "locText", { + get: function () { + return null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "hasPanel", { + get: function () { + if (!this.data) + return false; + return this.data.hasDetailPanel(this); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "detailPanel", { + get: function () { + return this.detailPanelValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "detailPanelId", { + get: function () { + return !!this.detailPanel ? this.detailPanel.id : ""; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "isDetailPanelShowing", { + get: function () { + return !!this.data ? this.data.getIsDetailPanelShowing(this) : false; + }, + enumerable: false, + configurable: true + }); + MatrixDropdownRowModelBase.prototype.setIsDetailPanelShowing = function (val) { + if (!!this.data) { + this.data.setIsDetailPanelShowing(this, val); + } + if (!!this.onDetailPanelShowingChanged) { + this.onDetailPanelShowingChanged(); + } + }; + MatrixDropdownRowModelBase.prototype.showHideDetailPanel = function () { + if (this.isDetailPanelShowing) { + this.hideDetailPanel(); + } + else { + this.showDetailPanel(); + } + }; + MatrixDropdownRowModelBase.prototype.showDetailPanel = function () { + this.ensureDetailPanel(); + if (!this.detailPanelValue) + return; + this.setIsDetailPanelShowing(true); + }; + MatrixDropdownRowModelBase.prototype.hideDetailPanel = function (destroyPanel) { + if (destroyPanel === void 0) { destroyPanel = false; } + this.setIsDetailPanelShowing(false); + if (destroyPanel) { + this.detailPanelValue = null; + } + }; + MatrixDropdownRowModelBase.prototype.ensureDetailPanel = function () { + if (this.isCreatingDetailPanel) + return; + if (!!this.detailPanelValue || !this.hasPanel || !this.data) + return; + this.isCreatingDetailPanel = true; + this.detailPanelValue = this.data.createRowDetailPanel(this); + var questions = this.detailPanelValue.questions; + var value = this.data.getRowValue(this.data.getRowIndex(this)); + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(value)) { + for (var i = 0; i < questions.length; i++) { + var key = questions[i].getValueName(); + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(value[key])) { + questions[i].value = value[key]; + } + } + } + this.detailPanelValue.setSurveyImpl(this); + this.isCreatingDetailPanel = false; + }; + MatrixDropdownRowModelBase.prototype.getAllValues = function () { + return this.value; + }; + MatrixDropdownRowModelBase.prototype.getFilteredValues = function () { + var allValues = this.getAllValues(); + var values = { row: allValues }; + for (var key in allValues) { + values[key] = allValues[key]; + } + return values; + }; + MatrixDropdownRowModelBase.prototype.getFilteredProperties = function () { + return { survey: this.getSurvey(), row: this }; + }; + MatrixDropdownRowModelBase.prototype.runCondition = function (values, properties) { + if (!!this.data) { + values[MatrixDropdownRowModelBase.OwnerVariableName] = this.data.value; + } + values[MatrixDropdownRowModelBase.IndexVariableName] = this.rowIndex; + values[MatrixDropdownRowModelBase.RowValueVariableName] = this.rowName; + if (!properties) + properties = {}; + properties[MatrixDropdownRowModelBase.RowVariableName] = this; + for (var i = 0; i < this.cells.length; i++) { + values[MatrixDropdownRowModelBase.RowVariableName] = this.value; + this.cells[i].runCondition(values, properties); + } + if (!!this.detailPanel) { + this.detailPanel.runCondition(values, properties); + } + }; + MatrixDropdownRowModelBase.prototype.clearValue = function () { + var questions = this.questions; + for (var i = 0; i < questions.length; i++) { + questions[i].clearValue(); + } + }; + MatrixDropdownRowModelBase.prototype.onAnyValueChanged = function (name) { + var questions = this.questions; + for (var i = 0; i < questions.length; i++) { + questions[i].onAnyValueChanged(name); + } + }; + MatrixDropdownRowModelBase.prototype.getDataValueCore = function (valuesHash, key) { + var survey = this.getSurvey(); + if (!!survey) { + return survey.getDataValueCore(valuesHash, key); + } + else { + return valuesHash[key]; + } + }; + MatrixDropdownRowModelBase.prototype.getValue = function (name) { + var question = this.getQuestionByName(name); + return !!question ? question.value : null; + }; + MatrixDropdownRowModelBase.prototype.setValue = function (name, newColumnValue) { + this.setValueCore(name, newColumnValue, false); + }; + MatrixDropdownRowModelBase.prototype.getVariable = function (name) { + return undefined; + }; + MatrixDropdownRowModelBase.prototype.setVariable = function (name, newValue) { }; + MatrixDropdownRowModelBase.prototype.getComment = function (name) { + var question = this.getQuestionByName(name); + return !!question ? question.comment : ""; + }; + MatrixDropdownRowModelBase.prototype.setComment = function (name, newValue, locNotification) { + this.setValueCore(name, newValue, true); + }; + MatrixDropdownRowModelBase.prototype.setValueCore = function (name, newColumnValue, isComment) { + if (this.isSettingValue) + return; + this.updateQuestionsValue(name, newColumnValue, isComment); + var newValue = this.value; + var changedName = isComment ? name + _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].commentPrefix : name; + var changedValue = isComment ? this.getComment(name) : this.getValue(name); + var changedQuestion = this.getQuestionByName(name); + var changingValue = this.data.onRowChanging(this, changedName, newValue); + if (!!changedQuestion && + !this.isTwoValueEquals(changingValue, changedValue)) { + if (isComment) { + changedQuestion.comment = changingValue; + } + else { + changedQuestion.value = changingValue; + } + } + else { + if (this.data.isValidateOnValueChanging && + this.hasQuestonError(changedQuestion)) + return; + this.data.onRowChanged(this, changedName, newValue, newColumnValue == null && !changedQuestion); + this.onAnyValueChanged(MatrixDropdownRowModelBase.RowVariableName); + } + }; + MatrixDropdownRowModelBase.prototype.updateQuestionsValue = function (name, newColumnValue, isComment) { + if (!this.detailPanel) + return; + var colQuestion = this.getQuestionByColumnName(name); + var detailQuestion = this.detailPanel.getQuestionByName(name); + if (!colQuestion || !detailQuestion) + return; + var isColQuestion = this.isTwoValueEquals(newColumnValue, isComment ? colQuestion.comment : colQuestion.value); + var question = isColQuestion ? detailQuestion : colQuestion; + this.isSettingValue = true; + if (!isComment) { + question.value = newColumnValue; + } + else { + question.comment = newColumnValue; + } + this.isSettingValue = false; + }; + MatrixDropdownRowModelBase.prototype.hasQuestonError = function (question) { + if (!question) + return false; + if (question.hasErrors(true, { + isOnValueChanged: !this.data.isValidateOnValueChanging, + })) + return true; + if (question.isEmpty()) + return false; + var cell = this.getCellByColumnName(question.name); + if (!cell || !cell.column || !cell.column.isUnique) + return false; + return this.data.checkIfValueInRowDuplicated(this, question); + }; + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "isEmpty", { + get: function () { + var val = this.value; + if (_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(val)) + return true; + for (var key in val) { + if (val[key] !== undefined && val[key] !== null) + return false; + } + return true; + }, + enumerable: false, + configurable: true + }); + MatrixDropdownRowModelBase.prototype.getQuestionByColumn = function (column) { + var cell = this.getCellByColumn(column); + return !!cell ? cell.question : null; + }; + MatrixDropdownRowModelBase.prototype.getCellByColumn = function (column) { + for (var i = 0; i < this.cells.length; i++) { + if (this.cells[i].column == column) + return this.cells[i]; + } + return null; + }; + MatrixDropdownRowModelBase.prototype.getCellByColumnName = function (columnName) { + for (var i = 0; i < this.cells.length; i++) { + if (this.cells[i].column.name == columnName) + return this.cells[i]; + } + return null; + }; + MatrixDropdownRowModelBase.prototype.getQuestionByColumnName = function (columnName) { + var cell = this.getCellByColumnName(columnName); + return !!cell ? cell.question : null; + }; + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "questions", { + get: function () { + var res = []; + for (var i = 0; i < this.cells.length; i++) { + res.push(this.cells[i].question); + } + var detailQuestions = !!this.detailPanel ? this.detailPanel.questions : []; + for (var i = 0; i < detailQuestions.length; i++) { + res.push(detailQuestions[i]); + } + return res; + }, + enumerable: false, + configurable: true + }); + MatrixDropdownRowModelBase.prototype.getQuestionByName = function (name) { + var res = this.getQuestionByColumnName(name); + if (!!res) + return res; + return !!this.detailPanel ? this.detailPanel.getQuestionByName(name) : null; + }; + MatrixDropdownRowModelBase.prototype.getQuestionsByName = function (name) { + var res = []; + var q = this.getQuestionByColumnName(name); + if (!!q) + res.push(q); + if (!!this.detailPanel) { + q = this.detailPanel.getQuestionByName(name); + if (!!q) + res.push(q); + } + return res; + }; + MatrixDropdownRowModelBase.prototype.getSharedQuestionByName = function (columnName) { + return !!this.data + ? this.data.getSharedQuestionByName(columnName, this) + : null; + }; + MatrixDropdownRowModelBase.prototype.clearIncorrectValues = function (val) { + for (var key in val) { + var question = this.getQuestionByName(key); + if (question) { + var qVal = question.value; + question.clearIncorrectValues(); + if (!this.isTwoValueEquals(qVal, question.value)) { + this.setValue(key, question.value); + } + } + else { + if (!this.getSharedQuestionByName(key) && + key.indexOf(_settings__WEBPACK_IMPORTED_MODULE_9__["settings"].matrixTotalValuePostFix) < 0) { + this.setValue(key, null); + } + } + } + }; + MatrixDropdownRowModelBase.prototype.getLocale = function () { + return this.data ? this.data.getLocale() : ""; + }; + MatrixDropdownRowModelBase.prototype.getMarkdownHtml = function (text, name) { + return this.data ? this.data.getMarkdownHtml(text, name) : null; + }; + MatrixDropdownRowModelBase.prototype.getRenderer = function (name) { + return this.data ? this.data.getRenderer(name) : null; + }; + MatrixDropdownRowModelBase.prototype.getRendererContext = function (locStr) { + return this.data ? this.data.getRendererContext(locStr) : locStr; + }; + MatrixDropdownRowModelBase.prototype.getProcessedText = function (text) { + return this.data ? this.data.getProcessedText(text) : text; + }; + MatrixDropdownRowModelBase.prototype.locStrsChanged = function () { + for (var i = 0; i < this.cells.length; i++) { + this.cells[i].locStrsChanged(); + } + if (!!this.detailPanel) { + this.detailPanel.locStrsChanged(); + } + }; + MatrixDropdownRowModelBase.prototype.updateCellQuestionOnColumnChanged = function (column, name, newValue) { + var cell = this.getCellByColumn(column); + if (!cell) + return; + this.updateCellOnColumnChanged(cell, name, newValue); + }; + MatrixDropdownRowModelBase.prototype.updateCellQuestionOnColumnItemValueChanged = function (column, propertyName, obj, name, newValue, oldValue) { + var cell = this.getCellByColumn(column); + if (!cell) + return; + this.updateCellOnColumnItemValueChanged(cell, propertyName, obj, name, newValue, oldValue); + }; + MatrixDropdownRowModelBase.prototype.onQuestionReadOnlyChanged = function (parentIsReadOnly) { + var questions = this.questions; + for (var i = 0; i < questions.length; i++) { + var q = questions[i]; + q.setPropertyValue("isReadOnly", q.isReadOnly); + } + if (!!this.detailPanel) { + this.detailPanel.readOnly = parentIsReadOnly; + } + }; + MatrixDropdownRowModelBase.prototype.hasErrors = function (fireCallback, rec, raiseOnCompletedAsyncValidators) { + var res = false; + var cells = this.cells; + if (!cells) + return res; + for (var colIndex = 0; colIndex < cells.length; colIndex++) { + if (!cells[colIndex]) + continue; + var question = cells[colIndex].question; + if (!question || !question.visible) + continue; + question.onCompletedAsyncValidators = function (hasErrors) { + raiseOnCompletedAsyncValidators(); + }; + if (!!rec && rec.isOnValueChanged === true && question.isEmpty()) + continue; + res = question.hasErrors(fireCallback, rec) || res; + } + if (this.hasPanel) { + this.ensureDetailPanel(); + var panelHasError = this.detailPanel.hasErrors(fireCallback, false, rec); + if (!rec.hideErroredPanel && panelHasError && fireCallback) { + if (rec.isSingleDetailPanel) { + rec.hideErroredPanel = true; + } + this.showDetailPanel(); + } + res = panelHasError || res; + } + return res; + }; + MatrixDropdownRowModelBase.prototype.updateCellOnColumnChanged = function (cell, name, newValue) { + cell.question[name] = newValue; + }; + MatrixDropdownRowModelBase.prototype.updateCellOnColumnItemValueChanged = function (cell, propertyName, obj, name, newValue, oldValue) { + var items = cell.question[propertyName]; + if (!Array.isArray(items)) + return; + var val = name === "value" ? oldValue : obj["value"]; + var item = _itemvalue__WEBPACK_IMPORTED_MODULE_6__["ItemValue"].getItemByValue(items, val); + if (!item) + return; + item[name] = newValue; + }; + MatrixDropdownRowModelBase.prototype.buildCells = function (value) { + this.isSettingValue = true; + var columns = this.data.columns; + for (var i = 0; i < columns.length; i++) { + var column = columns[i]; + if (!column.isVisible) + continue; + var cell = this.createCell(column); + this.cells.push(cell); + var cellValue = this.getCellValue(value, column.name); + if (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(cellValue)) { + cell.question.value = cellValue; + var commentKey = column.name + _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].commentPrefix; + if (!!value && !_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(value[commentKey])) { + cell.question.comment = value[commentKey]; + } + } + } + this.isSettingValue = false; + }; + MatrixDropdownRowModelBase.prototype.isTwoValueEquals = function (val1, val2) { + return _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isTwoValueEquals(val1, val2, false, true, false); + }; + MatrixDropdownRowModelBase.prototype.getCellValue = function (value, name) { + if (!!this.editingObj) + return _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].getObjPropertyValue(this.editingObj, name); + return !!value ? value[name] : undefined; + }; + MatrixDropdownRowModelBase.prototype.createCell = function (column) { + return new MatrixDropdownCell(column, this, this.data); + }; + MatrixDropdownRowModelBase.prototype.getSurveyData = function () { + return this; + }; + MatrixDropdownRowModelBase.prototype.getSurvey = function () { + return this.data ? this.data.getSurvey() : null; + }; + MatrixDropdownRowModelBase.prototype.getTextProcessor = function () { + return this.textPreProcessor; + }; + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "rowIndex", { + get: function () { + return !!this.data ? this.data.getRowIndex(this) + 1 : -1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownRowModelBase.prototype, "editingObj", { + get: function () { + return this.editingObjValue; + }, + enumerable: false, + configurable: true + }); + MatrixDropdownRowModelBase.prototype.dispose = function () { + if (!!this.editingObj) { + this.editingObj.onPropertyChanged.remove(this.onEditingObjPropertyChanged); + this.editingObjValue = null; + } + }; + MatrixDropdownRowModelBase.prototype.subscribeToChanges = function (value) { + var _this = this; + if (!value || !value.getType || !value.onPropertyChanged) + return; + if (value === this.editingObj) + return; + this.editingObjValue = value; + this.onEditingObjPropertyChanged = function (sender, options) { + _this.updateOnSetValue(options.name, options.newValue); + }; + this.editingObj.onPropertyChanged.add(this.onEditingObjPropertyChanged); + }; + MatrixDropdownRowModelBase.prototype.updateOnSetValue = function (name, newValue) { + this.isSettingValue = true; + var questions = this.getQuestionsByName(name); + for (var i = 0; i < questions.length; i++) { + questions[i].value = newValue; + } + this.isSettingValue = false; + }; + MatrixDropdownRowModelBase.RowVariableName = "row"; + MatrixDropdownRowModelBase.OwnerVariableName = "self"; + MatrixDropdownRowModelBase.IndexVariableName = "rowIndex"; + MatrixDropdownRowModelBase.RowValueVariableName = "rowValue"; + MatrixDropdownRowModelBase.idCounter = 1; + return MatrixDropdownRowModelBase; + }()); + + var MatrixDropdownTotalRowModel = /** @class */ (function (_super) { + __extends(MatrixDropdownTotalRowModel, _super); + function MatrixDropdownTotalRowModel(data) { + var _this = _super.call(this, data, null) || this; + _this.buildCells(null); + return _this; + } + MatrixDropdownTotalRowModel.prototype.createCell = function (column) { + return new MatrixDropdownTotalCell(column, this, this.data); + }; + MatrixDropdownTotalRowModel.prototype.setValue = function (name, newValue) { + if (!!this.data && !this.isSettingValue) { + this.data.onTotalValueChanged(); + } + }; + MatrixDropdownTotalRowModel.prototype.runCondition = function (values, properties) { + var counter = 0; + var prevValue; + do { + prevValue = _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].getUnbindValue(this.value); + _super.prototype.runCondition.call(this, values, properties); + counter++; + } while (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isTwoValueEquals(prevValue, this.value) && counter < 3); + }; + MatrixDropdownTotalRowModel.prototype.updateCellOnColumnChanged = function (cell, name, newValue) { + cell.updateCellQuestion(); + }; + return MatrixDropdownTotalRowModel; + }(MatrixDropdownRowModelBase)); + + /** + * A base class for matrix dropdown and matrix dynamic questions. + */ + var QuestionMatrixDropdownModelBase = /** @class */ (function (_super) { + __extends(QuestionMatrixDropdownModelBase, _super); + function QuestionMatrixDropdownModelBase(name) { + var _this = _super.call(this, name) || this; + _this.isRowChanging = false; + _this.lockResetRenderedTable = false; + _this.isDoingonAnyValueChanged = false; + _this.createItemValues("choices"); + _this.createLocalizableString("optionsCaption", _this, false, true); + _this.createLocalizableString("keyDuplicationError", _this, false, true); + _this.detailPanelValue = _this.createNewDetailPanel(); + _this.detailPanel.selectedElementInDesign = _this; + _this.detailPanel.renderWidth = "100%"; + _this.detailPanel.isInteractiveDesignElement = false; + _this.detailPanel.showTitle = false; + _this.registerFunctionOnPropertyValueChanged("columns", function (newColumns) { + _this.updateColumnsAndRows(); + }); + _this.registerFunctionOnPropertyValueChanged("cellType", function () { + _this.updateColumnsAndRows(); + }); + _this.registerFunctionOnPropertiesValueChanged(["optionsCaption", "columnColCount", "rowTitleWidth", "choices"], function () { + _this.clearRowsAndResetRenderedTable(); + }); + _this.registerFunctionOnPropertiesValueChanged([ + "columnLayout", + "addRowLocation", + "hideColumnsIfEmpty", + "showHeader", + "minRowCount", + "isReadOnly", + "rowCount", + "hasFooter", + "detailPanelMode", + ], function () { + _this.resetRenderedTable(); + }); + _this.registerFunctionOnPropertiesValueChanged([ + "isMobile" + ], function () { + if (_this.columnLayout === "vertical") { + _this.resetRenderedTable(); + } + }); + return _this; + } + Object.defineProperty(QuestionMatrixDropdownModelBase, "defaultCellType", { + get: function () { + return _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].matrixDefaultCellType; + }, + set: function (val) { + _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].matrixDefaultCellType = val; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.addDefaultColumns = function (matrix) { + var colNames = _questionfactory__WEBPACK_IMPORTED_MODULE_7__["QuestionFactory"].DefaultColums; + for (var i = 0; i < colNames.length; i++) + matrix.addColumn(colNames[i]); + }; + QuestionMatrixDropdownModelBase.prototype.createColumnValues = function () { + var _this = this; + return this.createNewArray("columns", function (item) { + item.colOwner = _this; + }, function (item) { + item.colOwner = null; + }); + }; + QuestionMatrixDropdownModelBase.prototype.getType = function () { + return "matrixdropdownbase"; + }; + QuestionMatrixDropdownModelBase.prototype.dispose = function () { + _super.prototype.dispose.call(this); + this.clearGeneratedRows(); + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "hasSingleInput", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "isRowsDynamic", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "isUpdateLocked", { + get: function () { + return this.isLoadingFromJson || this.isUpdating; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.beginUpdate = function () { + this.isUpdating = true; + }; + QuestionMatrixDropdownModelBase.prototype.endUpdate = function () { + this.isUpdating = false; + this.updateColumnsAndRows(); + }; + QuestionMatrixDropdownModelBase.prototype.updateColumnsAndRows = function () { + this.updateColumnsIndexes(this.columns); + this.updateColumnsCellType(); + this.generatedTotalRow = null; + this.clearRowsAndResetRenderedTable(); + }; + QuestionMatrixDropdownModelBase.prototype.itemValuePropertyChanged = function (item, name, oldValue, newValue) { + _super.prototype.itemValuePropertyChanged.call(this, item, name, oldValue, newValue); + if (item.ownerPropertyName === "choices") { + this.clearRowsAndResetRenderedTable(); + } + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "columnLayout", { + /** + * Set columnLayout to 'vertical' to place columns vertically and rows horizontally. It makes sense when we have many columns and few rows. + * @see columns + * @see rowCount + */ + get: function () { + return this.getPropertyValue("columnLayout"); + }, + set: function (val) { + this.setPropertyValue("columnLayout", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "columnsLocation", { + get: function () { + return this.columnLayout; + }, + set: function (val) { + this.columnLayout = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "isColumnLayoutHorizontal", { + /** + * Returns true if columns are located horizontally + * @see columnLayout + */ + get: function () { + if (this.isMobile) + return true; + return this.columnLayout != "vertical"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "detailPanelMode", { + /** + * Set the value to "underRow" to show the detailPanel under the row. + */ + get: function () { + return this.getPropertyValue("detailPanelMode"); + }, + set: function (val) { + this.setPropertyValue("detailPanelMode", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "detailPanel", { + /** + * The detail template Panel. This panel is used as a template on creating detail panel for a row. + * @see detailElements + * @see detailPanelMode + */ + get: function () { + return this.detailPanelValue; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.getPanel = function () { + return this.detailPanel; + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "detailElements", { + /** + * The template Panel elements, questions and panels. + * @see detailPanel + * @see detailPanelMode + */ + get: function () { + return this.detailPanel.elements; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.createNewDetailPanel = function () { + return _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].createClass("panel"); + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "hasRowText", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.getFooterText = function () { + return null; + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "canAddRow", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "canRemoveRows", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.canRemoveRow = function (row) { + return true; + }; + QuestionMatrixDropdownModelBase.prototype.onPointerDown = function (pointerDownEvent, row) { }; + QuestionMatrixDropdownModelBase.prototype.onRowsChanged = function () { + this.resetRenderedTable(); + _super.prototype.onRowsChanged.call(this); + }; + QuestionMatrixDropdownModelBase.prototype.onStartRowAddingRemoving = function () { + this.lockResetRenderedTable = true; + }; + QuestionMatrixDropdownModelBase.prototype.onEndRowAdding = function () { + this.lockResetRenderedTable = false; + if (!this.renderedTable) + return; + if (this.renderedTable.isRequireReset()) { + this.resetRenderedTable(); + } + else { + this.renderedTable.onAddedRow(); + } + }; + QuestionMatrixDropdownModelBase.prototype.onEndRowRemoving = function (row) { + this.lockResetRenderedTable = false; + if (this.renderedTable.isRequireReset()) { + this.resetRenderedTable(); + } + else { + if (!!row) { + this.renderedTable.onRemovedRow(row); + } + } + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "renderedTableValue", { + get: function () { + return this.getPropertyValue("renderedTable", null); + }, + set: function (val) { + this.setPropertyValue("renderedTable", val); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.clearRowsAndResetRenderedTable = function () { + this.clearGeneratedRows(); + this.resetRenderedTable(); + this.fireCallback(this.columnsChangedCallback); + }; + QuestionMatrixDropdownModelBase.prototype.resetRenderedTable = function () { + if (this.lockResetRenderedTable || this.isUpdateLocked) + return; + this.renderedTableValue = null; + this.fireCallback(this.onRenderedTableResetCallback); + }; + QuestionMatrixDropdownModelBase.prototype.clearGeneratedRows = function () { + if (!this.generatedVisibleRows) + return; + for (var i = 0; i < this.generatedVisibleRows.length; i++) { + this.generatedVisibleRows[i].dispose(); + } + _super.prototype.clearGeneratedRows.call(this); + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "renderedTable", { + get: function () { + if (!this.renderedTableValue) { + this.renderedTableValue = this.createRenderedTable(); + if (!!this.onRenderedTableCreatedCallback) { + this.onRenderedTableCreatedCallback(this.renderedTableValue); + } + } + return this.renderedTableValue; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.createRenderedTable = function () { + return new _question_matrixdropdownrendered__WEBPACK_IMPORTED_MODULE_13__["QuestionMatrixDropdownRenderedTable"](this); + }; + QuestionMatrixDropdownModelBase.prototype.onMatrixRowCreated = function (row) { + if (!this.survey) + return; + var options = { + rowValue: row.value, + row: row, + column: null, + columnName: null, + cell: null, + cellQuestion: null, + value: null, + }; + for (var i = 0; i < this.visibleColumns.length; i++) { + options.column = this.visibleColumns[i]; + options.columnName = options.column.name; + var cell = row.cells[i]; + options.cell = cell; + options.cellQuestion = cell.question; + options.value = cell.value; + if (!!this.onCellCreatedCallback) { + this.onCellCreatedCallback(options); + } + this.survey.matrixCellCreated(this, options); + } + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "cellType", { + /** + * Use this property to change the default cell type. + */ + get: function () { + return this.getPropertyValue("cellType", _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].matrixDefaultCellType); + }, + set: function (val) { + val = val.toLowerCase(); + this.setPropertyValue("cellType", val); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.updateColumnsCellType = function () { + for (var i = 0; i < this.columns.length; i++) { + this.columns[i].defaultCellTypeChanged(); + } + }; + QuestionMatrixDropdownModelBase.prototype.updateColumnsIndexes = function (cols) { + for (var i = 0; i < cols.length; i++) { + cols[i].setIndex(i); + } + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "columnColCount", { + /** + * The default column count for radiogroup and checkbox cell types. + */ + get: function () { + return this.getPropertyValue("columnColCount"); + }, + set: function (value) { + if (value < 0 || value > 4) + return; + this.setPropertyValue("columnColCount", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "columnMinWidth", { + /** + * Use this property to set the minimum column width. + */ + get: function () { + return this.getPropertyValue("columnMinWidth", ""); + }, + set: function (val) { + this.setPropertyValue("columnMinWidth", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "horizontalScroll", { + /** + * Set this property to true to show the horizontal scroll. + */ + get: function () { + return this.getPropertyValue("horizontalScroll", false); + }, + set: function (val) { + this.setPropertyValue("horizontalScroll", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "allowAdaptiveActions", { + /** + * The Matrix toolbar and inner panel toolbars get adaptive if the property is set to true. + */ + get: function () { + return this.getPropertyValue("allowAdaptiveActions"); + }, + set: function (val) { + this.setPropertyValue("allowAdaptiveActions", val); + if (!!this.detailPanel) { + this.detailPanel.allowAdaptiveActions = val; + } + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.getRequiredText = function () { + return this.survey ? this.survey.requiredText : ""; + }; + QuestionMatrixDropdownModelBase.prototype.onColumnPropertyChanged = function (column, name, newValue) { + this.updateHasFooter(); + if (!this.generatedVisibleRows) + return; + for (var i = 0; i < this.generatedVisibleRows.length; i++) { + this.generatedVisibleRows[i].updateCellQuestionOnColumnChanged(column, name, newValue); + } + if (!!this.generatedTotalRow) { + this.generatedTotalRow.updateCellQuestionOnColumnChanged(column, name, newValue); + } + this.onColumnsChanged(); + if (name == "isRequired") { + this.resetRenderedTable(); + } + if (column.isShowInMultipleColumns) { + this.onShowInMultipleColumnsChanged(column); + } + }; + QuestionMatrixDropdownModelBase.prototype.onColumnItemValuePropertyChanged = function (column, propertyName, obj, name, newValue, oldValue) { + if (!this.generatedVisibleRows) + return; + for (var i = 0; i < this.generatedVisibleRows.length; i++) { + this.generatedVisibleRows[i].updateCellQuestionOnColumnItemValueChanged(column, propertyName, obj, name, newValue, oldValue); + } + }; + QuestionMatrixDropdownModelBase.prototype.onShowInMultipleColumnsChanged = function (column) { + this.clearGeneratedRows(); + this.resetRenderedTable(); + }; + QuestionMatrixDropdownModelBase.prototype.onColumnCellTypeChanged = function (column) { + this.clearGeneratedRows(); + this.resetRenderedTable(); + }; + QuestionMatrixDropdownModelBase.prototype.getRowTitleWidth = function () { + return ""; + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "hasFooter", { + get: function () { + return this.getPropertyValue("hasFooter", false); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.getAddRowLocation = function () { + return "default"; + }; + QuestionMatrixDropdownModelBase.prototype.getShowColumnsIfEmpty = function () { + return false; + }; + QuestionMatrixDropdownModelBase.prototype.updateShowTableAndAddRow = function () { + if (!!this.renderedTable) { + this.renderedTable.updateShowTableAndAddRow(); + } + }; + QuestionMatrixDropdownModelBase.prototype.updateHasFooter = function () { + this.setPropertyValue("hasFooter", this.hasTotal); + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "hasTotal", { + get: function () { + for (var i = 0; i < this.columns.length; i++) { + if (this.columns[i].hasTotal) + return true; + } + return false; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.getCellType = function () { + return this.cellType; + }; + QuestionMatrixDropdownModelBase.prototype.getCustomCellType = function (column, row, cellType) { + if (!this.survey) + return cellType; + var options = { + rowValue: row.value, + row: row, + column: column, + columnName: column.name, + cellType: cellType + }; + this.survey.matrixCellCreating(this, options); + return options.cellType; + }; + QuestionMatrixDropdownModelBase.prototype.getConditionJson = function (operator, path) { + if (operator === void 0) { operator = null; } + if (path === void 0) { path = null; } + if (!path) + return _super.prototype.getConditionJson.call(this); + var columnName = ""; + for (var i = path.length - 1; i >= 0; i--) { + if (path[i] == ".") + break; + columnName = path[i] + columnName; + } + var column = this.getColumnByName(columnName); + if (!column) + return null; + var question = column.createCellQuestion(null); + if (!question) + return null; + return question.getConditionJson(operator); + }; + QuestionMatrixDropdownModelBase.prototype.clearIncorrectValues = function () { + var rows = this.visibleRows; + if (!rows) + return; + for (var i = 0; i < rows.length; i++) { + rows[i].clearIncorrectValues(this.getRowValue(i)); + } + }; + QuestionMatrixDropdownModelBase.prototype.clearErrors = function () { + _super.prototype.clearErrors.call(this); + this.runFuncForCellQuestions(function (q) { q.clearErrors(); }); + }; + QuestionMatrixDropdownModelBase.prototype.localeChanged = function () { + _super.prototype.localeChanged.call(this); + this.runFuncForCellQuestions(function (q) { q.localeChanged(); }); + }; + QuestionMatrixDropdownModelBase.prototype.runFuncForCellQuestions = function (func) { + if (!!this.generatedVisibleRows) { + for (var i = 0; i < this.generatedVisibleRows.length; i++) { + var row = this.generatedVisibleRows[i]; + for (var j = 0; j < row.cells.length; j++) { + func(row.cells[j].question); + } + } + } + }; + QuestionMatrixDropdownModelBase.prototype.runCondition = function (values, properties) { + _super.prototype.runCondition.call(this, values, properties); + var counter = 0; + var prevTotalValue; + do { + prevTotalValue = _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].getUnbindValue(this.totalValue); + this.runCellsCondition(values, properties); + this.runTotalsCondition(values, properties); + counter++; + } while (!_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isTwoValueEquals(prevTotalValue, this.totalValue) && + counter < 3); + }; + QuestionMatrixDropdownModelBase.prototype.shouldRunColumnExpression = function () { + return false; + }; + QuestionMatrixDropdownModelBase.prototype.runCellsCondition = function (values, properties) { + if (!this.generatedVisibleRows) + return; + var newValues = this.getRowConditionValues(values); + var rows = this.generatedVisibleRows; + for (var i = 0; i < rows.length; i++) { + rows[i].runCondition(newValues, properties); + } + this.checkColumnsVisibility(); + }; + QuestionMatrixDropdownModelBase.prototype.checkColumnsVisibility = function () { + var hasChanged = false; + for (var i = 0; i < this.visibleColumns.length; i++) { + if (!this.visibleColumns[i].visibleIf) + continue; + hasChanged = + this.isColumnVisibilityChanged(this.visibleColumns[i]) || hasChanged; + } + if (hasChanged) { + this.resetRenderedTable(); + } + }; + QuestionMatrixDropdownModelBase.prototype.isColumnVisibilityChanged = function (column) { + var curVis = column.hasVisibleCell; + var hasVisCell = false; + var rows = this.generatedVisibleRows; + for (var i = 0; i < rows.length; i++) { + var cell = rows[i].cells[column.index]; + if (!!cell && !!cell.question && cell.question.isVisible) { + hasVisCell = true; + break; + } + } + if (curVis != hasVisCell) { + column.hasVisibleCell = hasVisCell; + } + return curVis != hasVisCell; + }; + QuestionMatrixDropdownModelBase.prototype.runTotalsCondition = function (values, properties) { + if (!this.generatedTotalRow) + return; + this.generatedTotalRow.runCondition(this.getRowConditionValues(values), properties); + }; + QuestionMatrixDropdownModelBase.prototype.getRowConditionValues = function (values) { + var newValues = values; + if (!newValues) + newValues = {}; + /* + var newValues: { [index: string]: any } = {}; + if (values && values instanceof Object) { + newValues = JSON.parse(JSON.stringify(values)); + } + */ + var totalRow = {}; + if (!this.isValueEmpty(this.totalValue)) { + totalRow = JSON.parse(JSON.stringify(this.totalValue)); + } + newValues["row"] = {}; + newValues["totalRow"] = totalRow; + return newValues; + }; + QuestionMatrixDropdownModelBase.prototype.locStrsChanged = function () { + _super.prototype.locStrsChanged.call(this); + var columns = this.columns; + for (var i = 0; i < columns.length; i++) { + columns[i].locStrsChanged(); + } + var rows = this.generatedVisibleRows; + if (!rows) + return; + for (var i = 0; i < rows.length; i++) { + rows[i].locStrsChanged(); + } + if (!!this.generatedTotalRow) { + this.generatedTotalRow.locStrsChanged(); + } + }; + /** + * Returns the column by it's name. Returns null if a column with this name doesn't exist. + * @param column + */ + QuestionMatrixDropdownModelBase.prototype.getColumnByName = function (columnName) { + for (var i = 0; i < this.columns.length; i++) { + if (this.columns[i].name == columnName) + return this.columns[i]; + } + return null; + }; + QuestionMatrixDropdownModelBase.prototype.getColumnName = function (columnName) { + return this.getColumnByName(columnName); + }; + /** + * Returns the column width. + * @param column + */ + QuestionMatrixDropdownModelBase.prototype.getColumnWidth = function (column) { + return column.minWidth ? column.minWidth : this.columnMinWidth; + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "choices", { + /** + * The default choices for dropdown, checkbox and radiogroup cell types. + */ + get: function () { + return this.getPropertyValue("choices"); + }, + set: function (val) { + this.setPropertyValue("choices", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "optionsCaption", { + /** + * The default options caption for dropdown cell type. + */ + get: function () { + return this.getLocalizableStringText("optionsCaption"); + }, + set: function (val) { + this.setLocalizableStringText("optionsCaption", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "locOptionsCaption", { + get: function () { + return this.getLocalizableString("optionsCaption"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "keyDuplicationError", { + /** + * The duplication value error text. Set it to show the text different from the default. + * @see MatrixDropdownColumn.isUnique + */ + get: function () { + return this.getLocalizableStringText("keyDuplicationError"); + }, + set: function (val) { + this.setLocalizableStringText("keyDuplicationError", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "locKeyDuplicationError", { + get: function () { + return this.getLocalizableString("keyDuplicationError"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "storeOthersAsComment", { + get: function () { + return !!this.survey ? this.survey.storeOthersAsComment : false; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.addColumn = function (name, title) { + if (title === void 0) { title = null; } + var column = new _question_matrixdropdowncolumn__WEBPACK_IMPORTED_MODULE_12__["MatrixDropdownColumn"](name, title); + this.columns.push(column); + return column; + }; + QuestionMatrixDropdownModelBase.prototype.getVisibleRows = function () { + var _this = this; + if (this.isUpdateLocked) + return null; + if (!this.generatedVisibleRows) { + this.generatedVisibleRows = this.generateRows(); + this.generatedVisibleRows.forEach(function (row) { return _this.onMatrixRowCreated(row); }); + if (this.data) { + this.runCellsCondition(this.data.getFilteredValues(), this.data.getFilteredProperties()); + } + this.updateValueOnRowsGeneration(this.generatedVisibleRows); + this.updateIsAnswered(); + } + return this.generatedVisibleRows; + }; + QuestionMatrixDropdownModelBase.prototype.updateValueOnRowsGeneration = function (rows) { + var oldValue = this.createNewValue(true); + var newValue = this.createNewValue(); + for (var i = 0; i < rows.length; i++) { + var row = rows[i]; + if (!!row.editingObj) + continue; + var rowValue = this.getRowValue(i); + var rValue = row.value; + if (this.isTwoValueEquals(rowValue, rValue)) + continue; + newValue = this.getNewValueOnRowChanged(row, "", rValue, false, newValue) + .value; + } + if (this.isTwoValueEquals(oldValue, newValue)) + return; + this.isRowChanging = true; + this.setNewValue(newValue); + this.isRowChanging = false; + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "totalValue", { + get: function () { + if (!this.hasTotal || !this.visibleTotalRow) + return {}; + return this.visibleTotalRow.value; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.getVisibleTotalRow = function () { + if (this.isUpdateLocked) + return null; + if (this.hasTotal) { + if (!this.generatedTotalRow) { + this.generatedTotalRow = this.generateTotalRow(); + if (this.data) { + var properties = { survey: this.survey }; + this.runTotalsCondition(this.data.getAllValues(), properties); + } + } + } + else { + this.generatedTotalRow = null; + } + return this.generatedTotalRow; + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "visibleTotalRow", { + get: function () { + return this.getVisibleTotalRow(); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.onSurveyLoad = function () { + _super.prototype.onSurveyLoad.call(this); + this.updateColumnsIndexes(this.columns); + this.clearGeneratedRows(); + this.generatedTotalRow = null; + this.updateHasFooter(); + }; + /** + * Returns the row value. If the row value is empty, the object is empty: {}. + * @param rowIndex row index from 0 to visible row count - 1. + */ + QuestionMatrixDropdownModelBase.prototype.getRowValue = function (rowIndex) { + if (rowIndex < 0) + return null; + var visRows = this.visibleRows; + if (rowIndex >= visRows.length) + return null; + var newValue = this.createNewValue(); + return this.getRowValueCore(visRows[rowIndex], newValue); + }; + QuestionMatrixDropdownModelBase.prototype.checkIfValueInRowDuplicated = function (checkedRow, cellQuestion) { + if (!this.generatedVisibleRows) + return false; + var res = false; + for (var i = 0; i < this.generatedVisibleRows.length; i++) { + var row = this.generatedVisibleRows[i]; + if (checkedRow === row) + continue; + if (row.getValue(cellQuestion.name) == cellQuestion.value) { + res = true; + break; + } + } + if (res) { + this.addDuplicationError(cellQuestion); + } + else { + cellQuestion.clearErrors(); + } + return res; + }; + /** + * Set the row value. + * @param rowIndex row index from 0 to visible row count - 1. + * @param rowValue an object {"column name": columnValue,... } + */ + QuestionMatrixDropdownModelBase.prototype.setRowValue = function (rowIndex, rowValue) { + if (rowIndex < 0) + return null; + var visRows = this.visibleRows; + if (rowIndex >= visRows.length) + return null; + visRows[rowIndex].value = rowValue; + this.onRowChanged(visRows[rowIndex], "", rowValue, false); + }; + QuestionMatrixDropdownModelBase.prototype.generateRows = function () { + return null; + }; + QuestionMatrixDropdownModelBase.prototype.generateTotalRow = function () { + return new MatrixDropdownTotalRowModel(this); + }; + QuestionMatrixDropdownModelBase.prototype.createNewValue = function (nullOnEmpty) { + if (nullOnEmpty === void 0) { nullOnEmpty = false; } + var res = !this.value ? {} : this.createValueCopy(); + if (nullOnEmpty && this.isMatrixValueEmpty(res)) + return null; + return res; + }; + QuestionMatrixDropdownModelBase.prototype.getRowValueCore = function (row, questionValue, create) { + if (create === void 0) { create = false; } + var result = !!questionValue && !!questionValue[row.rowName] + ? questionValue[row.rowName] + : null; + if (!result && create) { + result = {}; + if (!!questionValue) { + questionValue[row.rowName] = result; + } + } + return result; + }; + QuestionMatrixDropdownModelBase.prototype.getRowObj = function (row) { + var obj = this.getRowValueCore(row, this.value); + return !!obj && !!obj.getType ? obj : null; + }; + QuestionMatrixDropdownModelBase.prototype.getRowDisplayValue = function (keysAsText, row, rowValue) { + if (!rowValue) + return rowValue; + if (!!row.editingObj) + return rowValue; + var keys = Object.keys(rowValue); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var question = row.getQuestionByName(key); + if (!question) { + question = this.getSharedQuestionByName(key, row); + } + if (!!question) { + var displayvalue = question.getDisplayValue(keysAsText, rowValue[key]); + if (keysAsText && !!question.title && question.title !== key) { + rowValue[question.title] = displayvalue; + delete rowValue[key]; + } + else { + rowValue[key] = displayvalue; + } + } + } + return rowValue; + }; + QuestionMatrixDropdownModelBase.prototype.getPlainData = function (options) { + var _this = this; + if (options === void 0) { options = { + includeEmpty: true, + }; } + var questionPlainData = _super.prototype.getPlainData.call(this, options); + if (!!questionPlainData) { + questionPlainData.isNode = true; + questionPlainData.data = this.visibleRows.map(function (row) { + var rowDataItem = { + name: row.rowName, + title: row.text, + value: row.value, + displayValue: _this.getRowDisplayValue(false, row, row.value), + getString: function (val) { + return typeof val === "object" ? JSON.stringify(val) : val; + }, + isNode: true, + data: row.cells + .map(function (cell) { + return cell.question.getPlainData(options); + }) + .filter(function (d) { return !!d; }), + }; + (options.calculations || []).forEach(function (calculation) { + rowDataItem[calculation.propertyName] = row[calculation.propertyName]; + }); + return rowDataItem; + }); + } + return questionPlainData; + }; + QuestionMatrixDropdownModelBase.prototype.addConditionObjectsByContext = function (objects, context) { + var hasContext = !!context ? context === true || this.columns.indexOf(context) > -1 : false; + var rowsIndeces = this.getConditionObjectsRowIndeces(); + if (hasContext) { + rowsIndeces.push(-1); + } + for (var i = 0; i < rowsIndeces.length; i++) { + var index = rowsIndeces[i]; + var rowName = index > -1 ? this.getConditionObjectRowName(index) : "row"; + if (!rowName) + continue; + var rowText = index > -1 ? this.getConditionObjectRowText(index) : "row"; + var hasQuestionPrefix = index > -1 || context === true; + var dot = hasQuestionPrefix && index === -1 ? "." : ""; + var prefixName = (hasQuestionPrefix ? this.getValueName() : "") + dot + rowName + "."; + var prefixTitle = (hasQuestionPrefix ? this.processedTitle : "") + dot + rowText + "."; + for (var j = 0; j < this.columns.length; j++) { + var column = this.columns[j]; + if (index === -1 && context === column) + continue; + var obj = { + name: prefixName + column.name, + text: prefixTitle + column.fullTitle, + question: this + }; + if (index === -1 && context === true) { + obj.context = this; + } + objects.push(obj); + } + } + }; + QuestionMatrixDropdownModelBase.prototype.getConditionObjectRowName = function (index) { + return ""; + }; + QuestionMatrixDropdownModelBase.prototype.getConditionObjectRowText = function (index) { + return this.getConditionObjectRowName(index); + }; + QuestionMatrixDropdownModelBase.prototype.getConditionObjectsRowIndeces = function () { + return []; + }; + QuestionMatrixDropdownModelBase.prototype.getProgressInfo = function () { + if (!!this.generatedVisibleRows) + return _survey_element__WEBPACK_IMPORTED_MODULE_4__["SurveyElement"].getProgressInfoByElements(this.getCellQuestions(), this.isRequired); + var res = _base__WEBPACK_IMPORTED_MODULE_3__["Base"].createProgressInfo(); + this.updateProgressInfoByValues(res); + return res; + }; + QuestionMatrixDropdownModelBase.prototype.updateProgressInfoByValues = function (res) { }; + QuestionMatrixDropdownModelBase.prototype.updateProgressInfoByRow = function (res, rowValue) { + res.questionCount += this.columns.length; + for (var i = 0; i < this.columns.length; i++) { + var col = this.columns[i]; + res.requiredQuestionCount += col.isRequired; + var hasValue = !_helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].isValueEmpty(rowValue[col.name]); + res.answeredQuestionCount += hasValue ? 1 : 0; + res.requiredAnsweredQuestionCount += hasValue && col.isRequired ? 1 : 0; + } + }; + QuestionMatrixDropdownModelBase.prototype.getCellQuestions = function () { + var res = []; + this.runFuncForCellQuestions(function (q) { res.push(q); }); + return res; + }; + QuestionMatrixDropdownModelBase.prototype.onBeforeValueChanged = function (val) { }; + QuestionMatrixDropdownModelBase.prototype.onSetQuestionValue = function () { + if (this.isRowChanging) + return; + this.onBeforeValueChanged(this.value); + if (!this.generatedVisibleRows || this.generatedVisibleRows.length == 0) + return; + this.isRowChanging = true; + var val = this.createNewValue(); + for (var i = 0; i < this.generatedVisibleRows.length; i++) { + var row = this.generatedVisibleRows[i]; + this.generatedVisibleRows[i].value = this.getRowValueCore(row, val); + } + this.isRowChanging = false; + }; + QuestionMatrixDropdownModelBase.prototype.setQuestionValue = function (newValue) { + _super.prototype.setQuestionValue.call(this, newValue, false); + this.onSetQuestionValue(); + this.updateIsAnswered(); + }; + QuestionMatrixDropdownModelBase.prototype.supportGoNextPageAutomatic = function () { + var rows = this.generatedVisibleRows; + if (!rows) + rows = this.visibleRows; + if (!rows) + return true; + for (var i = 0; i < rows.length; i++) { + var cells = this.generatedVisibleRows[i].cells; + if (!cells) + continue; + for (var colIndex = 0; colIndex < cells.length; colIndex++) { + var question = cells[colIndex].question; + if (question && + (!question.supportGoNextPageAutomatic() || !question.value)) + return false; + } + } + return true; + }; + QuestionMatrixDropdownModelBase.prototype.getContainsErrors = function () { + return (_super.prototype.getContainsErrors.call(this) || + this.checkForAnswersOrErrors(function (question) { return question.containsErrors; }, false)); + }; + QuestionMatrixDropdownModelBase.prototype.getIsAnswered = function () { + return (_super.prototype.getIsAnswered.call(this) && + this.checkForAnswersOrErrors(function (question) { return question.isAnswered; }, true)); + }; + QuestionMatrixDropdownModelBase.prototype.checkForAnswersOrErrors = function (predicate, every) { + if (every === void 0) { every = false; } + var rows = this.generatedVisibleRows; + if (!rows) + return false; + for (var i = 0; i < rows.length; i++) { + var cells = rows[i].cells; + if (!cells) + continue; + for (var colIndex = 0; colIndex < cells.length; colIndex++) { + if (!cells[colIndex]) + continue; + var question = cells[colIndex].question; + if (question && question.isVisible) + if (predicate(question)) { + if (!every) + return true; + } + else { + if (every) + return false; + } + } + } + return every ? true : false; + }; + QuestionMatrixDropdownModelBase.prototype.hasErrors = function (fireCallback, rec) { + if (fireCallback === void 0) { fireCallback = true; } + if (rec === void 0) { rec = null; } + var errosInRows = this.hasErrorInRows(fireCallback, rec); + var isDuplicated = this.isValueDuplicated(); + return _super.prototype.hasErrors.call(this, fireCallback, rec) || errosInRows || isDuplicated; + }; + QuestionMatrixDropdownModelBase.prototype.getIsRunningValidators = function () { + if (_super.prototype.getIsRunningValidators.call(this)) + return true; + if (!this.generatedVisibleRows) + return false; + for (var i = 0; i < this.generatedVisibleRows.length; i++) { + var cells = this.generatedVisibleRows[i].cells; + if (!cells) + continue; + for (var colIndex = 0; colIndex < cells.length; colIndex++) { + if (!cells[colIndex]) + continue; + var question = cells[colIndex].question; + if (!!question && question.isRunningValidators) + return true; + } + } + return false; + }; + QuestionMatrixDropdownModelBase.prototype.getAllErrors = function () { + var result = _super.prototype.getAllErrors.call(this); + var rows = this.generatedVisibleRows; + if (rows === null) + return result; + for (var i = 0; i < rows.length; i++) { + var row = rows[i]; + for (var j = 0; j < row.cells.length; j++) { + var errors = row.cells[j].question.getAllErrors(); + if (errors && errors.length > 0) { + result = result.concat(errors); + } + } + } + return result; + }; + QuestionMatrixDropdownModelBase.prototype.hasErrorInRows = function (fireCallback, rec) { + var _this = this; + var rows = this.generatedVisibleRows; + if (!this.generatedVisibleRows) { + rows = this.visibleRows; + } + var res = false; + if (!rec) + rec = {}; + if (!rows) + return rec; + rec.isSingleDetailPanel = this.detailPanelMode === "underRowSingle"; + for (var i = 0; i < rows.length; i++) { + res = rows[i].hasErrors(fireCallback, rec, function () { + _this.raiseOnCompletedAsyncValidators(); + }) || res; + } + return res; + }; + QuestionMatrixDropdownModelBase.prototype.isValueDuplicated = function () { + if (!this.generatedVisibleRows) + return false; + var columns = this.getUniqueColumns(); + var res = false; + for (var i = 0; i < columns.length; i++) { + res = this.isValueInColumnDuplicated(columns[i]) || res; + } + return res; + }; + QuestionMatrixDropdownModelBase.prototype.isValueInColumnDuplicated = function (column) { + var keyValues = []; + var res = false; + for (var i = 0; i < this.generatedVisibleRows.length; i++) { + res = + this.isValueDuplicatedInRow(this.generatedVisibleRows[i], column, keyValues) || res; + } + return res; + }; + QuestionMatrixDropdownModelBase.prototype.getUniqueColumns = function () { + var res = new Array(); + for (var i = 0; i < this.columns.length; i++) { + if (this.columns[i].isUnique) { + res.push(this.columns[i]); + } + } + return res; + }; + QuestionMatrixDropdownModelBase.prototype.isValueDuplicatedInRow = function (row, column, keyValues) { + var question = row.getQuestionByColumn(column); + if (!question || question.isEmpty()) + return false; + var value = question.value; + for (var i = 0; i < keyValues.length; i++) { + if (value == keyValues[i]) { + this.addDuplicationError(question); + return true; + } + } + keyValues.push(value); + return false; + }; + QuestionMatrixDropdownModelBase.prototype.addDuplicationError = function (question) { + question.addError(new _error__WEBPACK_IMPORTED_MODULE_10__["KeyDuplicationError"](this.keyDuplicationError, this)); + }; + QuestionMatrixDropdownModelBase.prototype.getFirstInputElementId = function () { + var question = this.getFirstCellQuestion(false); + return question ? question.inputId : _super.prototype.getFirstInputElementId.call(this); + }; + QuestionMatrixDropdownModelBase.prototype.getFirstErrorInputElementId = function () { + var question = this.getFirstCellQuestion(true); + return question ? question.inputId : _super.prototype.getFirstErrorInputElementId.call(this); + }; + QuestionMatrixDropdownModelBase.prototype.getFirstCellQuestion = function (onError) { + if (!this.generatedVisibleRows) + return null; + for (var i = 0; i < this.generatedVisibleRows.length; i++) { + var cells = this.generatedVisibleRows[i].cells; + for (var colIndex = 0; colIndex < cells.length; colIndex++) { + if (!onError) + return cells[colIndex].question; + if (cells[colIndex].question.currentErrorCount > 0) + return cells[colIndex].question; + } + } + return null; + }; + QuestionMatrixDropdownModelBase.prototype.onReadOnlyChanged = function () { + _super.prototype.onReadOnlyChanged.call(this); + if (!this.generateRows) + return; + for (var i = 0; i < this.visibleRows.length; i++) { + this.visibleRows[i].onQuestionReadOnlyChanged(this.isReadOnly); + } + }; + //IMatrixDropdownData + QuestionMatrixDropdownModelBase.prototype.createQuestion = function (row, column) { + return this.createQuestionCore(row, column); + }; + QuestionMatrixDropdownModelBase.prototype.createQuestionCore = function (row, column) { + var question = column.createCellQuestion(row); + question.setSurveyImpl(row); + question.setParentQuestion(this); + return question; + }; + QuestionMatrixDropdownModelBase.prototype.deleteRowValue = function (newValue, row) { + if (!newValue) + return newValue; + delete newValue[row.rowName]; + return this.isObject(newValue) && Object.keys(newValue).length == 0 + ? null + : newValue; + }; + QuestionMatrixDropdownModelBase.prototype.onAnyValueChanged = function (name) { + if (this.isUpdateLocked || + this.isDoingonAnyValueChanged || + !this.generatedVisibleRows) + return; + this.isDoingonAnyValueChanged = true; + var rows = this.visibleRows; + for (var i = 0; i < rows.length; i++) { + rows[i].onAnyValueChanged(name); + } + var totalRow = this.visibleTotalRow; + if (!!totalRow) { + totalRow.onAnyValueChanged(name); + } + this.isDoingonAnyValueChanged = false; + }; + QuestionMatrixDropdownModelBase.prototype.isObject = function (value) { + return value !== null && typeof value === "object"; + }; + QuestionMatrixDropdownModelBase.prototype.getOnCellValueChangedOptions = function (row, columnName, rowValue) { + var getQuestion = function (colName) { + for (var i = 0; i < row.cells.length; i++) { + var col = row.cells[i].column; + if (!!col && col.name === colName) { + return row.cells[i].question; + } + } + return null; + }; + return { + row: row, + columnName: columnName, + rowValue: rowValue, + value: !!rowValue ? rowValue[columnName] : null, + getCellQuestion: getQuestion, + }; + }; + QuestionMatrixDropdownModelBase.prototype.onCellValueChanged = function (row, columnName, rowValue) { + if (!this.survey) + return; + var options = this.getOnCellValueChangedOptions(row, columnName, rowValue); + if (!!this.onCellValueChangedCallback) { + this.onCellValueChangedCallback(options); + } + this.survey.matrixCellValueChanged(this, options); + }; + QuestionMatrixDropdownModelBase.prototype.validateCell = function (row, columnName, rowValue) { + if (!this.survey) + return; + var options = this.getOnCellValueChangedOptions(row, columnName, rowValue); + return this.survey.matrixCellValidate(this, options); + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "isValidateOnValueChanging", { + get: function () { + return !!this.survey ? this.survey.isValidateOnValueChanging : false; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.onRowChanging = function (row, columnName, rowValue) { + if (!this.survey) + return !!rowValue ? rowValue[columnName] : null; + var options = this.getOnCellValueChangedOptions(row, columnName, rowValue); + var oldRowValue = this.getRowValueCore(row, this.createNewValue(), true); + options.oldValue = !!oldRowValue ? oldRowValue[columnName] : null; + this.survey.matrixCellValueChanging(this, options); + return options.value; + }; + QuestionMatrixDropdownModelBase.prototype.onRowChanged = function (row, columnName, newRowValue, isDeletingValue) { + var rowObj = !!columnName ? this.getRowObj(row) : null; + if (!!rowObj) { + var columnValue = null; + if (!!newRowValue && !isDeletingValue) { + columnValue = newRowValue[columnName]; + } + this.isRowChanging = true; + rowObj[columnName] = columnValue; + this.isRowChanging = false; + this.onCellValueChanged(row, columnName, rowObj); + } + else { + var oldValue = this.createNewValue(true); + var combine = this.getNewValueOnRowChanged(row, columnName, newRowValue, isDeletingValue, this.createNewValue()); + if (this.isTwoValueEquals(oldValue, combine.value)) + return; + this.isRowChanging = true; + this.setNewValue(combine.value); + this.isRowChanging = false; + if (columnName) { + this.onCellValueChanged(row, columnName, combine.rowValue); + } + } + }; + QuestionMatrixDropdownModelBase.prototype.getNewValueOnRowChanged = function (row, columnName, newRowValue, isDeletingValue, newValue) { + var rowValue = this.getRowValueCore(row, newValue, true); + if (isDeletingValue) { + delete rowValue[columnName]; + } + for (var i = 0; i < row.cells.length; i++) { + var key = row.cells[i].question.getValueName(); + delete rowValue[key]; + } + if (newRowValue) { + newRowValue = JSON.parse(JSON.stringify(newRowValue)); + for (var key in newRowValue) { + if (!this.isValueEmpty(newRowValue[key])) { + rowValue[key] = newRowValue[key]; + } + } + } + if (this.isObject(rowValue) && Object.keys(rowValue).length === 0) { + newValue = this.deleteRowValue(newValue, row); + } + return { value: newValue, rowValue: rowValue }; + }; + QuestionMatrixDropdownModelBase.prototype.getRowIndex = function (row) { + if (!this.generatedVisibleRows) + return -1; + return this.visibleRows.indexOf(row); + }; + QuestionMatrixDropdownModelBase.prototype.getElementsInDesign = function (includeHidden) { + if (includeHidden === void 0) { includeHidden = false; } + if (this.detailPanelMode == "none") + return _super.prototype.getElementsInDesign.call(this, includeHidden); + return includeHidden ? [this.detailPanel] : this.detailElements; + }; + QuestionMatrixDropdownModelBase.prototype.hasDetailPanel = function (row) { + if (this.detailPanelMode == "none") + return false; + if (this.isDesignMode) + return true; + if (!!this.onHasDetailPanelCallback) + return this.onHasDetailPanelCallback(row); + return this.detailElements.length > 0; + }; + QuestionMatrixDropdownModelBase.prototype.getIsDetailPanelShowing = function (row) { + if (this.detailPanelMode == "none") + return false; + if (this.isDesignMode) { + var res = this.visibleRows.indexOf(row) == 0; + if (res) { + if (!row.detailPanel) { + row.showDetailPanel(); + } + } + return res; + } + return this.getPropertyValue("isRowShowing" + row.id, false); + }; + QuestionMatrixDropdownModelBase.prototype.setIsDetailPanelShowing = function (row, val) { + if (val == this.getIsDetailPanelShowing(row)) + return; + this.setPropertyValue("isRowShowing" + row.id, val); + this.updateDetailPanelButtonCss(row); + if (!!this.renderedTable) { + this.renderedTable.onDetailPanelChangeVisibility(row, val); + } + if (val && this.detailPanelMode === "underRowSingle") { + var rows = this.visibleRows; + for (var i = 0; i < rows.length; i++) { + if (rows[i].id !== row.id && rows[i].isDetailPanelShowing) { + rows[i].hideDetailPanel(); + } + } + } + }; + QuestionMatrixDropdownModelBase.prototype.getDetailPanelButtonCss = function (row) { + var builder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(this.getPropertyValue("detailButtonCss" + row.id)); + return builder.append(this.cssClasses.detailButton, builder.toString() === "").toString(); + }; + QuestionMatrixDropdownModelBase.prototype.getDetailPanelIconCss = function (row) { + var builder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(this.getPropertyValue("detailIconCss" + row.id)); + return builder.append(this.cssClasses.detailIcon, builder.toString() === "").toString(); + }; + QuestionMatrixDropdownModelBase.prototype.getDetailPanelIconId = function (row) { + return this.getIsDetailPanelShowing(row) ? this.cssClasses.detailIconExpandedId : this.cssClasses.detailIconId; + }; + QuestionMatrixDropdownModelBase.prototype.updateDetailPanelButtonCss = function (row) { + var classes = this.cssClasses; + var isPanelShowing = this.getIsDetailPanelShowing(row); + var iconBuilder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(classes.detailIcon) + .append(classes.detailIconExpanded, isPanelShowing); + this.setPropertyValue("detailIconCss" + row.id, iconBuilder.toString()); + var buttonBuilder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(classes.detailButton) + .append(classes.detailButtonExpanded, isPanelShowing); + this.setPropertyValue("detailButtonCss" + row.id, buttonBuilder.toString()); + }; + QuestionMatrixDropdownModelBase.prototype.createRowDetailPanel = function (row) { + if (this.isDesignMode) + return this.detailPanel; + var panel = this.createNewDetailPanel(); + panel.readOnly = this.isReadOnly; + var json = this.detailPanel.toJSON(); + new _jsonobject__WEBPACK_IMPORTED_MODULE_0__["JsonObject"]().toObject(json, panel); + panel.renderWidth = "100%"; + panel.updateCustomWidgets(); + if (!!this.onCreateDetailPanelCallback) { + this.onCreateDetailPanelCallback(row, panel); + } + return panel; + }; + QuestionMatrixDropdownModelBase.prototype.getSharedQuestionByName = function (columnName, row) { + if (!this.survey || !this.valueName) + return null; + var index = this.getRowIndex(row); + if (index < 0) + return null; + return (this.survey.getQuestionByValueNameFromArray(this.valueName, columnName, index)); + }; + QuestionMatrixDropdownModelBase.prototype.onTotalValueChanged = function () { + if (!!this.data && + !!this.visibleTotalRow && + !this.isUpdateLocked && + !this.isSett && + !this.isReadOnly) { + this.data.setValue(this.getValueName() + _settings__WEBPACK_IMPORTED_MODULE_9__["settings"].matrixTotalValuePostFix, this.totalValue, false); + } + }; + QuestionMatrixDropdownModelBase.prototype.getParentTextProcessor = function () { + if (!this.parentQuestion || !this.parent) + return null; + var data = this.parent.data; + if (!!data && !!data.getTextProcessor) + return data.getTextProcessor(); + return null; + }; + QuestionMatrixDropdownModelBase.prototype.getQuestionFromArray = function (name, index) { + if (index >= this.visibleRows.length) + return null; + return this.visibleRows[index].getQuestionByName(name); + }; + QuestionMatrixDropdownModelBase.prototype.isMatrixValueEmpty = function (val) { + if (!val) + return; + if (Array.isArray(val)) { + for (var i = 0; i < val.length; i++) { + if (this.isObject(val[i]) && Object.keys(val[i]).length > 0) + return false; + } + return true; + } + return Object.keys(val).length == 0; + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "SurveyModel", { + get: function () { + return this.survey; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.getCellTemplateData = function (cell) { + // return cell.cell.column.templateQuestion; + return this.SurveyModel.getMatrixCellTemplateData(cell); + }; + QuestionMatrixDropdownModelBase.prototype.getCellWrapperComponentName = function (cell) { + return this.SurveyModel.getElementWrapperComponentName(cell, "cell"); + }; + QuestionMatrixDropdownModelBase.prototype.getCellWrapperComponentData = function (cell) { + return this.SurveyModel.getElementWrapperComponentData(cell, "cell"); + }; + QuestionMatrixDropdownModelBase.prototype.getColumnHeaderWrapperComponentName = function (cell) { + return this.SurveyModel.getElementWrapperComponentName(cell, "column-header"); + }; + QuestionMatrixDropdownModelBase.prototype.getColumnHeaderWrapperComponentData = function (cell) { + return this.SurveyModel.getElementWrapperComponentData(cell, "column-header"); + }; + QuestionMatrixDropdownModelBase.prototype.getRowHeaderWrapperComponentName = function (cell) { + return this.SurveyModel.getElementWrapperComponentName(cell, "row-header"); + }; + QuestionMatrixDropdownModelBase.prototype.getRowHeaderWrapperComponentData = function (cell) { + return this.SurveyModel.getElementWrapperComponentData(cell, "row-header"); + }; + Object.defineProperty(QuestionMatrixDropdownModelBase.prototype, "showHorizontalScroll", { + get: function () { + return !this.isDefaultV2Theme && this.horizontalScroll; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownModelBase.prototype.getRootCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_11__["CssClassBuilder"]().append(_super.prototype.getRootCss.call(this)).append(this.cssClasses.rootScroll, this.horizontalScroll).toString(); + }; + return QuestionMatrixDropdownModelBase; + }(_martixBase__WEBPACK_IMPORTED_MODULE_1__["QuestionMatrixBaseModel"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("matrixdropdownbase", [ + { + name: "columns:matrixdropdowncolumns", + className: "matrixdropdowncolumn", + }, + { + name: "columnLayout", + alternativeName: "columnsLocation", + default: "horizontal", + choices: ["horizontal", "vertical"], + }, + { + name: "detailElements", + visible: false, + isLightSerializable: false, + }, + { + name: "detailPanelMode", + choices: ["none", "underRow", "underRowSingle"], + default: "none", + }, + "horizontalScroll:boolean", + { + name: "choices:itemvalue[]", + }, + { name: "optionsCaption", serializationProperty: "locOptionsCaption" }, + { + name: "keyDuplicationError", + serializationProperty: "locKeyDuplicationError", + }, + { + name: "cellType", + default: "dropdown", + choices: function () { + return _question_matrixdropdowncolumn__WEBPACK_IMPORTED_MODULE_12__["MatrixDropdownColumn"].getColumnTypes(); + }, + }, + { name: "columnColCount", default: 0, choices: [0, 1, 2, 3, 4] }, + "columnMinWidth", + { name: "allowAdaptiveActions:boolean", default: false, visible: false }, + ], function () { + return new QuestionMatrixDropdownModelBase(""); + }, "matrixbase"); + + + /***/ }), + + /***/ "./src/question_matrixdropdowncolumn.ts": + /*!**********************************************!*\ + !*** ./src/question_matrixdropdowncolumn.ts ***! + \**********************************************/ + /*! exports provided: matrixDropdownColumnTypes, MatrixDropdownColumn */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "matrixDropdownColumnTypes", function() { return matrixDropdownColumnTypes; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDropdownColumn", function() { return MatrixDropdownColumn; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _question_expression__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_expression */ "./src/question_expression.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + function onUpdateSelectBaseCellQuestion(cellQuestion, column, question, data) { + cellQuestion.storeOthersAsComment = !!question + ? question.storeOthersAsComment + : false; + if ((!cellQuestion.choices || cellQuestion.choices.length == 0) && + cellQuestion.choicesByUrl.isEmpty) { + cellQuestion.choices = question.choices; + } + if (!cellQuestion.choicesByUrl.isEmpty) { + cellQuestion.choicesByUrl.run(data.getTextProcessor()); + } + } + var matrixDropdownColumnTypes = { + dropdown: { + onCellQuestionUpdate: function (cellQuestion, column, question, data) { + onUpdateSelectBaseCellQuestion(cellQuestion, column, question, data); + if (!!cellQuestion.locOptionsCaption && + cellQuestion.locOptionsCaption.isEmpty && + !question.locOptionsCaption.isEmpty) { + cellQuestion.optionsCaption = question.optionsCaption; + } + }, + }, + checkbox: { + onCellQuestionUpdate: function (cellQuestion, column, question, data) { + onUpdateSelectBaseCellQuestion(cellQuestion, column, question, data); + cellQuestion.colCount = + column.colCount > -1 ? column.colCount : question.columnColCount; + }, + }, + radiogroup: { + onCellQuestionUpdate: function (cellQuestion, column, question, data) { + onUpdateSelectBaseCellQuestion(cellQuestion, column, question, data); + cellQuestion.colCount = + column.colCount > -1 ? column.colCount : question.columnColCount; + }, + }, + text: {}, + comment: {}, + boolean: { + onCellQuestionUpdate: function (cellQuestion, column, question, data) { + cellQuestion.showTitle = true; + cellQuestion.renderAs = column.renderAs; + }, + }, + expression: {}, + rating: {}, + }; + var MatrixDropdownColumn = /** @class */ (function (_super) { + __extends(MatrixDropdownColumn, _super); + function MatrixDropdownColumn(name, title) { + if (title === void 0) { title = null; } + var _this = _super.call(this) || this; + _this.colOwnerValue = null; + _this.indexValue = -1; + _this._isVisible = true; + _this._hasVisibleCell = true; + _this.previousChoicesId = undefined; + var self = _this; + _this.createLocalizableString("totalFormat", _this); + _this.registerFunctionOnPropertyValueChanged("showInMultipleColumns", function () { + self.doShowInMultipleColumnsChanged(); + }); + _this.updateTemplateQuestion(); + _this.name = name; + if (title) { + _this.title = title; + } + else { + _this.templateQuestion.locTitle.strChanged(); + } + return _this; + } + MatrixDropdownColumn.getColumnTypes = function () { + var res = []; + for (var key in matrixDropdownColumnTypes) { + res.push(key); + } + return res; + }; + MatrixDropdownColumn.prototype.getOriginalObj = function () { + return this.templateQuestion; + }; + MatrixDropdownColumn.prototype.getClassNameProperty = function () { + return "cellType"; + }; + MatrixDropdownColumn.prototype.getSurvey = function (live) { + return !!this.colOwner ? this.colOwner.survey : null; + }; + MatrixDropdownColumn.prototype.endLoadingFromJson = function () { + var _this = this; + _super.prototype.endLoadingFromJson.call(this); + this.templateQuestion.endLoadingFromJson(); + this.templateQuestion.onGetSurvey = function () { + return _this.getSurvey(); + }; + }; + MatrixDropdownColumn.prototype.getDynamicPropertyName = function () { + return "cellType"; + }; + MatrixDropdownColumn.prototype.getDynamicType = function () { + return this.calcCellQuestionType(null); + }; + Object.defineProperty(MatrixDropdownColumn.prototype, "colOwner", { + get: function () { + return this.colOwnerValue; + }, + set: function (value) { + this.colOwnerValue = value; + if (!!value) { + this.updateTemplateQuestion(); + } + }, + enumerable: false, + configurable: true + }); + MatrixDropdownColumn.prototype.locStrsChanged = function () { + _super.prototype.locStrsChanged.call(this); + this.locTitle.strChanged(); + }; + MatrixDropdownColumn.prototype.addUsedLocales = function (locales) { + _super.prototype.addUsedLocales.call(this, locales); + this.templateQuestion.addUsedLocales(locales); + }; + Object.defineProperty(MatrixDropdownColumn.prototype, "index", { + get: function () { + return this.indexValue; + }, + enumerable: false, + configurable: true + }); + MatrixDropdownColumn.prototype.setIndex = function (val) { + this.indexValue = val; + }; + MatrixDropdownColumn.prototype.getType = function () { + return "matrixdropdowncolumn"; + }; + Object.defineProperty(MatrixDropdownColumn.prototype, "cellType", { + get: function () { + return this.getPropertyValue("cellType"); + }, + set: function (val) { + val = val.toLocaleLowerCase(); + this.updateTemplateQuestion(val); + this.setPropertyValue("cellType", val); + if (!!this.colOwner) { + this.colOwner.onColumnCellTypeChanged(this); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "templateQuestion", { + get: function () { + return this.templateQuestionValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "value", { + get: function () { + return this.templateQuestion.name; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "isVisible", { + get: function () { + return this._isVisible; + }, + enumerable: false, + configurable: true + }); + MatrixDropdownColumn.prototype.setIsVisible = function (newVal) { + this._isVisible = newVal; + }; + Object.defineProperty(MatrixDropdownColumn.prototype, "hasVisibleCell", { + get: function () { + return this._hasVisibleCell; + }, + set: function (newVal) { + this._hasVisibleCell = newVal; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "name", { + get: function () { + return this.templateQuestion.name; + }, + set: function (val) { + this.templateQuestion.name = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "title", { + get: function () { + return this.templateQuestion.title; + }, + set: function (val) { + this.templateQuestion.title = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "locTitle", { + get: function () { + return this.templateQuestion.locTitle; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "fullTitle", { + get: function () { + return this.locTitle.textOrHtml; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "isRequired", { + get: function () { + return this.templateQuestion.isRequired; + }, + set: function (val) { + this.templateQuestion.isRequired = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "requiredText", { + get: function () { + return this.templateQuestion.requiredText; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "requiredErrorText", { + get: function () { + return this.templateQuestion.requiredErrorText; + }, + set: function (val) { + this.templateQuestion.requiredErrorText = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "locRequiredErrorText", { + get: function () { + return this.templateQuestion.locRequiredErrorText; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "readOnly", { + get: function () { + return this.templateQuestion.readOnly; + }, + set: function (val) { + this.templateQuestion.readOnly = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "hasOther", { + get: function () { + return this.templateQuestion.hasOther; + }, + set: function (val) { + this.templateQuestion.hasOther = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "visibleIf", { + get: function () { + return this.templateQuestion.visibleIf; + }, + set: function (val) { + this.templateQuestion.visibleIf = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "enableIf", { + get: function () { + return this.templateQuestion.enableIf; + }, + set: function (val) { + this.templateQuestion.enableIf = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "requiredIf", { + get: function () { + return this.templateQuestion.requiredIf; + }, + set: function (val) { + this.templateQuestion.requiredIf = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "isUnique", { + get: function () { + return this.getPropertyValue("isUnique"); + }, + set: function (val) { + this.setPropertyValue("isUnique", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "showInMultipleColumns", { + get: function () { + return this.getPropertyValue("showInMultipleColumns", false); + }, + set: function (val) { + this.setPropertyValue("showInMultipleColumns", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "isSupportMultipleColumns", { + get: function () { + return ["checkbox", "radiogroup"].indexOf(this.cellType) > -1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "isShowInMultipleColumns", { + get: function () { + return this.showInMultipleColumns && this.isSupportMultipleColumns; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "validators", { + get: function () { + return this.templateQuestion.validators; + }, + set: function (val) { + this.templateQuestion.validators = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "totalType", { + get: function () { + return this.getPropertyValue("totalType"); + }, + set: function (val) { + this.setPropertyValue("totalType", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "totalExpression", { + get: function () { + return this.getPropertyValue("totalExpression"); + }, + set: function (val) { + this.setPropertyValue("totalExpression", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "hasTotal", { + get: function () { + return this.totalType != "none" || !!this.totalExpression; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "totalFormat", { + get: function () { + return this.getLocalizableStringText("totalFormat", ""); + }, + set: function (val) { + this.setLocalizableStringText("totalFormat", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "locTotalFormat", { + get: function () { + return this.getLocalizableString("totalFormat"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "renderAs", { + get: function () { + return this.getPropertyValue("renderAs"); + }, + set: function (val) { + this.setPropertyValue("renderAs", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "totalMaximumFractionDigits", { + get: function () { + return this.getPropertyValue("totalMaximumFractionDigits"); + }, + set: function (val) { + if (val < -1 || val > 20) + return; + this.setPropertyValue("totalMaximumFractionDigits", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "totalMinimumFractionDigits", { + get: function () { + return this.getPropertyValue("totalMinimumFractionDigits"); + }, + set: function (val) { + if (val < -1 || val > 20) + return; + this.setPropertyValue("totalMinimumFractionDigits", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "totalDisplayStyle", { + get: function () { + return this.getPropertyValue("totalDisplayStyle"); + }, + set: function (val) { + this.setPropertyValue("totalDisplayStyle", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "totalCurrency", { + get: function () { + return this.getPropertyValue("totalCurrency"); + }, + set: function (val) { + if (Object(_question_expression__WEBPACK_IMPORTED_MODULE_2__["getCurrecyCodes"])().indexOf(val) < 0) + return; + this.setPropertyValue("totalCurrency", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "minWidth", { + get: function () { + return this.getPropertyValue("minWidth", ""); + }, + set: function (val) { + this.setPropertyValue("minWidth", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "width", { + get: function () { + return this.getPropertyValue("width", ""); + }, + set: function (val) { + this.setPropertyValue("width", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDropdownColumn.prototype, "colCount", { + get: function () { + return this.getPropertyValue("colCount"); + }, + set: function (val) { + if (val < -1 || val > 4) + return; + this.setPropertyValue("colCount", val); + }, + enumerable: false, + configurable: true + }); + MatrixDropdownColumn.prototype.getLocale = function () { + return this.colOwner ? this.colOwner.getLocale() : ""; + }; + MatrixDropdownColumn.prototype.getMarkdownHtml = function (text, name) { + return this.colOwner ? this.colOwner.getMarkdownHtml(text, name) : null; + }; + MatrixDropdownColumn.prototype.getRenderer = function (name) { + return !!this.colOwner ? this.colOwner.getRenderer(name) : null; + }; + MatrixDropdownColumn.prototype.getRendererContext = function (locStr) { + return !!this.colOwner ? this.colOwner.getRendererContext(locStr) : locStr; + }; + MatrixDropdownColumn.prototype.getProcessedText = function (text) { + return this.colOwner ? this.colOwner.getProcessedText(text) : text; + }; + MatrixDropdownColumn.prototype.createCellQuestion = function (row) { + var qType = this.calcCellQuestionType(row); + var cellQuestion = this.createNewQuestion(qType); + this.callOnCellQuestionUpdate(cellQuestion, row); + return cellQuestion; + }; + MatrixDropdownColumn.prototype.updateCellQuestion = function (cellQuestion, data, onUpdateJson) { + if (onUpdateJson === void 0) { onUpdateJson = null; } + this.setQuestionProperties(cellQuestion, onUpdateJson); + }; + MatrixDropdownColumn.prototype.callOnCellQuestionUpdate = function (cellQuestion, data) { + var qType = cellQuestion.getType(); + var qDefinition = matrixDropdownColumnTypes[qType]; + if (qDefinition && qDefinition["onCellQuestionUpdate"]) { + qDefinition["onCellQuestionUpdate"](cellQuestion, this, this.colOwner, data); + } + }; + MatrixDropdownColumn.prototype.defaultCellTypeChanged = function () { + this.updateTemplateQuestion(); + }; + MatrixDropdownColumn.prototype.calcCellQuestionType = function (row) { + var cellType = this.getDefaultCellQuestionType(); + if (!!row && !!this.colOwner) { + cellType = this.colOwner.getCustomCellType(this, row, cellType); + } + return cellType; + }; + MatrixDropdownColumn.prototype.getDefaultCellQuestionType = function (cellType) { + if (!cellType) + cellType = this.cellType; + if (cellType !== "default") + return cellType; + if (this.colOwner) + return this.colOwner.getCellType(); + return _settings__WEBPACK_IMPORTED_MODULE_3__["settings"].matrixDefaultCellType; + }; + MatrixDropdownColumn.prototype.updateTemplateQuestion = function (newCellType) { + var _this = this; + var curCellType = this.getDefaultCellQuestionType(newCellType); + var prevCellType = this.templateQuestion + ? this.templateQuestion.getType() + : ""; + if (curCellType === prevCellType) + return; + if (this.templateQuestion) { + this.removeProperties(prevCellType); + } + this.templateQuestionValue = this.createNewQuestion(curCellType); + this.templateQuestion.locOwner = this; + this.addProperties(curCellType); + this.templateQuestion.onPropertyChanged.add(function (sender, options) { + _this.propertyValueChanged(options.name, options.oldValue, options.newValue); + }); + this.templateQuestion.onItemValuePropertyChanged.add(function (sender, options) { + _this.doItemValuePropertyChanged(options.propertyName, options.obj, options.name, options.newValue, options.oldValue); + }); + this.templateQuestion.isContentElement = true; + if (!this.isLoadingFromJson) { + this.templateQuestion.onGetSurvey = function () { + return _this.getSurvey(); + }; + } + this.templateQuestion.locTitle.strChanged(); + }; + MatrixDropdownColumn.prototype.createNewQuestion = function (cellType) { + var question = _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].createClass(cellType); + if (!question) { + question = _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].createClass("text"); + } + question.loadingOwner = this; + question.isEditableTemplateElement = true; + this.setQuestionProperties(question); + return question; + }; + MatrixDropdownColumn.prototype.setQuestionProperties = function (question, onUpdateJson) { + var _this = this; + if (onUpdateJson === void 0) { onUpdateJson = null; } + if (this.templateQuestion) { + var json = new _jsonobject__WEBPACK_IMPORTED_MODULE_0__["JsonObject"]().toJsonObject(this.templateQuestion, true); + if (onUpdateJson) { + onUpdateJson(json); + } + json.type = question.getType(); + new _jsonobject__WEBPACK_IMPORTED_MODULE_0__["JsonObject"]().toObject(json, question); + question.isContentElement = this.templateQuestion.isContentElement; + this.previousChoicesId = undefined; + question.loadedChoicesFromServerCallback = function () { + if (!_this.isShowInMultipleColumns) + return; + if (!!_this.previousChoicesId && _this.previousChoicesId !== question.id) + return; + _this.previousChoicesId = question.id; + var choices = question.visibleChoices; + _this.templateQuestion.choices = choices; + _this.propertyValueChanged("choices", choices, choices); + }; + } + }; + MatrixDropdownColumn.prototype.propertyValueChanged = function (name, oldValue, newValue) { + _super.prototype.propertyValueChanged.call(this, name, oldValue, newValue); + if (!_jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].hasOriginalProperty(this, name)) + return; + if (this.colOwner != null && !this.isLoadingFromJson) { + this.colOwner.onColumnPropertyChanged(this, name, newValue); + } + }; + MatrixDropdownColumn.prototype.doItemValuePropertyChanged = function (propertyName, obj, name, newValue, oldValue) { + if (!_jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].hasOriginalProperty(obj, name)) + return; + if (this.colOwner != null && !this.isLoadingFromJson) { + this.colOwner.onColumnItemValuePropertyChanged(this, propertyName, obj, name, newValue, oldValue); + } + }; + MatrixDropdownColumn.prototype.doShowInMultipleColumnsChanged = function () { + if (this.colOwner != null && !this.isLoadingFromJson) { + this.colOwner.onShowInMultipleColumnsChanged(this); + } + }; + MatrixDropdownColumn.prototype.getProperties = function (curCellType) { + return _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].getDynamicPropertiesByObj(this, curCellType); + }; + MatrixDropdownColumn.prototype.removeProperties = function (curCellType) { + var properties = this.getProperties(curCellType); + for (var i = 0; i < properties.length; i++) { + var prop = properties[i]; + delete this[prop.name]; + if (prop.serializationProperty) { + delete this[prop.serializationProperty]; + } + } + }; + MatrixDropdownColumn.prototype.addProperties = function (curCellType) { + var question = this.templateQuestion; + var properties = this.getProperties(curCellType); + for (var i = 0; i < properties.length; i++) { + var prop = properties[i]; + this.addProperty(question, prop.name, false); + if (prop.serializationProperty) { + this.addProperty(question, prop.serializationProperty, true); + } + } + }; + MatrixDropdownColumn.prototype.addProperty = function (question, propName, isReadOnly) { + var desc = { + configurable: true, + get: function () { + return question[propName]; + }, + }; + if (!isReadOnly) { + desc["set"] = function (v) { + question[propName] = v; + }; + } + Object.defineProperty(this, propName, desc); + }; + return MatrixDropdownColumn; + }(_base__WEBPACK_IMPORTED_MODULE_1__["Base"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("matrixdropdowncolumn", [ + { name: "!name", isUnique: true }, + { name: "title", serializationProperty: "locTitle" }, + { + name: "cellType", + default: "default", + choices: function () { + var res = MatrixDropdownColumn.getColumnTypes(); + res.splice(0, 0, "default"); + return res; + }, + }, + { name: "colCount", default: -1, choices: [-1, 0, 1, 2, 3, 4] }, + "isRequired:boolean", + "isUnique:boolean", + { + name: "requiredErrorText:text", + serializationProperty: "locRequiredErrorText", + }, + "readOnly:boolean", + "minWidth", + "width", + "visibleIf:condition", + "enableIf:condition", + "requiredIf:condition", + { + name: "showInMultipleColumns:boolean", + dependsOn: "cellType", + visibleIf: function (obj) { + if (!obj) + return false; + return obj.isSupportMultipleColumns; + }, + }, + { + name: "validators:validators", + baseClassName: "surveyvalidator", + classNamePart: "validator", + }, + { + name: "totalType", + default: "none", + choices: ["none", "sum", "count", "min", "max", "avg"], + }, + "totalExpression:expression", + { name: "totalFormat", serializationProperty: "locTotalFormat" }, + { + name: "totalDisplayStyle", + default: "none", + choices: ["none", "decimal", "currency", "percent"], + }, + { + name: "totalCurrency", + choices: function () { + return Object(_question_expression__WEBPACK_IMPORTED_MODULE_2__["getCurrecyCodes"])(); + }, + default: "USD", + }, + { name: "totalMaximumFractionDigits:number", default: -1 }, + { name: "totalMinimumFractionDigits:number", default: -1 }, + { name: "renderAs", default: "default", visible: false }, + ], function () { + return new MatrixDropdownColumn(""); + }); + + + /***/ }), + + /***/ "./src/question_matrixdropdownrendered.ts": + /*!************************************************!*\ + !*** ./src/question_matrixdropdownrendered.ts ***! + \************************************************/ + /*! exports provided: QuestionMatrixDropdownRenderedCell, QuestionMatrixDropdownRenderedRow, QuestionMatrixDropdownRenderedTable */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDropdownRenderedCell", function() { return QuestionMatrixDropdownRenderedCell; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDropdownRenderedRow", function() { return QuestionMatrixDropdownRenderedRow; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDropdownRenderedTable", function() { return QuestionMatrixDropdownRenderedTable; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _actions_action__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./actions/action */ "./src/actions/action.ts"); + /* harmony import */ var _actions_adaptive_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./actions/adaptive-container */ "./src/actions/adaptive-container.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + + + + + var QuestionMatrixDropdownRenderedCell = /** @class */ (function () { + function QuestionMatrixDropdownRenderedCell() { + this.minWidth = ""; + this.width = ""; + this.colSpans = 1; + this.isActionsCell = false; + this.isDragHandlerCell = false; + this.classNameValue = ""; + this.idValue = QuestionMatrixDropdownRenderedCell.counter++; + } + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "hasQuestion", { + get: function () { + return !!this.question; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "hasTitle", { + get: function () { + return !!this.locTitle; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "hasPanel", { + get: function () { + return !!this.panel; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "id", { + get: function () { + return this.idValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "showErrorOnTop", { + get: function () { + return this.showErrorOnCore("top"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "showErrorOnBottom", { + get: function () { + return this.showErrorOnCore("bottom"); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownRenderedCell.prototype.showErrorOnCore = function (location) { + return (this.getShowErrorLocation() == location && + (!this.isChoice || this.isFirstChoice)); + }; + QuestionMatrixDropdownRenderedCell.prototype.getShowErrorLocation = function () { + return this.hasQuestion ? this.question.survey.questionErrorLocation : ""; + }; + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "item", { + get: function () { + return this.itemValue; + }, + set: function (val) { + this.itemValue = val; + if (!!val) { + val.hideCaption = true; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "isChoice", { + get: function () { + return !!this.item; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "choiceValue", { + get: function () { + return this.isChoice ? this.item.value : null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "isCheckbox", { + get: function () { + return this.isChoice && this.question.getType() == "checkbox"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "isFirstChoice", { + get: function () { + return this.choiceIndex === 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "className", { + get: function () { + var builder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]().append(this.classNameValue); + if (this.hasQuestion) { + builder + .append(this.question.cssClasses.hasError, this.question.errors.length > 0) + .append(this.question.cssClasses.answered, this.question.isAnswered); + } + return builder.toString(); + }, + set: function (val) { + this.classNameValue = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedCell.prototype, "headers", { + get: function () { + if (this.cell && + this.cell.column && + this.cell.column.isShowInMultipleColumns) { + return this.item.locText.renderedHtml; + } + if (this.question && this.question.isVisible) { + return this.question.locTitle.renderedHtml; + } + if (this.hasTitle) { + return this.locTitle.renderedHtml || ""; + } + return ""; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownRenderedCell.prototype.getTitle = function () { + return (this.matrix && this.matrix.showHeader) ? this.headers : ""; + }; + QuestionMatrixDropdownRenderedCell.prototype.calculateFinalClassName = function (matrixCssClasses) { + var questionCss = this.cell.question.cssClasses; + // 'text-align': $data.isChoice ? 'center': + var builder = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]() + .append(questionCss.itemValue, !!questionCss) + .append(questionCss.asCell, !!questionCss); + return builder.append(matrixCssClasses.cell, builder.isEmpty() && !!matrixCssClasses) + .append(matrixCssClasses.choiceCell, this.isChoice) + .toString(); + }; + QuestionMatrixDropdownRenderedCell.counter = 1; + return QuestionMatrixDropdownRenderedCell; + }()); + + var QuestionMatrixDropdownRenderedRow = /** @class */ (function (_super) { + __extends(QuestionMatrixDropdownRenderedRow, _super); + function QuestionMatrixDropdownRenderedRow(cssClasses, isDetailRow) { + if (isDetailRow === void 0) { isDetailRow = false; } + var _this = _super.call(this) || this; + _this.cssClasses = cssClasses; + _this.isDetailRow = isDetailRow; + _this.cells = []; + _this.onCreating(); + _this.idValue = QuestionMatrixDropdownRenderedRow.counter++; + return _this; + } + QuestionMatrixDropdownRenderedRow.prototype.onCreating = function () { }; // need for knockout binding see QuestionMatrixDropdownRenderedRow.prototype["onCreating"] + Object.defineProperty(QuestionMatrixDropdownRenderedRow.prototype, "id", { + get: function () { + return this.idValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedRow.prototype, "attributes", { + get: function () { + if (!this.row) + return {}; + return { "data-sv-drop-target-matrix-row": this.row.id }; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedRow.prototype, "className", { + get: function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]() + .append(this.cssClasses.row) + .append(this.cssClasses.detailRow, this.isDetailRow) + .append(this.cssClasses.ghostRow, this.isGhostRow) + .append(this.cssClasses.rowAdditional, this.isAdditionalClasses) + .toString(); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownRenderedRow.counter = 1; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: null }) + ], QuestionMatrixDropdownRenderedRow.prototype, "isGhostRow", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) + ], QuestionMatrixDropdownRenderedRow.prototype, "isAdditionalClasses", void 0); + return QuestionMatrixDropdownRenderedRow; + }(_base__WEBPACK_IMPORTED_MODULE_1__["Base"])); + + var QuestionMatrixDropdownRenderedTable = /** @class */ (function (_super) { + __extends(QuestionMatrixDropdownRenderedTable, _super); + function QuestionMatrixDropdownRenderedTable(matrix) { + var _this = _super.call(this) || this; + _this.matrix = matrix; + _this.renderedRowsChangedCallback = function () { }; + _this.hasActionCellInRowsValues = {}; + _this.build(); + return _this; + } + Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "showTable", { + get: function () { + return this.getPropertyValue("showTable", true); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "showHeader", { + get: function () { + return this.getPropertyValue("showHeader"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "showAddRowOnTop", { + get: function () { + return this.getPropertyValue("showAddRowOnTop", false); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "showAddRowOnBottom", { + get: function () { + return this.getPropertyValue("showAddRowOnBottom", false); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "showFooter", { + get: function () { + return this.matrix.hasFooter && this.matrix.isColumnLayoutHorizontal; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "hasFooter", { + get: function () { + return !!this.footerRow; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "hasRemoveRows", { + get: function () { + return this.hasRemoveRowsValue; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownRenderedTable.prototype.isRequireReset = function () { + return (this.hasRemoveRows != this.matrix.canRemoveRows || + !this.matrix.isColumnLayoutHorizontal); + }; + Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "headerRow", { + get: function () { + return this.headerRowValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "footerRow", { + get: function () { + return this.footerRowValue; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownRenderedTable.prototype.build = function () { + this.hasRemoveRowsValue = this.matrix.canRemoveRows; + //build rows now + this.matrix.visibleRows; + this.cssClasses = this.matrix.cssClasses; + this.buildRowsActions(); + this.buildHeader(); + this.buildRows(); + this.buildFooter(); + this.updateShowTableAndAddRow(); + }; + QuestionMatrixDropdownRenderedTable.prototype.updateShowTableAndAddRow = function () { + var showTable = this.rows.length > 0 || + this.matrix.isDesignMode || + !this.matrix.getShowColumnsIfEmpty(); + this.setPropertyValue("showTable", showTable); + var showAddRow = this.matrix.canAddRow && showTable; + var showAddRowOnTop = showAddRow; + var showAddRowOnBottom = showAddRow; + if (showAddRowOnTop) { + if (this.matrix.getAddRowLocation() === "default") { + showAddRowOnTop = !this.matrix.isColumnLayoutHorizontal; + } + else { + showAddRowOnTop = this.matrix.getAddRowLocation() !== "bottom"; + } + } + if (showAddRowOnBottom && this.matrix.getAddRowLocation() !== "topBottom") { + showAddRowOnBottom = !showAddRowOnTop; + } + this.setPropertyValue("showAddRowOnTop", showAddRowOnTop); + this.setPropertyValue("showAddRowOnBottom", showAddRowOnBottom); + }; + QuestionMatrixDropdownRenderedTable.prototype.onAddedRow = function () { + if (this.getRenderedDataRowCount() >= this.matrix.visibleRows.length) + return; + var row = this.matrix.visibleRows[this.matrix.visibleRows.length - 1]; + this.rowsActions.push(this.buildRowActions(row)); + this.addHorizontalRow(this.rows, row, this.matrix.visibleRows.length == 1 && !this.matrix.showHeader); + this.updateShowTableAndAddRow(); + }; + QuestionMatrixDropdownRenderedTable.prototype.getRenderedDataRowCount = function () { + var res = 0; + for (var i = 0; i < this.rows.length; i++) { + if (!this.rows[i].isDetailRow) + res++; + } + return res; + }; + QuestionMatrixDropdownRenderedTable.prototype.onRemovedRow = function (row) { + var rowIndex = this.getRenderedRowIndex(row); + if (rowIndex < 0) + return; + this.rowsActions.splice(rowIndex, 1); + var removeCount = 1; + if (rowIndex < this.rows.length - 1 && + this.rows[rowIndex + 1].isDetailRow) { + removeCount++; + } + this.rows.splice(rowIndex, removeCount); + this.updateShowTableAndAddRow(); + }; + QuestionMatrixDropdownRenderedTable.prototype.onDetailPanelChangeVisibility = function (row, isShowing) { + var rowIndex = this.getRenderedRowIndex(row); + if (rowIndex < 0) + return; + var panelRowIndex = rowIndex < this.rows.length - 1 && this.rows[rowIndex + 1].isDetailRow + ? rowIndex + 1 + : -1; + if ((isShowing && panelRowIndex > -1) || (!isShowing && panelRowIndex < 0)) + return; + if (isShowing) { + var detailRow = this.createDetailPanelRow(row, this.rows[rowIndex]); + this.rows.splice(rowIndex + 1, 0, detailRow); + } + else { + this.rows.splice(panelRowIndex, 1); + } + }; + QuestionMatrixDropdownRenderedTable.prototype.getRenderedRowIndex = function (row) { + for (var i = 0; i < this.rows.length; i++) { + if (this.rows[i].row == row) + return i; + } + return -1; + }; + QuestionMatrixDropdownRenderedTable.prototype.buildRowsActions = function () { + this.rowsActions = []; + var rows = this.matrix.visibleRows; + for (var i = 0; i < rows.length; i++) { + this.rowsActions.push(this.buildRowActions(rows[i])); + } + }; + QuestionMatrixDropdownRenderedTable.prototype.buildHeader = function () { + var colHeaders = this.matrix.isColumnLayoutHorizontal && this.matrix.showHeader; + var isShown = colHeaders || + (this.matrix.hasRowText && !this.matrix.isColumnLayoutHorizontal); + this.setPropertyValue("showHeader", isShown); + if (!isShown) + return; + this.headerRowValue = new QuestionMatrixDropdownRenderedRow(this.cssClasses); + if (this.matrix.allowRowsDragAndDrop) { + this.headerRow.cells.push(this.createHeaderCell(null)); + } + if (this.hasActionCellInRows("start")) { + this.headerRow.cells.push(this.createHeaderCell(null)); + } + if (this.matrix.hasRowText && this.matrix.showHeader) { + this.headerRow.cells.push(this.createHeaderCell(null)); + } + if (this.matrix.isColumnLayoutHorizontal) { + for (var i = 0; i < this.matrix.visibleColumns.length; i++) { + var column = this.matrix.visibleColumns[i]; + if (!column.hasVisibleCell) + continue; + if (column.isShowInMultipleColumns) { + this.createMutlipleColumnsHeader(column); + } + else { + this.headerRow.cells.push(this.createHeaderCell(column)); + } + } + } + else { + var rows = this.matrix.visibleRows; + for (var i = 0; i < rows.length; i++) { + var cell = this.createTextCell(rows[i].locText); + cell.row = rows[i]; + this.headerRow.cells.push(cell); + } + if (this.matrix.hasFooter) { + this.headerRow.cells.push(this.createTextCell(this.matrix.getFooterText())); + } + } + if (this.hasActionCellInRows("end")) { + this.headerRow.cells.push(this.createHeaderCell(null)); + } + }; + QuestionMatrixDropdownRenderedTable.prototype.buildFooter = function () { + if (!this.showFooter) + return; + this.footerRowValue = new QuestionMatrixDropdownRenderedRow(this.cssClasses); + if (this.matrix.allowRowsDragAndDrop) { + this.footerRow.cells.push(this.createHeaderCell(null)); + } + if (this.hasActionCellInRows("start")) { + this.footerRow.cells.push(this.createHeaderCell(null)); + } + if (this.matrix.hasRowText) { + this.footerRow.cells.push(this.createTextCell(this.matrix.getFooterText())); + } + var cells = this.matrix.visibleTotalRow.cells; + for (var i = 0; i < cells.length; i++) { + var cell = cells[i]; + if (!cell.column.hasVisibleCell) + continue; + if (cell.column.isShowInMultipleColumns) { + this.createMutlipleColumnsFooter(this.footerRow, cell); + } + else { + var editCell = this.createEditCell(cell); + if (cell.column) { + this.setHeaderCellWidth(cell.column, editCell); + } + this.footerRow.cells.push(editCell); + } + } + if (this.hasActionCellInRows("end")) { + this.footerRow.cells.push(this.createHeaderCell(null)); + } + }; + QuestionMatrixDropdownRenderedTable.prototype.buildRows = function () { + var rows = this.matrix.isColumnLayoutHorizontal + ? this.buildHorizontalRows() + : this.buildVerticalRows(); + this.rows = rows; + }; + QuestionMatrixDropdownRenderedTable.prototype.hasActionCellInRows = function (location) { + if (this.hasActionCellInRowsValues[location] === undefined) { + var rows = this.matrix.visibleRows; + this.hasActionCellInRowsValues[location] = false; + for (var i = 0; i < rows.length; i++) { + if (!this.isValueEmpty(this.getRowActions(i, location))) { + this.hasActionCellInRowsValues[location] = true; + break; + } + } + } + return this.hasActionCellInRowsValues[location]; + }; + QuestionMatrixDropdownRenderedTable.prototype.canRemoveRow = function (row) { + return this.matrix.canRemoveRow(row); + }; + QuestionMatrixDropdownRenderedTable.prototype.buildHorizontalRows = function () { + var rows = this.matrix.visibleRows; + var renderedRows = []; + for (var i = 0; i < rows.length; i++) { + this.addHorizontalRow(renderedRows, rows[i], i == 0 && !this.matrix.showHeader); + } + return renderedRows; + }; + QuestionMatrixDropdownRenderedTable.prototype.addHorizontalRow = function (renderedRows, row, useAsHeader) { + var renderedRow = this.createHorizontalRow(row, useAsHeader); + renderedRow.row = row; + renderedRows.push(renderedRow); + if (row.isDetailPanelShowing) { + renderedRows.push(this.createDetailPanelRow(row, renderedRow)); + } + }; + QuestionMatrixDropdownRenderedTable.prototype.getRowDragCell = function (rowIndex) { + var cell = new QuestionMatrixDropdownRenderedCell(); + cell.isDragHandlerCell = true; + cell.className = this.getActionsCellClassName(); + cell.row = this.matrix.visibleRows[rowIndex]; + return cell; + }; + QuestionMatrixDropdownRenderedTable.prototype.getActionsCellClassName = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]().append(this.cssClasses.actionsCell).append(this.cssClasses.verticalCell, !this.matrix.isColumnLayoutHorizontal).toString(); + }; + QuestionMatrixDropdownRenderedTable.prototype.getRowActionsCell = function (rowIndex, location) { + var rowActions = this.getRowActions(rowIndex, location); + if (!this.isValueEmpty(rowActions)) { + var cell = new QuestionMatrixDropdownRenderedCell(); + var actionContainer = this.matrix.allowAdaptiveActions ? new _actions_adaptive_container__WEBPACK_IMPORTED_MODULE_5__["AdaptiveActionContainer"]() : new _actions_container__WEBPACK_IMPORTED_MODULE_7__["ActionContainer"](); + if (!!this.matrix.survey && this.matrix.survey.getCss().actionBar) { + actionContainer.cssClasses = this.matrix.survey.getCss().actionBar; + } + actionContainer.setItems(rowActions); + var itemValue = new _itemvalue__WEBPACK_IMPORTED_MODULE_2__["ItemValue"](actionContainer); + cell.item = itemValue; + cell.isActionsCell = true; + cell.className = this.getActionsCellClassName(); + cell.row = this.matrix.visibleRows[rowIndex]; + return cell; + } + return null; + }; + QuestionMatrixDropdownRenderedTable.prototype.getRowActions = function (rowIndex, location) { + var actions = this.rowsActions[rowIndex]; + if (!Array.isArray(actions)) + return []; + return actions.filter(function (action) { + if (!action.location) { + action.location = "start"; + } + return action.location === location; + }); + }; + QuestionMatrixDropdownRenderedTable.prototype.buildRowActions = function (row) { + var actions = []; + this.setDefaultRowActions(row, actions); + if (!!this.matrix.survey) { + actions = this.matrix.survey.getUpdatedMatrixRowActions(this.matrix, row, actions); + } + return actions; + }; + Object.defineProperty(QuestionMatrixDropdownRenderedTable.prototype, "showRemoveButtonAsIcon", { + get: function () { + return (_settings__WEBPACK_IMPORTED_MODULE_8__["settings"].matrixRenderRemoveAsIcon && this.matrix.survey && this.matrix.survey.css.root === "sd-root-modern"); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDropdownRenderedTable.prototype.setDefaultRowActions = function (row, actions) { + var matrix = this.matrix; + if (this.hasRemoveRows && this.canRemoveRow(row)) { + if (!this.showRemoveButtonAsIcon) { + actions.push(new _actions_action__WEBPACK_IMPORTED_MODULE_4__["Action"]({ + id: "remove-row", + location: "end", + enabled: !this.matrix.isInputReadOnly, + component: "sv-matrix-remove-button", + data: { row: row, question: this.matrix }, + })); + } + else { + actions.push(new _actions_action__WEBPACK_IMPORTED_MODULE_4__["Action"]({ + id: "remove-row", + iconName: "icon-delete", + component: "sv-action-bar-item", + innerCss: new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]().append(this.matrix.cssClasses.button).append(this.matrix.cssClasses.buttonRemove).toString(), + location: "end", + showTitle: false, + title: matrix.removeRowText, + enabled: !matrix.isInputReadOnly, + data: { row: row, question: matrix }, + action: function () { + matrix.removeRowUI(row); + }, + })); + } + } + if (row.hasPanel) { + actions.push(new _actions_action__WEBPACK_IMPORTED_MODULE_4__["Action"]({ + id: "show-detail", + title: _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("editText"), + showTitle: false, + location: "start", + component: "sv-matrix-detail-button", + data: { row: row, question: this.matrix }, + })); + } + }; + QuestionMatrixDropdownRenderedTable.prototype.createHorizontalRow = function (row, useAsHeader) { + var res = new QuestionMatrixDropdownRenderedRow(this.cssClasses); + if (this.matrix.allowRowsDragAndDrop) { + var rowIndex = this.matrix.visibleRows.indexOf(row); + res.cells.push(this.getRowDragCell(rowIndex)); + } + this.addRowActionsCell(row, res, "start"); + if (this.matrix.hasRowText) { + var renderedCell = this.createTextCell(row.locText); + renderedCell.row = row; + res.cells.push(renderedCell); + if (useAsHeader) { + this.setHeaderCellWidth(null, renderedCell); + } + renderedCell.className = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]() + .append(renderedCell.className) + .append(this.cssClasses.rowTextCell) + .append(this.cssClasses.detailRowText, row.hasPanel) + .toString(); + } + for (var i = 0; i < row.cells.length; i++) { + var cell = row.cells[i]; + if (!cell.column.hasVisibleCell) + continue; + if (cell.column.isShowInMultipleColumns) { + this.createMutlipleEditCells(res, cell); + } + else { + var renderedCell = this.createEditCell(cell); + res.cells.push(renderedCell); + if (useAsHeader) { + this.setHeaderCellWidth(cell.column, renderedCell); + } + } + } + this.addRowActionsCell(row, res, "end"); + return res; + }; + QuestionMatrixDropdownRenderedTable.prototype.addRowActionsCell = function (row, renderedRow, location) { + var rowIndex = this.matrix.visibleRows.indexOf(row); + if (this.hasActionCellInRows(location)) { + var actions = this.getRowActionsCell(rowIndex, location); + if (!!actions) { + renderedRow.cells.push(actions); + } + else { + var cell = new QuestionMatrixDropdownRenderedCell(); + cell.isEmpty = true; + renderedRow.cells.push(cell); + } + } + }; + QuestionMatrixDropdownRenderedTable.prototype.createDetailPanelRow = function (row, renderedRow) { + var panelFullWidth = this.matrix.isDesignMode; + var res = new QuestionMatrixDropdownRenderedRow(this.cssClasses, true); + res.row = row; + var buttonCell = new QuestionMatrixDropdownRenderedCell(); + if (this.matrix.hasRowText) { + buttonCell.colSpans = 2; + } + buttonCell.isEmpty = true; + if (!panelFullWidth) + res.cells.push(buttonCell); + var actionsCell = null; + if (this.hasActionCellInRows("end")) { + actionsCell = new QuestionMatrixDropdownRenderedCell(); + actionsCell.isEmpty = true; + } + var cell = new QuestionMatrixDropdownRenderedCell(); + cell.panel = row.detailPanel; + cell.colSpans = + renderedRow.cells.length - + (!panelFullWidth ? buttonCell.colSpans : 0) - + (!!actionsCell ? actionsCell.colSpans : 0); + cell.className = this.cssClasses.detailPanelCell; + res.cells.push(cell); + if (!!actionsCell) { + res.cells.push(actionsCell); + } + if (typeof this.matrix.onCreateDetailPanelRenderedRowCallback === "function") { + this.matrix.onCreateDetailPanelRenderedRowCallback(res); + } + return res; + }; + QuestionMatrixDropdownRenderedTable.prototype.buildVerticalRows = function () { + var columns = this.matrix.columns; + var renderedRows = []; + for (var i = 0; i < columns.length; i++) { + var col = columns[i]; + if (col.isVisible && col.hasVisibleCell) { + if (col.isShowInMultipleColumns) { + this.createMutlipleVerticalRows(renderedRows, col, i); + } + else { + renderedRows.push(this.createVerticalRow(col, i)); + } + } + } + if (this.hasActionCellInRows("end")) { + renderedRows.push(this.createEndVerticalActionRow()); + } + return renderedRows; + }; + QuestionMatrixDropdownRenderedTable.prototype.createMutlipleVerticalRows = function (renderedRows, column, index) { + var choices = this.getMultipleColumnChoices(column); + if (!choices) + return; + for (var i = 0; i < choices.length; i++) { + renderedRows.push(this.createVerticalRow(column, index, choices[i], i)); + } + }; + QuestionMatrixDropdownRenderedTable.prototype.createVerticalRow = function (column, index, choice, choiceIndex) { + if (choice === void 0) { choice = null; } + if (choiceIndex === void 0) { choiceIndex = -1; } + var res = new QuestionMatrixDropdownRenderedRow(this.cssClasses); + if (this.matrix.showHeader) { + var lTitle = !!choice ? choice.locText : column.locTitle; + var hCell = this.createTextCell(lTitle); + hCell.column = column; + hCell.className = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]() + .append(hCell.className) + .append(this.cssClasses.rowTextCell).toString(); + if (!choice) { + this.setRequriedToHeaderCell(column, hCell); + } + res.cells.push(hCell); + } + var rows = this.matrix.visibleRows; + for (var i = 0; i < rows.length; i++) { + var rChoice = choice; + var rChoiceIndex = choiceIndex >= 0 ? choiceIndex : i; + var cell = rows[i].cells[index]; + var visChoices = !!choice ? cell.question.visibleChoices : undefined; + if (!!visChoices && rChoiceIndex < visChoices.length) { + rChoice = visChoices[rChoiceIndex]; + } + var rCell = this.createEditCell(cell, rChoice); + rCell.item = rChoice; + rCell.choiceIndex = rChoiceIndex; + res.cells.push(rCell); + } + if (this.matrix.hasTotal) { + res.cells.push(this.createEditCell(this.matrix.visibleTotalRow.cells[index])); + } + return res; + }; + QuestionMatrixDropdownRenderedTable.prototype.createEndVerticalActionRow = function () { + var res = new QuestionMatrixDropdownRenderedRow(this.cssClasses); + if (this.matrix.showHeader) { + res.cells.push(this.createEmptyCell()); + } + var rows = this.matrix.visibleRows; + for (var i = 0; i < rows.length; i++) { + res.cells.push(this.getRowActionsCell(i, "end")); + } + if (this.matrix.hasTotal) { + res.cells.push(this.createEmptyCell()); + } + return res; + }; + QuestionMatrixDropdownRenderedTable.prototype.createMutlipleEditCells = function (rRow, cell, isFooter) { + if (isFooter === void 0) { isFooter = false; } + var choices = isFooter + ? this.getMultipleColumnChoices(cell.column) + : cell.question.visibleChoices; + if (!choices) + return; + for (var i = 0; i < choices.length; i++) { + var rCell = this.createEditCell(cell, !isFooter ? choices[i] : undefined); + if (!isFooter) { + //rCell.item = choices[i]; + rCell.choiceIndex = i; + } + rRow.cells.push(rCell); + } + }; + QuestionMatrixDropdownRenderedTable.prototype.createEditCell = function (cell, choiceItem) { + if (choiceItem === void 0) { choiceItem = undefined; } + var res = new QuestionMatrixDropdownRenderedCell(); + res.cell = cell; + res.row = cell.row; + res.question = cell.question; + res.matrix = this.matrix; + res.item = choiceItem; + res.className = res.calculateFinalClassName(this.cssClasses); + //res.css = res.calcCss(this.cssClasses.cell); + // var questionCss = cell.question.cssClasses; + // var className = ""; + // if (!!questionCss) { + // className = ""; + // if (!!questionCss.itemValue) { + // className += " " + questionCss.itemValue; + // } + // if (!!questionCss.asCell) { + // if (!!className) className += ""; + // className += questionCss.asCell; + // } + // } + // if (!className && !!this.cssClasses.cell) { + // className = this.cssClasses.cell; + // } + //res.className = className; + return res; + }; + QuestionMatrixDropdownRenderedTable.prototype.createMutlipleColumnsFooter = function (rRow, cell) { + this.createMutlipleEditCells(rRow, cell, true); + }; + QuestionMatrixDropdownRenderedTable.prototype.createMutlipleColumnsHeader = function (column) { + var choices = this.getMultipleColumnChoices(column); + if (!choices) + return; + for (var i = 0; i < choices.length; i++) { + var cell = this.createTextCell(choices[i].locText); + this.setHeaderCell(column, cell); + this.headerRow.cells.push(cell); + } + }; + QuestionMatrixDropdownRenderedTable.prototype.getMultipleColumnChoices = function (column) { + var choices = column.templateQuestion.choices; + if (!!choices && Array.isArray(choices) && choices.length == 0) + return this.matrix.choices; + choices = column.templateQuestion.visibleChoices; + if (!choices || !Array.isArray(choices)) + return null; + return choices; + }; + QuestionMatrixDropdownRenderedTable.prototype.createHeaderCell = function (column) { + var cell = !!column ? this.createTextCell(column.locTitle) : this.createEmptyCell(); + cell.column = column; + this.setHeaderCell(column, cell); + cell.className = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]().append(this.cssClasses.headerCell).append(this.cssClasses.emptyCell, !!cell.isEmpty).toString(); + return cell; + }; + QuestionMatrixDropdownRenderedTable.prototype.setHeaderCell = function (column, cell) { + this.setHeaderCellWidth(column, cell); + this.setRequriedToHeaderCell(column, cell); + }; + QuestionMatrixDropdownRenderedTable.prototype.setHeaderCellWidth = function (column, cell) { + cell.minWidth = column != null ? this.matrix.getColumnWidth(column) : ""; + cell.width = column != null ? column.width : this.matrix.getRowTitleWidth(); + }; + QuestionMatrixDropdownRenderedTable.prototype.setRequriedToHeaderCell = function (column, cell) { + if (!!column && column.isRequired && this.matrix.survey) { + cell.requiredText = this.matrix.survey.requiredText; + } + }; + QuestionMatrixDropdownRenderedTable.prototype.createRemoveRowCell = function (row) { + var res = new QuestionMatrixDropdownRenderedCell(); + res.row = row; + res.isRemoveRow = this.canRemoveRow(row); + if (!!this.cssClasses.cell) { + res.className = this.cssClasses.cell; + } + return res; + }; + QuestionMatrixDropdownRenderedTable.prototype.createTextCell = function (locTitle) { + var cell = new QuestionMatrixDropdownRenderedCell(); + cell.locTitle = locTitle; + if (!!this.cssClasses.cell) { + cell.className = this.cssClasses.cell; + } + return cell; + }; + QuestionMatrixDropdownRenderedTable.prototype.createEmptyCell = function () { + var res = this.createTextCell(null); + res.isEmpty = true; + return res; + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["propertyArray"])({ + onPush: function (_, i, target) { + target.renderedRowsChangedCallback(); + }, + }) + ], QuestionMatrixDropdownRenderedTable.prototype, "rows", void 0); + return QuestionMatrixDropdownRenderedTable; + }(_base__WEBPACK_IMPORTED_MODULE_1__["Base"])); + + + + /***/ }), + + /***/ "./src/question_matrixdynamic.ts": + /*!***************************************!*\ + !*** ./src/question_matrixdynamic.ts ***! + \***************************************/ + /*! exports provided: MatrixDynamicRowModel, QuestionMatrixDynamicModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MatrixDynamicRowModel", function() { return MatrixDynamicRowModel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMatrixDynamicModel", function() { return QuestionMatrixDynamicModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_matrixdropdownbase */ "./src/question_matrixdropdownbase.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./error */ "./src/error.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); + /* harmony import */ var _dragdrop_matrix_rows__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./dragdrop/matrix-rows */ "./src/dragdrop/matrix-rows.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _question_matrixdropdownrendered__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./question_matrixdropdownrendered */ "./src/question_matrixdropdownrendered.ts"); + /* harmony import */ var _utils_dragOrClickHelper__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/dragOrClickHelper */ "./src/utils/dragOrClickHelper.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + + + + + + var MatrixDynamicRowModel = /** @class */ (function (_super) { + __extends(MatrixDynamicRowModel, _super); + function MatrixDynamicRowModel(index, data, value) { + var _this = _super.call(this, data, value) || this; + _this.index = index; + _this.buildCells(value); + return _this; + } + Object.defineProperty(MatrixDynamicRowModel.prototype, "rowName", { + get: function () { + return this.id; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MatrixDynamicRowModel.prototype, "shortcutText", { + get: function () { + var matrix = this.data; + var index = matrix.visibleRows.indexOf(this) + 1; + var questionValue1 = this.cells.length > 1 ? this.cells[1]["questionValue"] : undefined; + var questionValue0 = this.cells.length > 0 ? this.cells[0]["questionValue"] : undefined; + return (questionValue1 && questionValue1.value || + questionValue0 && questionValue0.value || + "" + index); + }, + enumerable: false, + configurable: true + }); + return MatrixDynamicRowModel; + }(_question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_2__["MatrixDropdownRowModelBase"])); + + /** + * A Model for a matrix dymanic question. You may use a dropdown, checkbox, radiogroup, text and comment questions as a cell editors. + * An end-user may dynamically add/remove rows, unlike in matrix dropdown question. + */ + var QuestionMatrixDynamicModel = /** @class */ (function (_super) { + __extends(QuestionMatrixDynamicModel, _super); + function QuestionMatrixDynamicModel(name) { + var _this = _super.call(this, name) || this; + _this.rowCounter = 0; + _this.initialRowCount = 2; + _this.setRowCountValueFromData = false; + _this.startDragMatrixRow = function (event, currentTarget) { + _this.dragDropMatrixRows.startDrag(event, _this.draggedRow, _this, event.target); + }; + _this.moveRowByIndex = function (fromIndex, toIndex) { + var value = _this.createNewValue(); + if (!value) + return; + var movableRow = value[fromIndex]; + if (!movableRow) + return; + value.splice(fromIndex, 1); + value.splice(toIndex, 0, movableRow); + _this.value = value; + }; + _this.createLocalizableString("confirmDeleteText", _this, false, "confirmDelete"); + var locAddRowText = _this.createLocalizableString("addRowText", _this); + locAddRowText.onGetTextCallback = function (text) { + return !!text ? text : _this.defaultAddRowText; + }; + _this.createLocalizableString("removeRowText", _this, false, "removeRow"); + _this.createLocalizableString("emptyRowsText", _this, false, true); + _this.registerFunctionOnPropertiesValueChanged(["hideColumnsIfEmpty", "allowAddRows"], function () { + _this.updateShowTableAndAddRow(); + }); + _this.registerFunctionOnPropertyValueChanged("allowRowsDragAndDrop", function () { + _this.clearRowsAndResetRenderedTable(); + }); + _this.dragOrClickHelper = new _utils_dragOrClickHelper__WEBPACK_IMPORTED_MODULE_10__["DragOrClickHelper"](_this.startDragMatrixRow); + return _this; + } + QuestionMatrixDynamicModel.prototype.setSurveyImpl = function (value, isLight) { + _super.prototype.setSurveyImpl.call(this, value, isLight); + this.dragDropMatrixRows = new _dragdrop_matrix_rows__WEBPACK_IMPORTED_MODULE_7__["DragDropMatrixRows"](this.survey); + }; + QuestionMatrixDynamicModel.prototype.isBanStartDrag = function (pointerDownEvent) { + var target = pointerDownEvent.target; + return target.getAttribute("contenteditable") === "true" || target.nodeName === "INPUT"; + }; + QuestionMatrixDynamicModel.prototype.onPointerDown = function (pointerDownEvent, row) { + if (!this.allowRowsDragAndDrop) + return; + if (this.isBanStartDrag(pointerDownEvent)) + return; + if (row.isDetailPanelShowing) + return; + this.draggedRow = row; + this.dragOrClickHelper.onPointerDown(pointerDownEvent); + }; + QuestionMatrixDynamicModel.prototype.getType = function () { + return "matrixdynamic"; + }; + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "isRowsDynamic", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "confirmDelete", { + /** + * Set it to true, to show a confirmation dialog on removing a row + * @see ConfirmDeleteText + */ + get: function () { + return this.getPropertyValue("confirmDelete", false); + }, + set: function (val) { + this.setPropertyValue("confirmDelete", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "keyName", { + /** + * Set it to a column name and the library shows duplication error, if there are same values in different rows in the column. + * @see keyDuplicationError + */ + get: function () { + return this.getPropertyValue("keyName", ""); + }, + set: function (val) { + this.setPropertyValue("keyName", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "defaultRowValue", { + /** + * If it is not empty, then this value is set to every new row, including rows created initially, unless the defaultValue is not empty + * @see defaultValue + * @see defaultValueFromLastRow + */ + get: function () { + return this.getPropertyValue("defaultRowValue"); + }, + set: function (val) { + this.setPropertyValue("defaultRowValue", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "defaultValueFromLastRow", { + /** + * Set it to true to copy the value into new added row from the last row. If defaultRowValue is set and this property equals to true, + * then the value for new added row is merging. + * @see defaultValue + * @see defaultRowValue + */ + get: function () { + return this.getPropertyValue("defaultValueFromLastRow", false); + }, + set: function (val) { + this.setPropertyValue("defaultValueFromLastRow", val); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDynamicModel.prototype.isDefaultValueEmpty = function () { + return (_super.prototype.isDefaultValueEmpty.call(this) && this.isValueEmpty(this.defaultRowValue)); + }; + QuestionMatrixDynamicModel.prototype.valueFromData = function (val) { + if (this.minRowCount < 1) + return _super.prototype.valueFromData.call(this, val); + if (!Array.isArray(val)) + val = []; + for (var i = val.length; i < this.minRowCount; i++) + val.push({}); + return val; + }; + QuestionMatrixDynamicModel.prototype.setDefaultValue = function () { + if (this.isValueEmpty(this.defaultRowValue) || + !this.isValueEmpty(this.defaultValue)) { + _super.prototype.setDefaultValue.call(this); + return; + } + if (!this.isEmpty() || this.rowCount == 0) + return; + var newValue = []; + for (var i = 0; i < this.rowCount; i++) { + newValue.push(this.defaultRowValue); + } + this.value = newValue; + }; + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "rowCount", { + /** + * The number of rows in the matrix. + * @see minRowCount + * @see maxRowCount + */ + get: function () { + return this.rowCountValue; + }, + set: function (val) { + if (val < 0 || val > _settings__WEBPACK_IMPORTED_MODULE_5__["settings"].matrixMaximumRowCount) + return; + this.setRowCountValueFromData = false; + var prevValue = this.rowCountValue; + this.rowCountValue = val; + if (this.value && this.value.length > val) { + var qVal = this.value; + qVal.splice(val); + this.value = qVal; + } + if (this.isUpdateLocked) { + this.initialRowCount = val; + return; + } + if (this.generatedVisibleRows || prevValue == 0) { + if (!this.generatedVisibleRows) { + this.generatedVisibleRows = []; + } + this.generatedVisibleRows.splice(val); + for (var i = prevValue; i < val; i++) { + var newRow = this.createMatrixRow(this.getValueForNewRow()); + this.generatedVisibleRows.push(newRow); + this.onMatrixRowCreated(newRow); + } + } + this.onRowsChanged(); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDynamicModel.prototype.updateProgressInfoByValues = function (res) { + var val = this.value; + if (!Array.isArray(val)) + val = []; + for (var i = 0; i < this.rowCount; i++) { + var rowValue = i < val.length ? val[i] : {}; + this.updateProgressInfoByRow(res, rowValue); + } + }; + QuestionMatrixDynamicModel.prototype.getValueForNewRow = function () { + var res = null; + if (!!this.onGetValueForNewRowCallBack) { + res = this.onGetValueForNewRowCallBack(this); + } + return res; + }; + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "allowRowsDragAndDrop", { + /** + * Set this property to true, to allow rows drag and drop. + */ + get: function () { + if (this.readOnly) + return false; + return this.getPropertyValue("allowRowsDragAndDrop"); + }, + set: function (val) { + this.setPropertyValue("allowRowsDragAndDrop", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "iconDragElement", { + get: function () { + return this.cssClasses.iconDragElement; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDynamicModel.prototype.createRenderedTable = function () { + return new QuestionMatrixDynamicRenderedTable(this); + }; + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "rowCountValue", { + get: function () { + return this.getPropertyValue("rowCount"); + }, + set: function (val) { + this.setPropertyValue("rowCount", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "minRowCount", { + /** + * The minimum row count. A user could not delete a row if the rowCount equals to minRowCount + * @see rowCount + * @see maxRowCount + * @see allowAddRows + */ + get: function () { + return this.getPropertyValue("minRowCount"); + }, + set: function (val) { + if (val < 0) + val = 0; + this.setPropertyValue("minRowCount", val); + if (val > this.maxRowCount) + this.maxRowCount = val; + if (this.rowCount < val) + this.rowCount = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "maxRowCount", { + /** + * The maximum row count. A user could not add a row if the rowCount equals to maxRowCount + * @see rowCount + * @see minRowCount + * @see allowAddRows + */ + get: function () { + return this.getPropertyValue("maxRowCount"); + }, + set: function (val) { + if (val <= 0) + return; + if (val > _settings__WEBPACK_IMPORTED_MODULE_5__["settings"].matrixMaximumRowCount) + val = _settings__WEBPACK_IMPORTED_MODULE_5__["settings"].matrixMaximumRowCount; + if (val == this.maxRowCount) + return; + this.setPropertyValue("maxRowCount", val); + if (val < this.minRowCount) + this.minRowCount = val; + if (this.rowCount > val) + this.rowCount = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "allowAddRows", { + /** + * Set this property to false to disable ability to add new rows. "Add new Row" button becomes invsible in UI + * @see canAddRow + * @see allowRemoveRows + */ + get: function () { + return this.getPropertyValue("allowAddRows"); + }, + set: function (val) { + this.setPropertyValue("allowAddRows", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "allowRemoveRows", { + /** + * Set this property to false to disable ability to remove rows. "Remove" row buttons become invsible in UI + * @see canRemoveRows + * @see allowAddRows + */ + get: function () { + return this.getPropertyValue("allowRemoveRows"); + }, + set: function (val) { + this.setPropertyValue("allowRemoveRows", val); + if (!this.isUpdateLocked) { + this.resetRenderedTable(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "canAddRow", { + /** + * Returns true, if a new row can be added. + * @see allowAddRows + * @see maxRowCount + * @see canRemoveRows + * @see rowCount + */ + get: function () { + return (this.allowAddRows && !this.isReadOnly && this.rowCount < this.maxRowCount); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "canRemoveRows", { + /** + * Returns true, if row can be removed. + * @see minRowCount + * @see canAddRow + * @see rowCount + */ + get: function () { + var res = this.allowRemoveRows && + !this.isReadOnly && + this.rowCount > this.minRowCount; + return !!this.canRemoveRowsCallback ? this.canRemoveRowsCallback(res) : res; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDynamicModel.prototype.canRemoveRow = function (row) { + if (!this.survey) + return true; + return this.survey.matrixAllowRemoveRow(this, row.index, row); + }; + /** + * Creates and add a new row and focus the cell in the first column. + */ + QuestionMatrixDynamicModel.prototype.addRowUI = function () { + var oldRowCount = this.rowCount; + this.addRow(); + if (oldRowCount === this.rowCount) + return; + var q = this.getQuestionToFocusOnAddingRow(); + if (!!q) { + q.focus(); + } + }; + QuestionMatrixDynamicModel.prototype.getQuestionToFocusOnAddingRow = function () { + var row = this.visibleRows[this.visibleRows.length - 1]; + for (var i = 0; i < row.cells.length; i++) { + var q = row.cells[i].question; + if (!!q && q.isVisible && !q.isReadOnly) { + return q; + } + } + return null; + }; + /** + * Creates and add a new row. + */ + QuestionMatrixDynamicModel.prototype.addRow = function () { + var options = { question: this, canAddRow: this.canAddRow }; + if (!!this.survey) { + this.survey.matrixBeforeRowAdded(options); + } + if (!options.canAddRow) + return; + this.onStartRowAddingRemoving(); + this.addRowCore(); + this.onEndRowAdding(); + if (this.detailPanelShowOnAdding && this.visibleRows.length > 0) { + this.visibleRows[this.visibleRows.length - 1].showDetailPanel(); + } + }; + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "detailPanelShowOnAdding", { + /** + * Set this property to true to show detail panel immediately on adding a new row. + * @see detailPanelMode + */ + get: function () { + return this.getPropertyValue("detailPanelShowOnAdding"); + }, + set: function (val) { + this.setPropertyValue("detailPanelShowOnAdding", val); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDynamicModel.prototype.hasRowsAsItems = function () { + return false; + }; + QuestionMatrixDynamicModel.prototype.unbindValue = function () { + this.clearGeneratedRows(); + this.clearPropertyValue("value"); + this.rowCountValue = 0; + _super.prototype.unbindValue.call(this); + }; + QuestionMatrixDynamicModel.prototype.isValueSurveyElement = function (val) { + return this.isEditingSurveyElement || _super.prototype.isValueSurveyElement.call(this, val); + }; + QuestionMatrixDynamicModel.prototype.addRowCore = function () { + var prevRowCount = this.rowCount; + this.rowCount = this.rowCount + 1; + var defaultValue = this.getDefaultRowValue(true); + var newValue = null; + if (!this.isValueEmpty(defaultValue)) { + newValue = this.createNewValue(); + if (newValue.length == this.rowCount) { + newValue[newValue.length - 1] = defaultValue; + this.value = newValue; + } + } + if (this.data) { + this.runCellsCondition(this.getDataFilteredValues(), this.getDataFilteredProperties()); + var row = this.visibleRows[this.rowCount - 1]; + if (!this.isValueEmpty(row.value)) { + if (!newValue) { + newValue = this.createNewValue(); + } + if (!this.isValueSurveyElement(newValue) && + !this.isTwoValueEquals(newValue[newValue.length - 1], row.value)) { + newValue[newValue.length - 1] = row.value; + this.value = newValue; + } + } + } + if (this.survey) { + if (prevRowCount + 1 == this.rowCount) { + this.survey.matrixRowAdded(this, this.visibleRows[this.visibleRows.length - 1]); + this.onRowsChanged(); + } + } + }; + QuestionMatrixDynamicModel.prototype.getDefaultRowValue = function (isRowAdded) { + var res = null; + for (var i = 0; i < this.columns.length; i++) { + var q = this.columns[i].templateQuestion; + if (!!q && !this.isValueEmpty(q.getDefaultValue())) { + res = res || {}; + res[this.columns[i].name] = q.getDefaultValue(); + } + } + if (!this.isValueEmpty(this.defaultRowValue)) { + for (var key in this.defaultRowValue) { + res = res || {}; + res[key] = this.defaultRowValue[key]; + } + } + if (isRowAdded && this.defaultValueFromLastRow) { + var val = this.value; + if (!!val && Array.isArray(val) && val.length >= this.rowCount - 1) { + var rowValue = val[this.rowCount - 2]; + for (var key in rowValue) { + res = res || {}; + res[key] = rowValue[key]; + } + } + } + return res; + }; + /** + * Removes a row by it's index. If confirmDelete is true, show a confirmation dialog + * @param index a row index, from 0 to rowCount - 1 + * @see removeRow + * @see confirmDelete + */ + QuestionMatrixDynamicModel.prototype.removeRowUI = function (value) { + if (!!value && !!value.rowName) { + var index = this.visibleRows.indexOf(value); + if (index < 0) + return; + value = index; + } + if (!this.isRequireConfirmOnRowDelete(value) || + Object(_utils_utils__WEBPACK_IMPORTED_MODULE_6__["confirmAction"])(this.confirmDeleteText)) { + this.removeRow(value); + } + }; + QuestionMatrixDynamicModel.prototype.isRequireConfirmOnRowDelete = function (index) { + if (!this.confirmDelete) + return false; + if (index < 0 || index >= this.rowCount) + return false; + var value = this.createNewValue(); + if (this.isValueEmpty(value) || !Array.isArray(value)) + return false; + if (index >= value.length) + return false; + return !this.isValueEmpty(value[index]); + }; + /** + * Removes a row by it's index. + * @param index a row index, from 0 to rowCount - 1 + */ + QuestionMatrixDynamicModel.prototype.removeRow = function (index) { + if (!this.canRemoveRows) + return; + if (index < 0 || index >= this.rowCount) + return; + var row = !!this.visibleRows && index < this.visibleRows.length + ? this.visibleRows[index] + : null; + if (!!row && + !!this.survey && + !this.survey.matrixRowRemoving(this, index, row)) + return; + this.onStartRowAddingRemoving(); + this.removeRowCore(index); + this.onEndRowRemoving(row); + }; + QuestionMatrixDynamicModel.prototype.removeRowCore = function (index) { + var row = this.generatedVisibleRows + ? this.generatedVisibleRows[index] + : null; + if (this.generatedVisibleRows && index < this.generatedVisibleRows.length) { + this.generatedVisibleRows.splice(index, 1); + } + this.rowCountValue--; + if (this.value) { + var val = []; + if (Array.isArray(this.value) && index < this.value.length) { + val = this.createValueCopy(); + } + else { + val = this.createNewValue(); + } + val.splice(index, 1); + val = this.deleteRowValue(val, null); + this.isRowChanging = true; + this.value = val; + this.isRowChanging = false; + } + this.onRowsChanged(); + if (this.survey) { + this.survey.matrixRowRemoved(this, index, row); + } + }; + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "confirmDeleteText", { + /** + * Use this property to change the default text showing in the confirmation delete dialog on removing a row. + */ + get: function () { + return this.getLocalizableStringText("confirmDeleteText"); + }, + set: function (val) { + this.setLocalizableStringText("confirmDeleteText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "locConfirmDeleteText", { + get: function () { + return this.getLocalizableString("confirmDeleteText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "addRowText", { + /** + * Use this property to change the default value of add row button text. + */ + get: function () { + return this.getLocalizableStringText("addRowText", this.defaultAddRowText); + }, + set: function (val) { + this.setLocalizableStringText("addRowText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "locAddRowText", { + get: function () { + return this.getLocalizableString("addRowText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "defaultAddRowText", { + get: function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString(this.isColumnLayoutHorizontal ? "addRow" : "addColumn"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "addRowLocation", { + /** + * By default the 'Add Row' button is shown on bottom if columnLayout is horizontal and on top if columnLayout is vertical.
+ * You may set it to "top", "bottom" or "topBottom" (to show on top and bottom). + * @see columnLayout + */ + get: function () { + return this.getPropertyValue("addRowLocation"); + }, + set: function (val) { + this.setPropertyValue("addRowLocation", val); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDynamicModel.prototype.getAddRowLocation = function () { + return this.addRowLocation; + }; + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "hideColumnsIfEmpty", { + /** + * Set this property to true to hide matrix columns when there is no any row. + */ + get: function () { + return this.getPropertyValue("hideColumnsIfEmpty"); + }, + set: function (val) { + this.setPropertyValue("hideColumnsIfEmpty", val); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDynamicModel.prototype.getShowColumnsIfEmpty = function () { + return this.hideColumnsIfEmpty; + }; + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "removeRowText", { + /** + * Use this property to change the default value of remove row button text. + */ + get: function () { + return this.getLocalizableStringText("removeRowText"); + }, + set: function (val) { + this.setLocalizableStringText("removeRowText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "locRemoveRowText", { + get: function () { + return this.getLocalizableString("removeRowText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "emptyRowsText", { + /** + * Use this property to change the default value of remove row button text. + */ + get: function () { + return this.getLocalizableStringText("emptyRowsText"); + }, + set: function (val) { + this.setLocalizableStringText("emptyRowsText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "locEmptyRowsText", { + get: function () { + return this.getLocalizableString("emptyRowsText"); + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDynamicModel.prototype.getDisplayValueCore = function (keysAsText, value) { + if (!value || !Array.isArray(value)) + return value; + var values = this.getUnbindValue(value); + var rows = this.visibleRows; + for (var i = 0; i < rows.length && i < values.length; i++) { + var val = values[i]; + if (!val) + continue; + values[i] = this.getRowDisplayValue(keysAsText, rows[i], val); + } + return values; + }; + QuestionMatrixDynamicModel.prototype.getConditionObjectRowName = function (index) { + return "[" + index.toString() + "]"; + }; + QuestionMatrixDynamicModel.prototype.getConditionObjectsRowIndeces = function () { + var res = []; + var rowCount = Math.max(this.rowCount, 1); + for (var i = 0; i < Math.min(_settings__WEBPACK_IMPORTED_MODULE_5__["settings"].matrixMaxRowCountInCondition, rowCount); i++) { + res.push(i); + } + return res; + }; + QuestionMatrixDynamicModel.prototype.supportGoNextPageAutomatic = function () { + return false; + }; + Object.defineProperty(QuestionMatrixDynamicModel.prototype, "hasRowText", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + QuestionMatrixDynamicModel.prototype.onCheckForErrors = function (errors, isOnValueChanged) { + _super.prototype.onCheckForErrors.call(this, errors, isOnValueChanged); + if (!isOnValueChanged && this.hasErrorInMinRows()) { + errors.push(new _error__WEBPACK_IMPORTED_MODULE_4__["MinRowCountError"](this.minRowCount, this)); + } + }; + QuestionMatrixDynamicModel.prototype.hasErrorInMinRows = function () { + if (this.minRowCount <= 0 || !this.isRequired || !this.generatedVisibleRows) + return false; + var setRowCount = 0; + for (var rowIndex = 0; rowIndex < this.generatedVisibleRows.length; rowIndex++) { + var row = this.generatedVisibleRows[rowIndex]; + if (!row.isEmpty) + setRowCount++; + } + return setRowCount < this.minRowCount; + }; + QuestionMatrixDynamicModel.prototype.getUniqueColumns = function () { + var res = _super.prototype.getUniqueColumns.call(this); + if (!!this.keyName) { + var column = this.getColumnByName(this.keyName); + if (!!column && res.indexOf(column) < 0) { + res.push(column); + } + } + return res; + }; + QuestionMatrixDynamicModel.prototype.generateRows = function () { + var result = new Array(); + if (this.rowCount === 0) + return result; + var val = this.createNewValue(); + for (var i = 0; i < this.rowCount; i++) { + result.push(this.createMatrixRow(this.getRowValueByIndex(val, i))); + } + if (!this.isValueEmpty(this.getDefaultRowValue(false))) { + this.value = val; + } + return result; + }; + QuestionMatrixDynamicModel.prototype.createMatrixRow = function (value) { + return new MatrixDynamicRowModel(this.rowCounter++, this, value); + }; + QuestionMatrixDynamicModel.prototype.onBeforeValueChanged = function (val) { + if (!val || !Array.isArray(val)) + return; + var newRowCount = val.length; + if (newRowCount == this.rowCount) + return; + if (!this.setRowCountValueFromData && newRowCount < this.initialRowCount) + return; + this.setRowCountValueFromData = true; + this.rowCountValue = newRowCount; + if (this.generatedVisibleRows) { + this.clearGeneratedRows(); + this.generatedVisibleRows = this.visibleRows; + this.onRowsChanged(); + } + }; + QuestionMatrixDynamicModel.prototype.createNewValue = function () { + var result = this.createValueCopy(); + if (!result || !Array.isArray(result)) + result = []; + if (result.length > this.rowCount) + result.splice(this.rowCount); + var rowValue = this.getDefaultRowValue(false); + rowValue = rowValue || {}; + for (var i = result.length; i < this.rowCount; i++) { + result.push(this.getUnbindValue(rowValue)); + } + return result; + }; + QuestionMatrixDynamicModel.prototype.deleteRowValue = function (newValue, row) { + var isEmpty = true; + for (var i = 0; i < newValue.length; i++) { + if (this.isObject(newValue[i]) && Object.keys(newValue[i]).length > 0) { + isEmpty = false; + break; + } + } + return isEmpty ? null : newValue; + }; + QuestionMatrixDynamicModel.prototype.getRowValueByIndex = function (questionValue, index) { + return Array.isArray(questionValue) && + index >= 0 && + index < questionValue.length + ? questionValue[index] + : null; + }; + QuestionMatrixDynamicModel.prototype.getRowValueCore = function (row, questionValue, create) { + if (create === void 0) { create = false; } + if (!this.generatedVisibleRows) + return {}; + var res = this.getRowValueByIndex(questionValue, this.generatedVisibleRows.indexOf(row)); + if (!res && create) + res = {}; + return res; + }; + QuestionMatrixDynamicModel.prototype.getAddRowButtonCss = function (isEmptySection) { + if (isEmptySection === void 0) { isEmptySection = false; } + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_8__["CssClassBuilder"]() + .append(this.cssClasses.button) + .append(this.cssClasses.buttonAdd) + .append(this.cssClasses.emptyRowsButton, isEmptySection) + .toString(); + }; + QuestionMatrixDynamicModel.prototype.getRemoveRowButtonCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_8__["CssClassBuilder"]() + .append(this.cssClasses.button) + .append(this.cssClasses.buttonRemove) + .toString(); + }; + QuestionMatrixDynamicModel.prototype.getRootCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_8__["CssClassBuilder"]().append(_super.prototype.getRootCss.call(this)).append(this.cssClasses.empty, !this.renderedTable.showTable).toString(); + }; + return QuestionMatrixDynamicModel; + }(_question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_2__["QuestionMatrixDropdownModelBase"])); + + var QuestionMatrixDynamicRenderedTable = /** @class */ (function (_super) { + __extends(QuestionMatrixDynamicRenderedTable, _super); + function QuestionMatrixDynamicRenderedTable() { + return _super !== null && _super.apply(this, arguments) || this; + } + QuestionMatrixDynamicRenderedTable.prototype.setDefaultRowActions = function (row, actions) { + _super.prototype.setDefaultRowActions.call(this, row, actions); + }; + return QuestionMatrixDynamicRenderedTable; + }(_question_matrixdropdownrendered__WEBPACK_IMPORTED_MODULE_9__["QuestionMatrixDropdownRenderedTable"])); + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("matrixdynamic", [ + { name: "rowsVisibleIf:condition", visible: false }, + { name: "allowAddRows:boolean", default: true }, + { name: "allowRemoveRows:boolean", default: true }, + { name: "rowCount:number", default: 2, minValue: 0, isBindable: true }, + { name: "minRowCount:number", default: 0, minValue: 0 }, + { + name: "maxRowCount:number", + default: _settings__WEBPACK_IMPORTED_MODULE_5__["settings"].matrixMaximumRowCount, + }, + { name: "keyName" }, + "defaultRowValue:rowvalue", + "defaultValueFromLastRow:boolean", + { name: "confirmDelete:boolean" }, + { + name: "confirmDeleteText", + dependsOn: "confirmDelete", + visibleIf: function (obj) { + return !obj || obj.confirmDelete; + }, + serializationProperty: "locConfirmDeleteText", + }, + { + name: "addRowLocation", + default: "default", + choices: ["default", "top", "bottom", "topBottom"], + }, + { name: "addRowText", serializationProperty: "locAddRowText" }, + { name: "removeRowText", serializationProperty: "locRemoveRowText" }, + "hideColumnsIfEmpty:boolean", + { + name: "emptyRowsText:text", + serializationProperty: "locEmptyRowsText", + dependsOn: "hideColumnsIfEmpty", + visibleIf: function (obj) { + return !obj || obj.hideColumnsIfEmpty; + }, + }, + { + name: "detailPanelShowOnAdding:boolean", + dependsOn: "detailPanelMode", + visibleIf: function (obj) { + return obj.detailPanelMode !== "none"; + }, + }, + "allowRowsDragAndDrop:switch" + ], function () { + return new QuestionMatrixDynamicModel(""); + }, "matrixdropdownbase"); + _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("matrixdynamic", function (name) { + var q = new QuestionMatrixDynamicModel(name); + q.choices = [1, 2, 3, 4, 5]; + _question_matrixdropdownbase__WEBPACK_IMPORTED_MODULE_2__["QuestionMatrixDropdownModelBase"].addDefaultColumns(q); + return q; + }); + + + /***/ }), + + /***/ "./src/question_multipletext.ts": + /*!**************************************!*\ + !*** ./src/question_multipletext.ts ***! + \**************************************/ + /*! exports provided: MultipleTextItemModel, QuestionMultipleTextModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MultipleTextItemModel", function() { return MultipleTextItemModel; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionMultipleTextModel", function() { return QuestionMultipleTextModel; }); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var _question_text__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./question_text */ "./src/question_text.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + + + var MultipleTextItemModel = /** @class */ (function (_super) { + __extends(MultipleTextItemModel, _super); + function MultipleTextItemModel(name, title) { + if (name === void 0) { name = null; } + if (title === void 0) { title = null; } + var _this = _super.call(this) || this; + _this.editorValue = _this.createEditor(name); + _this.editor.questionTitleTemplateCallback = function () { + return ""; + }; + _this.editor.titleLocation = "left"; + if (title) { + _this.title = title; + } + return _this; + } + MultipleTextItemModel.prototype.getType = function () { + return "multipletextitem"; + }; + Object.defineProperty(MultipleTextItemModel.prototype, "id", { + get: function () { + return this.editor.id; + }, + enumerable: false, + configurable: true + }); + MultipleTextItemModel.prototype.getOriginalObj = function () { + return this.editor; + }; + Object.defineProperty(MultipleTextItemModel.prototype, "name", { + /** + * The item name. + */ + get: function () { + return this.editor.name; + }, + set: function (val) { + this.editor.name = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MultipleTextItemModel.prototype, "question", { + get: function () { + return this.data; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MultipleTextItemModel.prototype, "editor", { + get: function () { + return this.editorValue; + }, + enumerable: false, + configurable: true + }); + MultipleTextItemModel.prototype.createEditor = function (name) { + return new _question_text__WEBPACK_IMPORTED_MODULE_3__["QuestionTextModel"](name); + }; + MultipleTextItemModel.prototype.addUsedLocales = function (locales) { + _super.prototype.addUsedLocales.call(this, locales); + this.editor.addUsedLocales(locales); + }; + MultipleTextItemModel.prototype.locStrsChanged = function () { + _super.prototype.locStrsChanged.call(this); + this.editor.locStrsChanged(); + }; + MultipleTextItemModel.prototype.setData = function (data) { + this.data = data; + if (!!data) { + this.editor.defaultValue = data.getItemDefaultValue(this.name); + this.editor.setSurveyImpl(this); + this.editor.parent = data; + } + }; + Object.defineProperty(MultipleTextItemModel.prototype, "isRequired", { + /** + * Set this property to true, to make the item a required. If a user doesn't fill the item then a validation error will be generated. + */ + get: function () { + return this.editor.isRequired; + }, + set: function (val) { + this.editor.isRequired = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MultipleTextItemModel.prototype, "inputType", { + /** + * Use this property to change the default input type. + */ + get: function () { + return this.editor.inputType; + }, + set: function (val) { + this.editor.inputType = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MultipleTextItemModel.prototype, "title", { + /** + * Item title. If it is empty, the item name is rendered as title. This property supports markdown. + * @see name + */ + get: function () { + return this.editor.title; + }, + set: function (val) { + this.editor.title = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MultipleTextItemModel.prototype, "locTitle", { + get: function () { + return this.editor.locTitle; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MultipleTextItemModel.prototype, "fullTitle", { + /** + * Returns the text or html for rendering the title. + */ + get: function () { + return this.editor.fullTitle; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MultipleTextItemModel.prototype, "maxLength", { + /** + * The maximum text length. If it is -1, defaul value, then the survey maxTextLength property will be used. + * If it is 0, then the value is unlimited + * @see SurveyModel.maxTextLength + */ + get: function () { + return this.editor.maxLength; + }, + set: function (val) { + this.editor.maxLength = val; + }, + enumerable: false, + configurable: true + }); + MultipleTextItemModel.prototype.getMaxLength = function () { + var survey = this.getSurvey(); + return _helpers__WEBPACK_IMPORTED_MODULE_6__["Helpers"].getMaxLength(this.maxLength, survey ? survey.maxTextLength : -1); + }; + Object.defineProperty(MultipleTextItemModel.prototype, "placeHolder", { + /** + * The input place holder. + */ + get: function () { + return this.editor.placeHolder; + }, + set: function (val) { + this.editor.placeHolder = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MultipleTextItemModel.prototype, "locPlaceHolder", { + get: function () { + return this.editor.locPlaceHolder; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MultipleTextItemModel.prototype, "requiredErrorText", { + /** + * The custom text that will be shown on required error. Use this property, if you do not want to show the default text. + */ + get: function () { + return this.editor.requiredErrorText; + }, + set: function (val) { + this.editor.requiredErrorText = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MultipleTextItemModel.prototype, "locRequiredErrorText", { + get: function () { + return this.editor.locRequiredErrorText; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MultipleTextItemModel.prototype, "size", { + /** + * The input size. + */ + get: function () { + return this.editor.size; + }, + set: function (val) { + this.editor.size = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(MultipleTextItemModel.prototype, "validators", { + /** + * The list of question validators. + */ + get: function () { + return this.editor.validators; + }, + set: function (val) { + this.editor.validators = val; + }, + enumerable: false, + configurable: true + }); + MultipleTextItemModel.prototype.getValidators = function () { + return this.validators; + }; + Object.defineProperty(MultipleTextItemModel.prototype, "value", { + /** + * The item value. + */ + get: function () { + return this.data ? this.data.getMultipleTextValue(this.name) : null; + }, + set: function (value) { + if (this.data != null) { + this.data.setMultipleTextValue(this.name, value); + } + }, + enumerable: false, + configurable: true + }); + MultipleTextItemModel.prototype.isEmpty = function () { + return this.editor.isEmpty(); + }; + MultipleTextItemModel.prototype.onValueChanged = function (newValue) { + if (this.valueChangedCallback) + this.valueChangedCallback(newValue); + }; + //ISurveyImpl + MultipleTextItemModel.prototype.getSurveyData = function () { + return this; + }; + MultipleTextItemModel.prototype.getSurvey = function () { + return this.data ? this.data.getSurvey() : null; + }; + MultipleTextItemModel.prototype.getTextProcessor = function () { + return this.data ? this.data.getTextProcessor() : null; + }; + //ISurveyData + MultipleTextItemModel.prototype.getValue = function (name) { + if (!this.data) + return null; + return this.data.getMultipleTextValue(name); + }; + MultipleTextItemModel.prototype.setValue = function (name, value) { + if (this.data) { + this.data.setMultipleTextValue(name, value); + } + }; + MultipleTextItemModel.prototype.getVariable = function (name) { + return undefined; + }; + MultipleTextItemModel.prototype.setVariable = function (name, newValue) { }; + MultipleTextItemModel.prototype.getComment = function (name) { + return null; + }; + MultipleTextItemModel.prototype.setComment = function (name, newValue) { }; + MultipleTextItemModel.prototype.getAllValues = function () { + if (this.data) + return this.data.getAllValues(); + return this.value; + }; + MultipleTextItemModel.prototype.getFilteredValues = function () { + return this.getAllValues(); + }; + MultipleTextItemModel.prototype.getFilteredProperties = function () { + return { survey: this.getSurvey() }; + }; + //IValidatorOwner + MultipleTextItemModel.prototype.getValidatorTitle = function () { + return this.title; + }; + Object.defineProperty(MultipleTextItemModel.prototype, "validatedValue", { + get: function () { + return this.value; + }, + set: function (val) { + this.value = val; + }, + enumerable: false, + configurable: true + }); + MultipleTextItemModel.prototype.getDataFilteredValues = function () { + return this.getFilteredValues(); + }; + MultipleTextItemModel.prototype.getDataFilteredProperties = function () { + return this.getFilteredProperties(); + }; + return MultipleTextItemModel; + }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); + + /** + * A Model for a multiple text question. + */ + var QuestionMultipleTextModel = /** @class */ (function (_super) { + __extends(QuestionMultipleTextModel, _super); + function QuestionMultipleTextModel(name) { + var _this = _super.call(this, name) || this; + _this.isMultipleItemValueChanging = false; + _this.createNewArray("items", function (item) { + item.setData(_this); + }); + _this.registerFunctionOnPropertyValueChanged("items", function () { + _this.fireCallback(_this.colCountChangedCallback); + }); + _this.registerFunctionOnPropertyValueChanged("colCount", function () { + _this.fireCallback(_this.colCountChangedCallback); + }); + _this.registerFunctionOnPropertyValueChanged("itemSize", function () { + _this.updateItemsSize(); + }); + return _this; + } + QuestionMultipleTextModel.addDefaultItems = function (question) { + var names = _questionfactory__WEBPACK_IMPORTED_MODULE_5__["QuestionFactory"].DefaultMutlipleTextItems; + for (var i = 0; i < names.length; i++) + question.addItem(names[i]); + }; + QuestionMultipleTextModel.prototype.getType = function () { + return "multipletext"; + }; + QuestionMultipleTextModel.prototype.setSurveyImpl = function (value, isLight) { + _super.prototype.setSurveyImpl.call(this, value, isLight); + for (var i = 0; i < this.items.length; i++) { + this.items[i].setData(this); + } + }; + Object.defineProperty(QuestionMultipleTextModel.prototype, "isAllowTitleLeft", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMultipleTextModel.prototype, "hasSingleInput", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + QuestionMultipleTextModel.prototype.onSurveyLoad = function () { + this.editorsOnSurveyLoad(); + _super.prototype.onSurveyLoad.call(this); + this.fireCallback(this.colCountChangedCallback); + }; + QuestionMultipleTextModel.prototype.setQuestionValue = function (newValue, updateIsAnswered) { + if (updateIsAnswered === void 0) { updateIsAnswered = true; } + _super.prototype.setQuestionValue.call(this, newValue, updateIsAnswered); + this.performForEveryEditor(function (item) { + item.editor.updateValueFromSurvey(item.value); + }); + this.updateIsAnswered(); + }; + QuestionMultipleTextModel.prototype.onSurveyValueChanged = function (newValue) { + _super.prototype.onSurveyValueChanged.call(this, newValue); + this.performForEveryEditor(function (item) { + item.editor.onSurveyValueChanged(item.value); + }); + }; + QuestionMultipleTextModel.prototype.updateItemsSize = function () { + this.performForEveryEditor(function (item) { + item.editor.updateInputSize(); + }); + }; + QuestionMultipleTextModel.prototype.editorsOnSurveyLoad = function () { + this.performForEveryEditor(function (item) { + item.editor.onSurveyLoad(); + }); + }; + QuestionMultipleTextModel.prototype.performForEveryEditor = function (func) { + for (var i = 0; i < this.items.length; i++) { + var item = this.items[i]; + if (item.editor) { + func(item); + } + } + }; + Object.defineProperty(QuestionMultipleTextModel.prototype, "items", { + /** + * The list of input items. + */ + get: function () { + return this.getPropertyValue("items"); + }, + set: function (val) { + this.setPropertyValue("items", val); + }, + enumerable: false, + configurable: true + }); + /** + * Add a new text item. + * @param name a item name + * @param title a item title (optional) + */ + QuestionMultipleTextModel.prototype.addItem = function (name, title) { + if (title === void 0) { title = null; } + var item = this.createTextItem(name, title); + this.items.push(item); + return item; + }; + QuestionMultipleTextModel.prototype.getItemByName = function (name) { + for (var i = 0; i < this.items.length; i++) { + if (this.items[i].name == name) + return this.items[i]; + } + return null; + }; + QuestionMultipleTextModel.prototype.addConditionObjectsByContext = function (objects, context) { + for (var i = 0; i < this.items.length; i++) { + var item = this.items[i]; + objects.push({ + name: this.getValueName() + "." + item.name, + text: this.processedTitle + "." + item.fullTitle, + question: this, + }); + } + }; + QuestionMultipleTextModel.prototype.getConditionJson = function (operator, path) { + if (path === void 0) { path = null; } + if (!path) + return _super.prototype.getConditionJson.call(this); + var item = this.getItemByName(path); + if (!item) + return null; + var json = new _jsonobject__WEBPACK_IMPORTED_MODULE_4__["JsonObject"]().toJsonObject(item); + json["type"] = "text"; + return json; + }; + QuestionMultipleTextModel.prototype.locStrsChanged = function () { + _super.prototype.locStrsChanged.call(this); + for (var i = 0; i < this.items.length; i++) { + this.items[i].locStrsChanged(); + } + }; + QuestionMultipleTextModel.prototype.supportGoNextPageAutomatic = function () { + for (var i = 0; i < this.items.length; i++) { + if (this.items[i].isEmpty()) + return false; + } + return true; + }; + Object.defineProperty(QuestionMultipleTextModel.prototype, "colCount", { + /** + * The number of columns. Items are rendred in one line if the value is 0. + */ + get: function () { + return this.getPropertyValue("colCount"); + }, + set: function (val) { + if (val < 1 || val > 5) + return; + this.setPropertyValue("colCount", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionMultipleTextModel.prototype, "itemSize", { + /** + * The default text input size. + */ + get: function () { + return this.getPropertyValue("itemSize"); + }, + set: function (val) { + this.setPropertyValue("itemSize", val); + }, + enumerable: false, + configurable: true + }); + /** + * Returns the list of rendered rows. + */ + QuestionMultipleTextModel.prototype.getRows = function () { + var colCount = this.colCount; + var items = this.items; + var rows = []; + var index = 0; + for (var i = 0; i < items.length; i++) { + if (index == 0) { + rows.push([]); + } + rows[rows.length - 1].push(items[i]); + index++; + if (index >= colCount) { + index = 0; + } + } + return rows; + }; + QuestionMultipleTextModel.prototype.onValueChanged = function () { + _super.prototype.onValueChanged.call(this); + this.onItemValueChanged(); + }; + QuestionMultipleTextModel.prototype.createTextItem = function (name, title) { + return new MultipleTextItemModel(name, title); + }; + QuestionMultipleTextModel.prototype.onItemValueChanged = function () { + if (this.isMultipleItemValueChanging) + return; + for (var i = 0; i < this.items.length; i++) { + var itemValue = null; + if (this.value && this.items[i].name in this.value) { + itemValue = this.value[this.items[i].name]; + } + this.items[i].onValueChanged(itemValue); + } + }; + QuestionMultipleTextModel.prototype.getIsRunningValidators = function () { + if (_super.prototype.getIsRunningValidators.call(this)) + return true; + for (var i = 0; i < this.items.length; i++) { + if (this.items[i].editor.isRunningValidators) + return true; + } + return false; + }; + QuestionMultipleTextModel.prototype.hasErrors = function (fireCallback, rec) { + var _this = this; + if (fireCallback === void 0) { fireCallback = true; } + if (rec === void 0) { rec = null; } + var res = false; + for (var i = 0; i < this.items.length; i++) { + this.items[i].editor.onCompletedAsyncValidators = function (hasErrors) { + _this.raiseOnCompletedAsyncValidators(); + }; + if (!!rec && + rec.isOnValueChanged === true && + this.items[i].editor.isEmpty()) + continue; + res = this.items[i].editor.hasErrors(fireCallback, rec) || res; + } + return _super.prototype.hasErrors.call(this, fireCallback) || res; + }; + QuestionMultipleTextModel.prototype.getAllErrors = function () { + var result = _super.prototype.getAllErrors.call(this); + for (var i = 0; i < this.items.length; i++) { + var errors = this.items[i].editor.getAllErrors(); + if (errors && errors.length > 0) { + result = result.concat(errors); + } + } + return result; + }; + QuestionMultipleTextModel.prototype.clearErrors = function () { + _super.prototype.clearErrors.call(this); + for (var i = 0; i < this.items.length; i++) { + this.items[i].editor.clearErrors(); + } + }; + QuestionMultipleTextModel.prototype.getContainsErrors = function () { + var res = _super.prototype.getContainsErrors.call(this); + if (res) + return res; + var items = this.items; + for (var i = 0; i < items.length; i++) { + if (items[i].editor.containsErrors) + return true; + } + return false; + }; + QuestionMultipleTextModel.prototype.getIsAnswered = function () { + if (!_super.prototype.getIsAnswered.call(this)) + return false; + for (var i = 0; i < this.items.length; i++) { + var editor = this.items[i].editor; + if (editor.isVisible && !editor.isAnswered) + return false; + } + return true; + }; + QuestionMultipleTextModel.prototype.getProgressInfo = function () { + var elements = []; + for (var i = 0; i < this.items.length; i++) { + elements.push(this.items[i].editor); + } + return _survey_element__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].getProgressInfoByElements(elements, this.isRequired); + }; + QuestionMultipleTextModel.prototype.getDisplayValueCore = function (keysAsText, value) { + if (!value) + return value; + var res = {}; + for (var i = 0; i < this.items.length; i++) { + var item = this.items[i]; + var val = value[item.name]; + if (_helpers__WEBPACK_IMPORTED_MODULE_6__["Helpers"].isValueEmpty(val)) + continue; + var itemName = item.name; + if (keysAsText && !!item.title) { + itemName = item.title; + } + res[itemName] = item.editor.getDisplayValue(keysAsText, val); + } + return res; + }; + //IMultipleTextData + QuestionMultipleTextModel.prototype.getMultipleTextValue = function (name) { + if (!this.value) + return null; + return this.value[name]; + }; + QuestionMultipleTextModel.prototype.setMultipleTextValue = function (name, value) { + this.isMultipleItemValueChanging = true; + if (this.isValueEmpty(value)) { + value = undefined; + } + var newValue = this.value; + if (!newValue) { + newValue = {}; + } + newValue[name] = value; + this.setNewValue(newValue); + this.isMultipleItemValueChanging = false; + }; + QuestionMultipleTextModel.prototype.getItemDefaultValue = function (name) { + return !!this.defaultValue ? this.defaultValue[name] : null; + }; + QuestionMultipleTextModel.prototype.getTextProcessor = function () { + return this.textProcessor; + }; + QuestionMultipleTextModel.prototype.getAllValues = function () { + return this.data ? this.data.getAllValues() : null; + }; + QuestionMultipleTextModel.prototype.getIsRequiredText = function () { + return this.survey ? this.survey.requiredText : ""; + }; + //IPanel + QuestionMultipleTextModel.prototype.addElement = function (element, index) { }; + QuestionMultipleTextModel.prototype.removeElement = function (element) { + return false; + }; + QuestionMultipleTextModel.prototype.getQuestionTitleLocation = function () { + return "left"; + }; + QuestionMultipleTextModel.prototype.getQuestionStartIndex = function () { + return this.getStartIndex(); + }; + QuestionMultipleTextModel.prototype.getChildrenLayoutType = function () { + return "row"; + }; + QuestionMultipleTextModel.prototype.elementWidthChanged = function (el) { }; + Object.defineProperty(QuestionMultipleTextModel.prototype, "elements", { + get: function () { + return []; + }, + enumerable: false, + configurable: true + }); + QuestionMultipleTextModel.prototype.indexOf = function (el) { + return -1; + }; + QuestionMultipleTextModel.prototype.ensureRowsVisibility = function () { + // do nothing + }; + QuestionMultipleTextModel.prototype.getItemLabelCss = function (item) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_7__["CssClassBuilder"]().append(this.cssClasses.itemLabel).append(this.cssClasses.itemLabelOnError, item.editor.errors.length > 0).toString(); + }; + QuestionMultipleTextModel.prototype.getItemCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_7__["CssClassBuilder"]().append(this.cssClasses.item).toString(); + }; + QuestionMultipleTextModel.prototype.getItemTitleCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_7__["CssClassBuilder"]().append(this.cssClasses.itemTitle).toString(); + }; + return QuestionMultipleTextModel; + }(_question__WEBPACK_IMPORTED_MODULE_2__["Question"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_4__["Serializer"].addClass("multipletextitem", [ + "name", + "isRequired:boolean", + { name: "placeHolder", serializationProperty: "locPlaceHolder" }, + { + name: "inputType", + default: "text", + choices: [ + "color", + "date", + "datetime", + "datetime-local", + "email", + "month", + "number", + "password", + "range", + "tel", + "text", + "time", + "url", + "week", + ], + }, + { name: "title", serializationProperty: "locTitle" }, + { name: "maxLength:number", default: -1 }, + { name: "size:number", minValue: 0 }, + { + name: "requiredErrorText:text", + serializationProperty: "locRequiredErrorText", + }, + { + name: "validators:validators", + baseClassName: "surveyvalidator", + classNamePart: "validator", + }, + ], function () { + return new MultipleTextItemModel(""); + }); + _jsonobject__WEBPACK_IMPORTED_MODULE_4__["Serializer"].addClass("multipletext", [ + { name: "!items:textitems", className: "multipletextitem" }, + { name: "itemSize:number", minValue: 0 }, + { name: "colCount:number", default: 1, choices: [1, 2, 3, 4, 5] }, + ], function () { + return new QuestionMultipleTextModel(""); + }, "question"); + _questionfactory__WEBPACK_IMPORTED_MODULE_5__["QuestionFactory"].Instance.registerQuestion("multipletext", function (name) { + var q = new QuestionMultipleTextModel(name); + QuestionMultipleTextModel.addDefaultItems(q); + return q; + }); + + + /***/ }), + + /***/ "./src/question_paneldynamic.ts": + /*!**************************************!*\ + !*** ./src/question_paneldynamic.ts ***! + \**************************************/ + /*! exports provided: QuestionPanelDynamicItem, QuestionPanelDynamicTemplateSurveyImpl, QuestionPanelDynamicModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionPanelDynamicItem", function() { return QuestionPanelDynamicItem; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionPanelDynamicTemplateSurveyImpl", function() { return QuestionPanelDynamicTemplateSurveyImpl; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionPanelDynamicModel", function() { return QuestionPanelDynamicModel; }); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _textPreProcessor__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./textPreProcessor */ "./src/textPreProcessor.ts"); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./error */ "./src/error.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _actions_action__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./actions/action */ "./src/actions/action.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + var __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + + + + + + + + + + + + var QuestionPanelDynamicItemTextProcessor = /** @class */ (function (_super) { + __extends(QuestionPanelDynamicItemTextProcessor, _super); + function QuestionPanelDynamicItemTextProcessor(data, panelItem, variableName) { + var _this = _super.call(this, variableName) || this; + _this.data = data; + _this.panelItem = panelItem; + _this.variableName = variableName; + return _this; + } + Object.defineProperty(QuestionPanelDynamicItemTextProcessor.prototype, "survey", { + get: function () { + return this.panelItem.getSurvey(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicItemTextProcessor.prototype, "panel", { + get: function () { + return this.panelItem.panel; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicItemTextProcessor.prototype, "panelIndex", { + get: function () { + return !!this.data ? this.data.getItemIndex(this.panelItem) : -1; + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicItemTextProcessor.prototype.getValues = function () { + return this.panelItem.getAllValues(); + }; + QuestionPanelDynamicItemTextProcessor.prototype.getQuestionByName = function (name) { + var res = _super.prototype.getQuestionByName.call(this, name); + if (!!res) + return res; + var index = this.panelIndex; + return index > -1 + ? this.data.getSharedQuestionFromArray(name, index) + : null; + }; + QuestionPanelDynamicItemTextProcessor.prototype.onCustomProcessText = function (textValue) { + if (textValue.name == QuestionPanelDynamicItem.IndexVariableName) { + var index = this.panelIndex; + if (index > -1) { + textValue.isExists = true; + textValue.value = index + 1; + return true; + } + } + if (textValue.name.toLowerCase().indexOf(QuestionPanelDynamicItem.ParentItemVariableName + ".") == 0) { + var q = this.data; + if (!!q && !!q.parentQuestion && !!q.parent && !!q.parent.data) { + var processor = new QuestionPanelDynamicItemTextProcessor(q.parentQuestion, q.parent.data, QuestionPanelDynamicItem.ItemVariableName); + var text = QuestionPanelDynamicItem.ItemVariableName + + textValue.name.substring(QuestionPanelDynamicItem.ParentItemVariableName.length); + var res = processor.processValue(text, textValue.returnDisplayValue); + textValue.isExists = res.isExists; + textValue.value = res.value; + } + return true; + } + return false; + }; + return QuestionPanelDynamicItemTextProcessor; + }(_textPreProcessor__WEBPACK_IMPORTED_MODULE_3__["QuestionTextProcessor"])); + var QuestionPanelDynamicItem = /** @class */ (function () { + function QuestionPanelDynamicItem(data, panel) { + this.data = data; + this.panelValue = panel; + this.textPreProcessor = new QuestionPanelDynamicItemTextProcessor(data, this, QuestionPanelDynamicItem.ItemVariableName); + this.setSurveyImpl(); + } + Object.defineProperty(QuestionPanelDynamicItem.prototype, "panel", { + get: function () { + return this.panelValue; + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicItem.prototype.setSurveyImpl = function () { + this.panel.setSurveyImpl(this); + }; + QuestionPanelDynamicItem.prototype.getValue = function (name) { + var values = this.getAllValues(); + return values[name]; + }; + QuestionPanelDynamicItem.prototype.setValue = function (name, newValue) { + var oldItemData = this.data.getPanelItemData(this); + var oldValue = !!oldItemData ? oldItemData[name] : undefined; + if (typeof oldValue !== "object" && _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isTwoValueEquals(newValue, oldValue)) + return; + this.data.setPanelItemData(this, name, newValue); + var questions = this.panel.questions; + for (var i = 0; i < questions.length; i++) { + if (questions[i].getValueName() === name) + continue; + questions[i].checkBindings(name, newValue); + } + }; + QuestionPanelDynamicItem.prototype.getVariable = function (name) { + return undefined; + }; + QuestionPanelDynamicItem.prototype.setVariable = function (name, newValue) { }; + QuestionPanelDynamicItem.prototype.getComment = function (name) { + var result = this.getValue(name + _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].commentPrefix); + return result ? result : ""; + }; + QuestionPanelDynamicItem.prototype.setComment = function (name, newValue, locNotification) { + this.setValue(name + _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].commentPrefix, newValue); + }; + QuestionPanelDynamicItem.prototype.getAllValues = function () { + return this.data.getPanelItemData(this); + }; + QuestionPanelDynamicItem.prototype.getFilteredValues = function () { + var values = {}; + var surveyValues = !!this.data && !!this.data.getRootData() + ? this.data.getRootData().getFilteredValues() + : {}; + for (var key in surveyValues) { + values[key] = surveyValues[key]; + } + values[QuestionPanelDynamicItem.ItemVariableName] = this.getAllValues(); + if (!!this.data) { + values[QuestionPanelDynamicItem.IndexVariableName.toLowerCase()] = this.data.getItemIndex(this); + var q = this.data; + if (!!q && !!q.parentQuestion && !!q.parent) { + values[QuestionPanelDynamicItem.ParentItemVariableName] = q.parent.getValue(); + } + } + return values; + }; + QuestionPanelDynamicItem.prototype.getFilteredProperties = function () { + if (!!this.data && !!this.data.getRootData()) + return this.data.getRootData().getFilteredProperties(); + return { survey: this.getSurvey() }; + }; + QuestionPanelDynamicItem.prototype.getSurveyData = function () { + return this; + }; + QuestionPanelDynamicItem.prototype.getSurvey = function () { + return this.data ? this.data.getSurvey() : null; + }; + QuestionPanelDynamicItem.prototype.getTextProcessor = function () { + return this.textPreProcessor; + }; + QuestionPanelDynamicItem.ItemVariableName = "panel"; + QuestionPanelDynamicItem.ParentItemVariableName = "parentpanel"; + QuestionPanelDynamicItem.IndexVariableName = "panelIndex"; + return QuestionPanelDynamicItem; + }()); + + var QuestionPanelDynamicTemplateSurveyImpl = /** @class */ (function () { + function QuestionPanelDynamicTemplateSurveyImpl(data) { + this.data = data; + } + QuestionPanelDynamicTemplateSurveyImpl.prototype.getSurveyData = function () { + return null; + }; + QuestionPanelDynamicTemplateSurveyImpl.prototype.getSurvey = function () { + return this.data.getSurvey(); + }; + QuestionPanelDynamicTemplateSurveyImpl.prototype.getTextProcessor = function () { + return null; + }; + return QuestionPanelDynamicTemplateSurveyImpl; + }()); + + /** + * A Model for a panel dymanic question. You setup the template panel, but adding elements (any question or a panel) and assign a text to it's title, and this panel will be used as a template on creating dynamic panels. The number of panels is defined by panelCount property. + * An end-user may dynamically add/remove panels, unless you forbidden this. + */ + var QuestionPanelDynamicModel = /** @class */ (function (_super) { + __extends(QuestionPanelDynamicModel, _super); + function QuestionPanelDynamicModel(name) { + var _this = _super.call(this, name) || this; + _this.loadingPanelCount = 0; + _this.currentIndexValue = -1; + _this.isAddingNewPanels = false; + _this.createNewArray("panels"); + _this.templateValue = _this.createAndSetupNewPanelObject(); + _this.template.renderWidth = "100%"; + _this.template.selectedElementInDesign = _this; + _this.template.addElementCallback = function (element) { + _this.addOnPropertyChangedCallback(element); + _this.rebuildPanels(); + }; + _this.template.removeElementCallback = function () { + _this.rebuildPanels(); + }; + _this.createLocalizableString("confirmDeleteText", _this, false, "confirmDelete"); + _this.createLocalizableString("keyDuplicationError", _this, false, true); + _this.createLocalizableString("panelAddText", _this, false, "addPanel"); + _this.createLocalizableString("panelRemoveText", _this, false, "removePanel"); + _this.createLocalizableString("panelPrevText", _this, false, "pagePrevText"); + _this.createLocalizableString("panelNextText", _this, false, "pageNextText"); + _this.createLocalizableString("noEntriesText", _this, false, "noEntriesText"); + _this.registerFunctionOnPropertyValueChanged("panelsState", function () { + _this.setPanelsState(); + }); + _this.registerFunctionOnPropertiesValueChanged(["isMobile"], function () { + _this.updateFooterActions(); + }); + return _this; + } + Object.defineProperty(QuestionPanelDynamicModel.prototype, "hasSingleInput", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.setSurveyImpl = function (value, isLight) { + _super.prototype.setSurveyImpl.call(this, value, isLight); + this.setTemplatePanelSurveyImpl(); + this.setPanelsSurveyImpl(); + }; + QuestionPanelDynamicModel.prototype.assignOnPropertyChangedToTemplate = function () { + var elements = this.template.elements; + for (var i = 0; i < elements.length; i++) { + this.addOnPropertyChangedCallback(elements[i]); + } + }; + QuestionPanelDynamicModel.prototype.addOnPropertyChangedCallback = function (element) { + var _this = this; + if (element.isQuestion) { + element.setParentQuestion(this); + } + element.onPropertyChanged.add(function (element, options) { + _this.onTemplateElementPropertyChanged(element, options); + }); + if (element.isPanel) { + element.addElementCallback = function (element) { + _this.addOnPropertyChangedCallback(element); + }; + } + }; + QuestionPanelDynamicModel.prototype.onTemplateElementPropertyChanged = function (element, options) { + if (this.isLoadingFromJson || this.useTemplatePanel || this.panels.length == 0) + return; + var property = _jsonobject__WEBPACK_IMPORTED_MODULE_5__["Serializer"].findProperty(element.getType(), options.name); + if (!property) + return; + var panels = this.panels; + for (var i = 0; i < panels.length; i++) { + var question = panels[i].getQuestionByName(element.name); + if (!!question && question[options.name] !== options.newValue) { + question[options.name] = options.newValue; + } + } + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "useTemplatePanel", { + get: function () { + return this.isDesignMode && !this.isContentElement; + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.getType = function () { + return "paneldynamic"; + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "isCompositeQuestion", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.clearOnDeletingContainer = function () { + this.panels.forEach(function (panel) { + panel.clearOnDeletingContainer(); + }); + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "isAllowTitleLeft", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.removeElement = function (element) { + return this.template.removeElement(element); + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "template", { + /** + * The template Panel. This panel is used as a template on creatign dynamic panels + * @see templateElements + * @see templateTitle + * @see panelCount + */ + get: function () { + return this.templateValue; + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.getPanel = function () { + return this.template; + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "templateElements", { + /** + * The template Panel elements, questions and panels. + * @see templateElements + * @see template + * @see panelCount + */ + get: function () { + return this.template.elements; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "templateTitle", { + /** + * The template Panel title property. + * @see templateElements + * @see template + * @see panelCount + */ + get: function () { + return this.template.title; + }, + set: function (newValue) { + this.template.title = newValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "locTemplateTitle", { + get: function () { + return this.template.locTitle; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "templateDescription", { + /** + * The template Panel description property. + * @see templateElements + * @see template + * @see panelCount + * @see templateTitle + */ + get: function () { + return this.template.description; + }, + set: function (newValue) { + this.template.description = newValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "locTemplateDescription", { + get: function () { + return this.template.locDescription; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "items", { + get: function () { + var res = []; + for (var i = 0; i < this.panels.length; i++) { + res.push(this.panels[i].data); + } + return res; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "panels", { + /** + * The array of dynamic panels created based on panel template + * @see template + * @see panelCount + */ + get: function () { + return this.getPropertyValue("panels"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "currentIndex", { + /** + * The index of current active dynamical panel when the renderMode is not "list". If there is no dymamic panel (panelCount = 0) or renderMode equals "list" it returns -1, otherwise it returns a value from 0 to panelCount - 1. + * @see currentPanel + * @see panels + * @see panelCount + * @see renderMode + */ + get: function () { + if (this.isRenderModeList) + return -1; + if (this.useTemplatePanel) + return 0; + if (this.currentIndexValue < 0 && this.panelCount > 0) { + this.currentIndexValue = 0; + } + if (this.currentIndexValue >= this.panelCount) { + this.currentIndexValue = this.panelCount - 1; + } + return this.currentIndexValue; + }, + set: function (val) { + if (this.currentIndexValue !== val) { + if (val >= this.panelCount) + val = this.panelCount - 1; + this.currentIndexValue = val; + this.updateFooterActions(); + this.fireCallback(this.currentIndexChangedCallback); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "currentPanel", { + /** + * The current active dynamical panel when the renderMode is not "list". If there is no dymamic panel (panelCount = 0) or renderMode equals "list" it returns null. + * @see currenIndex + * @see panels + * @see panelCount + * @see renderMode + */ + get: function () { + var index = this.currentIndex; + if (index < 0 || index >= this.panels.length) + return null; + return this.panels[index]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "confirmDelete", { + /** + * Set it to true, to show a confirmation dialog on removing a panel + * @see ConfirmDeleteText + */ + get: function () { + return this.getPropertyValue("confirmDelete", false); + }, + set: function (val) { + this.setPropertyValue("confirmDelete", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "keyName", { + /** + * Set it to a question name used in the template panel and the library shows duplication error, if there are same values in different panels of this question. + * @see keyDuplicationError + */ + get: function () { + return this.getPropertyValue("keyName", ""); + }, + set: function (val) { + this.setPropertyValue("keyName", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "confirmDeleteText", { + /** + * Use this property to change the default text showing in the confirmation delete dialog on removing a panel. + */ + get: function () { + return this.getLocalizableStringText("confirmDeleteText"); + }, + set: function (val) { + this.setLocalizableStringText("confirmDeleteText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "locConfirmDeleteText", { + get: function () { + return this.getLocalizableString("confirmDeleteText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "keyDuplicationError", { + /** + * The duplication value error text. Set it to show the text different from the default. + * @see keyName + */ + get: function () { + return this.getLocalizableStringText("keyDuplicationError"); + }, + set: function (val) { + this.setLocalizableStringText("keyDuplicationError", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "locKeyDuplicationError", { + get: function () { + return this.getLocalizableString("keyDuplicationError"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelPrevText", { + /** + * Use this property to change the default previous button text. Previous button shows the previous panel, change the currentPanel, when the renderMode doesn't equal to "list". + * @see currentPanel + * @see currentIndex + * @see renderMode + */ + get: function () { + return this.getLocalizableStringText("panelPrevText"); + }, + set: function (val) { + this.setLocalizableStringText("panelPrevText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "locPanelPrevText", { + get: function () { + return this.getLocalizableString("panelPrevText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelNextText", { + /** + * Use this property to change the default next button text. Next button shows the next panel, change the currentPanel, when the renderMode doesn't equal to "list". + * @see currentPanel + * @see currentIndex + * @see renderMode + */ + get: function () { + return this.getLocalizableStringText("panelNextText"); + }, + set: function (val) { + this.setLocalizableStringText("panelNextText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "locPanelNextText", { + get: function () { + return this.getLocalizableString("panelNextText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelAddText", { + /** + * Use this property to change the default value of add panel button text. + */ + get: function () { + return this.getLocalizableStringText("panelAddText"); + }, + set: function (value) { + this.setLocalizableStringText("panelAddText", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "locPanelAddText", { + get: function () { + return this.getLocalizableString("panelAddText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelRemoveText", { + /** + * Use this property to change the default value of remove panel button text. + */ + get: function () { + return this.getLocalizableStringText("panelRemoveText"); + }, + set: function (val) { + this.setLocalizableStringText("panelRemoveText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "locPanelRemoveText", { + get: function () { + return this.getLocalizableString("panelRemoveText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "isProgressTopShowing", { + /** + * Returns true when the renderMode equals to "progressTop" or "progressTopBottom" + */ + get: function () { + return this.renderMode === "progressTop" || this.renderMode === "progressTopBottom"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "isProgressBottomShowing", { + /** + * Returns true when the renderMode equals to "progressBottom" or "progressTopBottom" + */ + get: function () { + return this.renderMode === "progressBottom" || this.renderMode === "progressTopBottom"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "isPrevButtonShowing", { + /** + * Returns true when currentIndex is more than 0. + * @see currenIndex + * @see currenPanel + */ + get: function () { + return this.currentIndex > 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "isNextButtonShowing", { + /** + * Returns true when currentIndex is more than or equal 0 and less than panelCount - 1. + * @see currenIndex + * @see currenPanel + * @see panelCount + */ + get: function () { + return this.currentIndex >= 0 && this.currentIndex < this.panelCount - 1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "isRangeShowing", { + /** + * Returns true when showRangeInProgress equals to true, renderMode doesn't equal to "list" and panelCount is >= 2. + */ + get: function () { + return (this.showRangeInProgress && this.currentIndex >= 0 && this.panelCount > 1); + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.getElementsInDesign = function (includeHidden) { + if (includeHidden === void 0) { includeHidden = false; } + return includeHidden ? [this.template] : this.templateElements; + }; + QuestionPanelDynamicModel.prototype.prepareValueForPanelCreating = function () { + this.addingNewPanelsValue = this.value; + this.isAddingNewPanels = true; + this.isNewPanelsValueChanged = false; + }; + QuestionPanelDynamicModel.prototype.setValueAfterPanelsCreating = function () { + this.isAddingNewPanels = false; + if (this.isNewPanelsValueChanged) { + this.isValueChangingInternally = true; + this.value = this.addingNewPanelsValue; + this.isValueChangingInternally = false; + } + }; + QuestionPanelDynamicModel.prototype.getValueCore = function () { + return this.isAddingNewPanels + ? this.addingNewPanelsValue + : _super.prototype.getValueCore.call(this); + }; + QuestionPanelDynamicModel.prototype.setValueCore = function (newValue) { + if (this.isAddingNewPanels) { + this.isNewPanelsValueChanged = true; + this.addingNewPanelsValue = newValue; + } + else { + _super.prototype.setValueCore.call(this, newValue); + } + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelCount", { + /** + * Use this property to get/set the number of dynamic panels. + * @see template + * @see minPanelCount + * @see maxPanelCount + * @see addPanel + * @see removePanel + * @see removePanelUI + */ + get: function () { + return this.isLoadingFromJson || this.useTemplatePanel + ? this.loadingPanelCount + : this.panels.length; + }, + set: function (val) { + if (val < 0) + return; + if (this.isLoadingFromJson || this.useTemplatePanel) { + this.loadingPanelCount = val; + return; + } + if (val == this.panels.length || this.useTemplatePanel) + return; + this.updateBindings("panelCount", val); + this.prepareValueForPanelCreating(); + for (var i = this.panelCount; i < val; i++) { + var panel = this.createNewPanel(); + this.panels.push(panel); + if (this.renderMode == "list" && this.panelsState != "default") { + if (this.panelsState === "expand") { + panel.expand(); + } + else { + if (!!panel.title) { + panel.collapse(); + } + } + } + } + if (val < this.panelCount) + this.panels.splice(val, this.panelCount - val); + this.setValueAfterPanelsCreating(); + this.setValueBasedOnPanelCount(); + this.reRunCondition(); + this.updateFooterActions(); + this.fireCallback(this.panelCountChangedCallback); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelsState", { + /** + * Use this property to allow the end-user to collapse/expand the panels. It works only if the renderMode property equals to "list" and templateTitle property is not empty. The following values are available: + *
default - the default value. User can't collapse/expand panels + *
expanded - User can collapse/expand panels and all panels are expanded by default + *
collapsed - User can collapse/expand panels and all panels are collapsed by default + *
firstExpanded - User can collapse/expand panels. The first panel is expanded and others are collapsed + * @see renderMode + * @see templateTitle + */ + get: function () { + return this.getPropertyValue("panelsState"); + }, + set: function (val) { + this.setPropertyValue("panelsState", val); + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.setTemplatePanelSurveyImpl = function () { + this.template.setSurveyImpl(this.useTemplatePanel + ? this.surveyImpl + : new QuestionPanelDynamicTemplateSurveyImpl(this)); + }; + QuestionPanelDynamicModel.prototype.setPanelsSurveyImpl = function () { + for (var i = 0; i < this.panels.length; i++) { + var panel = this.panels[i]; + if (panel == this.template) + continue; + panel.setSurveyImpl(panel.data); + } + }; + QuestionPanelDynamicModel.prototype.setPanelsState = function () { + if (this.useTemplatePanel || this.renderMode != "list" || !this.templateTitle) + return; + for (var i = 0; i < this.panels.length; i++) { + var state = this.panelsState; + if (state === "firstExpanded") { + state = i === 0 ? "expanded" : "collapsed"; + } + this.panels[i].state = state; + } + }; + QuestionPanelDynamicModel.prototype.setValueBasedOnPanelCount = function () { + var value = this.value; + if (!value || !Array.isArray(value)) + value = []; + if (value.length == this.panelCount) + return; + for (var i = value.length; i < this.panelCount; i++) + value.push({}); + if (value.length > this.panelCount) { + value.splice(this.panelCount, value.length - this.panelCount); + } + this.isValueChangingInternally = true; + this.value = value; + this.isValueChangingInternally = false; + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "minPanelCount", { + /** + * The minimum panel count. A user could not delete a panel if the panelCount equals to minPanelCount + * @see panelCount + * @see maxPanelCount + */ + get: function () { + return this.getPropertyValue("minPanelCount"); + }, + set: function (val) { + if (val < 0) + val = 0; + if (val == this.minPanelCount) + return; + this.setPropertyValue("minPanelCount", val); + if (val > this.maxPanelCount) + this.maxPanelCount = val; + if (this.panelCount < val) + this.panelCount = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "maxPanelCount", { + /** + * The maximum panel count. A user could not add a panel if the panelCount equals to maxPanelCount + * @see panelCount + * @see minPanelCount + */ + get: function () { + return this.getPropertyValue("maxPanelCount"); + }, + set: function (val) { + if (val <= 0) + return; + if (val > _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].panelMaximumPanelCount) + val = _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].panelMaximumPanelCount; + if (val == this.maxPanelCount) + return; + this.setPropertyValue("maxPanelCount", val); + if (val < this.minPanelCount) + this.minPanelCount = val; + if (this.panelCount > val) + this.panelCount = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "allowAddPanel", { + /** + * Set this property to false to hide the 'Add New' button + * @see allowRemovePanel + */ + get: function () { + return this.getPropertyValue("allowAddPanel"); + }, + set: function (val) { + this.setPropertyValue("allowAddPanel", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "allowRemovePanel", { + /** + * Set this property to false to hide the 'Remove' button + * @see allowAddPanel + */ + get: function () { + return this.getPropertyValue("allowRemovePanel"); + }, + set: function (val) { + this.setPropertyValue("allowRemovePanel", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "templateTitleLocation", { + /** + * Set this property different from "default" to set the specific question title location for the template questions. + * @see SurveyModel.questionTitleLocation + * @see PanelModelBase.questionTitleLocation + */ + get: function () { + return this.getPropertyValue("templateTitleLocation"); + }, + set: function (value) { + this.setPropertyValue("templateTitleLocation", value.toLowerCase()); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "showQuestionNumbers", { + /** + * Use this property to show/hide the numbers in titles in questions inside a dynamic panel. + * By default the value is "off". You may set it to "onPanel" and the first question inside a dynamic panel will start with 1 or "onSurvey" to include nested questions in dymamic panels into global survey question numbering. + */ + get: function () { + return this.getPropertyValue("showQuestionNumbers"); + }, + set: function (val) { + this.setPropertyValue("showQuestionNumbers", val); + if (!this.isLoadingFromJson && this.survey) { + this.survey.questionVisibilityChanged(this, this.visible); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "panelRemoveButtonLocation", { + /** + * Use this property to change the location of the remove button relative to the panel. + * By default the value is "bottom". You may set it to "right" and remove button will appear to the right of the panel. + */ + get: function () { + return this.getPropertyValue("panelRemoveButtonLocation"); + }, + set: function (val) { + this.setPropertyValue("panelRemoveButtonLocation", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "showRangeInProgress", { + /** + * Shows the range from 1 to panelCount when renderMode doesn't equal to "list". Set to false to hide this element. + * @see panelCount + * @see renderMode + */ + get: function () { + return this.getPropertyValue("showRangeInProgress"); + }, + set: function (val) { + this.setPropertyValue("showRangeInProgress", val); + this.updateFooterActions(); + this.fireCallback(this.currentIndexChangedCallback); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "renderMode", { + /** + * By default the property equals to "list" and all dynamic panels are rendered one by one on the page. You may change it to: "progressTop", "progressBottom" or "progressTopBottom" to render only one dynamic panel at once. The progress and navigation elements can be rendred on top, bottom or both. + */ + get: function () { + return this.getPropertyValue("renderMode"); + }, + set: function (val) { + this.setPropertyValue("renderMode", val); + this.updateFooterActions(); + this.fireCallback(this.renderModeChangedCallback); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "isRenderModeList", { + /** + * Returns true when renderMode equals to "list". + * @see renderMode + */ + get: function () { + return this.renderMode === "list"; + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.setVisibleIndex = function (value) { + if (!this.isVisible) + return 0; + var startIndex = this.showQuestionNumbers == "onSurvey" ? value : 0; + for (var i = 0; i < this.panels.length; i++) { + var counter = this.setPanelVisibleIndex(this.panels[i], startIndex, this.showQuestionNumbers != "off"); + if (this.showQuestionNumbers == "onSurvey") { + startIndex += counter; + } + } + _super.prototype.setVisibleIndex.call(this, this.showQuestionNumbers != "onSurvey" ? value : -1); + return this.showQuestionNumbers != "onSurvey" ? 1 : startIndex - value; + }; + QuestionPanelDynamicModel.prototype.setPanelVisibleIndex = function (panel, index, showIndex) { + if (!showIndex) { + panel.setVisibleIndex(-1); + return 0; + } + return panel.setVisibleIndex(index); + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "canAddPanel", { + /** + * Returns true when an end user may add a new panel. The question is not read only and panelCount less than maxPanelCount + * and renderMode is "list" or the current panel doesn't have any errors + * @see isReadOnly + * @see panelCount + * @see maxPanelCount + * @see renderMode + */ + get: function () { + if (this.isDesignMode) + return false; + if (this.isDefaultV2Theme && !this.legacyNavigation && !this.isRenderModeList && this.currentIndex < this.panelCount - 1) { + return false; + } + return (this.allowAddPanel && + !this.isReadOnly && + this.panelCount < this.maxPanelCount); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "canRemovePanel", { + /** + * Returns true when an end user may remove a panel. The question is not read only and panelCount is more than minPanelCount + * @see isReadOnly + * @see panelCount + * @see minPanelCount + */ + get: function () { + if (this.isDesignMode) + return false; + return (this.allowRemovePanel && + !this.isReadOnly && + this.panelCount > this.minPanelCount); + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.rebuildPanels = function () { + var _a; + if (this.isLoadingFromJson) + return; + this.prepareValueForPanelCreating(); + var panels = []; + if (this.useTemplatePanel) { + new QuestionPanelDynamicItem(this, this.template); + panels.push(this.template); + } + else { + for (var i = 0; i < this.panelCount; i++) { + panels.push(this.createNewPanel()); + } + } + (_a = this.panels).splice.apply(_a, __spreadArray([0, this.panels.length], panels, false)); + this.setValueAfterPanelsCreating(); + this.setPanelsState(); + this.reRunCondition(); + this.updateFooterActions(); + this.fireCallback(this.panelCountChangedCallback); + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "defaultPanelValue", { + /** + * If it is not empty, then this value is set to every new panel, including panels created initially, unless the defaultValue is not empty + * @see defaultValue + * @see defaultValueFromLastRow + */ + get: function () { + return this.getPropertyValue("defaultPanelValue"); + }, + set: function (val) { + this.setPropertyValue("defaultPanelValue", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "defaultValueFromLastPanel", { + /** + * Set it to true to copy the value into new added panel from the last panel. If defaultPanelValue is set and this property equals to true, + * then the value for new added panel is merging. + * @see defaultValue + * @see defaultPanelValue + */ + get: function () { + return this.getPropertyValue("defaultValueFromLastPanel", false); + }, + set: function (val) { + this.setPropertyValue("defaultValueFromLastPanel", val); + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.isDefaultValueEmpty = function () { + return (_super.prototype.isDefaultValueEmpty.call(this) && this.isValueEmpty(this.defaultPanelValue)); + }; + QuestionPanelDynamicModel.prototype.setDefaultValue = function () { + if (this.isValueEmpty(this.defaultPanelValue) || + !this.isValueEmpty(this.defaultValue)) { + _super.prototype.setDefaultValue.call(this); + return; + } + if (!this.isEmpty() || this.panelCount == 0) + return; + var newValue = []; + for (var i = 0; i < this.panelCount; i++) { + newValue.push(this.defaultPanelValue); + } + this.value = newValue; + }; + QuestionPanelDynamicModel.prototype.isEmpty = function () { + var val = this.value; + if (!val || !Array.isArray(val)) + return true; + for (var i = 0; i < val.length; i++) { + if (!this.isRowEmpty(val[i])) + return false; + } + return true; + }; + QuestionPanelDynamicModel.prototype.getProgressInfo = function () { + return _survey_element__WEBPACK_IMPORTED_MODULE_1__["SurveyElement"].getProgressInfoByElements(this.panels, this.isRequired); + }; + QuestionPanelDynamicModel.prototype.isRowEmpty = function (val) { + for (var prop in val) { + if (val.hasOwnProperty(prop)) + return false; + } + return true; + }; + /** + * Add a new dynamic panel based on the template Panel. It checks if canAddPanel returns true and then calls addPanel method. + * If a renderMode is different from "list" and the current panel has erros, then + * @see template + * @see panelCount + * @see panels + * @see canAddPanel + */ + QuestionPanelDynamicModel.prototype.addPanelUI = function () { + if (!this.canAddPanel) + return null; + if (!this.canLeaveCurrentPanel()) + return null; + var newPanel = this.addPanel(); + if (this.renderMode === "list" && this.panelsState !== "default") { + newPanel.expand(); + } + return newPanel; + }; + /** + * Add a new dynamic panel based on the template Panel. + * @see template + * @see panelCount + * @see panels + * @see renderMode + */ + QuestionPanelDynamicModel.prototype.addPanel = function () { + this.panelCount++; + if (!this.isRenderModeList) { + this.currentIndex = this.panelCount - 1; + } + var newValue = this.value; + var hasModified = false; + if (!this.isValueEmpty(this.defaultPanelValue)) { + if (!!newValue && + Array.isArray(newValue) && + newValue.length == this.panelCount) { + hasModified = true; + this.copyValue(newValue[newValue.length - 1], this.defaultPanelValue); + } + } + if (this.defaultValueFromLastPanel && + !!newValue && + Array.isArray(newValue) && + newValue.length > 1 && + newValue.length == this.panelCount) { + hasModified = true; + this.copyValue(newValue[newValue.length - 1], newValue[newValue.length - 2]); + } + if (hasModified) { + this.value = newValue; + } + if (this.survey) + this.survey.dynamicPanelAdded(this); + return this.panels[this.panelCount - 1]; + }; + QuestionPanelDynamicModel.prototype.canLeaveCurrentPanel = function () { + return !(this.renderMode !== "list" && this.currentPanel && this.currentPanel.hasErrors()); + }; + QuestionPanelDynamicModel.prototype.copyValue = function (src, dest) { + for (var key in dest) { + src[key] = dest[key]; + } + }; + /** + * Call removePanel function. Do nothing is canRemovePanel returns false. If confirmDelete set to true, it shows the confirmation dialog first. + * @param value a panel or panel index + * @see removePanel + * @see confirmDelete + * @see confirmDeleteText + * @see canRemovePanel + * + */ + QuestionPanelDynamicModel.prototype.removePanelUI = function (value) { + if (!this.canRemovePanel) + return; + if (!this.confirmDelete || Object(_utils_utils__WEBPACK_IMPORTED_MODULE_9__["confirmAction"])(this.confirmDeleteText)) { + this.removePanel(value); + } + }; + /** + * Goes to the next panel in the PanelDynamic + * Returns true, if it can move to the next panel. It can return false if the renderMode is "list" or the current panel has errors. + * @see renderMode + */ + QuestionPanelDynamicModel.prototype.goToNextPanel = function () { + if (this.currentIndex < 0) + return false; + if (!this.canLeaveCurrentPanel()) + return false; + this.currentIndex++; + return true; + }; + /** + * Goes to the previous panel in the PanelDynamic + * + */ + QuestionPanelDynamicModel.prototype.goToPrevPanel = function () { + if (this.currentIndex < 0) + return; + this.currentIndex--; + }; + /** + * Removes a dynamic panel from the panels array. + * @param value a panel or panel index + * @see panels + * @see template + */ + QuestionPanelDynamicModel.prototype.removePanel = function (value) { + var index = this.getPanelIndex(value); + if (index < 0 || index >= this.panelCount) + return; + var panel = this.panels[index]; + this.panels.splice(index, 1); + this.updateBindings("panelCount", this.panelCount); + var value = this.value; + if (!value || !Array.isArray(value) || index >= value.length) + return; + this.isValueChangingInternally = true; + value.splice(index, 1); + this.value = value; + this.updateFooterActions(); + this.fireCallback(this.panelCountChangedCallback); + if (this.survey) + this.survey.dynamicPanelRemoved(this, index, panel); + this.isValueChangingInternally = false; + }; + QuestionPanelDynamicModel.prototype.getPanelIndex = function (val) { + if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isNumber(val)) + return val; + var items = this.items; + for (var i = 0; i < this.panels.length; i++) { + if (this.panels[i] === val || items[i] === val) + return i; + } + return -1; + }; + QuestionPanelDynamicModel.prototype.locStrsChanged = function () { + _super.prototype.locStrsChanged.call(this); + var panels = this.panels; + for (var i = 0; i < panels.length; i++) { + panels[i].locStrsChanged(); + } + }; + QuestionPanelDynamicModel.prototype.clearIncorrectValues = function () { + for (var i = 0; i < this.panels.length; i++) { + this.clearIncorrectValuesInPanel(i); + } + }; + QuestionPanelDynamicModel.prototype.clearErrors = function () { + _super.prototype.clearErrors.call(this); + for (var i = 0; i < this.panels.length; i++) { + this.panels[i].clearErrors(); + } + }; + QuestionPanelDynamicModel.prototype.getQuestionFromArray = function (name, index) { + if (index >= this.panelCount) + return null; + return this.panels[index].getQuestionByName(name); + }; + QuestionPanelDynamicModel.prototype.clearIncorrectValuesInPanel = function (index) { + var panel = this.panels[index]; + panel.clearIncorrectValues(); + var val = this.value; + var values = !!val && index < val.length ? val[index] : null; + if (!values) + return; + var isChanged = false; + for (var key in values) { + if (this.getSharedQuestionFromArray(key, index)) + continue; + var q = panel.getQuestionByName(key); + if (!!q) + continue; + if (this.iscorrectValueWithPostPrefix(panel, key, _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].commentPrefix) || + this.iscorrectValueWithPostPrefix(panel, key, _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].matrixTotalValuePostFix)) + continue; + delete values[key]; + isChanged = true; + } + if (isChanged) { + val[index] = values; + this.value = val; + } + }; + QuestionPanelDynamicModel.prototype.iscorrectValueWithPostPrefix = function (panel, key, postPrefix) { + if (key.indexOf(postPrefix) !== key.length - postPrefix.length) + return false; + return !!panel.getQuestionByName(key.substr(0, key.indexOf(postPrefix))); + }; + QuestionPanelDynamicModel.prototype.getSharedQuestionFromArray = function (name, panelIndex) { + return !!this.survey && !!this.valueName + ? (this.survey.getQuestionByValueNameFromArray(this.valueName, name, panelIndex)) + : null; + }; + QuestionPanelDynamicModel.prototype.addConditionObjectsByContext = function (objects, context) { + var hasContext = !!context + ? context === true || this.template.questions.indexOf(context) > -1 + : false; + var prefixName = this.getValueName() + "[0]."; + var prefixText = this.processedTitle + "[0]."; + var panelObjs = new Array(); + var questions = this.template.questions; + for (var i = 0; i < questions.length; i++) { + questions[i].addConditionObjectsByContext(panelObjs, context); + } + for (var i = 0; i < panelObjs.length; i++) { + objects.push({ + name: prefixName + panelObjs[i].name, + text: prefixText + panelObjs[i].text, + question: panelObjs[i].question, + }); + } + if (hasContext) { + var prefixName_1 = context === true ? this.getValueName() + "." : ""; + var prefixText_1 = context === true ? this.processedTitle + "." : ""; + for (var i = 0; i < panelObjs.length; i++) { + if (panelObjs[i].question == context) + continue; + var obj = { + name: prefixName_1 + "panel." + panelObjs[i].name, + text: prefixText_1 + "panel." + panelObjs[i].text, + question: panelObjs[i].question + }; + if (context === true) { + obj.context = this; + } + objects.push(obj); + } + } + }; + QuestionPanelDynamicModel.prototype.getConditionJson = function (operator, path) { + if (operator === void 0) { operator = null; } + if (path === void 0) { path = null; } + if (!path) + return _super.prototype.getConditionJson.call(this, operator, path); + var questionName = path; + var pos = path.indexOf("."); + if (pos > -1) { + questionName = path.substr(0, pos); + path = path.substr(pos + 1); + } + var question = this.template.getQuestionByName(questionName); + if (!question) + return null; + return question.getConditionJson(operator, path); + }; + QuestionPanelDynamicModel.prototype.onReadOnlyChanged = function () { + var readOnly = this.isReadOnly; + this.template.readOnly = readOnly; + for (var i = 0; i < this.panels.length; i++) { + this.panels[i].readOnly = readOnly; + } + _super.prototype.onReadOnlyChanged.call(this); + }; + QuestionPanelDynamicModel.prototype.onSurveyLoad = function () { + this.template.readOnly = this.isReadOnly; + this.template.onSurveyLoad(); + if (this.loadingPanelCount > 0) { + this.panelCount = this.loadingPanelCount; + } + if (this.useTemplatePanel) { + this.rebuildPanels(); + } + this.setPanelsSurveyImpl(); + this.setPanelsState(); + this.assignOnPropertyChangedToTemplate(); + _super.prototype.onSurveyLoad.call(this); + }; + QuestionPanelDynamicModel.prototype.onFirstRendering = function () { + this.template.onFirstRendering(); + for (var i = 0; i < this.panels.length; i++) { + this.panels[i].onFirstRendering(); + } + _super.prototype.onFirstRendering.call(this); + }; + QuestionPanelDynamicModel.prototype.localeChanged = function () { + _super.prototype.localeChanged.call(this); + for (var i = 0; i < this.panels.length; i++) { + this.panels[i].localeChanged(); + } + }; + QuestionPanelDynamicModel.prototype.runCondition = function (values, properties) { + _super.prototype.runCondition.call(this, values, properties); + this.runPanelsCondition(values, properties); + }; + QuestionPanelDynamicModel.prototype.reRunCondition = function () { + if (!this.data) + return; + this.runCondition(this.getDataFilteredValues(), this.getDataFilteredProperties()); + }; + QuestionPanelDynamicModel.prototype.runPanelsCondition = function (values, properties) { + var cachedValues = {}; + if (values && values instanceof Object) { + cachedValues = JSON.parse(JSON.stringify(values)); + } + if (!!this.parentQuestion && !!this.parent) { + cachedValues[QuestionPanelDynamicItem.ParentItemVariableName] = this.parent.getValue(); + } + for (var i = 0; i < this.panels.length; i++) { + var panelValues = this.getPanelItemData(this.panels[i].data); + //Should be unique for every panel due async expression support + var newValues = _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].createCopy(cachedValues); + newValues[QuestionPanelDynamicItem.ItemVariableName.toLowerCase()] = panelValues; + newValues[QuestionPanelDynamicItem.IndexVariableName.toLowerCase()] = i; + this.panels[i].runCondition(newValues, properties); + } + }; + QuestionPanelDynamicModel.prototype.onAnyValueChanged = function (name) { + _super.prototype.onAnyValueChanged.call(this, name); + for (var i = 0; i < this.panels.length; i++) { + this.panels[i].onAnyValueChanged(name); + this.panels[i].onAnyValueChanged(QuestionPanelDynamicItem.ItemVariableName); + } + }; + QuestionPanelDynamicModel.prototype.hasKeysDuplicated = function (fireCallback, rec) { + if (rec === void 0) { rec = null; } + var keyValues = []; + var res; + for (var i = 0; i < this.panels.length; i++) { + res = + this.isValueDuplicated(this.panels[i], keyValues, rec, fireCallback) || + res; + } + return res; + }; + QuestionPanelDynamicModel.prototype.updatePanelsContainsErrors = function () { + var question = this.changingValueQuestion; + var parent = question.parent; + while (!!parent) { + parent.updateContainsErrors(); + parent = parent.parent; + } + this.updateContainsErrors(); + }; + QuestionPanelDynamicModel.prototype.hasErrors = function (fireCallback, rec) { + if (fireCallback === void 0) { fireCallback = true; } + if (rec === void 0) { rec = null; } + if (this.isValueChangingInternally) + return false; + var res = false; + if (!!this.changingValueQuestion) { + var res = this.changingValueQuestion.hasErrors(fireCallback, rec); + res = this.hasKeysDuplicated(fireCallback, rec) || res; + this.updatePanelsContainsErrors(); + return res; + } + else { + var errosInPanels = this.hasErrorInPanels(fireCallback, rec); + return _super.prototype.hasErrors.call(this, fireCallback) || errosInPanels; + } + }; + QuestionPanelDynamicModel.prototype.getContainsErrors = function () { + var res = _super.prototype.getContainsErrors.call(this); + if (res) + return res; + var panels = this.panels; + for (var i = 0; i < panels.length; i++) { + if (panels[i].containsErrors) + return true; + } + return false; + }; + QuestionPanelDynamicModel.prototype.getIsAnswered = function () { + if (!_super.prototype.getIsAnswered.call(this)) + return false; + var panels = this.panels; + for (var i = 0; i < panels.length; i++) { + var visibleQuestions = []; + panels[i].addQuestionsToList(visibleQuestions, true); + for (var j = 0; j < visibleQuestions.length; j++) { + if (!visibleQuestions[j].isAnswered) + return false; + } + } + return true; + }; + QuestionPanelDynamicModel.prototype.clearValueIfInvisibleCore = function () { + for (var i = 0; i < this.panels.length; i++) { + var questions = this.panels[i].questions; + for (var j = 0; j < questions.length; j++) { + questions[j].clearValueIfInvisible(); + } + } + _super.prototype.clearValueIfInvisibleCore.call(this); + }; + QuestionPanelDynamicModel.prototype.getIsRunningValidators = function () { + if (_super.prototype.getIsRunningValidators.call(this)) + return true; + for (var i = 0; i < this.panels.length; i++) { + var questions = this.panels[i].questions; + for (var j = 0; j < questions.length; j++) { + if (questions[j].isRunningValidators) + return true; + } + } + return false; + }; + QuestionPanelDynamicModel.prototype.getAllErrors = function () { + var result = _super.prototype.getAllErrors.call(this); + for (var i = 0; i < this.panels.length; i++) { + var questions = this.panels[i].questions; + for (var j = 0; j < questions.length; j++) { + var errors = questions[j].getAllErrors(); + if (errors && errors.length > 0) { + result = result.concat(errors); + } + } + } + return result; + }; + QuestionPanelDynamicModel.prototype.getDisplayValueCore = function (keysAsText, value) { + var values = this.getUnbindValue(value); + if (!values || !Array.isArray(values)) + return values; + for (var i = 0; i < this.panels.length && i < values.length; i++) { + var val = values[i]; + if (!val) + continue; + values[i] = this.getPanelDisplayValue(i, val, keysAsText); + } + return values; + }; + QuestionPanelDynamicModel.prototype.getPanelDisplayValue = function (panelIndex, val, keysAsText) { + if (!val) + return val; + var panel = this.panels[panelIndex]; + var keys = Object.keys(val); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var question = panel.getQuestionByValueName(key); + if (!question) { + question = this.getSharedQuestionFromArray(key, panelIndex); + } + if (!!question) { + var qValue = question.getDisplayValue(keysAsText, val[key]); + val[key] = qValue; + if (keysAsText && !!question.title && question.title !== key) { + val[question.title] = qValue; + delete val[key]; + } + } + } + return val; + }; + QuestionPanelDynamicModel.prototype.hasErrorInPanels = function (fireCallback, rec) { + var res = false; + var panels = this.panels; + var keyValues = []; + for (var i = 0; i < panels.length; i++) { + this.setOnCompleteAsyncInPanel(panels[i]); + } + for (var i = 0; i < panels.length; i++) { + var pnlError = panels[i].hasErrors(fireCallback, !!rec && rec.focuseOnFirstError, rec); + pnlError = this.isValueDuplicated(panels[i], keyValues, rec, fireCallback) || pnlError; + if (!this.isRenderModeList && pnlError && !res) { + this.currentIndex = i; + } + res = pnlError || res; + } + return res; + }; + QuestionPanelDynamicModel.prototype.setOnCompleteAsyncInPanel = function (panel) { + var _this = this; + var questions = panel.questions; + for (var i = 0; i < questions.length; i++) { + questions[i].onCompletedAsyncValidators = function (hasErrors) { + _this.raiseOnCompletedAsyncValidators(); + }; + } + }; + QuestionPanelDynamicModel.prototype.isValueDuplicated = function (panel, keyValues, rec, fireCallback) { + if (!this.keyName) + return false; + var question = panel.getQuestionByValueName(this.keyName); + if (!question || question.isEmpty()) + return false; + var value = question.value; + if (!!this.changingValueQuestion && + question != this.changingValueQuestion) { + question.hasErrors(fireCallback, rec); + } + for (var i = 0; i < keyValues.length; i++) { + if (value == keyValues[i]) { + if (fireCallback) { + question.addError(new _error__WEBPACK_IMPORTED_MODULE_7__["KeyDuplicationError"](this.keyDuplicationError, this)); + } + if (!!rec && !rec.firstErrorQuestion) { + rec.firstErrorQuestion = question; + } + return true; + } + } + keyValues.push(value); + return false; + }; + QuestionPanelDynamicModel.prototype.createNewPanel = function () { + var panel = this.createAndSetupNewPanelObject(); + var json = this.template.toJSON(); + new _jsonobject__WEBPACK_IMPORTED_MODULE_5__["JsonObject"]().toObject(json, panel); + panel.renderWidth = "100%"; + panel.updateCustomWidgets(); + new QuestionPanelDynamicItem(this, panel); + panel.onFirstRendering(); + var questions = panel.questions; + for (var i = 0; i < questions.length; i++) { + questions[i].setParentQuestion(this); + } + panel.locStrsChanged(); + return panel; + }; + QuestionPanelDynamicModel.prototype.createAndSetupNewPanelObject = function () { + var panel = this.createNewPanelObject(); + panel.isInteractiveDesignElement = false; + var self = this; + panel.onGetQuestionTitleLocation = function () { + return self.getTemplateQuestionTitleLocation(); + }; + return panel; + }; + QuestionPanelDynamicModel.prototype.getTemplateQuestionTitleLocation = function () { + return this.templateTitleLocation != "default" + ? this.templateTitleLocation + : this.getTitleLocationCore(); + }; + QuestionPanelDynamicModel.prototype.createNewPanelObject = function () { + return _jsonobject__WEBPACK_IMPORTED_MODULE_5__["Serializer"].createClass("panel"); + }; + QuestionPanelDynamicModel.prototype.setPanelCountBasedOnValue = function () { + if (this.isValueChangingInternally || this.useTemplatePanel) + return; + var val = this.value; + var newPanelCount = val && Array.isArray(val) ? val.length : 0; + if (newPanelCount == 0 && this.loadingPanelCount > 0) { + newPanelCount = this.loadingPanelCount; + } + this.panelCount = newPanelCount; + }; + QuestionPanelDynamicModel.prototype.setQuestionValue = function (newValue) { + _super.prototype.setQuestionValue.call(this, newValue, false); + this.setPanelCountBasedOnValue(); + for (var i = 0; i < this.panels.length; i++) { + this.panelUpdateValueFromSurvey(this.panels[i]); + } + this.updateIsAnswered(); + }; + QuestionPanelDynamicModel.prototype.onSurveyValueChanged = function (newValue) { + _super.prototype.onSurveyValueChanged.call(this, newValue); + for (var i = 0; i < this.panels.length; i++) { + this.panelSurveyValueChanged(this.panels[i]); + } + if (newValue === undefined) { + this.setValueBasedOnPanelCount(); + } + }; + QuestionPanelDynamicModel.prototype.panelUpdateValueFromSurvey = function (panel) { + var questions = panel.questions; + var values = this.getPanelItemData(panel.data); + for (var i = 0; i < questions.length; i++) { + var q = questions[i]; + q.updateValueFromSurvey(values[q.getValueName()]); + q.updateCommentFromSurvey(values[q.getValueName() + _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].commentPrefix]); + } + }; + QuestionPanelDynamicModel.prototype.panelSurveyValueChanged = function (panel) { + var questions = panel.questions; + var values = this.getPanelItemData(panel.data); + for (var i = 0; i < questions.length; i++) { + var q = questions[i]; + q.onSurveyValueChanged(values[q.getValueName()]); + } + }; + QuestionPanelDynamicModel.prototype.onSetData = function () { + _super.prototype.onSetData.call(this); + if (this.useTemplatePanel) { + this.setTemplatePanelSurveyImpl(); + this.rebuildPanels(); + } + }; + //IQuestionPanelDynamicData + QuestionPanelDynamicModel.prototype.getItemIndex = function (item) { + var res = this.items.indexOf(item); + return res > -1 ? res : this.items.length; + }; + QuestionPanelDynamicModel.prototype.getPanelItemData = function (item) { + var items = this.items; + var index = items.indexOf(item); + var qValue = this.value; + if (index < 0 && Array.isArray(qValue) && qValue.length > items.length) { + index = items.length; + } + if (index < 0) + return {}; + if (!qValue || !Array.isArray(qValue) || qValue.length <= index) + return {}; + return qValue[index]; + }; + QuestionPanelDynamicModel.prototype.setPanelItemData = function (item, name, val) { + if (this.isSetPanelItemData && this.isSetPanelItemData.indexOf(name) > -1) + return; + if (!this.isSetPanelItemData) + this.isSetPanelItemData = []; + this.isSetPanelItemData.push(name); + var items = this.items; + var index = items.indexOf(item); + if (index < 0) + index = items.length; + var qValue = this.getUnbindValue(this.value); + if (!qValue || !Array.isArray(qValue)) { + qValue = []; + } + if (qValue.length <= index) { + for (var i = qValue.length; i <= index; i++) { + qValue.push({}); + } + } + if (!qValue[index]) + qValue[index] = {}; + if (!this.isValueEmpty(val)) { + qValue[index][name] = val; + } + else { + delete qValue[index][name]; + } + if (index >= 0 && index < this.panels.length) { + this.changingValueQuestion = this.panels[index].getQuestionByValueName(name); + } + this.value = qValue; + this.changingValueQuestion = null; + if (this.survey) { + var options = { + question: this, + panel: item.panel, + name: name, + itemIndex: index, + itemValue: qValue[index], + value: val, + }; + this.survey.dynamicPanelItemValueChanged(this, options); + } + var index = this.isSetPanelItemData.indexOf(name); + if (index > -1) { + this.isSetPanelItemData.splice(index, 1); + } + }; + QuestionPanelDynamicModel.prototype.getRootData = function () { + return this.data; + }; + QuestionPanelDynamicModel.prototype.getPlainData = function (options) { + if (options === void 0) { options = { + includeEmpty: true, + }; } + var questionPlainData = _super.prototype.getPlainData.call(this, options); + if (!!questionPlainData) { + questionPlainData.isNode = true; + questionPlainData.data = this.panels.map(function (panel, index) { + var panelDataItem = { + name: panel.name || index, + title: panel.title || "Panel", + value: panel.getValue(), + displayValue: panel.getValue(), + getString: function (val) { + return typeof val === "object" ? JSON.stringify(val) : val; + }, + isNode: true, + data: panel.questions + .map(function (question) { return question.getPlainData(options); }) + .filter(function (d) { return !!d; }), + }; + (options.calculations || []).forEach(function (calculation) { + panelDataItem[calculation.propertyName] = panel[calculation.propertyName]; + }); + return panelDataItem; + }); + } + return questionPlainData; + }; + QuestionPanelDynamicModel.prototype.updateElementCss = function (reNew) { + _super.prototype.updateElementCss.call(this, reNew); + for (var i = 0; i < this.panels.length; i++) { + var el = this.panels[i]; + el.updateElementCss(reNew); + } + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "progressText", { + get: function () { + var rangeMax = this.panelCount; + return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] + .getString("panelDynamicProgressText")["format"](this.currentIndex + 1, rangeMax); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "progress", { + get: function () { + return ((this.currentIndex + 1) / this.panelCount) * 100 + "%"; + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.getRootCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]().append(_super.prototype.getRootCss.call(this)).append(this.cssClasses.empty, this.getShowNoEntriesPlaceholder()).toString(); + }; + QuestionPanelDynamicModel.prototype.getPanelWrapperCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(this.cssClasses.panelWrapper) + .append(this.cssClasses.panelWrapperInRow, this.panelRemoveButtonLocation === "right") + .toString(); + }; + QuestionPanelDynamicModel.prototype.getPanelRemoveButtonCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(this.cssClasses.button) + .append(this.cssClasses.buttonRemove) + .append(this.cssClasses.buttonRemoveRight, this.panelRemoveButtonLocation === "right") + .toString(); + }; + QuestionPanelDynamicModel.prototype.getAddButtonCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(this.cssClasses.button) + .append(this.cssClasses.buttonAdd) + .append(this.cssClasses.buttonAdd + "--list-mode", this.renderMode === "list") + .toString(); + }; + QuestionPanelDynamicModel.prototype.getPrevButtonCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(this.cssClasses.buttonPrev) + .append(this.cssClasses.buttonPrevDisabled, !this.isPrevButtonShowing) + .toString(); + }; + QuestionPanelDynamicModel.prototype.getNextButtonCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_10__["CssClassBuilder"]() + .append(this.cssClasses.buttonNext) + .append(this.cssClasses.buttonNextDisabled, !this.isNextButtonShowing) + .toString(); + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "noEntriesText", { + /** + * A text displayed when the dynamic panel contains no entries. Applies only in the Default V2 theme. + */ + get: function () { + return this.getLocalizableStringText("noEntriesText"); + }, + set: function (val) { + this.setLocalizableStringText("noEntriesText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionPanelDynamicModel.prototype, "locNoEntriesText", { + get: function () { + return this.getLocalizableString("noEntriesText"); + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.getShowNoEntriesPlaceholder = function () { + return !!this.cssClasses.noEntriesPlaceholder && !this.isDesignMode && this.panelCount === 0; + }; + QuestionPanelDynamicModel.prototype.needResponsiveWidth = function () { + var panel = this.getPanel(); + if (!!panel && panel.needResponsiveWidth()) + return true; + return false; + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "footerToolbar", { + get: function () { + if (!this.footerToolbarValue) { + this.initFooterToolbar(); + } + return this.footerToolbarValue; + }, + enumerable: false, + configurable: true + }); + QuestionPanelDynamicModel.prototype.updateFooterActions = function () { + if (!!this.updateFooterActionsCallback) { + this.updateFooterActionsCallback(); + } + }; + QuestionPanelDynamicModel.prototype.initFooterToolbar = function () { + var _this = this; + this.footerToolbarValue = this.createActionContainer(); + var items = []; + var prevTextBtn = new _actions_action__WEBPACK_IMPORTED_MODULE_11__["Action"]({ + id: "sv-pd-prev-btn", + title: this.panelPrevText, + action: function () { + _this.goToPrevPanel(); + } + }); + var nextTextBtn = new _actions_action__WEBPACK_IMPORTED_MODULE_11__["Action"]({ + id: "sv-pd-next-btn", + title: this.panelNextText, + action: function () { + _this.goToNextPanel(); + } + }); + var addBtn = new _actions_action__WEBPACK_IMPORTED_MODULE_11__["Action"]({ + id: "sv-pd-add-btn", + component: "sv-paneldynamic-add-btn", + data: { question: this } + }); + var prevBtnIcon = new _actions_action__WEBPACK_IMPORTED_MODULE_11__["Action"]({ + id: "sv-prev-btn-icon", + component: "sv-paneldynamic-prev-btn", + data: { question: this } + }); + var progressText = new _actions_action__WEBPACK_IMPORTED_MODULE_11__["Action"]({ + id: "sv-pd-progress-text", + component: "sv-paneldynamic-progress-text", + data: { question: this } + }); + var nextBtnIcon = new _actions_action__WEBPACK_IMPORTED_MODULE_11__["Action"]({ + id: "sv-pd-next-btn-icon", + component: "sv-paneldynamic-next-btn", + data: { question: this } + }); + items.push(prevTextBtn, nextTextBtn, addBtn, prevBtnIcon, progressText, nextBtnIcon); + this.updateFooterActionsCallback = function () { + var isLegacyNavigation = _this.legacyNavigation; + var isRenderModeList = _this.isRenderModeList; + var isMobile = _this.isMobile; + var showNavigation = !isLegacyNavigation && !isRenderModeList; + prevTextBtn.visible = showNavigation && _this.currentIndex > 0; + nextTextBtn.visible = showNavigation && _this.currentIndex < _this.panelCount - 1; + nextTextBtn.needSpace = isMobile && nextTextBtn.visible && prevTextBtn.visible; + addBtn.needSpace = _this.isMobile && !nextTextBtn.visible && prevTextBtn.visible; + progressText.visible = !_this.isRenderModeList && !isMobile; + progressText.needSpace = !isLegacyNavigation && !_this.isMobile; + var showLegacyNavigation = isLegacyNavigation && !isRenderModeList; + prevBtnIcon.visible = showLegacyNavigation; + nextBtnIcon.visible = showLegacyNavigation; + prevBtnIcon.needSpace = showLegacyNavigation; + }; + this.updateFooterActionsCallback(); + this.footerToolbarValue.setItems(items); + }; + Object.defineProperty(QuestionPanelDynamicModel.prototype, "showLegacyNavigation", { + get: function () { + return !this.isDefaultV2Theme; + }, + enumerable: false, + configurable: true + }); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_5__["property"])({ defaultValue: false, onSet: function (_, target) { target.updateFooterActions(); } }) + ], QuestionPanelDynamicModel.prototype, "legacyNavigation", void 0); + return QuestionPanelDynamicModel; + }(_question__WEBPACK_IMPORTED_MODULE_4__["Question"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_5__["Serializer"].addClass("paneldynamic", [ + { + name: "templateElements", + alternativeName: "questions", + visible: false, + isLightSerializable: false, + }, + { name: "templateTitle:text", serializationProperty: "locTemplateTitle" }, + { + name: "templateDescription:text", + serializationProperty: "locTemplateDescription", + }, + { name: "noEntriesText:text", serializationProperty: "locNoEntriesText" }, + { name: "allowAddPanel:boolean", default: true }, + { name: "allowRemovePanel:boolean", default: true }, + { + name: "panelCount:number", + isBindable: true, + default: 0, + choices: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], + }, + { name: "minPanelCount:number", default: 0, minValue: 0 }, + { + name: "maxPanelCount:number", + default: _settings__WEBPACK_IMPORTED_MODULE_8__["settings"].panelMaximumPanelCount, + }, + "defaultPanelValue:panelvalue", + "defaultValueFromLastPanel:boolean", + { + name: "panelsState", + default: "default", + choices: ["default", "collapsed", "expanded", "firstExpanded"], + }, + { name: "keyName" }, + { + name: "keyDuplicationError", + serializationProperty: "locKeyDuplicationError", + }, + { name: "confirmDelete:boolean" }, + { + name: "confirmDeleteText", + serializationProperty: "locConfirmDeleteText", + }, + { name: "panelAddText", serializationProperty: "locPanelAddText" }, + { name: "panelRemoveText", serializationProperty: "locPanelRemoveText" }, + { name: "panelPrevText", serializationProperty: "locPanelPrevText" }, + { name: "panelNextText", serializationProperty: "locPanelNextText" }, + { + name: "showQuestionNumbers", + default: "off", + choices: ["off", "onPanel", "onSurvey"], + }, + { name: "showRangeInProgress:boolean", default: true }, + { + name: "renderMode", + default: "list", + choices: ["list", "progressTop", "progressBottom", "progressTopBottom"], + }, + { + name: "templateTitleLocation", + default: "default", + choices: ["default", "top", "bottom", "left"], + }, + { + name: "panelRemoveButtonLocation", + default: "bottom", + choices: ["bottom", "right"], + }, + ], function () { + return new QuestionPanelDynamicModel(""); + }, "question"); + _questionfactory__WEBPACK_IMPORTED_MODULE_6__["QuestionFactory"].Instance.registerQuestion("paneldynamic", function (name) { + return new QuestionPanelDynamicModel(name); + }); + + + /***/ }), + + /***/ "./src/question_radiogroup.ts": + /*!************************************!*\ + !*** ./src/question_radiogroup.ts ***! + \************************************/ + /*! exports provided: QuestionRadiogroupModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRadiogroupModel", function() { return QuestionRadiogroupModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _question_baseselect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./question_baseselect */ "./src/question_baseselect.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + /** + * A Model for a radiogroup question. + */ + var QuestionRadiogroupModel = /** @class */ (function (_super) { + __extends(QuestionRadiogroupModel, _super); + function QuestionRadiogroupModel(name) { + return _super.call(this, name) || this; + } + QuestionRadiogroupModel.prototype.getType = function () { + return "radiogroup"; + }; + Object.defineProperty(QuestionRadiogroupModel.prototype, "ariaRole", { + get: function () { + return "radiogroup"; + }, + enumerable: false, + configurable: true + }); + QuestionRadiogroupModel.prototype.getFirstInputElementId = function () { + return this.inputId + "_0"; + }; + Object.defineProperty(QuestionRadiogroupModel.prototype, "selectedItem", { + /** + * Return the selected item in the radio group. Returns null if the value is empty + */ + get: function () { + if (this.isEmpty()) + return null; + return _itemvalue__WEBPACK_IMPORTED_MODULE_4__["ItemValue"].getItemByValue(this.visibleChoices, this.value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRadiogroupModel.prototype, "showClearButton", { + /** + * Show "clear button" flag. + */ + get: function () { + return this.getPropertyValue("showClearButton"); + }, + set: function (val) { + this.setPropertyValue("showClearButton", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRadiogroupModel.prototype, "canShowClearButton", { + get: function () { + return this.showClearButton && !this.isReadOnly; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRadiogroupModel.prototype, "clearButtonCaption", { + get: function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_3__["surveyLocalization"].getString("clearCaption"); + }, + enumerable: false, + configurable: true + }); + QuestionRadiogroupModel.prototype.supportGoNextPageAutomatic = function () { + return true; + }; + return QuestionRadiogroupModel; + }(_question_baseselect__WEBPACK_IMPORTED_MODULE_2__["QuestionCheckboxBase"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("radiogroup", [{ name: "showClearButton:boolean", default: false }, + { name: "separateSpecialChoices", visible: true }], function () { + return new QuestionRadiogroupModel(""); + }, "checkboxbase"); + _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].Instance.registerQuestion("radiogroup", function (name) { + var q = new QuestionRadiogroupModel(name); + q.choices = _questionfactory__WEBPACK_IMPORTED_MODULE_1__["QuestionFactory"].DefaultChoices; + return q; + }); + + + /***/ }), + + /***/ "./src/question_ranking.ts": + /*!*********************************!*\ + !*** ./src/question_ranking.ts ***! + \*********************************/ + /*! exports provided: QuestionRankingModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRankingModel", function() { return QuestionRankingModel; }); + /* harmony import */ var _dragdrop_ranking_choices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dragdrop/ranking-choices */ "./src/dragdrop/ranking-choices.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _question_checkbox__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./question_checkbox */ "./src/question_checkbox.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _utils_devices__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/devices */ "./src/utils/devices.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + + + /** + * A Model for a ranking question + */ + var QuestionRankingModel = /** @class */ (function (_super) { + __extends(QuestionRankingModel, _super); + function QuestionRankingModel(name) { + var _this = _super.call(this, name) || this; + _this.domNode = null; + _this.onVisibleChoicesChanged = function () { + _super.prototype.onVisibleChoicesChanged.call(_this); + // ranking question with only one choice doesn't make sense + if (_this.visibleChoices.length === 1) { + _this.value = []; + _this.updateRankingChoices(); + return; + } + if (_this.isEmpty()) { + _this.updateRankingChoices(); + return; + } + if (_this.visibleChoices.length > _this.value.length) + _this.addToValueByVisibleChoices(); + if (_this.visibleChoices.length < _this.value.length) + _this.removeFromValueByVisibleChoices(); + _this.updateRankingChoices(); + }; + _this.localeChanged = function () { + _super.prototype.localeChanged.call(_this); + _this.updateRankingChoices(); + }; + _this.handlePointerDown = function (event, choice, node) { + if (_this.allowStartDrag) { + _this.dragDropRankingChoices.startDrag(event, choice, _this, node); + } + }; + _this.handleKeydown = function (event, choice) { + var key = event.key; + var index = _this.rankingChoices.indexOf(choice); + if (key === "ArrowUp" && index) { + _this.handleArrowUp(index, choice); + } + if (key === "ArrowDown" && index !== _this.rankingChoices.length - 1) { + _this.handleArrowDown(index, choice); + } + }; + _this.handleArrowUp = function (index, choice) { + var choices = _this.rankingChoices; + choices.splice(index, 1); + choices.splice(index - 1, 0, choice); + _this.setValue(); + setTimeout(function () { + _this.focusItem(index - 1); + }, 1); + }; + _this.handleArrowDown = function (index, choice) { + var choices = _this.rankingChoices; + choices.splice(index, 1); + choices.splice(index + 1, 0, choice); + _this.setValue(); + setTimeout(function () { + _this.focusItem(index + 1); + }, 1); + }; + _this.focusItem = function (index) { + var itemsNodes = _this.domNode.querySelectorAll("." + _this.cssClasses.item); + itemsNodes[index].focus(); + }; + _this.setValue = function () { + var value = []; + _this.rankingChoices.forEach(function (choice) { + value.push(choice.value); + }); + _this.value = value; + }; + _this.setValueFromUI = function () { + var value = []; + var textNodes = _this.domNode.querySelectorAll("." + _this.cssClasses.controlLabel); + textNodes.forEach(function (textNode, index) { + var innerText = textNode.innerText; + _this.visibleChoices.forEach(function (visibleChoice) { + if (innerText === visibleChoice.text) { + value.push(visibleChoice.value); + } + }); + }); + _this.value = value; + }; + _this.syncNumbers = function () { + if (!_this.domNode) + return; + var selector = "." + + _this.cssClasses.item + + ":not(." + + _this.cssClasses.itemDragMod + + ")" + + " ." + + _this.cssClasses.itemIndex; + var indexNodes = _this.domNode.querySelectorAll(selector); + indexNodes.forEach(function (indexNode, index) { + indexNode.innerText = _this.getNumberByIndex(index); + }); + }; + _this.setGhostText = function (text) { + var indexNodes = _this.domNode.querySelectorAll("." + _this.cssClasses.itemIndex); + var ghostNode = indexNodes[indexNodes.length - 1]; + ghostNode.innerText = text; + }; + _this.createNewArray("rankingChoices"); + return _this; + } + QuestionRankingModel.prototype.getType = function () { + return "ranking"; + }; + Object.defineProperty(QuestionRankingModel.prototype, "rootClass", { + get: function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__["CssClassBuilder"]() + .append(this.cssClasses.root) + .append(this.cssClasses.rootMobileMod, _utils_devices__WEBPACK_IMPORTED_MODULE_5__["IsMobile"]) + .append(this.cssClasses.rootDisabled, !this.allowStartDrag) + .append(this.cssClasses.itemOnError, this.errors.length > 0) + .toString(); + }, + enumerable: false, + configurable: true + }); + QuestionRankingModel.prototype.getItemClassCore = function (item, options) { + var itemIndex = this.rankingChoices.indexOf(item); + var dropTargetIndex = this.rankingChoices.indexOf(this.currentDropTarget); + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__["CssClassBuilder"]() + .append(_super.prototype.getItemClassCore.call(this, item, options)) + .append(this.cssClasses.itemGhostMod, this.currentDropTarget === item) + .append("sv-dragdrop-movedown", itemIndex === dropTargetIndex + 1 && this.dropTargetNodeMove === "down") + .append("sv-dragdrop-moveup", itemIndex === dropTargetIndex - 1 && this.dropTargetNodeMove === "up") + .toString(); + }; + QuestionRankingModel.prototype.isItemCurrentDropTarget = function (item) { + return this.dragDropRankingChoices.dropTarget === item; + }; + Object.defineProperty(QuestionRankingModel.prototype, "ghostPositionCssClass", { + get: function () { + if (this.ghostPosition === "top") + return this.cssClasses.dragDropGhostPositionTop; + if (this.ghostPosition === "bottom") + return this.cssClasses.dragDropGhostPositionBottom; + return ""; + }, + enumerable: false, + configurable: true + }); + QuestionRankingModel.prototype.getNumberByIndex = function (index) { + return this.isEmpty() ? "\u2013" : index + 1 + ""; + }; + QuestionRankingModel.prototype.setSurveyImpl = function (value, isLight) { + _super.prototype.setSurveyImpl.call(this, value, isLight); + this.updateRankingChoices(); + }; + QuestionRankingModel.prototype.isAnswerCorrect = function () { + return _helpers__WEBPACK_IMPORTED_MODULE_6__["Helpers"].isArraysEqual(this.value, this.correctAnswer, false); + }; + QuestionRankingModel.prototype.onSurveyValueChanged = function (newValue) { + _super.prototype.onSurveyValueChanged.call(this, newValue); + if (this.isLoadingFromJson) + return; + this.updateRankingChoices(); + }; + QuestionRankingModel.prototype.addToValueByVisibleChoices = function () { + var newValue = this.value.slice(); + this.visibleChoices.forEach(function (choice) { + if (newValue.indexOf(choice.value) === -1) { + newValue.push(choice.value); + } + }); + this.value = newValue; + }; + QuestionRankingModel.prototype.removeFromValueByVisibleChoices = function () { + var _this = this; + var newValue = this.value.slice(); + this.value.forEach(function (valueItem, index) { + var isValueItemToRemove = true; + _this.visibleChoices.forEach(function (choice) { + if (choice.value === valueItem) + isValueItemToRemove = false; + }); + isValueItemToRemove && newValue.splice(index, 1); + }); + this.value = newValue; + }; + Object.defineProperty(QuestionRankingModel.prototype, "rankingChoices", { + get: function () { + return this.getPropertyValue("rankingChoices", []); + }, + enumerable: false, + configurable: true + }); + QuestionRankingModel.prototype.updateRankingChoices = function () { + var _this = this; + var newRankingChoices = []; + // ranking question with only one choice doesn't make sense + if (this.visibleChoices.length === 1) { + this.setPropertyValue("rankingChoices", newRankingChoices); + return; + } + if (this.isEmpty()) { + this.setPropertyValue("rankingChoices", this.visibleChoices); + return; + } + this.value.forEach(function (valueItem) { + _this.visibleChoices.forEach(function (choice) { + if (choice.value === valueItem) + newRankingChoices.push(choice); + }); + }); + this.setPropertyValue("rankingChoices", newRankingChoices); + }; + QuestionRankingModel.prototype.endLoadingFromJson = function () { + _super.prototype.endLoadingFromJson.call(this); + this.dragDropRankingChoices = new _dragdrop_ranking_choices__WEBPACK_IMPORTED_MODULE_0__["DragDropRankingChoices"](this.survey); + }; + Object.defineProperty(QuestionRankingModel.prototype, "allowStartDrag", { + get: function () { + return !this.isReadOnly && !this.isDesignMode; + }, + enumerable: false, + configurable: true + }); + //cross framework initialization + QuestionRankingModel.prototype.afterRenderQuestionElement = function (el) { + this.domNode = el; + _super.prototype.afterRenderQuestionElement.call(this, el); + }; + //cross framework destroy + QuestionRankingModel.prototype.beforeDestroyQuestionElement = function (el) { + _super.prototype.beforeDestroyQuestionElement.call(this, el); + }; + QuestionRankingModel.prototype.supportSelectAll = function () { + return false; + }; + QuestionRankingModel.prototype.supportOther = function () { + return false; + }; + QuestionRankingModel.prototype.supportNone = function () { + return false; + }; + QuestionRankingModel.prototype.getIconHoverCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__["CssClassBuilder"]() + .append(this.cssClasses.itemIcon) + .append(this.cssClasses.itemIconHoverMod) + .toString(); + }; + QuestionRankingModel.prototype.getIconFocusCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_4__["CssClassBuilder"]() + .append(this.cssClasses.itemIcon) + .append(this.cssClasses.itemIconFocusMod) + .toString(); + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: null }) + ], QuestionRankingModel.prototype, "currentDropTarget", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ defaultValue: null }) + ], QuestionRankingModel.prototype, "dropTargetNodeMove", void 0); + return QuestionRankingModel; + }(_question_checkbox__WEBPACK_IMPORTED_MODULE_3__["QuestionCheckboxModel"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("ranking", [ + { name: "hasOther", visible: false, isSerializable: false }, + { name: "otherText", visible: false, isSerializable: false }, + { name: "otherErrorText", visible: false, isSerializable: false }, + { name: "storeOthersAsComment", visible: false, isSerializable: false }, + { name: "hasNone", visible: false, isSerializable: false }, + { name: "noneText", visible: false, isSerializable: false }, + { name: "hasSelectAll", visible: false, isSerializable: false }, + { name: "selectAllText", visible: false, isSerializable: false }, + { name: "colCount:number", visible: false, isSerializable: false }, + { name: "maxSelectedChoices", visible: false, isSerializable: false }, + ], function () { + return new QuestionRankingModel(""); + }, "checkbox"); + _questionfactory__WEBPACK_IMPORTED_MODULE_2__["QuestionFactory"].Instance.registerQuestion("ranking", function (name) { + var q = new QuestionRankingModel(name); + q.choices = _questionfactory__WEBPACK_IMPORTED_MODULE_2__["QuestionFactory"].DefaultChoices; + return q; + }); + + + /***/ }), + + /***/ "./src/question_rating.ts": + /*!********************************!*\ + !*** ./src/question_rating.ts ***! + \********************************/ + /*! exports provided: RenderedRatingItem, QuestionRatingModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenderedRatingItem", function() { return RenderedRatingItem; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionRatingModel", function() { return QuestionRatingModel; }); + /* harmony import */ var _itemvalue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./itemvalue */ "./src/itemvalue.ts"); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + + + + var RenderedRatingItem = /** @class */ (function (_super) { + __extends(RenderedRatingItem, _super); + function RenderedRatingItem(itemValue, locString) { + if (locString === void 0) { locString = null; } + var _this = _super.call(this) || this; + _this.itemValue = itemValue; + _this.locString = locString; + return _this; + } + Object.defineProperty(RenderedRatingItem.prototype, "value", { + get: function () { + return this.itemValue.getPropertyValue("value"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(RenderedRatingItem.prototype, "locText", { + get: function () { + return this.locString || this.itemValue.locText; + }, + enumerable: false, + configurable: true + }); + return RenderedRatingItem; + }(_base__WEBPACK_IMPORTED_MODULE_7__["Base"])); + + /** + * A Model for a rating question. + */ + var QuestionRatingModel = /** @class */ (function (_super) { + __extends(QuestionRatingModel, _super); + function QuestionRatingModel(name) { + var _this = _super.call(this, name) || this; + _this.createItemValues("rateValues"); + var self = _this; + _this.registerFunctionOnPropertyValueChanged("rateValues", function () { + self.fireCallback(self.rateValuesChangedCallback); + }); + _this.createLocalizableString("ratingOptionsCaption", _this, false, true); + _this.onPropertyChanged.add(function (sender, options) { + if (options.name == "rateMin" || + options.name == "rateMax" || + options.name == "minRateDescription" || + options.name == "maxRateDescription" || + options.name == "rateStep" || + options.name == "displayRateDescriptionsAsExtremeItems" || + options.name == "value") { + self.fireCallback(self.rateValuesChangedCallback); + } + }); + _this.createLocalizableString("minRateDescription", _this, true); + _this.createLocalizableString("maxRateDescription", _this, true); + return _this; + } + QuestionRatingModel.prototype.endLoadingFromJson = function () { + _super.prototype.endLoadingFromJson.call(this); + this.hasMinRateDescription = !!this.minRateDescription; + this.hasMaxRateDescription = !!this.maxRateDescription; + }; + QuestionRatingModel.prototype.onSurveyLoad = function () { + _super.prototype.onSurveyLoad.call(this); + this.fireCallback(this.rateValuesChangedCallback); + }; + Object.defineProperty(QuestionRatingModel.prototype, "rateValues", { + /** + * The list of rate items. Every item has value and text. If text is empty, the value is rendered. The item text supports markdown. If it is empty the array is generated by using rateMin, rateMax and rateStep properties. + * @see rateMin + * @see rateMax + * @see rateStep + */ + get: function () { + return this.getPropertyValue("rateValues"); + }, + set: function (val) { + this.setPropertyValue("rateValues", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "rateMin", { + /** + * This property is used to generate rate values if rateValues array is empty. It is the first value in the rating. The default value is 1. + * @see rateValues + * @see rateMax + * @see rateStep + */ + get: function () { + return this.getPropertyValue("rateMin"); + }, + set: function (val) { + if (!this.isLoadingFromJson && val > this.rateMax - this.rateStep) + val = this.rateMax - this.rateStep; + this.setPropertyValue("rateMin", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "rateMax", { + /** + * This property is used to generate rate values if rateValues array is empty. It is the last value in the rating. The default value is 5. + * @see rateValues + * @see rateMin + * @see rateStep + */ + get: function () { + return this.getPropertyValue("rateMax"); + }, + set: function (val) { + if (!this.isLoadingFromJson && val < this.rateMin + this.rateStep) + val = this.rateMin + this.rateStep; + this.setPropertyValue("rateMax", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "rateStep", { + /** + * This property is used to generate rate values if rateValues array is empty. It is the step value. The number of rate values are (rateMax - rateMin) / rateStep. The default value is 1. + * @see rateValues + * @see rateMin + * @see rateMax + */ + get: function () { + return this.getPropertyValue("rateStep"); + }, + set: function (val) { + if (val <= 0) + val = 1; + if (!this.isLoadingFromJson && val > this.rateMax - this.rateMin) + val = this.rateMax - this.rateMin; + this.setPropertyValue("rateStep", val); + }, + enumerable: false, + configurable: true + }); + QuestionRatingModel.prototype.getDisplayValueCore = function (keysAsText, value) { + var res = _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getTextOrHtmlByValue(this.visibleRateValues, value); + return !!res ? res : value; + }; + Object.defineProperty(QuestionRatingModel.prototype, "visibleRateValues", { + get: function () { + if (this.rateValues.length > 0) + return this.rateValues; + var res = []; + var value = this.rateMin; + var step = this.rateStep; + while (value <= this.rateMax && + res.length < _settings__WEBPACK_IMPORTED_MODULE_4__["settings"].ratingMaximumRateValueCount) { + var item = new _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"](value); + item.locOwner = this; + item.ownerPropertyName = "rateValues"; + res.push(item); + value = this.correctValue(value + step, step); + } + return res; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "renderedRateItems", { + get: function () { + var _this = this; + return this.visibleRateValues.map(function (v, i) { + if (_this.displayRateDescriptionsAsExtremeItems) { + if (i == 0) + return new RenderedRatingItem(v, _this.minRateDescription && _this.locMinRateDescription || v.locText); + if (i == _this.visibleRateValues.length - 1) + return new RenderedRatingItem(v, _this.maxRateDescription && _this.locMaxRateDescription || v.locText); + } + return new RenderedRatingItem(v); + }); + }, + enumerable: false, + configurable: true + }); + QuestionRatingModel.prototype.correctValue = function (value, step) { + if (!value) + return value; + if (Math.round(value) == value) + return value; + var fr = 0; + while (Math.round(step) != step) { + step *= 10; + fr++; + } + return parseFloat(value.toFixed(fr)); + }; + QuestionRatingModel.prototype.getType = function () { + return "rating"; + }; + QuestionRatingModel.prototype.getFirstInputElementId = function () { + return this.inputId + "_0"; + }; + QuestionRatingModel.prototype.supportGoNextPageAutomatic = function () { + return true; + }; + QuestionRatingModel.prototype.supportComment = function () { + return true; + }; + QuestionRatingModel.prototype.supportOther = function () { + return false; + }; + Object.defineProperty(QuestionRatingModel.prototype, "minRateDescription", { + /** + * The description of minimum (first) item. + */ + get: function () { + return this.getLocalizableStringText("minRateDescription"); + }, + set: function (val) { + this.setLocalizableStringText("minRateDescription", val); + this.hasMinRateDescription = !!this.minRateDescription; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "locMinRateDescription", { + get: function () { + return this.getLocalizableString("minRateDescription"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "maxRateDescription", { + /** + * The description of maximum (last) item. + */ + get: function () { + return this.getLocalizableStringText("maxRateDescription"); + }, + set: function (val) { + this.setLocalizableStringText("maxRateDescription", val); + this.hasMaxRateDescription = !!this.maxRateDescription; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "locMaxRateDescription", { + get: function () { + return this.getLocalizableString("maxRateDescription"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "hasMinLabel", { + get: function () { + return !this.displayRateDescriptionsAsExtremeItems && !!this.hasMinRateDescription; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "hasMaxLabel", { + get: function () { + return !this.displayRateDescriptionsAsExtremeItems && !!this.hasMaxRateDescription; + }, + enumerable: false, + configurable: true + }); + QuestionRatingModel.prototype.valueToData = function (val) { + if (this.rateValues.length > 0) { + var item = _itemvalue__WEBPACK_IMPORTED_MODULE_0__["ItemValue"].getItemByValue(this.rateValues, val); + return !!item ? item.value : val; + } + return !isNaN(val) ? parseFloat(val) : val; + }; + /** + * Click value again to clear. + */ + QuestionRatingModel.prototype.setValueFromClick = function (value) { + if (this.value === parseFloat(value)) { + this.clearValue(); + } + else { + this.value = value; + } + }; + Object.defineProperty(QuestionRatingModel.prototype, "ratingRootCss", { + get: function () { + return ((this.useDropdown == "never" || (!!this.survey && this.survey.isDesignMode)) && this.cssClasses.rootWrappable) ? + this.cssClasses.rootWrappable : this.cssClasses.root; + }, + enumerable: false, + configurable: true + }); + QuestionRatingModel.prototype.getItemClass = function (item) { + var isSelected = this.value == item.value; + var isDisabled = this.isReadOnly || !item.isEnabled; + var allowHover = !isDisabled && !isSelected && !(!!this.survey && this.survey.isDesignMode); + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]() + .append(this.cssClasses.item) + .append(this.cssClasses.selected, this.value == item.value) + .append(this.cssClasses.itemDisabled, this.isReadOnly) + .append(this.cssClasses.itemHover, allowHover) + .append(this.cssClasses.itemOnError, this.errors.length > 0) + .toString(); + }; + //methods for mobile view + QuestionRatingModel.prototype.getControlClass = function () { + this.isEmpty(); + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_6__["CssClassBuilder"]() + .append(this.cssClasses.control) + .append(this.cssClasses.controlEmpty, this.isEmpty()) + .append(this.cssClasses.onError, this.errors.length > 0) + .append(this.cssClasses.controlDisabled, this.isReadOnly) + .toString(); + }; + Object.defineProperty(QuestionRatingModel.prototype, "optionsCaption", { + get: function () { + return this.getLocalizableStringText("ratingOptionsCaption"); + }, + set: function (val) { + this.setLocalizableStringText("ratingOptionsCaption", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "locOptionsCaption", { + get: function () { + return this.getLocalizableString("ratingOptionsCaption"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "showOptionsCaption", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "renderedValue", { + get: function () { + return this.value; + }, + set: function (val) { + this.value = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "visibleChoices", { + get: function () { + return this.visibleRateValues; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionRatingModel.prototype, "readOnlyText", { + get: function () { + return (this.displayValue || this.showOptionsCaption && this.optionsCaption); + }, + enumerable: false, + configurable: true + }); + QuestionRatingModel.prototype.needResponsiveWidth = function () { + var rateValues = this.getPropertyValue("rateValues"); + var rateStep = this.getPropertyValue("rateStep"); + var rateMax = this.getPropertyValue("rateMax"); + var rateMin = this.getPropertyValue("rateMin"); + return this.useDropdown != "always" && !!(this.hasMinRateDescription || + this.hasMaxRateDescription || + rateValues.length > 0 || + (rateStep && (rateMax - rateMin) / rateStep > 9)); + }; + // TODO: return responsiveness after design improvement + QuestionRatingModel.prototype.supportResponsiveness = function () { + return true; + }; + QuestionRatingModel.prototype.getCompactRenderAs = function () { + return (this.useDropdown == "never") ? "default" : "dropdown"; + }; + QuestionRatingModel.prototype.getDesktopRenderAs = function () { + return (this.useDropdown == "always") ? "dropdown" : "default"; + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: false }) + ], QuestionRatingModel.prototype, "hasMinRateDescription", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: false }) + ], QuestionRatingModel.prototype, "hasMaxRateDescription", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: false }) + ], QuestionRatingModel.prototype, "displayRateDescriptionsAsExtremeItems", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: "auto", onSet: function (val, target) { } }) + ], QuestionRatingModel.prototype, "useDropdown", void 0); + return QuestionRatingModel; + }(_question__WEBPACK_IMPORTED_MODULE_1__["Question"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_2__["Serializer"].addClass("rating", [ + { name: "hasComment:switch", layout: "row" }, + { + name: "commentText", + dependsOn: "hasComment", + visibleIf: function (obj) { + return obj.hasComment; + }, + serializationProperty: "locCommentText", + layout: "row", + }, + { + name: "commentPlaceHolder", + serializationProperty: "locCommentPlaceHolder", + dependsOn: "hasComment", + visibleIf: function (obj) { + return obj.hasComment; + }, + }, + { + name: "rateValues:itemvalue[]", + baseValue: function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_5__["surveyLocalization"].getString("choices_Item"); + }, + }, + { name: "rateMin:number", default: 1 }, + { name: "rateMax:number", default: 5 }, + { name: "rateStep:number", default: 1, minValue: 0.1 }, + { + name: "minRateDescription", + alternativeName: "mininumRateDescription", + serializationProperty: "locMinRateDescription", + }, + { + name: "maxRateDescription", + alternativeName: "maximumRateDescription", + serializationProperty: "locMaxRateDescription", + }, + { name: "displayRateDescriptionsAsExtremeItems:boolean", default: false }, + { + name: "useDropdown", + default: "auto", + choices: ["auto", "never", "always"], + } + ], function () { + return new QuestionRatingModel(""); + }, "question"); + _questionfactory__WEBPACK_IMPORTED_MODULE_3__["QuestionFactory"].Instance.registerQuestion("rating", function (name) { + return new QuestionRatingModel(name); + }); + + + /***/ }), + + /***/ "./src/question_signaturepad.ts": + /*!**************************************!*\ + !*** ./src/question_signaturepad.ts ***! + \**************************************/ + /*! exports provided: QuestionSignaturePadModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionSignaturePadModel", function() { return QuestionSignaturePadModel; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var signature_pad__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! signature_pad */ "./node_modules/signature_pad/dist/signature_pad.mjs"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + + var defaultWidth = 300; + var defaultHeight = 200; + function resizeCanvas(canvas) { + var context = canvas.getContext("2d"); + var devicePixelRatio = window.devicePixelRatio || 1; + var backingStoreRatio = context.webkitBackingStorePixelRatio || + context.mozBackingStorePixelRatio || + context.msBackingStorePixelRatio || + context.oBackingStorePixelRatio || + context.backingStorePixelRatio || + 1; + var ratio = devicePixelRatio / backingStoreRatio; + var oldWidth = canvas.width; + var oldHeight = canvas.height; + canvas.width = oldWidth * ratio; + canvas.height = oldHeight * ratio; + canvas.style.width = oldWidth + "px"; + canvas.style.height = oldHeight + "px"; + context.scale(ratio, ratio); + } + /** + * A Model for signature pad question. + */ + var QuestionSignaturePadModel = /** @class */ (function (_super) { + __extends(QuestionSignaturePadModel, _super); + function QuestionSignaturePadModel(name) { + return _super.call(this, name) || this; + } + QuestionSignaturePadModel.prototype.getCssRoot = function (cssClasses) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_5__["CssClassBuilder"]() + .append(_super.prototype.getCssRoot.call(this, cssClasses)) + .append(cssClasses.small, this.width.toString() === "300") + .toString(); + }; + QuestionSignaturePadModel.prototype.updateValue = function () { + if (this.signaturePad) { + var data = this.signaturePad.toDataURL(this.dataFormat); + this.value = data; + } + }; + QuestionSignaturePadModel.prototype.getType = function () { + return "signaturepad"; + }; + QuestionSignaturePadModel.prototype.afterRenderQuestionElement = function (el) { + if (!!el) { + this.initSignaturePad(el); + } + _super.prototype.afterRenderQuestionElement.call(this, el); + }; + QuestionSignaturePadModel.prototype.beforeDestroyQuestionElement = function (el) { + if (!!el) { + this.destroySignaturePad(el); + } + }; + QuestionSignaturePadModel.prototype.initSignaturePad = function (el) { + var _this = this; + var canvas = el.getElementsByTagName("canvas")[0]; + var signaturePad = new signature_pad__WEBPACK_IMPORTED_MODULE_4__["default"](canvas, { backgroundColor: "#ffffff" }); + if (this.isInputReadOnly) { + signaturePad.off(); + } + this.readOnlyChangedCallback = function () { + if (_this.isInputReadOnly) { + signaturePad.off(); + } + else { + signaturePad.on(); + } + }; + signaturePad.penColor = this.penColor; + signaturePad.backgroundColor = this.backgroundColor; + signaturePad.onBegin = function () { + _this.isDrawingValue = true; + canvas.focus(); + }; + signaturePad.onEnd = function () { + _this.isDrawingValue = false; + _this.updateValue(); + }; + var updateValueHandler = function () { + var data = _this.value; + canvas.width = _this.width || defaultWidth; + canvas.height = _this.height || defaultHeight; + resizeCanvas(canvas); + if (!data) { + signaturePad.clear(); + } + else { + signaturePad.fromDataURL(data); + } + }; + updateValueHandler(); + this.readOnlyChangedCallback(); + this.signaturePad = signaturePad; + var propertyChangedHandler = function (sender, options) { + if (options.name === "width" || options.name === "height") { + updateValueHandler(); + } + if (options.name === "value") { + updateValueHandler(); + } + }; + this.onPropertyChanged.add(propertyChangedHandler); + this.signaturePad.propertyChangedHandler = propertyChangedHandler; + }; + QuestionSignaturePadModel.prototype.destroySignaturePad = function (el) { + if (this.signaturePad) { + this.onPropertyChanged.remove(this.signaturePad.propertyChangedHandler); + this.signaturePad.off(); + } + this.readOnlyChangedCallback = null; + this.signaturePad = null; + }; + Object.defineProperty(QuestionSignaturePadModel.prototype, "width", { + /** + * Use it to set the specific width for the signature pad. + */ + get: function () { + return this.getPropertyValue("width"); + }, + set: function (val) { + this.setPropertyValue("width", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSignaturePadModel.prototype, "height", { + /** + * Use it to set the specific height for the signature pad. + */ + get: function () { + return this.getPropertyValue("height"); + }, + set: function (val) { + this.setPropertyValue("height", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSignaturePadModel.prototype, "allowClear", { + /** + * Use it to clear content of the signature pad. + */ + get: function () { + return this.getPropertyValue("allowClear"); + }, + set: function (val) { + this.setPropertyValue("allowClear", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSignaturePadModel.prototype, "canShowClearButton", { + get: function () { + return !this.isInputReadOnly && this.allowClear; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSignaturePadModel.prototype, "penColor", { + /** + * Use it to set pen color for the signature pad. + */ + get: function () { + return this.getPropertyValue("penColor"); + }, + set: function (val) { + this.setPropertyValue("penColor", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSignaturePadModel.prototype, "backgroundColor", { + /** + * Use it to set background color for the signature pad. + */ + get: function () { + return this.getPropertyValue("backgroundColor"); + }, + set: function (val) { + this.setPropertyValue("backgroundColor", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionSignaturePadModel.prototype, "clearButtonCaption", { + /** + * The clear signature button caption. + */ + get: function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_1__["surveyLocalization"].getString("clearCaption"); + }, + enumerable: false, + configurable: true + }); + QuestionSignaturePadModel.prototype.needShowPlaceholder = function () { + return !this.isDrawingValue && this.isEmpty(); + }; + Object.defineProperty(QuestionSignaturePadModel.prototype, "placeHolderText", { + get: function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_1__["surveyLocalization"].getString("signaturePlaceHolder"); + }, + enumerable: false, + configurable: true + }); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) + ], QuestionSignaturePadModel.prototype, "isDrawingValue", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: "" }) + ], QuestionSignaturePadModel.prototype, "dataFormat", void 0); + return QuestionSignaturePadModel; + }(_question__WEBPACK_IMPORTED_MODULE_3__["Question"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_0__["Serializer"].addClass("signaturepad", [ + { + name: "width:number", + category: "general", + default: 300, + }, + { + name: "height:number", + category: "general", + default: 200, + }, + { + name: "allowClear:boolean", + category: "general", + default: true, + }, + { + name: "penColor:color", + category: "general", + default: "#1ab394", + }, + { + name: "backgroundColor:color", + category: "general", + default: "#ffffff", + }, + { + name: "dataFormat", + category: "general", + default: "", + choices: [ + { value: "", text: "PNG" }, + { value: "image/jpeg", text: "JPEG" }, + { value: "image/svg+xml", text: "SVG" }, + ], + }, + { name: "defaultValue", visible: false }, + { name: "correctAnswer", visible: false }, + ], function () { + return new QuestionSignaturePadModel(""); + }, "question"); + _questionfactory__WEBPACK_IMPORTED_MODULE_2__["QuestionFactory"].Instance.registerQuestion("signaturepad", function (name) { + return new QuestionSignaturePadModel(name); + }); + + + /***/ }), + + /***/ "./src/question_text.ts": + /*!******************************!*\ + !*** ./src/question_text.ts ***! + \******************************/ + /*! exports provided: QuestionTextModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionTextModel", function() { return QuestionTextModel; }); + /* harmony import */ var _questionfactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./questionfactory */ "./src/questionfactory.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _validator__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./validator */ "./src/validator.ts"); + /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./error */ "./src/error.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + /* harmony import */ var _question_textbase__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./question_textbase */ "./src/question_textbase.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + + + /** + * A Model for an input text question. + */ + var QuestionTextModel = /** @class */ (function (_super) { + __extends(QuestionTextModel, _super); + function QuestionTextModel(name) { + var _this = _super.call(this, name) || this; + _this.createLocalizableString("minErrorText", _this, true, "minError"); + _this.createLocalizableString("maxErrorText", _this, true, "maxError"); + _this.locDataListValue = new _localizablestring__WEBPACK_IMPORTED_MODULE_2__["LocalizableStrings"](_this); + _this.locDataListValue.onValueChanged = function (oldValue, newValue) { + _this.propertyValueChanged("dataList", oldValue, newValue); + }; + _this.registerFunctionOnPropertiesValueChanged(["min", "max", "inputType", "minValueExpression", "maxValueExpression"], function () { + _this.setRenderedMinMax(); + }); + _this.registerFunctionOnPropertiesValueChanged(["inputType", "size"], function () { + _this.updateInputSize(); + _this.calcRenderedPlaceHolder(); + }); + return _this; + } + QuestionTextModel.prototype.isTextValue = function () { + return ["text", "number", "password"].indexOf(this.inputType) > -1; + }; + QuestionTextModel.prototype.getType = function () { + return "text"; + }; + QuestionTextModel.prototype.onSurveyLoad = function () { + _super.prototype.onSurveyLoad.call(this); + this.setRenderedMinMax(); + this.updateInputSize(); + }; + Object.defineProperty(QuestionTextModel.prototype, "inputType", { + /** + * Use this property to change the default input type. + */ + get: function () { + return this.getPropertyValue("inputType"); + }, + set: function (val) { + val = val.toLowerCase(); + if (val == "datetime_local") + val = "datetime-local"; + this.setPropertyValue("inputType", val.toLowerCase()); + if (!this.isLoadingFromJson) { + this.min = undefined; + this.max = undefined; + this.step = undefined; + } + }, + enumerable: false, + configurable: true + }); + QuestionTextModel.prototype.runCondition = function (values, properties) { + _super.prototype.runCondition.call(this, values, properties); + if (!!this.minValueExpression || !!this.maxValueExpression) { + this.setRenderedMinMax(values, properties); + } + }; + QuestionTextModel.prototype.getValidators = function () { + var validators = _super.prototype.getValidators.call(this); + if (this.inputType === "email" && + !this.validators.some(function (v) { return v.getType() === "emailvalidator"; })) { + validators.push(new _validator__WEBPACK_IMPORTED_MODULE_4__["EmailValidator"]()); + } + return validators; + }; + QuestionTextModel.prototype.isLayoutTypeSupported = function (layoutType) { + return true; + }; + Object.defineProperty(QuestionTextModel.prototype, "size", { + /** + * The text input size + */ + get: function () { + return this.getPropertyValue("size"); + }, + set: function (val) { + this.setPropertyValue("size", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "isTextInput", { + get: function () { + return (["text", "search", "tel", "url", "email", "password"].indexOf(this.inputType) > -1); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "inputSize", { + get: function () { + return this.getPropertyValue("inputSize", 0); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "renderedInputSize", { + get: function () { + return this.getPropertyValue("inputSize") || null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "inputWidth", { + get: function () { + return this.getPropertyValue("inputWidth"); + }, + enumerable: false, + configurable: true + }); + QuestionTextModel.prototype.updateInputSize = function () { + var size = this.isTextInput && this.size > 0 ? this.size : 0; + if (this.isTextInput && + size < 1 && + this.parent && + !!this.parent["itemSize"]) { + size = this.parent["itemSize"]; + } + this.setPropertyValue("inputSize", size); + this.setPropertyValue("inputWidth", size > 0 ? "auto" : ""); + }; + Object.defineProperty(QuestionTextModel.prototype, "autoComplete", { + /** + * Text auto complete + */ + get: function () { + return this.getPropertyValue("autoComplete", ""); + }, + set: function (val) { + this.setPropertyValue("autoComplete", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "min", { + /** + * The minimum value + */ + get: function () { + return this.getPropertyValue("min"); + }, + set: function (val) { + if (this.isValueExpression(val)) { + this.minValueExpression = val.substr(1); + return; + } + this.setPropertyValue("min", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "max", { + /** + * The maximum value + */ + get: function () { + return this.getPropertyValue("max"); + }, + set: function (val) { + if (this.isValueExpression(val)) { + this.maxValueExpression = val.substr(1); + return; + } + this.setPropertyValue("max", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "minValueExpression", { + /** + * The minimum value that you can setup as expression, for example today(-1) = yesterday; + */ + get: function () { + return this.getPropertyValue("minValueExpression", ""); + }, + set: function (val) { + this.setPropertyValue("minValueExpression", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "maxValueExpression", { + /** + * The maximum value that you can setup as expression, for example today(1) = tomorrow; + */ + get: function () { + return this.getPropertyValue("maxValueExpression", ""); + }, + set: function (val) { + this.setPropertyValue("maxValueExpression", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "renderedMin", { + get: function () { + return this.getPropertyValue("renderedMin"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "renderedMax", { + get: function () { + return this.getPropertyValue("renderedMax"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "minErrorText", { + /** + * The text that shows when value is less than min property. + * @see min + * @see maxErrorText + */ + get: function () { + return this.getLocalizableStringText("minErrorText"); + }, + set: function (val) { + this.setLocalizableStringText("minErrorText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "locMinErrorText", { + get: function () { + return this.getLocalizableString("minErrorText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "maxErrorText", { + /** + * The text that shows when value is greater than man property. + * @see max + * @see minErrorText + */ + get: function () { + return this.getLocalizableStringText("maxErrorText"); + }, + set: function (val) { + this.setLocalizableStringText("maxErrorText", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "locMaxErrorText", { + get: function () { + return this.getLocalizableString("maxErrorText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "isMinMaxType", { + /** + * Readonly property that returns true if the current inputType allows to set min and max properties + * @see inputType + * @see min + * @see max + */ + get: function () { + return isMinMaxType(this); + }, + enumerable: false, + configurable: true + }); + QuestionTextModel.prototype.onCheckForErrors = function (errors, isOnValueChanged) { + _super.prototype.onCheckForErrors.call(this, errors, isOnValueChanged); + if (isOnValueChanged) + return; + if (this.isValueLessMin) { + errors.push(new _error__WEBPACK_IMPORTED_MODULE_5__["CustomError"](this.getMinMaxErrorText(this.minErrorText, this.getCalculatedMinMax(this.renderedMin)), this)); + } + if (this.isValueGreaterMax) { + errors.push(new _error__WEBPACK_IMPORTED_MODULE_5__["CustomError"](this.getMinMaxErrorText(this.maxErrorText, this.getCalculatedMinMax(this.renderedMax)), this)); + } + }; + QuestionTextModel.prototype.canSetValueToSurvey = function () { + if (!this.isMinMaxType) + return true; + var isValid = !this.isValueLessMin && !this.isValueGreaterMax; + if (this.inputType === "number" && !!this.survey && + (this.survey.isValidateOnValueChanging || this.survey.isValidateOnValueChanged)) { + this.hasErrors(); + } + return isValid; + }; + QuestionTextModel.prototype.getMinMaxErrorText = function (errorText, value) { + if (!value) + return errorText; + return errorText.replace("{0}", value.toString()); + }; + Object.defineProperty(QuestionTextModel.prototype, "isValueLessMin", { + get: function () { + return (!this.isValueEmpty(this.renderedMin) && + this.getCalculatedMinMax(this.value) < + this.getCalculatedMinMax(this.renderedMin)); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "isValueGreaterMax", { + get: function () { + return (!this.isValueEmpty(this.renderedMax) && + this.getCalculatedMinMax(this.value) > + this.getCalculatedMinMax(this.renderedMax)); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "isDateInputType", { + get: function () { + return this.inputType === "date" || this.inputType === "datetime-local"; + }, + enumerable: false, + configurable: true + }); + QuestionTextModel.prototype.getCalculatedMinMax = function (minMax) { + if (this.isValueEmpty(minMax)) + return minMax; + return this.isDateInputType ? new Date(minMax) : minMax; + }; + QuestionTextModel.prototype.setRenderedMinMax = function (values, properties) { + var _this = this; + if (values === void 0) { values = null; } + if (properties === void 0) { properties = null; } + this.minValueRunner = this.getDefaultRunner(this.minValueRunner, this.minValueExpression); + this.setValueAndRunExpression(this.minValueRunner, this.min, function (val) { + if (!val && _this.isDateInputType && !!_settings__WEBPACK_IMPORTED_MODULE_6__["settings"].minDate) { + val = _settings__WEBPACK_IMPORTED_MODULE_6__["settings"].minDate; + } + _this.setPropertyValue("renderedMin", val); + }, values, properties); + this.maxValueRunner = this.getDefaultRunner(this.maxValueRunner, this.maxValueExpression); + this.setValueAndRunExpression(this.maxValueRunner, this.max, function (val) { + if (!val && _this.isDateInputType) { + val = !!_settings__WEBPACK_IMPORTED_MODULE_6__["settings"].maxDate ? _settings__WEBPACK_IMPORTED_MODULE_6__["settings"].maxDate : "2999-12-31"; + } + _this.setPropertyValue("renderedMax", val); + }, values, properties); + }; + Object.defineProperty(QuestionTextModel.prototype, "step", { + /** + * The step value + */ + get: function () { + return this.getPropertyValue("step"); + }, + set: function (val) { + this.setPropertyValue("step", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "renderedStep", { + get: function () { + return this.isValueEmpty(this.step) ? "any" : this.step; + }, + enumerable: false, + configurable: true + }); + QuestionTextModel.prototype.supportGoNextPageAutomatic = function () { + return ["date", "datetime", "datetime-local"].indexOf(this.inputType) < 0; + }; + QuestionTextModel.prototype.supportGoNextPageError = function () { + return ["date", "datetime", "datetime-local"].indexOf(this.inputType) < 0; + }; + Object.defineProperty(QuestionTextModel.prototype, "dataList", { + /** + * The list of recommended options available to choose. + */ + get: function () { + return this.locDataList.value; + }, + set: function (val) { + this.locDataList.value = val; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "locDataList", { + get: function () { + return this.locDataListValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextModel.prototype, "dataListId", { + get: function () { + return this.locDataList.hasValue() ? this.id + "_datalist" : ""; + }, + enumerable: false, + configurable: true + }); + QuestionTextModel.prototype.canRunValidators = function (isOnValueChanged) { + return (this.errors.length > 0 || + !isOnValueChanged || + this.supportGoNextPageError()); + }; + QuestionTextModel.prototype.setNewValue = function (newValue) { + newValue = this.correctValueType(newValue); + _super.prototype.setNewValue.call(this, newValue); + }; + QuestionTextModel.prototype.correctValueType = function (newValue) { + if (!newValue) + return newValue; + if (this.inputType == "number" || this.inputType == "range") { + return _helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].isNumber(newValue) ? parseFloat(newValue) : ""; + } + return newValue; + }; + QuestionTextModel.prototype.hasPlaceHolder = function () { + return !this.isReadOnly && this.inputType !== "range"; + }; + QuestionTextModel.prototype.isReadOnlyRenderDiv = function () { + return this.isReadOnly && _settings__WEBPACK_IMPORTED_MODULE_6__["settings"].readOnlyTextRenderMode === "div"; + }; + Object.defineProperty(QuestionTextModel.prototype, "inputStyle", { + get: function () { + var style = {}; + if (!!this.inputWidth) { + style.width = this.inputWidth; + } + return style; + }, + enumerable: false, + configurable: true + }); + return QuestionTextModel; + }(_question_textbase__WEBPACK_IMPORTED_MODULE_7__["QuestionTextBase"])); + + var minMaxTypes = [ + "number", + "date", + "datetime", + "datetime-local", + "month", + "time", + "week", + ]; + function isMinMaxType(obj) { + var t = !!obj ? obj.inputType : ""; + if (!t) + return false; + return minMaxTypes.indexOf(t) > -1; + } + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("text", [ + { + name: "inputType", + default: "text", + choices: [ + "color", + "date", + "datetime", + "datetime-local", + "email", + "month", + "number", + "password", + "range", + "tel", + "text", + "time", + "url", + "week", + ], + }, + { + name: "size:number", + minValue: 0, + dependsOn: "inputType", + visibleIf: function (obj) { + if (!obj) + return false; + return obj.isTextInput; + }, + }, + { + name: "textUpdateMode", + default: "default", + choices: ["default", "onBlur", "onTyping"], + dependsOn: "inputType", + visibleIf: function (obj) { + if (!obj) + return false; + return obj.isTextInput; + }, + }, + { + name: "autoComplete", + dataList: [ + "name", + "honorific-prefix", + "given-name", + "additional-name", + "family-name", + "honorific-suffix", + "nickname", + "organization-title", + "username", + "new-password", + "current-password", + "organization", + "street-address", + "address-line1", + "address-line2", + "address-line3", + "address-level4", + "address-level3", + "address-level2", + "address-level1", + "country", + "country-name", + "postal-code", + "cc-name", + "cc-given-name", + "cc-additional-name", + "cc-family-name", + "cc-number", + "cc-exp", + "cc-exp-month", + "cc-exp-year", + "cc-csc", + "cc-type", + "transaction-currency", + "transaction-amount", + "language", + "bday", + "bday-day", + "bday-month", + "bday-year", + "sex", + "url", + "photo", + "tel", + "tel-country-code", + "tel-national", + "tel-area-code", + "tel-local", + "tel-local-prefix", + "tel-local-suffix", + "tel-extension", + "email", + "impp", + ], + }, + { + name: "min", + dependsOn: "inputType", + visibleIf: function (obj) { + return isMinMaxType(obj); + }, + onPropertyEditorUpdate: function (obj, propertyEditor) { + if (!!obj && !!obj.inputType) { + propertyEditor.inputType = obj.inputType; + } + }, + }, + { + name: "max", + dependsOn: "inputType", + nextToProperty: "*min", + visibleIf: function (obj) { + return isMinMaxType(obj); + }, + onPropertyEditorUpdate: function (obj, propertyEditor) { + if (!!obj && !!obj.inputType) { + propertyEditor.inputType = obj.inputType; + } + }, + }, + { + name: "minValueExpression:expression", + category: "logic", + dependsOn: "inputType", + visibleIf: function (obj) { + return isMinMaxType(obj); + }, + }, + { + name: "maxValueExpression:expression", + category: "logic", + dependsOn: "inputType", + visibleIf: function (obj) { + return isMinMaxType(obj); + }, + }, + { + name: "minErrorText", + serializationProperty: "locMinErrorText", + dependsOn: "inputType", + visibleIf: function (obj) { + return isMinMaxType(obj); + }, + }, + { + name: "maxErrorText", + serializationProperty: "locMaxErrorText", + dependsOn: "inputType", + visibleIf: function (obj) { + return isMinMaxType(obj); + }, + }, + { + name: "step:number", + dependsOn: "inputType", + visibleIf: function (obj) { + if (!obj) + return false; + return obj.inputType === "number"; + }, + }, + { + name: "maxLength:number", + default: -1, + dependsOn: "inputType", + visibleIf: function (obj) { + if (!obj) + return false; + return obj.isTextInput; + }, + }, + { + name: "placeHolder", + serializationProperty: "locPlaceHolder", + dependsOn: "inputType", + visibleIf: function (obj) { + if (!obj) + return false; + return obj.isTextInput; + }, + }, + { + name: "dataList:string[]", + serializationProperty: "locDataList", + dependsOn: "inputType", + visibleIf: function (obj) { + if (!obj) + return false; + return obj.inputType === "text"; + }, + }, + ], function () { + return new QuestionTextModel(""); + }, "textbase"); + _questionfactory__WEBPACK_IMPORTED_MODULE_0__["QuestionFactory"].Instance.registerQuestion("text", function (name) { + return new QuestionTextModel(name); + }); + + + /***/ }), + + /***/ "./src/question_textbase.ts": + /*!**********************************!*\ + !*** ./src/question_textbase.ts ***! + \**********************************/ + /*! exports provided: QuestionTextBase */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionTextBase", function() { return QuestionTextBase; }); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + /** + * A Base Model for a comment and text questions + */ + var QuestionTextBase = /** @class */ (function (_super) { + __extends(QuestionTextBase, _super); + function QuestionTextBase(name) { + return _super.call(this, name) || this; + } + QuestionTextBase.prototype.isTextValue = function () { + return true; + }; + Object.defineProperty(QuestionTextBase.prototype, "maxLength", { + /** + * The maximum text length. If it is -1, defaul value, then the survey maxTextLength property will be used. + * If it is 0, then the value is unlimited + * @see SurveyModel.maxTextLength + */ + get: function () { + return this.getPropertyValue("maxLength"); + }, + set: function (val) { + this.setPropertyValue("maxLength", val); + }, + enumerable: false, + configurable: true + }); + QuestionTextBase.prototype.getMaxLength = function () { + return _helpers__WEBPACK_IMPORTED_MODULE_2__["Helpers"].getMaxLength(this.maxLength, this.survey ? this.survey.maxTextLength : -1); + }; + QuestionTextBase.prototype.getType = function () { + return "textbase"; + }; + QuestionTextBase.prototype.isEmpty = function () { + return _super.prototype.isEmpty.call(this) || this.value === ""; + }; + Object.defineProperty(QuestionTextBase.prototype, "textUpdateMode", { + /** + * Gets or sets a value that specifies how the question updates it's value. + * + * The following options are available: + * - `default` - get the value from survey.textUpdateMode + * - `onBlur` - the value is updated after an input loses the focus. + * - `onTyping` - update the value of text questions, "text" and "comment", on every key press. + * + * Note, that setting to "onTyping" may lead to a performance degradation, in case you have many expressions in the survey. + * @see survey.textUpdateMode + */ + get: function () { + return this.getPropertyValue("textUpdateMode"); + }, + set: function (val) { + this.setPropertyValue("textUpdateMode", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextBase.prototype, "isSurveyInputTextUpdate", { + get: function () { + if (this.textUpdateMode == "default") + return !!this.survey ? this.survey.isUpdateValueTextOnTyping : false; + return this.textUpdateMode == "onTyping"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextBase.prototype, "renderedPlaceHolder", { + get: function () { + return this.getPropertyValue("renderedPlaceHolder"); + }, + enumerable: false, + configurable: true + }); + QuestionTextBase.prototype.setRenderedPlaceHolder = function (val) { + this.setPropertyValue("renderedPlaceHolder", val); + }; + QuestionTextBase.prototype.onReadOnlyChanged = function () { + _super.prototype.onReadOnlyChanged.call(this); + this.calcRenderedPlaceHolder(); + }; + QuestionTextBase.prototype.onSurveyLoad = function () { + this.calcRenderedPlaceHolder(); + _super.prototype.onSurveyLoad.call(this); + }; + QuestionTextBase.prototype.localeChanged = function () { + _super.prototype.localeChanged.call(this); + this.calcRenderedPlaceHolder(); + }; + QuestionTextBase.prototype.calcRenderedPlaceHolder = function () { + var res = this.placeHolder; + if (!!res && !this.hasPlaceHolder()) { + res = undefined; + } + this.setRenderedPlaceHolder(res); + }; + QuestionTextBase.prototype.hasPlaceHolder = function () { + return !this.isReadOnly; + }; + QuestionTextBase.prototype.getControlClass = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_3__["CssClassBuilder"]() + .append(this.cssClasses.root) + .append(this.cssClasses.onError, this.errors.length > 0) + .append(this.cssClasses.controlDisabled, this.isReadOnly) + .toString(); + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])({ localizable: true, onSet: function (val, target) { return target.calcRenderedPlaceHolder(); } }) + ], QuestionTextBase.prototype, "placeHolder", void 0); + return QuestionTextBase; + }(_question__WEBPACK_IMPORTED_MODULE_0__["Question"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("textbase", [], function () { + return new QuestionTextBase(""); + }, "question"); + + + /***/ }), + + /***/ "./src/questionfactory.ts": + /*!********************************!*\ + !*** ./src/questionfactory.ts ***! + \********************************/ + /*! exports provided: QuestionFactory, ElementFactory */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionFactory", function() { return QuestionFactory; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ElementFactory", function() { return ElementFactory; }); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + + + //TODO replace completely with ElementFactory + var QuestionFactory = /** @class */ (function () { + function QuestionFactory() { + this.creatorHash = {}; + } + Object.defineProperty(QuestionFactory, "DefaultChoices", { + get: function () { + return [ + _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("choices_Item") + "1", + _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("choices_Item") + "2", + _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("choices_Item") + "3", + ]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionFactory, "DefaultColums", { + get: function () { + var colName = _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("matrix_column") + " "; + return [colName + "1", colName + "2", colName + "3"]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionFactory, "DefaultRows", { + get: function () { + var rowName = _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("matrix_row") + " "; + return [rowName + "1", rowName + "2"]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionFactory, "DefaultMutlipleTextItems", { + get: function () { + var itemName = _surveyStrings__WEBPACK_IMPORTED_MODULE_0__["surveyLocalization"].getString("multipletext_itemname"); + return [itemName + "1", itemName + "2"]; + }, + enumerable: false, + configurable: true + }); + QuestionFactory.prototype.registerQuestion = function (questionType, questionCreator) { + this.creatorHash[questionType] = questionCreator; + }; + QuestionFactory.prototype.unregisterElement = function (elementType) { + delete this.creatorHash[elementType]; + }; + QuestionFactory.prototype.clear = function () { + this.creatorHash = {}; + }; + QuestionFactory.prototype.getAllTypes = function () { + var result = new Array(); + for (var key in this.creatorHash) { + result.push(key); + } + return result.sort(); + }; + QuestionFactory.prototype.createQuestion = function (questionType, name) { + var creator = this.creatorHash[questionType]; + if (creator == null) + return null; + return creator(name); + }; + QuestionFactory.Instance = new QuestionFactory(); + return QuestionFactory; + }()); + + var ElementFactory = /** @class */ (function () { + function ElementFactory() { + this.creatorHash = {}; + } + ElementFactory.prototype.registerElement = function (elementType, elementCreator) { + this.creatorHash[elementType] = elementCreator; + }; + ElementFactory.prototype.clear = function () { + this.creatorHash = {}; + }; + ElementFactory.prototype.unregisterElement = function (elementType, removeFromSerializer) { + if (removeFromSerializer === void 0) { removeFromSerializer = false; } + delete this.creatorHash[elementType]; + QuestionFactory.Instance.unregisterElement(elementType); + if (removeFromSerializer) { + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].removeClass(elementType); + } + }; + ElementFactory.prototype.getAllTypes = function () { + var result = QuestionFactory.Instance.getAllTypes(); + for (var key in this.creatorHash) { + result.push(key); + } + return result.sort(); + }; + ElementFactory.prototype.createElement = function (elementType, name) { + var creator = this.creatorHash[elementType]; + if (creator == null) + return QuestionFactory.Instance.createQuestion(elementType, name); + return creator(name); + }; + ElementFactory.Instance = new ElementFactory(); + return ElementFactory; + }()); + + + + /***/ }), + + /***/ "./src/questionnonvalue.ts": + /*!*********************************!*\ + !*** ./src/questionnonvalue.ts ***! + \*********************************/ + /*! exports provided: QuestionNonValue */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionNonValue", function() { return QuestionNonValue; }); + /* harmony import */ var _question__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./question */ "./src/question.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + /** + * A Model for non value question. This question doesn't add any new functionality. It hides some properties, including the value. + */ + var QuestionNonValue = /** @class */ (function (_super) { + __extends(QuestionNonValue, _super); + function QuestionNonValue(name) { + return _super.call(this, name) || this; + } + QuestionNonValue.prototype.getType = function () { + return "nonvalue"; + }; + Object.defineProperty(QuestionNonValue.prototype, "hasInput", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionNonValue.prototype, "hasTitle", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + QuestionNonValue.prototype.getTitleLocation = function () { + return ""; + }; + Object.defineProperty(QuestionNonValue.prototype, "hasComment", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + QuestionNonValue.prototype.hasErrors = function (fireCallback, rec) { + return false; + }; + QuestionNonValue.prototype.getAllErrors = function () { + return []; + }; + QuestionNonValue.prototype.supportGoNextPageAutomatic = function () { + return false; + }; + QuestionNonValue.prototype.addConditionObjectsByContext = function (objects, context) { }; + QuestionNonValue.prototype.getConditionJson = function (operator, path) { + return null; + }; + return QuestionNonValue; + }(_question__WEBPACK_IMPORTED_MODULE_0__["Question"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("nonvalue", [ + { name: "title", visible: false }, + { name: "description", visible: false }, + { name: "valueName", visible: false }, + { name: "enableIf", visible: false }, + { name: "defaultValue", visible: false }, + { name: "correctAnswer", visible: false }, + { name: "clearIfInvisible", visible: false }, + { name: "isRequired", visible: false, isSerializable: false }, + { name: "requiredErrorText", visible: false }, + { name: "readOnly", visible: false }, + { name: "requiredIf", visible: false }, + { name: "validators", visible: false }, + { name: "titleLocation", visible: false }, + { name: "useDisplayValuesInTitle", visible: false }, + ], function () { + return new QuestionNonValue(""); + }, "question"); + + + /***/ }), + + /***/ "./src/rendererFactory.ts": + /*!********************************!*\ + !*** ./src/rendererFactory.ts ***! + \********************************/ + /*! exports provided: RendererFactory */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RendererFactory", function() { return RendererFactory; }); + var RendererFactory = /** @class */ (function () { + function RendererFactory() { + this.renderersHash = {}; + } + RendererFactory.prototype.unregisterRenderer = function (questionType, rendererAs) { + delete this.renderersHash[questionType][rendererAs]; + }; + RendererFactory.prototype.registerRenderer = function (questionType, renderAs, renderer) { + if (!this.renderersHash[questionType]) { + this.renderersHash[questionType] = {}; + } + this.renderersHash[questionType][renderAs] = renderer; + }; + RendererFactory.prototype.getRenderer = function (questionType, renderAs) { + return ((this.renderersHash[questionType] && + this.renderersHash[questionType][renderAs]) || + "default"); + }; + RendererFactory.prototype.getRendererByQuestion = function (question) { + return this.getRenderer(question.getType(), question.renderAs); + }; + RendererFactory.prototype.clear = function () { + this.renderersHash = {}; + }; + RendererFactory.Instance = new RendererFactory(); + return RendererFactory; + }()); + + + + /***/ }), + + /***/ "./src/settings.ts": + /*!*************************!*\ + !*** ./src/settings.ts ***! + \*************************/ + /*! exports provided: settings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "settings", function() { return settings; }); + /** + * Global survey settings + */ + var settings = { + /** + * Options for SurveyJS comparator. By default we trim strings and compare them as case insensitive. To change the behavior you can use following code: + * settings.comparator.trimStrings = false; //"abc " will not equal to "abc". They are equal by default. + * settings.comparator.caseSensitive = true; //"abc " will not equal to "Abc". They are equal by default. + */ + comparator: { + trimStrings: true, + caseSensitive: false + }, + /** + * The prefix that uses to store the question comment, as {questionName} + {commentPrefix}. + * The default + */ + commentPrefix: "-Comment", + /** + * Encode parameter on calling restful web API + */ + webserviceEncodeParameters: true, + /** + * Cache the result for choices getting from web services. Set this property to false, to disable the caching. + */ + useCachingForChoicesRestful: true, + get useCachingForChoicesRestfull() { + return settings.useCachingForChoicesRestful; + }, + set useCachingForChoicesRestfull(val) { + settings.useCachingForChoicesRestful = val; + }, + /** + * SurveyJS web service API url + */ + surveyServiceUrl: "https://api.surveyjs.io/public/v1/Survey", + /** + * separator that can allow to set value and text of ItemValue object in one string as: "value|text" + */ + itemValueSeparator: "|", + /** + * Set it to true to serialize itemvalue instance always as object even if text property is empty + * const item = new Survey.ItemValue(5); + * item.toJSON(); //will return {value: 5}, instead of 5 by default. + */ + itemValueAlwaysSerializeAsObject: false, + /** + * Set it to true to serialize itemvalue text property, even if it is empty or equals to value + * const item = new Survey.ItemValue("item1"); + * item.toJSON(); //will return {value: item1, text: "item1"}, instead of "item1" by default. + */ + itemValueAlwaysSerializeText: false, + /** + * default locale name for localizable strings that uses during serialization, {"default": "My text", "de": "Mein Text"} + */ + defaultLocaleName: "default", + /** + * Default row name for matrix (single choice) + */ + matrixDefaultRowName: "default", + /** + * Default cell type for dropdown and dynamic matrices + */ + matrixDefaultCellType: "dropdown", + /** + * Total value postfix for dropdown and dynamic matrices. The total value stores as: {matrixName} + {postfix} + */ + matrixTotalValuePostFix: "-total", + /** + * Maximum row count in dynamic matrix + */ + matrixMaximumRowCount: 1000, + /** + * Maximum rowCount that returns in addConditionObjectsByContext function + */ + matrixMaxRowCountInCondition: 1, + /** + * Set this property to false, to render matrix dynamic remove action as button. + * It is rendered as icon in new themes ("defaultV2") by default. + */ + matrixRenderRemoveAsIcon: true, + /** + * Maximum panel count in dynamic panel + */ + panelMaximumPanelCount: 100, + /** + * Maximum rate value count in rating question + */ + ratingMaximumRateValueCount: 20, + /** + * Disable the question while choices are getting from the web service + */ + disableOnGettingChoicesFromWeb: false, + /** + * Set to true to always serialize the localization string as object even if there is only one value for default locale. Instead of string "MyStr" serialize as {default: "MyStr"} + */ + serializeLocalizableStringAsObject: false, + /** + * Set to false to hide empty page title and description in design mode + */ + allowShowEmptyTitleInDesignMode: true, + /** + * Set to false to hide empty page description in design mode + */ + allowShowEmptyDescriptionInDesignMode: true, + /** + * Set this property to true to execute the complete trigger on value change instead of on next page. + */ + executeCompleteTriggerOnValueChanged: false, + /** + * Set this property to false to execute the skip trigger on next page instead of on value change. + */ + executeSkipTriggerOnValueChanged: true, + /** + * Specifies how the input field of [Comment](https://surveyjs.io/Documentation/Library?id=questioncommentmodel) questions is rendered in the read-only mode. + * Available values: + * "textarea" (default) - A 'textarea' element is used to render a Comment question's input field. + * "div" - A 'div' element is used to render a Comment question's input field. + */ + readOnlyCommentRenderMode: "textarea", + /** + * Specifies how the input field of [Text](https://surveyjs.io/Documentation/Library?id=questiontextmodel) questions is rendered in the read-only mode. + * Available values: + * "input" (default) - An 'input' element is used to render a Text question's input field. + * "div" - A 'div' element is used to render a Text question's input field. + */ + readOnlyTextRenderMode: "input", + /** + * Override this function, set your function, if you want to show your own dialog confirm window instead of standard browser window. + * @param message + */ + confirmActionFunc: function (message) { + return confirm(message); + }, + /** + * Set this property to change the default value of the minWidth constraint + */ + minWidth: "300px", + /** + * Set this property to change the default value of the minWidth constraint + */ + maxWidth: "initial", + /** + * This property tells how many times survey re-run expressions on value changes during condition running. We need it to avoid recursions in the expressions + */ + maximumConditionRunCountOnValueChanged: 10, + /** + * By default visibleIndex for question with titleLocation = "hidden" is -1, and survey doesn't count these questions when set questions numbers. + * Set it true, and a question next to a question with hidden title will increase it's number. + */ + setQuestionVisibleIndexForHiddenTitle: false, + /** + * By default visibleIndex for question with hideNumber = true is -1, and survey doesn't count these questions when set questions numbers. + * Set it true, and a question next to a question with hidden title number will increase it's number. + */ + setQuestionVisibleIndexForHiddenNumber: false, + /** + * By default all rows are rendered no matters whwther they are visible. + * Set it true, and survey markup rows will be rendered only if they are visible in viewport. + * This feature is experimantal and might do not support all the use cases. + */ + lazyRowsRendering: false, + lazyRowsRenderingStartRow: 3, + /** + * By default checkbox and radiogroup items are ordered in rows. + * Set it "column", and items will be ordered in columns. + */ + showItemsInOrder: "default", + /** + * Supported validators by question types. You can modify this variable to add validators for new question types or add/remove for existing question types. + */ + supportedValidators: { + question: ["expression"], + comment: ["text", "regex"], + text: ["numeric", "text", "regex", "email"], + checkbox: ["answercount"], + imagepicker: ["answercount"], + }, + /** + * Set the value as string "yyyy-mm-dd". text questions with inputType "date" will not allow to set to survey date that less than this value + */ + minDate: "", + /** + * Set the value as string "yyyy-mm-dd". text questions with inputType "date" will not allow to set to survey date that greater than this value + */ + maxDate: "", + showModal: undefined, + supportCreatorV2: false, + showDefaultItemsInCreatorV2: true, + /** + * Specifies a list of custom icons. + * Use this property to replace SurveyJS default icons (displayed in UI elements of SurveyJS Library or Creator) with your custom icons. + * For every default icon to replace, add a key/value object with the default icon's name as a key and the name of your custom icon as a value. + * For example: Survey.settings.customIcons["icon-redo"] = "my-own-redo-icon" + */ + customIcons: {}, + titleTags: { + survey: "h3", + page: "h4", + panel: "h4", + question: "h5", + } + }; + + + /***/ }), + + /***/ "./src/stylesmanager.ts": + /*!******************************!*\ + !*** ./src/stylesmanager.ts ***! + \******************************/ + /*! exports provided: StylesManager */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StylesManager", function() { return StylesManager; }); + /* harmony import */ var _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaultCss/cssstandard */ "./src/defaultCss/cssstandard.ts"); + + var StylesManager = /** @class */ (function () { + function StylesManager() { + this.sheet = null; + if (StylesManager.Enabled) { + this.sheet = StylesManager.findSheet(StylesManager.SurveyJSStylesSheetId); + if (!this.sheet) { + this.sheet = StylesManager.createSheet(StylesManager.SurveyJSStylesSheetId); + this.initializeStyles(this.sheet); + } + } + } + StylesManager.findSheet = function (styleSheetId) { + if (typeof document === "undefined") + return null; + for (var i = 0; i < document.styleSheets.length; i++) { + if (!!document.styleSheets[i].ownerNode && + document.styleSheets[i].ownerNode["id"] === styleSheetId) { + return document.styleSheets[i]; + } + } + return null; + }; + StylesManager.createSheet = function (styleSheetId) { + var style = document.createElement("style"); + style.id = styleSheetId; + // Add a media (and/or media query) here if you'd like! + // style.setAttribute("media", "screen") + // style.setAttribute("media", "only screen and (max-width : 1024px)") + style.appendChild(document.createTextNode("")); + document.head.appendChild(style); + return style.sheet; + }; + StylesManager.applyTheme = function (themeName, themeSelector) { + if (themeName === void 0) { themeName = "default"; } + if (themeSelector === void 0) { themeSelector = ".sv_main"; } + var ThemeCss; + if (themeName === "modern") + themeSelector = ".sv-root-modern "; + if (themeName === "defaultV2") { + _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_0__["surveyCss"].currentType = themeName; + return; + } + if (["bootstrap", "bootstrapmaterial", "modern"].indexOf(themeName) !== -1) { + ThemeCss = StylesManager[themeName + "ThemeCss"]; + _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_0__["surveyCss"].currentType = themeName; + } + else { + ThemeCss = StylesManager.ThemeCss; + _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_0__["surveyCss"].currentType = "standard"; + } + if (StylesManager.Enabled) { + var styleSheetId = (themeName + themeSelector).trim(); + var sheet_1 = StylesManager.findSheet(styleSheetId); + if (!sheet_1) { + sheet_1 = StylesManager.createSheet(styleSheetId); + var theme_1 = StylesManager.ThemeColors[themeName] || + StylesManager.ThemeColors["default"]; + Object.keys(ThemeCss).forEach(function (selector) { + var cssRuleText = ThemeCss[selector]; + Object.keys(theme_1).forEach(function (colorVariableName) { return (cssRuleText = cssRuleText.replace(new RegExp("\\" + colorVariableName, "g"), theme_1[colorVariableName])); }); + try { + sheet_1.insertRule(themeSelector + selector + " { " + cssRuleText + " }", 0); + } + catch (e) { } + }); + } + } + }; + StylesManager.prototype.initializeStyles = function (sheet) { + if (StylesManager.Enabled) { + Object.keys(StylesManager.Styles).forEach(function (selector) { + try { + sheet.insertRule(selector + " { " + StylesManager.Styles[selector] + " }", 0); + } + catch (e) { } + }); + Object.keys(StylesManager.Media).forEach(function (selector) { + try { + sheet.insertRule(StylesManager.Media[selector].media + + " { " + + selector + + " { " + + StylesManager.Media[selector].style + + " } }", 0); + } + catch (e) { } + }); + } + }; + StylesManager.SurveyJSStylesSheetId = "surveyjs-styles"; + StylesManager.Styles = { + // ".sv_bootstrap_css": + // "position: relative; width: 100%; background-color: #f4f4f4", + // ".sv_bootstrap_css .sv_custom_header": + // "position: absolute; width: 100%; height: 275px; background-color: #e7e7e7;", + // ".sv_bootstrap_css .sv_container": + // "max-width: 80%; margin: auto; position: relative; color: #6d7072; padding: 0 1em;", + // ".sv_bootstrap_css .panel-body": + // "background-color: white; padding: 1em 1em 5em 1em; border-top: 2px solid lightgray;", + ".sv_main span": "word-break: break-word;", + ".sv_main legend": "border: none; margin: 0;", + ".sv_bootstrap_css .sv_qstn": "padding: 0.5em 1em 1.5em 1em;", + ".sv_bootstrap_css .sv_qcbc input[type=checkbox], .sv_bootstrap_css .sv_qcbc input[type=radio]": "vertical-align: middle; margin-top: -1px", + ".sv_bootstrap_css .sv_qstn fieldset": "display: block;", + ".sv_bootstrap_css .sv_qstn .sv_q_checkbox_inline, .sv_bootstrap_css .sv_qstn .sv_q_radiogroup_inline": "display: inline-block;", + ".sv_bootstrap_css .sv-paneldynamic__progress-container ": "position: relative; margin-right: 250px; margin-left: 40px; margin-top: 10px;", + ".sv_main.sv_bootstrapmaterial_css .sv_q_radiogroup_control_label": "display: inline; position: static;", + ".sv_main.sv_bootstrapmaterial_css .checkbox": "margin-top:10px;margin-bottom:10px;", + ".sv_row": "clear: both; min-width:300px;", + ".sv_row .sv_qstn": "float: left", + ".sv_row .sv_qstn:last-child": "float: none", + ".sv_qstn": "display: vertical-align: top; overflow: auto; min-width:300px;", + ".sv_p_container": "display: vertical-align: top; min-width:300px;", + ".sv_q_title .sv_question_icon": "float: right; margin-right: 1em;", + ".sv_q_title .sv_question_icon::before": "content: ''; background-repeat: no-repeat; background-position: center; padding: 0.5em; display: inline-block; background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMi4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAxMCAxMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTAgMTA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOiM2RDcwNzI7fQ0KPC9zdHlsZT4NCjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMiwyIDAsNCA1LDkgMTAsNCA4LDIgNSw1ICIvPg0KPC9zdmc+DQo=);", + ".sv_q_title .sv_question_icon.sv_expanded::before": "transform: rotate(180deg);", + ".sv_qbln .checkbox-material": "margin-right: 3px;", + ".sv_qcbx .checkbox-material": "margin-right: 5px;", + ".sv_qcbx .checkbox label": "justify-content: left; display: inline-block;", + ".sv_qstn .radio label": "justify-content: left; display: inline-block;", + ".sv_qstn .sv_q_imgsel > label img": "pointer-events: none;", + ".sv_qstn .sv_q_imgsel.sv_q_imagepicker_inline": "display: inline-block;", + ".sv_qstn label.sv_q_m_label": "position: absolute; margin: 0; display: block; width: 100%;", + ".sv_qstn td": "position: relative;", + ".sv_q_mt": "table-layout: fixed;", + ".sv_q_mt_label": "display: flex; align-items: center; font-weight: inherit;", + ".sv_q_mt_title": "margin-right: 0.5em; width: 33%;", + ".sv_q_mt_item": "flex: 1;", + ".sv_q_mt_item_value": "float: left;", + '[dir="rtl"] .sv_q_mt_item_value': "float: right;", + ".sv_qstn.sv_qstn_left": "margin-top: 0.75em;", + ".sv_qstn .title-left": "float: left; margin-right: 1em; max-width: 50%", + '[dir="rtl"] .sv_qstn .title-left': "float: right; margin-left: 1em;", + ".sv_qstn .content-left": "overflow: hidden", + ".sv_q_radiogroup_inline .sv_q_radiogroup_other": "display: inline-block;", + ".sv_q_checkbox_inline .sv_q_checkbox_other": "display: inline-block;", + ".sv_q_checkbox_inline, .sv_q_radiogroup_inline, .sv_q_imagepicker_inline": "line-height: 2.5em;", + ".form-inline .sv_q_checkbox_inline:not(:last-child)": "margin-right: 1em;", + ".form-inline .sv_q_radiogroup_inline:not(:last-child)": "margin-right: 1em;", + ".sv_imgsel .sv_q_imagepicker_inline:not(:last-child)": "margin-right: 1em;", + ".sv_qstn fieldset": "border: none; margin: 0; padding: 0;", + ".sv_qstn .sv_q_file_placeholder": "display:none", + ".sv_p_title": "padding-left: 1em; padding-bottom: 0.3em;", + ".sv_p_title_expandable, .sv_q_title_expandable": "cursor: pointer; position: relative; display: flex; align-items: center; padding-right: 24px;", + ".sv_p_title_expandable::after, .sv_q_title_expandable::after": "content: \"\"; display: block;background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 10 10' style='enable-background:new 0 0 10 10;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%23404040;%7D%0A%3C/style%3E%3Cpolygon class='st0' points='2,2 0,4 5,9 10,4 8,2 5,5 '/%3E%3C/svg%3E%0A\"); background-repeat: no-repeat; background-position: center center; background-size: 10px 12px; width: 24px; height: 24px; position: absolute; right: 0;", + ".sv_p_title_expanded::after, .sv_q_title_expanded::after": "transform: rotate(180deg);", + ".sv_p_title .sv_panel_icon": "float: right; margin-right: 1em;", + ".sv_p_title .sv_panel_icon::before": "content: ''; background-repeat: no-repeat; background-position: center; padding: 0.5em; display: inline-block; background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMi4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAxMCAxMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTAgMTA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+DQoJLnN0MHtmaWxsOiM2RDcwNzI7fQ0KPC9zdHlsZT4NCjxwb2x5Z29uIGNsYXNzPSJzdDAiIHBvaW50cz0iMiwyIDAsNCA1LDkgMTAsNCA4LDIgNSw1ICIvPg0KPC9zdmc+DQo=);", + ".sv_p_title .sv_panel_icon.sv_expanded::before": "transform: rotate(180deg);", + ".sv_p_footer": "padding-left: 1em; padding-bottom: 1em;padding-top: 1em;", + ".sv_matrix_cell_detail_button": "position: relative", + ".sv_detail_panel_icon": "display: block; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 14px; height: 14px;", + ".sv_detail_panel_icon::before": "content: ''; background-repeat: no-repeat; background-position: center; width: 14px; height: 14px; display: block; transform: rotate(270deg); background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 15 15' style='enable-background:new 0 0 15 15;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%23FFFFFF;%7D%0A%3C/style%3E%3Cpolygon class='st0' points='14,5.5 12.6,4.1 7.5,9.1 2.4,4.1 1,5.5 7.5,12 '/%3E%3C/svg%3E%0A\");", + ".sv_detail_panel_icon.sv_detail_expanded::before": "transform: rotate(0deg)", + ".sv_matrix_empty_rows_section": "text-align: center; vertical-align: middle;", + ".sv_matrix_empty_rows_text": "padding:20px", + ".sv_q_file > input[type=file], .sv_q_file > button": "display: inline-block;", + ".sv_q_file_preview": "display: inline-block; vertical-align: top; border: 1px solid lightgray; padding: 5px; margin-top: 10px;", + ".sv_q_file_preview > a": "display: block; overflow: hidden; vertical-align: top; white-space: nowrap; text-overflow: ellipsis;", + ".sv_q_file_remove_button": "line-height: normal;", + ".sv_q_file_remove": "display: block; cursor: pointer;", + ".sv_q_m_cell_text": "cursor: pointer;", + ".sv_q_dd_other": "margin-top: 1em;", + ".sv_q_dd_other input": "width: 100%;", + ".sv_qstn .sv-q-col-1, .sv-question .sv-q-col-1": "width: 100%; display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", + ".sv_qstn .sv-q-col-2, .sv-question .sv-q-col-2": "width: calc(50% - 1em); display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", + ".sv_qstn .sv-q-col-3, .sv-question .sv-q-col-3": "width: calc(33.33333% - 1em); display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", + ".sv_qstn .sv-q-col-4, .sv-question .sv-q-col-4": "width: calc(25% - 1em); display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", + ".sv_qstn .sv-q-col-5, .sv-question .sv-q-col-5": "width: calc(20% - 1em); display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", + ".sv_qstn .sv-q-column-1, .sv-question .sv-q-column-1": "width: 100%; max-width: 100%; display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", + ".sv_qstn .sv-q-column-2, .sv-question .sv-q-column-2": "max-width: 50%; display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", + ".sv_qstn .sv-q-column-3, .sv-question .sv-q-column-3": "max-width: 33.33333%; display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", + ".sv_qstn .sv-q-column-4, .sv-question .sv-q-column-4": "max-width: 25%; display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", + ".sv_qstn .sv-q-column-5, .sv-question .sv-q-column-5": "max-width: 20%; display: inline-block; padding-right: 1em; box-sizing: border-box; word-break: break-word;", + ".sv_qstn .sv_q_file_input": "color: transparent;", + ".sv_qstn .sv_q_imgsel label > div": "overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 4px; border: 1px solid lightgray; border-radius: 4px;", + ".sv_qstn .sv_q_imgsel label > div > img, .sv_qstn .sv_q_imgsel label > div > embed": "display: block;", + ".sv_qstn table tr td .sv_q_m_cell_label": "position: absolute; left: 0; right: 0; top: 0; bottom: 0;", + "f-panel": "padding: 0.5em 1em; display: inline-block; line-height: 2em;", + ".sv_progress_bar > span": "white-space: nowrap;", + //progress buttons + ".sv_progress-buttons__container-center": "text-align: center;", + ".sv_progress-buttons__container": "display: inline-block; font-size: 0; width: 100%; max-width: 1100px; white-space: nowrap; overflow: hidden;", + ".sv_progress-buttons__image-button-left": "display: inline-block; vertical-align: top; margin-top: 22px; font-size: 14px; width: 16px; height: 16px; cursor: pointer; background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMi4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwb2x5Z29uIHBvaW50cz0iMTEsMTIgOSwxNCAzLDggOSwyIDExLDQgNyw4ICIvPg0KPC9zdmc+DQo=);", + ".sv_progress-buttons__image-button-right": "display: inline-block; vertical-align: top; margin-top: 22px; font-size: 14px; width: 16px; height: 16px; cursor: pointer; background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMi4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwb2x5Z29uIHBvaW50cz0iNSw0IDcsMiAxMyw4IDcsMTQgNSwxMiA5LDggIi8+DQo8L3N2Zz4NCg==);", + ".sv_progress-buttons__image-button--hidden": "visibility: hidden;", + ".sv_progress-buttons__list-container": "max-width: calc(100% - 36px); display: inline-block; overflow: hidden;", + ".sv_progress-buttons__list": "display: inline-block; width: max-content; padding-left: 28px; padding-right: 28px; margin-top: 14px; margin-bottom: 14px;", + ".sv_progress-buttons__list li": "width: 138px; font-size: 14px; font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; position: relative; text-align: center; vertical-align: top; display: inline-block;", + ".sv_progress-buttons__list li:before": "width: 24px; height: 24px; content: ''; line-height: 30px; display: block; margin: 0 auto 10px auto; border: 3px solid; border-radius: 50%; box-sizing: content-box; cursor: pointer;", + ".sv_progress-buttons__list li:after": "width: 73%; height: 3px; content: ''; position: absolute; top: 15px; left: -36.5%;", + ".sv_progress-buttons__list li:first-child:after": "content: none;", + ".sv_progress-buttons__list .sv_progress-buttons__page-title": "width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: bold;", + ".sv_progress-buttons__list .sv_progress-buttons__page-description": "width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;", + ".sv_progress-buttons__list li.sv_progress-buttons__list-element--nonclickable:before": "cursor: not-allowed;", + // ranking + ".sv-ranking": "outline: none; user-select: none;", + ".sv-ranking-item": "cursor: pointer; position: relative;", + ".sv-ranking-item:focus .sv-ranking-item__icon--hover": "visibility: hidden;", + ".sv-ranking-item:hover .sv-ranking-item__icon--hover": "visibility: visible;", + ".sv-question--disabled .sv-ranking-item:hover .sv-ranking-item__icon--hover": "visibility: hidden;", + ".sv-ranking-item:focus": "outline: none;", + ".sv-ranking-item:focus .sv-ranking-item__icon--focus": "visibility: visible; top: 15px;", + ".sv-ranking-item:focus .sv-ranking-item__index": "background: white; border: 2px solid #19b394;", + ".sv-ranking-item__content": "display: flex; align-items: center; line-height: 1em; background-color: white;padding: 5px 0px; border-radius: 100px;", + ".sv-ranking-item__icon-container": "left: 0;top: 0;bottom: 0;width: 25px; flex-shrink: 0;", + ".sv-ranking-item__icon": "visibility: hidden;top:20px;fill:#19b394;position: absolute;", + ".sv-ranking-item__index": "display: flex; flex-shrink: 0; align-items: center; justify-content: center; background: rgba(25, 179, 148, 0.1);border-radius: 100%; border:2px solid transparent; margin-right: 16px; width: 40px; height: 40px; line-height: 1em;", + ".sv-ranking-item__text": "display: inline-block;", + ".sv-ranking-item__ghost": "display: none;background: #f3f3f3;border-radius: 100px;width: 200px;height: 55px;z-index: 1;position: absolute;left: 25px;", + ".sv-ranking-item--ghost .sv-ranking-item__ghost": "display: block;", + ".sv-ranking-item--ghost .sv-ranking-item__content": "visibility: hidden;", + ".sv-ranking-item--drag .sv-ranking-item__content": "box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.1);border-radius: 100px;", + ".sv-ranking--drag .sv-ranking-item:hover .sv-ranking-item__icon": "visibility: hidden;", + ".sv-ranking-item--drag .sv-ranking-item__icon--hover": "visibility: visible;", + ".sv-ranking--mobile .sv-ranking-item__icon--hover": "visibility:visible; fill:#9f9f9f;", + ".sv-ranking--mobile.sv-ranking--drag .sv-ranking-item--ghost .sv-ranking-item__icon.sv-ranking-item__icon--hover": "visibility:hidden;", + ".sv-ranking--disabled .sv-ranking-item:hover .sv-ranking-item__icon": "visibility: hidden;", + ".sv-ranking--disabled": "opacity: 0.8;", + // EO ranking + // drag drop + ".sv-dragged-element-shortcut": "height: 24px; min-width: 100px; border-radius: 36px; background-color: white; padding: 16px; cursor: grabbing; position: absolute; z-index: 1000; box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.1); font-family: 'Open Sans'; font-size: 16px; padding-left: 20px;line-height: 24px;", + ".sv-matrixdynamic__drag-icon": "padding-top:14px", + ".sv-matrixdynamic__drag-icon:after": "content: ' '; display: block; height: 6px; width: 20px; border: 1px solid #e7e7e7; box-sizing: border-box; border-radius: 10px; cursor: move; margin-top: 12px;", + ".sv-matrix-row--drag-drop-ghost-mod td": "background-color: #f3f3f3;", + ".sv-matrix-row--drag-drop-ghost-mod td > *": "visibility: hidden", + //eo drag-drop + ".sv_qstn .sv_q_select_column": "display: inline-block; vertical-align: top; min-width: 10%;", + ".sv_qstn .sv_q_select_column > *:not(.sv_technical)": "display: block;", + ".sv_main .sv_container .sv_body .sv_p_root .sv_qstn .sv_q_select_column textarea": "margin-left: 0; padding-left: 0; line-height: initial;", + ".sv_main .sv-hidden": "display: none !important;", + ".sv_main .sv-visuallyhidden": "position: absolute; height: 1px !important; width: 1px !important; overflow: hidden; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px);", + // paneldynamic progress + ".sv_main .sv-progress": "height: 0.19em; background-color: $header-background-color; position: relative;", + ".sv_main .sv-progress__bar": "background-color: $main-color; height: 100%; position: relative;", + // EO paneldynamic progress + // paneldynamic + ".sv_main .sv-paneldynamic__progress-container": "position: relative; display: inline-block; width: calc(100% - 250px); margin-top: 20px;", + ".sv_main .sv-paneldynamic__add-btn": "float: right;", + ".sv_main .sv-paneldynamic__add-btn--list-mode": "float: none; margin-top: 0;", + ".sv_main .sv-paneldynamic__remove-btn": "margin-top: 1.25em;", + ".sv_main .sv-paneldynamic__remove-btn--right": "margin-top: 0; margin-left: 1.25em;", + ".sv_main .sv-paneldynamic__prev-btn, .sv_main .sv-paneldynamic__next-btn": "box-sizing: border-box; display: inline-block; cursor: pointer; width: 0.7em; top: -0.28em; position: absolute;", + ".sv_main .sv-paneldynamic__prev-btn svg, .sv_main .sv-paneldynamic__next-btn svg": "width: 0.7em; height: 0.7em; display: block;", + ".sv_main .sv-paneldynamic__prev-btn": "left: -1.3em; transform: rotate(90deg);", + ".sv_main .sv-paneldynamic__next-btn ": "right: -1.3em; transform: rotate(270deg);", + ".sv_main .sv-paneldynamic__prev-btn.sv-paneldynamic__prev-btn--disabled, .sv_main .sv-paneldynamic__next-btn.sv-paneldynamic__next-btn--disabled": "cursor: auto;", + ".sv_main .sv-paneldynamic__progress-text": "font-weight: bold; font-size: 0.87em; margin-top: 0.69em; margin-left: 4em", + // EO paneldynamic + //boolean + ".sv_main .sv-boolean__switch": "display: inline-block; box-sizing: border-box; width: 63px; height: 24px; margin-right: 17px; margin-left: 21px; padding: 2px 3px; vertical-align: middle; border-radius: 12px; cursor: pointer;", + ".sv_main .sv-boolean__slider": "display: inline-block; width: 20px; height: 20px; transition-duration: .4s; transition-property: margin-left; border: none; border-radius: 100%;", + ".sv_main .sv-boolean__label": "vertical-align: middle; cursor: pointer;", + ".sv_main .sv-boolean--indeterminate .sv-boolean__slider": "margin-left: calc(50% - 10px);", + ".sv_main .sv-boolean--checked .sv-boolean__slider": "margin-left: calc(100% - 20px);", + "[dir='rtl'] .sv-boolean__label ": "float: right;", + "[dir='rtl'] .sv-boolean--indeterminate .sv-boolean__slider": "margin-right: calc(50% - 0.625em);", + "[dir='rtl'] .sv-boolean--checked .sv-boolean__slider": "margin-right: calc(100% - 1.25em);", + "[dir='rtl'] .sv-boolean__switch": "float: right;", + "[style*='direction:rtl'] .sv-boolean__label ": "float: right;", + "[style*='direction:rtl'] .sv-boolean--indeterminate .sv-boolean__slider": "margin-right: calc(50% - 0.625em);", + "[style*='direction:rtl'] .sv-boolean--checked .sv-boolean__slider": "margin-right: calc(100% - 1.25em);", + "[style*='direction:rtl'] .sv-boolean__switch": "float: right;", + // EO boolean + ".sv_main .sv_q_num": "", + ".sv_main .sv_q_num + span": "", + // SignaturePad + ".sv_main .sjs_sp_container": "position: relative; box-sizing: content-box;", + ".sv_main .sjs_sp_controls": "position: absolute; left: 0; bottom: 0;", + ".sv_main .sjs_sp_controls > button": "user-select: none;", + ".sv_main .sjs_sp_container>div>canvas:focus": "outline: none;", + ".sv_main .sjs_sp_placeholder": "display: flex; align-items: center; justify-content: center; position: absolute; z-index: 0; user-select: none; pointer-events: none; width: 100%; height: 100%;", + // logo + // ".sv_main .sv_header": "white-space: nowrap;", + ".sv_main .sv_logo": "", + ".sv_main .sv-logo--left": "display: inline-block; vertical-align: top; margin-right: 2em;", + ".sv_main .sv-logo--right": "display: inline-block; vertical-align: top; margin-left: 2em; ", + ".sv_main .sv-logo--top": "display: block; width: 100%; text-align: center;", + ".sv_main .sv-logo--bottom": "display: block; width: 100%; text-align: center;", + ".sv_main .sv_header__text": "display: inline-block; vertical-align: top; max-width: 100%; width: 100%", + ".sv_main .sv-expand-action:before": "content: \"\"; display: inline-block; background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 10 10' style='enable-background:new 0 0 10 10;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bfill:%23404040;%7D%0A%3C/style%3E%3Cpolygon class='st0' points='2,2 0,4 5,9 10,4 8,2 5,5 '/%3E%3C/svg%3E%0A\"); background-repeat: no-repeat; background-position: center center; height: 10px; width: 12px; margin: auto 8px;", + ".sv_main .sv-expand-action--expanded:before": "transform: rotate(180deg);", + ".sv_main .sv-action-bar": "display: flex; position: relative; align-items: center; margin-left: auto; padding: 0 0 0 16px; overflow: hidden; white-space: nowrap;", + ".sv_main .sv-action-bar-separator": "display: inline-block; width: 1px; height: 24px; vertical-align: middle; margin-right: 16px; background-color: #d6d6d6;", + ".sv_main .sv-action-bar-item": "-webkit-appearance: none; -moz-appearance: none; appearance: none; display: flex; height: 40px; padding: 8px; box-sizing: border-box; margin-right: 16px; border: none; border-radius: 2px; background-color: transparent; cursor: pointer; line-height: 24px; font-size: 16px; overflow-x: hidden; white-space: nowrap; min-width: auto; font-weight: normal", + ".sv_main .sv-action-bar-item__title": "vertical-align: middle; white-space: nowrap;", + ".sv_main .sv-action-bar-item__title--with-icon": "margin-left: 8px;", + ".sv_main .sv-action__content": "display: flex; flex-direction: row; align-items: center;", + ".sv_main .sv-action__content > *": "flex: 0 0 auto;", + ".sv_main .sv-action--hidden": "width: 0px; height: 0px; overflow: hidden;", + ".sv_main .sv-action-bar-item__icon svg": "display: block;", + ".sv_main .sv-action-bar-item:active": "opacity: 0.5;", + ".sv_main .sv-action-bar-item:focus": "outline: none;", + ".sv_main .sv-title-actions": "display: flex;align-items: center; width: 100%;", + ".sv_main .sv-title-actions__title": "flex-wrap: wrap; max-width: 90%; min-width: 50%;", + ".sv_main .sv-title-actions__bar": "min-width: 56px;", + ".sv_main .sv_matrix_cell_actions .sv-action-bar": "margin-left: 0; padding-left: 0;", + ".sv_main .sv_p_wrapper_in_row": "display: flex; flex-direction: row; align-items: center;", + ".sv_main .sv_p_remove_btn_right": "margin-left: 1em;", + //button-group + ".sv_main .sv-button-group": "display: flex; align-items: center; flex-direction: row; font-size: 16px; height: 48px; overflow: auto;", + ".sv_main .sv-button-group__item": "display: flex; box-sizing: border-box; flex-direction: row; justify-content: center; align-items: center; width: 100%; padding: 11px 16px; line-height: 24px; border-width: 1px; border-style: solid; outline: none; font-size: 16px; font-weight: 400; cursor: pointer; overflow: hidden;", + ".sv_main .sv-button-group__item:not(:first-of-type)": "margin-left: -1px;", + ".sv_main .sv-button-group__item-icon": "display: block; height: 24px;", + ".sv_main .sv-button-group__item--selected": "font-weight: 600;", + ".sv_main .sv-button-group__item-decorator": "display: flex; align-items: center; max-width: 100%;", + ".sv_main .sv-button-group__item-icon + .sv-button-group__item-caption": "margin-left: 8px", + ".sv_main .sv-button-group__item-caption": "display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;", + ".sv_main .sv-button-group__item--disabled": "color: cursor: default;", + //eo button-group + //popup + "sv-popup": "display: block; position: absolute; z-index: -1;", + ".sv-popup": "position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; outline: none; z-index: 2;", + ".sv-popup__container": "filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, 0.1)); position: absolute; padding: 0;", + ".sv-popup__body-content": "background-color: var(--background, #fff); border-radius: calc(0.5 * var(--base-unit, 8px)); width: 100%; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; max-height: 90vh; max-width: 90vw;", + ".sv-popup--modal": "display: flex; align-items: center; justify-content: center;", + ".sv-popup--modal .sv-popup__container": "position: static;", + ".sv-popup--modal .sv-popup__body-content": "padding: calc(4 * var(--base-unit, 8px));", + ".sv-popup--overlay": "width: 100%;", + ".sv-popup--overlay .sv-popup__container": "background: rgba(144, 144, 144, 0.5); max-width: 100vw; max-height: calc(100vh - 1 * var(--base-unit, 8px)); height: calc(100vh - 1 * var(--base-unit, 8px)); width: 100%; padding-top: calc(2 * var(--base-unit, 8px)); border: unset;", + ".sv-popup__shadow": "width: 100%; height: 100%;", + ".sv-popup--overlay .sv-popup__body-content": "border-radius: calc(2 * var(--base-unit, 8px)) calc(2 * var(--base-unit, 8px)) 0px 0px; background: var(--background, #fff); box-shadow: 0px calc(1 * var(--base-unit, 8px)) calc(2 * var(--base-unit, 8px)) rgba(0, 0, 0, 0.1); padding: calc(3 * var(--base-unit, 8px)) calc(2 * var(--base-unit, 8px)) calc(2 * var(--base-unit, 8px)); height: calc(100% - calc(1 * var(--base-unit, 8px))); max-height: 100vh; max-width: 100vw;", + ".sv-popup--overlay .sv-popup__scrolling-content": "height: calc(100% - (10 * var(--base-unit, 8px)));", + ".sv-popup--overlay .sv-popup__body-footer": "margin-top: calc(2 * var(--base-unit, 8px));", + ".sv-popup--overlay .sv-popup__body-footer-item": "width: 100%;", + ".sv-popup--overlay .sv-popup__button--cancel": "background-color: var(--primary, #19b394); border: 2px solid var(--primary, #19b394); color: var(--primary-foreground, #fff);", + ".sv-popup__scrolling-content": "height: 100%; overflow: auto;", + ".sv-popup__scrolling-content::-webkit-scrollbar": "height: 6px; width: 6px; background-color: var(--background-dim, #f3f3f3);", + ".sv-popup__scrolling-content::-webkit-scrollbar-thumb": "background: var(--primary-light, rgba(25, 179, 148, 0.1));", + ".sv-popup__content": "min-width: 100%;", + ".sv-popup--show-pointer.sv-popup--top .sv-popup__pointer": "transform: translate(calc(-1 * var(--base-unit, 8px))) rotate(180deg);", + ".sv-popup--show-pointer.sv-popup--bottom .sv-popup__pointer": "transform: translate(calc(-1 * var(--base-unit, 8px)), calc(-1 * var(--base-unit, 8px)));", + ".sv-popup--show-pointer.sv-popup--right": "transform: translate(calc(1 * var(--base-unit, 8px)));", + ".sv-popup--show-pointer.sv-popup--right .sv-popup__pointer": "transform: translate(-12px, -4px) rotate(-90deg);", + ".sv-popup--show-pointer.sv-popup--left": "transform: translate(calc(-1 * var(--base-unit, 8px)));", + ".sv-popup--show-pointer.sv-popup--left .sv-popup__pointer": "transform: translate(-4px, -4px) rotate(90deg);", + ".sv-popup__pointer": "display: block; position: absolute;", + ".sv-popup__pointer:after": "content: ' '; display: block; width: 0; height: 0; border-left: calc(1 * var(--base-unit, 8px)) solid transparent; border-right: calc(1 * var(--base-unit, 8px)) solid transparent; border-bottom: calc(1 * var(--base-unit, 8px)) solid var(--background, #fff); align-self: center;", + ".sv-popup__body-header": "font-family: Open Sans; font-size: calc(3 * var(--base-unit, 8px)); line-height: calc(4 * var(--base-unit, 8px)); font-style: normal; font-weight: 700; margin-bottom: calc(2 * var(--base-unit, 8px)); color: var(--foreground, #161616);", + ".sv-popup__body-footer": "display: flex; margin-top: calc(4 * var(--base-unit, 8px));", + ".sv-popup__body-footer-item:first-child": "margin-left: auto;", + ".sv-popup__body-footer-item + .sv-popup__body-footer-item": "margin-left: calc(1 * var(--base-unit, 8px));", + ".sv-popup__button": "padding: calc(2 * var(--base-unit, 8px)) calc(6 * var(--base-unit, 8px)); background: var(--background, #fff); box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.15); border-radius: 4px; margin: 2px; cursor: pointer; font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-style: normal; font-weight: 600; font-size: calc(2 * var(--base-unit, 8px)); line-height: calc(3 * var(--base-unit, 8px)); text-align: center; color: var(--primary, #19b394); border: none; outline: none;", + ".sv-popup__button:hover": "box-shadow: 0 0 0 2px var(--primary, #19b394);", + ".sv-popup__button:disabled": "color: var(--foreground-disabled, rgba(#161616, 0.16)); cursor: default;", + ".sv-popup__button:disabled:hover": "box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.15);", + ".sv-popup__button.sv-popup__button--apply": "background-color: var(--primary, #19b394); color: var(--primary-foreground, #fff);", + ".sv-popup__button.sv-popup__button--apply:disabled": "background-color: var(--background-dim, #f3f3f3);", + //eo popup + //list + ".sv-list": "padding: 0; margin: 0; background: var(--background, #fff); font-family: 'Open Sans'; list-style-type: none;", + ".sv-list__item": "width: 100%; box-sizing: border-box; padding: calc(1 * 8px) calc(2 * 8px); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;", + ".sv-list__item-icon": "float: left; width: calc(3 * 8px); height: calc(3 * 8px); margin-right: calc(2 * 8px);", + ".sv-list__item-icon svg": "display: block;", + ".sv-list__item-icon use": "fill: #909090;", + ".sv-list__item:not(.sv-list__item--selected):hover": "background-color: var(--background-dim, #f3f3f3);", + ".sv-list__item--selected": "background-color: var(--primary, #19b394); color: var(--primary-foreground, #fff);", + ".sv-list__item--selected .sv-list__item-icon use": "fill: var(--primary-foreground, #fff);", + ".sv-list__item--disabled": "color: var(--foreground-disabled, rgba(#161616, 0.16)); cursor: default; pointer-events: none;", + ".sv-list__item span": "white-space: nowrap;", + ".sv-list__container": "position: relative;", + ".sv-list__filter": "position: sticky; top: 0; border-bottom: 1px solid rgba(0, 0, 0, 0.16); background: var(--background, #fff);", + ".sv-list__input": "-webkit-appearance: none; -moz-appearance: none; appearance: none; display: block; box-sizing: border-box; width: 100%; line-height: 24px; padding-left: 56px; padding-right: 24px; padding-top: 16px; padding-bottom: 16px; outline: none; font-size: 1em; border: 1px solid transparent;", + ".sv-list__filter-icon": "display: block; position: absolute; top: 16px; left: 16px;", + ".sv-list__filter-icon .sv-svg-icon": "width: 24px; height: 24px;", + //eo list + ".sv-skeleton-element": "min-height: 50px;", + }; + StylesManager.Media = { + ".sv_qstn fieldset .sv-q-col-1": { + style: "width: 100%;", + media: "@media only screen and (max-width: 480px)", + }, + ".sv_qstn fieldset .sv-q-col-2": { + style: "width: 100%;", + media: "@media only screen and (max-width: 480px)", + }, + ".sv_qstn fieldset .sv-q-col-3": { + style: "width: 100%;", + media: "@media only screen and (max-width: 480px)", + }, + ".sv_qstn fieldset .sv-q-col-4": { + style: "width: 100%;", + media: "@media only screen and (max-width: 480px)", + }, + ".sv_qstn fieldset .sv-q-col-5": { + style: "width: 100%;", + media: "@media only screen and (max-width: 480px)", + }, + ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn": { + style: "display: block; width: 100% !important;", + media: "@media (max-width: 600px)", + }, + ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn .title-left": { + style: "float: none;", + media: "@media (max-width: 600px)", + }, + ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn .sv_q_radiogroup_inline, .sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn .sv_q_checkbox_inline, .sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn .sv_q_imagepicker_inline": { + style: "display: block;", + media: "@media (max-width: 600px)", + }, + ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.table": { + style: "display: block;", + media: "@media (max-width: 600px)", + }, + ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.table thead": { + style: "display: none;", + media: "@media (max-width: 600px)", + }, + ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.table tbody, .sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.table tr, .sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.table td": { + style: "display: block;", + media: "@media (max-width: 600px)", + }, + ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.table:not(.sv_q_matrix) td:before": { + style: "content: attr(data-responsive-title);", + media: "@media (max-width: 600px)", + }, + ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn table.sv_q_matrix td:after": { + style: "content: attr(data-responsive-title); padding-left: 1em", + media: "@media (max-width: 600px)", + }, + ".sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn .radio label, .sv_main .sv_container .panel-body.card-block .sv_row .sv_qstn .checkbox label": { + style: "line-height: 12px; vertical-align: top;", + media: "@media (max-width: 600px)", + }, + ".sv_qstn label.sv_q_m_label": { + style: "display: inline;", + media: "@media (max-width: 600px)", + }, + ".sv_main .sv_custom_header": { + style: "display: none;", + media: "@media (max-width: 1300px)", + }, + ".sv_main .sv_container .sv_header h3": { + style: "font-size: 1.5em;", + media: "@media (max-width: 1300px)", + }, + ".sv_main .sv_container .sv_header h3 span": { + style: "font-size: 0.75em;", + media: "@media (max-width: 700px)", + }, + ".sv_main.sv_bootstrap_css .sv-progress__text": { + style: "margin-left: 8em;", + media: "@media (min-width: 768px)", + }, + ".sv_row": { + style: " display: flex; flex-wrap: wrap;", + media: "@supports (display: flex)", + }, + ".sv-row > .sv-row__panel, .sv-row__question:not(:last-child)": { + style: "float: left;", + media: "@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)", + }, + "[dir='rtl'],[style*='direction:rtl'] .sv-row__question:not(:last-child)": { + style: "float: right;", + media: "@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)", + }, + ".sv-row > .sv-row__panel, .sv-row__question": { + style: "width: 100% !important; padding-right: 0 !important;", + media: "@media only screen and (max-width: 600px)", + }, + }; + StylesManager.ThemeColors = { + default: { + "$header-background-color": "#e7e7e7", + "$body-container-background-color": "#f4f4f4", + "$main-color": "#1ab394", + "$main-hover-color": "#0aa384", + "$body-background-color": "white", + "$inputs-background-color": "white", + "$text-color": "#6d7072", + "$text-input-color": "#6d7072", + "$header-color": "#6d7072", + "$border-color": "#e7e7e7", + "$error-color": "#ed5565", + "$error-background-color": "#fd6575", + "$progress-text-color": "#9d9d9d", + "$disable-color": "#dbdbdb", + "$disabled-label-color": "rgba(64, 64, 64, 0.5)", + "$slider-color": "white", + "$disabled-switch-color": "#9f9f9f", + "$disabled-slider-color": "#cfcfcf", + "$foreground-light": "#909090", + "$foreground-disabled": "#161616", + "$background-dim": "#f3f3f3", + "$progress-buttons-color": "#8dd9ca", + "$progress-buttons-line-color": "#d4d4d4" + }, + orange: { + "$header-background-color": "#4a4a4a", + "$body-container-background-color": "#f8f8f8", + "$main-color": "#f78119", + "$main-hover-color": "#e77109", + "$body-background-color": "white", + "$inputs-background-color": "white", + "$text-color": "#4a4a4a", + "$text-input-color": "#4a4a4a", + "$header-color": "#f78119", + "$border-color": "#e7e7e7", + "$error-color": "#ed5565", + "$error-background-color": "#fd6575", + "$progress-text-color": "#9d9d9d", + "$disable-color": "#dbdbdb", + "$disabled-label-color": "rgba(64, 64, 64, 0.5)", + "$slider-color": "white", + "$disabled-switch-color": "#9f9f9f", + "$disabled-slider-color": "#cfcfcf", + "$foreground-light": "#909090", + "$foreground-disabled": "#161616", + "$background-dim": "#f3f3f3", + "$progress-buttons-color": "#f7b781", + "$progress-buttons-line-color": "#d4d4d4" + }, + darkblue: { + "$header-background-color": "#d9d8dd", + "$body-container-background-color": "#f6f7f2", + "$main-color": "#3c4f6d", + "$main-hover-color": "#2c3f5d", + "$body-background-color": "white", + "$inputs-background-color": "white", + "$text-color": "#4a4a4a", + "$text-input-color": "#4a4a4a", + "$header-color": "#6d7072", + "$border-color": "#e7e7e7", + "$error-color": "#ed5565", + "$error-background-color": "#fd6575", + "$progress-text-color": "#9d9d9d", + "$disable-color": "#dbdbdb", + "$disabled-label-color": "rgba(64, 64, 64, 0.5)", + "$slider-color": "white", + "$disabled-switch-color": "#9f9f9f", + "$disabled-slider-color": "#cfcfcf", + "$foreground-light": "#909090", + "$foreground-disabled": "#161616", + "$background-dim": "#f3f3f3", + "$progress-buttons-color": "#839ec9", + "$progress-buttons-line-color": "#d4d4d4" + }, + darkrose: { + "$header-background-color": "#ddd2ce", + "$body-container-background-color": "#f7efed", + "$main-color": "#68656e", + "$main-hover-color": "#58555e", + "$body-background-color": "white", + "$inputs-background-color": "white", + "$text-color": "#4a4a4a", + "$text-input-color": "#4a4a4a", + "$header-color": "#6d7072", + "$border-color": "#e7e7e7", + "$error-color": "#ed5565", + "$error-background-color": "#fd6575", + "$progress-text-color": "#9d9d9d", + "$disable-color": "#dbdbdb", + "$disabled-label-color": "rgba(64, 64, 64, 0.5)", + "$slider-color": "white", + "$disabled-switch-color": "#9f9f9f", + "$disabled-slider-color": "#cfcfcf", + "$foreground-light": "#909090", + "$foreground-disabled": "#161616", + "$background-dim": "#f3f3f3", + "$progress-buttons-color": "#c6bed4", + "$progress-buttons-line-color": "#d4d4d4" + }, + stone: { + "$header-background-color": "#cdccd2", + "$body-container-background-color": "#efedf4", + "$main-color": "#0f0f33", + "$main-hover-color": "#191955", + "$body-background-color": "white", + "$inputs-background-color": "white", + "$text-color": "#0f0f33", + "$text-input-color": "#0f0f33", + "$header-color": "#0f0f33", + "$border-color": "#e7e7e7", + "$error-color": "#ed5565", + "$error-background-color": "#fd6575", + "$progress-text-color": "#9d9d9d", + "$disable-color": "#dbdbdb", + "$disabled-label-color": "rgba(64, 64, 64, 0.5)", + "$slider-color": "white", + "$disabled-switch-color": "#9f9f9f", + "$disabled-slider-color": "#cfcfcf", + "$foreground-light": "#909090", + "$foreground-disabled": "#161616", + "$background-dim": "#f3f3f3", + "$progress-buttons-color": "#747491", + "$progress-buttons-line-color": "#d4d4d4" + }, + winter: { + "$header-background-color": "#82b8da", + "$body-container-background-color": "#dae1e7", + "$main-color": "#3c3b40", + "$main-hover-color": "#1e1d20", + "$body-background-color": "white", + "$inputs-background-color": "white", + "$text-color": "#000", + "$text-input-color": "#000", + "$header-color": "#000", + "$border-color": "#e7e7e7", + "$error-color": "#ed5565", + "$error-background-color": "#fd6575", + "$disable-color": "#dbdbdb", + "$progress-text-color": "#9d9d9d", + "$disabled-label-color": "rgba(64, 64, 64, 0.5)", + "$slider-color": "white", + "$disabled-switch-color": "#9f9f9f", + "$disabled-slider-color": "#cfcfcf", + "$foreground-light": "#909090", + "$foreground-disabled": "#161616", + "$background-dim": "#f3f3f3", + "$progress-buttons-color": "#d1c9f5", + "$progress-buttons-line-color": "#d4d4d4" + }, + winterstone: { + "$header-background-color": "#323232", + "$body-container-background-color": "#f8f8f8", + "$main-color": "#5ac8fa", + "$main-hover-color": "#06a1e7", + "$body-background-color": "white", + "$inputs-background-color": "white", + "$text-color": "#000", + "$text-input-color": "#000", + "$header-color": "#000", + "$border-color": "#e7e7e7", + "$error-color": "#ed5565", + "$error-background-color": "#fd6575", + "$disable-color": "#dbdbdb", + "$progress-text-color": "#9d9d9d", + "$disabled-label-color": "rgba(64, 64, 64, 0.5)", + "$slider-color": "white", + "$disabled-switch-color": "#9f9f9f", + "$disabled-slider-color": "#cfcfcf", + "$foreground-light": "#909090", + "$foreground-disabled": "#161616", + "$background-dim": "#f3f3f3", + "$progress-buttons-color": "#acdcf2", + "$progress-buttons-line-color": "#d4d4d4" + }, + modern: { + "$main-color": "#1ab394", + "$add-button-color": "#1948b3", + "$remove-button-color": "#ff1800", + "$disable-color": "#dbdbdb", + "$progress-text-color": "#9d9d9d", + "$disabled-label-color": "rgba(64, 64, 64, 0.5)", + "$slider-color": "white", + "$disabled-switch-color": "#9f9f9f", + "$disabled-slider-color": "#cfcfcf", + "$error-color": "#d52901", + "$text-color": "#404040", + "$light-text-color": "#fff", + "$button-text-color": "#fff", + "$checkmark-color": "#fff", + "$matrix-text-checked-color": "#fff", + "$progress-buttons-color": "#8dd9ca", + "$progress-buttons-line-color": "#d4d4d4", + "$text-input-color": "#404040", + "$inputs-background-color": "transparent", + "$main-hover-color": "#9f9f9f", + "$body-container-background-color": "#f4f4f4", + "$text-border-color": "#d4d4d4", + "$disabled-text-color": "rgba(64, 64, 64, 0.5)", + "$border-color": "rgb(64, 64, 64, 0.5)", + "$dropdown-border-color": "#d4d4d4", + "$header-background-color": "#e7e7e7", + "$answer-background-color": "rgba(26, 179, 148, 0.2)", + "$error-background-color": "rgba(213, 41, 1, 0.2)", + "$radio-checked-color": "#404040", + "$clean-button-color": "#1948b3", + "$body-background-color": "#ffffff", + "$foreground-light": "#909090", + "$foreground-disabled": "#161616", + "$background-dim": "#f3f3f3", + }, + bootstrap: { + "$main-color": "#18a689", + "$text-color": "#404040;", + "$text-input-color": "#404040;", + "$progress-text-color": "#9d9d9d", + "$disable-color": "#dbdbdb", + "$header-background-color": "#e7e7e7", + "$disabled-label-color": "rgba(64, 64, 64, 0.5)", + "$slider-color": "white", + "$disabled-switch-color": "#9f9f9f", + "$disabled-slider-color": "#cfcfcf", + "$foreground-light": "#909090", + "$foreground-disabled": "#161616", + "$background-dim": "#f3f3f3", + "$progress-buttons-color": "#8dd6c7", + "$progress-buttons-line-color": "#d4d4d4", + }, + bootstrapmaterial: { + "$main-color": "#18a689", + "$text-color": "#404040;", + "$text-input-color": "#404040;", + "$progress-text-color": "#9d9d9d", + "$disable-color": "#dbdbdb", + "$header-background-color": "#e7e7e7", + "$disabled-label-color": "rgba(64, 64, 64, 0.5)", + "$slider-color": "white", + "$disabled-switch-color": "#9f9f9f", + "$disabled-slider-color": "#cfcfcf", + "$body-background-color": "#ffffff", + "$foreground-light": "#909090", + "$foreground-disabled": "#161616", + "$background-dim": "#f3f3f3", + "$progress-buttons-color": "#8dd6c7", + "$progress-buttons-line-color": "#d4d4d4", + } + }; + StylesManager.ThemeCss = { + ".sv_default_css": "background-color: $body-container-background-color;", + ".sv_default_css hr": "border-color: $border-color;", + ".sv_default_css input[type='button'], .sv_default_css button": "color: $body-background-color; background-color: $main-color;", + ".sv_default_css input[type='button']:hover, .sv_default_css button:hover": "background-color: $main-hover-color;", + ".sv_default_css .sv_header": "color: $header-color;", + ".sv_default_css .sv_custom_header": "background-color: $header-background-color;", + ".sv_default_css .sv_container": "color: $text-color;", + ".sv_default_css .sv_body": "background-color: $body-background-color; border-color: $main-color;", + ".sv_default_css .sv_progress": "background-color: $border-color;", + ".sv_default_css .sv_progress_bar": "background-color: $main-color;", + ".sv_default_css .sv_progress-buttons__list li:before": "border-color: $progress-buttons-color; background-color: $progress-buttons-color;", + ".sv_default_css .sv_progress-buttons__list li:after": "background-color: $progress-buttons-line-color;", + ".sv_default_css .sv_progress-buttons__list .sv_progress-buttons__page-title": "color: $text-color;", + ".sv_default_css .sv_progress-buttons__list .sv_progress-buttons__page-description": "color: $text-color;", + ".sv_default_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed:before": "border-color: $main-color; background-color: $main-color;", + ".sv_default_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed + li:after": "background-color: $progress-buttons-color", + ".sv_default_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", + ".sv_default_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", + ".sv_default_css .sv_p_root > .sv_row": "border-color: $border-color;", + ".sv_default_css .sv_p_root > .sv_row:nth-child(odd)": "background-color: $body-background-color;", + ".sv_default_css .sv_p_root > .sv_row:nth-child(even)": "background-color: $body-container-background-color;", + ".sv_default_css .sv_q_other input": "color: $text-color; -webkit-text-fill-color: $text-color; border-color: $border-color; background-color: $inputs-background-color;", + ".sv_default_css .sv_q_text_root": "color: $text-color; -webkit-text-fill-color: $text-color; border-color: $border-color; background-color: $inputs-background-color;", + ".sv_default_css .sv_q_dropdown_control": "color: $text-input-color; border-color: $border-color; background-color: $inputs-background-color;", + ".sv_default_css input[type='text']": "color: $text-color; -webkit-text-fill-color: $text-color; border-color: $border-color; background-color: $inputs-background-color;", + ".sv_default_css select": "color: $text-color; border-color: $border-color; background-color: $inputs-background-color;", + ".sv_default_css textarea": "color: $text-input-color; -webkit-text-fill-color: $text-input-color; border-color: $border-color; background-color: $inputs-background-color;", + ".sv_default_css input:not([type='button']):not([type='reset']):not([type='submit']):not([type='image']):not([type='checkbox']):not([type='radio'])": "border: 1px solid $border-color; background-color: $inputs-background-color;color: $text-input-color; -webkit-text-fill-color: $text-input-color;", + ".sv_default_css input:not([type='button']):not([type='reset']):not([type='submit']):not([type='image']):not([type='checkbox']):not([type='radio']):focus": "border: 1px solid $main-color;", + ".sv_default_css .sv_container .sv_body .sv_p_root .sv_q .sv_select_wrapper .sv_q_dropdown_control ": "background-color: $inputs-background-color;", + ".sv_default_css .sv_q_other input:focus": "border-color: $main-color;", + ".sv_default_css .sv_q_text_root:focus": "border-color: $main-color;", + ".sv_default_css .sv_q_dropdown_control:focus": "border-color: $main-color;", + ".sv_default_css input[type='text']:focus": "border-color: $main-color;", + '.sv_default_css .sv_container .sv_body .sv_p_root .sv_q input[type="radio"]:focus, .sv_default_css .sv_container .sv_body .sv_p_root .sv_q input[type="checkbox"]:focus': "outline: 1px dotted $main-color;", + ".sv_default_css select:focus": "border-color: $main-color;", + ".sv_default_css textarea:focus": "border-color: $main-color;", + ".sv_default_css .sv_select_wrapper": "background-color: $body-background-color;", + ".sv_default_css .sv_select_wrapper::before": "background-color: $main-color;", + ".sv_default_css .sv_q_rating_item.active .sv_q_rating_item_text": "background-color: $main-hover-color; border-color: $main-hover-color; color: $body-background-color;", + ".sv_default_css .sv_q_rating_item .sv_q_rating_item_text": "border-color: $border-color;", + ".sv_default_css .sv_q_rating_item .sv_q_rating_item_text:hover": "border-color: $main-hover-color;", + ".sv_default_css table.sv_q_matrix tr": "border-color: $border-color;", + ".sv_default_css table.sv_q_matrix_dropdown tr": "border-color: $border-color;", + ".sv_default_css table.sv_q_matrix_dynamic tr": "border-color: $border-color;", + ".sv_default_css .sv_q_m_cell_selected": "color: $body-background-color; background-color: $main-hover-color;", + ".sv_main .sv_q_file_remove:hover": "color: $main-color;", + ".sv_main .sv_q_file_choose_button": "color: $body-background-color; background-color: $main-color;", + ".sv_main .sv_q_file_choose_button:hover": "background-color: $main-hover-color;", + ".sv_main .sv_q_imgsel.checked label>div": "background-color: $main-color", + ".sv_default_css .sv_p_description": "padding-left: 1.29em;", + //progress bar + ".sv_main .sv-progress": "background-color: $header-background-color;", + ".sv_main .sv-progress__bar": "background-color: $main-color;", + //paneldynamic + ".sv_main .sv-paneldynamic__prev-btn.sv-paneldynamic__prev-btn--disabled, .sv_main .sv-paneldynamic__next-btn.sv-paneldynamic__next-btn--disabled": "fill: $disable-color;", + ".sv_main .sv-paneldynamic__progress-text": "color: $progress-text-color;", + ".sv_main .sv-paneldynamic__prev-btn, .sv_main .sv-paneldynamic__next-btn": "fill: $text-color", + //boolean + ".sv_main .sv-boolean__switch": "background-color: $main-color;", + ".sv_main .sv-boolean__slider": "background-color: $slider-color;", + ".sv_main .sv-boolean__label--disabled": "color: $disabled-label-color;", + ".sv_main .sv-boolean--disabled .sv-boolean__switch": "background-color: $disabled-switch-color;", + ".sv_main .sv-boolean--disabled .sv-boolean__slider": "background-color: $disabled-slider-color;", + //eo boolean + //signature pad + ".sv_main .sjs_sp_container": "border: 1px dashed $disable-color;", + ".sv_main .sjs_sp_placeholder": "color: $foreground-light;", + ".sv_main .sv_matrix_detail_row": "background-color: #ededed; border-top: 1px solid $header-background-color; border-bottom: 1px solid $header-background-color;", + //action-bar + ".sv_main .sv-action-bar-item": "color: $text-color;", + ".sv_main .sv-action-bar-item__icon use": "fill: $foreground-light;", + ".sv_main .sv-action-bar-item:hover": "background-color: $background-dim;", + //eo action-bar + //button-group + ".sv_main .sv-button-group__item--hover:hover": "background-color: $background-dim;", + ".sv_main .sv-button-group__item-icon use": "fill: $foreground-light;", + ".sv_main .sv-button-group__item--selected": "color: $main-color;", + ".sv_main .sv-button-group__item--selected .sv-button-group__item-icon use": "fill: $main-color;", + ".sv_main .sv-button-group__item--disabled": "color: $foreground-disabled;", + ".sv_main .sv-button-group__item--disabled .sv-button-group__item-icon use": "fill: $foreground-disabled;", + ".sv_main .sv-button-group__item": "background: $body-background-color; border-color: $border-color;", + //eo button-group + ".sv_main .sv_qstn textarea": "max-width: 100%", + //list + ".sv-list__input": "color: $text-input-color; border-color: $border-color; background-color: $inputs-background-color;", + ".sv-list__input::placeholder": "color: $foreground-light;", + ".sv-list__input:focus": "border-color: $main-color;", + ".sv-list__input:disabled": "color: $foreground-disabled;", + ".sv-list__input:disabled::placeholder": "color: $foreground-disabled;", + //eo list + ".sv-skeleton-element": "background-color: $background-dim;", + }; + StylesManager.modernThemeCss = { + // ".sv-paneldynamic__add-btn": "background-color: $add-button-color;", + // ".sv-paneldynamic__remove-btn": "background-color: $remove-button-color;", + ".sv-boolean__switch": "background-color: $main-color;", + ".sv-boolean__slider": "background-color: $slider-color;", + ".sv-boolean__label--disabled": "color: $disabled-label-color;", + ".sv-boolean--disabled .sv-boolean__switch": "background-color: $disabled-switch-color;", + ".sv-boolean--disabled .sv-boolean__slider": "background-color: $disabled-slider-color;", + ".sv-btn": "color: $button-text-color;", + ".sv-btn--navigation": "background-color: $main-color", + ".sv-checkbox__svg": "border-color: $border-color; fill: transparent;", + ".sv-checkbox--allowhover:hover .sv-checkbox__svg": "background-color: $main-hover-color; fill: $checkmark-color;", + ".sv-checkbox--checked .sv-checkbox__svg": "background-color: $main-color; fill: $checkmark-color;", + ".sv-checkbox--checked.sv-checkbox--disabled .sv-checkbox__svg": "background-color: $disable-color; fill: $checkmark-color;", + ".sv-checkbox--disabled .sv-checkbox__svg": "border-color: $disable-color;", + ".sv-comment": "border-color: $text-border-color; max-width: 100%;", + ".sv-comment:focus": "border-color: $main-color;", + ".sv-completedpage": "color: $text-color; background-color: $body-container-background-color;", + ".sv-container-modern": "color: $text-color;", + ".sv-container-modern__title": "color: $main-color;", + ".sv-description": "color: $disabled-text-color;", + ".sv-dropdown": "border-bottom: 0.06em solid $text-border-color;", + ".sv-dropdown:focus": "border-color: $dropdown-border-color;", + ".sv-dropdown--error": "border-color: $error-color; color: $error-color;", + ".sv-dropdown--error::placeholder": "color: $error-color;", + ".sv-dropdown--error::-ms-input-placeholder": "color: $error-color;", + ".sv-file__decorator": "background-color: $body-container-background-color;", + ".sv-file__clean-btn": "background-color: $remove-button-color;", + ".sv-file__choose-btn:not(.sv-file__choose-btn--disabled)": "background-color: $add-button-color;", + ".sv-file__choose-btn--disabled": "background-color: $disable-color;", + ".sv-file__remove-svg": "fill: #ff1800;", + ".sv-file__sign a": "color: $text-color;", + ".sv-imagepicker__item--allowhover:hover .sv-imagepicker__image": "background-color: $main-hover-color; border-color: $main-hover-color;", + ".sv-imagepicker__item--checked .sv-imagepicker__image": "background-color: $main-color; border-color: $main-color;", + ".sv-imagepicker__item--disabled.sv-imagepicker__item--checked .sv-imagepicker__image": "background-color: $disable-color; border-color: $disable-color;", + ".sv-item__control:focus + .sv-item__decorator": "border-color: $main-color;", + ".sv-matrix__text--checked": "color: $matrix-text-checked-color; background-color: $main-color;", + ".sv-matrix__text--disabled.sv-matrix__text--checked": "background-color: $disable-color;", + ".sv-matrixdynamic__add-btn": "background-color: $add-button-color;", + ".sv-matrixdynamic__remove-btn": "background-color: $remove-button-color;", + ".sv-paneldynamic__add-btn": "background-color: $add-button-color;", + ".sv-paneldynamic__remove-btn": "background-color: $remove-button-color;", + ".sv-paneldynamic__prev-btn": "fill: $text-color;", + ".sv-paneldynamic__next-btn": "fill: $text-color;", + ".sv-paneldynamic__prev-btn.sv-paneldynamic__prev-btn--disabled": "fill: $disable-color;", + ".sv-paneldynamic__next-btn.sv-paneldynamic__next-btn--disabled": "fill: $disable-color;", + ".sv-paneldynamic__progress-text": "color: $progress-text-color;", + ".sv-progress": "background-color: $header-background-color;", + ".sv-progress__bar": "background-color: $main-color;", + ".sv-progress__text": "color: $progress-text-color;", + ".sv_progress-buttons__list li:before": "border-color: $progress-buttons-color; background-color: $progress-buttons-color;", + ".sv_progress-buttons__list li:after": "background-color: $progress-buttons-line-color;", + ".sv_progress-buttons__list .sv_progress-buttons__page-title": "color: $text-color;", + ".sv_progress-buttons__list .sv_progress-buttons__page-description": "color: $text-color;", + ".sv_progress-buttons__list li.sv_progress-buttons__list-element--passed:before": "border-color: $main-color; background-color: $main-color;", + ".sv_progress-buttons__list li.sv_progress-buttons__list-element--passed + li:after": "background-color: $progress-buttons-color", + ".sv_progress-buttons__list li.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", + ".sv_progress-buttons__list li.sv_progress-buttons__list-element--passed.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", + ".sv-question__erbox": "color: $error-color;", + ".sv-question__title--answer": "background-color: $answer-background-color;", + ".sv-question__title--error": "background-color: $error-background-color;", + ".sv-panel__title--error": "background-color: $error-background-color;", + ".sv-radio__svg": "border-color: $border-color; fill: transparent;", + ".sv-radio--allowhover:hover .sv-radio__svg": "fill: $border-color;", + ".sv-radio--checked .sv-radio__svg": "border-color: $radio-checked-color; fill: $radio-checked-color;", + ".sv-radio--disabled .sv-radio__svg": "border-color: $disable-color;", + ".sv-radio--disabled.sv-radio--checked .sv-radio__svg": "fill: $disable-color;", + ".sv-rating": "color: $text-color;", + ".sv-rating input:focus + .sv-rating__min-text + .sv-rating__item-text, .sv-rating input:focus + .sv-rating__item-text": "outline-color: $main-color;", + ".sv-rating__item-text": "color: $main-hover-color; border: solid 0.1875em $main-hover-color;", + ".sv-rating__item-text:hover": "background-color: $main-hover-color; color: $body-background-color;", + ".sv-rating__item--selected .sv-rating__item-text": "background-color: $main-color; color: $body-background-color; border-color: $main-color;", + ".sv-rating--disabled .sv-rating__item-text": "color: $disable-color; border-color: $disable-color;", + ".sv-rating--disabled .sv-rating__item-text:hover": "background-color: transparent;", + ".sv-rating--disabled .sv-rating__item-text:hover .sv-rating__item--selected .sv-rating__item-text": "background-color: $disable-color; color: $body-background-color;", + "::-webkit-scrollbar": "background-color: $main-hover-color;", + "::-webkit-scrollbar-thumb": "background: $main-color;", + ".sv-selectbase__clear-btn": "background-color: $clean-button-color;", + ".sv-table": "background-color: rgba($main-hover-color, 0.1);", + ".sv-text:focus": "border-color: $main-color;", + '.sv-text[type="date"]::-webkit-calendar-picker-indicator': "color: transparent; background: transparent;", + ".sv-text--error": "color: $error-color; border-color: $error-color;", + ".sv-text--error::placeholder": "color: $error-color;", + ".sv-text--error::-ms-placeholder": "color: $error-color;", + ".sv-text--error:-ms-placeholder": "color: $error-color;", + "input.sv-text, textarea.sv-comment, select.sv-dropdown": "color: $text-input-color; background-color: $inputs-background-color;", + ".sv-text::placeholder": "color: $text-input-color;", + ".sv-text::-ms-placeholder": "color: $text-input-color;", + ".sv-text:-ms-placeholder": "color: $text-input-color;", + ".sv-table__row--detail": "background-color: $header-background-color;", + //signature pad + ".sjs_sp_container": "border: 1px dashed $disable-color;", + ".sjs_sp_placeholder": "color: $foreground-light;", + //drag-drop + ".sv-matrixdynamic__drag-icon": "padding-top:16px", + ".sv-matrixdynamic__drag-icon:after": "content: ' '; display: block; height: 6px; width: 20px; border: 1px solid $border-color; box-sizing: border-box; border-radius: 10px; cursor: move; margin-top: 12px;", + ".sv-matrix__drag-drop-ghost-position-top, .sv-matrix__drag-drop-ghost-position-bottom": "position: relative;", + ".sv-matrix__drag-drop-ghost-position-top::after, .sv-matrix__drag-drop-ghost-position-bottom::after": "content: ''; width: 100%; height: 4px; background-color: var(--primary, #19b394); position: absolute; left: 0;", + ".sv-matrix__drag-drop-ghost-position-top::after": "top: 0;", + ".sv-matrix__drag-drop-ghost-position-bottom::after": "bottom: 0;", + //eo drag-drop + ".sv-skeleton-element": "background-color: $background-dim;", + }; + StylesManager.bootstrapThemeCss = { + ".sv_main .sv_q_imgsel.checked label>div": "background-color: $main-color", + ".sv_main .sv_p_description": "padding-left: 1.66em;", + ".sv_main .sv_qstn_error_bottom": "margin-top: 20px; margin-bottom: 0;", + ".sv_main .progress": "width: 60%;", + ".sv_main .progress-bar": "width: auto; margin-left: 2px; margin-right: 2px;", + ".sv_main .table>tbody>tr>td": "min-width: 90px;", + ".sv_main f-panel .sv_qstn": "padding: 0; vertical-align: middle;", + ".sv_main .sv_q_image": "display: inline-block;", + ".sv_main .sv_row .sv_qstn:first-child:last-child": "flex: none !important;", + ".sv_main .sv_row .sv_p_container:first-child:last-child": "flex: none !important;", + //progress bar + ".sv_main .sv-progress": "background-color: $header-background-color;", + ".sv_main .sv-progress__bar": "background-color: $main-color;", + //progress buttons + ".sv_main .sv_progress-buttons__list li:before": "border-color: $progress-buttons-color; background-color: $progress-buttons-color;", + ".sv_main .sv_progress-buttons__list li:after": "background-color: $progress-buttons-line-color;", + ".sv_main .sv_progress-buttons__list .sv_progress-buttons__page-title": "color: $text-color;", + ".sv_main .sv_progress-buttons__list .sv_progress-buttons__page-description": "color: $text-color;", + ".sv_main .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed:before": "border-color: $main-color; background-color: $main-color;", + ".sv_main .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed + li:after": "background-color: $progress-buttons-color", + ".sv_main .sv_progress-buttons__list li.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", + ".sv_main .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", + //paneldynamic + ".sv_main .sv-paneldynamic__prev-btn.sv-paneldynamic__prev-btn--disabled, .sv_main .sv-paneldynamic__next-btn.sv-paneldynamic__next-btn--disabled": "fill: $disable-color;", + ".sv_main .sv-paneldynamic__progress-text": "color: $progress-text-color;", + ".sv_main .sv-paneldynamic__prev-btn, .sv_main .sv-paneldynamic__next-btn": "fill: $text-color", + //boolean + ".sv_main .sv-boolean__switch": "background-color: $main-color;", + ".sv_main .sv-boolean__slider": "background-color: $slider-color;", + ".sv_main .sv-boolean__label--disabled": "color: $disabled-label-color;", + ".sv_main .sv-boolean--disabled .sv-boolean__switch": "background-color: $disabled-switch-color;", + ".sv_main .sv-boolean--disabled .sv-boolean__slider": "background-color: $disabled-slider-color;", + //eo boolean + //signature pad + ".sv_main .sjs_sp_container": "border: 1px dashed $disable-color;", + ".sv_main .sjs_sp_placeholder": "color: $foreground-light;", + ".sv_main .sv_matrix_detail_row": "background-color: #ededed; border-top: 1px solid $header-background-color; border-bottom: 1px solid $header-background-color;", + ".sv_main .sv-action-bar-item": "color: $text-color;", + ".sv_main .sv-action-bar-item__icon use": "fill: $foreground-light;", + ".sv_main .sv-action-bar-item:hover": "background-color: $background-dim;", + ".sv-skeleton-element": "background-color: $background-dim;", + }; + StylesManager.bootstrapmaterialThemeCss = { + ".sv_main.sv_bootstrapmaterial_css .form-group.is-focused .form-control": "linear-gradient(0deg, $main-color 2px, $main-color 0),linear-gradient(0deg, #D2D2D2 1px, transparent 0);", + ".sv_main.sv_bootstrapmaterial_css .sv_qstn": "margin-bottom: 1rem;", + ".sv_main.sv_bootstrapmaterial_css .sv_qstn label.sv_q_m_label": "height: 100%;", + ".sv_main.sv_bootstrapmaterial_css .sv_q_image": "display: inline-block;", + ".sv_main .sv_row .sv_qstn:first-child:last-child": "flex: none !important;", + ".sv_main .sv_row .sv_p_container:first-child:last-child": "flex: none !important;", + ".sv_main.sv_bootstrapmaterial_css .checkbox input[type=checkbox]:checked + .checkbox-material .check": "border-color: $main-color;", + ".sv_main.sv_bootstrapmaterial_css label.checkbox-inline input[type=checkbox]:checked + .checkbox-material .check": "border-color: $main-color;", + ".sv_main.sv_bootstrapmaterial_css .checkbox input[type=checkbox]:checked + .checkbox-material .check:before": "color: $main-color;", + ".sv_main.sv_bootstrapmaterial_css label.checkbox-inline input[type=checkbox]:checked + .checkbox-material .check:before": "color: $main-color;", + ".sv_main.sv_bootstrapmaterial_css .radio input[type=radio]:checked ~ .circle": "border-color: $main-color;", + ".sv_main.sv_bootstrapmaterial_css label.radio-inline input[type=radio]:checked ~ .circle": "border-color: $main-color;", + ".sv_main.sv_bootstrapmaterial_css .radio input[type=radio]:checked ~ .check": "background-color: $main-color;", + ".sv_main.sv_bootstrapmaterial_css label.radio-inline input[type=radio]:checked ~ .check": "background-color: $main-color;", + ".sv_main.sv_bootstrapmaterial_css .btn-default.active": "background-color: $main-color; color: $body-background-color;", + ".sv_main.sv_bootstrapmaterial_css .btn-default:active": "background-color: $main-color; color: $body-background-color;", + ".sv_main.sv_bootstrapmaterial_css .btn-secondary.active": "background-color: $main-color; color: $body-background-color;", + ".sv_main.sv_bootstrapmaterial_css .btn-secondary:active": "background-color: $main-color; color: $body-background-color;", + ".sv_main.sv_bootstrapmaterial_css .open>.dropdown-toggle.btn-default": "background-color: $main-color; color: $body-background-color;", + ".sv_main.sv_bootstrapmaterial_css input[type='button'].btn-primary, .sv_main.sv_bootstrapmaterial_css button.btn-primary": "color: $body-background-color; background-color: $main-color;", + ".sv_main.sv_bootstrapmaterial_css input[type='button'].btn-primary:hover, .sv_main.sv_bootstrapmaterial_css button.btn-primary:hover": "background-color: $main-hover-color;", + ".sv_main .sv_q_imgsel.checked label>div": "background-color: $main-color;", + ".sv_main.sv_bootstrapmaterial_css .sv_q_file_remove:hover": "color: $main-color;", + ".sv_main.sv_bootstrapmaterial_css .form-group input[type=file]": "position: relative; opacity: 1;", + ".sv_main.sv_bootstrapmaterial_css .progress": "width: 60%; height: 1.5em;", + ".sv_main.sv_bootstrapmaterial_css .progress-bar": "width: auto; margin-left: 2px; margin-right: 2px;", + //progress bar + ".sv_main .sv-progress": "background-color: $header-background-color;", + ".sv_main .sv-progress__bar": "background-color: $main-color;", + //progress buttons + ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list li:before": "border-color: $progress-buttons-color; background-color: $progress-buttons-color;", + ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list li:after": "background-color: $progress-buttons-line-color;", + ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list .sv_progress-buttons__page-title": "color: $text-color;", + ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list .sv_progress-buttons__page-description": "color: $text-color;", + ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed:before": "border-color: $main-color; background-color: $main-color;", + ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed + li:after": "background-color: $progress-buttons-color", + ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", + ".sv_main.sv_bootstrapmaterial_css .sv_progress-buttons__list li.sv_progress-buttons__list-element--passed.sv_progress-buttons__list-element--current:before": "border-color: $main-color; background-color: white;", + //paneldynamic + ".sv_main .sv-paneldynamic__prev-btn.sv-paneldynamic__prev-btn--disabled, .sv_main .sv-paneldynamic__next-btn.sv-paneldynamic__next-btn--disabled": "fill: $disable-color;", + ".sv_main .sv-paneldynamic__progress-text": "color: $progress-text-color;", + ".sv_main .sv-paneldynamic__prev-btn, .sv_main .sv-paneldynamic__next-btn": "fill: $text-color", + //boolean + ".sv_main .sv-boolean .checkbox-decorator": "display: none;", + ".sv_main .sv-boolean__switch": "background-color: $main-color;", + ".sv_main .sv-boolean__slider": "background-color: $slider-color;", + ".sv_main .sv-boolean__label.sv-boolean__label--disabled": "color: $disabled-label-color;", + ".sv_main .sv-boolean__label": "color: $text-color;", + ".sv_main .sv-boolean--disabled .sv-boolean__switch": "background-color: $disabled-switch-color;", + ".sv_main .sv-boolean--disabled .sv-boolean__slider": "background-color: $disabled-slider-color;", + //eo boolean + ".sv_main .sv_matrix_detail_row": "background-color: #ededed; border-top: 1px solid $header-background-color; border-bottom: 1px solid $header-background-color;", + //signature pad + ".sv_main .sjs_sp_container": "border: 1px dashed $disable-color;", + ".sv_main .sjs_sp_placeholder": "color: $foreground-light;", + ".sv_main .sv-action-bar-item": "color: $text-color;", + ".sv_main .sv-action-bar-item__icon use": "fill: $foreground-light;", + ".sv_main .sv-action-bar-item:hover": "background-color: $background-dim;", + ".sv-skeleton-element": "background-color: $background-dim;", + }; + StylesManager.Enabled = true; + return StylesManager; + }()); + + + + /***/ }), + + /***/ "./src/survey-element.ts": + /*!*******************************!*\ + !*** ./src/survey-element.ts ***! + \*******************************/ + /*! exports provided: SurveyElementCore, DragTypeOverMeEnum, SurveyElement */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyElementCore", function() { return SurveyElementCore; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DragTypeOverMeEnum", function() { return DragTypeOverMeEnum; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyElement", function() { return SurveyElement; }); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _actions_adaptive_container__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions/adaptive-container */ "./src/actions/adaptive-container.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + /* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + + /** + * Base class of SurveyJS Elements and Survey. + */ + var SurveyElementCore = /** @class */ (function (_super) { + __extends(SurveyElementCore, _super); + function SurveyElementCore() { + var _this = _super.call(this) || this; + _this.createLocTitleProperty(); + return _this; + } + SurveyElementCore.prototype.createLocTitleProperty = function () { + return this.createLocalizableString("title", this, true); + }; + Object.defineProperty(SurveyElementCore.prototype, "title", { + /** + * Question, Panel, Page and Survey title. If page and panel is empty then they are not rendered. + * Question renders question name if the title is empty. Use survey questionTitleTemplate property to change the title question rendering. + * @see SurveyModel.questionTitleTemplate + */ + get: function () { + return this.getLocalizableStringText("title", this.getDefaultTitleValue()); + }, + set: function (val) { + this.setLocalizableStringText("title", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElementCore.prototype, "locTitle", { + get: function () { + return this.getLocalizableString("title"); + }, + enumerable: false, + configurable: true + }); + SurveyElementCore.prototype.getDefaultTitleValue = function () { return undefined; }; + SurveyElementCore.prototype.updateDescriptionVisibility = function (newDescription) { + this.hasDescription = !!newDescription; + }; + Object.defineProperty(SurveyElementCore.prototype, "locDescription", { + get: function () { + return this.getLocalizableString("description"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElementCore.prototype, "titleTagName", { + get: function () { + var titleTagName = this.getDefaultTitleTagName(); + var survey = this.getSurvey(); + return !!survey ? survey.getElementTitleTagName(this, titleTagName) : titleTagName; + }, + enumerable: false, + configurable: true + }); + SurveyElementCore.prototype.getDefaultTitleTagName = function () { + return _settings__WEBPACK_IMPORTED_MODULE_4__["settings"].titleTags[this.getType()]; + }; + Object.defineProperty(SurveyElementCore.prototype, "hasTitle", { + get: function () { return this.title.length > 0; }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElementCore.prototype, "hasTitleActions", { + get: function () { return false; }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElementCore.prototype, "hasTitleEvents", { + get: function () { + return this.hasTitleActions; + }, + enumerable: false, + configurable: true + }); + SurveyElementCore.prototype.getTitleToolbar = function () { return null; }; + SurveyElementCore.prototype.getTitleOwner = function () { return undefined; }; + Object.defineProperty(SurveyElementCore.prototype, "isTitleOwner", { + get: function () { return !!this.getTitleOwner(); }, + enumerable: false, + configurable: true + }); + SurveyElementCore.prototype.toggleState = function () { return undefined; }; + Object.defineProperty(SurveyElementCore.prototype, "cssClasses", { + get: function () { return {}; }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElementCore.prototype, "cssTitle", { + get: function () { return ""; }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElementCore.prototype, "ariaTitleId", { + get: function () { return undefined; }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElementCore.prototype, "titleTabIndex", { + get: function () { return undefined; }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElementCore.prototype, "titleAriaExpanded", { + get: function () { return undefined; }, + enumerable: false, + configurable: true + }); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])() + ], SurveyElementCore.prototype, "hasDescription", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ localizable: true, onSet: function (newDescription, self) { + self.updateDescriptionVisibility(self, newDescription); + } + }) + ], SurveyElementCore.prototype, "description", void 0); + return SurveyElementCore; + }(_base__WEBPACK_IMPORTED_MODULE_1__["Base"])); + + var DragTypeOverMeEnum; + (function (DragTypeOverMeEnum) { + DragTypeOverMeEnum[DragTypeOverMeEnum["InsideEmptyPanel"] = 1] = "InsideEmptyPanel"; + DragTypeOverMeEnum[DragTypeOverMeEnum["MultilineRight"] = 2] = "MultilineRight"; + DragTypeOverMeEnum[DragTypeOverMeEnum["MultilineLeft"] = 3] = "MultilineLeft"; + })(DragTypeOverMeEnum || (DragTypeOverMeEnum = {})); + /** + * Base class of SurveyJS Elements. + */ + var SurveyElement = /** @class */ (function (_super) { + __extends(SurveyElement, _super); + function SurveyElement(name) { + var _this = _super.call(this) || this; + _this.selectedElementInDesignValue = _this; + _this.disableDesignActions = SurveyElement.CreateDisabledDesignElements; + _this.isContentElement = false; + _this.isEditableTemplateElement = false; + _this.isInteractiveDesignElement = true; + _this.name = name; + _this.createNewArray("errors"); + _this.createNewArray("titleActions"); + _this.registerFunctionOnPropertyValueChanged("isReadOnly", function () { + _this.onReadOnlyChanged(); + }); + _this.registerFunctionOnPropertyValueChanged("errors", function () { + _this.updateVisibleErrors(); + }); + return _this; + } + SurveyElement.getProgressInfoByElements = function (children, isRequired) { + var info = _base__WEBPACK_IMPORTED_MODULE_1__["Base"].createProgressInfo(); + for (var i = 0; i < children.length; i++) { + if (!children[i].isVisible) + continue; + var childInfo = children[i].getProgressInfo(); + info.questionCount += childInfo.questionCount; + info.answeredQuestionCount += childInfo.answeredQuestionCount; + info.requiredQuestionCount += childInfo.requiredQuestionCount; + info.requiredAnsweredQuestionCount += + childInfo.requiredAnsweredQuestionCount; + } + if (isRequired && info.questionCount > 0) { + if (info.requiredQuestionCount == 0) + info.requiredQuestionCount = 1; + if (info.answeredQuestionCount > 0) + info.requiredAnsweredQuestionCount = 1; + } + return info; + }; + SurveyElement.ScrollElementToTop = function (elementId) { + if (!elementId || typeof document === "undefined") + return false; + var el = document.getElementById(elementId); + if (!el || !el.scrollIntoView) + return false; + var elemTop = el.getBoundingClientRect().top; + if (elemTop < 0) + el.scrollIntoView(); + return elemTop < 0; + }; + SurveyElement.GetFirstNonTextElement = function (elements, removeSpaces) { + if (removeSpaces === void 0) { removeSpaces = false; } + if (!elements || !elements.length || elements.length == 0) + return null; + if (removeSpaces) { + var tEl = elements[0]; + if (tEl.nodeName === "#text") + tEl.data = ""; + tEl = elements[elements.length - 1]; + if (tEl.nodeName === "#text") + tEl.data = ""; + } + for (var i = 0; i < elements.length; i++) { + if (elements[i].nodeName != "#text" && elements[i].nodeName != "#comment") + return elements[i]; + } + return null; + }; + SurveyElement.FocusElement = function (elementId) { + if (!elementId || typeof document === "undefined") + return false; + var res = SurveyElement.focusElementCore(elementId); + if (!res) { + setTimeout(function () { + SurveyElement.focusElementCore(elementId); + }, 10); + } + return res; + }; + SurveyElement.focusElementCore = function (elementId) { + var el = document.getElementById(elementId); + if (el) { + el.focus(); + return true; + } + return false; + }; + SurveyElement.prototype.onPropertyValueChanged = function (name, oldValue, newValue) { + _super.prototype.onPropertyValueChanged.call(this, name, oldValue, newValue); + if (name === "state") { + if (oldValue === "default" || newValue === "default") { + this.updateTitleActions(); + } + else { + this.updateElementCss(false); + } + if (this.stateChangedCallback) + this.stateChangedCallback(); + } + }; + SurveyElement.prototype.getSkeletonComponentNameCore = function () { + if (this.survey) { + return this.survey.getSkeletonComponentName(this); + } + return ""; + }; + Object.defineProperty(SurveyElement.prototype, "skeletonComponentName", { + get: function () { + return this.getSkeletonComponentNameCore(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "state", { + /** + * Set this property to "collapsed" to render only Panel title and expanded button and to "expanded" to render the collapsed button in the Panel caption + */ + get: function () { + return this.getPropertyValue("state"); + }, + set: function (val) { + this.setPropertyValue("state", val); + this.notifyStateChanged(); + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.notifyStateChanged = function () { + if (this.survey) { + this.survey.elementContentVisibilityChanged(this); + } + }; + Object.defineProperty(SurveyElement.prototype, "isCollapsed", { + /** + * Returns true if the Element is in the collapsed state + * @see state + * @see collapse + * @see isExpanded + */ + get: function () { + if (this.isDesignMode) + return; + return this.state === "collapsed"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "isExpanded", { + /** + * Returns true if the Element is in the expanded state + * @see state + * @see expand + * @see isCollapsed + */ + get: function () { + return this.state === "expanded"; + }, + enumerable: false, + configurable: true + }); + /** + * Collapse the Element + * @see state + */ + SurveyElement.prototype.collapse = function () { + if (this.isDesignMode) + return; + this.state = "collapsed"; + }; + /** + * Expand the Element + * @see state + */ + SurveyElement.prototype.expand = function () { + this.state = "expanded"; + }; + /** + * Toggle element's state + * @see state + */ + SurveyElement.prototype.toggleState = function () { + if (this.isCollapsed) { + this.expand(); + return true; + } + if (this.isExpanded) { + this.collapse(); + return false; + } + return true; + }; + Object.defineProperty(SurveyElement.prototype, "hasStateButton", { + get: function () { + return this.isExpanded || this.isCollapsed; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "shortcutText", { + get: function () { + return this.title || this.name; + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.getTitleToolbar = function () { + if (!this.titleToolbarValue) { + this.titleToolbarValue = this.createActionContainer(true); + this.titleToolbarValue.setItems(this.getTitleActions()); + } + return this.titleToolbarValue; + }; + SurveyElement.prototype.createActionContainer = function (allowAdaptiveActions) { + var actionContainer = allowAdaptiveActions ? new _actions_adaptive_container__WEBPACK_IMPORTED_MODULE_2__["AdaptiveActionContainer"]() : new _actions_container__WEBPACK_IMPORTED_MODULE_5__["ActionContainer"](); + if (this.survey && !!this.survey.getCss().actionBar) { + actionContainer.cssClasses = this.survey.getCss().actionBar; + } + return actionContainer; + }; + Object.defineProperty(SurveyElement.prototype, "titleActions", { + get: function () { + return this.getPropertyValue("titleActions"); + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.getTitleActions = function () { + if (!this.isTitleActionRequested) { + this.updateTitleActions(); + this.isTitleActionRequested = true; + } + return this.titleActions; + }; + SurveyElement.prototype.updateTitleActions = function () { + var actions = []; + if (!!this.survey) { + actions = this.survey.getUpdatedElementTitleActions(this, actions); + } + this.setPropertyValue("titleActions", actions); + }; + Object.defineProperty(SurveyElement.prototype, "hasTitleActions", { + get: function () { + return this.getTitleActions().length > 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "hasTitleEvents", { + get: function () { + return this.state !== undefined && this.state !== "default"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "titleTabIndex", { + get: function () { + return !this.isPage && this.state !== "default" ? 0 : undefined; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "titleAriaExpanded", { + get: function () { + if (this.isPage || this.state === "default") + return undefined; + return this.state === "expanded"; + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.setSurveyImpl = function (value, isLight) { + this.surveyImplValue = value; + if (!this.surveyImplValue) { + this.setSurveyCore(null); + } + else { + this.surveyDataValue = this.surveyImplValue.getSurveyData(); + this.setSurveyCore(this.surveyImplValue.getSurvey()); + this.textProcessorValue = this.surveyImplValue.getTextProcessor(); + this.onSetData(); + } + if (!!this.survey) { + this.clearCssClasses(); + } + }; + SurveyElement.prototype.canRunConditions = function () { + return _super.prototype.canRunConditions.call(this) && !!this.data; + }; + SurveyElement.prototype.getDataFilteredValues = function () { + return !!this.data ? this.data.getFilteredValues() : null; + }; + SurveyElement.prototype.getDataFilteredProperties = function () { + var props = !!this.data ? this.data.getFilteredProperties() : {}; + props.question = this; + return props; + }; + Object.defineProperty(SurveyElement.prototype, "surveyImpl", { + get: function () { + return this.surveyImplValue; + }, + enumerable: false, + configurable: true + }); + /* You shouldn't use this method ever */ + SurveyElement.prototype.__setData = function (data) { + if (_settings__WEBPACK_IMPORTED_MODULE_4__["settings"].supportCreatorV2) { + this.surveyDataValue = data; + } + }; + Object.defineProperty(SurveyElement.prototype, "data", { + get: function () { + return this.surveyDataValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "survey", { + /** + * Returns the survey object. + */ + get: function () { + return this.getSurvey(); + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.getSurvey = function (live) { + if (!!this.surveyValue) + return this.surveyValue; + if (!!this.surveyImplValue) { + this.setSurveyCore(this.surveyImplValue.getSurvey()); + } + return this.surveyValue; + }; + SurveyElement.prototype.setSurveyCore = function (value) { + this.surveyValue = value; + if (!!this.surveyChangedCallback) { + this.surveyChangedCallback(); + } + }; + Object.defineProperty(SurveyElement.prototype, "isInternal", { + get: function () { + return this.isContentElement; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "areInvisibleElementsShowing", { + get: function () { + return (!!this.survey && + this.survey.areInvisibleElementsShowing && + !this.isContentElement); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "isVisible", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "isReadOnly", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "readOnly", { + /** + * Set it to true to make an element question/panel/page readonly. + * Please note, this property is hidden for question without input, for example html question. + * @see enableIf + * @see isReadOnly + */ + get: function () { + return this.getPropertyValue("readOnly", false); + }, + set: function (val) { + if (this.readOnly == val) + return; + this.setPropertyValue("readOnly", val); + if (!this.isLoadingFromJson) { + this.setPropertyValue("isReadOnly", this.isReadOnly); + } + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.onReadOnlyChanged = function () { + if (!!this.readOnlyChangedCallback) { + this.readOnlyChangedCallback(); + } + }; + Object.defineProperty(SurveyElement.prototype, "css", { + get: function () { + return !!this.survey ? this.survey.getCss() : {}; + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.ensureCssClassesValue = function () { + if (!this.cssClassesValue) { + this.cssClassesValue = this.calcCssClasses(this.css); + this.updateElementCssCore(this.cssClassesValue); + } + }; + Object.defineProperty(SurveyElement.prototype, "cssClasses", { + /** + * Returns all css classes that used for rendering the question, panel or page. + * You can use survey.onUpdateQuestionCssClasses event to override css classes for a question, survey.onUpdatePanelCssClasses event for a panel and survey.onUpdatePageCssClasses for a page. + * @see SurveyModel.updateQuestionCssClasses + * @see SurveyModel.updatePanelCssClasses + * @see SurveyModel.updatePageCssClasses + */ + get: function () { + if (!this.survey) + return this.calcCssClasses(this.css); + this.ensureCssClassesValue(); + return this.cssClassesValue; + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.calcCssClasses = function (css) { return undefined; }; + SurveyElement.prototype.updateElementCssCore = function (cssClasses) { }; + Object.defineProperty(SurveyElement.prototype, "cssError", { + get: function () { return ""; }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.updateElementCss = function (reNew) { + this.clearCssClasses(); + }; + SurveyElement.prototype.clearCssClasses = function () { + this.cssClassesValue = undefined; + }; + SurveyElement.prototype.getIsLoadingFromJson = function () { + if (_super.prototype.getIsLoadingFromJson.call(this)) + return true; + return this.survey ? this.survey.isLoadingFromJson : false; + }; + Object.defineProperty(SurveyElement.prototype, "name", { + /** + * This is the identifier of a survey element - question or panel. + * @see valueName + */ + get: function () { + return this.getPropertyValue("name", ""); + }, + set: function (val) { + var oldValue = this.name; + this.setPropertyValue("name", this.getValidName(val)); + if (!this.isLoadingFromJson && !!oldValue) { + this.onNameChanged(oldValue); + } + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.getValidName = function (name) { + return name; + }; + SurveyElement.prototype.onNameChanged = function (oldValue) { }; + SurveyElement.prototype.updateBindingValue = function (valueName, value) { + if (!!this.data && + !this.isTwoValueEquals(value, this.data.getValue(valueName))) { + this.data.setValue(valueName, value, false); + } + }; + Object.defineProperty(SurveyElement.prototype, "errors", { + /** + * The list of errors. It is created by callig hasErrors functions + * @see hasErrors + */ + get: function () { + return this.getPropertyValue("errors"); + }, + set: function (val) { + this.setPropertyValue("errors", val); + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.updateVisibleErrors = function () { + var counter = 0; + for (var i = 0; i < this.errors.length; i++) { + if (this.errors[i].visible) + counter++; + } + this.hasVisibleErrors = counter > 0; + }; + Object.defineProperty(SurveyElement.prototype, "containsErrors", { + /** + * Returns true if a question or a container (panel/page) or their chidren have an error. + * The value can be out of date. hasErrors function should be called to get the correct value. + */ + get: function () { + return this.getPropertyValue("containsErrors", false); + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.updateContainsErrors = function () { + this.setPropertyValue("containsErrors", this.getContainsErrors()); + }; + SurveyElement.prototype.getContainsErrors = function () { + return this.errors.length > 0; + }; + SurveyElement.prototype.getElementsInDesign = function (includeHidden) { + return []; + }; + Object.defineProperty(SurveyElement.prototype, "selectedElementInDesign", { + get: function () { + return this.selectedElementInDesignValue; + }, + set: function (val) { + this.selectedElementInDesignValue = val; + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.updateCustomWidgets = function () { }; + SurveyElement.prototype.onSurveyLoad = function () { }; + SurveyElement.prototype.onFirstRendering = function () { + this.ensureCssClassesValue(); + }; + SurveyElement.prototype.endLoadingFromJson = function () { + _super.prototype.endLoadingFromJson.call(this); + if (!this.survey) { + this.onSurveyLoad(); + } + }; + SurveyElement.prototype.setVisibleIndex = function (index) { + return 0; + }; + Object.defineProperty(SurveyElement.prototype, "isPage", { + /** + * Returns true if it is a page. + */ + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "isPanel", { + /** + * Returns true if it is a panel. + */ + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "isQuestion", { + /** + * Returns true if it is a question. + */ + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.delete = function () { }; + /** + * Returns the current survey locale + * @see SurveyModel.locale + */ + SurveyElement.prototype.getLocale = function () { + return this.survey + ? this.survey.getLocale() + : this.locOwner + ? this.locOwner.getLocale() + : ""; + }; + SurveyElement.prototype.getMarkdownHtml = function (text, name) { + return this.survey + ? this.survey.getSurveyMarkdownHtml(this, text, name) + : this.locOwner + ? this.locOwner.getMarkdownHtml(text, name) + : null; + }; + SurveyElement.prototype.getRenderer = function (name) { + return this.survey && typeof this.survey.getRendererForString === "function" + ? this.survey.getRendererForString(this, name) + : this.locOwner && typeof this.locOwner.getRenderer === "function" + ? this.locOwner.getRenderer(name) + : null; + }; + SurveyElement.prototype.getRendererContext = function (locStr) { + return this.survey && typeof this.survey.getRendererContextForString === "function" + ? this.survey.getRendererContextForString(this, locStr) + : this.locOwner && typeof this.locOwner.getRendererContext === "function" + ? this.locOwner.getRendererContext(locStr) + : locStr; + }; + SurveyElement.prototype.getProcessedText = function (text) { + if (this.isLoadingFromJson) + return text; + if (this.textProcessor) + return this.textProcessor.processText(text, this.getUseDisplayValuesInTitle()); + if (this.locOwner) + return this.locOwner.getProcessedText(text); + return text; + }; + SurveyElement.prototype.getUseDisplayValuesInTitle = function () { return true; }; + SurveyElement.prototype.removeSelfFromList = function (list) { + if (!list || !Array.isArray(list)) + return; + var index = list.indexOf(this); + if (index > -1) { + list.splice(index, 1); + } + }; + Object.defineProperty(SurveyElement.prototype, "textProcessor", { + get: function () { + return this.textProcessorValue; + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.getProcessedHtml = function (html) { + if (!html || !this.textProcessor) + return html; + return this.textProcessor.processText(html, true); + }; + SurveyElement.prototype.onSetData = function () { }; + Object.defineProperty(SurveyElement.prototype, "parent", { + get: function () { + return this.getPropertyValue("parent", null); + }, + set: function (val) { + this.setPropertyValue("parent", val); + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.getPage = function (parent) { + while (parent && parent.parent) + parent = parent.parent; + if (parent && parent.getType() == "page") + return parent; + return null; + }; + SurveyElement.prototype.moveToBase = function (parent, container, insertBefore) { + if (insertBefore === void 0) { insertBefore = null; } + if (!container) + return false; + parent.removeElement(this); + var index = -1; + if (_helpers__WEBPACK_IMPORTED_MODULE_3__["Helpers"].isNumber(insertBefore)) { + index = parseInt(insertBefore); + } + if (index == -1 && !!insertBefore && !!insertBefore.getType) { + index = container.indexOf(insertBefore); + } + container.addElement(this, index); + return true; + }; + SurveyElement.prototype.setPage = function (parent, newPage) { + var oldPage = this.getPage(parent); + //fix for the creator v1: https://github.com/surveyjs/survey-creator/issues/1744 + if (typeof newPage === "string") { + var survey = this.getSurvey(); + survey.pages.forEach(function (page) { + if (newPage === page.name) + newPage = page; + }); + } + if (oldPage === newPage) + return; + if (parent) + parent.removeElement(this); + if (newPage) { + newPage.addElement(this, -1); + } + }; + SurveyElement.prototype.getSearchableLocKeys = function (keys) { + keys.push("title"); + keys.push("description"); + }; + Object.defineProperty(SurveyElement.prototype, "isDefaultV2Theme", { + get: function () { + return this.survey && this.survey.getCss().root == "sd-root-modern"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "isErrorsModeTooltip", { + get: function () { + return this.isDefaultV2Theme; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "hasParent", { + get: function () { + return (this.parent && !this.parent.isPage) || (this.parent === undefined); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "hasFrameV2", { + get: function () { + return !this.hasParent && this.isDefaultV2Theme && !this.isDesignMode; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "width", { + /** + * Use it to set the specific width to the survey element like css style (%, px, em etc). + */ + get: function () { + return this.getPropertyValue("width", ""); + }, + set: function (val) { + this.setPropertyValue("width", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "minWidth", { + /** + * Use it to set the specific minWidth constraint to the survey element like css style (%, px, em etc). + */ + get: function () { + return this.getPropertyValue("minWidth"); + }, + set: function (val) { + this.setPropertyValue("minWidth", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "maxWidth", { + /** + * Use it to set the specific maxWidth constraint to the survey element like css style (%, px, em etc). + */ + get: function () { + return this.getPropertyValue("maxWidth"); + }, + set: function (val) { + this.setPropertyValue("maxWidth", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "renderWidth", { + /** + * The rendered width of the question. + */ + get: function () { + return this.getPropertyValue("renderWidth", ""); + }, + set: function (val) { + this.setPropertyValue("renderWidth", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "indent", { + /** + * The left indent. Set this property to increase the survey element left indent. + */ + get: function () { + return this.getPropertyValue("indent"); + }, + set: function (val) { + this.setPropertyValue("indent", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "rightIndent", { + /** + * The right indent. Set it different from 0 to increase the right padding. + */ + get: function () { + return this.getPropertyValue("rightIndent", 0); + }, + set: function (val) { + this.setPropertyValue("rightIndent", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "paddingLeft", { + get: function () { + return this.getPropertyValue("paddingLeft", ""); + }, + set: function (val) { + this.setPropertyValue("paddingLeft", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "paddingRight", { + get: function () { + return this.getPropertyValue("paddingRight", ""); + }, + set: function (val) { + this.setPropertyValue("paddingRight", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "rootStyle", { + get: function () { + var style = {}; + if (this.allowRootStyle && this.renderWidth) { + style["width"] = this.renderWidth; + style["flexGrow"] = 1; + style["flexShrink"] = 1; + style["flexBasis"] = this.renderWidth; + style["minWidth"] = this.minWidth; + style["maxWidth"] = this.maxWidth; + } + return style; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyElement.prototype, "clickTitleFunction", { + get: function () { + var _this = this; + if (this.needClickTitleFunction()) { + return function () { + return _this.processTitleClick(); + }; + } + return undefined; + }, + enumerable: false, + configurable: true + }); + SurveyElement.prototype.needClickTitleFunction = function () { + return this.state !== "default"; + }; + SurveyElement.prototype.processTitleClick = function () { + if (this.state !== "default") { + this.toggleState(); + } + }; + SurveyElement.CreateDisabledDesignElements = false; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: null }) + ], SurveyElement.prototype, "dragTypeOverMe", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) + ], SurveyElement.prototype, "isDragMe", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])() + ], SurveyElement.prototype, "cssClassesValue", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: false }) + ], SurveyElement.prototype, "hasVisibleErrors", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_0__["property"])({ defaultValue: true }) + ], SurveyElement.prototype, "allowRootStyle", void 0); + return SurveyElement; + }(SurveyElementCore)); + + + + /***/ }), + + /***/ "./src/survey-error.ts": + /*!*****************************!*\ + !*** ./src/survey-error.ts ***! + \*****************************/ + /*! exports provided: SurveyError */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyError", function() { return SurveyError; }); + /* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts"); + + var SurveyError = /** @class */ (function () { + function SurveyError(text, errorOwner) { + if (text === void 0) { text = null; } + if (errorOwner === void 0) { errorOwner = null; } + this.text = text; + this.errorOwner = errorOwner; + this.visible = true; + } + SurveyError.prototype.equalsTo = function (error) { + if (!error || !error.getErrorType) + return false; + if (this.getErrorType() !== error.getErrorType()) + return false; + return this.text === error.text && this.visible === error.visible; + }; + Object.defineProperty(SurveyError.prototype, "locText", { + get: function () { + if (!this.locTextValue) { + this.locTextValue = new _localizablestring__WEBPACK_IMPORTED_MODULE_0__["LocalizableString"](this.errorOwner, true); + this.locTextValue.text = this.getText(); + } + return this.locTextValue; + }, + enumerable: false, + configurable: true + }); + SurveyError.prototype.getText = function () { + var res = this.text; + if (!res) + res = this.getDefaultText(); + if (!!this.errorOwner) { + res = this.errorOwner.getErrorCustomText(res, this); + } + return res; + }; + SurveyError.prototype.getErrorType = function () { + return "base"; + }; + SurveyError.prototype.getDefaultText = function () { + return ""; + }; + return SurveyError; + }()); + + + + /***/ }), + + /***/ "./src/survey.ts": + /*!***********************!*\ + !*** ./src/survey.ts ***! + \***********************/ + /*! exports provided: SurveyModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyModel", function() { return SurveyModel; }); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _survey_element__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./survey-element */ "./src/survey-element.ts"); + /* harmony import */ var _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./defaultCss/cssstandard */ "./src/defaultCss/cssstandard.ts"); + /* harmony import */ var _textPreProcessor__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./textPreProcessor */ "./src/textPreProcessor.ts"); + /* harmony import */ var _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./conditionProcessValue */ "./src/conditionProcessValue.ts"); + /* harmony import */ var _dxSurveyService__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./dxSurveyService */ "./src/dxSurveyService.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./error */ "./src/error.ts"); + /* harmony import */ var _localizablestring__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./localizablestring */ "./src/localizablestring.ts"); + /* harmony import */ var _stylesmanager__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./stylesmanager */ "./src/stylesmanager.ts"); + /* harmony import */ var _surveyTimerModel__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./surveyTimerModel */ "./src/surveyTimerModel.ts"); + /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + /* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./utils/utils */ "./src/utils/utils.ts"); + /* harmony import */ var _actions_action__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./actions/action */ "./src/actions/action.ts"); + /* harmony import */ var _actions_container__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./actions/container */ "./src/actions/container.ts"); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + + + + + + + + + + + + + + + + + /** + * The `Survey` object contains information about the survey, Pages, Questions, flow logic and etc. + */ + var SurveyModel = /** @class */ (function (_super) { + __extends(SurveyModel, _super); + //#endregion + function SurveyModel(jsonObj, renderedElement) { + if (jsonObj === void 0) { jsonObj = null; } + if (renderedElement === void 0) { renderedElement = null; } + var _this = _super.call(this) || this; + _this.valuesHash = {}; + _this.variablesHash = {}; + _this.localeValue = ""; + //#region Event declarations + /** + * The event is fired before the survey is completed and the `onComplete` event is fired. You can prevent the survey from completing by setting `options.allowComplete` to `false` + *
`sender` - the survey object that fires the event. + *
`options.allowComplete` - Specifies whether a user can complete a survey. Set this property to `false` to prevent the survey from completing. The default value is `true`. + *
`options.isCompleteOnTrigger` - returns true if the survey is completing on "complete" trigger. + * @see onComplete + */ + _this.onCompleting = _this.addEvent(); + /** + * The event is fired after a user clicks the 'Complete' button and finishes a survey. Use this event to send the survey data to your web server. + *
`sender` - the survey object that fires the event. + *
`options.showDataSaving(text)` - call this method to show that the survey is saving survey data on your server. The `text` is an optional parameter to show a custom message instead of default. + *
`options.showDataSavingError(text)` - call this method to show that an error occurred while saving the data on your server. If you want to show a custom error, use an optional `text` parameter. + *
`options.showDataSavingSuccess(text)` - call this method to show that the data was successfully saved on the server. + *
`options.showDataSavingClear` - call this method to hide the text about the saving progress. + *
`options.isCompleteOnTrigger` - returns true if the survey is completed on "complete" trigger. + * @see data + * @see clearInvisibleValues + * @see completeLastPage + * @see surveyPostId + */ + _this.onComplete = _this.addEvent(); + /** + * The event is fired before the survey is going to preview mode, state equals to `preview`. It happens when a user click on "Preview" button. It shows when "showPreviewBeforeComplete" proeprty equals to "showAllQuestions" or "showAnsweredQuestions". + * You can prevent showing it by setting allowShowPreview to `false`. + *
`sender` - the survey object that fires the event. + *
`options.allowShowPreview` - Specifies whether a user can see a preview. Set this property to `false` to prevent from showing the preview. The default value is `true`. + * @see showPreviewBeforeComplete + */ + _this.onShowingPreview = _this.addEvent(); + /** + * The event is fired after a user clicks the 'Complete' button. The event allows you to specify the URL opened after completing a survey. + * Specify the `navigateToUrl` property to make survey navigate to another url. + *
`sender` - the survey object that fires the event. + *
`options.url` - Specifies a URL opened after completing a survey. Set this property to an empty string to cancel the navigation and show the completed survey page. + * @see navigateToUrl + * @see navigateToUrlOnCondition + */ + _this.onNavigateToUrl = _this.addEvent(); + /** + * The event is fired after the survey changed it's state from "starting" to "running". The "starting" state means that survey shows the started page. + * The `firstPageIsStarted` property should be set to `true`, if you want to display a start page in your survey. In this case, an end user should click the "Start" button to start the survey. + * @see firstPageIsStarted + */ + _this.onStarted = _this.addEvent(); + /** + * The event is fired on clicking the 'Next' button if the `sendResultOnPageNext` is set to `true`. You can use it to save the intermediate results, for example, if your survey is large enough. + *
`sender` - the survey object that fires the event. + * @see sendResultOnPageNext + */ + _this.onPartialSend = _this.addEvent(); + /** + * The event is fired before the current page changes to another page. Typically it happens when a user click the 'Next' or 'Prev' buttons. + *
`sender` - the survey object that fires the event. + *
`option.oldCurrentPage` - the previous current/active page. + *
`option.newCurrentPage` - a new current/active page. + *
`option.allowChanging` - set it to `false` to disable the current page changing. It is `true` by default. + *
`option.isNextPage` - commonly means, that end-user press the next page button. In general, it means that options.newCurrentPage is the next page after options.oldCurrentPage + *
`option.isPrevPage` - commonly means, that end-user press the previous page button. In general, it means that options.newCurrentPage is the previous page before options.oldCurrentPage + * @see currentPage + * @see currentPageNo + * @see nextPage + * @see prevPage + * @see completeLastPage + * @see onCurrentPageChanged + **/ + _this.onCurrentPageChanging = _this.addEvent(); + /** + * The event is fired when the current page has been changed to another page. Typically it happens when a user click on 'Next' or 'Prev' buttons. + *
`sender` - the survey object that fires the event. + *
`option.oldCurrentPage` - a previous current/active page. + *
`option.newCurrentPage` - a new current/active page. + *
`option.isNextPage` - commonly means, that end-user press the next page button. In general, it means that options.newCurrentPage is the next page after options.oldCurrentPage + *
`option.isPrevPage` - commonly means, that end-user press the previous page button. In general, it means that options.newCurrentPage is the previous page before options.oldCurrentPage + * @see currentPage + * @see currentPageNo + * @see nextPage + * @see prevPage + * @see completeLastPage + * @see onCurrentPageChanging + */ + _this.onCurrentPageChanged = _this.addEvent(); + /** + * The event is fired before the question value (answer) is changed. It can be done via UI by a user or programmatically on calling the `setValue` method. + *
`sender` - the survey object that fires the event. + *
`options.name` - the value name that has being changed. + *
`options.question` - a question which `question.name` equals to the value name. If there are several questions with the same name, the first question is used. If there is no such questions, the `options.question` is null. + *
`options.oldValue` - an old, previous value. + *
`options.value` - a new value. You can change it. + * @see setValue + * @see onValueChanged + */ + _this.onValueChanging = _this.addEvent(); + /** + * The event is fired when the question value (i.e., answer) has been changed. The question value can be changed in UI (by a user) or programmatically (on calling `setValue` method). + * Use the `onDynamicPanelItemValueChanged` and `onMatrixCellValueChanged` events to handle changes in a question in the Panel Dynamic and a cell question in matrices. + *
`sender` - the survey object that fires the event. + *
`options.name` - the value name that has been changed. + *
`options.question` - a question which `question.name` equals to the value name. If there are several questions with the same name, the first question is used. If there is no such questions, the `options.question` is `null`. + *
`options.value` - a new value. + * @see setValue + * @see onValueChanging + * @see onDynamicPanelItemValueChanged + * @see onMatrixCellValueChanged + */ + _this.onValueChanged = _this.addEvent(); + /** + * The event is fired when setVariable function is called. It can be called on changing a calculated value. + *
`sender` - the survey object that fires the event. + *
`options.name` - the variable name that has been changed. + *
`options.value` - a new value. + * @see setVariable + * @see onValueChanged + * @see calculatedValues + */ + _this.onVariableChanged = _this.addEvent(); + /** + * The event is fired when a question visibility has been changed. + *
`sender` - the survey object that fires the event. + *
`options.question` - a question which visibility has been changed. + *
`options.name` - a question name. + *
`options.visible` - a question `visible` boolean value. + * @see Question.visibile + * @see Question.visibileIf + */ + _this.onVisibleChanged = _this.addEvent(); + /** + * The event is fired on changing a page visibility. + *
`sender` - the survey object that fires the event. + *
`options.page` - a page which visibility has been changed. + *
`options.visible` - a page `visible` boolean value. + * @see PageModel.visibile + * @see PageModel.visibileIf + */ + _this.onPageVisibleChanged = _this.addEvent(); + /** + * The event is fired on changing a panel visibility. + *
`sender` - the survey object that fires the event. + *
`options.panel` - a panel which visibility has been changed. + *
`options.visible` - a panel `visible` boolean value. + * @see PanelModel.visibile + * @see PanelModel.visibileIf + */ + _this.onPanelVisibleChanged = _this.addEvent(); + /** + * The event is fired on creating a new question. + * Unlike the onQuestionAdded event, this event calls for all question created in survey including inside: a page, panel, matrix cell, dynamic panel and multiple text. + * or inside a matrix cell or it can be a text question in multiple text items or inside a panel of a panel dynamic. + * You can use this event to set up properties to a question based on it's type for all questions, regardless where they are located, on the page or inside a matrix cell. + * Please note: If you want to use this event for questions loaded from JSON then you have to create survey with empty/null JSON parameter, assign the event and call survey.fromJSON(yourJSON) function. + *
`sender` - the survey object that fires the event. + *
`options.question` - a newly created question object. + * @see Question + * @see onQuestionAdded + */ + _this.onQuestionCreated = _this.addEvent(); + /** + * The event is fired on adding a new question into survey. + *
`sender` - the survey object that fires the event. + *
`options.question` - a newly added question object. + *
`options.name` - a question name. + *
`options.index` - an index of the question in the container (page or panel). + *
`options.parentPanel` - a container where a new question is located. It can be a page or panel. + *
`options.rootPanel` - typically, it is a page. + * @see Question + * @see onQuestionCreated + */ + _this.onQuestionAdded = _this.addEvent(); + /** + * The event is fired on removing a question from survey. + *
`sender` - the survey object that fires the event. + *
`options.question` - a removed question object. + *
`options.name` - a question name. + * @see Question + */ + _this.onQuestionRemoved = _this.addEvent(); + /** + * The event is fired on adding a panel into survey. + *
`sender` - the survey object that fires the event. + *
`options.panel` - a newly added panel object. + *
`options.name` - a panel name. + *
`options.index` - an index of the panel in the container (a page or panel). + *
`options.parentPanel` - a container (a page or panel) where a new panel is located. + *
`options.rootPanel` - a root container, typically it is a page. + * @see PanelModel + */ + _this.onPanelAdded = _this.addEvent(); + /** + * The event is fired on removing a panel from survey. + *
`sender` - the survey object that fires the event. + *
`options.panel` - a removed panel object. + *
`options.name` - a panel name. + * @see PanelModel + */ + _this.onPanelRemoved = _this.addEvent(); + /** + * The event is fired on adding a page into survey. + *
`sender` - the survey object that fires the event. + *
`options.page` - a newly added `panel` object. + * @see PanelModel + */ + _this.onPageAdded = _this.addEvent(); + /** + * The event is fired on validating value in a question. You can specify a custom error message using `options.error`. The survey blocks completing the survey or going to the next page when the error messages are displayed. + *
`sender` - the survey object that fires the event. + *
`options.question` - a validated question. + *
`options.name` - a question name. + *
`options.value` - the current question value (answer). + *
`options.error` - an error string. It is empty by default. + * @see onServerValidateQuestions + * @see onSettingQuestionErrors + */ + _this.onValidateQuestion = _this.addEvent(); + /** + * The event is fired before errors are assigned to a question. You may add/remove/modify errors for a question. + *
`sender` - the survey object that fires the event. + *
`options.question` - a validated question. + *
`options.errors` - the list of errors. The list is empty by default and remains empty if a validated question has no errors. + * @see onValidateQuestion + */ + _this.onSettingQuestionErrors = _this.addEvent(); + /** + * Use this event to validate data on your server. + *
`sender` - the survey object that fires the event. + *
`options.data` - the values of all non-empty questions on the current page. You can get a question value as `options.data["myQuestionName"]`. + *
`options.errors` - set your errors to this object as: `options.errors["myQuestionName"] = "Error text";`. It will be shown as a question error. + *
`options.complete()` - call this function to tell survey that your server callback has been processed. + * @see onValidateQuestion + * @see onValidatePanel + */ + _this.onServerValidateQuestions = _this.addEvent(); + /** + * Use this event to modify the HTML before rendering, for example HTML on a completed page. + *
`sender` - the survey object that fires the event. + *
`options.html` - an HTML that you may change before text processing and then rendering. + * @see completedHtml + * @see loadingHtml + * @see QuestionHtmlModel.html + */ + /** + * The event is fired on validating a panel. Set your error to `options.error` and survey will show the error for the panel and block completing the survey or going to the next page. + *
`sender` - the survey object that fires the event. + *
`options.name` - a panel name. + *
`options.error` - an error string. It is empty by default. + * @see onValidateQuestion + */ + _this.onValidatePanel = _this.addEvent(); + /** + * Use the event to change the default error text. + *
`sender` - the survey object that fires the event. + *
`options.text` - an error text. + *
`options.error` - an instance of the `SurveyError` object. + *
`options.obj` - an instance of Question, Panel or Survey object to where error is located. + *
`options.name` - the error name. The following error names are available: + * required, requireoneanswer, requirenumeric, exceedsize, webrequest, webrequestempty, otherempty, + * uploadingfile, requiredinallrowserror, minrowcounterror, keyduplicationerror, custom + */ + _this.onErrorCustomText = _this.addEvent(); + /** + * Use the this event to be notified when the survey finished validate questions on the current page. It commonly happens when a user try to go to the next page or complete the survey + * options.questions - the list of questions that have errors + * options.errors - the list of errors + * options.page - the page where question(s) are located + */ + _this.onValidatedErrorsOnCurrentPage = _this.addEvent(); + /** + * Use this event to modify the HTML content before rendering, for example `completeHtml` or `loadingHtml`. + * `options.html` - specifies the modified HTML content. + * @see completedHtml + * @see loadingHtml + */ + _this.onProcessHtml = _this.addEvent(); + /** + * Use this event to change the question title in code. If you want to remove question numbering then set showQuestionNumbers to "off". + *
`sender` - the survey object that fires the event. + *
`options.title` - a calculated question title, based on question `title`, `name`. + *
`options.question` - a question object. + * @see showQuestionNumbers + * @see requiredText + */ + _this.onGetQuestionTitle = _this.addEvent(); + /** + * Use this event to change the element title tag name that renders by default. + *
`sender` - the survey object that fires the event. + *
`options.element` - an element (question, panel, page and survey) that SurveyJS is going to render. + *
`options.tagName` - an element title tagName that are used to render a title. You can change it from the default value. + * @see showQuestionNumbers + * @see requiredText + */ + _this.onGetTitleTagName = _this.addEvent(); + /** + * Use this event to change the question no in code. If you want to remove question numbering then set showQuestionNumbers to "off". + *
`sender` - the survey object that fires the event. + *
`options.no` - a calculated question no, based on question `visibleIndex`, survey `.questionStartIndex` properties. You can change it. + *
`options.question` - a question object. + * @see showQuestionNumbers + * @see questionStartIndex + */ + _this.onGetQuestionNo = _this.addEvent(); + /** + * Use this event to change the progress text in code. + *
`sender` - the survey object that fires the event. + *
`options.text` - a progress text, that SurveyJS will render in progress bar. + *
`options.questionCount` - a number of questions that have input(s). We do not count html or expression questions + *
`options.answeredQuestionCount` - a number of questions that have input(s) and an user has answered. + *
`options.requiredQuestionCount` - a number of required questions that have input(s). We do not count html or expression questions + *
`options.requiredAnsweredQuestionCount` - a number of required questions that have input(s) and an user has answered. + * @see progressBarType + */ + _this.onProgressText = _this.addEvent(); + /** + * Use this event to process the markdown text. + *
`sender` - the survey object that fires the event. + *
`options.element` - SurveyJS element (a question, panel, page, or survey) where the string is going to be rendered. + *
`options.name` - a property name is going to be rendered. + *
`options.text` - a text that is going to be rendered. + *
`options.html` - an HTML content. It is `null` by default. Use this property to specify the HTML content rendered instead of `options.text`. + */ + _this.onTextMarkdown = _this.addEvent(); + /** + * Use this event to specity render component name used for text rendering. + *
`sender` - the survey object that fires the event. + *
`options.element` - SurveyJS element (a question, panel, page, or survey) where the string is going to be rendered. + *
`options.name` - a property name is going to be rendered. + *
`options.renderAs` - a component name used for text rendering. + */ + _this.onTextRenderAs = _this.addEvent(); + /** + * The event fires when it gets response from the [api.surveyjs.io](https://api.surveyjs.io) service on saving survey results. Use it to find out if the results have been saved successfully. + *
`sender` - the survey object that fires the event. + *
`options.success` - it is `true` if the results has been sent to the service successfully. + *
`options.response` - a response from the service. + */ + _this.onSendResult = _this.addEvent(); + /** + * Use it to get results after calling the `getResult` method. It returns a simple analytics from [api.surveyjs.io](https://api.surveyjs.io) service. + *
`sender` - the survey object that fires the event. + *
`options.success` - it is `true` if the results were got from the service successfully. + *
`options.data` - the object `{AnswersCount, QuestionResult : {} }`. `AnswersCount` is the number of posted survey results. `QuestionResult` is an object with all possible unique answers to the question and number of these answers. + *
`options.dataList` - an array of objects `{name, value}`, where `name` is a unique value/answer to the question and `value` is a number/count of such answers. + *
`options.response` - the server response. + * @see getResult + */ + _this.onGetResult = _this.addEvent(); + /** + * The event is fired on uploading the file in QuestionFile when `storeDataAsText` is set to `false`. Use this event to change the uploaded file name or to prevent a particular file from being uploaded. + *
`sender` - the survey object that fires the event. + *
`options.question` - the file question instance. + *
`options.name` - the question name. + *
`options.files` - the Javascript File objects array to upload. + *
`options.callback` - a callback function to get the file upload status and the updloaded file content. + * @see uploadFiles + * @see QuestionFileModel.storeDataAsText + * @see onDownloadFile + * @see onClearFiles + * @see [View Examples](https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fsurveyjs.io%2FExamples%2F+%22onUploadFiles%22) + */ + _this.onUploadFiles = _this.addEvent(); + /** + * The event is fired on downloading a file in QuestionFile. Use this event to pass the file to a preview. + *
`sender` - the survey object that fires the event. + *
`options.name` - the question name. + *
`options.content` - the file content. + *
`options.fileValue` - single file question value. + *
`options.callback` - a callback function to get the file downloading status and the downloaded file content. + * @see downloadFile + * @see onClearFiles + * @see onUploadFiles + * @see [View Examples](https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fsurveyjs.io%2FExamples%2F+%22onDownloadFile%22) + */ + _this.onDownloadFile = _this.addEvent(); + /** + * This event is fired on clearing the value in a QuestionFile. Use this event to remove files stored on your server. + *
`sender` - the survey object that fires the event. + *
`question` - the question instance. + *
`options.name` - the question name. + *
`options.value` - the question value. + *
`options.fileName` - a removed file's name, set it to `null` to clear all files. + *
`options.callback` - a callback function to get the operation status. + * @see clearFiles + * @see onDownloadFile + * @see onUploadFiles + * @see [View Examples](https://www.google.com/search?q=site%3Ahttps%3A%2F%2Fsurveyjs.io%2FExamples%2F+%22onClearFiles%22) + */ + _this.onClearFiles = _this.addEvent(); + /** + * The event is fired after choices for radiogroup, checkbox, and dropdown has been loaded from a RESTful service and before they are assigned to a question. + * You may change the choices, before they are assigned or disable/enabled make visible/invisible question, based on loaded results. + *
`sender` - the survey object that fires the event. + *
`question` - the question where loaded choices are going to be assigned. + *
`choices` - the loaded choices. You can change the loaded choices to before they are assigned to question. + *
`serverResult` - a result that comes from the server as it is. + */ + _this.onLoadChoicesFromServer = _this.addEvent(); + /** + * The event is fired after survey is loaded from api.surveyjs.io service. + * You can use this event to perform manipulation with the survey model after it was loaded from the web service. + *
`sender` - the survey object that fires the event. + * @see surveyId + * @see loadSurveyFromService + */ + _this.onLoadedSurveyFromService = _this.addEvent(); + /** + * The event is fired on processing the text when it finds a text in brackets: `{somevalue}`. By default, it uses the value of survey question values and variables. + * For example, you may use the text processing in loading choices from the web. If your `choicesByUrl.url` equals to "UrlToServiceToGetAllCities/{country}/{state}", + * you may set on this event `options.value` to "all" or empty string when the "state" value/question is non selected by a user. + *
`sender` - the survey object that fires the event. + *
`options.name` - the name of the processing value, for example, "state" in our example. + *
`options.value` - the value of the processing text. + *
`options.isExists` - a boolean value. Set it to `true` if you want to use the value and set it to `false` if you don't. + */ + _this.onProcessTextValue = _this.addEvent(); + /** + * The event is fired before rendering a question. Use it to override the default question CSS classes. + *
`sender` - the survey object that fires the event. + *
`options.question` - a question for which you can change the CSS classes. + *
`options.cssClasses` - an object with CSS classes. For example `{root: "table", button: "button"}`. You can change them to your own CSS classes. + */ + _this.onUpdateQuestionCssClasses = _this.addEvent(); + /** + * The event is fired before rendering a panel. Use it to override the default panel CSS classes. + *
`sender` - the survey object that fires the event. + *
`options.panel` - a panel for which you can change the CSS classes. + *
`options.cssClasses` - an object with CSS classes. For example `{title: "sv_p_title", description: "small"}`. You can change them to your own CSS classes. + */ + _this.onUpdatePanelCssClasses = _this.addEvent(); + /** + * The event is fired before rendering a page. Use it to override the default page CSS classes. + *
`sender` - the survey object that fires the event. + *
`options.page` - a page for which you can change the CSS classes. + *
`options.cssClasses` - an object with CSS classes. For example `{title: "sv_p_title", description: "small"}`. You can change them to your own CSS classes. + */ + _this.onUpdatePageCssClasses = _this.addEvent(); + /** + * The event is fired before rendering a choice item in radiogroup, checkbox or dropdown questions. Use it to override the default choice item css. + *
`sender` - the survey object that fires the event. + *
`options.question` - a question where choice item is rendered. + *
`options.item` - a choice item of ItemValue type. You can get value or text choice properties as options.item.value or options.choice.text + *
`options.css` - a string with css classes divided by space. You can change it. + */ + _this.onUpdateChoiceItemCss = _this.addEvent(); + /** + * The event is fired right after survey is rendered in DOM. + *
`sender` - the survey object that fires the event. + *
`options.htmlElement` - a root HTML element bound to the survey object. + */ + _this.onAfterRenderSurvey = _this.addEvent(); + /** + * The event is fired right after a page is rendered in DOM. Use it to modify HTML elements. + *
`sender` - the survey object that fires the event. + *
`options.htmlElement` - an HTML element bound to the survey header object. + */ + _this.onAfterRenderHeader = _this.addEvent(); + /** + * The event is fired right after a page is rendered in DOM. Use it to modify HTML elements. + *
`sender` - the survey object that fires the event. + *
`options.page` - a page object for which the event is fired. Typically the current/active page. + *
`options.htmlElement` - an HTML element bound to the page object. + */ + _this.onAfterRenderPage = _this.addEvent(); + /** + * The event is fired right after a question is rendered in DOM. Use it to modify HTML elements. + *
`sender` - the survey object that fires the event. + *
`options.question` - a question object for which the event is fired. + *
`options.htmlElement` - an HTML element bound to the question object. + */ + _this.onAfterRenderQuestion = _this.addEvent(); + /** + * The event is fired right after a non-composite question (text, comment, dropdown, radiogroup, checkbox) is rendered in DOM. Use it to modify HTML elements. + * This event is not fired for matrices, panels, multiple text and image picker. + *
`sender` - the survey object that fires the event. + *
`options.question` - a question object for which the event is fired. + *
`options.htmlElement` - an HTML element bound to the question object. + */ + _this.onAfterRenderQuestionInput = _this.addEvent(); + /** + * The event is fired right after a panel is rendered in DOM. Use it to modify HTML elements. + *
`sender` - the survey object that fires the event + *
`options.panel` - a panel object for which the event is fired + *
`options.htmlElement` - an HTML element bound to the panel object + */ + _this.onAfterRenderPanel = _this.addEvent(); + /** + * The event occurs when an element within a question gets focus. + *
`sender` - A [survey](https://surveyjs.io/Documentation/Library?id=surveymodel) object that fires the event. + *
`options.question` - A [question](https://surveyjs.io/Documentation/Library?id=Question) whose child element gets focus. + * @see onFocusInPanel + */ + _this.onFocusInQuestion = _this.addEvent(); + /** + * The event occurs when an element within a panel gets focus. + *
`sender` - A [survey](https://surveyjs.io/Documentation/Library?id=surveymodel) object that fires the event. + *
`options.panel` - A [panel](https://surveyjs.io/Documentation/Library?id=PanelModelBase) whose child element gets focus. + * @see onFocusInQuestion + */ + _this.onFocusInPanel = _this.addEvent(); + /** + * Use this event to change the visibility of an individual choice item in [Checkbox](https://surveyjs.io/Documentation/Library?id=questioncheckboxmodel), [Dropdown](https://surveyjs.io/Documentation/Library?id=questiondropdownmodel), [Radiogroup](https://surveyjs.io/Documentation/Library?id=questionradiogroupmodel), and other similar question types. + * + * The event handler accepts the following arguments: + * + * - `sender` - A Survey instance that raised the event. + * - `options.question` - A Question instance to which the choice item belongs. + * - `options.item` - The choice item as specified in the [choices](https://surveyjs.io/Documentation/Library?id=QuestionSelectBase#choices) array. + * - `options.visible` - A Boolean value that specifies the item visibility. Set it to `false` to hide the item. + */ + _this.onShowingChoiceItem = _this.addEvent(); + /** + * The event is fired on adding a new row in Matrix Dynamic question. + *
`sender` - the survey object that fires the event + *
`options.question` - a matrix question. + *
`options.row` - a new added row. + * @see QuestionMatrixDynamicModel + * @see QuestionMatrixDynamicModel.visibleRows + */ + _this.onMatrixRowAdded = _this.addEvent(); + /** + * The event is fired before adding a new row in Matrix Dynamic question. + *
`sender` - the survey object that fires the event + *
`options.question` - a matrix question. + *
`options.canAddRow` - specifies whether a new row can be added + * @see QuestionMatrixDynamicModel + * @see QuestionMatrixDynamicModel.visibleRows + */ + _this.onMatrixBeforeRowAdded = _this.addEvent(); + /** + * The event is fired before removing a row from Matrix Dynamic question. You can disable removing and clear the data instead. + *
`sender` - the survey object that fires the event + *
`options.question` - a matrix question. + *
`options.rowIndex` - a row index. + *
`options.row` - a row object. + *
`options.allow` - a boolean property. Set it to `false` to disable the row removing. + * @see QuestionMatrixDynamicModel + * @see onMatrixRowRemoved + * @see onMatrixAllowRemoveRow + */ + _this.onMatrixRowRemoving = _this.addEvent(); + /** + * The event is fired on removing a row from Matrix Dynamic question. + *
`sender` - the survey object that fires the event + *
`options.question` - a matrix question + *
`options.rowIndex` - a removed row index + *
`options.row` - a removed row object + * @see QuestionMatrixDynamicModel + * @see QuestionMatrixDynamicModel.visibleRows + * @see onMatrixRowRemoving + * @see onMatrixAllowRemoveRow + */ + _this.onMatrixRowRemoved = _this.addEvent(); + /** + * The event is fired before rendering "Remove" button for removing a row from Matrix Dynamic question. + *
`sender` - the survey object that fires the event + *
`options.question` - a matrix question. + *
`options.rowIndex` - a row index. + *
`options.row` - a row object. + *
`options.allow` - a boolean property. Set it to `false` to disable the row removing. + * @see QuestionMatrixDynamicModel + * @see onMatrixRowRemoving + * @see onMatrixRowRemoved + */ + _this.onMatrixAllowRemoveRow = _this.addEvent(); + /** + * The event is fired before creating cell question in the matrix. You can change the cell question type by setting different options.cellType. + *
`sender` - the survey object that fires the event. + *
`options.question` - the matrix question. + *
`options.cellType` - the cell question type. You can change it. + *
`options.rowValue` - the value of the current row. To access a particular column's value within the current row, use: `options.rowValue["columnValue"]`. + *
`options.column` - the matrix column object. + *
`options.columnName` - the matrix column name. + *
`options.row` - the matrix row object. + * @see onMatrixBeforeRowAdded + * @see onMatrixCellCreated + * @see QuestionMatrixDynamicModel + * @see QuestionMatrixDropdownModel + */ + _this.onMatrixCellCreating = _this.addEvent(); + /** + * The event is fired for every cell created in Matrix Dynamic and Matrix Dropdown questions. + *
`sender` - the survey object that fires the event. + *
`options.question` - the matrix question. + *
`options.cell` - the matrix cell. + *
`options.cellQuestion` - the question/editor in the cell. You may customize it, change it's properties, like choices or visible. + *
`options.rowValue` - the value of the current row. To access a particular column's value within the current row, use: `options.rowValue["columnValue"]`. + *
`options.column` - the matrix column object. + *
`options.columnName` - the matrix column name. + *
`options.row` - the matrix row object. + * @see onMatrixBeforeRowAdded + * @see onMatrixCellCreating + * @see onMatrixRowAdded + * @see QuestionMatrixDynamicModel + * @see QuestionMatrixDropdownModel + */ + _this.onMatrixCellCreated = _this.addEvent(); + /** + * The event is fired for every cell after is has been rendered in DOM. + *
`sender` - the survey object that fires the event. + *
`options.question` - the matrix question. + *
`options.cell` - the matrix cell. + *
`options.cellQuestion` - the question/editor in the cell. + *
`options.htmlElement` - an HTML element bound to the `cellQuestion` object. + *
`options.column` - the matrix column object. + *
`options.row` - the matrix row object. + * @see onMatrixCellCreated + * @see QuestionMatrixDynamicModel + * @see QuestionMatrixDropdownModel + */ + _this.onMatrixAfterCellRender = _this.addEvent(); + /** + * The event is fired when cell value is changed in Matrix Dynamic and Matrix Dropdown questions. + *
`sender` - the survey object that fires the event. + *
`options.question` - the matrix question. + *
`options.columnName` - the matrix column name. + *
`options.value` - a new value. + *
`options.row` - the matrix row object. + *
`options.getCellQuestion(columnName)` - the function that returns the cell question by column name. + * @see onMatrixCellValueChanging + * @see onMatrixBeforeRowAdded + * @see onMatrixRowAdded + * @see QuestionMatrixDynamicModel + * @see QuestionMatrixDropdownModel + */ + _this.onMatrixCellValueChanged = _this.addEvent(); + /** + * The event is fired on changing cell value in Matrix Dynamic and Matrix Dropdown questions. You may change the `options.value` property to change a cell value. + *
`sender` - the survey object that fires the event. + *
`options.question` - the matrix question. + *
`options.columnName` - the matrix column name. + *
`options.value` - a new value. + *
`options.oldValue` - the old value. + *
`options.row` - the matrix row object. + *
`options.getCellQuestion(columnName)` - the function that returns a cell question by column name. + * @see onMatrixCellValueChanged + * @see onMatrixBeforeRowAdded + * @see onMatrixRowAdded + * @see QuestionMatrixDynamicModel + * @see QuestionMatrixDropdownModel + */ + _this.onMatrixCellValueChanging = _this.addEvent(); + /** + * The event is fired when Matrix Dynamic and Matrix Dropdown questions validate the cell value. + *
`sender` - the survey object that fires the event. + *
`options.error` - an error string. It is empty by default. + *
`options.question` - the matrix question. + *
`options.columnName` - the matrix column name. + *
`options.value` - a cell value. + *
`options.row` - the matrix row object. + *
`options.getCellQuestion(columnName)` - the function that returns the cell question by column name. + * @see onMatrixBeforeRowAdded + * @see onMatrixRowAdded + * @see QuestionMatrixDynamicModel + * @see QuestionMatrixDropdownModel + */ + _this.onMatrixCellValidate = _this.addEvent(); + /** + * The event is fired on adding a new panel in Panel Dynamic question. + *
`sender` - the survey object that fires the event. + *
`options.question` - a panel question. + *
`options.panel` - an added panel. + * @see QuestionPanelDynamicModel + * @see QuestionPanelDynamicModel.panels + */ + _this.onDynamicPanelAdded = _this.addEvent(); + /** + * The event is fired on removing a panel from Panel Dynamic question. + *
`sender` - the survey object that fires the event. + *
`options.question` - a panel question. + *
`options.panelIndex` - a removed panel index. + *
`options.panel` - a removed panel. + * @see QuestionPanelDynamicModel + * @see QuestionPanelDynamicModel.panels + */ + _this.onDynamicPanelRemoved = _this.addEvent(); + /** + * The event is fired every second if the method `startTimer` has been called. + * @see startTimer + * @see timeSpent + * @see Page.timeSpent + */ + _this.onTimer = _this.addEvent(); + /** + * The event is fired before displaying a new information in the Timer Panel. Use it to change the default text. + *
`sender` - the survey object that fires the event. + *
`options.text` - the timer panel info text. + */ + _this.onTimerPanelInfoText = _this.addEvent(); + /** + * The event is fired when item value is changed in Panel Dynamic question. + *
`sender` - the survey object that fires the event. + *
`options.question` - the panel question. + *
`options.panel` - the dynamic panel item. + *
`options.name` - the item name. + *
`options.value` - a new value. + *
`options.itemIndex` - the panel item index. + *
`options.itemValue` - the panel item object. + * @see onDynamicPanelAdded + * @see QuestionPanelDynamicModel + */ + _this.onDynamicPanelItemValueChanged = _this.addEvent(); + /** + * Use this event to define, whether an answer to a question is correct or not. + *
`sender` - the survey object that fires the event. + *
`options.question` - a question on which you have to decide if the answer is correct or not. + *
`options.result` - returns `true`, if an answer is correct, or `false`, if the answer is not correct. Use questions' `value` and `correctAnswer` properties to return the correct value. + *
`options.correctAnswers` - you may change the default number of correct or incorrect answers in the question, for example for matrix, where each row is a quiz question. + * @see Question.value + * @see Question.correctAnswer + */ + _this.onIsAnswerCorrect = _this.addEvent(); + /** + * Use this event to control drag&drop operations during design mode. + *
`sender` - the survey object that fires the event. + *
`options.allow` - set it to `false` to disable dragging. + *
`options.target` - a target element that is dragged. + *
`options.source` - a source element. It can be `null`, if it is a new element, dragging from toolbox. + *
`options.parent` - a page or panel where target element is dragging. + *
`options.insertBefore` - an element before the target element is dragging. It can be `null` if parent container (page or panel) is empty or dragging an element after the last element in a container. + *
`options.insertAfter` - an element after the target element is dragging. It can be `null` if parent container (page or panel) is empty or dragging element to the first position within the parent container. + * @see setDesignMode + * @see isDesignMode + */ + _this.onDragDropAllow = _this.addEvent(); + /** + * Use this event to control scrolling element to top. You can cancel the default behavior by setting options.cancel property to true. + *
`sender` - the survey object that fires the event. + *
`options.element` - an element that is going to be scrolled on top. + *
`options.question` - a question that is going to be scrolled on top. It can be null if options.page is not null. + *
`options.page` - a page that is going to be scrolled on top. It can be null if options.question is not null. + *
`options.elementId` - the unique element DOM Id. + *
`options.cancel` - set this property to true to cancel the default scrolling. + */ + _this.onScrollingElementToTop = _this.addEvent(); + _this.onLocaleChangedEvent = _this.addEvent(); + /** + * Use this event to create/customize actions to be displayed in a question's title. + *
`sender` - A [Survey](https://surveyjs.io/Documentation/Library?id=SurveyModel) object that fires the event. + *
`options.question` - A [Question](https://surveyjs.io/Documentation/Library?id=Question) object for which the event is fired. + *
`options.titleActions` - A list of actions ([IAction](https://surveyjs.io/Documentation/Library?id=IAction) objects) associated with the processed question. + * @see IAction + * @see Question + */ + _this.onGetQuestionTitleActions = _this.addEvent(); + /** + * Use this event to create/customize actions to be displayed in a panel's title. + *
`sender` - A survey object that fires the event. + *
`options.panel` - A panel ([PanelModel](https://surveyjs.io/Documentation/Library?id=panelmodel) object) for which the event is fired. + *
`options.titleActions` - A list of actions ([IAction](https://surveyjs.io/Documentation/Library?id=IAction) objects) associated with the processed panel. + * @see IAction + * @see PanelModel + */ + _this.onGetPanelTitleActions = _this.addEvent(); + /** + * Use this event to create/customize actions to be displayed in a page's title. + *
`sender` - A survey object that fires the event. + *
`options.page` - A page ([PageModel](https://surveyjs.io/Documentation/Library?id=pagemodel) object) for which the event is fired. + *
`options.titleActions` - A list of actions ([IAction](https://surveyjs.io/Documentation/Library?id=IAction) objects) associated with the processed page. + * @see IAction + * @see PageModel + */ + _this.onGetPageTitleActions = _this.addEvent(); + /** + * Use this event to create/customize actions to be displayed in a matrix question's row. + *
`sender` - A survey object that fires the event. + *
`options.question` - A matrix question ([QuestionMatrixBaseModel](https://surveyjs.io/Documentation/Library?id=questionmatrixbasemodel) object) for which the event is fired. + *
`options.row` - A matrix row for which the event is fired. + *
`options.actions` - A list of actions ([IAction](https://surveyjs.io/Documentation/Library?id=IAction) objects) associated with the processed matrix question and row. + * @see IAction + * @see QuestionMatrixDropdownModelBase + */ + _this.onGetMatrixRowActions = _this.addEvent(); + /** + * The event is fired after the survey element content was collapsed or expanded. + *
`sender` - the survey object that fires the event. + *
`options.element` - Specifies which survey element content was collapsed or expanded. + * @see onElementContentVisibilityChanged + */ + _this.onElementContentVisibilityChanged = _this.addEvent(); + /** + * The event is fired before expression question convert it's value into display value for rendering. + *
`sender` - the survey object that fires the event. + *
`options.question` - The expression question. + *
`options.value` - The question value. + *
`options.displayValue` - the display value that you can change before rendering. + */ + _this.onGetExpressionDisplayValue = _this.addEvent(); + /** + * The list of errors on loading survey JSON. If the list is empty after loading a JSON, then the JSON is correct and has no errors. + * @see JsonError + */ + _this.jsonErrors = null; + _this.cssValue = null; + /** + * Gets or sets whether to hide all required errors. + */ + _this.hideRequiredErrors = false; + //#endregion + _this._isMobile = false; + _this._isDesignMode = false; + /** + * Gets or sets whether the survey must ignore validation like required questions and others, on `nextPage` and `completeLastPage` function calls. The default is `false`. + * @see nextPage + * @see completeLastPage + * @see mode + */ + _this.ignoreValidation = false; + _this.isNavigationButtonPressed = false; + _this.mouseDownPage = null; + _this.isCalculatingProgressText = false; + _this.isFirstPageRendering = true; + _this.isCurrentPageRendering = true; + _this.isTriggerIsRunning = false; + _this.triggerValues = null; + _this.triggerKeys = null; + _this.conditionValues = null; + _this.isValueChangedOnRunningCondition = false; + _this.conditionRunnerCounter = 0; + _this.conditionUpdateVisibleIndexes = false; + _this.conditionNotifyElementsOnAnyValueOrVariableChanged = false; + _this.isEndLoadingFromJson = null; + _this.questionHashes = { + names: {}, + namesInsensitive: {}, + valueNames: {}, + valueNamesInsensitive: {}, + }; + _this.needRenderIcons = true; + _this.skeletonComponentName = "sv-skeleton"; + if (typeof document !== "undefined") { + SurveyModel.stylesManager = new _stylesmanager__WEBPACK_IMPORTED_MODULE_11__["StylesManager"](); + } + var htmlCallBack = function (str) { return "

" + str + "

"; }; + _this.createHtmlLocString("completedHtml", "completingSurvey", htmlCallBack); + _this.createHtmlLocString("completedBeforeHtml", "completingSurveyBefore", htmlCallBack); + _this.createHtmlLocString("loadingHtml", "loadingSurvey", htmlCallBack); + _this.createLocalizableString("logo", _this, false); + _this.createLocalizableString("startSurveyText", _this, false, true); + _this.createLocalizableString("pagePrevText", _this, false, true); + _this.createLocalizableString("pageNextText", _this, false, true); + _this.createLocalizableString("completeText", _this, false, true); + _this.createLocalizableString("previewText", _this, false, true); + _this.createLocalizableString("editText", _this, false, true); + _this.createLocalizableString("questionTitleTemplate", _this, true); + _this.textPreProcessor = new _textPreProcessor__WEBPACK_IMPORTED_MODULE_5__["TextPreProcessor"](); + _this.textPreProcessor.onProcess = function (textValue) { + _this.getProcessedTextValue(textValue); + }; + _this.timerModelValue = new _surveyTimerModel__WEBPACK_IMPORTED_MODULE_12__["SurveyTimerModel"](_this); + _this.timerModelValue.onTimer = function (page) { + _this.doTimer(page); + }; + _this.createNewArray("pages", function (value) { + _this.doOnPageAdded(value); + }, function (value) { + _this.doOnPageRemoved(value); + }); + _this.createNewArray("triggers", function (value) { + value.setOwner(_this); + }); + _this.createNewArray("calculatedValues", function (value) { + value.setOwner(_this); + }); + _this.createNewArray("completedHtmlOnCondition", function (value) { + value.locOwner = _this; + }); + _this.createNewArray("navigateToUrlOnCondition", function (value) { + value.locOwner = _this; + }); + _this.registerFunctionOnPropertyValueChanged("firstPageIsStarted", function () { + _this.onFirstPageIsStartedChanged(); + }); + _this.registerFunctionOnPropertyValueChanged("mode", function () { + _this.onModeChanged(); + }); + _this.registerFunctionOnPropertyValueChanged("progressBarType", function () { + _this.updateProgressText(); + }); + _this.registerFunctionOnPropertiesValueChanged(["questionStartIndex", "requiredText", "questionTitlePattern"], function () { + _this.resetVisibleIndexes(); + }); + _this.registerFunctionOnPropertiesValueChanged(["isLoading", "isCompleted", "isCompletedBefore", "mode", "isStartedState", "currentPage"], function () { _this.updateState(); }); + _this.registerFunctionOnPropertiesValueChanged(["state", "currentPage", "showPreviewBeforeComplete"], function () { _this.onStateAndCurrentPageChanged(); }); + _this.onGetQuestionNo.onCallbacksChanged = function () { + _this.resetVisibleIndexes(); + }; + _this.onProgressText.onCallbacksChanged = function () { + _this.updateProgressText(); + }; + _this.onTextMarkdown.onCallbacksChanged = function () { + _this.locStrsChanged(); + }; + _this.onProcessHtml.onCallbacksChanged = function () { + _this.locStrsChanged(); + }; + _this.onGetQuestionTitle.onCallbacksChanged = function () { + _this.locStrsChanged(); + }; + _this.onUpdatePageCssClasses.onCallbacksChanged = function () { + _this.currentPage && _this.currentPage.updateElementCss(); + }; + _this.onUpdatePanelCssClasses.onCallbacksChanged = function () { + _this.currentPage && _this.currentPage.updateElementCss(); + }; + _this.onUpdateQuestionCssClasses.onCallbacksChanged = function () { + _this.currentPage && _this.currentPage.updateElementCss(); + }; + _this.onShowingChoiceItem.onCallbacksChanged = function () { + _this.rebuildQuestionChoices(); + }; + _this.navigationBarValue = _this.createNavigationBar(); + _this.onBeforeCreating(); + if (jsonObj) { + if (typeof jsonObj === "string" || jsonObj instanceof String) { + jsonObj = JSON.parse(jsonObj); + } + if (jsonObj && jsonObj.clientId) { + _this.clientId = jsonObj.clientId; + } + _this.fromJSON(jsonObj); + if (_this.surveyId) { + _this.loadSurveyFromService(_this.surveyId, _this.clientId); + } + } + _this.onCreating(); + if (!!renderedElement) { + _this.render(renderedElement); + } + _this.updateCss(); + return _this; + } + Object.defineProperty(SurveyModel, "cssType", { + get: function () { + return _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_4__["surveyCss"].currentType; + }, + set: function (value) { + _stylesmanager__WEBPACK_IMPORTED_MODULE_11__["StylesManager"].applyTheme(value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "platformName", { + get: function () { + return SurveyModel.platform; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "commentPrefix", { + /** + * You can display an additional field (comment field) for the most of questions; users can enter additional comments to their response. + * The comment field input is saved as `'question name' + 'commentPrefix'`. + * @see data + * @see Question.hasComment + */ + get: function () { + return _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].commentPrefix; + }, + set: function (val) { + _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].commentPrefix = val; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.createHtmlLocString = function (name, locName, func) { + this.createLocalizableString(name, this, false, locName).onGetLocalizationTextCallback = func; + }; + SurveyModel.prototype.getType = function () { + return "survey"; + }; + SurveyModel.prototype.onPropertyValueChanged = function (name, oldValue, newValue) { + if (name === "questionsOnPageMode") { + this.onQuestionsOnPageModeChanged(oldValue); + } + }; + Object.defineProperty(SurveyModel.prototype, "pages", { + /** + * Returns a list of all pages in the survey, including invisible pages. + * @see PageModel + * @see visiblePages + */ + get: function () { + return this.getPropertyValue("pages"); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.render = function (element) { + if (this.renderCallback) { + this.renderCallback(); + } + }; + SurveyModel.prototype.updateSurvey = function (newProps, oldProps) { + var _loop_1 = function () { + if (key == "model" || key == "children") + return "continue"; + if (key.indexOf("on") == 0 && this_1[key] && this_1[key].add) { + var funcBody_1 = newProps[key]; + var func = function (sender, options) { + funcBody_1(sender, options); + }; + this_1[key].add(func); + } + else { + this_1[key] = newProps[key]; + } + }; + var this_1 = this; + for (var key in newProps) { + _loop_1(); + } + if (newProps && newProps.data) + this.onValueChanged.add(function (sender, options) { + newProps.data[options.name] = options.value; + }); + }; + SurveyModel.prototype.getCss = function () { + return this.css; + }; + SurveyModel.prototype.updateCompletedPageCss = function () { + this.containerCss = this.css.container; + this.completedCss = new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]().append(this.css.body) + .append(this.css.completedPage).toString(); // for completed page + }; + SurveyModel.prototype.updateCss = function () { + this.rootCss = this.getRootCss(); + this.updateNavigationCss(); + this.updateCompletedPageCss(); + }; + Object.defineProperty(SurveyModel.prototype, "css", { + get: function () { + if (!this.cssValue) { + this.cssValue = {}; + this.copyCssClasses(this.cssValue, _defaultCss_cssstandard__WEBPACK_IMPORTED_MODULE_4__["surveyCss"].getCss()); + } + return this.cssValue; + }, + set: function (value) { + this.mergeValues(value, this.css); + this.updateCss(); + this.updateElementCss(false); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "cssTitle", { + get: function () { + return this.css.title; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "cssNavigationComplete", { + get: function () { + return this.getNavigationCss(this.cssSurveyNavigationButton, this.css.navigation.complete); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "cssNavigationPreview", { + get: function () { + return this.getNavigationCss(this.cssSurveyNavigationButton, this.css.navigation.preview); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "cssNavigationEdit", { + get: function () { + return this.getNavigationCss(this.css.navigationButton, this.css.navigation.edit); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "cssNavigationPrev", { + get: function () { + return this.getNavigationCss(this.cssSurveyNavigationButton, this.css.navigation.prev); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "cssNavigationStart", { + get: function () { + return this.getNavigationCss(this.cssSurveyNavigationButton, this.css.navigation.start); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "cssNavigationNext", { + get: function () { + return this.getNavigationCss(this.cssSurveyNavigationButton, this.css.navigation.next); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "cssSurveyNavigationButton", { + get: function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]().append(this.css.navigationButton).append(this.css.bodyNavigationButton).toString(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "bodyCss", { + get: function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]().append(this.css.body) + .append(this.css.body + "--" + this.calculateWidthMode()).toString(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "completedStateCss", { + get: function () { + return this.getPropertyValue("completedStateCss", ""); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.getCompletedStateCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]().append(this.css.saveData[this.completedState], this.completedState !== "").toString(); + }; + SurveyModel.prototype.getNavigationCss = function (main, btn) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]().append(main) + .append(btn).toString(); + }; + Object.defineProperty(SurveyModel.prototype, "lazyRendering", { + /** + * By default all rows are rendered no matters if they are visible or not. + * Set it true, and survey markup rows will be rendered only if they are visible in viewport. + * This feature is experimantal and might do not support all the use cases. + */ + get: function () { + return this.lazyRenderingValue === true; + }, + set: function (val) { + if (this.lazyRendering === val) + return; + this.lazyRenderingValue = val; + var page = this.currentPage; + if (!!page) { + page.updateRows(); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isLazyRendering", { + get: function () { + return this.lazyRendering || _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].lazyRowsRendering; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.updateLazyRenderingRowsOnRemovingElements = function () { + if (!this.isLazyRendering) + return; + var page = this.currentPage; + if (!!page) { + Object(_utils_utils__WEBPACK_IMPORTED_MODULE_15__["scrollElementByChildId"])(page.id); + } + }; + Object.defineProperty(SurveyModel.prototype, "triggers", { + /** + * Gets or sets a list of triggers in the survey. + * @see SurveyTrigger + */ + get: function () { + return this.getPropertyValue("triggers"); + }, + set: function (val) { + this.setPropertyValue("triggers", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "calculatedValues", { + /** + * Gets or sets a list of calculated values in the survey. + * @see CalculatedValue + */ + get: function () { + return this.getPropertyValue("calculatedValues"); + }, + set: function (val) { + this.setPropertyValue("calculatedValues", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "surveyId", { + /** + * Gets or sets an identifier of a survey model loaded from the [api.surveyjs.io](https://api.surveyjs.io) service. When specified, the survey JSON is automatically loaded from [api.surveyjs.io](https://api.surveyjs.io) service. + * @see loadSurveyFromService + * @see onLoadedSurveyFromService + */ + get: function () { + return this.getPropertyValue("surveyId", ""); + }, + set: function (val) { + this.setPropertyValue("surveyId", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "surveyPostId", { + /** + * Gets or sets an identifier of a survey model saved to the [api.surveyjs.io](https://api.surveyjs.io) service. When specified, the survey data is automatically saved to the [api.surveyjs.io](https://api.surveyjs.io) service. + * @see onComplete + * @see surveyShowDataSaving + */ + get: function () { + return this.getPropertyValue("surveyPostId", ""); + }, + set: function (val) { + this.setPropertyValue("surveyPostId", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "clientId", { + /** + * Gets or sets user's identifier (e.g., e-mail or unique customer id) in your web application. + * If you load survey or post survey results from/to [api.surveyjs.io](https://api.surveyjs.io) service, then the library do not allow users to run the same survey the second time. + * On the second run, the user will see the survey complete page. + */ + get: function () { + return this.getPropertyValue("clientId", ""); + }, + set: function (val) { + this.setPropertyValue("clientId", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "cookieName", { + /** + * Gets or sets a cookie name used to save information about completing the survey. + * If the property is not empty, before starting the survey, the Survey library checks if the cookie with this name exists. + * If it is `true`, the survey goes to complete mode and a user sees the survey complete page. On completing the survey the cookie with this name is created. + */ + get: function () { + return this.getPropertyValue("cookieName", ""); + }, + set: function (val) { + this.setPropertyValue("cookieName", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "sendResultOnPageNext", { + /** + * Gets or sets whether to save survey results on completing every page. If the property value is set to `true`, the `onPartialSend` event is fired. + * @see onPartialSend + * @see clientId + */ + get: function () { + return this.getPropertyValue("sendResultOnPageNext", false); + }, + set: function (val) { + this.setPropertyValue("sendResultOnPageNext", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "surveyShowDataSaving", { + /** + * Gets or sets whether to show the progress on saving/sending data into the [api.surveyjs.io](https://api.surveyjs.io) service. + * @see surveyPostId + */ + get: function () { + return this.getPropertyValue("surveyShowDataSaving", false); + }, + set: function (val) { + this.setPropertyValue("surveyShowDataSaving", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "focusFirstQuestionAutomatic", { + /** + * Gets or sets whether the first input is focused on showing a next or a previous page. + */ + get: function () { + return this.getPropertyValue("focusFirstQuestionAutomatic"); + }, + set: function (val) { + this.setPropertyValue("focusFirstQuestionAutomatic", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "focusOnFirstError", { + /** + * Gets or sets whether the first input is focused if the current page has errors. + * Set this property to `false` (the default value is `true`) if you do not want to bring the focus to the first question that has error on the page. + */ + get: function () { + return this.getPropertyValue("focusOnFirstError"); + }, + set: function (val) { + this.setPropertyValue("focusOnFirstError", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "showNavigationButtons", { + /** + * Gets or sets the navigation buttons position. + * Possible values: 'bottom' (default), 'top', 'both' and 'none'. Set it to 'none' to hide 'Prev', 'Next' and 'Complete' buttons. + * It makes sense if you are going to create a custom navigation, have only a single page, or the `goNextPageAutomatic` property is set to `true`. + * @see goNextPageAutomatic + * @see showPrevButton + */ + get: function () { + return this.getPropertyValue("showNavigationButtons"); + }, + set: function (val) { + if (val === true || val === undefined) { + val = "bottom"; + } + if (val === false) { + val = "none"; + } + this.setPropertyValue("showNavigationButtons", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "showPrevButton", { + /** + * Gets or sets whether the Survey displays "Prev" button in its pages. Set it to `false` to prevent end-users from going back to their answers. + * @see showNavigationButtons + */ + get: function () { + return this.getPropertyValue("showPrevButton"); + }, + set: function (val) { + this.setPropertyValue("showPrevButton", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "showTitle", { + /** + * Gets or sets whether the Survey displays survey title in its pages. Set it to `false` to hide a survey title. + * @see title + */ + get: function () { + return this.getPropertyValue("showTitle"); + }, + set: function (val) { + this.setPropertyValue("showTitle", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "showPageTitles", { + /** + * Gets or sets whether the Survey displays page titles. Set it to `false` to hide page titles. + * @see PageModel.title + */ + get: function () { + return this.getPropertyValue("showPageTitles"); + }, + set: function (val) { + this.setPropertyValue("showPageTitles", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "showCompletedPage", { + /** + * On finishing the survey the complete page is shown. Set the property to `false`, to hide the complete page. + * @see data + * @see onComplete + * @see navigateToUrl + */ + get: function () { + return this.getPropertyValue("showCompletedPage"); + }, + set: function (val) { + this.setPropertyValue("showCompletedPage", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "navigateToUrl", { + /** + * Set this property to a url you want to navigate after a user completing the survey. + * By default it uses after calling onComplete event. In case calling options.showDataSaving callback in onComplete event, navigateToUrl will be used on calling options.showDataSavingSuccess callback. + */ + get: function () { + return this.getPropertyValue("navigateToUrl"); + }, + set: function (val) { + this.setPropertyValue("navigateToUrl", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "navigateToUrlOnCondition", { + /** + * Gets or sets a list of URL condition items. If the expression of this item returns `true`, then survey will navigate to the item URL. + * @see UrlConditionItem + * @see navigateToUrl + */ + get: function () { + return this.getPropertyValue("navigateToUrlOnCondition"); + }, + set: function (val) { + this.setPropertyValue("navigateToUrlOnCondition", val); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.getNavigateToUrl = function () { + var item = this.getExpressionItemOnRunCondition(this.navigateToUrlOnCondition); + var url = !!item ? item.url : this.navigateToUrl; + if (!!url) { + url = this.processText(url, true); + } + return url; + }; + SurveyModel.prototype.navigateTo = function () { + var url = this.getNavigateToUrl(); + var options = { url: url }; + this.onNavigateToUrl.fire(this, options); + if (!options.url || typeof window === "undefined" || !window.location) + return; + window.location.href = options.url; + }; + Object.defineProperty(SurveyModel.prototype, "requiredText", { + /** + * Gets or sets the required question mark. The required question mark is a char or string that is rendered in the required questions' titles. + * @see Question.title + */ + get: function () { + return this.getPropertyValue("requiredText", "*"); + }, + set: function (val) { + this.setPropertyValue("requiredText", val); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.beforeSettingQuestionErrors = function (question, errors) { + this.maakeRequiredErrorsInvisibgle(errors); + this.onSettingQuestionErrors.fire(this, { + question: question, + errors: errors, + }); + }; + SurveyModel.prototype.beforeSettingPanelErrors = function (question, errors) { + this.maakeRequiredErrorsInvisibgle(errors); + }; + SurveyModel.prototype.maakeRequiredErrorsInvisibgle = function (errors) { + if (!this.hideRequiredErrors) + return; + for (var i = 0; i < errors.length; i++) { + var erType = errors[i].getErrorType(); + if (erType == "required" || erType == "requireoneanswer") { + errors[i].visible = false; + } + } + }; + Object.defineProperty(SurveyModel.prototype, "questionStartIndex", { + /** + * Gets or sets the first question index. The first question index is '1' by default. You may start it from '100' or from 'A', by setting '100' or 'A' to this property. + * You can set the start index to "(1)" or "# A)" or "a)" to render question number as (1), # A) and a) accordingly. + * @see Question.title + * @see requiredText + */ + get: function () { + return this.getPropertyValue("questionStartIndex", ""); + }, + set: function (val) { + this.setPropertyValue("questionStartIndex", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "storeOthersAsComment", { + /** + * Gets or sets whether the "Others" option text is stored as question comment. + * + * By default the entered text in the "Others" input in the checkbox/radiogroup/dropdown is stored as `"question name " + "-Comment"`. The value itself is `"question name": "others"`. + * Set this property to `false`, to store the entered text directly in the `"question name"` key. + * @see commentPrefix + */ + get: function () { + return this.getPropertyValue("storeOthersAsComment"); + }, + set: function (val) { + this.setPropertyValue("storeOthersAsComment", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "maxTextLength", { + /** + * Specifies the default maximum length for questions like text and comment, including matrix cell questions. + * + * The default value is `0`, that means that the text and comment have the same max length as the standard HTML input - 524288 characters: https://www.w3schools.com/tags/att_input_maxlength.asp. + * @see maxOthersLength + */ + get: function () { + return this.getPropertyValue("maxTextLength"); + }, + set: function (val) { + this.setPropertyValue("maxTextLength", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "maxOthersLength", { + /** + * Gets or sets the default maximum length for question comments and others + * + * The default value is `0`, that means that the question comments have the same max length as the standard HTML input - 524288 characters: https://www.w3schools.com/tags/att_input_maxlength.asp. + * @see Question.hasComment + * @see Question.hasOther + * @see maxTextLength + */ + get: function () { + return this.getPropertyValue("maxOthersLength"); + }, + set: function (val) { + this.setPropertyValue("maxOthersLength", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "goNextPageAutomatic", { + /** + * Gets or ses whether a user can navigate the next page automatically after answering all the questions on a page without pressing the "Next" button. + * The available options: + * + * - `true` - navigate the next page and submit survey data automatically. + * - `autogonext` - navigate the next page automatically but do not submit survey data. + * - `false` - do not navigate the next page and do not submit survey data automatically. + * @see showNavigationButtons + */ + get: function () { + return this.getPropertyValue("goNextPageAutomatic", false); + }, + set: function (val) { + this.setPropertyValue("goNextPageAutomatic", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "allowCompleteSurveyAutomatic", { + /** + * Gets or sets whether a survey is automatically completed when `goNextPageAutomatic = true`. Set it to `false` if you do not want to submit survey automatically on completing the last survey page. + * @see goNextPageAutomatic + */ + get: function () { + return this.getPropertyValue("allowCompleteSurveyAutomatic", true); + }, + set: function (val) { + this.setPropertyValue("allowCompleteSurveyAutomatic", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "checkErrorsMode", { + /** + * Gets or sets a value that specifies how the survey validates the question answers. + * + * The following options are available: + * + * - `onNextPage` (default) - check errors on navigating to the next page or on completing the survey. + * - `onValueChanged` - check errors on every question value (i.e., answer) changing. + * - `onValueChanging` - check errors before setting value into survey. If there is an error, then survey data is not changed, but question value will be keeped. + * - `onComplete` - to validate all visible questions on complete button click. If there are errors on previous pages, then the page with the first error becomes the current. + */ + get: function () { + return this.getPropertyValue("checkErrorsMode"); + }, + set: function (val) { + this.setPropertyValue("checkErrorsMode", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "autoGrowComment", { + /** + * Specifies whether the text area of [comment](https://surveyjs.io/Documentation/Library?id=questioncommentmodel) questions/elements automatically expands its height to avoid the vertical scrollbar and to display the entire multi-line contents entered by respondents. + * Default value is false. + * @see QuestionCommentModel.autoGrow + */ + get: function () { + return this.getPropertyValue("autoGrowComment"); + }, + set: function (val) { + this.setPropertyValue("autoGrowComment", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "textUpdateMode", { + /** + * Gets or sets a value that specifies how the survey updates its questions' text values. + * + * The following options are available: + * + * - `onBlur` (default) - the value is updated after an input loses the focus. + * - `onTyping` - update the value of text questions, "text" and "comment", on every key press. + * + * Note, that setting to "onTyping" may lead to a performance degradation, in case you have many expressions in the survey. + */ + get: function () { + return this.getPropertyValue("textUpdateMode"); + }, + set: function (val) { + this.setPropertyValue("textUpdateMode", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "clearInvisibleValues", { + /** + * Gets or sets a value that specifies how the invisible data is included in survey data. + * + * The following options are available: + * + * - `none` - include the invisible values into the survey data. + * - `onHidden` - clear the question value when it becomes invisible. If a question has value and it was invisible initially then survey clears the value on completing. + * - `onHiddenContainer` - clear the question value when it or its parent (page or panel) becomes invisible. If a question has value and it was invisible initially then survey clears the value on completing. + * - `onComplete` (default) - clear invisible question values on survey complete. In this case, the invisible questions will not be stored on the server. + * @see Question.visible + * @see onComplete + */ + get: function () { + return this.getPropertyValue("clearInvisibleValues"); + }, + set: function (val) { + if (val === true) + val = "onComplete"; + if (val === false) + val = "none"; + this.setPropertyValue("clearInvisibleValues", val); + }, + enumerable: false, + configurable: true + }); + /** + * Call this function to remove all question values from the survey, that end-user will not be able to enter. + * For example the value that doesn't exists in a radiogroup/dropdown/checkbox choices or matrix rows/columns. + * Please note, this function doesn't clear values for invisible questions or values that doesn't associated with questions. + * In fact this function just call clearIncorrectValues function of all questions in the survey + * @param removeNonExisingRootKeys - set this parameter to true to remove keys from survey.data that doesn't have corresponded questions and calculated values + * @see Question.clearIncorrectValues + * @see Page.clearIncorrectValues + * @see Panel.clearIncorrectValues + */ + SurveyModel.prototype.clearIncorrectValues = function (removeNonExisingRootKeys) { + if (removeNonExisingRootKeys === void 0) { removeNonExisingRootKeys = false; } + for (var i = 0; i < this.pages.length; i++) { + this.pages[i].clearIncorrectValues(); + } + if (!removeNonExisingRootKeys) + return; + var data = this.data; + var hasChanges = false; + for (var key in data) { + if (!!this.getQuestionByValueName(key)) + continue; + if (this.iscorrectValueWithPostPrefix(key, _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].commentPrefix) || + this.iscorrectValueWithPostPrefix(key, _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].matrixTotalValuePostFix)) + continue; + var calcValue = this.getCalculatedValueByName(key); + if (!!calcValue && calcValue.includeIntoResult) + continue; + hasChanges = true; + delete data[key]; + } + if (hasChanges) { + this.data = data; + } + }; + SurveyModel.prototype.iscorrectValueWithPostPrefix = function (key, postPrefix) { + if (key.indexOf(postPrefix) !== key.length - postPrefix.length) + return false; + return !!this.getQuestionByValueName(key.substr(0, key.indexOf(postPrefix))); + }; + Object.defineProperty(SurveyModel.prototype, "locale", { + /** + * Gets or sets the survey locale. The default value it is empty, this means the 'en' locale is used. + * You can set it to 'de' - German, 'fr' - French and so on. The library has built-in localization for several languages. The library has a multi-language support as well. + */ + get: function () { + return this.localeValue; + }, + set: function (value) { + _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].currentLocale = value; + this.localeValue = _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].currentLocale; + this.setPropertyValue("locale", this.localeValue); + if (this.isLoadingFromJson) + return; + this.notifyElementsOnAnyValueOrVariableChanged("locale"); + this.localeChanged(); + this.onLocaleChangedEvent.fire(this, value); + }, + enumerable: false, + configurable: true + }); + /** + * Returns an array of locales that are used in the survey's translation. + */ + SurveyModel.prototype.getUsedLocales = function () { + var locs = new Array(); + this.addUsedLocales(locs); + //Replace the default locale with the real one + var index = locs.indexOf("default"); + if (index > -1) { + var defaultLoc = _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].defaultLocale; + //Remove the defaultLoc + var defIndex = locs.indexOf(defaultLoc); + if (defIndex > -1) { + locs.splice(defIndex, 1); + } + index = locs.indexOf("default"); + locs[index] = defaultLoc; + } + return locs; + }; + SurveyModel.prototype.localeChanged = function () { + for (var i = 0; i < this.pages.length; i++) { + this.pages[i].localeChanged(); + } + }; + //ILocalizableOwner + SurveyModel.prototype.getLocale = function () { + return this.locale; + }; + SurveyModel.prototype.locStrsChanged = function () { + _super.prototype.locStrsChanged.call(this); + if (!this.currentPage) + return; + this.updateProgressText(); + var page = this.activePage; + if (!!page) { + page.locStrsChanged(); + } + var visPages = this.visiblePages; + for (var i = 0; i < visPages.length; i++) { + visPages[i].navigationLocStrChanged(); + } + }; + SurveyModel.prototype.getMarkdownHtml = function (text, name) { + return this.getSurveyMarkdownHtml(this, text, name); + }; + SurveyModel.prototype.getRenderer = function (name) { + return this.getRendererForString(this, name); + }; + SurveyModel.prototype.getRendererContext = function (locStr) { + return this.getRendererContextForString(this, locStr); + }; + SurveyModel.prototype.getRendererForString = function (element, name) { + var renderAs = this.getBuiltInRendererForString(element, name); + var options = { element: element, name: name, renderAs: renderAs }; + this.onTextRenderAs.fire(this, options); + return options.renderAs; + }; + SurveyModel.prototype.getRendererContextForString = function (element, locStr) { + return locStr; + }; + SurveyModel.prototype.getExpressionDisplayValue = function (question, value, displayValue) { + var options = { + question: question, + value: value, + displayValue: displayValue, + }; + this.onGetExpressionDisplayValue.fire(this, options); + return options.displayValue; + }; + SurveyModel.prototype.getBuiltInRendererForString = function (element, name) { + if (this.isDesignMode) + return _localizablestring__WEBPACK_IMPORTED_MODULE_10__["LocalizableString"].editableRenderer; + return undefined; + }; + SurveyModel.prototype.getProcessedText = function (text) { + return this.processText(text, true); + }; + SurveyModel.prototype.getLocString = function (str) { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].getString(str); + }; + //ISurveyErrorOwner + SurveyModel.prototype.getErrorCustomText = function (text, error) { + return this.getSurveyErrorCustomText(this, text, error); + }; + SurveyModel.prototype.getSurveyErrorCustomText = function (obj, text, error) { + var options = { + text: text, + name: error.getErrorType(), + obj: obj, + error: error + }; + this.onErrorCustomText.fire(this, options); + return options.text; + }; + Object.defineProperty(SurveyModel.prototype, "emptySurveyText", { + /** + * Returns the text that is displayed when there are no any visible pages and questiona. + */ + get: function () { + return this.getLocString("emptySurvey"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "logo", { + //#region Title/Header options + /** + * Gets or sets a survey logo. + * @see title + */ + get: function () { + return this.getLocalizableStringText("logo"); + }, + set: function (value) { + this.setLocalizableStringText("logo", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "locLogo", { + get: function () { + return this.getLocalizableString("logo"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "logoWidth", { + /** + * Gets or sets a survey logo width. + * @see logo + */ + get: function () { + var width = this.getPropertyValue("logoWidth"); + return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_15__["getSize"])(width); + }, + set: function (value) { + this.setPropertyValue("logoWidth", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "logoHeight", { + /** + * Gets or sets a survey logo height. + * @see logo + */ + get: function () { + var height = this.getPropertyValue("logoHeight"); + return Object(_utils_utils__WEBPACK_IMPORTED_MODULE_15__["getSize"])(height); + }, + set: function (value) { + this.setPropertyValue("logoHeight", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "logoPosition", { + /** + * Gets or sets a survey logo position. + * @see logo + */ + get: function () { + return this.getPropertyValue("logoPosition"); + }, + set: function (value) { + this.setPropertyValue("logoPosition", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "hasLogo", { + get: function () { + return !!this.logo && this.logoPosition !== "none"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isLogoBefore", { + get: function () { + if (this.isDesignMode) + return false; + return (this.renderedHasLogo && + (this.logoPosition === "left" || this.logoPosition === "top")); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isLogoAfter", { + get: function () { + if (this.isDesignMode) + return this.renderedHasLogo; + return (this.renderedHasLogo && + (this.logoPosition === "right" || this.logoPosition === "bottom")); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "logoClassNames", { + get: function () { + var logoClasses = { + left: "sv-logo--left", + right: "sv-logo--right", + top: "sv-logo--top", + bottom: "sv-logo--bottom", + }; + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]().append(this.css.logo) + .append(logoClasses[this.logoPosition]).toString(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "renderedHasTitle", { + get: function () { + if (this.isDesignMode) + return this.isPropertyVisible("title"); + return !this.locTitle.isEmpty && this.showTitle; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "renderedHasDescription", { + get: function () { + if (this.isDesignMode) + return this.isPropertyVisible("description"); + return !!this.hasDescription; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "hasTitle", { + get: function () { + return this.renderedHasTitle; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "renderedHasLogo", { + get: function () { + if (this.isDesignMode) + return this.isPropertyVisible("logo"); + return this.hasLogo; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "renderedHasHeader", { + get: function () { + return this.renderedHasTitle || this.renderedHasLogo; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "logoFit", { + /** + * The logo fit mode. + * @see logo + */ + get: function () { + return this.getPropertyValue("logoFit"); + }, + set: function (val) { + this.setPropertyValue("logoFit", val); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.setIsMobile = function (newVal) { + if (newVal === void 0) { newVal = true; } + if (this.isMobile !== newVal) { + this._isMobile = newVal; + this.updateCss(); + this.getAllQuestions().map(function (q) { return q.isMobile = newVal; }); + } + }; + Object.defineProperty(SurveyModel.prototype, "isMobile", { + get: function () { + return this._isMobile; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.isLogoImageChoosen = function () { + return this.locLogo.renderedHtml; + }; + Object.defineProperty(SurveyModel.prototype, "titleMaxWidth", { + get: function () { + if (!(Object(_utils_utils__WEBPACK_IMPORTED_MODULE_15__["isMobile"])() || this.isMobile) && + !this.isValueEmpty(this.isLogoImageChoosen()) && + !_settings__WEBPACK_IMPORTED_MODULE_14__["settings"].supportCreatorV2) { + var logoWidth = this.logoWidth; + if (this.logoPosition === "left" || this.logoPosition === "right") { + return "calc(100% - 5px - 2em - " + logoWidth + ")"; + } + } + return ""; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "completedHtml", { + /** + * Gets or sets the HTML content displayed on the complete page. Use this property to change the default complete page text. + * @see showCompletedPage + * @see completedHtmlOnCondition + * @see locale + */ + get: function () { + return this.getLocalizableStringText("completedHtml"); + }, + set: function (value) { + this.setLocalizableStringText("completedHtml", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "locCompletedHtml", { + get: function () { + return this.getLocalizableString("completedHtml"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "completedHtmlOnCondition", { + /** + * The list of HTML condition items. If the expression of this item returns `true`, then a survey will use this item HTML instead of `completedHtml`. + * @see HtmlConditionItem + * @see completeHtml + */ + get: function () { + return this.getPropertyValue("completedHtmlOnCondition"); + }, + set: function (val) { + this.setPropertyValue("completedHtmlOnCondition", val); + }, + enumerable: false, + configurable: true + }); + /** + * Calculates a given expression and returns a result value. + * @param expression + */ + SurveyModel.prototype.runExpression = function (expression) { + if (!expression) + return null; + var values = this.getFilteredValues(); + var properties = this.getFilteredProperties(); + return new _conditions__WEBPACK_IMPORTED_MODULE_13__["ExpressionRunner"](expression).run(values, properties); + }; + /** + * Calculates a given expression and returns `true` or `false`. + * @param expression + */ + SurveyModel.prototype.runCondition = function (expression) { + if (!expression) + return false; + var values = this.getFilteredValues(); + var properties = this.getFilteredProperties(); + return new _conditions__WEBPACK_IMPORTED_MODULE_13__["ConditionRunner"](expression).run(values, properties); + }; + /** + * Run all triggers that performs on value changed and not on moving to the next page. + */ + SurveyModel.prototype.runTriggers = function () { + this.checkTriggers(this.getFilteredValues(), false); + }; + Object.defineProperty(SurveyModel.prototype, "renderedCompletedHtml", { + get: function () { + var item = this.getExpressionItemOnRunCondition(this.completedHtmlOnCondition); + return !!item ? item.html : this.completedHtml; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.getExpressionItemOnRunCondition = function (items) { + if (items.length == 0) + return null; + var values = this.getFilteredValues(); + var properties = this.getFilteredProperties(); + for (var i = 0; i < items.length; i++) { + if (items[i].runCondition(values, properties)) { + return items[i]; + } + } + return null; + }; + Object.defineProperty(SurveyModel.prototype, "completedBeforeHtml", { + /** + * The HTML content displayed to an end user that has already completed the survey. + * @see clientId + * @see locale + */ + get: function () { + return this.getLocalizableStringText("completedBeforeHtml"); + }, + set: function (value) { + this.setLocalizableStringText("completedBeforeHtml", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "locCompletedBeforeHtml", { + get: function () { + return this.getLocalizableString("completedBeforeHtml"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "loadingHtml", { + /** + * The HTML that shows on loading survey Json from the [api.surveyjs.io](https://api.surveyjs.io) service. + * @see surveyId + * @see locale + */ + get: function () { + return this.getLocalizableStringText("loadingHtml"); + }, + set: function (value) { + this.setLocalizableStringText("loadingHtml", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "locLoadingHtml", { + get: function () { + return this.getLocalizableString("loadingHtml"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "defaultLoadingHtml", { + /** + * Default value for loadingHtml property + * @see loadingHtml + */ + get: function () { + return "

" + this.getLocString("loadingSurvey") + "

"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "navigationBar", { + get: function () { + return this.navigationBarValue; + }, + enumerable: false, + configurable: true + }); + /** + * Adds a custom navigation item similar to the Previous Page, Next Page, and Complete buttons. + * Accepts an object described in the [IAction](https://surveyjs.io/Documentation/Library?id=IAction) help section. + */ + SurveyModel.prototype.addNavigationItem = function (val) { + if (!val.component) { + val.component = "sv-nav-btn"; + } + if (!val.innerCss) { + val.innerCss = this.cssSurveyNavigationButton; + } + return this.navigationBar.addAction(val); + }; + Object.defineProperty(SurveyModel.prototype, "startSurveyText", { + /** + * Gets or sets the 'Start' button caption. + * The 'Start' button is shown on the started page. Set the `firstPageIsStarted` property to `true`, to display the started page. + * @see firstPageIsStarted + * @see locale + */ + get: function () { + return this.getLocalizableStringText("startSurveyText"); + }, + set: function (newValue) { + this.setLocalizableStringText("startSurveyText", newValue); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "locStartSurveyText", { + get: function () { + return this.getLocalizableString("startSurveyText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "pagePrevText", { + /** + * Gets or sets the 'Prev' button caption. + * @see locale + */ + get: function () { + return this.getLocalizableStringText("pagePrevText"); + }, + set: function (newValue) { + this.setLocalizableStringText("pagePrevText", newValue); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "locPagePrevText", { + get: function () { + return this.getLocalizableString("pagePrevText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "pageNextText", { + /** + * Gets or sets the 'Next' button caption. + * @see locale + */ + get: function () { + return this.getLocalizableStringText("pageNextText"); + }, + set: function (newValue) { + this.setLocalizableStringText("pageNextText", newValue); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "locPageNextText", { + get: function () { + return this.getLocalizableString("pageNextText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "completeText", { + /** + * Gets or sets the 'Complete' button caption. + * @see locale + */ + get: function () { + return this.getLocalizableStringText("completeText"); + }, + set: function (newValue) { + this.setLocalizableStringText("completeText", newValue); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "locCompleteText", { + get: function () { + return this.getLocalizableString("completeText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "previewText", { + /** + * Gets or sets the 'Preview' button caption. + * @see locale + * @see showPreviewBeforeComplete + * @see editText + * @see showPreview + */ + get: function () { + return this.getLocalizableStringText("previewText"); + }, + set: function (newValue) { + this.setLocalizableStringText("previewText", newValue); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "locPreviewText", { + get: function () { + return this.getLocalizableString("previewText"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "editText", { + /** + * Gets or sets the 'Edit' button caption. + * @see locale + * @see showPreviewBeforeComplete + * @see previewText + * @see cancelPreview + */ + get: function () { + return this.getLocalizableStringText("editText"); + }, + set: function (newValue) { + this.setLocalizableStringText("editText", newValue); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "locEditText", { + get: function () { + return this.getLocalizableString("editText"); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.getElementTitleTagName = function (element, tagName) { + if (this.onGetTitleTagName.isEmpty) + return tagName; + var options = { element: element, tagName: tagName }; + this.onGetTitleTagName.fire(this, options); + return options.tagName; + }; + Object.defineProperty(SurveyModel.prototype, "questionTitlePattern", { + /** + * Set the pattern for question title. Default is "numTitleRequire", 1. What is your name? *, + * You can set it to numRequireTitle: 1. * What is your name? + * You can set it to requireNumTitle: * 1. What is your name? + * You can set it to numTitle (remove require symbol completely): 1. What is your name? + * @see QuestionModel.title + */ + get: function () { + return this.getPropertyValue("questionTitlePattern", "numTitleRequire"); + }, + set: function (val) { + if (val !== "numRequireTitle" && + val !== "requireNumTitle" && + val != "numTitle") { + val = "numTitleRequire"; + } + this.setPropertyValue("questionTitlePattern", val); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.getQuestionTitlePatternOptions = function () { + var res = new Array(); + var title = this.getLocString("questionTitlePatternText"); + var num = !!this.questionStartIndex ? this.questionStartIndex : "1."; + res.push({ + value: "numTitleRequire", + text: num + " " + title + " " + this.requiredText + }); + res.push({ + value: "numRequireTitle", + text: num + " " + this.requiredText + " " + title + }); + res.push({ + value: "requireNumTitle", + text: this.requiredText + " " + num + " " + title + }); + res.push({ + value: "numTitle", + text: num + " " + title + }); + return res; + }; + Object.defineProperty(SurveyModel.prototype, "questionTitleTemplate", { + /** + * Gets or sets a question title template. Obsolete, please use questionTitlePattern + * @see QuestionModel.title + * @see questionTitlePattern + */ + get: function () { + return this.getLocalizableStringText("questionTitleTemplate"); + }, + set: function (value) { + this.setLocalizableStringText("questionTitleTemplate", value); + this.questionTitlePattern = this.getNewTitlePattern(value); + this.questionStartIndex = this.getNewQuestionTitleElement(value, "no", this.questionStartIndex, "1"); + this.requiredText = this.getNewQuestionTitleElement(value, "require", this.requiredText, "*"); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.getNewTitlePattern = function (template) { + if (!!template) { + var strs = []; + while (template.indexOf("{") > -1) { + template = template.substr(template.indexOf("{") + 1); + var ind = template.indexOf("}"); + if (ind < 0) + break; + strs.push(template.substr(0, ind)); + template = template.substr(ind + 1); + } + if (strs.length > 1) { + if (strs[0] == "require") + return "requireNumTitle"; + if (strs[1] == "require" && strs.length == 3) + return "numRequireTitle"; + if (strs.indexOf("require") < 0) + return "numTitle"; + } + if (strs.length == 1 && strs[0] == "title") { + return "numTitle"; + } + } + return "numTitleRequire"; + }; + SurveyModel.prototype.getNewQuestionTitleElement = function (template, name, currentValue, defaultValue) { + name = "{" + name + "}"; + if (!template || template.indexOf(name) < 0) + return currentValue; + var ind = template.indexOf(name); + var prefix = ""; + var postfix = ""; + var i = ind - 1; + for (; i >= 0; i--) { + if (template[i] == "}") + break; + } + if (i < ind - 1) { + prefix = template.substr(i + 1, ind - i - 1); + } + ind += name.length; + i = ind; + for (; i < template.length; i++) { + if (template[i] == "{") + break; + } + if (i > ind) { + postfix = template.substr(ind, i - ind); + } + i = 0; + while (i < prefix.length && prefix.charCodeAt(i) < 33) + i++; + prefix = prefix.substr(i); + i = postfix.length - 1; + while (i >= 0 && postfix.charCodeAt(i) < 33) + i--; + postfix = postfix.substr(0, i + 1); + if (!prefix && !postfix) + return currentValue; + var value = !!currentValue ? currentValue : defaultValue; + return prefix + value + postfix; + }; + Object.defineProperty(SurveyModel.prototype, "locQuestionTitleTemplate", { + get: function () { + return this.getLocalizableString("questionTitleTemplate"); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.getUpdatedQuestionTitle = function (question, title) { + if (this.onGetQuestionTitle.isEmpty) + return title; + var options = { question: question, title: title }; + this.onGetQuestionTitle.fire(this, options); + return options.title; + }; + SurveyModel.prototype.getUpdatedQuestionNo = function (question, no) { + if (this.onGetQuestionNo.isEmpty) + return no; + var options = { question: question, no: no }; + this.onGetQuestionNo.fire(this, options); + return options.no; + }; + Object.defineProperty(SurveyModel.prototype, "showPageNumbers", { + /** + * Gets or sets whether the survey displays page numbers on pages titles. + */ + get: function () { + return this.getPropertyValue("showPageNumbers", false); + }, + set: function (value) { + if (value === this.showPageNumbers) + return; + this.setPropertyValue("showPageNumbers", value); + this.updateVisibleIndexes(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "showQuestionNumbers", { + /** + * Gets or sets a value that specifies how the question numbers are displayed. + * + * The following options are available: + * + * - `on` - display question numbers + * - `onpage` - display question numbers, start numbering on every page + * - `off` - turn off the numbering for questions titles + */ + get: function () { + return this.getPropertyValue("showQuestionNumbers"); + }, + set: function (value) { + value = value.toLowerCase(); + value = value === "onpage" ? "onPage" : value; + if (value === this.showQuestionNumbers) + return; + this.setPropertyValue("showQuestionNumbers", value); + this.updateVisibleIndexes(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "showProgressBar", { + /** + * Gets or sets the survey progress bar position. + * + * The following options are available: + * + * - `off` (default) - don't show progress bar + * - `top` - show progress bar in the top + * - `bottom` - show progress bar in the bottom + * - `both` - show progress bar in both sides: top and bottom. + */ + get: function () { + return this.getPropertyValue("showProgressBar"); + }, + set: function (newValue) { + this.setPropertyValue("showProgressBar", newValue.toLowerCase()); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "progressBarType", { + /** + * Gets or sets the type of info in the progress bar. + * + * The following options are available: + * + * - `pages` (default), + * - `questions`, + * - `requiredQuestions`, + * - `correctQuestions`, + * - `buttons` + */ + get: function () { + return this.getPropertyValue("progressBarType"); + }, + set: function (newValue) { + if (newValue === "correctquestion") + newValue = "correctQuestion"; + if (newValue === "requiredquestion") + newValue = "requiredQuestion"; + this.setPropertyValue("progressBarType", newValue); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isShowProgressBarOnTop", { + get: function () { + if (!this.canShowProresBar()) + return false; + return this.showProgressBar === "top" || this.showProgressBar === "both"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isShowProgressBarOnBottom", { + get: function () { + if (!this.canShowProresBar()) + return false; + return this.showProgressBar === "bottom" || this.showProgressBar === "both"; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.canShowProresBar = function () { + return (!this.isShowingPreview || + this.showPreviewBeforeComplete != "showAllQuestions"); + }; + Object.defineProperty(SurveyModel.prototype, "processedTitle", { + /** + * Returns the text/HTML that is rendered as a survey title. + */ + get: function () { + return this.locTitle.renderedHtml; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "questionTitleLocation", { + /** + * Gets or sets the question title location. + * + * The following options are available: + * + * - `bottom` - show a question title to bottom + * - `left` - show a question title to left + * - `top` - show a question title to top. + * + * > Some questions, for example matrixes, do not support 'left' value. The title for them will be displayed to the top. + */ + get: function () { + return this.getPropertyValue("questionTitleLocation"); + }, + set: function (value) { + this.setPropertyValue("questionTitleLocation", value.toLowerCase()); + if (!this.isLoadingFromJson) { + this.updateElementCss(true); + } + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.updateElementCss = function (reNew) { + if (!!this.startedPage) { + this.startedPage.updateElementCss(reNew); + } + var pages = this.visiblePages; + for (var i = 0; i < pages.length; i++) { + pages[i].updateElementCss(reNew); + } + }; + Object.defineProperty(SurveyModel.prototype, "questionErrorLocation", { + /** + * Gets or sets the error message position. + * + * The following options are available: + * + * - `top` - to show question error(s) over the question, + * - `bottom` - to show question error(s) under the question. + */ + get: function () { + return this.getPropertyValue("questionErrorLocation"); + }, + set: function (value) { + this.setPropertyValue("questionErrorLocation", value.toLowerCase()); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "questionDescriptionLocation", { + /** + * Gets or sets the question description position. The default value is `underTitle`. + * + * The following options are available: + * + * - `underTitle` - show question description under the question title, + * - `underInput` - show question description under the question input instead of question title. + */ + get: function () { + return this.getPropertyValue("questionDescriptionLocation"); + }, + set: function (value) { + this.setPropertyValue("questionDescriptionLocation", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "mode", { + /** + * Gets or sets the survey edit mode. + * + * The following options are available: + * + * - `edit` (default) - make a survey editable, + * - `display` - make a survey read-only. + */ + get: function () { + return this.getPropertyValue("mode"); + }, + set: function (value) { + value = value.toLowerCase(); + if (value == this.mode) + return; + if (value != "edit" && value != "display") + return; + this.setPropertyValue("mode", value); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.onModeChanged = function () { + for (var i = 0; i < this.pages.length; i++) { + var page = this.pages[i]; + page.setPropertyValue("isReadOnly", page.isReadOnly); + } + this.updateButtonsVisibility(); + }; + Object.defineProperty(SurveyModel.prototype, "data", { + /** + * Gets or sets an object that stores the survey results/data. You can set it directly as `{ 'question name': questionValue, ... }` + * + * > If you set the `data` property after creating the survey, you may need to set the `currentPageNo` to `0`, if you are using `visibleIf` properties for questions/pages/panels to ensure that you are starting from the first page. + * @see setValue + * @see getValue + * @see mergeData + * @see currentPageNo + */ + get: function () { + var result = {}; + var keys = this.getValuesKeys(); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var dataValue = this.getDataValueCore(this.valuesHash, key); + if (dataValue !== undefined) { + result[key] = dataValue; + } + } + this.setCalcuatedValuesIntoResult(result); + return result; + }, + set: function (data) { + this.valuesHash = {}; + this.setDataCore(data); + }, + enumerable: false, + configurable: true + }); + /** + * Merge the values into survey.data. It works as survey.data, except it doesn't clean the existing data, but overrides them. + * @param data data to merge. It should be an object {keyValue: Value, ...} + * @see data + * @see setValue + */ + SurveyModel.prototype.mergeData = function (data) { + if (!data) + return; + this.setDataCore(data); + }; + SurveyModel.prototype.setDataCore = function (data) { + if (data) { + for (var key in data) { + this.setDataValueCore(this.valuesHash, key, data[key]); + } + } + this.updateAllQuestionsValue(); + this.notifyAllQuestionsOnValueChanged(); + this.notifyElementsOnAnyValueOrVariableChanged(""); + this.runConditions(); + this.updateAllQuestionsValue(); + }; + Object.defineProperty(SurveyModel.prototype, "editingObj", { + get: function () { + return this.editingObjValue; + }, + set: function (val) { + var _this = this; + if (this.editingObj == val) + return; + if (!!this.editingObj) { + this.editingObj.onPropertyChanged.remove(this.onEditingObjPropertyChanged); + } + this.editingObjValue = val; + if (this.isDisposed) + return; + if (!val) { + var questions = this.getAllQuestions(); + for (var i = 0; i < questions.length; i++) { + questions[i].unbindValue(); + } + } + if (!!this.editingObj) { + this.setDataCore({}); + this.onEditingObjPropertyChanged = function (sender, options) { + if (!_jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].hasOriginalProperty(_this.editingObj, options.name)) + return; + _this.updateOnSetValue(options.name, _this.editingObj[options.name], options.oldValue); + }; + this.editingObj.onPropertyChanged.add(this.onEditingObjPropertyChanged); + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isEditingSurveyElement", { + get: function () { + return !!this.editingObj; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.setCalcuatedValuesIntoResult = function (result) { + for (var i = 0; i < this.calculatedValues.length; i++) { + var calValue = this.calculatedValues[i]; + if (calValue.includeIntoResult && + !!calValue.name && + this.getVariable(calValue.name) !== undefined) { + result[calValue.name] = this.getVariable(calValue.name); + } + } + }; + SurveyModel.prototype.getAllValues = function () { + return this.data; + }; + /** + * Returns survey result data as an array of plain objects: with question `title`, `name`, `value`, and `displayValue`. + * + * For complex questions (like matrix, etc.) `isNode` flag is set to `true` and data contains array of nested objects (rows). + * + * Set `options.includeEmpty` to `false` if you want to skip empty answers. + */ + SurveyModel.prototype.getPlainData = function (options) { + if (!options) { + options = { includeEmpty: true, includeQuestionTypes: false }; + } + var result = []; + this.getAllQuestions().forEach(function (question) { + var resultItem = question.getPlainData(options); + if (!!resultItem) { + result.push(resultItem); + } + }); + return result; + }; + SurveyModel.prototype.getFilteredValues = function () { + var values = {}; + for (var key in this.variablesHash) + values[key] = this.variablesHash[key]; + this.addCalculatedValuesIntoFilteredValues(values); + var keys = this.getValuesKeys(); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + values[key] = this.getDataValueCore(this.valuesHash, key); + } + return values; + }; + SurveyModel.prototype.addCalculatedValuesIntoFilteredValues = function (values) { + var caclValues = this.calculatedValues; + for (var i = 0; i < caclValues.length; i++) + values[caclValues[i].name] = caclValues[i].value; + }; + SurveyModel.prototype.getFilteredProperties = function () { + return { survey: this }; + }; + SurveyModel.prototype.getValuesKeys = function () { + if (!this.editingObj) + return Object.keys(this.valuesHash); + var props = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].getPropertiesByObj(this.editingObj); + var res = []; + for (var i = 0; i < props.length; i++) { + res.push(props[i].name); + } + return res; + }; + SurveyModel.prototype.getDataValueCore = function (valuesHash, key) { + if (!!this.editingObj) + return _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].getObjPropertyValue(this.editingObj, key); + return this.getDataFromValueHash(valuesHash, key); + }; + SurveyModel.prototype.setDataValueCore = function (valuesHash, key, value) { + if (!!this.editingObj) { + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].setObjPropertyValue(this.editingObj, key, value); + } + else { + this.setDataToValueHash(valuesHash, key, value); + } + }; + SurveyModel.prototype.deleteDataValueCore = function (valuesHash, key) { + if (!!this.editingObj) { + this.editingObj[key] = null; + } + else { + this.deleteDataFromValueHash(valuesHash, key); + } + }; + SurveyModel.prototype.getDataFromValueHash = function (valuesHash, key) { + if (!!this.valueHashGetDataCallback) + return this.valueHashGetDataCallback(valuesHash, key); + return valuesHash[key]; + }; + SurveyModel.prototype.setDataToValueHash = function (valuesHash, key, value) { + if (!!this.valueHashSetDataCallback) { + this.valueHashSetDataCallback(valuesHash, key, value); + } + else { + valuesHash[key] = value; + } + }; + SurveyModel.prototype.deleteDataFromValueHash = function (valuesHash, key) { + if (!!this.valueHashDeleteDataCallback) { + this.valueHashDeleteDataCallback(valuesHash, key); + } + else { + delete valuesHash[key]; + } + }; + Object.defineProperty(SurveyModel.prototype, "comments", { + /** + * Returns all comments from the data. + * @see data + */ + get: function () { + var result = {}; + var keys = this.getValuesKeys(); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (key.indexOf(this.commentPrefix) > 0) { + result[key] = this.getDataValueCore(this.valuesHash, key); + } + } + return result; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "visiblePages", { + /** + * Returns a list of visible pages. If all pages are visible, then this property returns the same list as the `pages` property. + * @see pages + * @see PageModel.visible + * @see PageModel.visibleIf + */ + get: function () { + if (this.isDesignMode) + return this.pages; + var result = new Array(); + for (var i = 0; i < this.pages.length; i++) { + if (this.isPageInVisibleList(this.pages[i])) { + result.push(this.pages[i]); + } + } + return result; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.isPageInVisibleList = function (page) { + return this.isDesignMode || page.isVisible && !page.isStarted; + }; + Object.defineProperty(SurveyModel.prototype, "isEmpty", { + /** + * Returns `true` if the survey contains no pages. The survey is empty. + */ + get: function () { + return this.pages.length == 0; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "PageCount", { + /** + * Deprecated. Use the `pageCount` property instead. + */ + get: function () { + return this.pageCount; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "pageCount", { + /** + * Returns the survey page count. + * @see visiblePageCount + * @see pages + */ + get: function () { + return this.pages.length; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "visiblePageCount", { + /** + * Returns a number of visible pages within the survey. + * @see pageCount + * @see visiblePages + */ + get: function () { + return this.visiblePages.length; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "startedPage", { + /** + * Returns the started page. This property works if the `firstPageIsStarted` property is set to `true`. + * @see firstPageIsStarted + */ + get: function () { + var page = this.firstPageIsStarted && this.pages.length > 0 ? this.pages[0] : null; + if (!!page) { + page.onFirstRendering(); + page.setWasShown(true); + } + return page; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "currentPage", { + /** + * Gets or sets the current survey page. If a survey is rendered, then this property returns a page that a user can see/edit. + */ + get: function () { + return this.getPropertyValue("currentPage", null); + }, + set: function (value) { + if (this.isLoadingFromJson) + return; + var newPage = this.getPageByObject(value); + if (!!value && !newPage) + return; + if (!newPage && this.isCurrentPageAvailable) + return; + var vPages = this.visiblePages; + if (newPage != null && vPages.indexOf(newPage) < 0) + return; + if (newPage == this.currentPage) + return; + var oldValue = this.currentPage; + if (!this.currentPageChanging(newPage, oldValue)) + return; + this.setPropertyValue("currentPage", newPage); + if (!!newPage) { + newPage.onFirstRendering(); + newPage.updateCustomWidgets(); + newPage.setWasShown(true); + } + this.locStrsChanged(); + this.currentPageChanged(newPage, oldValue); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.updateCurrentPage = function () { + if (this.isCurrentPageAvailable) + return; + this.currentPage = this.firstVisiblePage; + }; + Object.defineProperty(SurveyModel.prototype, "isCurrentPageAvailable", { + get: function () { + var page = this.currentPage; + return !!page && this.isPageInVisibleList(page) && this.isPageExistsInSurvey(page); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.isPageExistsInSurvey = function (page) { + if (this.pages.indexOf(page) > -1) + return true; + return !!this.onContainsPageCallback && this.onContainsPageCallback(page); + }; + Object.defineProperty(SurveyModel.prototype, "activePage", { + /** + * Returns the currentPage, unless the started page is showing. In this case returns the started page. + * @see currentPage + * @see firstPageIsStarted + * @see startedPage + */ + get: function () { + return this.getPropertyValue("activePage"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isShowStartingPage", { + /** + * The started page is showing right now. survey state equals to "starting" + */ + get: function () { + return this.state === "starting"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isShowingPage", { + /** + * Survey is showing a page right now. It is in "running", "preview" or starting state. + */ + get: function () { + return this.state == "running" || this.state == "preview" || this.isShowStartingPage; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.updateActivePage = function () { + var newPage = this.isShowStartingPage ? this.startedPage : this.currentPage; + this.setPropertyValue("activePage", newPage); + }; + SurveyModel.prototype.onStateAndCurrentPageChanged = function () { + this.updateActivePage(); + this.updateButtonsVisibility(); + }; + SurveyModel.prototype.getPageByObject = function (value) { + if (!value) + return null; + if (value.getType && value.getType() == "page") + return value; + if (typeof value === "string" || value instanceof String) + return this.getPageByName(String(value)); + if (!isNaN(value)) { + var index = Number(value); + var vPages = this.visiblePages; + if (value < 0 || value >= vPages.length) + return null; + return vPages[index]; + } + return value; + }; + Object.defineProperty(SurveyModel.prototype, "currentPageNo", { + /** + * The zero-based index of the current page in the visible pages array. + */ + get: function () { + return this.visiblePages.indexOf(this.currentPage); + }, + set: function (value) { + var vPages = this.visiblePages; + if (value < 0 || value >= vPages.length) + return; + this.currentPage = vPages[value]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "questionsOrder", { + /** + * Gets or sets the question display order. Use this property to randomize questions. You can randomize questions on a specific page. + * + * The following options are available: + * + * - `random` - randomize questions + * - `initial` - keep questions in the same order, as in a survey model. + * @see SurveyPage.questionsOrder + */ + get: function () { + return this.getPropertyValue("questionsOrder"); + }, + set: function (val) { + this.setPropertyValue("questionsOrder", val); + }, + enumerable: false, + configurable: true + }); + /** + * Sets the input focus to the first question with the input field. + */ + SurveyModel.prototype.focusFirstQuestion = function () { + if (this.isFocusingQuestion) + return; + var page = this.activePage; + if (page) { + page.scrollToTop(); + page.focusFirstQuestion(); + } + }; + SurveyModel.prototype.scrollToTopOnPageChange = function (doScroll) { + if (doScroll === void 0) { doScroll = true; } + var page = this.activePage; + if (!page) + return; + if (doScroll) { + page.scrollToTop(); + } + if (this.isCurrentPageRendering && this.focusFirstQuestionAutomatic && !this.isFocusingQuestion) { + page.focusFirstQuestion(); + this.isCurrentPageRendering = false; + } + }; + Object.defineProperty(SurveyModel.prototype, "state", { + /** + * Returns the current survey state: + * + * - `loading` - the survey is being loaded from JSON, + * - `empty` - there is nothing to display in the current survey, + * - `starting` - the survey's start page is displayed, + * - `running` - a respondent is answering survey questions right now, + * - `preview` - a respondent is previewing answered questions before submitting the survey (see [example](https://surveyjs.io/Examples/Library?id=survey-showpreview)), + * - `completed` - a respondent has completed the survey and submitted the results. + * + * Details: [Preview State](https://surveyjs.io/Documentation/Library#states) + */ + get: function () { + return this.getPropertyValue("state", "empty"); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.updateState = function () { + this.setPropertyValue("state", this.calcState()); + }; + SurveyModel.prototype.calcState = function () { + if (this.isLoading) + return "loading"; + if (this.isCompleted) + return "completed"; + if (this.isCompletedBefore) + return "completedbefore"; + if (!this.isDesignMode && + this.isEditMode && + this.isStartedState && + this.startedPage) + return "starting"; + if (this.isShowingPreview) + return this.currentPage ? "preview" : "empty"; + return this.currentPage ? "running" : "empty"; + }; + Object.defineProperty(SurveyModel.prototype, "isCompleted", { + get: function () { + return this.getPropertyValue("isCompleted", false); + }, + set: function (val) { + this.setPropertyValue("isCompleted", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isShowingPreview", { + get: function () { + return this.getPropertyValue("isShowingPreview", false); + }, + set: function (val) { + if (this.isShowingPreview == val) + return; + this.setPropertyValue("isShowingPreview", val); + this.onShowingPreviewChanged(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isStartedState", { + get: function () { + return this.getPropertyValue("isStartedState", false); + }, + set: function (val) { + this.setPropertyValue("isStartedState", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isCompletedBefore", { + get: function () { + return this.getPropertyValue("isCompletedBefore", false); + }, + set: function (val) { + this.setPropertyValue("isCompletedBefore", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isLoading", { + get: function () { + return this.getPropertyValue("isLoading", false); + }, + set: function (val) { + this.setPropertyValue("isLoading", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "completedState", { + get: function () { + return this.getPropertyValue("completedState", ""); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "completedStateText", { + get: function () { + return this.getPropertyValue("completedStateText", ""); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.setCompletedState = function (value, text) { + this.setPropertyValue("completedState", value); + if (!text) { + if (value == "saving") + text = this.getLocString("savingData"); + if (value == "error") + text = this.getLocString("savingDataError"); + if (value == "success") + text = this.getLocString("savingDataSuccess"); + } + this.setPropertyValue("completedStateText", text); + this.setPropertyValue("completedStateCss", this.getCompletedStateCss()); + }; + /** + * Clears the survey data and state. If the survey has a `completed` state, it will get a `running` state. + * @param clearData clear the data + * @param gotoFirstPage make the first page as a current page. + * @see data + * @see state + * @see currentPage + */ + SurveyModel.prototype.clear = function (clearData, gotoFirstPage) { + if (clearData === void 0) { clearData = true; } + if (gotoFirstPage === void 0) { gotoFirstPage = true; } + this.isCompleted = false; + this.isCompletedBefore = false; + this.isLoading = false; + if (clearData) { + this.data = null; + this.variablesHash = {}; + } + this.timerModel.spent = 0; + for (var i = 0; i < this.pages.length; i++) { + this.pages[i].timeSpent = 0; + this.pages[i].setWasShown(false); + this.pages[i].passed = false; + } + this.isStartedState = this.firstPageIsStarted; + if (gotoFirstPage) { + this.currentPage = this.firstVisiblePage; + } + if (clearData) { + this.updateValuesWithDefaults(); + } + }; + SurveyModel.prototype.mergeValues = function (src, dest) { + if (!dest || !src) + return; + if (typeof dest !== "object") + return; + for (var key in src) { + var value = src[key]; + if (value && typeof value === "object") { + if (!dest[key] || typeof dest[key] !== "object") + dest[key] = {}; + this.mergeValues(value, dest[key]); + } + else { + dest[key] = value; + } + } + }; + SurveyModel.prototype.updateValuesWithDefaults = function () { + if (this.isDesignMode || this.isLoading) + return; + for (var i = 0; i < this.pages.length; i++) { + var questions = this.pages[i].questions; + for (var j = 0; j < questions.length; j++) { + questions[j].updateValueWithDefaults(); + } + } + }; + SurveyModel.prototype.updateCustomWidgets = function (page) { + if (!page) + return; + page.updateCustomWidgets(); + }; + SurveyModel.prototype.currentPageChanging = function (newValue, oldValue) { + var options = { + oldCurrentPage: oldValue, + newCurrentPage: newValue, + allowChanging: true, + isNextPage: this.isNextPage(newValue, oldValue), + isPrevPage: this.isPrevPage(newValue, oldValue), + }; + this.onCurrentPageChanging.fire(this, options); + if (options.allowChanging) { + this.isCurrentPageRendering = true; + } + return options.allowChanging; + }; + SurveyModel.prototype.currentPageChanged = function (newValue, oldValue) { + var isNextPage = this.isNextPage(newValue, oldValue); + if (isNextPage) { + oldValue.passed = true; + } + this.onCurrentPageChanged.fire(this, { + oldCurrentPage: oldValue, + newCurrentPage: newValue, + isNextPage: isNextPage, + isPrevPage: this.isPrevPage(newValue, oldValue), + }); + }; + SurveyModel.prototype.isNextPage = function (newValue, oldValue) { + if (!newValue || !oldValue) + return false; + return newValue.visibleIndex == oldValue.visibleIndex + 1; + }; + SurveyModel.prototype.isPrevPage = function (newValue, oldValue) { + if (!newValue || !oldValue) + return false; + return newValue.visibleIndex + 1 == oldValue.visibleIndex; + }; + /** + * Returns the progress that a user made while going through the survey. + * It depends from progressBarType property + * @see progressBarType + * @see progressValue + */ + SurveyModel.prototype.getProgress = function () { + if (this.currentPage == null) + return 0; + if (this.progressBarType !== "pages") { + var info = this.getProgressInfo(); + if (this.progressBarType === "requiredQuestions") { + return info.requiredQuestionCount >= 1 + ? Math.ceil((info.requiredAnsweredQuestionCount * 100) / + info.requiredQuestionCount) + : 100; + } + return info.questionCount >= 1 + ? Math.ceil((info.answeredQuestionCount * 100) / info.questionCount) + : 100; + } + var visPages = this.visiblePages; + var index = visPages.indexOf(this.currentPage) + 1; + return Math.ceil((index * 100) / visPages.length); + }; + Object.defineProperty(SurveyModel.prototype, "progressValue", { + /** + * Returns the progress that a user made while going through the survey. + * It depends from progressBarType property + * @see progressBarType + */ + get: function () { + return this.getPropertyValue("progressValue", 0); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isNavigationButtonsShowing", { + /** + * Returns the navigation buttons (i.e., 'Prev', 'Next', or 'Complete' and 'Preview') position. + */ + get: function () { + if (this.isDesignMode) + return "none"; + var page = this.currentPage; + if (!page) + return "none"; + if (page.navigationButtonsVisibility === "show") { + return "bottom"; + } + if (page.navigationButtonsVisibility === "hide") { + return "none"; + } + return this.showNavigationButtons; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isNavigationButtonsShowingOnTop", { + /** + * Returns true if the navigation buttons (i.e., 'Prev', 'Next', or 'Complete' and 'Preview') are shows on top. + */ + get: function () { + return this.getIsNavigationButtonsShowingOn("top"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isNavigationButtonsShowingOnBottom", { + /** + * Returns true if the navigation buttons (i.e., 'Prev', 'Next', or 'Complete' and 'Preview') are shows on bottom. + */ + get: function () { + return this.getIsNavigationButtonsShowingOn("bottom"); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.getIsNavigationButtonsShowingOn = function (buttonPosition) { + var res = this.isNavigationButtonsShowing; + return res == "both" || res == buttonPosition; + }; + Object.defineProperty(SurveyModel.prototype, "isEditMode", { + /** + * Returns `true` if the survey is in edit mode. + * @see mode + */ + get: function () { + return this.mode == "edit"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isDisplayMode", { + /** + * Returns `true` if the survey is in display mode or in preview mode. + * @see mode + * @see showPreviewBeforeComplete + */ + get: function () { + return this.mode == "display" || this.state == "preview"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isUpdateValueTextOnTyping", { + get: function () { + return this.textUpdateMode == "onTyping"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isDesignMode", { + /** + * Returns `true` if the survey is in design mode. It is used by SurveyJS Editor. + * @see setDesignMode + */ + get: function () { + return this._isDesignMode; + }, + enumerable: false, + configurable: true + }); + /** + * Sets the survey into design mode. + * @param value use true to set the survey into the design mode. + */ + SurveyModel.prototype.setDesignMode = function (value) { + this._isDesignMode = value; + this.onQuestionsOnPageModeChanged("standard"); + }; + Object.defineProperty(SurveyModel.prototype, "showInvisibleElements", { + /** + * Gets or sets whether to show all elements in the survey, regardless their visibility. The default value is `false`. + */ + get: function () { + return this.getPropertyValue("showInvisibleElements", false); + }, + set: function (val) { + var visPages = this.visiblePages; + this.setPropertyValue("showInvisibleElements", val); + if (this.isLoadingFromJson) + return; + this.runConditions(); + this.updateAllElementsVisibility(visPages); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.updateAllElementsVisibility = function (visPages) { + for (var i = 0; i < this.pages.length; i++) { + var page = this.pages[i]; + page.updateElementVisibility(); + if (visPages.indexOf(page) > -1 != page.isVisible) { + this.onPageVisibleChanged.fire(this, { + page: page, + visible: page.isVisible, + }); + } + } + }; + Object.defineProperty(SurveyModel.prototype, "areInvisibleElementsShowing", { + get: function () { + return this.isDesignMode || this.showInvisibleElements; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "areEmptyElementsHidden", { + get: function () { + return (this.isShowingPreview && + this.showPreviewBeforeComplete == "showAnsweredQuestions"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "hasCookie", { + /** + * Returns `true`, if a user has already completed the survey in this browser and there is a cookie about it. Survey goes to `completed` state if the function returns `true`. + * @see cookieName + * @see setCookie + * @see deleteCookie + * @see state + */ + get: function () { + if (!this.cookieName || typeof document === "undefined") + return false; + var cookies = document.cookie; + return cookies && cookies.indexOf(this.cookieName + "=true") > -1; + }, + enumerable: false, + configurable: true + }); + /** + * Set the cookie with `cookieName` in user's browser. It is done automatically on survey complete if the `cookieName` property value is not empty. + * @see cookieName + * @see hasCookie + * @see deleteCookie + */ + SurveyModel.prototype.setCookie = function () { + if (!this.cookieName || typeof document === "undefined") + return; + document.cookie = + this.cookieName + "=true; expires=Fri, 31 Dec 9999 0:0:0 GMT"; + }; + /** + * Deletes the cookie with `cookieName` from the browser. + * @see cookieName + * @see hasCookie + * @see setCookie + */ + SurveyModel.prototype.deleteCookie = function () { + if (!this.cookieName) + return; + document.cookie = this.cookieName + "=;"; + }; + /** + * Navigates user to the next page. + * + * Returns `false` in the following cases: + * + * - if the current page is the last page. + * - if the current page contains errors (for example, a required question is empty). + * @see isCurrentPageHasErrors + * @see prevPage + * @see completeLastPage + */ + SurveyModel.prototype.nextPage = function () { + if (this.isLastPage) + return false; + return this.doCurrentPageComplete(false); + }; + SurveyModel.prototype.hasErrorsOnNavigate = function (doComplete) { + var _this = this; + if (this.ignoreValidation || !this.isEditMode) + return false; + var func = function (hasErrors) { + if (!hasErrors) { + _this.doCurrentPageCompleteCore(doComplete); + } + }; + if (this.checkErrorsMode === "onComplete") { + if (!this.isLastPage) + return false; + return this.hasErrors(true, true, func) !== false; + } + return this.hasCurrentPageErrors(func) !== false; + }; + SurveyModel.prototype.checkForAsyncQuestionValidation = function (questions, func) { + var _this = this; + this.clearAsyncValidationQuesitons(); + var _loop_2 = function () { + if (questions[i].isRunningValidators) { + var q_1 = questions[i]; + q_1.onCompletedAsyncValidators = function (hasErrors) { + _this.onCompletedAsyncQuestionValidators(q_1, func, hasErrors); + }; + this_2.asyncValidationQuesitons.push(questions[i]); + } + }; + var this_2 = this; + for (var i = 0; i < questions.length; i++) { + _loop_2(); + } + return this.asyncValidationQuesitons.length > 0; + }; + SurveyModel.prototype.clearAsyncValidationQuesitons = function () { + if (!!this.asyncValidationQuesitons) { + var asynQuestions = this.asyncValidationQuesitons; + for (var i = 0; i < asynQuestions.length; i++) { + asynQuestions[i].onCompletedAsyncValidators = null; + } + } + this.asyncValidationQuesitons = []; + }; + SurveyModel.prototype.onCompletedAsyncQuestionValidators = function (question, func, hasErrors) { + if (hasErrors) { + this.clearAsyncValidationQuesitons(); + func(true); + if (this.focusOnFirstError && !!question && !!question.page && question.page === this.currentPage) { + var questions = this.currentPage.questions; + for (var i_1 = 0; i_1 < questions.length; i_1++) { + if (questions[i_1] !== question && questions[i_1].errors.length > 0) + return; + } + question.focus(true); + } + return; + } + var asynQuestions = this.asyncValidationQuesitons; + for (var i = 0; i < asynQuestions.length; i++) { + if (asynQuestions[i].isRunningValidators) + return; + } + func(false); + }; + Object.defineProperty(SurveyModel.prototype, "isCurrentPageHasErrors", { + /** + * Returns `true`, if the current page contains errors, for example, the required question is empty or a question validation is failed. + * @see nextPage + */ + get: function () { + return this.checkIsCurrentPageHasErrors(); + }, + enumerable: false, + configurable: true + }); + /** + * Returns `true`, if the current page contains any error. If there is an async function in an expression, then the function will return `undefined` value. + * In this case, you should use `onAsyncValidation` parameter, which is a callback function: (hasErrors: boolean) => void + * @param onAsyncValidation use this parameter if you use async functions in your expressions. This callback function will be called with hasErrors value equals to `true` or `false`. + * @see hasPageErrors + * @see hasErrors + * @see currentPage + */ + SurveyModel.prototype.hasCurrentPageErrors = function (onAsyncValidation) { + return this.hasPageErrors(undefined, onAsyncValidation); + }; + /** + * Returns `true`, if a page contains an error. If there is an async function in an expression, then the function will return `undefined` value. + * In this case, you should use the second `onAsyncValidation` parameter, which is a callback function: (hasErrors: boolean) => void + * @param page the page that you want to validate. If the parameter is undefined then the `activePage` is using + * @param onAsyncValidation use this parameter if you use async functions in your expressions. This callback function will be called with hasErrors value equals to `true` or `false`. + * @see hasCurrentPageErrors + * @see hasErrors + * @see activePage + * @see currentPage + */ + SurveyModel.prototype.hasPageErrors = function (page, onAsyncValidation) { + if (!page) { + page = this.activePage; + } + if (!page) + return false; + if (this.checkIsPageHasErrors(page)) + return true; + if (!onAsyncValidation) + return false; + return this.checkForAsyncQuestionValidation(page.questions, function (hasErrors) { return onAsyncValidation(hasErrors); }) + ? undefined + : false; + }; + /** + * Returns `true`, if any of the survey pages contains errors. If there is an async function in an expression, then the function will return `undefined` value. + * In this case, you should use the third `onAsyncValidation` parameter, which is a callback function: (hasErrors: boolean) => void + * @param fireCallback set it to `true`, to show errors in UI. + * @param focusOnFirstError set it to `true` to focus on the first question that doesn't pass the validation and make the page, where the question is located, the current. + * @param onAsyncValidation use this parameter if you use async functions in your expressions. This callback function will be called with hasErrors value equals to `true` or `false`. + * @see hasCurrentPageErrors + * @see hasPageErrors + */ + SurveyModel.prototype.hasErrors = function (fireCallback, focusOnFirstError, onAsyncValidation) { + if (fireCallback === void 0) { fireCallback = true; } + if (focusOnFirstError === void 0) { focusOnFirstError = false; } + if (!!onAsyncValidation) { + fireCallback = true; + } + var visPages = this.visiblePages; + var firstErrorPage = null; + var res = false; + for (var i = 0; i < visPages.length; i++) { + if (visPages[i].hasErrors(fireCallback, false)) { + if (!firstErrorPage) + firstErrorPage = visPages[i]; + res = true; + } + } + if (focusOnFirstError && !!firstErrorPage) { + this.currentPage = firstErrorPage; + var questions = firstErrorPage.questions; + for (var i = 0; i < questions.length; i++) { + if (questions[i].errors.length > 0) { + questions[i].focus(true); + break; + } + } + } + if (res || !onAsyncValidation) + return res; + return this.checkForAsyncQuestionValidation(this.getAllQuestions(), function (hasErrors) { return onAsyncValidation(hasErrors); }) + ? undefined + : false; + }; + /** + * Checks whether survey elements (pages, panels, and questions) have unique question names. + * You can check for unique names for individual page and panel (and all their elements) or a question. + * If the parameter is not specified, then a survey checks that all its elements have unique names. + * @param element page, panel or question, it is `null` by default, that means all survey elements will be checked + */ + SurveyModel.prototype.ensureUniqueNames = function (element) { + if (element === void 0) { element = null; } + if (element == null) { + for (var i = 0; i < this.pages.length; i++) { + this.ensureUniqueName(this.pages[i]); + } + } + else { + this.ensureUniqueName(element); + } + }; + SurveyModel.prototype.ensureUniqueName = function (element) { + if (element.isPage) { + this.ensureUniquePageName(element); + } + if (element.isPanel) { + this.ensureUniquePanelName(element); + } + if (element.isPage || element.isPanel) { + var elements = element.elements; + for (var i = 0; i < elements.length; i++) { + this.ensureUniqueNames(elements[i]); + } + } + else { + this.ensureUniqueQuestionName(element); + } + }; + SurveyModel.prototype.ensureUniquePageName = function (element) { + var _this = this; + return this.ensureUniqueElementName(element, function (name) { + return _this.getPageByName(name); + }); + }; + SurveyModel.prototype.ensureUniquePanelName = function (element) { + var _this = this; + return this.ensureUniqueElementName(element, function (name) { + return _this.getPanelByName(name); + }); + }; + SurveyModel.prototype.ensureUniqueQuestionName = function (element) { + var _this = this; + return this.ensureUniqueElementName(element, function (name) { + return _this.getQuestionByName(name); + }); + }; + SurveyModel.prototype.ensureUniqueElementName = function (element, getElementByName) { + var existingElement = getElementByName(element.name); + if (!existingElement || existingElement == element) + return; + var newName = this.getNewName(element.name); + while (!!getElementByName(newName)) { + var newName = this.getNewName(element.name); + } + element.name = newName; + }; + SurveyModel.prototype.getNewName = function (name) { + var pos = name.length; + while (pos > 0 && name[pos - 1] >= "0" && name[pos - 1] <= "9") { + pos--; + } + var base = name.substr(0, pos); + var num = 0; + if (pos < name.length) { + num = parseInt(name.substr(pos)); + } + num++; + return base + num; + }; + SurveyModel.prototype.checkIsCurrentPageHasErrors = function (isFocuseOnFirstError) { + if (isFocuseOnFirstError === void 0) { isFocuseOnFirstError = undefined; } + return this.checkIsPageHasErrors(this.activePage, isFocuseOnFirstError); + }; + SurveyModel.prototype.checkIsPageHasErrors = function (page, isFocuseOnFirstError) { + if (isFocuseOnFirstError === void 0) { isFocuseOnFirstError = undefined; } + if (isFocuseOnFirstError === undefined) { + isFocuseOnFirstError = this.focusOnFirstError; + } + if (!page) + return true; + var res = page.hasErrors(true, isFocuseOnFirstError); + this.fireValidatedErrorsOnPage(page); + return res; + }; + SurveyModel.prototype.fireValidatedErrorsOnPage = function (page) { + if (this.onValidatedErrorsOnCurrentPage.isEmpty || !page) + return; + var questionsOnPage = page.questions; + var questions = new Array(); + var errors = new Array(); + for (var i = 0; i < questionsOnPage.length; i++) { + var q = questionsOnPage[i]; + if (q.errors.length > 0) { + questions.push(q); + for (var j = 0; j < q.errors.length; j++) { + errors.push(q.errors[j]); + } + } + } + this.onValidatedErrorsOnCurrentPage.fire(this, { + questions: questions, + errors: errors, + page: page, + }); + }; + /** + * Navigates user to a previous page. If the current page is the first page, `prevPage` returns `false`. `prevPage` does not perform any checks, required questions can be empty. + * @see isFirstPage + */ + SurveyModel.prototype.prevPage = function () { + if (this.isFirstPage || this.state === "starting") + return false; + this.resetNavigationButton(); + var vPages = this.visiblePages; + var index = vPages.indexOf(this.currentPage); + this.currentPage = vPages[index - 1]; + return true; + }; + /** + * Completes the survey, if the current page is the last one. It returns `false` if the last page has errors. + * If the last page has no errors, `completeLastPage` calls `doComplete` and returns `true`. + * @see isCurrentPageHasErrors + * @see nextPage + * @see doComplete + */ + SurveyModel.prototype.completeLastPage = function () { + var res = this.doCurrentPageComplete(true); + if (res) { + this.cancelPreview(); + } + return res; + }; + SurveyModel.prototype.navigationMouseDown = function () { + this.isNavigationButtonPressed = true; + return true; + }; + SurveyModel.prototype.resetNavigationButton = function () { + this.isNavigationButtonPressed = false; + }; + SurveyModel.prototype.nextPageUIClick = function () { + if (!!this.mouseDownPage && this.mouseDownPage !== this.activePage) + return; + this.mouseDownPage = null; + this.nextPage(); + }; + SurveyModel.prototype.nextPageMouseDown = function () { + this.mouseDownPage = this.activePage; + return this.navigationMouseDown(); + }; + /** + * Shows preview for the survey. Switches the survey to the "preview" state. + * + * Details: [Preview State](https://surveyjs.io/Documentation/Library#states-preview) + * @see showPreviewBeforeComplete + * @see cancelPreview + * @see state + * @see previewText + * @see editText + */ + SurveyModel.prototype.showPreview = function () { + this.resetNavigationButton(); + if (this.hasErrorsOnNavigate(true)) + return false; + if (this.doServerValidation(true, true)) + return false; + this.showPreviewCore(); + return true; + }; + SurveyModel.prototype.showPreviewCore = function () { + var options = { allowShowPreview: true }; + this.onShowingPreview.fire(this, options); + this.isShowingPreview = options.allowShowPreview; + }; + /** + * Cancels preview and switches back to the "running" state. + * + * Details: [Preview State](https://surveyjs.io/Documentation/Library#states-preview) + * @param curPage - A new current page. If the parameter is undefined then the last page becomes the current. + * @see showPreviewBeforeComplete + * @see showPreview + * @see state + */ + SurveyModel.prototype.cancelPreview = function (curPage) { + if (curPage === void 0) { curPage = null; } + if (!this.isShowingPreview) + return; + this.isShowingPreview = false; + if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(curPage) && this.visiblePageCount > 0) { + curPage = this.visiblePageCount - 1; + } + if (curPage !== null) { + this.currentPage = curPage; + } + }; + SurveyModel.prototype.cancelPreviewByPage = function (panel) { + this.cancelPreview(panel["originalPage"]); + }; + SurveyModel.prototype.doCurrentPageComplete = function (doComplete) { + if (this.isValidatingOnServer) + return false; + this.resetNavigationButton(); + if (this.hasErrorsOnNavigate(doComplete)) + return false; + return this.doCurrentPageCompleteCore(doComplete); + }; + SurveyModel.prototype.doCurrentPageCompleteCore = function (doComplete) { + if (this.doServerValidation(doComplete)) + return false; + if (doComplete) { + this.currentPage.passed = true; + return this.doComplete(); + } + this.doNextPage(); + return true; + }; + Object.defineProperty(SurveyModel.prototype, "isSinglePage", { + /** + * Obsolete. Use the `questionsOnPageMode` property instead. + * @see questionsOnPageMode + */ + get: function () { + return this.questionsOnPageMode == "singlePage"; + }, + set: function (val) { + this.questionsOnPageMode = val ? "singlePage" : "standard"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "questionsOnPageMode", { + /** + * Gets or sets a value that specifies how the survey combines questions, panels, and pages. + * + * The following options are available: + * + * - `singlePage` - combine all survey pages in a single page. Pages will be converted to panels. + * - `questionPerPage` - show one question per page. Survey will create a separate page for every question. + */ + get: function () { + return this.getPropertyValue("questionsOnPageMode"); + }, + set: function (val) { + this.setPropertyValue("questionsOnPageMode", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "firstPageIsStarted", { + /** + * Gets or sets whether the first survey page is a start page. Set this property to `true`, to make the first page a starting page. + * An end user cannot navigate to the start page and the start page does not affect a survey progress. + */ + get: function () { + return this.getPropertyValue("firstPageIsStarted", false); + }, + set: function (val) { + this.setPropertyValue("firstPageIsStarted", val); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.isPageStarted = function (page) { + return (this.firstPageIsStarted && this.pages.length > 0 && this.pages[0] === page); + }; + Object.defineProperty(SurveyModel.prototype, "showPreviewBeforeComplete", { + /** + * Set this property to "showAllQuestions" or "showAnsweredQuestions" to allow respondents to preview answers before submitting the survey results. + * + * Details: [Preview State](https://surveyjs.io/Documentation/Library#states-preview) + * Example: [Show Preview Before Complete](https://surveyjs.io/Examples/Library?id=survey-showpreview) + * @see showPreview + * @see cancelPreview + * @see state + * @see previewText + * @see editText + */ + get: function () { + return this.getPropertyValue("showPreviewBeforeComplete"); + }, + set: function (val) { + this.setPropertyValue("showPreviewBeforeComplete", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isShowPreviewBeforeComplete", { + get: function () { + var preview = this.showPreviewBeforeComplete; + return preview == "showAllQuestions" || preview == "showAnsweredQuestions"; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.onFirstPageIsStartedChanged = function () { + if (this.pages.length == 0) + return; + this.isStartedState = this.firstPageIsStarted; + this.pageVisibilityChanged(this.pages[0], !this.firstPageIsStarted); + }; + SurveyModel.prototype.onShowingPreviewChanged = function () { + if (this.isDesignMode) + return; + if (this.isShowingPreview) { + this.runningPages = this.pages.slice(0, this.pages.length); + this.setupPagesForPageModes(true); + } + else { + if (this.runningPages) { + this.restoreOrigionalPages(this.runningPages); + } + this.runningPages = undefined; + } + this.runConditions(); + this.updateAllElementsVisibility(this.pages); + this.updateVisibleIndexes(); + this.currentPageNo = 0; + }; + SurveyModel.prototype.onQuestionsOnPageModeChanged = function (oldValue) { + if (this.isShowingPreview) + return; + if (this.questionsOnPageMode == "standard" || this.isDesignMode) { + if (this.origionalPages) { + this.restoreOrigionalPages(this.origionalPages); + } + this.origionalPages = undefined; + } + else { + if (!oldValue || oldValue == "standard") { + this.origionalPages = this.pages.slice(0, this.pages.length); + } + this.setupPagesForPageModes(this.isSinglePage); + } + this.runConditions(); + this.updateVisibleIndexes(); + }; + SurveyModel.prototype.restoreOrigionalPages = function (originalPages) { + this.questionHashesClear(); + this.pages.splice(0, this.pages.length); + for (var i = 0; i < originalPages.length; i++) { + this.pages.push(originalPages[i]); + } + }; + SurveyModel.prototype.setupPagesForPageModes = function (isSinglePage) { + this.questionHashesClear(); + var startIndex = this.firstPageIsStarted ? 1 : 0; + _super.prototype.startLoadingFromJson.call(this); + var newPages = this.createPagesForQuestionOnPageMode(isSinglePage, startIndex); + var deletedLen = this.pages.length - startIndex; + this.pages.splice(startIndex, deletedLen); + for (var i = 0; i < newPages.length; i++) { + this.pages.push(newPages[i]); + } + _super.prototype.endLoadingFromJson.call(this); + for (var i = 0; i < newPages.length; i++) { + newPages[i].setSurveyImpl(this, true); + } + this.doElementsOnLoad(); + this.updateCurrentPage(); + }; + SurveyModel.prototype.createPagesForQuestionOnPageMode = function (isSinglePage, startIndex) { + if (isSinglePage) { + return [this.createSinglePage(startIndex)]; + } + return this.createPagesForEveryQuestion(startIndex); + }; + SurveyModel.prototype.createSinglePage = function (startIndex) { + var single = this.createNewPage("all"); + single.setSurveyImpl(this); + for (var i = startIndex; i < this.pages.length; i++) { + var page = this.pages[i]; + var panel = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass("panel"); + panel.originalPage = page; + single.addPanel(panel); + var json = new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"]().toJsonObject(page); + new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"]().toObject(json, panel); + if (!this.showPageTitles) { + panel.title = ""; + } + } + return single; + }; + SurveyModel.prototype.createPagesForEveryQuestion = function (startIndex) { + var res = []; + for (var i = startIndex; i < this.pages.length; i++) { + var originalPage = this.pages[i]; + // Initialize randomization + originalPage.setWasShown(true); + for (var j = 0; j < originalPage.elements.length; j++) { + var originalElement = originalPage.elements[j]; + var element = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass(originalElement.getType()); + if (!element) + continue; + var jsonObj = new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"](); + //Deserialize page properties only, excluding elements + jsonObj.lightSerializing = true; + var pageJson = jsonObj.toJsonObject(originalPage); + var page = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass(originalPage.getType()); + page.fromJSON(pageJson); + page.name = originalElement.name; + page.setSurveyImpl(this); + res.push(page); + var json = new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"]().toJsonObject(originalElement); + new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"]().toObject(json, element); + page.addElement(element); + for (var k = 0; k < page.questions.length; k++) { + this.questionHashesAdded(page.questions[k]); + } + } + } + return res; + }; + Object.defineProperty(SurveyModel.prototype, "isFirstPage", { + /** + * Gets whether the current page is the first one. + */ + get: function () { + return this.getPropertyValue("isFirstPage"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isLastPage", { + /** + * Gets whether the current page is the last one. + */ + get: function () { + return this.getPropertyValue("isLastPage"); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.updateButtonsVisibility = function () { + this.updateIsFirstLastPageState(); + this.setPropertyValue("isShowPrevButton", this.calcIsShowPrevButton()); + this.setPropertyValue("isShowNextButton", this.calcIsShowNextButton()); + this.setPropertyValue("isCompleteButtonVisible", this.calcIsCompleteButtonVisible()); + this.setPropertyValue("isPreviewButtonVisible", this.calcIsPreviewButtonVisible()); + this.setPropertyValue("isCancelPreviewButtonVisible", this.calcIsCancelPreviewButtonVisible()); + }; + Object.defineProperty(SurveyModel.prototype, "isShowPrevButton", { + get: function () { + return this.getPropertyValue("isShowPrevButton"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isShowNextButton", { + get: function () { + return this.getPropertyValue("isShowNextButton"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isCompleteButtonVisible", { + get: function () { + return this.getPropertyValue("isCompleteButtonVisible"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isPreviewButtonVisible", { + get: function () { + return this.getPropertyValue("isPreviewButtonVisible"); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isCancelPreviewButtonVisible", { + get: function () { + return this.getPropertyValue("isCancelPreviewButtonVisible"); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.updateIsFirstLastPageState = function () { + var curPage = this.currentPage; + this.setPropertyValue("isFirstPage", !!curPage && curPage === this.firstVisiblePage); + this.setPropertyValue("isLastPage", !!curPage && curPage === this.lastVisiblePage); + }; + SurveyModel.prototype.calcIsShowPrevButton = function () { + if (this.isFirstPage || !this.showPrevButton || this.state !== "running") + return false; + var page = this.visiblePages[this.currentPageNo - 1]; + return this.getPageMaxTimeToFinish(page) <= 0; + }; + SurveyModel.prototype.calcIsShowNextButton = function () { + return this.state === "running" && !this.isLastPage; + }; + SurveyModel.prototype.calcIsCompleteButtonVisible = function () { + var state = this.state; + return this.isEditMode && (this.state === "running" && this.isLastPage && !this.isShowPreviewBeforeComplete || state === "preview"); + }; + SurveyModel.prototype.calcIsPreviewButtonVisible = function () { + return (this.isEditMode && + this.isShowPreviewBeforeComplete && + this.state == "running" && this.isLastPage); + }; + SurveyModel.prototype.calcIsCancelPreviewButtonVisible = function () { + return (this.isEditMode && + this.isShowPreviewBeforeComplete && + this.state == "preview"); + }; + Object.defineProperty(SurveyModel.prototype, "firstVisiblePage", { + get: function () { + var pages = this.pages; + for (var i = 0; i < pages.length; i++) { + if (this.isPageInVisibleList(pages[i])) + return pages[i]; + } + return null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "lastVisiblePage", { + get: function () { + var pages = this.pages; + for (var i = pages.length - 1; i >= 0; i--) { + if (this.isPageInVisibleList(pages[i])) + return pages[i]; + } + return null; + }, + enumerable: false, + configurable: true + }); + /** + * Completes the survey. + * + * Calling this function performs the following tasks: + * + * - writes cookie if the `cookieName` property is not empty + * - sets the survey into `completed` state + * - fires the `onComplete` event + * - calls `sendResult` function. + * + * Calling the `doComplete` function does not perform any validation, unlike the `completeLastPage` function. + * The function can return false, if you set options.allowComplete to false in onCompleting event. Otherwise it returns true. + * It calls `navigateToUrl` after calling `onComplete` event. + * In case calling `options.showDataSaving` callback in the `onComplete` event, `navigateToUrl` is used on calling `options.showDataSavingSuccess` callback. + * @see completeLastPage + * @see onCompleting + * @see cookieName + * @see state + * @see onComplete + * @see surveyPostId + * @see completeLastPage + * @see navigateToUrl + * @see navigateToUrlOnCondition + */ + SurveyModel.prototype.doComplete = function (isCompleteOnTrigger) { + if (isCompleteOnTrigger === void 0) { isCompleteOnTrigger = false; } + var onCompletingOptions = { + allowComplete: true, + isCompleteOnTrigger: isCompleteOnTrigger, + }; + this.onCompleting.fire(this, onCompletingOptions); + if (!onCompletingOptions.allowComplete) { + this.isCompleted = false; + return false; + } + var previousCookie = this.hasCookie; + this.stopTimer(); + this.setCompleted(); + this.clearUnusedValues(); + this.setCookie(); + var self = this; + var savingDataStarted = false; + var onCompleteOptions = { + isCompleteOnTrigger: isCompleteOnTrigger, + showDataSaving: function (text) { + savingDataStarted = true; + self.setCompletedState("saving", text); + }, + showDataSavingError: function (text) { + self.setCompletedState("error", text); + }, + showDataSavingSuccess: function (text) { + self.setCompletedState("success", text); + self.navigateTo(); + }, + showDataSavingClear: function (text) { + self.setCompletedState("", ""); + }, + }; + this.onComplete.fire(this, onCompleteOptions); + if (!previousCookie && this.surveyPostId) { + this.sendResult(); + } + if (!savingDataStarted) { + this.navigateTo(); + } + return true; + }; + /** + * Starts the survey. Changes the survey mode from "starting" to "running". Call this function if your survey has a start page, otherwise this function does nothing. + * @see firstPageIsStarted + */ + SurveyModel.prototype.start = function () { + if (!this.firstPageIsStarted) + return false; + if (this.checkIsPageHasErrors(this.startedPage, true)) + return false; + this.isStartedState = false; + this.startTimerFromUI(); + this.onStarted.fire(this, {}); + this.updateVisibleIndexes(); + if (!!this.currentPage) { + this.currentPage.locStrsChanged(); + } + return true; + }; + Object.defineProperty(SurveyModel.prototype, "isValidatingOnServer", { + /** + * Gets whether the question values on the current page are validating on the server at the current moment. + * @see onServerValidateQuestions + */ + get: function () { + return this.getPropertyValue("isValidatingOnServer", false); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.setIsValidatingOnServer = function (val) { + if (val == this.isValidatingOnServer) + return; + this.setPropertyValue("isValidatingOnServer", val); + this.onIsValidatingOnServerChanged(); + }; + SurveyModel.prototype.onIsValidatingOnServerChanged = function () { }; + SurveyModel.prototype.doServerValidation = function (doComplete, isPreview) { + if (isPreview === void 0) { isPreview = false; } + if (!this.onServerValidateQuestions || + this.onServerValidateQuestions.isEmpty) + return false; + if (!doComplete && this.checkErrorsMode === "onComplete") + return false; + var self = this; + var options = { + data: {}, + errors: {}, + survey: this, + complete: function () { + self.completeServerValidation(options, isPreview); + }, + }; + if (doComplete && this.checkErrorsMode === "onComplete") { + options.data = this.data; + } + else { + var questions = this.activePage.questions; + for (var i = 0; i < questions.length; i++) { + var question = questions[i]; + if (!question.visible) + continue; + var value = this.getValue(question.getValueName()); + if (!this.isValueEmpty(value)) + options.data[question.getValueName()] = value; + } + } + this.setIsValidatingOnServer(true); + if (typeof this.onServerValidateQuestions === "function") { + this.onServerValidateQuestions(this, options); + } + else { + this.onServerValidateQuestions.fire(this, options); + } + return true; + }; + SurveyModel.prototype.completeServerValidation = function (options, isPreview) { + this.setIsValidatingOnServer(false); + if (!options && !options.survey) + return; + var self = options.survey; + var hasErrors = false; + if (options.errors) { + var hasToFocus = this.focusOnFirstError; + for (var name in options.errors) { + var question = self.getQuestionByName(name); + if (question && question["errors"]) { + hasErrors = true; + question.addError(new _error__WEBPACK_IMPORTED_MODULE_9__["CustomError"](options.errors[name], this)); + if (hasToFocus) { + hasToFocus = false; + if (!!question.page) { + this.currentPage = question.page; + } + question.focus(true); + } + } + } + this.fireValidatedErrorsOnPage(this.currentPage); + } + if (!hasErrors) { + if (isPreview) { + this.showPreviewCore(); + } + else { + if (self.isLastPage) + self.doComplete(); + else + self.doNextPage(); + } + } + }; + SurveyModel.prototype.doNextPage = function () { + var curPage = this.currentPage; + this.checkOnPageTriggers(); + if (!this.isCompleted) { + if (this.sendResultOnPageNext) { + this.sendResult(this.surveyPostId, this.clientId, true); + } + if (curPage === this.currentPage) { + var vPages = this.visiblePages; + var index = vPages.indexOf(this.currentPage); + this.currentPage = vPages[index + 1]; + } + } + else { + this.doComplete(true); + } + }; + SurveyModel.prototype.setCompleted = function () { + this.isCompleted = true; + }; + Object.defineProperty(SurveyModel.prototype, "processedCompletedHtml", { + /** + * Returns the HTML content for the complete page. + * @see completedHtml + */ + get: function () { + var html = this.renderedCompletedHtml; + return !!html ? this.processHtml(html) : ""; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "processedCompletedBeforeHtml", { + /** + * Returns the HTML content, that is shown to a user that had completed the survey before. + * @see completedHtml + * @see cookieName + */ + get: function () { + return this.processHtml(this.completedBeforeHtml); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "processedLoadingHtml", { + /** + * Returns the HTML content, that is shows when a survey loads the survey JSON. + */ + get: function () { + return this.processHtml(this.loadingHtml); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.getProgressInfo = function () { + var pages = this.isDesignMode ? this.pages : this.visiblePages; + return _survey_element__WEBPACK_IMPORTED_MODULE_3__["SurveyElement"].getProgressInfoByElements(pages, false); + }; + Object.defineProperty(SurveyModel.prototype, "progressText", { + /** + * Returns the text for the current progress. + */ + get: function () { + var res = this.getPropertyValue("progressText", ""); + if (!res) { + this.updateProgressText(); + res = this.getPropertyValue("progressText", ""); + } + return res; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.updateProgressText = function (onValueChanged) { + if (onValueChanged === void 0) { onValueChanged = false; } + if (this.isCalculatingProgressText) + return; + if (onValueChanged && + this.progressBarType == "pages" && + this.onProgressText.isEmpty) + return; + this.isCalculatingProgressText = true; + this.setPropertyValue("progressText", this.getProgressText()); + this.setPropertyValue("progressValue", this.getProgress()); + this.isCalculatingProgressText = false; + }; + SurveyModel.prototype.getProgressText = function () { + if (!this.isDesignMode && this.currentPage == null) + return ""; + var options = { + questionCount: 0, + answeredQuestionCount: 0, + requiredQuestionCount: 0, + requiredAnsweredQuestionCount: 0, + text: "", + }; + var type = this.progressBarType.toLowerCase(); + if (type === "questions" || + type === "requiredquestions" || + type === "correctquestions" || + !this.onProgressText.isEmpty) { + var info = this.getProgressInfo(); + options.questionCount = info.questionCount; + options.answeredQuestionCount = info.answeredQuestionCount; + options.requiredQuestionCount = info.requiredQuestionCount; + options.requiredAnsweredQuestionCount = + info.requiredAnsweredQuestionCount; + } + options.text = this.getProgressTextCore(options); + this.onProgressText.fire(this, options); + return options.text; + }; + SurveyModel.prototype.getProgressTextCore = function (info) { + var type = this.progressBarType.toLowerCase(); + if (type === "questions") { + return this.getLocString("questionsProgressText")["format"](info.answeredQuestionCount, info.questionCount); + } + if (type === "requiredquestions") { + return this.getLocString("questionsProgressText")["format"](info.requiredAnsweredQuestionCount, info.requiredQuestionCount); + } + if (type === "correctquestions") { + var correctAnswersCount = this.getCorrectedAnswerCount(); + return this.getLocString("questionsProgressText")["format"](correctAnswersCount, info.questionCount); + } + var vPages = this.isDesignMode ? this.pages : this.visiblePages; + var index = vPages.indexOf(this.currentPage) + 1; + return this.getLocString("progressText")["format"](index, vPages.length); + }; + SurveyModel.prototype.getRootCss = function () { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_18__["CssClassBuilder"]().append(this.css.root).append(this.css.rootMobile, this.isMobile).toString(); + }; + SurveyModel.prototype.afterRenderSurvey = function (htmlElement) { + var _this = this; + this.destroyResizeObserver(); + if (Array.isArray(htmlElement)) { + htmlElement = _survey_element__WEBPACK_IMPORTED_MODULE_3__["SurveyElement"].GetFirstNonTextElement(htmlElement); + } + var observedElement = htmlElement; + var cssVariables = this.css.variables; + if (!!cssVariables) { + var mobileWidth_1 = Number.parseFloat(window.getComputedStyle(observedElement).getPropertyValue(cssVariables.mobileWidth)); + if (!!mobileWidth_1) { + var isProcessed_1 = false; + this.resizeObserver = new ResizeObserver(function () { + if (isProcessed_1 || !Object(_utils_utils__WEBPACK_IMPORTED_MODULE_15__["isContainerVisible"])(observedElement)) { + isProcessed_1 = false; + } + else { + isProcessed_1 = _this.processResponsiveness(observedElement.offsetWidth, mobileWidth_1); + } + }); + this.resizeObserver.observe(observedElement); + } + } + this.onAfterRenderSurvey.fire(this, { + survey: this, + htmlElement: htmlElement, + }); + }; + SurveyModel.prototype.processResponsiveness = function (width, mobileWidth) { + var isMobile = width < mobileWidth; + if (this.isMobile === isMobile) { + return false; + } + else { + this.setIsMobile(isMobile); + return true; + } + }; + SurveyModel.prototype.destroyResizeObserver = function () { + if (!!this.resizeObserver) { + this.resizeObserver.disconnect(); + this.resizeObserver = undefined; + } + }; + SurveyModel.prototype.updateQuestionCssClasses = function (question, cssClasses) { + this.onUpdateQuestionCssClasses.fire(this, { + question: question, + cssClasses: cssClasses, + }); + }; + SurveyModel.prototype.updatePanelCssClasses = function (panel, cssClasses) { + this.onUpdatePanelCssClasses.fire(this, { + panel: panel, + cssClasses: cssClasses, + }); + }; + SurveyModel.prototype.updatePageCssClasses = function (page, cssClasses) { + this.onUpdatePageCssClasses.fire(this, { + page: page, + cssClasses: cssClasses, + }); + }; + SurveyModel.prototype.updateChoiceItemCss = function (question, options) { + options.question = question; + this.onUpdateChoiceItemCss.fire(this, options); + }; + SurveyModel.prototype.afterRenderPage = function (htmlElement) { + var _this = this; + if (!this.isDesignMode) { + setTimeout(function () { return _this.scrollToTopOnPageChange(!_this.isFirstPageRendering); }, 1); + } + this.isFirstPageRendering = false; + if (this.onAfterRenderPage.isEmpty) + return; + this.onAfterRenderPage.fire(this, { + page: this.activePage, + htmlElement: htmlElement, + }); + }; + SurveyModel.prototype.afterRenderHeader = function (htmlElement) { + if (this.onAfterRenderHeader.isEmpty) + return; + this.onAfterRenderHeader.fire(this, { + htmlElement: htmlElement, + }); + }; + SurveyModel.prototype.afterRenderQuestion = function (question, htmlElement) { + this.onAfterRenderQuestion.fire(this, { + question: question, + htmlElement: htmlElement, + }); + }; + SurveyModel.prototype.afterRenderQuestionInput = function (question, htmlElement) { + if (this.onAfterRenderQuestionInput.isEmpty) + return; + var id = question.inputId; + if (!!id && htmlElement.id !== id && typeof document !== "undefined") { + var el = document.getElementById(id); + if (!!el) { + htmlElement = el; + } + } + this.onAfterRenderQuestionInput.fire(this, { + question: question, + htmlElement: htmlElement, + }); + }; + SurveyModel.prototype.afterRenderPanel = function (panel, htmlElement) { + this.onAfterRenderPanel.fire(this, { + panel: panel, + htmlElement: htmlElement, + }); + }; + SurveyModel.prototype.whenQuestionFocusIn = function (question) { + this.onFocusInQuestion.fire(this, { + question: question + }); + }; + SurveyModel.prototype.whenPanelFocusIn = function (panel) { + this.onFocusInPanel.fire(this, { + panel: panel + }); + }; + SurveyModel.prototype.rebuildQuestionChoices = function () { + this.getAllQuestions().forEach(function (q) { return q.surveyChoiceItemVisibilityChange(); }); + }; + SurveyModel.prototype.canChangeChoiceItemsVisibility = function () { + return !this.onShowingChoiceItem.isEmpty; + }; + SurveyModel.prototype.getChoiceItemVisibility = function (question, item, val) { + var options = { question: question, item: item, visible: val }; + this.onShowingChoiceItem.fire(this, options); + return options.visible; + }; + SurveyModel.prototype.matrixBeforeRowAdded = function (options) { + this.onMatrixBeforeRowAdded.fire(this, options); + }; + SurveyModel.prototype.matrixRowAdded = function (question, row) { + this.onMatrixRowAdded.fire(this, { question: question, row: row }); + }; + SurveyModel.prototype.getQuestionByValueNameFromArray = function (valueName, name, index) { + var questions = this.getQuestionsByValueName(valueName); + if (!questions) + return; + for (var i = 0; i < questions.length; i++) { + var res = questions[i].getQuestionFromArray(name, index); + if (!!res) + return res; + } + return null; + }; + SurveyModel.prototype.matrixRowRemoved = function (question, rowIndex, row) { + this.onMatrixRowRemoved.fire(this, { + question: question, + rowIndex: rowIndex, + row: row, + }); + }; + SurveyModel.prototype.matrixRowRemoving = function (question, rowIndex, row) { + var options = { + question: question, + rowIndex: rowIndex, + row: row, + allow: true, + }; + this.onMatrixRowRemoving.fire(this, options); + return options.allow; + }; + SurveyModel.prototype.matrixAllowRemoveRow = function (question, rowIndex, row) { + var options = { + question: question, + rowIndex: rowIndex, + row: row, + allow: true, + }; + this.onMatrixAllowRemoveRow.fire(this, options); + return options.allow; + }; + SurveyModel.prototype.matrixCellCreating = function (question, options) { + options.question = question; + this.onMatrixCellCreating.fire(this, options); + }; + SurveyModel.prototype.matrixCellCreated = function (question, options) { + options.question = question; + this.onMatrixCellCreated.fire(this, options); + }; + SurveyModel.prototype.matrixAfterCellRender = function (question, options) { + options.question = question; + this.onMatrixAfterCellRender.fire(this, options); + }; + SurveyModel.prototype.matrixCellValueChanged = function (question, options) { + options.question = question; + this.onMatrixCellValueChanged.fire(this, options); + }; + SurveyModel.prototype.matrixCellValueChanging = function (question, options) { + options.question = question; + this.onMatrixCellValueChanging.fire(this, options); + }; + Object.defineProperty(SurveyModel.prototype, "isValidateOnValueChanging", { + get: function () { + return this.checkErrorsMode === "onValueChanging"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isValidateOnValueChanged", { + get: function () { + return this.checkErrorsMode === "onValueChanged"; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.matrixCellValidate = function (question, options) { + options.question = question; + this.onMatrixCellValidate.fire(this, options); + return options.error ? new _error__WEBPACK_IMPORTED_MODULE_9__["CustomError"](options.error, this) : null; + }; + SurveyModel.prototype.dynamicPanelAdded = function (question) { + if (this.onDynamicPanelAdded.isEmpty) + return; + var panels = question.panels; + var panel = panels[panels.length - 1]; + this.onDynamicPanelAdded.fire(this, { question: question, panel: panel }); + }; + SurveyModel.prototype.dynamicPanelRemoved = function (question, panelIndex, panel) { + var questions = !!panel ? panel.questions : []; + for (var i = 0; i < questions.length; i++) { + questions[i].clearOnDeletingContainer(); + } + this.onDynamicPanelRemoved.fire(this, { + question: question, + panelIndex: panelIndex, + panel: panel, + }); + }; + SurveyModel.prototype.dynamicPanelItemValueChanged = function (question, options) { + options.question = question; + this.onDynamicPanelItemValueChanged.fire(this, options); + }; + SurveyModel.prototype.dragAndDropAllow = function (options) { + options.allow = true; + this.onDragDropAllow.fire(this, options); + return options.allow; + }; + SurveyModel.prototype.elementContentVisibilityChanged = function (element) { + if (this.currentPage) { + this.currentPage.ensureRowsVisibility(); + } + this.onElementContentVisibilityChanged.fire(this, { element: element }); + }; + SurveyModel.prototype.getUpdatedElementTitleActions = function (element, titleActions) { + if (element.isPage) + return this.getUpdatedPageTitleActions(element, titleActions); + if (element.isPanel) + return this.getUpdatedPanelTitleActions(element, titleActions); + return this.getUpdatedQuestionTitleActions(element, titleActions); + }; + SurveyModel.prototype.getUpdatedQuestionTitleActions = function (question, titleActions) { + var options = { + question: question, + titleActions: titleActions, + }; + this.onGetQuestionTitleActions.fire(this, options); + return options.titleActions; + }; + SurveyModel.prototype.getUpdatedPanelTitleActions = function (panel, titleActions) { + var options = { + panel: panel, + titleActions: titleActions, + }; + this.onGetPanelTitleActions.fire(this, options); + return options.titleActions; + }; + SurveyModel.prototype.getUpdatedPageTitleActions = function (page, titleActions) { + var options = { + page: page, + titleActions: titleActions, + }; + this.onGetPageTitleActions.fire(this, options); + return options.titleActions; + }; + SurveyModel.prototype.getUpdatedMatrixRowActions = function (question, row, actions) { + var options = { + question: question, + actions: actions, + row: row, + }; + this.onGetMatrixRowActions.fire(this, options); + return options.actions; + }; + SurveyModel.prototype.scrollElementToTop = function (element, question, page, id) { + var options = { + element: element, + question: question, + page: page, + elementId: id, + cancel: false, + }; + this.onScrollingElementToTop.fire(this, options); + if (!options.cancel) { + _survey_element__WEBPACK_IMPORTED_MODULE_3__["SurveyElement"].ScrollElementToTop(options.elementId); + } + }; + /** + * Uploads a file to server. + * @param question a file question object + * @param name a question name + * @param files files to upload + * @param uploadingCallback a call back function to get the status on uploading the files + */ + SurveyModel.prototype.uploadFiles = function (question, name, files, uploadingCallback) { + if (this.onUploadFiles.isEmpty) { + uploadingCallback("error", files); + } + else { + this.onUploadFiles.fire(this, { + question: question, + name: name, + files: files || [], + callback: uploadingCallback, + }); + } + if (this.surveyPostId) { + this.uploadFilesCore(name, files, uploadingCallback); + } + }; + /** + * Downloads a file from server + * @param name a question name + * @param fileValue a single file question value + * @param callback a call back function to get the status on downloading the file and the downloaded file content + */ + SurveyModel.prototype.downloadFile = function (questionName, fileValue, callback) { + if (this.onDownloadFile.isEmpty) { + !!callback && callback("success", fileValue.content || fileValue); + } + this.onDownloadFile.fire(this, { + name: questionName, + content: fileValue.content || fileValue, + fileValue: fileValue, + callback: callback, + }); + }; + /** + * Clears files from server. + * @param question question + * @param name question name + * @param value file question value + * @param callback call back function to get the status of the clearing operation + */ + SurveyModel.prototype.clearFiles = function (question, name, value, fileName, callback) { + if (this.onClearFiles.isEmpty) { + !!callback && callback("success", value); + } + this.onClearFiles.fire(this, { + question: question, + name: name, + value: value, + fileName: fileName, + callback: callback, + }); + }; + SurveyModel.prototype.updateChoicesFromServer = function (question, choices, serverResult) { + var options = { + question: question, + choices: choices, + serverResult: serverResult, + }; + this.onLoadChoicesFromServer.fire(this, options); + return options.choices; + }; + SurveyModel.prototype.loadedChoicesFromServer = function (question) { + this.locStrsChanged(); + }; + SurveyModel.prototype.createSurveyService = function () { + return new _dxSurveyService__WEBPACK_IMPORTED_MODULE_7__["dxSurveyService"](); + }; + SurveyModel.prototype.uploadFilesCore = function (name, files, uploadingCallback) { + var _this = this; + var responses = []; + files.forEach(function (file) { + if (uploadingCallback) + uploadingCallback("uploading", file); + _this.createSurveyService().sendFile(_this.surveyPostId, file, function (success, response) { + if (success) { + responses.push({ content: response, file: file }); + if (responses.length === files.length) { + if (uploadingCallback) + uploadingCallback("success", responses); + } + } + else { + if (uploadingCallback) + uploadingCallback("error", { + response: response, + file: file, + }); + } + }); + }); + }; + SurveyModel.prototype.getPage = function (index) { + return this.pages[index]; + }; + /** + * Adds an existing page to the survey. + * @param page a newly added page + * @param index - a page index to where insert a page. It is -1 by default and the page will be added into the end. + * @see addNewPage + */ + SurveyModel.prototype.addPage = function (page, index) { + if (index === void 0) { index = -1; } + if (page == null) + return; + if (index < 0 || index >= this.pages.length) { + this.pages.push(page); + } + else { + this.pages.splice(index, 0, page); + } + }; + /** + * Creates a new page and adds it to a survey. Generates a new name if the `name` parameter is not specified. + * @param name a page name + * @param index - a page index to where insert a new page. It is -1 by default and the page will be added into the end. + * @see addPage + */ + SurveyModel.prototype.addNewPage = function (name, index) { + if (name === void 0) { name = null; } + if (index === void 0) { index = -1; } + var page = this.createNewPage(name); + this.addPage(page, index); + return page; + }; + /** + * Removes a page from a survey. + * @param page + */ + SurveyModel.prototype.removePage = function (page) { + var index = this.pages.indexOf(page); + if (index < 0) + return; + this.pages.splice(index, 1); + if (this.currentPage == page) { + this.currentPage = this.pages.length > 0 ? this.pages[0] : null; + } + }; + /** + * Returns a question by its name. + * @param name a question name + * @param caseInsensitive + * @see getQuestionByValueName + */ + SurveyModel.prototype.getQuestionByName = function (name, caseInsensitive) { + if (caseInsensitive === void 0) { caseInsensitive = false; } + if (!name) + return null; + if (caseInsensitive) { + name = name.toLowerCase(); + } + var hash = !!caseInsensitive + ? this.questionHashes.namesInsensitive + : this.questionHashes.names; + var res = hash[name]; + if (!res) + return null; + return res[0]; + }; + /** + * Returns a question by its value name + * @param valueName a question name + * @param caseInsensitive + * @see getQuestionByName + * @see getQuestionsByValueName + * @see Question.valueName + */ + SurveyModel.prototype.getQuestionByValueName = function (valueName, caseInsensitive) { + if (caseInsensitive === void 0) { caseInsensitive = false; } + var res = this.getQuestionsByValueName(valueName, caseInsensitive); + return !!res ? res[0] : null; + }; + /** + * Returns all questions by their valueName. name property is used if valueName property is empty. + * @param valueName a question name + * @param caseInsensitive + * @see getQuestionByName + * @see getQuestionByValueName + * @see Question.valueName + */ + SurveyModel.prototype.getQuestionsByValueName = function (valueName, caseInsensitive) { + if (caseInsensitive === void 0) { caseInsensitive = false; } + var hash = !!caseInsensitive + ? this.questionHashes.valueNamesInsensitive + : this.questionHashes.valueNames; + var res = hash[valueName]; + if (!res) + return null; + return res; + }; + SurveyModel.prototype.getCalculatedValueByName = function (name) { + for (var i = 0; i < this.calculatedValues.length; i++) { + if (name == this.calculatedValues[i].name) + return this.calculatedValues[i]; + } + return null; + }; + /** + * Gets a list of questions by their names. + * @param names an array of question names + * @param caseInsensitive + */ + SurveyModel.prototype.getQuestionsByNames = function (names, caseInsensitive) { + if (caseInsensitive === void 0) { caseInsensitive = false; } + var result = []; + if (!names) + return result; + for (var i = 0; i < names.length; i++) { + if (!names[i]) + continue; + var question = this.getQuestionByName(names[i], caseInsensitive); + if (question) + result.push(question); + } + return result; + }; + /** + * Returns a page on which an element (question or panel) is placed. + * @param element Question or Panel + */ + SurveyModel.prototype.getPageByElement = function (element) { + for (var i = 0; i < this.pages.length; i++) { + var page = this.pages[i]; + if (page.containsElement(element)) + return page; + } + return null; + }; + /** + * Returns a page on which a question is located. + * @param question + */ + SurveyModel.prototype.getPageByQuestion = function (question) { + return this.getPageByElement(question); + }; + /** + * Returns a page by it's name. + * @param name + */ + SurveyModel.prototype.getPageByName = function (name) { + for (var i = 0; i < this.pages.length; i++) { + if (this.pages[i].name == name) + return this.pages[i]; + } + return null; + }; + /** + * Returns a list of pages by their names. + * @param names a list of page names + */ + SurveyModel.prototype.getPagesByNames = function (names) { + var result = []; + if (!names) + return result; + for (var i = 0; i < names.length; i++) { + if (!names[i]) + continue; + var page = this.getPageByName(names[i]); + if (page) + result.push(page); + } + return result; + }; + /** + * Returns a list of all questions in a survey. + * @param visibleOnly set it `true`, if you want to get only visible questions + */ + SurveyModel.prototype.getAllQuestions = function (visibleOnly, includingDesignTime) { + if (visibleOnly === void 0) { visibleOnly = false; } + if (includingDesignTime === void 0) { includingDesignTime = false; } + var result = new Array(); + for (var i = 0; i < this.pages.length; i++) { + this.pages[i].addQuestionsToList(result, visibleOnly, includingDesignTime); + } + return result; + }; + /** + * Returns quiz questions. All visible questions that has input(s) widgets. + * @see getQuizQuestionCount + */ + SurveyModel.prototype.getQuizQuestions = function () { + var result = new Array(); + var startIndex = this.firstPageIsStarted ? 1 : 0; + for (var i = startIndex; i < this.pages.length; i++) { + if (!this.pages[i].isVisible) + continue; + var questions = this.pages[i].questions; + for (var j = 0; j < questions.length; j++) { + var q = questions[j]; + if (q.quizQuestionCount > 0) { + result.push(q); + } + } + } + return result; + }; + /** + * Returns a panel by its name. + * @param name a panel name + * @param caseInsensitive + * @see getQuestionByName + */ + SurveyModel.prototype.getPanelByName = function (name, caseInsensitive) { + if (caseInsensitive === void 0) { caseInsensitive = false; } + var panels = this.getAllPanels(); + if (caseInsensitive) + name = name.toLowerCase(); + for (var i = 0; i < panels.length; i++) { + var panelName = panels[i].name; + if (caseInsensitive) + panelName = panelName.toLowerCase(); + if (panelName == name) + return panels[i]; + } + return null; + }; + /** + * Returns a list of all survey's panels. + */ + SurveyModel.prototype.getAllPanels = function (visibleOnly, includingDesignTime) { + if (visibleOnly === void 0) { visibleOnly = false; } + if (includingDesignTime === void 0) { includingDesignTime = false; } + var result = new Array(); + for (var i = 0; i < this.pages.length; i++) { + this.pages[i].addPanelsIntoList(result, visibleOnly, includingDesignTime); + } + return result; + }; + /** + * Creates and returns a new page, but do not add it into the survey. + * You can use addPage(page) function to add it into survey later. + * @see addPage + * @see addNewPage + */ + SurveyModel.prototype.createNewPage = function (name) { + var page = _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].createClass("page"); + page.name = name; + return page; + }; + SurveyModel.prototype.questionOnValueChanging = function (valueName, newValue) { + if (this.onValueChanging.isEmpty) + return newValue; + var options = { + name: valueName, + question: this.getQuestionByValueName(valueName), + value: this.getUnbindValue(newValue), + oldValue: this.getValue(valueName), + }; + this.onValueChanging.fire(this, options); + return options.value; + }; + SurveyModel.prototype.updateQuestionValue = function (valueName, newValue) { + if (this.isLoadingFromJson) + return; + var questions = this.getQuestionsByValueName(valueName); + if (!!questions) { + for (var i = 0; i < questions.length; i++) { + var qValue = questions[i].value; + if ((qValue === newValue && Array.isArray(qValue) && !!this.editingObj) || + !this.isTwoValueEquals(qValue, newValue)) { + questions[i].updateValueFromSurvey(newValue); + } + } + } + }; + SurveyModel.prototype.checkQuestionErrorOnValueChanged = function (question) { + if (!this.isNavigationButtonPressed && + (this.checkErrorsMode === "onValueChanged" || + question.getAllErrors().length > 0)) { + this.checkQuestionErrorOnValueChangedCore(question); + } + }; + SurveyModel.prototype.checkQuestionErrorOnValueChangedCore = function (question) { + var oldErrorCount = question.getAllErrors().length; + var res = question.hasErrors(true, { + isOnValueChanged: !this.isValidateOnValueChanging, + }); + if (!!question.page && + (oldErrorCount > 0 || question.getAllErrors().length > 0)) { + this.fireValidatedErrorsOnPage(question.page); + } + return res; + }; + SurveyModel.prototype.checkErrorsOnValueChanging = function (valueName, newValue) { + if (this.isLoadingFromJson) + return false; + var questions = this.getQuestionsByValueName(valueName); + if (!questions) + return false; + var res = false; + for (var i = 0; i < questions.length; i++) { + var q = questions[i]; + if (!this.isTwoValueEquals(q.valueForSurvey, newValue)) { + q.value = newValue; + } + if (this.checkQuestionErrorOnValueChangedCore(q)) + res = true; + res = res || q.errors.length > 0; + } + return res; + }; + SurveyModel.prototype.notifyQuestionOnValueChanged = function (valueName, newValue) { + if (this.isLoadingFromJson) + return; + var questions = this.getQuestionsByValueName(valueName); + if (!!questions) { + for (var i = 0; i < questions.length; i++) { + var question = questions[i]; + this.checkQuestionErrorOnValueChanged(question); + question.onSurveyValueChanged(newValue); + this.onValueChanged.fire(this, { + name: valueName, + question: question, + value: newValue, + }); + } + } + else { + this.onValueChanged.fire(this, { + name: valueName, + question: null, + value: newValue, + }); + } + if (this.isDisposed) + return; + this.checkElementsBindings(valueName, newValue); + this.notifyElementsOnAnyValueOrVariableChanged(valueName); + }; + SurveyModel.prototype.checkElementsBindings = function (valueName, newValue) { + this.isRunningElementsBindings = true; + for (var i = 0; i < this.pages.length; i++) { + this.pages[i].checkBindings(valueName, newValue); + } + this.isRunningElementsBindings = false; + if (this.updateVisibleIndexAfterBindings) { + this.updateVisibleIndexes(); + this.updateVisibleIndexAfterBindings = false; + } + }; + SurveyModel.prototype.notifyElementsOnAnyValueOrVariableChanged = function (name) { + if (this.isEndLoadingFromJson === "processing") + return; + if (this.isRunningConditions) { + this.conditionNotifyElementsOnAnyValueOrVariableChanged = true; + return; + } + for (var i = 0; i < this.pages.length; i++) { + this.pages[i].onAnyValueChanged(name); + } + if (!this.isEndLoadingFromJson) { + this.locStrsChanged(); + } + }; + SurveyModel.prototype.updateAllQuestionsValue = function () { + var questions = this.getAllQuestions(); + for (var i = 0; i < questions.length; i++) { + var q = questions[i]; + var valName = q.getValueName(); + q.updateValueFromSurvey(this.getValue(valName)); + if (q.requireUpdateCommentValue) { + q.updateCommentFromSurvey(this.getComment(valName)); + } + } + }; + SurveyModel.prototype.notifyAllQuestionsOnValueChanged = function () { + var questions = this.getAllQuestions(); + for (var i = 0; i < questions.length; i++) { + questions[i].onSurveyValueChanged(this.getValue(questions[i].getValueName())); + } + }; + SurveyModel.prototype.checkOnPageTriggers = function () { + var questions = this.getCurrentPageQuestions(true); + var values = {}; + for (var i = 0; i < questions.length; i++) { + var question = questions[i]; + var name = question.getValueName(); + values[name] = this.getValue(name); + } + this.addCalculatedValuesIntoFilteredValues(values); + this.checkTriggers(values, true); + }; + SurveyModel.prototype.getCurrentPageQuestions = function (includeInvsible) { + if (includeInvsible === void 0) { includeInvsible = false; } + var result = []; + var page = this.currentPage; + if (!page) + return result; + for (var i = 0; i < page.questions.length; i++) { + var question = page.questions[i]; + if ((!includeInvsible && !question.visible) || !question.name) + continue; + result.push(question); + } + return result; + }; + SurveyModel.prototype.checkTriggers = function (key, isOnNextPage) { + if (this.isCompleted || this.triggers.length == 0 || this.isDisplayMode) + return; + if (this.isTriggerIsRunning) { + this.triggerValues = this.getFilteredValues(); + for (var k in key) { + this.triggerKeys[k] = key[k]; + } + return; + } + this.isTriggerIsRunning = true; + this.triggerKeys = key; + this.triggerValues = this.getFilteredValues(); + var properties = this.getFilteredProperties(); + for (var i = 0; i < this.triggers.length; i++) { + var trigger = this.triggers[i]; + if (trigger.isOnNextPage == isOnNextPage) { + trigger.checkExpression(this.triggerKeys, this.triggerValues, properties); + } + } + this.isTriggerIsRunning = false; + }; + SurveyModel.prototype.doElementsOnLoad = function () { + for (var i = 0; i < this.pages.length; i++) { + this.pages[i].onSurveyLoad(); + } + }; + Object.defineProperty(SurveyModel.prototype, "isRunningConditions", { + get: function () { + return !!this.conditionValues; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.runConditions = function () { + if (this.isCompleted || + this.isEndLoadingFromJson === "processing" || + this.isRunningConditions) + return; + this.conditionValues = this.getFilteredValues(); + var properties = this.getFilteredProperties(); + var oldCurrentPageIndex = this.pages.indexOf(this.currentPage); + this.runConditionsCore(properties); + this.checkIfNewPagesBecomeVisible(oldCurrentPageIndex); + this.conditionValues = null; + if (this.isValueChangedOnRunningCondition && + this.conditionRunnerCounter < + _settings__WEBPACK_IMPORTED_MODULE_14__["settings"].maximumConditionRunCountOnValueChanged) { + this.isValueChangedOnRunningCondition = false; + this.conditionRunnerCounter++; + this.runConditions(); + } + else { + this.isValueChangedOnRunningCondition = false; + this.conditionRunnerCounter = 0; + if (this.conditionUpdateVisibleIndexes) { + this.conditionUpdateVisibleIndexes = false; + this.updateVisibleIndexes(); + } + if (this.conditionNotifyElementsOnAnyValueOrVariableChanged) { + this.conditionNotifyElementsOnAnyValueOrVariableChanged = false; + this.notifyElementsOnAnyValueOrVariableChanged(""); + } + } + }; + SurveyModel.prototype.runConditionOnValueChanged = function (name, value) { + if (this.isRunningConditions) { + this.conditionValues[name] = value; + this.isValueChangedOnRunningCondition = true; + } + else { + this.runConditions(); + } + }; + SurveyModel.prototype.runConditionsCore = function (properties) { + var pages = this.pages; + for (var i = 0; i < this.calculatedValues.length; i++) { + this.calculatedValues[i].resetCalculation(); + } + for (var i = 0; i < this.calculatedValues.length; i++) { + this.calculatedValues[i].doCalculation(this.calculatedValues, this.conditionValues, properties); + } + for (var i = 0; i < pages.length; i++) { + pages[i].runCondition(this.conditionValues, properties); + } + }; + SurveyModel.prototype.checkIfNewPagesBecomeVisible = function (oldCurrentPageIndex) { + var newCurrentPageIndex = this.pages.indexOf(this.currentPage); + if (newCurrentPageIndex <= oldCurrentPageIndex + 1) + return; + for (var i = oldCurrentPageIndex + 1; i < newCurrentPageIndex; i++) { + if (this.pages[i].isVisible) { + this.currentPage = this.pages[i]; + break; + } + } + }; + /** + * Sends a survey result to the [api.surveyjs.io](https://api.surveyjs.io) service. + * @param postId [api.surveyjs.io](https://api.surveyjs.io) service postId + * @param clientId Typically a customer e-mail or an identifier + * @param isPartialCompleted Set it to `true` if the survey is not completed yet and the results are intermediate + * @see surveyPostId + * @see clientId + */ + SurveyModel.prototype.sendResult = function (postId, clientId, isPartialCompleted) { + if (postId === void 0) { postId = null; } + if (clientId === void 0) { clientId = null; } + if (isPartialCompleted === void 0) { isPartialCompleted = false; } + if (!this.isEditMode) + return; + if (isPartialCompleted && this.onPartialSend) { + this.onPartialSend.fire(this, null); + } + if (!postId && this.surveyPostId) { + postId = this.surveyPostId; + } + if (!postId) + return; + if (clientId) { + this.clientId = clientId; + } + if (isPartialCompleted && !this.clientId) + return; + var self = this; + if (this.surveyShowDataSaving) { + this.setCompletedState("saving", ""); + } + this.createSurveyService().sendResult(postId, this.data, function (success, response, request) { + if (self.surveyShowDataSaving) { + if (success) { + self.setCompletedState("success", ""); + } + else { + self.setCompletedState("error", response); + } + } + self.onSendResult.fire(self, { + success: success, + response: response, + request: request, + }); + }, this.clientId, isPartialCompleted); + }; + /** + * Calls the [api.surveyjs.io](https://api.surveyjs.io) service and, on callback, fires the `onGetResult` event with all answers that your users made for a question. + * @param resultId [api.surveyjs.io](https://api.surveyjs.io) service resultId + * @param name The question name + * @see onGetResult + */ + SurveyModel.prototype.getResult = function (resultId, name) { + var self = this; + this.createSurveyService().getResult(resultId, name, function (success, data, dataList, response) { + self.onGetResult.fire(self, { + success: success, + data: data, + dataList: dataList, + response: response, + }); + }); + }; + /** + * Loads the survey JSON from the [api.surveyjs.io](https://api.surveyjs.io) service. + * If `clientId` is not `null` and a user had completed a survey before, the survey switches to `completedbefore` state. + * @param surveyId [api.surveyjs.io](https://api.surveyjs.io) service surveyId + * @param clientId users' indentifier, for example an e-mail or a unique customer id in your web application. + * @see state + * @see onLoadedSurveyFromService + */ + SurveyModel.prototype.loadSurveyFromService = function (surveyId, cliendId) { + if (surveyId === void 0) { surveyId = null; } + if (cliendId === void 0) { cliendId = null; } + if (surveyId) { + this.surveyId = surveyId; + } + if (cliendId) { + this.clientId = cliendId; + } + var self = this; + this.isLoading = true; + this.onLoadingSurveyFromService(); + if (cliendId) { + this.createSurveyService().getSurveyJsonAndIsCompleted(this.surveyId, this.clientId, function (success, json, isCompleted, response) { + self.isLoading = false; + if (success) { + self.isCompletedBefore = isCompleted == "completed"; + self.loadSurveyFromServiceJson(json); + } + }); + } + else { + this.createSurveyService().loadSurvey(this.surveyId, function (success, result, response) { + self.isLoading = false; + if (success) { + self.loadSurveyFromServiceJson(result); + } + }); + } + }; + SurveyModel.prototype.loadSurveyFromServiceJson = function (json) { + if (!json) + return; + this.fromJSON(json); + this.notifyAllQuestionsOnValueChanged(); + this.onLoadSurveyFromService(); + this.onLoadedSurveyFromService.fire(this, {}); + }; + SurveyModel.prototype.onLoadingSurveyFromService = function () { }; + SurveyModel.prototype.onLoadSurveyFromService = function () { }; + SurveyModel.prototype.resetVisibleIndexes = function () { + var questions = this.getAllQuestions(true); + for (var i = 0; i < questions.length; i++) { + questions[i].setVisibleIndex(-1); + } + this.updateVisibleIndexes(); + }; + SurveyModel.prototype.updateVisibleIndexes = function () { + if (this.isLoadingFromJson || !!this.isEndLoadingFromJson) + return; + if (this.isRunningConditions && + this.onVisibleChanged.isEmpty && + this.onPageVisibleChanged.isEmpty) { + //Run update visible index only one time on finishing running conditions + this.conditionUpdateVisibleIndexes = true; + return; + } + if (this.isRunningElementsBindings) { + this.updateVisibleIndexAfterBindings = true; + return; + } + this.updatePageVisibleIndexes(this.showPageNumbers); + if (this.showQuestionNumbers == "onPage") { + var visPages = this.visiblePages; + for (var i = 0; i < visPages.length; i++) { + visPages[i].setVisibleIndex(0); + } + } + else { + var index = this.showQuestionNumbers == "on" ? 0 : -1; + for (var i = 0; i < this.pages.length; i++) { + index += this.pages[i].setVisibleIndex(index); + } + } + this.updateProgressText(true); + }; + SurveyModel.prototype.updatePageVisibleIndexes = function (showIndex) { + this.updateButtonsVisibility(); + var index = 0; + for (var i = 0; i < this.pages.length; i++) { + var page = this.pages[i]; + var isPageVisible = page.isVisible && (i > 0 || !page.isStarted); + page.visibleIndex = isPageVisible ? index++ : -1; + page.num = isPageVisible ? page.visibleIndex + 1 : -1; + } + }; + SurveyModel.prototype.fromJSON = function (json) { + if (!json) + return; + this.questionHashesClear(); + this.jsonErrors = null; + var jsonConverter = new _jsonobject__WEBPACK_IMPORTED_MODULE_1__["JsonObject"](); + jsonConverter.toObject(json, this); + if (jsonConverter.errors.length > 0) { + this.jsonErrors = jsonConverter.errors; + } + this.onStateAndCurrentPageChanged(); + }; + SurveyModel.prototype.setJsonObject = function (jsonObj) { + this.fromJSON(jsonObj); + }; + SurveyModel.prototype.endLoadingFromJson = function () { + this.isEndLoadingFromJson = "processing"; + this.isStartedState = this.firstPageIsStarted; + this.onQuestionsOnPageModeChanged("standard"); + _super.prototype.endLoadingFromJson.call(this); + if (this.hasCookie) { + this.doComplete(); + } + this.doElementsOnLoad(); + this.isEndLoadingFromJson = "conditions"; + this.runConditions(); + this.notifyElementsOnAnyValueOrVariableChanged(""); + this.isEndLoadingFromJson = null; + this.updateVisibleIndexes(); + this.updateCurrentPage(); + this.hasDescription = !!this.description; + }; + SurveyModel.prototype.updateNavigationCss = function () { + if (!!this.navigationBar) { + this.updateNavigationBarCss(); + !!this.updateNavigationItemCssCallback && this.updateNavigationItemCssCallback(); + } + }; + SurveyModel.prototype.updateNavigationBarCss = function () { + var val = this.navigationBar; + var cssClasses = this.css.actionBar; + if (!!cssClasses) { + val.cssClasses = cssClasses; + } + val.containerCss = this.css.footer; + }; + SurveyModel.prototype.createNavigationBar = function () { + var res = new _actions_container__WEBPACK_IMPORTED_MODULE_17__["ActionContainer"](); + res.setItems(this.createNavigationActions()); + return res; + }; + SurveyModel.prototype.createNavigationActions = function () { + var _this = this; + var defaultComponent = "sv-nav-btn"; + var navStart = new _actions_action__WEBPACK_IMPORTED_MODULE_16__["Action"]({ + id: "sv-nav-start", + visible: new _base__WEBPACK_IMPORTED_MODULE_2__["ComputedUpdater"](function () { return _this.isShowStartingPage; }), + visibleIndex: 10, + locTitle: this.locStartSurveyText, + action: function () { return _this.start(); }, + component: defaultComponent + }); + var navPrev = new _actions_action__WEBPACK_IMPORTED_MODULE_16__["Action"]({ + id: "sv-nav-prev", + visible: new _base__WEBPACK_IMPORTED_MODULE_2__["ComputedUpdater"](function () { return _this.isShowPrevButton; }), + visibleIndex: 20, + data: { + mouseDown: function () { return _this.navigationMouseDown(); }, + }, + locTitle: this.locPagePrevText, + action: function () { return _this.prevPage(); }, + component: defaultComponent + }); + var navNext = new _actions_action__WEBPACK_IMPORTED_MODULE_16__["Action"]({ + id: "sv-nav-next", + visible: new _base__WEBPACK_IMPORTED_MODULE_2__["ComputedUpdater"](function () { return _this.isShowNextButton; }), + visibleIndex: 30, + data: { + mouseDown: function () { return _this.nextPageMouseDown(); }, + }, + locTitle: this.locPageNextText, + action: function () { return _this.nextPageUIClick(); }, + component: defaultComponent + }); + var navPreview = new _actions_action__WEBPACK_IMPORTED_MODULE_16__["Action"]({ + id: "sv-nav-preview", + visible: new _base__WEBPACK_IMPORTED_MODULE_2__["ComputedUpdater"](function () { return _this.isPreviewButtonVisible; }), + visibleIndex: 40, + data: { + mouseDown: function () { return _this.navigationMouseDown(); }, + }, + locTitle: this.locPreviewText, + action: function () { return _this.showPreview(); }, + component: defaultComponent + }); + var navComplete = new _actions_action__WEBPACK_IMPORTED_MODULE_16__["Action"]({ + id: "sv-nav-complete", + visible: new _base__WEBPACK_IMPORTED_MODULE_2__["ComputedUpdater"](function () { return _this.isCompleteButtonVisible; }), + visibleIndex: 50, + data: { + mouseDown: function () { return _this.navigationMouseDown(); }, + }, + locTitle: this.locCompleteText, + action: function () { return _this.completeLastPage(); }, + component: defaultComponent + }); + this.updateNavigationItemCssCallback = function () { + navStart.innerCss = _this.cssNavigationStart; + navPrev.innerCss = _this.cssNavigationPrev; + navNext.innerCss = _this.cssNavigationNext; + navPreview.innerCss = _this.cssNavigationPreview; + navComplete.innerCss = _this.cssNavigationComplete; + }; + return [navStart, navPrev, navNext, navPreview, navComplete]; + }; + SurveyModel.prototype.onBeforeCreating = function () { }; + SurveyModel.prototype.onCreating = function () { }; + SurveyModel.prototype.getProcessedTextValue = function (textValue) { + this.getProcessedTextValueCore(textValue); + if (!this.onProcessTextValue.isEmpty) { + var wasEmpty = this.isValueEmpty(textValue.value); + this.onProcessTextValue.fire(this, textValue); + textValue.isExists = + textValue.isExists || (wasEmpty && !this.isValueEmpty(textValue.value)); + } + }; + SurveyModel.prototype.getBuiltInVariableValue = function (name) { + if (name === "pageno") { + var page = this.currentPage; + return page != null ? this.visiblePages.indexOf(page) + 1 : 0; + } + if (name === "pagecount") { + return this.visiblePageCount; + } + if (name === "correctedanswers" || name === "correctanswers" || name === "correctedanswercount") { + return this.getCorrectedAnswerCount(); + } + if (name === "incorrectedanswers" || name === "incorrectanswers" || name === "incorrectedanswercount") { + return this.getInCorrectedAnswerCount(); + } + if (name === "questioncount") { + return this.getQuizQuestionCount(); + } + return undefined; + }; + SurveyModel.prototype.getProcessedTextValueCore = function (textValue) { + var name = textValue.name.toLocaleLowerCase(); + if (["no", "require", "title"].indexOf(name) !== -1) { + return; + } + var builtInVar = this.getBuiltInVariableValue(name); + if (builtInVar !== undefined) { + textValue.isExists = true; + textValue.value = builtInVar; + return; + } + if (name === "locale") { + textValue.isExists = true; + textValue.value = !!this.locale + ? this.locale + : _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].defaultLocale; + return; + } + var variable = this.getVariable(name); + if (variable !== undefined) { + textValue.isExists = true; + textValue.value = variable; + return; + } + var question = this.getFirstName(name); + if (question) { + textValue.isExists = true; + var firstName = question.getValueName().toLowerCase(); + name = firstName + name.substr(firstName.length); + name = name.toLocaleLowerCase(); + var values = {}; + values[firstName] = textValue.returnDisplayValue + ? question.getDisplayValue(false, undefined) + : question.value; + textValue.value = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__["ProcessValue"]().getValue(name, values); + return; + } + var value = this.getValue(textValue.name); + if (value !== undefined) { + textValue.isExists = true; + textValue.value = value; + } + }; + SurveyModel.prototype.getFirstName = function (name) { + name = name.toLowerCase(); + var question; + do { + question = this.getQuestionByValueName(name, true); + name = this.reduceFirstName(name); + } while (!question && !!name); + return question; + }; + SurveyModel.prototype.reduceFirstName = function (name) { + var pos1 = name.lastIndexOf("."); + var pos2 = name.lastIndexOf("["); + if (pos1 < 0 && pos2 < 0) + return ""; + var pos = Math.max(pos1, pos2); + return name.substr(0, pos); + }; + SurveyModel.prototype.clearUnusedValues = function () { + var questions = this.getAllQuestions(); + for (var i = 0; i < questions.length; i++) { + questions[i].clearUnusedValues(); + } + this.clearInvisibleQuestionValues(); + }; + SurveyModel.prototype.hasVisibleQuestionByValueName = function (valueName) { + var questions = this.getQuestionsByValueName(valueName); + if (!questions) + return false; + for (var i = 0; i < questions.length; i++) { + if (questions[i].isVisible && questions[i].isParentVisible) + return true; + } + return false; + }; + SurveyModel.prototype.questionCountByValueName = function (valueName) { + var questions = this.getQuestionsByValueName(valueName); + return !!questions ? questions.length : 0; + }; + SurveyModel.prototype.clearInvisibleQuestionValues = function () { + var reason = this.clearInvisibleValues === "none" ? "none" : "onComplete"; + var questions = this.getAllQuestions(); + for (var i = 0; i < questions.length; i++) { + questions[i].clearValueIfInvisible(reason); + } + }; + /** + * Returns a variable value. Variable, unlike values, are not stored in the survey results. + * @param name A variable name + * @see SetVariable + */ + SurveyModel.prototype.getVariable = function (name) { + if (!name) + return null; + name = name.toLowerCase(); + var res = this.variablesHash[name]; + if (!this.isValueEmpty(res)) + return res; + if (name.indexOf(".") > -1 || name.indexOf("[") > -1) { + if (new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__["ProcessValue"]().hasValue(name, this.variablesHash)) + return new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__["ProcessValue"]().getValue(name, this.variablesHash); + } + return res; + }; + /** + * Sets a variable value. Variable, unlike values, are not stored in the survey results. + * @param name A variable name + * @param newValue A variable new value + * @see GetVariable + */ + SurveyModel.prototype.setVariable = function (name, newValue) { + if (!name) + return; + name = name.toLowerCase(); + this.variablesHash[name] = newValue; + this.notifyElementsOnAnyValueOrVariableChanged(name); + this.runConditionOnValueChanged(name, newValue); + this.onVariableChanged.fire(this, { name: name, value: newValue }); + }; + /** + * Returns all variables in the survey. Use setVariable function to create a new variable. + * @see getVariable + * @see setVariable + */ + SurveyModel.prototype.getVariableNames = function () { + var res = []; + for (var key in this.variablesHash) { + res.push(key); + } + return res; + }; + //ISurvey data + SurveyModel.prototype.getUnbindValue = function (value) { + if (!!this.editingObj) + return value; + return _helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].getUnbindValue(value); + }; + /** + * Returns a question value (answer) by a question's name. + * @param name A question name + * @see data + * @see setValue + */ + SurveyModel.prototype.getValue = function (name) { + if (!name || name.length == 0) + return null; + var value = this.getDataValueCore(this.valuesHash, name); + return this.getUnbindValue(value); + }; + /** + * Sets a question value (answer). It runs all triggers and conditions (`visibleIf` properties). + * + * Goes to the next page if `goNextPageAutomatic` is `true` and all questions on the current page are answered correctly. + * @param name A question name + * @param newValue A new question value + * @see data + * @see getValue + * @see PageModel.visibleIf + * @see Question.visibleIf + * @see goNextPageAutomatic + */ + SurveyModel.prototype.setValue = function (name, newQuestionValue, locNotification, allowNotifyValueChanged) { + if (locNotification === void 0) { locNotification = false; } + if (allowNotifyValueChanged === void 0) { allowNotifyValueChanged = true; } + var newValue = newQuestionValue; + if (allowNotifyValueChanged) { + newValue = this.questionOnValueChanging(name, newQuestionValue); + } + if (this.isValidateOnValueChanging && + this.checkErrorsOnValueChanging(name, newValue)) + return; + if (!this.editingObj && + this.isValueEqual(name, newValue) && + this.isTwoValueEquals(newValue, newQuestionValue)) + return; + var oldValue = this.getValue(name); + if (this.isValueEmpty(newValue)) { + this.deleteDataValueCore(this.valuesHash, name); + } + else { + newValue = this.getUnbindValue(newValue); + this.setDataValueCore(this.valuesHash, name, newValue); + } + this.updateOnSetValue(name, newValue, oldValue, locNotification, allowNotifyValueChanged); + }; + SurveyModel.prototype.updateOnSetValue = function (name, newValue, oldValue, locNotification, allowNotifyValueChanged) { + if (locNotification === void 0) { locNotification = false; } + if (allowNotifyValueChanged === void 0) { allowNotifyValueChanged = true; } + this.updateQuestionValue(name, newValue); + if (locNotification === true || this.isDisposed || this.isRunningElementsBindings) + return; + var triggerKeys = {}; + triggerKeys[name] = { newValue: newValue, oldValue: oldValue }; + this.runConditionOnValueChanged(name, newValue); + this.checkTriggers(triggerKeys, false); + if (allowNotifyValueChanged) + this.notifyQuestionOnValueChanged(name, newValue); + if (locNotification !== "text") { + this.tryGoNextPageAutomatic(name); + } + }; + SurveyModel.prototype.isValueEqual = function (name, newValue) { + if (newValue === "" || newValue === undefined) + newValue = null; + var oldValue = this.getValue(name); + if (oldValue === "" || oldValue === undefined) + oldValue = null; + if (newValue === null || oldValue === null) + return newValue === oldValue; + return this.isTwoValueEquals(newValue, oldValue); + }; + SurveyModel.prototype.doOnPageAdded = function (page) { + page.setSurveyImpl(this); + if (!page.name) + page.name = this.generateNewName(this.pages, "page"); + this.questionHashesPanelAdded(page); + this.updateVisibleIndexes(); + if (!this.isLoadingFromJson) { + this.updateProgressText(); + this.updateCurrentPage(); + } + var options = { page: page }; + this.onPageAdded.fire(this, options); + }; + SurveyModel.prototype.doOnPageRemoved = function (page) { + page.setSurveyImpl(null); + if (page === this.currentPage) { + this.updateCurrentPage(); + } + this.updateVisibleIndexes(); + this.updateProgressText(); + this.updateLazyRenderingRowsOnRemovingElements(); + }; + SurveyModel.prototype.generateNewName = function (elements, baseName) { + var keys = {}; + for (var i = 0; i < elements.length; i++) + keys[elements[i]["name"]] = true; + var index = 1; + while (keys[baseName + index]) + index++; + return baseName + index; + }; + SurveyModel.prototype.tryGoNextPageAutomatic = function (name) { + if (!!this.isEndLoadingFromJson || + !this.goNextPageAutomatic || + !this.currentPage) + return; + var question = this.getQuestionByValueName(name); + if (!question || + (!!question && + (!question.visible || !question.supportGoNextPageAutomatic()))) + return; + if (question.hasErrors(false) && !question.supportGoNextPageError()) + return; + var questions = this.getCurrentPageQuestions(); + if (questions.indexOf(question) < 0) + return; + for (var i = 0; i < questions.length; i++) { + if (questions[i].hasInput && questions[i].isEmpty()) + return; + } + if (!this.checkIsCurrentPageHasErrors(false)) { + if (!this.isLastPage) { + this.nextPage(); + } + else { + if (this.goNextPageAutomatic === true && + this.allowCompleteSurveyAutomatic) { + if (this.isShowPreviewBeforeComplete) { + this.showPreview(); + } + else { + this.completeLastPage(); + } + } + } + } + }; + /** + * Returns the comment value. + * @param name A comment's name. + * @see setComment + */ + SurveyModel.prototype.getComment = function (name) { + var res = this.getValue(name + this.commentPrefix); + return res || ""; + }; + /** + * Sets a comment value. + * @param name A comment name. + * @param newValue A new comment value. + * @see getComment + */ + SurveyModel.prototype.setComment = function (name, newValue, locNotification) { + if (locNotification === void 0) { locNotification = false; } + if (!newValue) + newValue = ""; + if (this.isTwoValueEquals(newValue, this.getComment(name))) + return; + var commentName = name + this.commentPrefix; + if (this.isValueEmpty(newValue)) { + this.deleteDataValueCore(this.valuesHash, commentName); + } + else { + this.setDataValueCore(this.valuesHash, commentName, newValue); + } + var questions = this.getQuestionsByValueName(name); + if (!!questions) { + for (var i = 0; i < questions.length; i++) { + questions[i].updateCommentFromSurvey(newValue); + this.checkQuestionErrorOnValueChanged(questions[i]); + } + } + if (!locNotification) { + this.runConditionOnValueChanged(name, this.getValue(name)); + } + if (locNotification !== "text") { + this.tryGoNextPageAutomatic(name); + } + var question = this.getQuestionByName(name); + if (question) { + this.onValueChanged.fire(this, { + name: commentName, + question: question, + value: newValue, + }); + } + }; + /** + * Removes a value from the survey results. + * @param {string} name The name of the value. Typically it is a question name. + */ + SurveyModel.prototype.clearValue = function (name) { + this.setValue(name, null); + this.setComment(name, null); + }; + Object.defineProperty(SurveyModel.prototype, "clearValueOnDisableItems", { + /** + * Gets or sets whether to clear value on disable items in checkbox, dropdown and radiogroup questions. + * By default, values are not cleared on disabled the corresponded items. This property is not persisted in survey JSON and you have to set it in code. + */ + get: function () { + return this.getPropertyValue("clearValueOnDisableItems", false); + }, + set: function (val) { + this.setPropertyValue("clearValueOnDisableItems", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isClearValueOnHidden", { + get: function () { + return (this.clearInvisibleValues == "onHidden" || + this.isClearValueOnHiddenContainer); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isClearValueOnHiddenContainer", { + get: function () { + return (this.clearInvisibleValues == "onHiddenContainer" && + !this.isShowingPreview && + !this.runningPages); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.questionVisibilityChanged = function (question, newValue) { + this.updateVisibleIndexes(); + this.onVisibleChanged.fire(this, { + question: question, + name: question.name, + visible: newValue, + }); + }; + SurveyModel.prototype.pageVisibilityChanged = function (page, newValue) { + if (this.isLoadingFromJson) + return; + if (newValue && !this.currentPage || page === this.currentPage) { + this.updateCurrentPage(); + } + this.updateVisibleIndexes(); + this.onPageVisibleChanged.fire(this, { + page: page, + visible: newValue, + }); + }; + SurveyModel.prototype.panelVisibilityChanged = function (panel, newValue) { + this.updateVisibleIndexes(); + this.onPanelVisibleChanged.fire(this, { + panel: panel, + visible: newValue, + }); + }; + SurveyModel.prototype.questionCreated = function (question) { + this.onQuestionCreated.fire(this, { question: question }); + }; + SurveyModel.prototype.questionAdded = function (question, index, parentPanel, rootPanel) { + if (!question.name) { + question.name = this.generateNewName(this.getAllQuestions(false, true), "question"); + } + if (!!question.page) { + this.questionHashesAdded(question); + } + if (!this.currentPage) { + this.updateCurrentPage(); + } + this.updateVisibleIndexes(); + if (!this.isMovingQuestion) { + this.onQuestionAdded.fire(this, { + question: question, + name: question.name, + index: index, + parentPanel: parentPanel, + rootPanel: rootPanel, + }); + } + }; + SurveyModel.prototype.questionRemoved = function (question) { + this.questionHashesRemoved(question, question.name, question.getValueName()); + this.updateVisibleIndexes(); + this.onQuestionRemoved.fire(this, { + question: question, + name: question.name, + }); + this.updateLazyRenderingRowsOnRemovingElements(); + }; + SurveyModel.prototype.questionRenamed = function (question, oldName, oldValueName) { + this.questionHashesRemoved(question, oldName, oldValueName); + this.questionHashesAdded(question); + }; + SurveyModel.prototype.questionHashesClear = function () { + this.questionHashes.names = {}; + this.questionHashes.namesInsensitive = {}; + this.questionHashes.valueNames = {}; + this.questionHashes.valueNamesInsensitive = {}; + }; + SurveyModel.prototype.questionHashesPanelAdded = function (panel) { + if (this.isLoadingFromJson) + return; + var questions = panel.questions; + for (var i = 0; i < questions.length; i++) { + this.questionHashesAdded(questions[i]); + } + }; + SurveyModel.prototype.questionHashesAdded = function (question) { + this.questionHashAddedCore(this.questionHashes.names, question, question.name); + this.questionHashAddedCore(this.questionHashes.namesInsensitive, question, question.name.toLowerCase()); + this.questionHashAddedCore(this.questionHashes.valueNames, question, question.getValueName()); + this.questionHashAddedCore(this.questionHashes.valueNamesInsensitive, question, question.getValueName().toLowerCase()); + }; + SurveyModel.prototype.questionHashesRemoved = function (question, name, valueName) { + if (!!name) { + this.questionHashRemovedCore(this.questionHashes.names, question, name); + this.questionHashRemovedCore(this.questionHashes.namesInsensitive, question, name.toLowerCase()); + } + if (!!valueName) { + this.questionHashRemovedCore(this.questionHashes.valueNames, question, valueName); + this.questionHashRemovedCore(this.questionHashes.valueNamesInsensitive, question, valueName.toLowerCase()); + } + }; + SurveyModel.prototype.questionHashAddedCore = function (hash, question, name) { + var res = hash[name]; + if (!!res) { + var res = hash[name]; + if (res.indexOf(question) < 0) { + res.push(question); + } + } + else { + hash[name] = [question]; + } + }; + SurveyModel.prototype.questionHashRemovedCore = function (hash, question, name) { + var res = hash[name]; + if (!res) + return; + var index = res.indexOf(question); + if (index > -1) { + res.splice(index, 1); + } + if (res.length == 0) { + delete hash[name]; + } + }; + SurveyModel.prototype.panelAdded = function (panel, index, parentPanel, rootPanel) { + if (!panel.name) { + panel.name = this.generateNewName(this.getAllPanels(false, true), "panel"); + } + this.questionHashesPanelAdded(panel); + this.updateVisibleIndexes(); + this.onPanelAdded.fire(this, { + panel: panel, + name: panel.name, + index: index, + parentPanel: parentPanel, + rootPanel: rootPanel, + }); + }; + SurveyModel.prototype.panelRemoved = function (panel) { + this.updateVisibleIndexes(); + this.onPanelRemoved.fire(this, { panel: panel, name: panel.name }); + this.updateLazyRenderingRowsOnRemovingElements(); + }; + SurveyModel.prototype.validateQuestion = function (question) { + if (this.onValidateQuestion.isEmpty) + return null; + var options = { + name: question.name, + question: question, + value: question.value, + error: null, + }; + this.onValidateQuestion.fire(this, options); + return options.error ? new _error__WEBPACK_IMPORTED_MODULE_9__["CustomError"](options.error, this) : null; + }; + SurveyModel.prototype.validatePanel = function (panel) { + if (this.onValidatePanel.isEmpty) + return null; + var options = { + name: panel.name, + panel: panel, + error: null, + }; + this.onValidatePanel.fire(this, options); + return options.error ? new _error__WEBPACK_IMPORTED_MODULE_9__["CustomError"](options.error, this) : null; + }; + SurveyModel.prototype.processHtml = function (html) { + var options = { html: html }; + this.onProcessHtml.fire(this, options); + return this.processText(options.html, true); + }; + SurveyModel.prototype.processText = function (text, returnDisplayValue) { + return this.processTextEx(text, returnDisplayValue, false).text; + }; + SurveyModel.prototype.processTextEx = function (text, returnDisplayValue, doEncoding) { + var res = { + text: this.processTextCore(text, returnDisplayValue, doEncoding), + hasAllValuesOnLastRun: true, + }; + res.hasAllValuesOnLastRun = this.textPreProcessor.hasAllValuesOnLastRun; + return res; + }; + SurveyModel.prototype.processTextCore = function (text, returnDisplayValue, doEncoding) { + if (doEncoding === void 0) { doEncoding = false; } + if (this.isDesignMode) + return text; + return this.textPreProcessor.process(text, returnDisplayValue, doEncoding); + }; + SurveyModel.prototype.getSurveyMarkdownHtml = function (element, text, name) { + var options = { + element: element, + text: text, + name: name, + html: null, + }; + this.onTextMarkdown.fire(this, options); + return options.html; + }; + /** + * Deprecated. Use the getCorrectAnswerCount method instead. + */ + SurveyModel.prototype.getCorrectedAnswerCount = function () { + return this.getCorrectedAnswerCountCore(true); + }; + /** + * Returns an amount of corrected quiz answers. + */ + SurveyModel.prototype.getCorrectAnswerCount = function () { + return this.getCorrectedAnswerCountCore(true); + }; + /** + * Returns quiz question number. It may be different from `getQuizQuestions.length` because some widgets like matrix may have several questions. + * @see getQuizQuestions + */ + SurveyModel.prototype.getQuizQuestionCount = function () { + var questions = this.getQuizQuestions(); + var res = 0; + for (var i = 0; i < questions.length; i++) { + res += questions[i].quizQuestionCount; + } + return res; + }; + /** + * Deprecated. Use the getInCorrectAnswerCount method instead. + */ + SurveyModel.prototype.getInCorrectedAnswerCount = function () { + return this.getCorrectedAnswerCountCore(false); + }; + /** + * Returns an amount of incorrect quiz answers. + */ + SurveyModel.prototype.getInCorrectAnswerCount = function () { + return this.getCorrectedAnswerCountCore(false); + }; + SurveyModel.prototype.getCorrectedAnswerCountCore = function (isCorrect) { + var questions = this.getQuizQuestions(); + var counter = 0; + var options = { + question: null, + result: false, + correctAnswers: 0, + incorrectAnswers: 0, + }; + for (var i = 0; i < questions.length; i++) { + var q = questions[i]; + var quizQuestionCount = q.quizQuestionCount; + options.question = q; + options.correctAnswers = q.correctAnswerCount; + options.incorrectAnswers = quizQuestionCount - options.correctAnswers; + options.result = options.question.isAnswerCorrect(); + this.onIsAnswerCorrect.fire(this, options); + if (isCorrect) { + if (options.result || options.correctAnswers < quizQuestionCount) { + var addCount = options.correctAnswers; + if (addCount == 0 && options.result) + addCount = 1; + counter += addCount; + } + } + else { + if (!options.result || options.incorrectAnswers < quizQuestionCount) { + counter += options.incorrectAnswers; + } + } + } + return counter; + }; + SurveyModel.prototype.getCorrectedAnswers = function () { + return this.getCorrectedAnswerCount(); + }; + SurveyModel.prototype.getInCorrectedAnswers = function () { + return this.getInCorrectedAnswerCount(); + }; + Object.defineProperty(SurveyModel.prototype, "showTimerPanel", { + /** + * Gets or sets a timer panel position. The timer panel displays information about how much time an end user spends on a survey/page. + * + * The available options: + * - `top` - display timer panel in the top. + * - `bottom` - display timer panel in the bottom. + * - `none` - do not display a timer panel. + * + * If the value is not equal to 'none', the survey calls the `startTimer()` method on survey rendering. + * @see showTimerPanelMode + * @see startTimer + * @see stopTimer + */ + get: function () { + return this.getPropertyValue("showTimerPanel"); + }, + set: function (val) { + this.setPropertyValue("showTimerPanel", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isTimerPanelShowingOnTop", { + get: function () { + return this.timerModel.isRunning && this.showTimerPanel == "top"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "isTimerPanelShowingOnBottom", { + get: function () { + return this.timerModel.isRunning && this.showTimerPanel == "bottom"; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "showTimerPanelMode", { + /** + * Gets or set a value that specifies whether the timer displays information for the page or for the entire survey. + * + * The available options: + * + * - `page` - show timer information for page + * - `survey` - show timer information for survey + * + * Use the `onTimerPanelInfoText` event to change the default text. + * @see showTimerPanel + * @see onTimerPanelInfoText + */ + get: function () { + return this.getPropertyValue("showTimerPanelMode"); + }, + set: function (val) { + this.setPropertyValue("showTimerPanelMode", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "widthMode", { + /** + * Gets or sets a value that specifies how the survey width is calculated. + * + * The available options: + * + * - `static` - A survey has a fixed width that mostly depends upon the applied theme. Resizing a browser window does not affect the survey width. + * - `responsive` - A survey takes all available horizontal space. A survey stretches or shrinks horizonally according to the screen size. + * - `auto` - Depends on the question type and corresponds to the static or responsive mode. + */ + // `custom/precise` - The survey width is specified by the width property. // in-future + get: function () { + return this.getPropertyValue("widthMode"); + }, + set: function (val) { + this.setPropertyValue("widthMode", val); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.calculateWidthMode = function () { + if (this.widthMode == "auto") { + var isResponsive_1 = false; + this.pages.forEach(function (page) { + if (page.needResponsiveWidth()) + isResponsive_1 = true; + }); + return isResponsive_1 ? "responsive" : "static"; + } + return this.widthMode; + }; + Object.defineProperty(SurveyModel.prototype, "timerInfoText", { + get: function () { + var options = { text: this.getTimerInfoText() }; + this.onTimerPanelInfoText.fire(this, options); + var loc = new _localizablestring__WEBPACK_IMPORTED_MODULE_10__["LocalizableString"](this, true); + loc.text = options.text; + return loc.textOrHtml; + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.getTimerInfoText = function () { + var page = this.currentPage; + if (!page) + return ""; + var pageSpent = this.getDisplayTime(page.timeSpent); + var surveySpent = this.getDisplayTime(this.timeSpent); + var pageLimitSec = this.getPageMaxTimeToFinish(page); + var pageLimit = this.getDisplayTime(pageLimitSec); + var surveyLimit = this.getDisplayTime(this.maxTimeToFinish); + if (this.showTimerPanelMode == "page") + return this.getTimerInfoPageText(page, pageSpent, pageLimit); + if (this.showTimerPanelMode == "survey") + return this.getTimerInfoSurveyText(surveySpent, surveyLimit); + if (this.showTimerPanelMode == "all") { + if (pageLimitSec <= 0 && this.maxTimeToFinish <= 0) { + return this.getLocString("timerSpentAll")["format"](pageSpent, surveySpent); + } + if (pageLimitSec > 0 && this.maxTimeToFinish > 0) { + return this.getLocString("timerLimitAll")["format"](pageSpent, pageLimit, surveySpent, surveyLimit); + } + var pageText = this.getTimerInfoPageText(page, pageSpent, pageLimit); + var surveyText = this.getTimerInfoSurveyText(surveySpent, surveyLimit); + return pageText + " " + surveyText; + } + return ""; + }; + SurveyModel.prototype.getTimerInfoPageText = function (page, pageSpent, pageLimit) { + return this.getPageMaxTimeToFinish(page) > 0 + ? this.getLocString("timerLimitPage")["format"](pageSpent, pageLimit) + : this.getLocString("timerSpentPage")["format"](pageSpent, pageLimit); + }; + SurveyModel.prototype.getTimerInfoSurveyText = function (surveySpent, surveyLimit) { + return this.maxTimeToFinish > 0 + ? this.getLocString("timerLimitSurvey")["format"](surveySpent, surveyLimit) + : this.getLocString("timerSpentSurvey")["format"](surveySpent, surveyLimit); + }; + SurveyModel.prototype.getDisplayTime = function (val) { + var min = Math.floor(val / 60); + var sec = val % 60; + var res = ""; + if (min > 0) { + res += min + " " + this.getLocString("timerMin"); + } + if (res && sec == 0) + return res; + if (res) + res += " "; + return res + sec + " " + this.getLocString("timerSec"); + }; + Object.defineProperty(SurveyModel.prototype, "timerModel", { + get: function () { return this.timerModelValue; }, + enumerable: false, + configurable: true + }); + /** + * Starts a timer that will calculate how much time end-user spends on the survey or on pages. + * @see stopTimer + * @see timeSpent + */ + SurveyModel.prototype.startTimer = function () { + this.timerModel.start(); + }; + SurveyModel.prototype.startTimerFromUI = function () { + if (this.showTimerPanel != "none" && this.state === "running") { + this.startTimer(); + } + }; + /** + * Stops the timer. + * @see startTimer + * @see timeSpent + */ + SurveyModel.prototype.stopTimer = function () { + this.timerModel.stop(); + }; + Object.defineProperty(SurveyModel.prototype, "timeSpent", { + /** + * Returns the time in seconds an end user spends on the survey + * @see startTimer + * @see PageModel.timeSpent + */ + get: function () { return this.timerModel.spent; }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "maxTimeToFinish", { + /** + * Gets or sets the maximum time in seconds that end user has to complete a survey. If the value is 0 or less, an end user has no time limit to finish a survey. + * @see startTimer + * @see maxTimeToFinishPage + */ + get: function () { + return this.getPropertyValue("maxTimeToFinish", 0); + }, + set: function (val) { + this.setPropertyValue("maxTimeToFinish", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyModel.prototype, "maxTimeToFinishPage", { + /** + * Gets or sets the maximum time in seconds that end user has to complete a page in the survey. If the value is 0 or less, an end user has no time limit. + * + * You may override this value for every page. + * @see startTimer + * @see maxTimeToFinish + * @see PageModel.maxTimeToFinish + */ + get: function () { + return this.getPropertyValue("maxTimeToFinishPage", 0); + }, + set: function (val) { + this.setPropertyValue("maxTimeToFinishPage", val); + }, + enumerable: false, + configurable: true + }); + SurveyModel.prototype.getPageMaxTimeToFinish = function (page) { + if (!page || page.maxTimeToFinish < 0) + return 0; + return page.maxTimeToFinish > 0 + ? page.maxTimeToFinish + : this.maxTimeToFinishPage; + }; + SurveyModel.prototype.doTimer = function (page) { + this.onTimer.fire(this, {}); + if (this.maxTimeToFinish > 0 && this.maxTimeToFinish == this.timeSpent) { + this.completeLastPage(); + } + if (page) { + var pageLimit = this.getPageMaxTimeToFinish(page); + if (pageLimit > 0 && pageLimit == page.timeSpent) { + if (this.isLastPage) { + this.completeLastPage(); + } + else { + this.nextPage(); + } + } + } + }; + Object.defineProperty(SurveyModel.prototype, "inSurvey", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + //ISurveyImplementor + SurveyModel.prototype.getSurveyData = function () { + return this; + }; + SurveyModel.prototype.getSurvey = function () { + return this; + }; + SurveyModel.prototype.getTextProcessor = function () { + return this; + }; + //ISurveyTriggerOwner + SurveyModel.prototype.getObjects = function (pages, questions) { + var result = []; + Array.prototype.push.apply(result, this.getPagesByNames(pages)); + Array.prototype.push.apply(result, this.getQuestionsByNames(questions)); + return result; + }; + SurveyModel.prototype.setTriggerValue = function (name, value, isVariable) { + if (!name) + return; + if (isVariable) { + this.setVariable(name, value); + } + else { + var question = this.getQuestionByName(name); + if (!!question) { + question.value = value; + } + else { + var processor = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__["ProcessValue"](); + var firstName = processor.getFirstName(name); + if (firstName == name) { + this.setValue(name, value); + } + else { + if (!this.getQuestionByName(firstName)) + return; + var data = this.getUnbindValue(this.getFilteredValues()); + processor.setValue(data, name, value); + this.setValue(firstName, data[firstName]); + } + } + } + }; + SurveyModel.prototype.copyTriggerValue = function (name, fromName) { + if (!name || !fromName) + return; + var processor = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_6__["ProcessValue"](); + var value = processor.getValue(fromName, this.getFilteredValues()); + this.setTriggerValue(name, value, false); + }; + SurveyModel.prototype.startMovingQuestion = function () { + this.isMovingQuestion = true; + }; + SurveyModel.prototype.stopMovingQuestion = function () { + this.isMovingQuestion = false; + }; + /** + * Focus question by its name. If needed change the current page on the page where question is located. + * Function returns false if there is no question with this name or question is invisible, otherwise it returns true. + * @param name question name + */ + SurveyModel.prototype.focusQuestion = function (name) { + var question = this.getQuestionByName(name, true); + if (!question || !question.isVisible || !question.page) + return false; + this.isFocusingQuestion = true; + this.currentPage = question.page; + question.focus(); + this.isFocusingQuestion = false; + this.isCurrentPageRendering = false; + return true; + }; + SurveyModel.prototype.getElementWrapperComponentName = function (element, reason) { + if (reason === "logo-image") { + return "sv-logo-image"; + } + return SurveyModel.TemplateRendererComponentName; + }; + SurveyModel.prototype.getQuestionContentWrapperComponentName = function (element) { + return SurveyModel.TemplateRendererComponentName; + }; + SurveyModel.prototype.getRowWrapperComponentName = function (row) { + return SurveyModel.TemplateRendererComponentName; + }; + SurveyModel.prototype.getElementWrapperComponentData = function (element, reason) { + return element; + }; + SurveyModel.prototype.getRowWrapperComponentData = function (row) { + return row; + }; + SurveyModel.prototype.getItemValueWrapperComponentName = function (item, question) { + return SurveyModel.TemplateRendererComponentName; + }; + SurveyModel.prototype.getItemValueWrapperComponentData = function (item, question) { + return item; + }; + SurveyModel.prototype.getMatrixCellTemplateData = function (cell) { + return cell.question; + }; + SurveyModel.prototype.searchText = function (text) { + if (!!text) + text = text.toLowerCase(); + var res = []; + for (var i = 0; i < this.pages.length; i++) { + this.pages[i].searchText(text, res); + } + return res; + }; + SurveyModel.prototype.getSkeletonComponentName = function (element) { + return this.skeletonComponentName; + }; + /** + * Use this method to dispose survey model properly. + */ + SurveyModel.prototype.dispose = function () { + this.currentPage = null; + this.destroyResizeObserver(); + _super.prototype.dispose.call(this); + this.editingObj = null; + if (!this.pages) + return; + for (var i = 0; i < this.pages.length; i++) { + this.pages[i].dispose(); + } + this.pages.splice(0, this.pages.length); + if (this.disposeCallback) { + this.disposeCallback(); + } + }; + SurveyModel.TemplateRendererComponentName = "sv-template-renderer"; + SurveyModel.stylesManager = null; + SurveyModel.platform = "unknown"; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() + ], SurveyModel.prototype, "completedCss", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() + ], SurveyModel.prototype, "containerCss", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() + ], SurveyModel.prototype, "_isMobile", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_1__["property"])() + ], SurveyModel.prototype, "rootCss", void 0); + return SurveyModel; + }(_survey_element__WEBPACK_IMPORTED_MODULE_3__["SurveyElementCore"])); + + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("survey", [ + { + name: "locale", + choices: function () { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].getLocales(true); + }, + onGetValue: function (obj) { + return obj.locale == _surveyStrings__WEBPACK_IMPORTED_MODULE_8__["surveyLocalization"].defaultLocale ? null : obj.locale; + }, + }, + { name: "title", serializationProperty: "locTitle", dependsOn: "locale" }, + { + name: "description:text", + serializationProperty: "locDescription", + dependsOn: "locale", + }, + { name: "logo", serializationProperty: "locLogo" }, + { name: "logoWidth", default: "300px", minValue: 0 }, + { name: "logoHeight", default: "200px", minValue: 0 }, + { + name: "logoFit", + default: "contain", + choices: ["none", "contain", "cover", "fill"], + }, + { + name: "logoPosition", + default: "left", + choices: ["none", "left", "right", "top", "bottom"], + }, + { name: "focusFirstQuestionAutomatic:boolean", default: true }, + { name: "focusOnFirstError:boolean", default: true }, + { name: "completedHtml:html", serializationProperty: "locCompletedHtml" }, + { + name: "completedBeforeHtml:html", + serializationProperty: "locCompletedBeforeHtml", + }, + { + name: "completedHtmlOnCondition:htmlconditions", + className: "htmlconditionitem", + }, + { name: "loadingHtml:html", serializationProperty: "locLoadingHtml" }, + { name: "pages:surveypages", className: "page" }, + { + name: "questions", + alternativeName: "elements", + baseClassName: "question", + visible: false, + isLightSerializable: false, + onGetValue: function (obj) { + return null; + }, + onSetValue: function (obj, value, jsonConverter) { + obj.pages.splice(0, obj.pages.length); + var page = obj.addNewPage(""); + jsonConverter.toObject({ questions: value }, page); + }, + }, + { + name: "triggers:triggers", + baseClassName: "surveytrigger", + classNamePart: "trigger", + }, + { + name: "calculatedValues:calculatedvalues", + className: "calculatedvalue", + }, + { name: "surveyId", visible: false }, + { name: "surveyPostId", visible: false }, + { name: "surveyShowDataSaving:boolean", visible: false }, + "cookieName", + "sendResultOnPageNext:boolean", + { + name: "showNavigationButtons", + default: "bottom", + choices: ["none", "top", "bottom", "both"], + }, + { name: "showPrevButton:boolean", default: true }, + { name: "showTitle:boolean", default: true }, + { name: "showPageTitles:boolean", default: true }, + { name: "showCompletedPage:boolean", default: true }, + "navigateToUrl", + { + name: "navigateToUrlOnCondition:urlconditions", + className: "urlconditionitem", + }, + { + name: "questionsOrder", + default: "initial", + choices: ["initial", "random"], + }, + "showPageNumbers:boolean", + { + name: "showQuestionNumbers", + default: "on", + choices: ["on", "onPage", "off"], + }, + { + name: "questionTitleLocation", + default: "top", + choices: ["top", "bottom", "left"], + }, + { + name: "questionDescriptionLocation", + default: "underTitle", + choices: ["underInput", "underTitle"], + }, + { name: "questionErrorLocation", default: "top", choices: ["top", "bottom"] }, + { + name: "showProgressBar", + default: "off", + choices: ["off", "top", "bottom", "both"], + }, + { + name: "progressBarType", + default: "pages", + choices: [ + "pages", + "questions", + "requiredQuestions", + "correctQuestions", + "buttons", + ], + }, + { name: "mode", default: "edit", choices: ["edit", "display"] }, + { name: "storeOthersAsComment:boolean", default: true }, + { name: "maxTextLength:number", default: 0, minValue: 0 }, + { name: "maxOthersLength:number", default: 0, minValue: 0 }, + "goNextPageAutomatic:boolean", + { + name: "clearInvisibleValues", + default: "onComplete", + choices: ["none", "onComplete", "onHidden", "onHiddenContainer"], + }, + { + name: "checkErrorsMode", + default: "onNextPage", + choices: ["onNextPage", "onValueChanged", "onValueChanging", "onComplete"], + }, + { + name: "textUpdateMode", + default: "onBlur", + choices: ["onBlur", "onTyping"], + }, + { name: "autoGrowComment:boolean", default: false }, + { name: "startSurveyText", serializationProperty: "locStartSurveyText" }, + { name: "pagePrevText", serializationProperty: "locPagePrevText" }, + { name: "pageNextText", serializationProperty: "locPageNextText" }, + { name: "completeText", serializationProperty: "locCompleteText" }, + { name: "previewText", serializationProperty: "locPreviewText" }, + { name: "editText", serializationProperty: "locEditText" }, + { name: "requiredText", default: "*" }, + { + name: "questionStartIndex", + dependsOn: ["showQuestionNumbers"], + visibleIf: function (survey) { + return !survey || survey.showQuestionNumbers !== "off"; + }, + }, + { + name: "questionTitlePattern", + default: "numTitleRequire", + dependsOn: ["questionStartIndex", "requiredText"], + choices: function (obj) { + if (!obj) + return []; + return obj.getQuestionTitlePatternOptions(); + }, + }, + { + name: "questionTitleTemplate", + visible: false, + isSerializable: false, + serializationProperty: "locQuestionTitleTemplate", + }, + { name: "firstPageIsStarted:boolean", default: false }, + { + name: "isSinglePage:boolean", + default: false, + visible: false, + isSerializable: false, + }, + { + name: "questionsOnPageMode", + default: "standard", + choices: ["singlePage", "standard", "questionPerPage"], + }, + { + name: "showPreviewBeforeComplete", + default: "noPreview", + choices: ["noPreview", "showAllQuestions", "showAnsweredQuestions"], + }, + { name: "maxTimeToFinish:number", default: 0, minValue: 0 }, + { name: "maxTimeToFinishPage:number", default: 0, minValue: 0 }, + { + name: "showTimerPanel", + default: "none", + choices: ["none", "top", "bottom"], + }, + { + name: "showTimerPanelMode", + default: "all", + choices: ["all", "page", "survey"], + }, + { + name: "widthMode", + default: "auto", + choices: ["auto", "static", "responsive"], + } + ]); + + + /***/ }), + + /***/ "./src/surveyProgress.ts": + /*!*******************************!*\ + !*** ./src/surveyProgress.ts ***! + \*******************************/ + /*! exports provided: SurveyProgressModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyProgressModel", function() { return SurveyProgressModel; }); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + + var SurveyProgressModel = /** @class */ (function () { + function SurveyProgressModel() { + } + SurveyProgressModel.getProgressTextInBarCss = function (css) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_0__["CssClassBuilder"]() + .append(css.progressText) + .append(css.progressTextInBar) + .toString(); + }; + SurveyProgressModel.getProgressTextUnderBarCss = function (css) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_0__["CssClassBuilder"]() + .append(css.progressText) + .append(css.progressTextUnderBar) + .toString(); + }; + return SurveyProgressModel; + }()); + + + + /***/ }), + + /***/ "./src/surveyProgressButtons.ts": + /*!**************************************!*\ + !*** ./src/surveyProgressButtons.ts ***! + \**************************************/ + /*! exports provided: SurveyProgressButtonsModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyProgressButtonsModel", function() { return SurveyProgressButtonsModel; }); + /* harmony import */ var _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/cssClassBuilder */ "./src/utils/cssClassBuilder.ts"); + + var SurveyProgressButtonsModel = /** @class */ (function () { + function SurveyProgressButtonsModel(survey) { + this.survey = survey; + } + SurveyProgressButtonsModel.prototype.isListElementClickable = function (index) { + if (!this.survey.onServerValidateQuestions || + this.survey.onServerValidateQuestions.isEmpty || + this.survey.checkErrorsMode === "onComplete") { + return true; + } + return index <= this.survey.currentPageNo + 1; + }; + SurveyProgressButtonsModel.prototype.getListElementCss = function (index) { + if (index >= this.survey.visiblePages.length) + return; + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_0__["CssClassBuilder"]() + .append(this.survey.css.progressButtonsListElementPassed, this.survey.visiblePages[index].passed) + .append(this.survey.css.progressButtonsListElementCurrent, this.survey.currentPageNo === index) + .append(this.survey.css.progressButtonsListElementNonClickable, !this.isListElementClickable(index)) + .toString(); + }; + SurveyProgressButtonsModel.prototype.getScrollButtonCss = function (hasScroller, isLeftScroll) { + return new _utils_cssClassBuilder__WEBPACK_IMPORTED_MODULE_0__["CssClassBuilder"]() + .append(this.survey.css.progressButtonsImageButtonLeft, isLeftScroll) + .append(this.survey.css.progressButtonsImageButtonRight, !isLeftScroll) + .append(this.survey.css.progressButtonsImageButtonHidden, !hasScroller) + .toString(); + }; + SurveyProgressButtonsModel.prototype.clickListElement = function (index) { + if (this.survey.isDesignMode) + return; + if (index < this.survey.currentPageNo) { + this.survey.currentPageNo = index; + } + else if (index > this.survey.currentPageNo) { + for (var i = this.survey.currentPageNo; i < index; i++) { + if (!this.survey.nextPage()) + break; + } + } + }; + return SurveyProgressButtonsModel; + }()); + + + + /***/ }), + + /***/ "./src/surveyStrings.ts": + /*!******************************!*\ + !*** ./src/surveyStrings.ts ***! + \******************************/ + /*! exports provided: surveyLocalization, surveyStrings */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "surveyLocalization", function() { return surveyLocalization; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "surveyStrings", function() { return surveyStrings; }); + /* harmony import */ var _localization_english__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./localization/english */ "./src/localization/english.ts"); + + var surveyLocalization = { + currentLocaleValue: "", + defaultLocaleValue: "en", + locales: {}, + localeNames: {}, + supportedLocales: [], + get currentLocale() { + return this.currentLocaleValue === this.defaultLocaleValue ? "" : this.currentLocaleValue; + }, + set currentLocale(val) { + if (val === "cz") + val = "cs"; + this.currentLocaleValue = val; + }, + get defaultLocale() { + return this.defaultLocaleValue; + }, + set defaultLocale(val) { + if (val === "cz") + val = "cs"; + this.defaultLocaleValue = val; + }, + getLocaleStrings: function (loc) { + return this.locales[loc]; + }, + getCurrentStrings: function (locale) { + var loc = locale && this.locales[locale]; + if (!loc) + loc = this.currentLocale ? this.locales[this.currentLocale] : this.locales[this.defaultLocale]; + if (!loc) + loc = this.locales[this.defaultLocale]; + return loc; + }, + getString: function (strName, locale) { + if (locale === void 0) { locale = null; } + var loc = this.getCurrentStrings(locale); + if (!loc[strName]) + loc = this.locales[this.defaultLocale]; + var result = loc[strName]; + if (result === undefined) { + result = this.locales["en"][strName]; + } + return result; + }, + getLocales: function (removeDefaultLoc) { + if (removeDefaultLoc === void 0) { removeDefaultLoc = false; } + var res = []; + res.push(""); + var locs = this.locales; + if (this.supportedLocales && this.supportedLocales.length > 0) { + locs = {}; + for (var i = 0; i < this.supportedLocales.length; i++) { + locs[this.supportedLocales[i]] = true; + } + } + for (var key in locs) { + if (removeDefaultLoc && key == this.defaultLocale) + continue; + res.push(key); + } + var locName = function (loc) { + if (!loc) + return ""; + var res = surveyLocalization.localeNames[loc]; + if (!res) + res = loc; + return res.toLowerCase(); + }; + res.sort(function (a, b) { + var str1 = locName(a); + var str2 = locName(b); + if (str1 === str2) + return 0; + return str1 < str2 ? -1 : 1; + }); + return res; + }, + }; + var surveyStrings = _localization_english__WEBPACK_IMPORTED_MODULE_0__["englishStrings"]; + surveyLocalization.locales["en"] = _localization_english__WEBPACK_IMPORTED_MODULE_0__["englishStrings"]; + surveyLocalization.localeNames["en"] = "english"; + + + /***/ }), + + /***/ "./src/surveyTimerModel.ts": + /*!*********************************!*\ + !*** ./src/surveyTimerModel.ts ***! + \*********************************/ + /*! exports provided: SurveyTimerModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTimerModel", function() { return SurveyTimerModel; }); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _surveytimer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./surveytimer */ "./src/surveytimer.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + var __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + + + var SurveyTimerModel = /** @class */ (function (_super) { + __extends(SurveyTimerModel, _super); + function SurveyTimerModel(survey) { + var _this = _super.call(this) || this; + _this.timerFunc = null; + _this.surveyValue = survey; + _this.onCreating(); + return _this; + } + Object.defineProperty(SurveyTimerModel.prototype, "survey", { + get: function () { return this.surveyValue; }, + enumerable: false, + configurable: true + }); + SurveyTimerModel.prototype.onCreating = function () { }; + SurveyTimerModel.prototype.start = function () { + var _this = this; + if (!this.survey) + return; + if (this.isRunning || this.isDesignMode) + return; + this.timerFunc = function () { _this.doTimer(); }; + this.setIsRunning(true); + this.updateText(); + _surveytimer__WEBPACK_IMPORTED_MODULE_1__["SurveyTimer"].instance.start(this.timerFunc); + }; + SurveyTimerModel.prototype.stop = function () { + if (!this.isRunning) + return; + this.setIsRunning(false); + _surveytimer__WEBPACK_IMPORTED_MODULE_1__["SurveyTimer"].instance.stop(this.timerFunc); + }; + Object.defineProperty(SurveyTimerModel.prototype, "isRunning", { + get: function () { + return this.getPropertyValue("isRunning", false); + }, + enumerable: false, + configurable: true + }); + SurveyTimerModel.prototype.setIsRunning = function (val) { + this.setPropertyValue("isRunning", val); + }; + SurveyTimerModel.prototype.doTimer = function () { + var page = this.survey.currentPage; + if (page) { + page.timeSpent = page.timeSpent + 1; + } + this.spent = this.spent + 1; + this.updateText(); + if (this.onTimer) { + this.onTimer(page); + } + }; + SurveyTimerModel.prototype.updateText = function () { + this.text = this.survey.timerInfoText; + }; + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])() + ], SurveyTimerModel.prototype, "text", void 0); + __decorate([ + Object(_jsonobject__WEBPACK_IMPORTED_MODULE_2__["property"])({ defaultValue: 0 }) + ], SurveyTimerModel.prototype, "spent", void 0); + return SurveyTimerModel; + }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); + + + + /***/ }), + + /***/ "./src/surveyWindow.ts": + /*!*****************************!*\ + !*** ./src/surveyWindow.ts ***! + \*****************************/ + /*! exports provided: SurveyWindowModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyWindowModel", function() { return SurveyWindowModel; }); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _survey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./survey */ "./src/survey.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + /** + * A Model for a survey running in the Window. + */ + var SurveyWindowModel = /** @class */ (function (_super) { + __extends(SurveyWindowModel, _super); + function SurveyWindowModel(jsonObj, initialModel) { + if (initialModel === void 0) { initialModel = null; } + var _this = _super.call(this) || this; + /** + * Set this value to negative value, for example -1, to avoid closing the window on completing the survey. Leave it equals to 0 (default value) to close the window immediately, or set it to 3, 5, 10, ... to close the window in 3, 5, 10 seconds. + */ + _this.closeOnCompleteTimeout = 0; + if (initialModel) { + _this.surveyValue = initialModel; + } + else { + _this.surveyValue = _this.createSurvey(jsonObj); + } + _this.surveyValue.showTitle = false; + if ("undefined" !== typeof document) { + _this.windowElement = document.createElement("div"); + } + _this.survey.onComplete.add(function (survey, options) { + _this.onSurveyComplete(); + }); + _this.registerFunctionOnPropertyValueChanged("isShowing", function () { + if (!!_this.showingChangedCallback) + _this.showingChangedCallback(); + }); + _this.registerFunctionOnPropertyValueChanged("isExpanded", function () { + _this.onExpandedChanged(); + }); + _this.updateCss(); + _this.onCreating(); + return _this; + } + SurveyWindowModel.prototype.onCreating = function () { }; + SurveyWindowModel.prototype.getType = function () { + return "window"; + }; + Object.defineProperty(SurveyWindowModel.prototype, "survey", { + /** + * A survey object. + * @see SurveyModel + */ + get: function () { + return this.surveyValue; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyWindowModel.prototype, "isShowing", { + /** + * Returns true if the window is currently showing. Set it to true to show the window and false to hide it. + * @see show + * @see hide + */ + get: function () { + return this.getPropertyValue("isShowing", false); + }, + set: function (val) { + this.setPropertyValue("isShowing", val); + }, + enumerable: false, + configurable: true + }); + /** + * Show the window + * @see hide + * @see isShowing + */ + SurveyWindowModel.prototype.show = function () { + this.isShowing = true; + }; + /** + * Hide the window + * @see show + * @see isShowing + */ + SurveyWindowModel.prototype.hide = function () { + this.isShowing = false; + }; + Object.defineProperty(SurveyWindowModel.prototype, "isExpanded", { + /** + * Returns true if the window is expanded. Set it to true to expand the window or false to collapse it. + * @see expand + * @see collapse + */ + get: function () { + return this.getPropertyValue("isExpanded", false); + }, + set: function (val) { + this.setPropertyValue("isExpanded", val); + }, + enumerable: false, + configurable: true + }); + SurveyWindowModel.prototype.onExpandedChanged = function () { + if (!!this.expandedChangedCallback) { + this.expandedChangedCallback(); + } + this.updateCssButton(); + }; + Object.defineProperty(SurveyWindowModel.prototype, "title", { + /** + * The window and survey title. + */ + get: function () { + return this.survey.title; + }, + set: function (value) { + this.survey.title = value; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyWindowModel.prototype, "locTitle", { + get: function () { + return this.survey.locTitle; + }, + enumerable: false, + configurable: true + }); + /** + * Expand the window to show the survey. + */ + SurveyWindowModel.prototype.expand = function () { + this.isExpanded = true; + }; + /** + * Collapse the window and show survey title only. + */ + SurveyWindowModel.prototype.collapse = function () { + this.isExpanded = false; + }; + SurveyWindowModel.prototype.changeExpandCollapse = function () { + this.isExpanded = !this.isExpanded; + }; + Object.defineProperty(SurveyWindowModel.prototype, "css", { + get: function () { + return this.survey.css; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyWindowModel.prototype, "cssButton", { + get: function () { + return this.getPropertyValue("cssButton", ""); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyWindowModel.prototype, "cssRoot", { + get: function () { + return this.getPropertyValue("cssRoot", ""); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyWindowModel.prototype, "cssBody", { + get: function () { + return this.getPropertyValue("cssBody", ""); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyWindowModel.prototype, "cssHeaderRoot", { + get: function () { + return this.getPropertyValue("cssHeaderRoot", ""); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyWindowModel.prototype, "cssHeaderTitle", { + get: function () { + return this.getPropertyValue("cssHeaderTitle", ""); + }, + enumerable: false, + configurable: true + }); + SurveyWindowModel.prototype.updateCss = function () { + if (!this.css || !this.css.window) + return; + var cssWindow = this.css.window; + this.setPropertyValue("cssRoot", cssWindow.root); + this.setPropertyValue("cssBody", cssWindow.body); + var cssHeader = cssWindow.header; + if (!cssHeader) + return; + this.setPropertyValue("cssHeaderRoot", cssHeader.root); + this.setPropertyValue("cssHeaderTitle", cssHeader.title); + this.updateCssButton(); + }; + SurveyWindowModel.prototype.updateCssButton = function () { + var cssHeader = !!this.css.window ? this.css.window.header : null; + if (!cssHeader) + return; + this.setCssButton(this.isExpanded ? cssHeader.buttonExpanded : cssHeader.buttonCollapsed); + }; + SurveyWindowModel.prototype.setCssButton = function (val) { + if (!val) + return; + this.setPropertyValue("cssButton", val); + }; + SurveyWindowModel.prototype.createSurvey = function (jsonObj) { + return new _survey__WEBPACK_IMPORTED_MODULE_1__["SurveyModel"](jsonObj); + }; + SurveyWindowModel.prototype.onSurveyComplete = function () { + if (this.closeOnCompleteTimeout < 0) + return; + if (this.closeOnCompleteTimeout == 0) { + this.hide(); + } + else { + var self = this; + var timerId = null; + var func = function () { + self.hide(); + if (typeof window !== "undefined") { + window.clearInterval(timerId); + } + }; + timerId = + typeof window !== "undefined" + ? window.setInterval(func, this.closeOnCompleteTimeout * 1000) + : 0; + } + }; + SurveyWindowModel.surveyElementName = "windowSurveyJS"; + return SurveyWindowModel; + }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); + + + + /***/ }), + + /***/ "./src/surveytimer.ts": + /*!****************************!*\ + !*** ./src/surveytimer.ts ***! + \****************************/ + /*! exports provided: surveyTimerFunctions, SurveyTimer */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "surveyTimerFunctions", function() { return surveyTimerFunctions; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTimer", function() { return SurveyTimer; }); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + + var surveyTimerFunctions = { + setTimeout: function (func) { + if (typeof window === "undefined") + return 0; + return window.setTimeout(func, 1000); + }, + clearTimeout: function (timerId) { + if (typeof window === "undefined") + return; + window.clearTimeout(timerId); + }, + }; + var SurveyTimer = /** @class */ (function () { + function SurveyTimer() { + this.listenerCounter = 0; + this.timerId = -1; + this.onTimer = new _base__WEBPACK_IMPORTED_MODULE_0__["Event"](); + } + Object.defineProperty(SurveyTimer, "instance", { + get: function () { + if (!SurveyTimer.instanceValue) { + SurveyTimer.instanceValue = new SurveyTimer(); + } + return SurveyTimer.instanceValue; + }, + enumerable: false, + configurable: true + }); + SurveyTimer.prototype.start = function (func) { + var _this = this; + if (func === void 0) { func = null; } + if (func) { + this.onTimer.add(func); + } + if (this.timerId < 0) { + this.timerId = surveyTimerFunctions.setTimeout(function () { + _this.doTimer(); + }); + } + this.listenerCounter++; + }; + SurveyTimer.prototype.stop = function (func) { + if (func === void 0) { func = null; } + if (func) { + this.onTimer.remove(func); + } + this.listenerCounter--; + if (this.listenerCounter == 0 && this.timerId > -1) { + surveyTimerFunctions.clearTimeout(this.timerId); + this.timerId = -1; + } + }; + SurveyTimer.prototype.doTimer = function () { + var _this = this; + if (this.onTimer.isEmpty || this.listenerCounter == 0) { + this.timerId = -1; + } + if (this.timerId < 0) + return; + var prevItem = this.timerId; + this.onTimer.fire(this, {}); + //We have to check that we have the same timerId + //It could be changed during events execution and it will lead to double timer events + if (prevItem !== this.timerId) + return; + this.timerId = surveyTimerFunctions.setTimeout(function () { + _this.doTimer(); + }); + }; + SurveyTimer.instanceValue = null; + return SurveyTimer; + }()); + + + + /***/ }), + + /***/ "./src/svgbundle.ts": + /*!**************************!*\ + !*** ./src/svgbundle.ts ***! + \**************************/ + /*! exports provided: SvgIconRegistry, SvgRegistry, SvgBundleViewModel */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SvgIconRegistry", function() { return SvgIconRegistry; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SvgRegistry", function() { return SvgRegistry; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SvgBundleViewModel", function() { return SvgBundleViewModel; }); + var SvgIconRegistry = /** @class */ (function () { + function SvgIconRegistry() { + this.icons = {}; + this.iconPrefix = "icon-"; + } + SvgIconRegistry.prototype.registerIconFromSymbol = function (iconId, iconSymbolSvg) { + this.icons[iconId] = iconSymbolSvg; + }; + SvgIconRegistry.prototype.registerIconFromSvgViaElement = function (iconId, iconSvg, iconPrefix) { + if (iconPrefix === void 0) { iconPrefix = this.iconPrefix; } + var divSvg = document.createElement("div"); + divSvg.innerHTML = iconSvg; + var symbol = document.createElement("symbol"); + var svg = divSvg.querySelector("svg"); + symbol.innerHTML = svg.innerHTML; + for (var i = 0; i < svg.attributes.length; i++) { + symbol.setAttributeNS("http://www.w3.org/2000/svg", svg.attributes[i].name, svg.attributes[i].value); + } + symbol.id = iconPrefix + iconId; + this.registerIconFromSymbol(iconId, symbol.outerHTML); + }; + SvgIconRegistry.prototype.registerIconFromSvg = function (iconId, iconSvg, iconPrefix) { + if (iconPrefix === void 0) { iconPrefix = this.iconPrefix; } + var startStr = ""); + return true; + } + else { + return false; + } + }; + SvgIconRegistry.prototype.registerIconsFromFolder = function (r) { + var _this = this; + r.keys().forEach(function (key) { + _this.registerIconFromSvg(key.substring(2, key.length - 4).toLowerCase(), r(key)); + }); + }; + SvgIconRegistry.prototype.iconsRenderedHtml = function () { + var _this = this; + return Object.keys(this.icons).map(function (icon) { return _this.icons[icon]; }).join(""); + }; + SvgIconRegistry.prototype.renderIcons = function () { + var containerId = "sv-icon-holder-global-container"; + if (!document.getElementById(containerId)) { + var iconsDiv = document.createElement("div"); + iconsDiv.id = containerId; + iconsDiv.innerHTML = "" + this.iconsRenderedHtml() + ""; + iconsDiv.style.display = "none"; + document.head.insertBefore(iconsDiv, document.head.firstChild); + } + }; + return SvgIconRegistry; + }()); + + var SvgRegistry = new SvgIconRegistry(); + var SvgBundleViewModel; + var path = __webpack_require__("./src/images sync \\.svg$"); + SvgRegistry.registerIconsFromFolder(path); + + + /***/ }), + + /***/ "./src/template-renderer.ts": + /*!**********************************!*\ + !*** ./src/template-renderer.ts ***! + \**********************************/ + /*! no exports provided */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + + + + /***/ }), + + /***/ "./src/textPreProcessor.ts": + /*!*********************************!*\ + !*** ./src/textPreProcessor.ts ***! + \*********************************/ + /*! exports provided: TextPreProcessorItem, TextPreProcessorValue, TextPreProcessor, QuestionTextProcessor */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextPreProcessorItem", function() { return TextPreProcessorItem; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextPreProcessorValue", function() { return TextPreProcessorValue; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextPreProcessor", function() { return TextPreProcessor; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QuestionTextProcessor", function() { return QuestionTextProcessor; }); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + /* harmony import */ var _conditionProcessValue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./conditionProcessValue */ "./src/conditionProcessValue.ts"); + + + var TextPreProcessorItem = /** @class */ (function () { + function TextPreProcessorItem() { + } + return TextPreProcessorItem; + }()); + + var TextPreProcessorValue = /** @class */ (function () { + function TextPreProcessorValue(name, returnDisplayValue) { + this.name = name; + this.returnDisplayValue = returnDisplayValue; + this.isExists = false; + this.canProcess = true; + } + return TextPreProcessorValue; + }()); + + var TextPreProcessor = /** @class */ (function () { + function TextPreProcessor() { + this._unObservableValues = [undefined]; + } + Object.defineProperty(TextPreProcessor.prototype, "hasAllValuesOnLastRunValue", { + get: function () { + return this._unObservableValues[0]; + }, + set: function (val) { + this._unObservableValues[0] = val; + }, + enumerable: false, + configurable: true + }); + TextPreProcessor.prototype.process = function (text, returnDisplayValue, doEncoding) { + if (returnDisplayValue === void 0) { returnDisplayValue = false; } + if (doEncoding === void 0) { doEncoding = false; } + this.hasAllValuesOnLastRunValue = true; + if (!text) + return text; + if (!this.onProcess) + return text; + var items = this.getItems(text); + for (var i = items.length - 1; i >= 0; i--) { + var item = items[i]; + var name = this.getName(text.substring(item.start + 1, item.end)); + if (!name) + continue; + var textValue = new TextPreProcessorValue(name, returnDisplayValue); + this.onProcess(textValue); + if (!textValue.isExists) { + if (textValue.canProcess) { + this.hasAllValuesOnLastRunValue = false; + } + continue; + } + if (_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(textValue.value)) { + this.hasAllValuesOnLastRunValue = false; + } + var replacedValue = !_helpers__WEBPACK_IMPORTED_MODULE_0__["Helpers"].isValueEmpty(textValue.value) + ? textValue.value + : ""; + if (doEncoding) { + replacedValue = encodeURIComponent(replacedValue); + } + text = + text.substr(0, item.start) + replacedValue + text.substr(item.end + 1); + } + return text; + }; + TextPreProcessor.prototype.processValue = function (name, returnDisplayValue) { + var textValue = new TextPreProcessorValue(name, returnDisplayValue); + if (!!this.onProcess) { + this.onProcess(textValue); + } + return textValue; + }; + Object.defineProperty(TextPreProcessor.prototype, "hasAllValuesOnLastRun", { + get: function () { + return !!this.hasAllValuesOnLastRunValue; + }, + enumerable: false, + configurable: true + }); + TextPreProcessor.prototype.getItems = function (text) { + var items = []; + var length = text.length; + var start = -1; + var ch = ""; + for (var i = 0; i < length; i++) { + ch = text[i]; + if (ch == "{") + start = i; + if (ch == "}") { + if (start > -1) { + var item = new TextPreProcessorItem(); + item.start = start; + item.end = i; + items.push(item); + } + start = -1; + } + } + return items; + }; + TextPreProcessor.prototype.getName = function (name) { + if (!name) + return; + return name.trim(); + }; + return TextPreProcessor; + }()); + + var QuestionTextProcessor = /** @class */ (function () { + function QuestionTextProcessor(variableName) { + var _this = this; + this.variableName = variableName; + this.textPreProcessor = new TextPreProcessor(); + this.textPreProcessor.onProcess = function (textValue) { + _this.getProcessedTextValue(textValue); + }; + } + QuestionTextProcessor.prototype.processValue = function (name, returnDisplayValue) { + return this.textPreProcessor.processValue(name, returnDisplayValue); + }; + Object.defineProperty(QuestionTextProcessor.prototype, "survey", { + get: function () { + return null; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(QuestionTextProcessor.prototype, "panel", { + get: function () { + return null; + }, + enumerable: false, + configurable: true + }); + QuestionTextProcessor.prototype.getValues = function () { + return !!this.panel ? this.panel.getValue() : null; + }; + QuestionTextProcessor.prototype.getQuestionByName = function (name) { + return !!this.panel + ? this.panel.getQuestionByValueName(name) + : null; + }; + QuestionTextProcessor.prototype.getParentTextProcessor = function () { return null; }; + QuestionTextProcessor.prototype.onCustomProcessText = function (textValue) { + return false; + }; + //ITextProcessor + QuestionTextProcessor.prototype.getProcessedTextValue = function (textValue) { + if (!textValue) + return; + if (this.onCustomProcessText(textValue)) + return; + var firstName = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_1__["ProcessValue"]().getFirstName(textValue.name); + textValue.isExists = firstName == this.variableName; + textValue.canProcess = textValue.isExists; + if (!textValue.canProcess) + return; + //name should start with the variable name + textValue.name = textValue.name.replace(this.variableName + ".", ""); + var firstName = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_1__["ProcessValue"]().getFirstName(textValue.name); + var question = this.getQuestionByName(firstName); + var values = {}; + if (question) { + values[firstName] = textValue.returnDisplayValue + ? question.displayValue + : question.value; + } + else { + var allValues = !!this.panel ? this.getValues() : null; + if (allValues) { + values[firstName] = allValues[firstName]; + } + } + textValue.value = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_1__["ProcessValue"]().getValue(textValue.name, values); + }; + QuestionTextProcessor.prototype.processText = function (text, returnDisplayValue) { + if (this.survey && this.survey.isDesignMode) + return text; + text = this.textPreProcessor.process(text, returnDisplayValue); + text = this.processTextCore(this.getParentTextProcessor(), text, returnDisplayValue); + return this.processTextCore(this.survey, text, returnDisplayValue); + }; + QuestionTextProcessor.prototype.processTextEx = function (text, returnDisplayValue) { + text = this.processText(text, returnDisplayValue); + var hasAllValuesOnLastRun = this.textPreProcessor.hasAllValuesOnLastRun; + var res = { hasAllValuesOnLastRun: true, text: text }; + if (this.survey) { + res = this.survey.processTextEx(text, returnDisplayValue, false); + } + res.hasAllValuesOnLastRun = + res.hasAllValuesOnLastRun && hasAllValuesOnLastRun; + return res; + }; + QuestionTextProcessor.prototype.processTextCore = function (textProcessor, text, returnDisplayValue) { + if (!textProcessor) + return text; + return textProcessor.processText(text, returnDisplayValue); + }; + return QuestionTextProcessor; + }()); + + + + /***/ }), + + /***/ "./src/trigger.ts": + /*!************************!*\ + !*** ./src/trigger.ts ***! + \************************/ + /*! exports provided: Trigger, SurveyTrigger, SurveyTriggerVisible, SurveyTriggerComplete, SurveyTriggerSetValue, SurveyTriggerSkip, SurveyTriggerRunExpression, SurveyTriggerCopyValue */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Trigger", function() { return Trigger; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTrigger", function() { return SurveyTrigger; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTriggerVisible", function() { return SurveyTriggerVisible; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTriggerComplete", function() { return SurveyTriggerComplete; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTriggerSetValue", function() { return SurveyTriggerSetValue; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTriggerSkip", function() { return SurveyTriggerSkip; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTriggerRunExpression", function() { return SurveyTriggerRunExpression; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyTriggerCopyValue", function() { return SurveyTriggerCopyValue; }); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); + /* harmony import */ var _expressions_expressions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./expressions/expressions */ "./src/expressions/expressions.ts"); + /* harmony import */ var _conditionProcessValue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./conditionProcessValue */ "./src/conditionProcessValue.ts"); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./settings */ "./src/settings.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + /** + * A base class for all triggers. + * A trigger calls a method when the expression change the result: from false to true or from true to false. + * Please note, it runs only one changing the expression result. + */ + var Trigger = /** @class */ (function (_super) { + __extends(Trigger, _super); + function Trigger() { + var _this = _super.call(this) || this; + _this.usedNames = []; + var self = _this; + _this.registerFunctionOnPropertiesValueChanged(["operator", "value", "name"], function () { + self.oldPropertiesChanged(); + }); + _this.registerFunctionOnPropertyValueChanged("expression", function () { + self.onExpressionChanged(); + }); + return _this; + } + Object.defineProperty(Trigger, "operators", { + get: function () { + if (Trigger.operatorsValue != null) + return Trigger.operatorsValue; + Trigger.operatorsValue = { + empty: function (value, expectedValue) { + return !value; + }, + notempty: function (value, expectedValue) { + return !!value; + }, + equal: function (value, expectedValue) { + return value == expectedValue; + }, + notequal: function (value, expectedValue) { + return value != expectedValue; + }, + contains: function (value, expectedValue) { + return value && value["indexOf"] && value.indexOf(expectedValue) > -1; + }, + notcontains: function (value, expectedValue) { + return (!value || !value["indexOf"] || value.indexOf(expectedValue) == -1); + }, + greater: function (value, expectedValue) { + return value > expectedValue; + }, + less: function (value, expectedValue) { + return value < expectedValue; + }, + greaterorequal: function (value, expectedValue) { + return value >= expectedValue; + }, + lessorequal: function (value, expectedValue) { + return value <= expectedValue; + }, + }; + return Trigger.operatorsValue; + }, + enumerable: false, + configurable: true + }); + Trigger.prototype.getType = function () { + return "triggerbase"; + }; + Trigger.prototype.toString = function () { + var res = this.getType().replace("trigger", ""); + var exp = !!this.expression ? this.expression : this.buildExpression(); + if (exp) { + res += ", " + exp; + } + return res; + }; + Object.defineProperty(Trigger.prototype, "operator", { + get: function () { + return this.getPropertyValue("operator", "equal"); + }, + set: function (value) { + if (!value) + return; + value = value.toLowerCase(); + if (!Trigger.operators[value]) + return; + this.setPropertyValue("operator", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Trigger.prototype, "value", { + get: function () { + return this.getPropertyValue("value", null); + }, + set: function (val) { + this.setPropertyValue("value", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Trigger.prototype, "name", { + get: function () { + return this.getPropertyValue("name", ""); + }, + set: function (val) { + this.setPropertyValue("name", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Trigger.prototype, "expression", { + get: function () { + return this.getPropertyValue("expression", ""); + }, + set: function (val) { + this.setPropertyValue("expression", val); + }, + enumerable: false, + configurable: true + }); + Trigger.prototype.checkExpression = function (keys, values, properties) { + if (properties === void 0) { properties = null; } + if (!this.isCheckRequired(keys)) + return; + if (!!this.conditionRunner) { + this.perform(values, properties); + } + }; + Trigger.prototype.check = function (value) { + var triggerResult = Trigger.operators[this.operator](value, this.value); + if (triggerResult) { + this.onSuccess({}, null); + } + else { + this.onFailure(); + } + }; + Trigger.prototype.perform = function (values, properties) { + var _this = this; + this.conditionRunner.onRunComplete = function (res) { + _this.triggerResult(res, values, properties); + }; + this.conditionRunner.run(values, properties); + }; + Trigger.prototype.triggerResult = function (res, values, properties) { + if (res) { + this.onSuccess(values, properties); + } + else { + this.onFailure(); + } + }; + Trigger.prototype.onSuccess = function (values, properties) { }; + Trigger.prototype.onFailure = function () { }; + Trigger.prototype.endLoadingFromJson = function () { + _super.prototype.endLoadingFromJson.call(this); + this.oldPropertiesChanged(); + }; + Trigger.prototype.oldPropertiesChanged = function () { + this.onExpressionChanged(); + }; + Trigger.prototype.onExpressionChanged = function () { + this.usedNames = []; + this.hasFunction = false; + this.conditionRunner = null; + }; + Trigger.prototype.buildExpression = function () { + if (!this.name) + return ""; + if (this.isValueEmpty(this.value) && this.isRequireValue) + return ""; + return ("{" + + this.name + + "} " + + this.operator + + " " + + _expressions_expressions__WEBPACK_IMPORTED_MODULE_3__["OperandMaker"].toOperandString(this.value)); + }; + Trigger.prototype.isCheckRequired = function (keys) { + if (!keys) + return false; + this.buildUsedNames(); + if (this.hasFunction === true) + return true; + var processValue = new _conditionProcessValue__WEBPACK_IMPORTED_MODULE_4__["ProcessValue"](); + for (var i = 0; i < this.usedNames.length; i++) { + var name = this.usedNames[i]; + if (keys.hasOwnProperty(name)) + return true; + var firstName = processValue.getFirstName(name); + if (!keys.hasOwnProperty(firstName)) + continue; + if (name == firstName) + return true; + var keyValue = keys[firstName]; + if (keyValue == undefined) + continue; + if (!keyValue.hasOwnProperty("oldValue") || + !keyValue.hasOwnProperty("newValue")) + return true; + var v = {}; + v[firstName] = keyValue["oldValue"]; + var oldValue = processValue.getValue(name, v); + v[firstName] = keyValue["newValue"]; + var newValue = processValue.getValue(name, v); + return !this.isTwoValueEquals(oldValue, newValue); + } + return false; + }; + Trigger.prototype.buildUsedNames = function () { + if (!!this.conditionRunner) + return; + var expression = this.expression; + if (!expression) { + expression = this.buildExpression(); + } + if (!expression) + return; + this.conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_2__["ConditionRunner"](expression); + this.hasFunction = this.conditionRunner.hasFunction(); + this.usedNames = this.conditionRunner.getVariables(); + }; + Object.defineProperty(Trigger.prototype, "isRequireValue", { + get: function () { + return this.operator !== "empty" && this.operator != "notempty"; + }, + enumerable: false, + configurable: true + }); + Trigger.operatorsValue = null; + return Trigger; + }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); + + /** + * It extends the Trigger base class and add properties required for SurveyJS classes. + */ + var SurveyTrigger = /** @class */ (function (_super) { + __extends(SurveyTrigger, _super); + function SurveyTrigger() { + var _this = _super.call(this) || this; + _this.ownerValue = null; + return _this; + } + Object.defineProperty(SurveyTrigger.prototype, "owner", { + get: function () { + return this.ownerValue; + }, + enumerable: false, + configurable: true + }); + SurveyTrigger.prototype.setOwner = function (owner) { + this.ownerValue = owner; + }; + SurveyTrigger.prototype.getSurvey = function (live) { + return !!this.owner && !!this.owner["getSurvey"] + ? this.owner.getSurvey() + : null; + }; + Object.defineProperty(SurveyTrigger.prototype, "isOnNextPage", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + return SurveyTrigger; + }(Trigger)); + + /** + * If expression returns true, it makes questions/pages visible. + * Ohterwise it makes them invisible. + */ + var SurveyTriggerVisible = /** @class */ (function (_super) { + __extends(SurveyTriggerVisible, _super); + function SurveyTriggerVisible() { + var _this = _super.call(this) || this; + _this.pages = []; + _this.questions = []; + return _this; + } + SurveyTriggerVisible.prototype.getType = function () { + return "visibletrigger"; + }; + SurveyTriggerVisible.prototype.onSuccess = function (values, properties) { + this.onTrigger(this.onItemSuccess); + }; + SurveyTriggerVisible.prototype.onFailure = function () { + this.onTrigger(this.onItemFailure); + }; + SurveyTriggerVisible.prototype.onTrigger = function (func) { + if (!this.owner) + return; + var objects = this.owner.getObjects(this.pages, this.questions); + for (var i = 0; i < objects.length; i++) { + func(objects[i]); + } + }; + SurveyTriggerVisible.prototype.onItemSuccess = function (item) { + item.visible = true; + }; + SurveyTriggerVisible.prototype.onItemFailure = function (item) { + item.visible = false; + }; + return SurveyTriggerVisible; + }(SurveyTrigger)); + + /** + * If expression returns true, it completes the survey. + */ + var SurveyTriggerComplete = /** @class */ (function (_super) { + __extends(SurveyTriggerComplete, _super); + function SurveyTriggerComplete() { + return _super.call(this) || this; + } + SurveyTriggerComplete.prototype.getType = function () { + return "completetrigger"; + }; + Object.defineProperty(SurveyTriggerComplete.prototype, "isOnNextPage", { + get: function () { + return !_settings__WEBPACK_IMPORTED_MODULE_5__["settings"].executeCompleteTriggerOnValueChanged; + }, + enumerable: false, + configurable: true + }); + SurveyTriggerComplete.prototype.onSuccess = function (values, properties) { + if (this.owner) + this.owner.setCompleted(); + }; + return SurveyTriggerComplete; + }(SurveyTrigger)); + + /** + * If expression returns true, the value from property **setValue** will be set to **setToName** + */ + var SurveyTriggerSetValue = /** @class */ (function (_super) { + __extends(SurveyTriggerSetValue, _super); + function SurveyTriggerSetValue() { + return _super.call(this) || this; + } + SurveyTriggerSetValue.prototype.getType = function () { + return "setvaluetrigger"; + }; + SurveyTriggerSetValue.prototype.onPropertyValueChanged = function (name, oldValue, newValue) { + _super.prototype.onPropertyValueChanged.call(this, name, oldValue, newValue); + if (name !== "setToName") + return; + var survey = this.getSurvey(); + if (survey && !survey.isLoadingFromJson && survey.isDesignMode) { + this.setValue = undefined; + } + }; + Object.defineProperty(SurveyTriggerSetValue.prototype, "setToName", { + get: function () { + return this.getPropertyValue("setToName", ""); + }, + set: function (val) { + this.setPropertyValue("setToName", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyTriggerSetValue.prototype, "setValue", { + get: function () { + return this.getPropertyValue("setValue"); + }, + set: function (val) { + this.setPropertyValue("setValue", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyTriggerSetValue.prototype, "isVariable", { + get: function () { + return this.getPropertyValue("isVariable", false); + }, + set: function (val) { + this.setPropertyValue("isVariable", val); + }, + enumerable: false, + configurable: true + }); + SurveyTriggerSetValue.prototype.onSuccess = function (values, properties) { + if (!this.setToName || !this.owner) + return; + this.owner.setTriggerValue(this.setToName, this.setValue, this.isVariable); + }; + return SurveyTriggerSetValue; + }(SurveyTrigger)); + + /** + * If expression returns true, the survey go to question **gotoName** and focus it. + */ + var SurveyTriggerSkip = /** @class */ (function (_super) { + __extends(SurveyTriggerSkip, _super); + function SurveyTriggerSkip() { + return _super.call(this) || this; + } + SurveyTriggerSkip.prototype.getType = function () { + return "skiptrigger"; + }; + Object.defineProperty(SurveyTriggerSkip.prototype, "gotoName", { + get: function () { + return this.getPropertyValue("gotoName", ""); + }, + set: function (val) { + this.setPropertyValue("gotoName", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyTriggerSkip.prototype, "isOnNextPage", { + get: function () { + return !_settings__WEBPACK_IMPORTED_MODULE_5__["settings"].executeSkipTriggerOnValueChanged; + }, + enumerable: false, + configurable: true + }); + SurveyTriggerSkip.prototype.onSuccess = function (values, properties) { + if (!this.gotoName || !this.owner) + return; + this.owner.focusQuestion(this.gotoName); + }; + return SurveyTriggerSkip; + }(SurveyTrigger)); + + /** + * If expression returns true, the **runExpression** will be run. If **setToName** property is not empty then the result of **runExpression** will be set to it. + */ + var SurveyTriggerRunExpression = /** @class */ (function (_super) { + __extends(SurveyTriggerRunExpression, _super); + function SurveyTriggerRunExpression() { + return _super.call(this) || this; + } + SurveyTriggerRunExpression.prototype.getType = function () { + return "runexpressiontrigger"; + }; + Object.defineProperty(SurveyTriggerRunExpression.prototype, "setToName", { + get: function () { + return this.getPropertyValue("setToName", ""); + }, + set: function (val) { + this.setPropertyValue("setToName", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyTriggerRunExpression.prototype, "runExpression", { + get: function () { + return this.getPropertyValue("runExpression", ""); + }, + set: function (val) { + this.setPropertyValue("runExpression", val); + }, + enumerable: false, + configurable: true + }); + SurveyTriggerRunExpression.prototype.onSuccess = function (values, properties) { + var _this = this; + if (!this.owner || !this.runExpression) + return; + var expression = new _conditions__WEBPACK_IMPORTED_MODULE_2__["ExpressionRunner"](this.runExpression); + if (expression.canRun) { + expression.onRunComplete = function (res) { + _this.onCompleteRunExpression(res); + }; + expression.run(values, properties); + } + }; + SurveyTriggerRunExpression.prototype.onCompleteRunExpression = function (newValue) { + if (!!this.setToName && newValue !== undefined) { + this.owner.setTriggerValue(this.setToName, newValue, false); + } + }; + return SurveyTriggerRunExpression; + }(SurveyTrigger)); + + /** + * If expression returns true, the value from question **fromName** will be set into **setToName**. + */ + var SurveyTriggerCopyValue = /** @class */ (function (_super) { + __extends(SurveyTriggerCopyValue, _super); + function SurveyTriggerCopyValue() { + return _super.call(this) || this; + } + Object.defineProperty(SurveyTriggerCopyValue.prototype, "setToName", { + get: function () { + return this.getPropertyValue("setToName", ""); + }, + set: function (val) { + this.setPropertyValue("setToName", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyTriggerCopyValue.prototype, "fromName", { + get: function () { + return this.getPropertyValue("fromName", ""); + }, + set: function (val) { + this.setPropertyValue("fromName", val); + }, + enumerable: false, + configurable: true + }); + SurveyTriggerCopyValue.prototype.getType = function () { + return "copyvaluetrigger"; + }; + SurveyTriggerCopyValue.prototype.onSuccess = function (values, properties) { + if (!this.setToName || !this.owner) + return; + this.owner.copyTriggerValue(this.setToName, this.fromName); + }; + return SurveyTriggerCopyValue; + }(SurveyTrigger)); + + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("trigger", [ + { name: "operator", default: "equal", visible: false }, + { name: "value", visible: false }, + "expression:condition", + ]); + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("surveytrigger", [{ name: "name", visible: false }], null, "trigger"); + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("visibletrigger", ["pages:pages", "questions:questions"], function () { + return new SurveyTriggerVisible(); + }, "surveytrigger"); + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("completetrigger", [], function () { + return new SurveyTriggerComplete(); + }, "surveytrigger"); + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("setvaluetrigger", [ + { name: "!setToName:questionvalue" }, + { + name: "setValue:triggervalue", + dependsOn: "setToName", + visibleIf: function (obj) { + return !!obj && !!obj["setToName"]; + }, + }, + { name: "isVariable:boolean", visible: false }, + ], function () { + return new SurveyTriggerSetValue(); + }, "surveytrigger"); + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("copyvaluetrigger", [{ name: "!fromName:questionvalue" }, { name: "!setToName:questionvalue" }], function () { + return new SurveyTriggerCopyValue(); + }, "surveytrigger"); + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("skiptrigger", [{ name: "!gotoName:question" }], function () { + return new SurveyTriggerSkip(); + }, "surveytrigger"); + _jsonobject__WEBPACK_IMPORTED_MODULE_1__["Serializer"].addClass("runexpressiontrigger", [{ name: "setToName:questionvalue" }, "runExpression:expression"], function () { + return new SurveyTriggerRunExpression(); + }, "surveytrigger"); + + + /***/ }), + + /***/ "./src/utils/cssClassBuilder.ts": + /*!**************************************!*\ + !*** ./src/utils/cssClassBuilder.ts ***! + \**************************************/ + /*! exports provided: CssClassBuilder */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CssClassBuilder", function() { return CssClassBuilder; }); + var CssClassBuilder = /** @class */ (function () { + function CssClassBuilder() { + this.classes = []; + } + CssClassBuilder.prototype.isEmpty = function () { + return this.toString() === ""; + }; + CssClassBuilder.prototype.append = function (value, condition) { + if (condition === void 0) { condition = true; } + if (!!value && condition) { + if (typeof value === "string") { + value = value.trim(); + } + this.classes.push(value); + } + return this; + }; + CssClassBuilder.prototype.toString = function () { + return this.classes.join(" "); + }; + return CssClassBuilder; + }()); + + + + /***/ }), + + /***/ "./src/utils/devices.ts": + /*!******************************!*\ + !*** ./src/utils/devices.ts ***! + \******************************/ + /*! exports provided: IsMobile, IsTouch */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IsMobile", function() { return IsMobile; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IsTouch", function() { return IsTouch; }); + // isMobile + var _isMobile = false; + var vendor = null; + if (typeof navigator !== "undefined" && + typeof window !== "undefined" && + navigator && + window) { + vendor = navigator.userAgent || navigator.vendor || window.opera; + } + (function (a) { + if (!a) + return; + if ((navigator.platform === "MacIntel" && navigator.maxTouchPoints > 0) || navigator.platform === "iPad") { + _isMobile = true; + } + else if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || + /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) + _isMobile = true; + })(vendor); + var _IPad = false; + var IsMobile = _isMobile || _IPad; + // isTouch + var _isTouch = false; + if (typeof window !== "undefined") { + _isTouch = "ontouchstart" in window || navigator.maxTouchPoints > 0; + } + var IsTouch = IsMobile && _isTouch; + + + /***/ }), + + /***/ "./src/utils/dragOrClickHelper.ts": + /*!****************************************!*\ + !*** ./src/utils/dragOrClickHelper.ts ***! + \****************************************/ + /*! exports provided: DragOrClickHelper */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DragOrClickHelper", function() { return DragOrClickHelper; }); + /* harmony import */ var survey_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! survey-core */ "./src/entries/core.ts"); + + var DragOrClickHelper = /** @class */ (function () { + function DragOrClickHelper(dragHandler) { + var _this = this; + this.dragHandler = dragHandler; + this.onPointerUp = function (pointerUpEvent) { + _this.clearListeners(); + }; + this.tryToStartDrag = function (pointerMoveEvent) { + _this.currentX = pointerMoveEvent.pageX; + _this.currentY = pointerMoveEvent.pageY; + if (_this.isMicroMovement) + return; + _this.clearListeners(); + _this.dragHandler(_this.pointerDownEvent, _this.currentTarget, _this.itemModel); + return true; + }; + } + DragOrClickHelper.prototype.onPointerDown = function (pointerDownEvent, itemModel) { + if (survey_core__WEBPACK_IMPORTED_MODULE_0__["IsTouch"]) { + this.dragHandler(pointerDownEvent, pointerDownEvent.currentTarget, itemModel); //TODO handle inside in the library's drag drop core, need refactoring + return; + } + this.pointerDownEvent = pointerDownEvent; + this.currentTarget = pointerDownEvent.currentTarget; + this.startX = pointerDownEvent.pageX; + this.startY = pointerDownEvent.pageY; + document.addEventListener("pointermove", this.tryToStartDrag); + this.currentTarget.addEventListener("pointerup", this.onPointerUp); + this.itemModel = itemModel; + }; + Object.defineProperty(DragOrClickHelper.prototype, "isMicroMovement", { + // see https://stackoverflow.com/questions/6042202/how-to-distinguish-mouse-click-and-drag + get: function () { + var delta = 10; + var diffX = Math.abs(this.currentX - this.startX); + var diffY = Math.abs(this.currentY - this.startY); + return diffX < delta && diffY < delta; + }, + enumerable: false, + configurable: true + }); + DragOrClickHelper.prototype.clearListeners = function () { + if (!this.pointerDownEvent) + return; + document.removeEventListener("pointermove", this.tryToStartDrag); + this.currentTarget.removeEventListener("pointerup", this.onPointerUp); + }; + return DragOrClickHelper; + }()); + + + + /***/ }), + + /***/ "./src/utils/popup.ts": + /*!****************************!*\ + !*** ./src/utils/popup.ts ***! + \****************************/ + /*! exports provided: PopupUtils */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PopupUtils", function() { return PopupUtils; }); + var PopupUtils = /** @class */ (function () { + function PopupUtils() { + } + PopupUtils.calculatePosition = function (targetRect, height, width, verticalPosition, horizontalPosition, showPointer) { + if (horizontalPosition == "center") + var left = (targetRect.left + targetRect.right - width) / 2; + else if (horizontalPosition == "left") + left = targetRect.left - width; + else + left = targetRect.right; + if (verticalPosition == "middle") + var top = (targetRect.top + targetRect.bottom - height) / 2; + else if (verticalPosition == "top") + top = targetRect.top - height; + else + top = targetRect.bottom; + if (showPointer) { + if (horizontalPosition != "center" && verticalPosition != "middle") { + if (verticalPosition == "top") { + top = top + targetRect.height; + } + else { + top = top - targetRect.height; + } + } + } + return { left: Math.round(left), top: Math.round(top) }; + }; + PopupUtils.updateVerticalDimensions = function (top, height, windowHeight) { + var result; + if (top < 0) { + result = { height: height + top, top: 0 }; + } + else if (height + top > windowHeight) { + var newHeight = Math.min(height, windowHeight - top - PopupUtils.bottomIndent); + result = { height: newHeight, top: top }; + } + return result; + }; + PopupUtils.updateHorizontalDimensions = function (left, width, windowWidth, horizontalPosition) { + var newWidth = width, newLeft = left; + if (horizontalPosition === "center") { + if (left < 0) { + newLeft = 0; + newWidth = Math.min(width, windowWidth); + } + else if (width + left > windowWidth) { + newLeft = windowWidth - width; + newLeft = Math.max(newLeft, 0); + newWidth = Math.min(width, windowWidth); + } + } + if (horizontalPosition === "left") { + if (left < 0) { + newLeft = 0; + newWidth = Math.min(width, windowWidth); + } + } + if (horizontalPosition === "right") { + if (width + left > windowWidth) { + newWidth = windowWidth - left; + } + } + return { width: newWidth, left: newLeft }; + }; + PopupUtils.updateVerticalPosition = function (targetRect, height, verticalPosition, showPointer, windowHeight) { + var deltaTop = height - (targetRect.top + (showPointer ? targetRect.height : 0)); + var deltaBottom = height + + targetRect.bottom - + (showPointer ? targetRect.height : 0) - + windowHeight; + if (deltaTop > 0 && deltaBottom <= 0 && verticalPosition == "top") { + verticalPosition = "bottom"; + } + else if (deltaBottom > 0 && + deltaTop <= 0 && + verticalPosition == "bottom") { + verticalPosition = "top"; + } + else if (deltaBottom > 0 && deltaTop > 0) { + verticalPosition = deltaTop < deltaBottom ? "top" : "bottom"; + } + return verticalPosition; + }; + PopupUtils.calculatePopupDirection = function (verticalPosition, horizontalPosition) { + var popupDirection; + if (horizontalPosition == "center" && verticalPosition != "middle") { + popupDirection = verticalPosition; + } + else if (horizontalPosition != "center") { + popupDirection = horizontalPosition; + } + return popupDirection; + }; + //called when showPointer is true + PopupUtils.calculatePointerTarget = function (targetRect, top, left, verticalPosition, horizontalPosition, marginLeft, marginRight) { + if (marginLeft === void 0) { marginLeft = 0; } + if (marginRight === void 0) { marginRight = 0; } + var targetPos = {}; + if (horizontalPosition != "center") { + targetPos.top = targetRect.top + targetRect.height / 2; + targetPos.left = targetRect[horizontalPosition]; + } + else if (verticalPosition != "middle") { + targetPos.top = targetRect[verticalPosition]; + targetPos.left = targetRect.left + targetRect.width / 2; + } + targetPos.left = Math.round(targetPos.left - left); + targetPos.top = Math.round(targetPos.top - top); + if (horizontalPosition == "left") { + targetPos.left -= marginLeft + marginRight; + } + if (horizontalPosition === "center") { + targetPos.left -= marginLeft; + } + return targetPos; + }; + PopupUtils.updatePopupWidthBeforeShow = function (popupModel, e) { + if (!!e && !!e.target) { + popupModel.width = e.target.getBoundingClientRect().width; + } + popupModel.toggleVisibility(); + }; + PopupUtils.bottomIndent = 16; + return PopupUtils; + }()); + + + + /***/ }), + + /***/ "./src/utils/responsivity-manager.ts": + /*!*******************************************!*\ + !*** ./src/utils/responsivity-manager.ts ***! + \*******************************************/ + /*! exports provided: ResponsivityManager, VerticalResponsivityManager */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResponsivityManager", function() { return ResponsivityManager; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VerticalResponsivityManager", function() { return VerticalResponsivityManager; }); + /* harmony import */ var timers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! timers */ "./node_modules/timers-browserify/main.js"); + /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./src/utils/utils.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + var ResponsivityManager = /** @class */ (function () { + function ResponsivityManager(container, model, itemsSelector, dotsItemSize) { + if (dotsItemSize === void 0) { dotsItemSize = 48; } + var _this = this; + this.container = container; + this.model = model; + this.itemsSelector = itemsSelector; + this.dotsItemSize = dotsItemSize; + this.resizeObserver = undefined; + this.isInitialized = false; + this.minDimensionConst = 56; + this.separatorSize = 17; + this.separatorAddConst = 1; + this.paddingSizeConst = 8; + this.recalcMinDimensionConst = true; + this.getComputedStyle = window.getComputedStyle.bind(window); + this.model.updateCallback = function (isResetInitialized) { + if (isResetInitialized) + _this.isInitialized = false; + else + Object(timers__WEBPACK_IMPORTED_MODULE_0__["setTimeout"])(function () { _this.process(); }, 1); + }; + if (typeof ResizeObserver !== "undefined") { + this.resizeObserver = new ResizeObserver(function (_) { return _this.process(); }); + this.resizeObserver.observe(this.container.parentElement); + } + } + ResponsivityManager.prototype.getDimensions = function (element) { + return { + scroll: element.scrollWidth, + offset: element.offsetWidth, + }; + }; + ResponsivityManager.prototype.getAvailableSpace = function () { + var style = this.getComputedStyle(this.container); + var space = this.container.offsetWidth; + if (style.boxSizing === "border-box") { + space -= parseFloat(style.paddingLeft) + parseFloat(style.paddingRight); + } + return space; + }; + ResponsivityManager.prototype.calcItemSize = function (item) { + return item.offsetWidth; + }; + ResponsivityManager.prototype.calcMinDimension = function (currentAction) { + var minDimensionConst = this.minDimensionConst; + if (currentAction.iconSize && this.recalcMinDimensionConst) { + minDimensionConst = 2 * currentAction.iconSize + this.paddingSizeConst; + } + return currentAction.canShrink + ? minDimensionConst + + (currentAction.needSeparator ? this.separatorSize : 0) + : currentAction.maxDimension; + }; + ResponsivityManager.prototype.calcItemsSizes = function () { + var _this = this; + var actions = this.model.actions; + this.container + .querySelectorAll(this.itemsSelector) + .forEach(function (item, index) { + var currentAction = actions[index]; + currentAction.maxDimension = _this.calcItemSize(item); + currentAction.minDimension = _this.calcMinDimension(currentAction); + }); + }; + Object.defineProperty(ResponsivityManager.prototype, "isContainerVisible", { + get: function () { + return Object(_utils__WEBPACK_IMPORTED_MODULE_1__["isContainerVisible"])(this.container); + }, + enumerable: false, + configurable: true + }); + ResponsivityManager.prototype.process = function () { + if (this.isContainerVisible && !this.model.isResponsivenessDisabled) { + if (!this.isInitialized) { + this.model.setActionsMode("large"); + this.calcItemsSizes(); + this.isInitialized = true; + } + this.model.fit(this.getAvailableSpace(), this.dotsItemSize); + } + }; + ResponsivityManager.prototype.dispose = function () { + this.model.updateCallback = undefined; + if (!!this.resizeObserver) { + this.resizeObserver.disconnect(); + } + }; + return ResponsivityManager; + }()); + + var VerticalResponsivityManager = /** @class */ (function (_super) { + __extends(VerticalResponsivityManager, _super); + function VerticalResponsivityManager(container, model, itemsSelector, dotsItemSize, minDimension) { + if (minDimension === void 0) { minDimension = 40; } + var _this = _super.call(this, container, model, itemsSelector, dotsItemSize) || this; + _this.minDimensionConst = minDimension; + _this.recalcMinDimensionConst = false; + return _this; + } + VerticalResponsivityManager.prototype.getDimensions = function () { + return { + scroll: this.container.scrollHeight, + offset: this.container.offsetHeight, + }; + }; + VerticalResponsivityManager.prototype.getAvailableSpace = function () { + var style = this.getComputedStyle(this.container); + var space = this.container.offsetHeight; + if (style.boxSizing === "border-box") { + space -= parseFloat(style.paddingTop) + parseFloat(style.paddingBottom); + } + return space; + }; + VerticalResponsivityManager.prototype.calcItemSize = function (item) { + return item.offsetHeight; + }; + return VerticalResponsivityManager; + }(ResponsivityManager)); + + + + /***/ }), + + /***/ "./src/utils/tooltip.ts": + /*!******************************!*\ + !*** ./src/utils/tooltip.ts ***! + \******************************/ + /*! exports provided: TooltipManager */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TooltipManager", function() { return TooltipManager; }); + var TooltipManager = /** @class */ (function () { + function TooltipManager(tooltipElement) { + var _this = this; + this.tooltipElement = tooltipElement; + this.onMouseMoveCallback = function (e) { + _this.tooltipElement.style.left = e.clientX + 12 + "px"; + _this.tooltipElement.style.top = e.clientY + 12 + "px"; + }; + this.targetElement = tooltipElement.parentElement; + this.targetElement.addEventListener("mousemove", this.onMouseMoveCallback); + } + TooltipManager.prototype.dispose = function () { + this.targetElement.removeEventListener("mousemove", this.onMouseMoveCallback); + }; + return TooltipManager; + }()); + + + + /***/ }), + + /***/ "./src/utils/utils.ts": + /*!****************************!*\ + !*** ./src/utils/utils.ts ***! + \****************************/ + /*! exports provided: unwrap, getSize, getElementWidth, isContainerVisible, classesToSelector, compareVersions, confirmAction, detectIEOrEdge, detectIEBrowser, loadFileFromBase64, isMobile, isElementVisible, findScrollableParent, scrollElementByChildId, createSvg, doKey2ClickBlur, doKey2ClickUp, doKey2ClickDown, getIconNameFromProxy, increaseHeightByContent, getOriginalEvent, preventDefaults */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unwrap", function() { return unwrap; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSize", function() { return getSize; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getElementWidth", function() { return getElementWidth; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isContainerVisible", function() { return isContainerVisible; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "classesToSelector", function() { return classesToSelector; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compareVersions", function() { return compareVersions; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "confirmAction", function() { return confirmAction; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectIEOrEdge", function() { return detectIEOrEdge; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectIEBrowser", function() { return detectIEBrowser; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadFileFromBase64", function() { return loadFileFromBase64; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isMobile", function() { return isMobile; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isElementVisible", function() { return isElementVisible; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findScrollableParent", function() { return findScrollableParent; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scrollElementByChildId", function() { return scrollElementByChildId; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSvg", function() { return createSvg; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doKey2ClickBlur", function() { return doKey2ClickBlur; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doKey2ClickUp", function() { return doKey2ClickUp; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "doKey2ClickDown", function() { return doKey2ClickDown; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getIconNameFromProxy", function() { return getIconNameFromProxy; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "increaseHeightByContent", function() { return increaseHeightByContent; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getOriginalEvent", function() { return getOriginalEvent; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "preventDefaults", function() { return preventDefaults; }); + /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../settings */ "./src/settings.ts"); + + function compareVersions(a, b) { + var regExStrip0 = /(\.0+)+$/; + var segmentsA = a.replace(regExStrip0, "").split("."); + var segmentsB = b.replace(regExStrip0, "").split("."); + var len = Math.min(segmentsA.length, segmentsB.length); + for (var i = 0; i < len; i++) { + var diff = parseInt(segmentsA[i], 10) - parseInt(segmentsB[i], 10); + if (diff) { + return diff; + } + } + return segmentsA.length - segmentsB.length; + } + function confirmAction(message) { + if (!!_settings__WEBPACK_IMPORTED_MODULE_0__["settings"] && !!_settings__WEBPACK_IMPORTED_MODULE_0__["settings"].confirmActionFunc) + return _settings__WEBPACK_IMPORTED_MODULE_0__["settings"].confirmActionFunc(message); + return confirm(message); + } + function detectIEBrowser() { + if (typeof window === "undefined") + return false; + var ua = window.navigator.userAgent; + var oldIe = ua.indexOf("MSIE "); + var elevenIe = ua.indexOf("Trident/"); + return oldIe > -1 || elevenIe > -1; + } + function detectIEOrEdge() { + if (typeof window === "undefined") + return false; + if (typeof detectIEOrEdge.isIEOrEdge === "undefined") { + var ua = window.navigator.userAgent; + var msie = ua.indexOf("MSIE "); + var trident = ua.indexOf("Trident/"); + var edge = ua.indexOf("Edge/"); + detectIEOrEdge.isIEOrEdge = edge > 0 || trident > 0 || msie > 0; + } + return detectIEOrEdge.isIEOrEdge; + } + function loadFileFromBase64(b64Data, fileName) { + try { + var byteString = atob(b64Data.split(",")[1]); + // separate out the mime component + var mimeString = b64Data + .split(",")[0] + .split(":")[1] + .split(";")[0]; + // write the bytes of the string to an ArrayBuffer + var ab = new ArrayBuffer(byteString.length); + var ia = new Uint8Array(ab); + for (var i = 0; i < byteString.length; i++) { + ia[i] = byteString.charCodeAt(i); + } + // write the ArrayBuffer to a blob, and you're done + var bb = new Blob([ab], { type: mimeString }); + if (typeof window !== "undefined" && + window.navigator && + window.navigator["msSaveBlob"]) { + window.navigator["msSaveOrOpenBlob"](bb, fileName); + } + } + catch (err) { } + } + function isMobile() { + return (typeof window !== "undefined" && typeof window.orientation !== "undefined"); + } + function isElementVisible(element, threshold) { + if (threshold === void 0) { threshold = 0; } + if (typeof document === "undefined") { + return false; + } + var elementRect = element.getBoundingClientRect(); + var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight); + var topWin = -threshold; + var bottomWin = viewHeight + threshold; + var topEl = elementRect.top; + var bottomEl = elementRect.bottom; + var maxTop = Math.max(topWin, topEl); + var minBottom = Math.min(bottomWin, bottomEl); + return maxTop <= minBottom; + } + function findScrollableParent(element) { + if (!element) { + return document.documentElement; + } + if (element.scrollHeight > element.clientHeight && + (getComputedStyle(element).overflowY === "scroll" || + getComputedStyle(element).overflowY === "auto")) { + return element; + } + if (element.scrollWidth > element.clientWidth && + (getComputedStyle(element).overflowX === "scroll" || + getComputedStyle(element).overflowX === "auto")) { + return element; + } + return findScrollableParent(element.parentElement); + } + function scrollElementByChildId(id) { + if (!document) + return; + var el = document.getElementById(id); + if (!el) + return; + var scrollableEl = findScrollableParent(el); + if (!!scrollableEl) { + scrollableEl.dispatchEvent(new CustomEvent("scroll")); + } + } + function getIconNameFromProxy(iconName) { + if (!iconName) + return iconName; + var proxyName = _settings__WEBPACK_IMPORTED_MODULE_0__["settings"].customIcons[iconName]; + return !!proxyName ? proxyName : iconName; + } + function createSvg(size, width, height, iconName, svgElem) { + if (!svgElem) + return; + if (size !== "auto") { + svgElem.style.width = (size || width || 16) + "px"; + svgElem.style.height = (size || height || 16) + "px"; + } + var node = svgElem.childNodes[0]; + var realIconName = getIconNameFromProxy(iconName); + node.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "#" + realIconName); + } + function unwrap(value) { + if (typeof value !== "function") { + return value; + } + else { + return value(); + } + } + function getSize(value) { + if (typeof value === "number") { + return "" + value + "px"; + } + if (!!value && typeof value === "string" && value.length > 0) { + var lastSymbol = value[value.length - 1]; + if ((lastSymbol >= "0" && lastSymbol <= "9") || lastSymbol == ".") { + try { + var num = parseFloat(value); + return "" + num + "px"; + } + catch (_a) { } + } + } + return value; + } + var keyFocusedClassName = "sv-focused--by-key"; + function doKey2ClickBlur(evt) { + var element = evt.target; + if (!element || !element.classList) + return; + element.classList.remove(keyFocusedClassName); + } + function doKey2ClickUp(evt, options) { + if (options === void 0) { options = { processEsc: true }; } + if (!!evt.target && evt.target["contentEditable"] === "true") { + return; + } + var element = evt.target; + if (!element) + return; + var char = evt.which || evt.keyCode; + if (char === 9) { + if (!!element.classList && !element.classList.contains(keyFocusedClassName)) { + element.classList.add(keyFocusedClassName); + } + } + else if (char === 13 || char === 32) { + if (element.click) + element.click(); + } + else if (options.processEsc && char === 27) { + if (element.blur) + element.blur(); + } + } + function doKey2ClickDown(evt, options) { + if (options === void 0) { options = { processEsc: true }; } + if (!!evt.target && evt.target["contentEditable"] === "true") { + return; + } + var char = evt.which || evt.keyCode; + var supportedCodes = [13, 32]; + if (options.processEsc) { + supportedCodes.push(27); + } + if (supportedCodes.indexOf(char) !== -1) { + evt.preventDefault(); + } + } + function increaseHeightByContent(element, getComputedStyle) { + if (!element) + return; + if (!getComputedStyle) + getComputedStyle = function (elt) { return window.getComputedStyle(elt); }; + var style = getComputedStyle(element); + element.style.height = "auto"; + element.style.height = (element.scrollHeight + parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth)) + "px"; + } + function getOriginalEvent(event) { + return event.originalEvent || event; + } + function preventDefaults(event) { + event.preventDefault(); + event.stopPropagation(); + } + function classesToSelector(str) { + var re = /\s*?([\w-]+)\s*?/g; + return str.replace(re, ".$1"); + } + function getElementWidth(el) { + return !!getComputedStyle ? Number.parseFloat(getComputedStyle(el).width) : el.offsetWidth; + } + function isContainerVisible(el) { + return !!(el.offsetWidth || + el.offsetHeight || + el.getClientRects().length); + } + + + + /***/ }), + + /***/ "./src/validator.ts": + /*!**************************!*\ + !*** ./src/validator.ts ***! + \**************************/ + /*! exports provided: ValidatorResult, SurveyValidator, ValidatorRunner, NumericValidator, TextValidator, AnswerCountValidator, RegexValidator, EmailValidator, ExpressionValidator */ + /***/ (function(module, __webpack_exports__, __webpack_require__) { + __webpack_require__.r(__webpack_exports__); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ValidatorResult", function() { return ValidatorResult; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SurveyValidator", function() { return SurveyValidator; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ValidatorRunner", function() { return ValidatorRunner; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumericValidator", function() { return NumericValidator; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextValidator", function() { return TextValidator; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnswerCountValidator", function() { return AnswerCountValidator; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RegexValidator", function() { return RegexValidator; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmailValidator", function() { return EmailValidator; }); + /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionValidator", function() { return ExpressionValidator; }); + /* harmony import */ var _base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base */ "./src/base.ts"); + /* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./error */ "./src/error.ts"); + /* harmony import */ var _surveyStrings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./surveyStrings */ "./src/surveyStrings.ts"); + /* harmony import */ var _jsonobject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./jsonobject */ "./src/jsonobject.ts"); + /* harmony import */ var _conditions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./conditions */ "./src/conditions.ts"); + /* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./helpers */ "./src/helpers.ts"); + var __extends = (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + })(); + + + + + + + var ValidatorResult = /** @class */ (function () { + function ValidatorResult(value, error) { + if (error === void 0) { error = null; } + this.value = value; + this.error = error; + } + return ValidatorResult; + }()); + + /** + * Base SurveyJS validator class. + */ + var SurveyValidator = /** @class */ (function (_super) { + __extends(SurveyValidator, _super); + function SurveyValidator() { + var _this = _super.call(this) || this; + _this.createLocalizableString("text", _this, true); + return _this; + } + SurveyValidator.prototype.getSurvey = function (live) { + return !!this.errorOwner && !!this.errorOwner["getSurvey"] + ? this.errorOwner.getSurvey() + : null; + }; + Object.defineProperty(SurveyValidator.prototype, "text", { + get: function () { + return this.getLocalizableStringText("text"); + }, + set: function (value) { + this.setLocalizableStringText("text", value); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyValidator.prototype, "isValidateAllValues", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyValidator.prototype, "locText", { + get: function () { + return this.getLocalizableString("text"); + }, + enumerable: false, + configurable: true + }); + SurveyValidator.prototype.getErrorText = function (name) { + if (this.text) + return this.text; + return this.getDefaultErrorText(name); + }; + SurveyValidator.prototype.getDefaultErrorText = function (name) { + return ""; + }; + SurveyValidator.prototype.validate = function (value, name, values, properties) { + return null; + }; + Object.defineProperty(SurveyValidator.prototype, "isRunning", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(SurveyValidator.prototype, "isAsync", { + get: function () { + return false; + }, + enumerable: false, + configurable: true + }); + SurveyValidator.prototype.getLocale = function () { + return !!this.errorOwner ? this.errorOwner.getLocale() : ""; + }; + SurveyValidator.prototype.getMarkdownHtml = function (text, name) { + return !!this.errorOwner + ? this.errorOwner.getMarkdownHtml(text, name) + : null; + }; + SurveyValidator.prototype.getRenderer = function (name) { + return !!this.errorOwner ? this.errorOwner.getRenderer(name) : null; + }; + SurveyValidator.prototype.getRendererContext = function (locStr) { + return !!this.errorOwner ? this.errorOwner.getRendererContext(locStr) : locStr; + }; + SurveyValidator.prototype.getProcessedText = function (text) { + return !!this.errorOwner ? this.errorOwner.getProcessedText(text) : text; + }; + SurveyValidator.prototype.createCustomError = function (name) { + return new _error__WEBPACK_IMPORTED_MODULE_1__["CustomError"](this.getErrorText(name), this.errorOwner); + }; + SurveyValidator.prototype.toString = function () { + var res = this.getType().replace("validator", ""); + if (!!this.text) { + res += ", " + this.text; + } + return res; + }; + return SurveyValidator; + }(_base__WEBPACK_IMPORTED_MODULE_0__["Base"])); + + var ValidatorRunner = /** @class */ (function () { + function ValidatorRunner() { + } + ValidatorRunner.prototype.run = function (owner) { + var _this = this; + var res = []; + var values = null; + var properties = null; + this.prepareAsyncValidators(); + var asyncResults = []; + var validators = owner.getValidators(); + for (var i = 0; i < validators.length; i++) { + var validator = validators[i]; + if (!values && validator.isValidateAllValues) { + values = owner.getDataFilteredValues(); + properties = owner.getDataFilteredProperties(); + } + if (validator.isAsync) { + this.asyncValidators.push(validator); + validator.onAsyncCompleted = function (result) { + if (!!result && !!result.error) + asyncResults.push(result.error); + if (!_this.onAsyncCompleted) + return; + for (var i = 0; i < _this.asyncValidators.length; i++) { + if (_this.asyncValidators[i].isRunning) + return; + } + _this.onAsyncCompleted(asyncResults); + }; + } + } + validators = owner.getValidators(); + for (var i = 0; i < validators.length; i++) { + var validator = validators[i]; + var validatorResult = validator.validate(owner.validatedValue, owner.getValidatorTitle(), values, properties); + if (!!validatorResult && !!validatorResult.error) { + res.push(validatorResult.error); + } + } + if (this.asyncValidators.length == 0 && !!this.onAsyncCompleted) + this.onAsyncCompleted([]); + return res; + }; + ValidatorRunner.prototype.prepareAsyncValidators = function () { + if (!!this.asyncValidators) { + for (var i = 0; i < this.asyncValidators.length; i++) { + this.asyncValidators[i].onAsyncCompleted = null; + } + } + this.asyncValidators = []; + }; + return ValidatorRunner; + }()); + + /** + * Validate numeric values. + */ + var NumericValidator = /** @class */ (function (_super) { + __extends(NumericValidator, _super); + function NumericValidator(minValue, maxValue) { + if (minValue === void 0) { minValue = null; } + if (maxValue === void 0) { maxValue = null; } + var _this = _super.call(this) || this; + _this.minValue = minValue; + _this.maxValue = maxValue; + return _this; + } + NumericValidator.prototype.getType = function () { + return "numericvalidator"; + }; + NumericValidator.prototype.validate = function (value, name, values, properties) { + if (name === void 0) { name = null; } + if (this.isValueEmpty(value)) + return null; + if (!_helpers__WEBPACK_IMPORTED_MODULE_5__["Helpers"].isNumber(value)) { + return new ValidatorResult(null, new _error__WEBPACK_IMPORTED_MODULE_1__["RequreNumericError"](null, this.errorOwner)); + } + var result = new ValidatorResult(parseFloat(value)); + if (this.minValue !== null && this.minValue > result.value) { + result.error = this.createCustomError(name); + return result; + } + if (this.maxValue !== null && this.maxValue < result.value) { + result.error = this.createCustomError(name); + return result; + } + return typeof value === "number" ? null : result; + }; + NumericValidator.prototype.getDefaultErrorText = function (name) { + var vName = name ? name : _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("value"); + if (this.minValue !== null && this.maxValue !== null) { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] + .getString("numericMinMax")["format"](vName, this.minValue, this.maxValue); + } + else { + if (this.minValue !== null) { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] + .getString("numericMin")["format"](vName, this.minValue); + } + return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] + .getString("numericMax")["format"](vName, this.maxValue); + } + }; + Object.defineProperty(NumericValidator.prototype, "minValue", { + /** + * The minValue property. + */ + get: function () { + return this.getPropertyValue("minValue"); + }, + set: function (val) { + this.setPropertyValue("minValue", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(NumericValidator.prototype, "maxValue", { + /** + * The maxValue property. + */ + get: function () { + return this.getPropertyValue("maxValue"); + }, + set: function (val) { + this.setPropertyValue("maxValue", val); + }, + enumerable: false, + configurable: true + }); + return NumericValidator; + }(SurveyValidator)); + + /** + * Validate text values. + */ + var TextValidator = /** @class */ (function (_super) { + __extends(TextValidator, _super); + function TextValidator() { + return _super.call(this) || this; + } + TextValidator.prototype.getType = function () { + return "textvalidator"; + }; + TextValidator.prototype.validate = function (value, name, values, properties) { + if (name === void 0) { name = null; } + if (this.isValueEmpty(value)) + return null; + if (!this.allowDigits) { + var reg = /^[A-Za-z\s]*$/; + if (!reg.test(value)) { + return new ValidatorResult(null, this.createCustomError(name)); + } + } + if (this.minLength > 0 && value.length < this.minLength) { + return new ValidatorResult(null, this.createCustomError(name)); + } + if (this.maxLength > 0 && value.length > this.maxLength) { + return new ValidatorResult(null, this.createCustomError(name)); + } + return null; + }; + TextValidator.prototype.getDefaultErrorText = function (name) { + if (this.minLength > 0 && this.maxLength > 0) + return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] + .getString("textMinMaxLength")["format"](this.minLength, this.maxLength); + if (this.minLength > 0) + return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] + .getString("textMinLength")["format"](this.minLength); + return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] + .getString("textMaxLength")["format"](this.maxLength); + }; + Object.defineProperty(TextValidator.prototype, "minLength", { + /** + * The minLength property. + */ + get: function () { + return this.getPropertyValue("minLength"); + }, + set: function (val) { + this.setPropertyValue("minLength", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextValidator.prototype, "maxLength", { + /** + * The maxLength property. + */ + get: function () { + return this.getPropertyValue("maxLength"); + }, + set: function (val) { + this.setPropertyValue("maxLength", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(TextValidator.prototype, "allowDigits", { + /** + * The allowDigits property. + */ + get: function () { + return this.getPropertyValue("allowDigits"); + }, + set: function (val) { + this.setPropertyValue("allowDigits", val); + }, + enumerable: false, + configurable: true + }); + return TextValidator; + }(SurveyValidator)); + + var AnswerCountValidator = /** @class */ (function (_super) { + __extends(AnswerCountValidator, _super); + function AnswerCountValidator(minCount, maxCount) { + if (minCount === void 0) { minCount = null; } + if (maxCount === void 0) { maxCount = null; } + var _this = _super.call(this) || this; + _this.minCount = minCount; + _this.maxCount = maxCount; + return _this; + } + AnswerCountValidator.prototype.getType = function () { + return "answercountvalidator"; + }; + AnswerCountValidator.prototype.validate = function (value, name, values, properties) { + if (value == null || value.constructor != Array) + return null; + var count = value.length; + if (count == 0) + return null; + if (this.minCount && count < this.minCount) { + return new ValidatorResult(null, this.createCustomError(_surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] + .getString("minSelectError")["format"](this.minCount))); + } + if (this.maxCount && count > this.maxCount) { + return new ValidatorResult(null, this.createCustomError(_surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] + .getString("maxSelectError")["format"](this.maxCount))); + } + return null; + }; + AnswerCountValidator.prototype.getDefaultErrorText = function (name) { + return name; + }; + Object.defineProperty(AnswerCountValidator.prototype, "minCount", { + /** + * The minCount property. + */ + get: function () { + return this.getPropertyValue("minCount"); + }, + set: function (val) { + this.setPropertyValue("minCount", val); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(AnswerCountValidator.prototype, "maxCount", { + /** + * The maxCount property. + */ + get: function () { + return this.getPropertyValue("maxCount"); + }, + set: function (val) { + this.setPropertyValue("maxCount", val); + }, + enumerable: false, + configurable: true + }); + return AnswerCountValidator; + }(SurveyValidator)); + + /** + * Use it to validate the text by regular expressions. + */ + var RegexValidator = /** @class */ (function (_super) { + __extends(RegexValidator, _super); + function RegexValidator(regex) { + if (regex === void 0) { regex = null; } + var _this = _super.call(this) || this; + _this.regex = regex; + return _this; + } + RegexValidator.prototype.getType = function () { + return "regexvalidator"; + }; + RegexValidator.prototype.validate = function (value, name, values, properties) { + if (name === void 0) { name = null; } + if (!this.regex || this.isValueEmpty(value)) + return null; + var re = new RegExp(this.regex); + if (Array.isArray(value)) { + for (var i = 0; i < value.length; i++) { + var res = this.hasError(re, value[i], name); + if (res) + return res; + } + } + return this.hasError(re, value, name); + }; + RegexValidator.prototype.hasError = function (re, value, name) { + if (re.test(value)) + return null; + return new ValidatorResult(value, this.createCustomError(name)); + }; + Object.defineProperty(RegexValidator.prototype, "regex", { + /** + * The regex property. + */ + get: function () { + return this.getPropertyValue("regex"); + }, + set: function (val) { + this.setPropertyValue("regex", val); + }, + enumerable: false, + configurable: true + }); + return RegexValidator; + }(SurveyValidator)); + + /** + * Validate e-mail address in the text input + */ + var EmailValidator = /** @class */ (function (_super) { + __extends(EmailValidator, _super); + function EmailValidator() { + var _this = _super.call(this) || this; + _this.re = /^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()=[\]\.,;:\s@\"]+\.)+[^<>()=[\]\.,;:\s@\"]{2,})$/i; + return _this; + } + EmailValidator.prototype.getType = function () { + return "emailvalidator"; + }; + EmailValidator.prototype.validate = function (value, name, values, properties) { + if (name === void 0) { name = null; } + if (!value) + return null; + if (this.re.test(value)) + return null; + return new ValidatorResult(value, this.createCustomError(name)); + }; + EmailValidator.prototype.getDefaultErrorText = function (name) { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"].getString("invalidEmail"); + }; + return EmailValidator; + }(SurveyValidator)); + + /** + * Show error if expression returns false + */ + var ExpressionValidator = /** @class */ (function (_super) { + __extends(ExpressionValidator, _super); + function ExpressionValidator(expression) { + if (expression === void 0) { expression = null; } + var _this = _super.call(this) || this; + _this.conditionRunner = null; + _this.isRunningValue = false; + _this.expression = expression; + return _this; + } + ExpressionValidator.prototype.getType = function () { + return "expressionvalidator"; + }; + Object.defineProperty(ExpressionValidator.prototype, "isValidateAllValues", { + get: function () { + return true; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ExpressionValidator.prototype, "isAsync", { + get: function () { + if (!this.ensureConditionRunner()) + return false; + return this.conditionRunner.isAsync; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(ExpressionValidator.prototype, "isRunning", { + get: function () { + return this.isRunningValue; + }, + enumerable: false, + configurable: true + }); + ExpressionValidator.prototype.validate = function (value, name, values, properties) { + var _this = this; + if (name === void 0) { name = null; } + if (values === void 0) { values = null; } + if (properties === void 0) { properties = null; } + if (!this.ensureConditionRunner()) + return null; + this.conditionRunner.onRunComplete = function (res) { + _this.isRunningValue = false; + if (!!_this.onAsyncCompleted) { + _this.onAsyncCompleted(_this.generateError(res, value, name)); + } + }; + this.isRunningValue = true; + var res = this.conditionRunner.run(values, properties); + if (this.conditionRunner.isAsync) + return null; + this.isRunningValue = false; + return this.generateError(res, value, name); + }; + ExpressionValidator.prototype.generateError = function (res, value, name) { + if (!res) { + return new ValidatorResult(value, this.createCustomError(name)); + } + return null; + }; + ExpressionValidator.prototype.getDefaultErrorText = function (name) { + return _surveyStrings__WEBPACK_IMPORTED_MODULE_2__["surveyLocalization"] + .getString("invalidExpression")["format"](this.expression); + }; + ExpressionValidator.prototype.ensureConditionRunner = function () { + if (!!this.conditionRunner) { + this.conditionRunner.expression = this.expression; + return true; + } + if (!this.expression) + return false; + this.conditionRunner = new _conditions__WEBPACK_IMPORTED_MODULE_4__["ConditionRunner"](this.expression); + return true; + }; + Object.defineProperty(ExpressionValidator.prototype, "expression", { + /** + * The expression property. + */ + get: function () { + return this.getPropertyValue("expression"); + }, + set: function (val) { + this.setPropertyValue("expression", val); + }, + enumerable: false, + configurable: true + }); + return ExpressionValidator; + }(SurveyValidator)); + + _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("surveyvalidator", [ + { name: "text", serializationProperty: "locText" }, + ]); + _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("numericvalidator", ["minValue:number", "maxValue:number"], function () { + return new NumericValidator(); + }, "surveyvalidator"); + _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("textvalidator", [{ name: "minLength:number", default: 0 }, + { name: "maxLength:number", default: 0 }, + { name: "allowDigits:boolean", default: true }], function () { + return new TextValidator(); + }, "surveyvalidator"); + _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("answercountvalidator", ["minCount:number", "maxCount:number"], function () { + return new AnswerCountValidator(); + }, "surveyvalidator"); + _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("regexvalidator", ["regex"], function () { + return new RegexValidator(); + }, "surveyvalidator"); + _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("emailvalidator", [], function () { + return new EmailValidator(); + }, "surveyvalidator"); + _jsonobject__WEBPACK_IMPORTED_MODULE_3__["Serializer"].addClass("expressionvalidator", ["expression:condition"], function () { + return new ExpressionValidator(); + }, "surveyvalidator"); + + + /***/ }), + + /***/ "knockout": + /*!********************************************************************************************!*\ + !*** external {"root":"ko","commonjs2":"knockout","commonjs":"knockout","amd":"knockout"} ***! + \********************************************************************************************/ + /*! no static exports found */ + /***/ (function(module, exports) { + + module.exports = __WEBPACK_EXTERNAL_MODULE_knockout__; + + /***/ }) + + /******/ }); + }); + + } (survey_ko)); const info = { name: "survey", @@ -62277,6 +62584,32 @@ var jsPsychSurvey = (function (jspsych) { pretty_name: "Textbox columns", default: 40, }, + /** + * Text only: Type for the HTML + + + + + + + + + diff --git a/jspsych-dist/examples/jspsych-html-video-response.html b/jspsych-dist/examples/jspsych-html-video-response.html new file mode 100644 index 0000000..395621a --- /dev/null +++ b/jspsych-dist/examples/jspsych-html-video-response.html @@ -0,0 +1,33 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/jspsych-dist/examples/jspsych-initialize-camera.html b/jspsych-dist/examples/jspsych-initialize-camera.html new file mode 100644 index 0000000..8567092 --- /dev/null +++ b/jspsych-dist/examples/jspsych-initialize-camera.html @@ -0,0 +1,20 @@ + + + + + + + + + + \ No newline at end of file diff --git a/jspsych-dist/examples/jspsych-mirror-camera.html b/jspsych-dist/examples/jspsych-mirror-camera.html new file mode 100644 index 0000000..1bd1a33 --- /dev/null +++ b/jspsych-dist/examples/jspsych-mirror-camera.html @@ -0,0 +1,26 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/jspsych-dist/license.txt b/jspsych-dist/license.txt index cb651e0..bb4e7ca 100644 --- a/jspsych-dist/license.txt +++ b/jspsych-dist/license.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2021 Joshua R. de Leeuw +Copyright (c) 2014-2022 Joshua R. de Leeuw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/psychophysics-demos/manual_drawFunc_gradation-LAPTOP-BR7JPMUG.html b/psychophysics-demos/manual_drawFunc_gradation-LAPTOP-BR7JPMUG.html new file mode 100644 index 0000000..75a49ea --- /dev/null +++ b/psychophysics-demos/manual_drawFunc_gradation-LAPTOP-BR7JPMUG.html @@ -0,0 +1,60 @@ + + + + + + + + + + + +