survey-creator-react 2.0.0-rc.1 → 2.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm/survey-creator-react.js +2850 -0
- package/fesm/survey-creator-react.js.map +1 -0
- package/index.html +2 -2
- package/package.json +5 -4
- package/survey-creator-react.js +22 -21
- package/survey-creator-react.js.map +1 -1
- package/survey-creator-react.min.js +1 -1
- package/survey-creator-react.min.js.LICENSE.txt +1 -1
- package/typings/entries/index.d.ts +0 -1
- package/survey-creator-react.d.ts +0 -2
- package/typings/ObjectSelector.d.ts +0 -1
- package/typings/PropertyGrid.d.ts +0 -14
- package/typings/Search.d.ts +0 -14
- package/typings/SideBar.d.ts +0 -19
- package/typings/SideBarPropertyGridHeader.d.ts +0 -1
- package/typings/SideBarPropertyGridPlaceholderHeader.d.ts +0 -1
- package/typings/SvgBundle.d.ts +0 -7
- package/typings/adorners/QuestionCarryForward.d.ts +0 -5
- package/typings/side-bar/Search.d.ts +0 -14
- package/typings/tab-control/TabButton.d.ts +0 -13
- package/typings/tab-control/TabControl.d.ts +0 -1
- package/typings/tabs/Embed.d.ts +0 -13
- package/typings/tabs/PropertyGridPlaceholder.d.ts +0 -4
- package/typings/tabs/Translation.d.ts +0 -9
- package/typings/tabs/TranslationLineSkeleton.d.ts +0 -4
- package/typings/toolbox/Toolbox.d.ts +0 -15
|
@@ -0,0 +1,2850 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SurveyJS Creator React v2.0.0-rc.10
|
|
3
|
+
* (c) 2015-2025 Devsoft Baltic OÜ - http://surveyjs.io/
|
|
4
|
+
* Github: https://github.com/surveyjs/survey-creator
|
|
5
|
+
* License: https://surveyjs.io/Licenses#SurveyCreator
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
import { createElement, Fragment } from 'react';
|
|
10
|
+
import * as ReactDOM from 'react-dom';
|
|
11
|
+
import { ReactElementFactory, SurveyElementBase, attachKey2click, SvgIcon, Survey, SvgBundleComponent, PopupModal, SurveyActionBar, NotifierComponent, ReactQuestionFactory, SurveyLocStringViewer, TitleElement, ReactSurveyElementsWrapper, LoadingIndicatorComponent, SurveyPage, Popup, LogoImage, SurveyQuestionElementBase, SurveyQuestion, CharacterCounterComponent, SurveyQuestionDropdown, SurveyHeader, List, SurveyQuestionButtonGroup, SurveyQuestionText } from 'survey-react-ui';
|
|
12
|
+
import { assign, SurveyCreatorModel, RowViewModel, QuestionAdornerViewModel, QuestionDropdownAdornerViewModel, QuestionImageAdornerViewModel, QuestionRatingAdornerViewModel, PageAdorner, LogoImageViewModel, editorLocalization, ItemValueWrapperViewModel, ImageItemValueWrapperViewModel, MatrixCellWrapperViewModel, SurveyResultsModel, ToolboxToolViewModel, ScrollViewModel, editableStringRendererName, StringEditorViewModelBase, initLogicOperator, PageNavigatorViewModel } from 'survey-creator-core';
|
|
13
|
+
export { PropertyGridEditorCollection, SurveyLogic, SurveyLogicUI, SurveyQuestionEditorDefinition, ToolboxToolViewModel, editorLocalization, localization, settings, svgBundle } from 'survey-creator-core';
|
|
14
|
+
import { ResponsivityManager, CssClassBuilder, settings, VerticalResponsivityManager, RendererFactory, unwrap, checkLibraryVersion } from 'survey-core';
|
|
15
|
+
|
|
16
|
+
class TabbedMenuComponent extends SurveyElementBase {
|
|
17
|
+
get model() {
|
|
18
|
+
return this.props.model;
|
|
19
|
+
}
|
|
20
|
+
getStateElement() {
|
|
21
|
+
return this.model;
|
|
22
|
+
}
|
|
23
|
+
constructor(props) {
|
|
24
|
+
super(props);
|
|
25
|
+
this.rootRef = React.createRef();
|
|
26
|
+
}
|
|
27
|
+
renderElement() {
|
|
28
|
+
const items = this.model.renderedActions.map((item) => React.createElement(TabbedMenuItemWrapper, { item: item, key: item.renderedId }));
|
|
29
|
+
return (React.createElement("div", { ref: this.rootRef, className: "svc-tabbed-menu" }, items));
|
|
30
|
+
}
|
|
31
|
+
componentDidMount() {
|
|
32
|
+
super.componentDidMount();
|
|
33
|
+
const container = this.rootRef.current;
|
|
34
|
+
if (!container)
|
|
35
|
+
return;
|
|
36
|
+
this.manager = new ResponsivityManager(container, this.model);
|
|
37
|
+
}
|
|
38
|
+
componentWillUnmount() {
|
|
39
|
+
this.manager && (this.manager.dispose());
|
|
40
|
+
super.componentWillUnmount();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
class TabbedMenuItemWrapper extends SurveyElementBase {
|
|
44
|
+
constructor(props) {
|
|
45
|
+
super(props);
|
|
46
|
+
this.ref = React.createRef();
|
|
47
|
+
}
|
|
48
|
+
get item() {
|
|
49
|
+
return this.props.item;
|
|
50
|
+
}
|
|
51
|
+
getStateElement() {
|
|
52
|
+
return this.item;
|
|
53
|
+
}
|
|
54
|
+
renderElement() {
|
|
55
|
+
let css = "svc-tabbed-menu-item-container";
|
|
56
|
+
if (this.item.css) {
|
|
57
|
+
css += " " + this.item.css;
|
|
58
|
+
}
|
|
59
|
+
css += (!this.item.isVisible ? " sv-action--hidden" : "");
|
|
60
|
+
const component = ReactElementFactory.Instance.createElement(this.item.component || "svc-tabbed-menu-item", { item: this.item });
|
|
61
|
+
return (React.createElement("span", { key: this.item.id, className: css, ref: this.ref },
|
|
62
|
+
React.createElement("div", { className: "sv-action__content" }, component)));
|
|
63
|
+
}
|
|
64
|
+
componentDidMount() {
|
|
65
|
+
super.componentDidMount();
|
|
66
|
+
this.item.updateModeCallback = (mode, callback) => {
|
|
67
|
+
queueMicrotask(() => {
|
|
68
|
+
if (ReactDOM["flushSync"]) {
|
|
69
|
+
ReactDOM["flushSync"](() => {
|
|
70
|
+
this.item.mode = mode;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this.item.mode = mode;
|
|
75
|
+
}
|
|
76
|
+
queueMicrotask(() => {
|
|
77
|
+
callback(mode, this.ref.current);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
this.item.afterRender();
|
|
82
|
+
}
|
|
83
|
+
componentWillUnmount() {
|
|
84
|
+
super.componentWillUnmount();
|
|
85
|
+
this.item.updateModeCallback = undefined;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
class TabbedMenuItemComponent extends SurveyElementBase {
|
|
89
|
+
get item() {
|
|
90
|
+
return this.props.item;
|
|
91
|
+
}
|
|
92
|
+
getStateElement() {
|
|
93
|
+
return this.item;
|
|
94
|
+
}
|
|
95
|
+
render() {
|
|
96
|
+
const item = this.item;
|
|
97
|
+
return (attachKey2click(React.createElement("div", { className: item.getRootCss(), onClick: () => item.action(item) },
|
|
98
|
+
item.hasTitle ? React.createElement("span", { className: item.getTitleCss() }, item.title) : null,
|
|
99
|
+
item.hasIcon ? React.createElement(SvgIcon, { iconName: item.iconName, className: item.getIconCss(), size: "auto", title: item.tooltip || item.title }) : null)));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
ReactElementFactory.Instance.registerElement("svc-tabbed-menu-item", (props) => {
|
|
103
|
+
return React.createElement(TabbedMenuItemComponent, props);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
class SurveyCreatorComponent extends SurveyElementBase {
|
|
107
|
+
constructor(props) {
|
|
108
|
+
super(props);
|
|
109
|
+
this.rootNode = React.createRef();
|
|
110
|
+
}
|
|
111
|
+
get creator() {
|
|
112
|
+
return this.props.creator;
|
|
113
|
+
}
|
|
114
|
+
getStateElement() {
|
|
115
|
+
return this.creator;
|
|
116
|
+
}
|
|
117
|
+
get style() {
|
|
118
|
+
return this.props.style;
|
|
119
|
+
}
|
|
120
|
+
componentDidUpdate(prevProps, prevState) {
|
|
121
|
+
super.componentDidUpdate(prevProps, prevState);
|
|
122
|
+
if (this.creator !== prevProps.creator) {
|
|
123
|
+
if (prevProps.creator) {
|
|
124
|
+
prevProps.creator.unsubscribeRootElement();
|
|
125
|
+
}
|
|
126
|
+
if (this.creator && this.rootNode.current) {
|
|
127
|
+
this.creator.setRootElement(this.rootNode.current);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
componentDidMount() {
|
|
132
|
+
super.componentDidMount();
|
|
133
|
+
this.creator.setRootElement(this.rootNode.current);
|
|
134
|
+
}
|
|
135
|
+
componentWillUnmount() {
|
|
136
|
+
super.componentWillUnmount();
|
|
137
|
+
this.creator.unsubscribeRootElement();
|
|
138
|
+
}
|
|
139
|
+
renderElement() {
|
|
140
|
+
const creator = this.props.creator;
|
|
141
|
+
if (creator.isCreatorDisposed)
|
|
142
|
+
return null;
|
|
143
|
+
const areaClassName = "svc-full-container svc-creator__area svc-flex-column" + (this.props.creator.haveCommercialLicense ? "" : " svc-creator__area--with-banner");
|
|
144
|
+
const contentWrapperClassName = "svc-creator__content-wrapper svc-flex-row" + (this.props.creator.isMobileView ? " svc-creator__content-wrapper--footer-toolbar" : "");
|
|
145
|
+
const fullContainerClassName = "svc-flex-row svc-full-container" + (" svc-creator__side-bar--" + this.creator.sidebarLocation);
|
|
146
|
+
const creatorStyles = {};
|
|
147
|
+
assign(creatorStyles, this.style, this.props.creator.themeVariables);
|
|
148
|
+
let licenseBanner = null;
|
|
149
|
+
if (!this.props.creator.haveCommercialLicense) {
|
|
150
|
+
const htmlValue = { __html: this.props.creator.licenseText };
|
|
151
|
+
licenseBanner = (React.createElement("div", { className: "svc-creator__banner" },
|
|
152
|
+
React.createElement("span", { className: "svc-creator__non-commercial-text", dangerouslySetInnerHTML: htmlValue })));
|
|
153
|
+
}
|
|
154
|
+
//AM: width unrecognized by react
|
|
155
|
+
return (React.createElement("div", { className: this.creator.getRootCss(), ref: this.rootNode, style: creatorStyles },
|
|
156
|
+
React.createElement(SvgBundleComponent, null),
|
|
157
|
+
React.createElement(PopupModal, null),
|
|
158
|
+
React.createElement("div", { className: areaClassName },
|
|
159
|
+
React.createElement("div", { className: fullContainerClassName },
|
|
160
|
+
React.createElement("div", { className: "svc-flex-column svc-flex-row__element svc-flex-row__element--growing" },
|
|
161
|
+
React.createElement("div", { className: "svc-top-bar" },
|
|
162
|
+
(creator.showTabs ?
|
|
163
|
+
React.createElement("div", { className: "svc-tabbed-menu-wrapper" },
|
|
164
|
+
React.createElement(TabbedMenuComponent, { model: creator.tabbedMenu })) : null),
|
|
165
|
+
(creator.showToolbar ?
|
|
166
|
+
React.createElement("div", { className: "svc-toolbar-wrapper" },
|
|
167
|
+
React.createElement(SurveyActionBar, { model: creator.toolbar }))
|
|
168
|
+
: null)),
|
|
169
|
+
React.createElement("div", { className: contentWrapperClassName },
|
|
170
|
+
React.createElement("div", { className: "svc-creator__content-holder svc-flex-column" }, this.renderActiveTab())),
|
|
171
|
+
React.createElement("div", { className: "svc-footer-bar" }, (creator.isMobileView ?
|
|
172
|
+
React.createElement("div", { className: "svc-toolbar-wrapper" },
|
|
173
|
+
React.createElement(SurveyActionBar, { model: creator.footerToolbar }))
|
|
174
|
+
: null))),
|
|
175
|
+
this.renderSidebar()),
|
|
176
|
+
licenseBanner,
|
|
177
|
+
React.createElement(NotifierComponent, { notifier: creator.notifier }))));
|
|
178
|
+
}
|
|
179
|
+
renderActiveTab() {
|
|
180
|
+
const creator = this.props.creator;
|
|
181
|
+
for (var i = 0; i < creator.tabs.length; i++) {
|
|
182
|
+
if (creator.tabs[i].id === creator.activeTab) {
|
|
183
|
+
return this.renderCreatorTab(creator.tabs[i]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
renderCreatorTab(tab) {
|
|
189
|
+
if (tab.visible === false) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
const creator = this.props.creator;
|
|
193
|
+
const component = !!tab.renderTab
|
|
194
|
+
? tab.renderTab()
|
|
195
|
+
: ReactElementFactory.Instance.createElement(tab.componentContent, {
|
|
196
|
+
creator: creator,
|
|
197
|
+
survey: creator.survey,
|
|
198
|
+
data: tab.data.model
|
|
199
|
+
});
|
|
200
|
+
const className = "svc-creator-tab" + (creator.toolboxLocation == "right" ? " svc-creator__toolbox--right" : "");
|
|
201
|
+
return (React.createElement("div", { key: tab.id, id: "scrollableDiv-" + tab.id, className: className }, component));
|
|
202
|
+
}
|
|
203
|
+
renderSidebar() {
|
|
204
|
+
if (!!this.creator.sidebar) {
|
|
205
|
+
return ReactElementFactory.Instance.createElement("svc-side-bar", { model: this.creator.sidebar });
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
class SurveyCreator extends SurveyCreatorModel {
|
|
213
|
+
constructor(options = {}, options2) {
|
|
214
|
+
super(options, options2);
|
|
215
|
+
}
|
|
216
|
+
render(target) {
|
|
217
|
+
let node = target;
|
|
218
|
+
if (typeof target === "string") {
|
|
219
|
+
node = document.getElementById(target);
|
|
220
|
+
}
|
|
221
|
+
/* eslint-disable react/no-deprecated */
|
|
222
|
+
ReactDOM.unmountComponentAtNode(node);
|
|
223
|
+
ReactDOM.render(React.createElement(React.StrictMode, null,
|
|
224
|
+
React.createElement(SurveyCreatorComponent, { creator: this })), node);
|
|
225
|
+
/* eslint-enable react/no-deprecated */
|
|
226
|
+
}
|
|
227
|
+
//ISurveyCreator
|
|
228
|
+
createQuestionElement(question) {
|
|
229
|
+
return ReactQuestionFactory.Instance.createQuestion(question.isDefaultRendering()
|
|
230
|
+
? question.getTemplate()
|
|
231
|
+
: question.getComponentName(), {
|
|
232
|
+
question: question,
|
|
233
|
+
isDisplayMode: question.isReadOnly,
|
|
234
|
+
creator: this
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
renderError(key, error, cssClasses) {
|
|
238
|
+
return (React.createElement("div", { key: key },
|
|
239
|
+
React.createElement("span", { className: cssClasses.error.icon, "aria-hidden": "true" }),
|
|
240
|
+
React.createElement("span", { className: cssClasses.error.item },
|
|
241
|
+
React.createElement(SurveyLocStringViewer, { locStr: error.locText }))));
|
|
242
|
+
}
|
|
243
|
+
questionTitleLocation() {
|
|
244
|
+
return this.survey.questionTitleLocation;
|
|
245
|
+
}
|
|
246
|
+
questionErrorLocation() {
|
|
247
|
+
return this.survey.questionErrorLocation;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
ReactElementFactory.Instance.registerElement("survey-widget", (props) => {
|
|
251
|
+
return React.createElement(Survey, props);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
class CreatorModelElement extends SurveyElementBase {
|
|
255
|
+
constructor(props) {
|
|
256
|
+
super(props);
|
|
257
|
+
this.createModel(props);
|
|
258
|
+
}
|
|
259
|
+
shouldComponentUpdate(nextProps, nextState) {
|
|
260
|
+
const result = super.shouldComponentUpdate(nextProps, nextState);
|
|
261
|
+
if (result) {
|
|
262
|
+
if (this.needUpdateModel(nextProps)) {
|
|
263
|
+
this.createModel(nextProps);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return result;
|
|
267
|
+
}
|
|
268
|
+
createModel(props) { }
|
|
269
|
+
needUpdateModel(nextProps) {
|
|
270
|
+
const names = this.getUpdatedModelProps();
|
|
271
|
+
if (!Array.isArray(names))
|
|
272
|
+
return true;
|
|
273
|
+
for (var i = 0; i < names.length; i++) {
|
|
274
|
+
const key = names[i];
|
|
275
|
+
if (this.props[key] !== nextProps[key])
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
getUpdatedModelProps() {
|
|
281
|
+
return undefined;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
class RowWrapper extends CreatorModelElement {
|
|
286
|
+
constructor(props) {
|
|
287
|
+
super(props);
|
|
288
|
+
}
|
|
289
|
+
createModel(props) {
|
|
290
|
+
if (!!this.model) {
|
|
291
|
+
this.model.dispose();
|
|
292
|
+
}
|
|
293
|
+
this.model = new RowViewModel(props.componentData.creator, props.row, null);
|
|
294
|
+
}
|
|
295
|
+
getUpdatedModelProps() {
|
|
296
|
+
return ["row", "componentData"];
|
|
297
|
+
}
|
|
298
|
+
getStateElement() {
|
|
299
|
+
return this.model;
|
|
300
|
+
}
|
|
301
|
+
componentDidMount() {
|
|
302
|
+
super.componentDidMount();
|
|
303
|
+
this.model.subscribeElementChanges();
|
|
304
|
+
}
|
|
305
|
+
componentWillUnmount() {
|
|
306
|
+
this.model.unsubscribeElementChanges();
|
|
307
|
+
super.componentWillUnmount();
|
|
308
|
+
}
|
|
309
|
+
render() {
|
|
310
|
+
return (React.createElement("div", { key: "svc-row-" + this.props.row.id, className: this.model.cssClasses },
|
|
311
|
+
React.createElement("div", { className: "svc-row__drop-indicator svc-row__drop-indicator--top" }),
|
|
312
|
+
React.createElement("div", { className: "svc-row__drop-indicator svc-row__drop-indicator--bottom" }),
|
|
313
|
+
this.props.element));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
ReactElementFactory.Instance.registerElement("svc-row", (props) => {
|
|
317
|
+
return React.createElement(RowWrapper, props);
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
class ReactMouseEvent {
|
|
321
|
+
constructor(event) {
|
|
322
|
+
this.event = event;
|
|
323
|
+
}
|
|
324
|
+
stopPropagation() {
|
|
325
|
+
this.event.stopPropagation();
|
|
326
|
+
//this.event.nativeEvent.stopPropagation();
|
|
327
|
+
//this.event.nativeEvent.stopImmediatePropagation();
|
|
328
|
+
}
|
|
329
|
+
preventDefault() {
|
|
330
|
+
this.event.preventDefault();
|
|
331
|
+
//this.event.nativeEvent.preventDefault();
|
|
332
|
+
}
|
|
333
|
+
get cancelBubble() {
|
|
334
|
+
//return this.event.cancelBubble;
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
set cancelBubble(value) {
|
|
338
|
+
//this.event.cancelBubble = value;
|
|
339
|
+
}
|
|
340
|
+
get target() {
|
|
341
|
+
return this.event.target;
|
|
342
|
+
}
|
|
343
|
+
get currentTarget() {
|
|
344
|
+
return this.event.currentTarget;
|
|
345
|
+
}
|
|
346
|
+
get clientX() {
|
|
347
|
+
return this.event.clientX;
|
|
348
|
+
}
|
|
349
|
+
get clientY() {
|
|
350
|
+
return this.event.clientY;
|
|
351
|
+
}
|
|
352
|
+
get offsetX() {
|
|
353
|
+
return this.event.nativeEvent.offsetX;
|
|
354
|
+
}
|
|
355
|
+
get offsetY() {
|
|
356
|
+
return this.event.nativeEvent.offsetY;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
class ReactDragEvent extends ReactMouseEvent {
|
|
360
|
+
constructor(event) {
|
|
361
|
+
super(event);
|
|
362
|
+
this.event = event;
|
|
363
|
+
}
|
|
364
|
+
get dataTransfer() {
|
|
365
|
+
return this.event.dataTransfer;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
class QuestionAdornerComponent extends CreatorModelElement {
|
|
370
|
+
constructor(props) {
|
|
371
|
+
super(props);
|
|
372
|
+
this.rootRef = React.createRef();
|
|
373
|
+
}
|
|
374
|
+
createModel(props) {
|
|
375
|
+
if (this.model) {
|
|
376
|
+
this.model.attachToUI(props.question, this.rootRef.current);
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
this.modelValue = this.createQuestionViewModel(props);
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
createQuestionViewModel(props) {
|
|
383
|
+
return new QuestionAdornerViewModel(props.componentData, props.question, null);
|
|
384
|
+
}
|
|
385
|
+
getUpdatedModelProps() {
|
|
386
|
+
return ["question", "componentData"];
|
|
387
|
+
}
|
|
388
|
+
get model() {
|
|
389
|
+
return this.modelValue;
|
|
390
|
+
}
|
|
391
|
+
getStateElement() {
|
|
392
|
+
return this.model;
|
|
393
|
+
}
|
|
394
|
+
renderElement() {
|
|
395
|
+
const allowInteractions = this.model.element
|
|
396
|
+
.isInteractiveDesignElement;
|
|
397
|
+
const titleForCollapsedState = this.renderQuestionTitle();
|
|
398
|
+
const content = this.renderContent(allowInteractions);
|
|
399
|
+
return (React.createElement("div", { ref: this.rootRef, "data-sv-drop-target-survey-element": this.model.element.name || null, className: this.model.rootCss(), onDoubleClick: e => { allowInteractions && this.model.dblclick(e.nativeEvent); e.stopPropagation(); }, onMouseLeave: e => allowInteractions && this.model.hover(e.nativeEvent, e.currentTarget), onMouseOver: e => allowInteractions && this.model.hover(e.nativeEvent, e.currentTarget) },
|
|
400
|
+
titleForCollapsedState,
|
|
401
|
+
content));
|
|
402
|
+
}
|
|
403
|
+
disableTabStop() {
|
|
404
|
+
return true;
|
|
405
|
+
}
|
|
406
|
+
renderContent(allowInteractions) {
|
|
407
|
+
var content = this.model.needToRenderContent ? this.renderElementContent() : null;
|
|
408
|
+
//if (!allowInteractions) return <>{content}{this.renderFooter()}</>;
|
|
409
|
+
return attachKey2click(React.createElement("div", { className: this.model.css(), onClick: (e) => this.model.select(this.model, new ReactMouseEvent(e)) },
|
|
410
|
+
React.createElement("div", { className: "svc-question__drop-indicator svc-question__drop-indicator--left" }),
|
|
411
|
+
React.createElement("div", { className: "svc-question__drop-indicator svc-question__drop-indicator--right" }),
|
|
412
|
+
React.createElement("div", { className: "svc-question__drop-indicator svc-question__drop-indicator--top" }),
|
|
413
|
+
React.createElement("div", { className: "svc-question__drop-indicator svc-question__drop-indicator--bottom" }),
|
|
414
|
+
allowInteractions ? this.renderHeader() : null,
|
|
415
|
+
content,
|
|
416
|
+
this.model.needToRenderContent ? this.renderFooter() : null), undefined, { disableTabStop: this.disableTabStop() });
|
|
417
|
+
}
|
|
418
|
+
renderHeader() {
|
|
419
|
+
return ReactElementFactory.Instance.createElement("svc-question-header", { model: this.model });
|
|
420
|
+
}
|
|
421
|
+
renderFooter() {
|
|
422
|
+
const allowInteractions = this.model.element
|
|
423
|
+
.isInteractiveDesignElement;
|
|
424
|
+
return allowInteractions ? ReactElementFactory.Instance.createElement("svc-question-footer", { className: "svc-question__content-actions", model: this.model }) : null;
|
|
425
|
+
}
|
|
426
|
+
renderCarryForwardBanner() {
|
|
427
|
+
if (!this.model.isBannerShowing)
|
|
428
|
+
return null;
|
|
429
|
+
return ReactElementFactory.Instance.createElement("svc-question-banner", this.model.createBannerParams());
|
|
430
|
+
}
|
|
431
|
+
renderQuestionTitle() {
|
|
432
|
+
if (!this.model.showHiddenTitle)
|
|
433
|
+
return null;
|
|
434
|
+
const element = this.model.element;
|
|
435
|
+
return (React.createElement("div", { ref: node => node && (!this.model.renderedCollapsed ?
|
|
436
|
+
node.setAttribute("inert", "") : node.removeAttribute("inert")), className: this.model.cssCollapsedHiddenHeader }, (element.hasTitle ?
|
|
437
|
+
React.createElement(TitleElement, { element: element }) :
|
|
438
|
+
React.createElement("div", { className: this.model.cssCollapsedHiddenTitle },
|
|
439
|
+
React.createElement("span", { className: "svc-fake-title" }, element.name)))));
|
|
440
|
+
}
|
|
441
|
+
renderElementContent() {
|
|
442
|
+
return (React.createElement(React.Fragment, null,
|
|
443
|
+
this.props.element,
|
|
444
|
+
this.renderElementPlaceholder(),
|
|
445
|
+
this.renderCarryForwardBanner()));
|
|
446
|
+
}
|
|
447
|
+
componentDidMount() {
|
|
448
|
+
super.componentDidMount();
|
|
449
|
+
this.model.attachToUI(this.props.question, this.rootRef.current);
|
|
450
|
+
}
|
|
451
|
+
renderElementPlaceholder() {
|
|
452
|
+
if (!this.model.isEmptyElement) {
|
|
453
|
+
return null;
|
|
454
|
+
}
|
|
455
|
+
return (React.createElement("div", { className: "svc-panel__placeholder_frame-wrapper" },
|
|
456
|
+
React.createElement("div", { className: "svc-panel__placeholder_frame" },
|
|
457
|
+
React.createElement("div", { className: "svc-panel__placeholder" }, this.model.placeholderText))));
|
|
458
|
+
}
|
|
459
|
+
componentWillUnmount() {
|
|
460
|
+
super.componentWillUnmount();
|
|
461
|
+
this.model.detachFromUI();
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
ReactElementFactory.Instance.registerElement("svc-question", (props) => {
|
|
465
|
+
return React.createElement(QuestionAdornerComponent, props);
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
class QuestionWrapperHeader extends React.Component {
|
|
469
|
+
render() {
|
|
470
|
+
if (!this.props.model.allowDragging)
|
|
471
|
+
return null;
|
|
472
|
+
return (React.createElement("div", { className: "svc-question__drag-area", onPointerDown: (event) => this.props.model.onPointerDown(event) },
|
|
473
|
+
React.createElement(SvgIcon, { className: "svc-question__drag-element", size: "auto", iconName: "icon-drag-area-indicator_24x16" }),
|
|
474
|
+
React.createElement("div", { className: "svc-question__top-actions" },
|
|
475
|
+
React.createElement(SurveyActionBar, { model: this.props.model.topActionContainer, handleClick: false }))));
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
ReactElementFactory.Instance.registerElement("svc-question-header", (props) => {
|
|
479
|
+
return React.createElement(QuestionWrapperHeader, props);
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
class QuestionWrapperFooter extends React.Component {
|
|
483
|
+
render() {
|
|
484
|
+
return (React.createElement("div", { className: this.props.className, onFocus: (e) => this.props.model.select(this.props.model, new ReactMouseEvent(e)) },
|
|
485
|
+
React.createElement(SurveyActionBar, { model: this.props.model.actionContainer, handleClick: false })));
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
ReactElementFactory.Instance.registerElement("svc-question-footer", (props) => {
|
|
489
|
+
return React.createElement(QuestionWrapperFooter, props);
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
class ActionButton extends SurveyElementBase {
|
|
493
|
+
renderElement() {
|
|
494
|
+
const classes = new CssClassBuilder()
|
|
495
|
+
.append(this.props.classes)
|
|
496
|
+
.append("svc-action-button")
|
|
497
|
+
.append("svc-action-button--selected", !!this.props.selected)
|
|
498
|
+
.append("svc-action-button--disabled", !!this.props.disabled)
|
|
499
|
+
.toString();
|
|
500
|
+
if (this.props.iconName) {
|
|
501
|
+
return this.renderIcon(classes);
|
|
502
|
+
}
|
|
503
|
+
return this.renderButtonText(classes);
|
|
504
|
+
}
|
|
505
|
+
renderButtonText(classes) {
|
|
506
|
+
if (this.props.disabled) {
|
|
507
|
+
return React.createElement("span", { className: classes }, this.props.text);
|
|
508
|
+
}
|
|
509
|
+
return (React.createElement(React.Fragment, null, attachKey2click(React.createElement("span", { role: "button", className: classes, onClick: (e) => {
|
|
510
|
+
if (!this.props.allowBubble) {
|
|
511
|
+
e.stopPropagation();
|
|
512
|
+
}
|
|
513
|
+
this.props.click();
|
|
514
|
+
}, title: this.props.title }, this.props.text))));
|
|
515
|
+
}
|
|
516
|
+
renderIcon(classes) {
|
|
517
|
+
classes += " svc-action-button--icon";
|
|
518
|
+
if (this.props.disabled) {
|
|
519
|
+
return React.createElement("span", { className: classes },
|
|
520
|
+
React.createElement(SvgIcon, { size: "auto", iconName: this.props.iconName }));
|
|
521
|
+
}
|
|
522
|
+
return (React.createElement(React.Fragment, null, attachKey2click(React.createElement("span", { className: classes, onClick: (e) => {
|
|
523
|
+
if (!this.props.allowBubble) {
|
|
524
|
+
e.stopPropagation();
|
|
525
|
+
}
|
|
526
|
+
this.props.click();
|
|
527
|
+
}, title: this.props.title },
|
|
528
|
+
React.createElement(SvgIcon, { size: "auto", iconName: this.props.iconName })))));
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
ReactElementFactory.Instance.registerElement("svc-action-button", (props) => { return React.createElement(ActionButton, props); });
|
|
532
|
+
|
|
533
|
+
class QuestionBanner extends React.Component {
|
|
534
|
+
render() {
|
|
535
|
+
return (React.createElement("div", { className: "svc-carry-forward-panel-wrapper" },
|
|
536
|
+
React.createElement("div", { className: "svc-carry-forward-panel" },
|
|
537
|
+
React.createElement("span", null,
|
|
538
|
+
this.props.text,
|
|
539
|
+
" "),
|
|
540
|
+
React.createElement("span", { className: "svc-carry-forward-panel__link" },
|
|
541
|
+
React.createElement(ActionButton, { click: () => this.props.onClick(), text: this.props.actionText })))));
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
ReactElementFactory.Instance.registerElement("svc-question-banner", (props) => {
|
|
545
|
+
return React.createElement(QuestionBanner, props);
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
class QuestionDropdownAdornerComponent extends QuestionAdornerComponent {
|
|
549
|
+
constructor(props) {
|
|
550
|
+
super(props);
|
|
551
|
+
}
|
|
552
|
+
createQuestionViewModel(props) {
|
|
553
|
+
return new QuestionDropdownAdornerViewModel(props.componentData, props.question, null);
|
|
554
|
+
}
|
|
555
|
+
get dropdownModel() {
|
|
556
|
+
return this.model;
|
|
557
|
+
}
|
|
558
|
+
get question() {
|
|
559
|
+
return this.dropdownModel.question;
|
|
560
|
+
}
|
|
561
|
+
renderElementPlaceholder() {
|
|
562
|
+
const textStyle = this.question.textStyle;
|
|
563
|
+
return (React.createElement("div", { className: "svc-question__dropdown-choices--wrapper" },
|
|
564
|
+
React.createElement("div", null,
|
|
565
|
+
React.createElement("div", { className: "svc-question__dropdown-choices" }, (this.dropdownModel.getRenderedItems() || []).map((item, index) => (React.createElement("div", { className: this.dropdownModel.getChoiceCss(), key: `editable_choice_${index}` }, ReactSurveyElementsWrapper.wrapItemValue(this.question.survey, ReactElementFactory.Instance.createElement(this.dropdownModel.itemComponent, {
|
|
566
|
+
key: item.value,
|
|
567
|
+
question: this.question,
|
|
568
|
+
cssClasses: this.question.cssClasses,
|
|
569
|
+
isDisplayMode: true,
|
|
570
|
+
item: item,
|
|
571
|
+
textStyle: textStyle,
|
|
572
|
+
index: index,
|
|
573
|
+
isChecked: this.question.value === item.value
|
|
574
|
+
}), this.question, item))))),
|
|
575
|
+
this.dropdownModel.needToCollapse ?
|
|
576
|
+
React.createElement(ActionButton, { click: this.dropdownModel.switchCollapse, text: this.dropdownModel.getButtonText(), allowBubble: true }) :
|
|
577
|
+
null)));
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
ReactElementFactory.Instance.registerElement("svc-dropdown-question", (props) => {
|
|
581
|
+
return React.createElement(QuestionDropdownAdornerComponent, props);
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
class QuestionImageAdornerComponent extends QuestionAdornerComponent {
|
|
585
|
+
createQuestionViewModel(props) {
|
|
586
|
+
return new QuestionImageAdornerViewModel(props.componentData, props.question, null);
|
|
587
|
+
}
|
|
588
|
+
get imageModel() {
|
|
589
|
+
return this.model;
|
|
590
|
+
}
|
|
591
|
+
renderHeader() {
|
|
592
|
+
return (React.createElement(React.Fragment, null,
|
|
593
|
+
React.createElement("input", { type: "file", "aria-hidden": "true", tabIndex: -1, accept: this.imageModel.acceptedTypes, className: "svc-choose-file-input", style: {
|
|
594
|
+
position: "absolute",
|
|
595
|
+
opacity: 0,
|
|
596
|
+
width: "1px",
|
|
597
|
+
height: "1px",
|
|
598
|
+
overflow: "hidden"
|
|
599
|
+
} }),
|
|
600
|
+
super.renderHeader()));
|
|
601
|
+
}
|
|
602
|
+
renderLoadingPlaceholder() {
|
|
603
|
+
return (React.createElement("div", { className: "svc-image-question__loading-placeholder" },
|
|
604
|
+
React.createElement("div", { className: "svc-image-question__loading" },
|
|
605
|
+
React.createElement(LoadingIndicatorComponent, null))));
|
|
606
|
+
}
|
|
607
|
+
renderChooseButton() {
|
|
608
|
+
return (React.createElement("div", { className: "svc-image-question-controls" }, this.model.allowEdit ? attachKey2click(React.createElement("span", { className: "svc-context-button", onClick: () => this.imageModel.chooseFile(this.imageModel) },
|
|
609
|
+
React.createElement(SvgIcon, { size: "auto", iconName: "icon-choosefile" }))) : null));
|
|
610
|
+
}
|
|
611
|
+
renderElementPlaceholder() {
|
|
612
|
+
return this.imageModel.isUploading ? this.renderLoadingPlaceholder() : this.renderChooseButton();
|
|
613
|
+
}
|
|
614
|
+
getStateElements() {
|
|
615
|
+
return [this.model, this.imageModel.filePresentationModel];
|
|
616
|
+
}
|
|
617
|
+
renderElementContent() {
|
|
618
|
+
if (this.imageModel.isEmptyImageLink) {
|
|
619
|
+
const fileQuestion = ReactQuestionFactory.Instance.createQuestion("file", {
|
|
620
|
+
creator: this.imageModel.question.survey,
|
|
621
|
+
isDisplayMode: false,
|
|
622
|
+
question: this.imageModel.filePresentationModel
|
|
623
|
+
});
|
|
624
|
+
return (React.createElement(React.Fragment, null, fileQuestion));
|
|
625
|
+
}
|
|
626
|
+
else {
|
|
627
|
+
return (React.createElement(React.Fragment, null,
|
|
628
|
+
this.props.element,
|
|
629
|
+
this.renderElementPlaceholder()));
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
ReactElementFactory.Instance.registerElement("svc-image-question", (props) => {
|
|
634
|
+
return React.createElement(QuestionImageAdornerComponent, props);
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
class QuestionRatingAdornerComponent extends CreatorModelElement {
|
|
638
|
+
createModel(props) {
|
|
639
|
+
this.modelValue = this.createQuestionViewModel(props);
|
|
640
|
+
}
|
|
641
|
+
createQuestionViewModel(props) {
|
|
642
|
+
return new QuestionRatingAdornerViewModel(props.componentData, props.question, null);
|
|
643
|
+
}
|
|
644
|
+
getUpdatedModelProps() {
|
|
645
|
+
return ["question", "componentData"];
|
|
646
|
+
}
|
|
647
|
+
get ratingModel() {
|
|
648
|
+
return this.model;
|
|
649
|
+
}
|
|
650
|
+
get model() {
|
|
651
|
+
return this.modelValue;
|
|
652
|
+
}
|
|
653
|
+
getStateElement() {
|
|
654
|
+
return this.model;
|
|
655
|
+
}
|
|
656
|
+
renderElement() {
|
|
657
|
+
const model = this.ratingModel;
|
|
658
|
+
return (React.createElement(React.Fragment, null,
|
|
659
|
+
React.createElement("div", { className: "svc-rating-question-content" },
|
|
660
|
+
React.createElement("div", { className: model.controlsClassNames },
|
|
661
|
+
model.allowRemove ? attachKey2click(React.createElement("span", { className: model.removeClassNames, "aria-label": model.removeTooltip, onClick: () => model.removeItem(model) },
|
|
662
|
+
React.createElement(SvgIcon, { size: "auto", iconName: "icon-remove_16x16", title: model.removeTooltip }))) : null,
|
|
663
|
+
model.allowAdd ? attachKey2click(React.createElement("span", { className: model.addClassNames, "aria-label": model.addTooltip, onClick: () => model.addItem(model) },
|
|
664
|
+
React.createElement(SvgIcon, { size: "auto", iconName: "icon-add_16x16", title: model.addTooltip }))) : null),
|
|
665
|
+
this.props.element)));
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
ReactElementFactory.Instance.registerElement("svc-rating-question", (props) => {
|
|
669
|
+
return React.createElement(QuestionRatingAdornerComponent, props);
|
|
670
|
+
});
|
|
671
|
+
ReactElementFactory.Instance.registerElement("svc-rating-question-content", (props) => {
|
|
672
|
+
return React.createElement(QuestionRatingAdornerComponent, props);
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
class QuestionWidgetAdornerComponent extends QuestionAdornerComponent {
|
|
676
|
+
createQuestionViewModel(props) {
|
|
677
|
+
return new QuestionAdornerViewModel(props.componentData, props.question, null);
|
|
678
|
+
}
|
|
679
|
+
get widgetModel() {
|
|
680
|
+
return this.model;
|
|
681
|
+
}
|
|
682
|
+
renderElementContent() {
|
|
683
|
+
return (React.createElement("div", { className: "svc-widget__content" }, this.props.element));
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
ReactElementFactory.Instance.registerElement("svc-widget-question", (props) => {
|
|
687
|
+
return React.createElement(QuestionWidgetAdornerComponent, props);
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
class CellQuestionAdornerComponent extends CreatorModelElement {
|
|
691
|
+
createModel(props) {
|
|
692
|
+
this.model = new QuestionAdornerViewModel(props.componentData, props.question, null);
|
|
693
|
+
}
|
|
694
|
+
getStateElement() {
|
|
695
|
+
return this.model;
|
|
696
|
+
}
|
|
697
|
+
getUpdatedModelProps() {
|
|
698
|
+
return ["question", "componentData"];
|
|
699
|
+
}
|
|
700
|
+
render() {
|
|
701
|
+
return (React.createElement(React.Fragment, null,
|
|
702
|
+
React.createElement("div", { "data-sv-drop-target-survey-element": this.model.element.name, className: "svc-question__adorner" },
|
|
703
|
+
React.createElement("div", { className: " svc-question__content--in-popup svc-question__content" }, this.props.element))));
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
ReactElementFactory.Instance.registerElement("svc-cell-question", (props) => {
|
|
707
|
+
return React.createElement(CellQuestionAdornerComponent, props);
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
class CellQuestionDropdownAdornerComponent extends CreatorModelElement {
|
|
711
|
+
createModel(props) {
|
|
712
|
+
this.model = new QuestionAdornerViewModel(props.componentData, props.question, null);
|
|
713
|
+
}
|
|
714
|
+
getUpdatedModelProps() {
|
|
715
|
+
return ["question", "componentData"];
|
|
716
|
+
}
|
|
717
|
+
getStateElement() {
|
|
718
|
+
return this.model;
|
|
719
|
+
}
|
|
720
|
+
render() {
|
|
721
|
+
const question = this.props.question;
|
|
722
|
+
const textStyle = this.props.question.textStyle;
|
|
723
|
+
return (React.createElement(React.Fragment, null,
|
|
724
|
+
React.createElement("div", { "data-sv-drop-target-survey-element": this.model.element.name, className: "svc-question__adorner" },
|
|
725
|
+
React.createElement("div", { className: " svc-question__content--in-popup svc-question__content" },
|
|
726
|
+
this.props.element,
|
|
727
|
+
React.createElement("div", { className: "svc-question__dropdown-choices" }, question.visibleChoices.map((item, index) => (React.createElement("div", { className: "svc-question__dropdown-choice", key: `editable_choice_${index}` }, ReactSurveyElementsWrapper.wrapItemValue(question.survey, ReactElementFactory.Instance.createElement("survey-radiogroup-item", {
|
|
728
|
+
question: question,
|
|
729
|
+
cssClasses: question.cssClasses,
|
|
730
|
+
isDisplayMode: true,
|
|
731
|
+
item: item,
|
|
732
|
+
textStyle: textStyle,
|
|
733
|
+
index: index,
|
|
734
|
+
isChecked: question.value === item.value
|
|
735
|
+
}), question, item)))))))));
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
ReactElementFactory.Instance.registerElement("svc-cell-dropdown-question", (props) => {
|
|
739
|
+
return React.createElement(CellQuestionDropdownAdornerComponent, props);
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
class CreatorSurveyPageComponent extends CreatorModelElement {
|
|
743
|
+
constructor(props) {
|
|
744
|
+
super(props);
|
|
745
|
+
this.rootRef = React.createRef();
|
|
746
|
+
}
|
|
747
|
+
createModel(props) {
|
|
748
|
+
if (this.model) {
|
|
749
|
+
this.model.attachToUI(props.page, this.rootRef.current);
|
|
750
|
+
}
|
|
751
|
+
this.model = new PageAdorner(props.creator, props.page);
|
|
752
|
+
this.model.isGhost = this.props.isGhost;
|
|
753
|
+
}
|
|
754
|
+
shouldComponentUpdate(nextProps, nextState) {
|
|
755
|
+
const res = super.shouldComponentUpdate(nextProps, nextState);
|
|
756
|
+
if (this.model) {
|
|
757
|
+
this.model.isGhost = this.props.isGhost;
|
|
758
|
+
}
|
|
759
|
+
return res;
|
|
760
|
+
}
|
|
761
|
+
componentDidUpdate(prevProps, prevState) {
|
|
762
|
+
super.componentDidUpdate(prevProps, prevState);
|
|
763
|
+
}
|
|
764
|
+
getUpdatedModelProps() {
|
|
765
|
+
return ["creator", "page"];
|
|
766
|
+
}
|
|
767
|
+
getStateElement() {
|
|
768
|
+
return this.model;
|
|
769
|
+
}
|
|
770
|
+
componentDidMount() {
|
|
771
|
+
super.componentDidMount();
|
|
772
|
+
this.model.attachToUI(this.props.page, this.rootRef.current);
|
|
773
|
+
this.model.isGhost = this.props.isGhost;
|
|
774
|
+
}
|
|
775
|
+
componentWillUnmount() {
|
|
776
|
+
super.componentWillUnmount();
|
|
777
|
+
this.model.detachFromUI();
|
|
778
|
+
}
|
|
779
|
+
canRender() {
|
|
780
|
+
return super.canRender();
|
|
781
|
+
}
|
|
782
|
+
renderElement() {
|
|
783
|
+
if (!this.props.page)
|
|
784
|
+
return null;
|
|
785
|
+
return (attachKey2click(React.createElement("div", { ref: this.rootRef, id: this.props.page.id, "data-sv-drop-target-survey-page": this.model.dropTargetName, className: "svc-page__content " + this.model.css, onClick: (e) => {
|
|
786
|
+
return this.model.select(this.model, new ReactMouseEvent(e));
|
|
787
|
+
}, onDoubleClick: e => this.model.dblclick(e.nativeEvent), onMouseLeave: (e) => this.model.hover(e.nativeEvent, e.currentTarget), onMouseOver: (e) => this.model.hover(e.nativeEvent, e.currentTarget) },
|
|
788
|
+
React.createElement("div", { className: "svc-question__drop-indicator svc-question__drop-indicator--top" }),
|
|
789
|
+
React.createElement("div", { className: "svc-question__drop-indicator svc-question__drop-indicator--bottom" }),
|
|
790
|
+
this.renderHeader(),
|
|
791
|
+
this.renderContent(),
|
|
792
|
+
this.renderPlaceholder(),
|
|
793
|
+
this.renderFooter())));
|
|
794
|
+
}
|
|
795
|
+
renderPlaceholder() {
|
|
796
|
+
if (!this.model.showPlaceholder)
|
|
797
|
+
return null;
|
|
798
|
+
return (React.createElement("div", { className: "svc-page__placeholder_frame" },
|
|
799
|
+
React.createElement("div", { className: "svc-panel__placeholder_frame" },
|
|
800
|
+
React.createElement("div", { className: "svc-panel__placeholder" }, this.model.placeholderText))));
|
|
801
|
+
}
|
|
802
|
+
renderContent() {
|
|
803
|
+
return (React.createElement(SurveyPage, { page: this.props.page, survey: this.props.survey, creator: this.props.creator, css: this.model.css }));
|
|
804
|
+
}
|
|
805
|
+
renderHeader() {
|
|
806
|
+
const actions = (React.createElement("div", { className: "svc-page__content-actions" },
|
|
807
|
+
React.createElement(SurveyActionBar, { model: this.model.actionContainer }),
|
|
808
|
+
(this.model.topActionContainer.hasActions ? React.createElement(SurveyActionBar, { model: this.model.topActionContainer }) : null)));
|
|
809
|
+
if (this.model.isGhost || !this.model.allowDragging) {
|
|
810
|
+
return actions;
|
|
811
|
+
}
|
|
812
|
+
return (React.createElement("div", { className: "svc-question__drag-area", onPointerDown: (event) => this.model.onPointerDown(event) },
|
|
813
|
+
React.createElement(SvgIcon, { className: "svc-question__drag-element", size: "auto", iconName: "icon-drag-area-indicator_24x16" }),
|
|
814
|
+
actions));
|
|
815
|
+
}
|
|
816
|
+
renderFooter() {
|
|
817
|
+
return React.createElement(SurveyActionBar, { model: this.model.footerActionsBar });
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
ReactElementFactory.Instance.registerElement("svc-page", (props) => {
|
|
821
|
+
return React.createElement(CreatorSurveyPageComponent, props);
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
class AddQuestionButtonComponent extends SurveyElementBase {
|
|
825
|
+
get model() {
|
|
826
|
+
return this.props.item.data;
|
|
827
|
+
}
|
|
828
|
+
renderTypeSelector() {
|
|
829
|
+
const questionTypeSelectorModel = this.model.questionTypeSelectorModel;
|
|
830
|
+
return attachKey2click(React.createElement("button", { type: "button", onClick: (e) => {
|
|
831
|
+
e.stopPropagation();
|
|
832
|
+
questionTypeSelectorModel.action();
|
|
833
|
+
}, className: "svc-element__question-type-selector", title: this.model.addNewQuestionText },
|
|
834
|
+
React.createElement("span", { className: "svc-element__question-type-selector-icon" },
|
|
835
|
+
React.createElement(SvgIcon, { iconName: questionTypeSelectorModel.iconName, size: "auto", title: this.model.addNewQuestionText })),
|
|
836
|
+
this.props.renderPopup === undefined || this.props.renderPopup ?
|
|
837
|
+
React.createElement(Popup, { model: questionTypeSelectorModel.popupModel })
|
|
838
|
+
: null));
|
|
839
|
+
}
|
|
840
|
+
renderElement() {
|
|
841
|
+
const addButtonClass = this.props.buttonClass || "svc-btn";
|
|
842
|
+
return React.createElement(React.Fragment, null,
|
|
843
|
+
attachKey2click(React.createElement("div", { className: "svc-element__add-new-question " + addButtonClass, onClick: (e) => {
|
|
844
|
+
e.stopPropagation();
|
|
845
|
+
this.model.addNewQuestion(this.model, new ReactMouseEvent(e));
|
|
846
|
+
}, onMouseOver: (e) => this.model.hoverStopper && this.model.hoverStopper(e.nativeEvent, e.currentTarget) },
|
|
847
|
+
React.createElement(SvgIcon, { className: "svc-panel__add-new-question-icon", iconName: "icon-add_24x24", size: "auto" }),
|
|
848
|
+
React.createElement("span", { className: "svc-add-new-item-button__text" }, this.model.addNewQuestionText),
|
|
849
|
+
this.props.renderPopup !== false ? this.renderTypeSelector() : null)),
|
|
850
|
+
this.props.renderPopup === false ? this.renderTypeSelector() : null);
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
ReactElementFactory.Instance.registerElement("svc-add-new-question-btn", (props) => {
|
|
854
|
+
return React.createElement(AddQuestionButtonComponent, props);
|
|
855
|
+
});
|
|
856
|
+
|
|
857
|
+
class PanelAdornerComponent extends QuestionAdornerComponent {
|
|
858
|
+
renderElementPlaceholder() {
|
|
859
|
+
if (!this.model.isEmptyElement) {
|
|
860
|
+
return null;
|
|
861
|
+
}
|
|
862
|
+
return (React.createElement("div", { className: "svc-panel__placeholder_frame-wrapper" },
|
|
863
|
+
React.createElement("div", { className: "svc-panel__placeholder_frame" },
|
|
864
|
+
React.createElement("div", { className: "svc-panel__placeholder" }, this.model.placeholderText),
|
|
865
|
+
this.model.showAddQuestionButton ? attachKey2click(React.createElement("div", { className: "svc-panel__add-new-question svc-action-button", onClick: (e) => {
|
|
866
|
+
e.stopPropagation();
|
|
867
|
+
this.model.addNewQuestion();
|
|
868
|
+
} },
|
|
869
|
+
React.createElement(SvgIcon, { className: "svc-panel__add-new-question-icon", iconName: "icon-add_24x24", size: "auto" }),
|
|
870
|
+
React.createElement("span", { className: "svc-add-new-item-button__text" }, this.model.addNewQuestionText))) : null)));
|
|
871
|
+
}
|
|
872
|
+
disableTabStop() {
|
|
873
|
+
return true;
|
|
874
|
+
}
|
|
875
|
+
renderFooter() {
|
|
876
|
+
return (React.createElement(React.Fragment, null,
|
|
877
|
+
!this.model.isEmptyElement && this.model.element.isPanel && this.model.showAddQuestionButton ? (React.createElement("div", { className: "svc-panel__add-new-question-container" },
|
|
878
|
+
React.createElement("div", { className: "svc-panel__question-type-selector-popup" },
|
|
879
|
+
React.createElement(Popup, { model: this.model.questionTypeSelectorModel.popupModel })),
|
|
880
|
+
React.createElement("div", { className: "svc-panel__add-new-question-wrapper" },
|
|
881
|
+
React.createElement(AddQuestionButtonComponent, { item: { data: this.model }, buttonClass: "svc-action-button", renderPopup: false })))) : null,
|
|
882
|
+
super.renderFooter()));
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
ReactElementFactory.Instance.registerElement("svc-panel", (props) => {
|
|
886
|
+
return React.createElement(PanelAdornerComponent, props);
|
|
887
|
+
});
|
|
888
|
+
|
|
889
|
+
class LogoImageComponent extends CreatorModelElement {
|
|
890
|
+
constructor(props) {
|
|
891
|
+
super(props);
|
|
892
|
+
this.rootRef = React.createRef();
|
|
893
|
+
}
|
|
894
|
+
createModel(props) {
|
|
895
|
+
let prevRoot = null;
|
|
896
|
+
if (!!this.model) {
|
|
897
|
+
prevRoot = this.model.root;
|
|
898
|
+
}
|
|
899
|
+
this.model = new LogoImageViewModel(props.data, prevRoot);
|
|
900
|
+
}
|
|
901
|
+
getUpdatedModelProps() {
|
|
902
|
+
return ["data"];
|
|
903
|
+
}
|
|
904
|
+
getStateElement() {
|
|
905
|
+
return this.model;
|
|
906
|
+
}
|
|
907
|
+
componentDidMount() {
|
|
908
|
+
super.componentDidMount();
|
|
909
|
+
this.model.root = this.rootRef.current;
|
|
910
|
+
}
|
|
911
|
+
renderChooseButton() {
|
|
912
|
+
return attachKey2click(React.createElement("span", { className: "svc-context-button", onClick: () => this.model.chooseFile(this.model) },
|
|
913
|
+
React.createElement(SvgIcon, { size: "auto", iconName: "icon-choosefile" })));
|
|
914
|
+
}
|
|
915
|
+
renderClearButton() {
|
|
916
|
+
return attachKey2click(React.createElement("span", { className: "svc-context-button svc-context-button--danger", onClick: () => this.model.remove(this.model) },
|
|
917
|
+
React.createElement(SvgIcon, { size: "auto", iconName: "icon-clear" })));
|
|
918
|
+
}
|
|
919
|
+
renderButtons() {
|
|
920
|
+
return (React.createElement("div", { className: "svc-context-container svc-logo-image-controls" },
|
|
921
|
+
this.renderChooseButton(),
|
|
922
|
+
this.renderClearButton()));
|
|
923
|
+
}
|
|
924
|
+
renderImage() {
|
|
925
|
+
return React.createElement("div", { className: this.model.containerCss },
|
|
926
|
+
this.renderButtons(),
|
|
927
|
+
React.createElement(LogoImage, { data: this.props.data.survey }));
|
|
928
|
+
}
|
|
929
|
+
renderPlaceHolder() {
|
|
930
|
+
return this.model.allowEdit && !this.model.isUploading ? attachKey2click(React.createElement("div", { className: "svc-logo-image-placeholder", onClick: () => this.model.chooseFile(this.model) },
|
|
931
|
+
React.createElement("svg", null,
|
|
932
|
+
React.createElement("use", { xlinkHref: "#icon-image-48x48" })))) : null;
|
|
933
|
+
}
|
|
934
|
+
renderInput() {
|
|
935
|
+
return React.createElement("input", { "aria-hidden": "true", type: "file", tabIndex: -1, accept: this.model.acceptedTypes, className: "svc-choose-file-input" });
|
|
936
|
+
}
|
|
937
|
+
renderLoadingIndicator() {
|
|
938
|
+
return React.createElement("div", { className: "svc-logo-image__loading" },
|
|
939
|
+
React.createElement(LoadingIndicatorComponent, null));
|
|
940
|
+
}
|
|
941
|
+
render() {
|
|
942
|
+
let content = null;
|
|
943
|
+
if (this.model.survey.locLogo.renderedHtml && !this.model.isUploading) {
|
|
944
|
+
content = this.renderImage();
|
|
945
|
+
}
|
|
946
|
+
else if (this.model.isUploading) {
|
|
947
|
+
content = this.renderLoadingIndicator();
|
|
948
|
+
}
|
|
949
|
+
else {
|
|
950
|
+
content = this.renderPlaceHolder();
|
|
951
|
+
}
|
|
952
|
+
return (React.createElement("div", { ref: this.rootRef, className: "svc-logo-image" },
|
|
953
|
+
this.renderInput(),
|
|
954
|
+
content));
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
ReactElementFactory.Instance.registerElement("svc-logo-image", (props) => {
|
|
958
|
+
return React.createElement(LogoImageComponent, props);
|
|
959
|
+
});
|
|
960
|
+
|
|
961
|
+
class SurveyQuestionLinkValue extends SurveyQuestionElementBase {
|
|
962
|
+
get question() {
|
|
963
|
+
return this.questionBase;
|
|
964
|
+
}
|
|
965
|
+
renderClear() {
|
|
966
|
+
const showClear = this.questionBase.showClear;
|
|
967
|
+
if (!this.questionBase.isReadOnly && showClear) {
|
|
968
|
+
return (React.createElement(ActionButton, { classes: this.question.linkClearButtonCssClasses, click: () => this.question.doClearClick(), text: editorLocalization.getString("pe.clear") }));
|
|
969
|
+
}
|
|
970
|
+
else {
|
|
971
|
+
return null;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
renderElement() {
|
|
975
|
+
return (React.createElement(React.Fragment, null,
|
|
976
|
+
React.createElement(ActionButton, { classes: this.question.linkSetButtonCssClasses, click: () => this.question.doLinkClick(), selected: this.question.isSelected, disabled: !this.question.isClickable, text: this.question.linkValueText, title: this.question.tooltip, iconName: this.question.iconName }),
|
|
977
|
+
this.renderClear()));
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
ReactQuestionFactory.Instance.registerQuestion("linkvalue", (props) => {
|
|
981
|
+
return React.createElement(SurveyQuestionLinkValue, props);
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
class SurveyElementEmbeddedSurvey extends SurveyQuestionElementBase {
|
|
985
|
+
get embeddedSurvey() {
|
|
986
|
+
return (this.props.element || this.props.question);
|
|
987
|
+
}
|
|
988
|
+
get creator() {
|
|
989
|
+
return this.props.creator;
|
|
990
|
+
}
|
|
991
|
+
render() {
|
|
992
|
+
if (!this.embeddedSurvey)
|
|
993
|
+
return null;
|
|
994
|
+
const survey = this.embeddedSurvey.embeddedSurvey;
|
|
995
|
+
if (!survey || !survey.currentPage)
|
|
996
|
+
return null;
|
|
997
|
+
return React.createElement(SurveyPage, { survey: survey, page: survey.currentPage, css: survey.css, creator: this.creator });
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
ReactQuestionFactory.Instance.registerQuestion("embeddedsurvey", (props) => {
|
|
1001
|
+
return React.createElement(SurveyElementEmbeddedSurvey, props);
|
|
1002
|
+
});
|
|
1003
|
+
|
|
1004
|
+
class QuestionEditorContentComponent extends React.Component {
|
|
1005
|
+
get survey() {
|
|
1006
|
+
return this.props.survey;
|
|
1007
|
+
}
|
|
1008
|
+
createQuestionElement(question) {
|
|
1009
|
+
return ReactQuestionFactory.Instance.createQuestion(!question.isDefaultRendering || question.isDefaultRendering()
|
|
1010
|
+
? question.getTemplate()
|
|
1011
|
+
: question.getComponentName(), {
|
|
1012
|
+
question: question,
|
|
1013
|
+
isDisplayMode: question.isInputReadOnly,
|
|
1014
|
+
creator: this,
|
|
1015
|
+
});
|
|
1016
|
+
}
|
|
1017
|
+
questionTitleLocation() {
|
|
1018
|
+
return this.survey.questionTitleLocation;
|
|
1019
|
+
}
|
|
1020
|
+
questionErrorLocation() {
|
|
1021
|
+
return this.survey.questionErrorLocation;
|
|
1022
|
+
}
|
|
1023
|
+
renderError(key, error, cssClasses) {
|
|
1024
|
+
return null;
|
|
1025
|
+
}
|
|
1026
|
+
render() {
|
|
1027
|
+
const question = this.survey.getAllQuestions()[0];
|
|
1028
|
+
return (React.createElement(React.Fragment, null,
|
|
1029
|
+
React.createElement(SurveyQuestion, { creator: this, element: question })));
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
ReactElementFactory.Instance.registerElement("svc-question-editor-content", (props) => {
|
|
1033
|
+
return React.createElement(QuestionEditorContentComponent, props);
|
|
1034
|
+
});
|
|
1035
|
+
|
|
1036
|
+
class ItemValueAdornerComponent extends CreatorModelElement {
|
|
1037
|
+
constructor(props) {
|
|
1038
|
+
super(props);
|
|
1039
|
+
this.onBlur = (event) => {
|
|
1040
|
+
this.model.onFocusOut(event.nativeEvent);
|
|
1041
|
+
};
|
|
1042
|
+
this.rootRef = React.createRef();
|
|
1043
|
+
}
|
|
1044
|
+
createModel(props) {
|
|
1045
|
+
this.model = new ItemValueWrapperViewModel(props.componentData.creator, props.question, props.item);
|
|
1046
|
+
}
|
|
1047
|
+
getUpdatedModelProps() {
|
|
1048
|
+
return ["question", "item"];
|
|
1049
|
+
}
|
|
1050
|
+
getStateElement() {
|
|
1051
|
+
return this.model;
|
|
1052
|
+
}
|
|
1053
|
+
componentDidUpdate(prevProps, prevState) {
|
|
1054
|
+
super.componentDidUpdate(prevProps, prevState);
|
|
1055
|
+
this.props.item.setRootElement(this.rootRef.current);
|
|
1056
|
+
if (prevProps.item !== this.props.item && prevProps.item) {
|
|
1057
|
+
prevProps.item.setRootElement(undefined);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
componentDidMount() {
|
|
1061
|
+
super.componentDidMount();
|
|
1062
|
+
this.props.item.setRootElement(this.rootRef.current);
|
|
1063
|
+
}
|
|
1064
|
+
componentWillUnmount() {
|
|
1065
|
+
super.componentWillUnmount();
|
|
1066
|
+
this.props.item.setRootElement(undefined);
|
|
1067
|
+
}
|
|
1068
|
+
render() {
|
|
1069
|
+
this.model.item = this.props.item;
|
|
1070
|
+
const button = this.model.allowAdd ? (attachKey2click(React.createElement("span", { className: "svc-item-value-controls__button svc-item-value-controls__add", "aria-label": this.model.tooltip, onClick: () => {
|
|
1071
|
+
this.model.add(this.model);
|
|
1072
|
+
this.model.isNew = false;
|
|
1073
|
+
} },
|
|
1074
|
+
React.createElement(SvgIcon, { size: "auto", iconName: "icon-add_16x16", title: this.model.tooltip })))) : (React.createElement(React.Fragment, null,
|
|
1075
|
+
" ",
|
|
1076
|
+
this.model.isDraggable ? (React.createElement("span", { className: "svc-item-value-controls__button svc-item-value-controls__drag" },
|
|
1077
|
+
React.createElement(SvgIcon, { className: "svc-item-value-controls__drag-icon", size: "auto", iconName: "icon-drag-24x24", title: this.model.dragTooltip }))) : null,
|
|
1078
|
+
this.model.allowRemove ? attachKey2click(React.createElement("span", { className: "svc-item-value-controls__button svc-item-value-controls__remove", "aria-label": this.model.tooltip, onClick: () => this.model.remove(this.model) },
|
|
1079
|
+
React.createElement(SvgIcon, { size: "auto", iconName: "icon-remove_16x16", title: this.model.tooltip }))) : null));
|
|
1080
|
+
const itemkey = this.props.element.key + (this.model.allowAdd ? "_new" : "");
|
|
1081
|
+
return (React.createElement("div", { ref: this.rootRef, className: "svc-item-value-wrapper" +
|
|
1082
|
+
(this.model.allowAdd ? " svc-item-value--new" : "") +
|
|
1083
|
+
(this.model.isDragging ? " svc-item-value--dragging" : "") +
|
|
1084
|
+
(this.model.isDragDropGhost ? " svc-item-value--ghost" : "") +
|
|
1085
|
+
(this.model.isDragDropMoveDown ? " svc-item-value--movedown" : "") +
|
|
1086
|
+
(this.model.isDragDropMoveUp ? " svc-item-value--moveup" : ""), key: itemkey, "data-sv-drop-target-item-value": this.model.isDraggable ? this.model.item.value : undefined, onPointerDown: (event) => this.model.onPointerDown(event) },
|
|
1087
|
+
React.createElement("div", { className: "svc-item-value__ghost" }),
|
|
1088
|
+
React.createElement("div", { className: "svc-item-value-controls", onBlur: this.onBlur }, button),
|
|
1089
|
+
React.createElement("div", { className: "svc-item-value__item", onClick: (event) => this.model.select(this.model, event.nativeEvent) }, this.props.element)));
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
ReactElementFactory.Instance.registerElement("svc-item-value", (props) => {
|
|
1093
|
+
return React.createElement(ItemValueAdornerComponent, props);
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1096
|
+
class ImageItemValueAdornerComponent extends CreatorModelElement {
|
|
1097
|
+
constructor(props) {
|
|
1098
|
+
super(props);
|
|
1099
|
+
this.preventDragHandler = (e) => {
|
|
1100
|
+
e.preventDefault();
|
|
1101
|
+
};
|
|
1102
|
+
this.rootRef = React.createRef();
|
|
1103
|
+
}
|
|
1104
|
+
createModel(props) {
|
|
1105
|
+
this.model = new ImageItemValueWrapperViewModel(props.componentData.creator, props.question, props.item, null, null);
|
|
1106
|
+
}
|
|
1107
|
+
getUpdatedModelProps() {
|
|
1108
|
+
return ["question", "item"];
|
|
1109
|
+
}
|
|
1110
|
+
getStateElement() {
|
|
1111
|
+
return this.model;
|
|
1112
|
+
}
|
|
1113
|
+
get question() {
|
|
1114
|
+
return this.props.question;
|
|
1115
|
+
}
|
|
1116
|
+
componentDidMount() {
|
|
1117
|
+
super.componentDidMount();
|
|
1118
|
+
this.model.itemsRoot = this.rootRef.current;
|
|
1119
|
+
}
|
|
1120
|
+
componentDidUpdate(prevProps, prevState) {
|
|
1121
|
+
super.componentDidUpdate(prevProps, prevState);
|
|
1122
|
+
this.model.itemsRoot = this.rootRef.current;
|
|
1123
|
+
}
|
|
1124
|
+
renderLoadingIndicator() {
|
|
1125
|
+
return React.createElement("div", { className: "svc-image-item-value__loading" },
|
|
1126
|
+
React.createElement(LoadingIndicatorComponent, null));
|
|
1127
|
+
}
|
|
1128
|
+
render() {
|
|
1129
|
+
this.model.item = this.props.item;
|
|
1130
|
+
const isNew = !this.props.question.isItemInList(this.props.item);
|
|
1131
|
+
this.model.isNew = isNew;
|
|
1132
|
+
const imageStyle = !this.model.getIsNewItemSingle() ? { width: this.question.renderedImageWidth, height: this.question.renderedImageHeight } : null;
|
|
1133
|
+
let content = null;
|
|
1134
|
+
if (isNew || this.model.isUploading) {
|
|
1135
|
+
content = (React.createElement(React.Fragment, null,
|
|
1136
|
+
React.createElement("div", { className: "svc-image-item-value__item", onDrop: this.model.onDrop, onDragOver: this.model.onDragOver, onDragLeave: this.model.onDragLeave },
|
|
1137
|
+
React.createElement("div", { className: "sd-imagepicker__item sd-imagepicker__item--inline" },
|
|
1138
|
+
React.createElement("label", { className: "sd-imagepicker__label" },
|
|
1139
|
+
React.createElement("div", { style: imageStyle, className: "sd-imagepicker__image" }, this.model.isUploading ? this.renderLoadingIndicator() : null)))),
|
|
1140
|
+
React.createElement("div", { className: "svc-image-item-value-controls" }, this.model.allowAdd && !this.model.isUploading ? attachKey2click(React.createElement("span", { className: "svc-context-button svc-image-item-value-controls__add", onClick: () => this.model.chooseNewFile(this.model) },
|
|
1141
|
+
React.createElement(SvgIcon, { size: "auto", iconName: "icon-add-lg", title: this.model.addFileTitle }))) : null)));
|
|
1142
|
+
}
|
|
1143
|
+
else {
|
|
1144
|
+
content = (React.createElement(React.Fragment, null,
|
|
1145
|
+
React.createElement("div", { className: "svc-image-item-value__item" }, this.props.element),
|
|
1146
|
+
this.model.isDraggable && this.model.canRenderControls ?
|
|
1147
|
+
React.createElement("span", { className: "svc-context-button svc-image-item-value-controls__drag-area-indicator", onPointerDown: (event) => this.model.onPointerDown(event) },
|
|
1148
|
+
React.createElement(SvgIcon, { size: "auto", iconName: "icon-drag-24x24" }))
|
|
1149
|
+
: null,
|
|
1150
|
+
this.model.canRenderControls ?
|
|
1151
|
+
React.createElement("div", { className: "svc-context-container svc-image-item-value-controls" },
|
|
1152
|
+
this.model.allowRemove && !this.model.isUploading ? attachKey2click(React.createElement("span", { className: "svc-context-button", onClick: () => this.model.chooseFile(this.model) },
|
|
1153
|
+
React.createElement(SvgIcon, { role: "button", size: "auto", iconName: "icon-choosefile", title: this.model.selectFileTitle }))) : null,
|
|
1154
|
+
this.model.allowRemove && !this.model.isUploading ? attachKey2click(React.createElement("span", { className: "svc-context-button svc-context-button--danger", onClick: () => this.model.remove(this.model) },
|
|
1155
|
+
React.createElement(SvgIcon, { role: "button", size: "auto", iconName: "icon-delete", title: this.model.removeFileTitle }))) : null)
|
|
1156
|
+
: null));
|
|
1157
|
+
}
|
|
1158
|
+
return (React.createElement("div", { ref: this.rootRef, className: this.model.getRootCss(), key: this.props.element.key, "data-sv-drop-target-item-value": this.model.isDraggable ? this.model.item.value : undefined, onPointerDown: (event) => this.model.onPointerDown(event), onDragStart: this.preventDragHandler },
|
|
1159
|
+
React.createElement("div", { className: "svc-image-item-value-wrapper__ghost", style: imageStyle }),
|
|
1160
|
+
React.createElement("div", { className: "svc-image-item-value-wrapper__content" },
|
|
1161
|
+
React.createElement("input", { type: "file", "aria-hidden": "true", tabIndex: -1, accept: this.model.acceptedTypes, className: "svc-choose-file-input", style: {
|
|
1162
|
+
position: "absolute",
|
|
1163
|
+
opacity: 0,
|
|
1164
|
+
width: "1px",
|
|
1165
|
+
height: "1px",
|
|
1166
|
+
overflow: "hidden"
|
|
1167
|
+
} }),
|
|
1168
|
+
content)));
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
ReactElementFactory.Instance.registerElement("svc-image-item-value", (props) => {
|
|
1172
|
+
return React.createElement(ImageItemValueAdornerComponent, props);
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
class MatrixCellAdornerComponent extends CreatorModelElement {
|
|
1176
|
+
createModel(props) {
|
|
1177
|
+
var _a;
|
|
1178
|
+
const data = props.componentData;
|
|
1179
|
+
let prevIsSelected = false;
|
|
1180
|
+
if (!!this.model) {
|
|
1181
|
+
prevIsSelected = this.model.isSelected;
|
|
1182
|
+
}
|
|
1183
|
+
this.model = new MatrixCellWrapperViewModel(data.creator, data.element, data.question, data.row, data.column || ((_a = data.element.cell) === null || _a === void 0 ? void 0 : _a.column));
|
|
1184
|
+
this.model.isSelected = prevIsSelected;
|
|
1185
|
+
}
|
|
1186
|
+
getUpdatedModelProps() {
|
|
1187
|
+
return ["componentData"];
|
|
1188
|
+
}
|
|
1189
|
+
componentDidUpdate(prevProps, prevState) {
|
|
1190
|
+
var _a, _b;
|
|
1191
|
+
super.componentDidUpdate(prevProps, prevState);
|
|
1192
|
+
const data = this.props.componentData;
|
|
1193
|
+
this.model.templateData = data.element;
|
|
1194
|
+
this.model.row = data.row;
|
|
1195
|
+
this.model.column = data.column || ((_b = (_a = data.element) === null || _a === void 0 ? void 0 : _a.cell) === null || _b === void 0 ? void 0 : _b.column);
|
|
1196
|
+
this.model.question = data.question;
|
|
1197
|
+
}
|
|
1198
|
+
getStateElement() {
|
|
1199
|
+
return this.model;
|
|
1200
|
+
}
|
|
1201
|
+
render() {
|
|
1202
|
+
let controls = null;
|
|
1203
|
+
if (!!this.model.isSupportCellEditor) {
|
|
1204
|
+
controls = React.createElement("div", { className: "svc-matrix-cell__question-controls" }, attachKey2click(React.createElement("span", { className: "svc-matrix-cell__question-controls-button svc-context-button", onClick: (event) => this.model.editQuestion(this.model, event) },
|
|
1205
|
+
React.createElement(SvgIcon, { size: "auto", iconName: "icon-edit" }))));
|
|
1206
|
+
}
|
|
1207
|
+
return (React.createElement("div", { className: "svc-matrix-cell", tabIndex: -1, key: this.props.element.key, onClick: (e) => !this.props.question && this.model.selectContext(this.model, e), onMouseOut: e => this.model.hover(e.nativeEvent, e.currentTarget), onMouseOver: e => this.model.hover(e.nativeEvent, e.currentTarget) },
|
|
1208
|
+
React.createElement("div", { className: "svc-matrix-cell--selected" + (this.model.isSelected ? " svc-visible" : "") }),
|
|
1209
|
+
this.props.element,
|
|
1210
|
+
controls));
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
ReactElementFactory.Instance.registerElement("svc-matrix-cell", (props) => {
|
|
1214
|
+
return React.createElement(MatrixCellAdornerComponent, props);
|
|
1215
|
+
});
|
|
1216
|
+
|
|
1217
|
+
class SurveyResults extends CreatorModelElement {
|
|
1218
|
+
createModel(props) {
|
|
1219
|
+
if (this.props.survey) {
|
|
1220
|
+
this.model = new SurveyResultsModel(props.survey);
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
getUpdatedModelProps() {
|
|
1224
|
+
return ["survey"];
|
|
1225
|
+
}
|
|
1226
|
+
getStateElement() {
|
|
1227
|
+
return this.model;
|
|
1228
|
+
}
|
|
1229
|
+
render() {
|
|
1230
|
+
if (!this.model) {
|
|
1231
|
+
return null;
|
|
1232
|
+
}
|
|
1233
|
+
return (React.createElement("div", { className: "svd-test-results" },
|
|
1234
|
+
React.createElement("div", { className: "svd-test-results__content" },
|
|
1235
|
+
React.createElement("div", { className: "svd-test-results__header" },
|
|
1236
|
+
React.createElement("div", { className: "svd-test-results__header-text" }, this.model.surveyResultsText),
|
|
1237
|
+
React.createElement("div", { className: "svd-test-results__header-types" },
|
|
1238
|
+
React.createElement(ActionButton, { click: () => this.model.selectTableClick(), text: this.model.surveyResultsTableText, selected: this.model.isTableSelected, disabled: false }),
|
|
1239
|
+
React.createElement(ActionButton, { click: () => this.model.selectJsonClick(), text: this.model.surveyResultsJsonText, selected: this.model.isJsonSelected, disabled: false }))),
|
|
1240
|
+
this.renderResultAsText(),
|
|
1241
|
+
this.renderResultAsTable())));
|
|
1242
|
+
}
|
|
1243
|
+
renderResultAsText() {
|
|
1244
|
+
if (this.model.resultViewType !== "text") {
|
|
1245
|
+
return null;
|
|
1246
|
+
}
|
|
1247
|
+
return (React.createElement("div", { className: "svd-test-results__text svd-light-bg-color" },
|
|
1248
|
+
React.createElement("div", null, this.model.resultText)));
|
|
1249
|
+
}
|
|
1250
|
+
renderResultAsTable() {
|
|
1251
|
+
if (this.model.resultViewType !== "table") {
|
|
1252
|
+
return null;
|
|
1253
|
+
}
|
|
1254
|
+
return (React.createElement("div", { className: "svd-test-results__table svd-light-bg-color" },
|
|
1255
|
+
React.createElement("table", null,
|
|
1256
|
+
React.createElement("thead", null,
|
|
1257
|
+
React.createElement("tr", { className: "svd-light-background-color" },
|
|
1258
|
+
React.createElement("th", { key: 1, className: "svd-dark-border-color" }, this.model.resultsTitle),
|
|
1259
|
+
React.createElement("th", { key: 2, className: "svd-dark-border-color" }, this.model.resultsDisplayValue))),
|
|
1260
|
+
React.createElement("tbody", null, SurveyResults.renderRows(this.model.resultData)))));
|
|
1261
|
+
}
|
|
1262
|
+
static renderRows(data) {
|
|
1263
|
+
const rows = [];
|
|
1264
|
+
for (var i = 0; i < data.length; i++) {
|
|
1265
|
+
rows.push(React.createElement(SurveyResultsByRow, { key: i + 1, row: data[i] }));
|
|
1266
|
+
}
|
|
1267
|
+
return rows;
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
class SurveyResultsByRow extends CreatorModelElement {
|
|
1271
|
+
get row() {
|
|
1272
|
+
return this.props.row;
|
|
1273
|
+
}
|
|
1274
|
+
getStateElement() {
|
|
1275
|
+
return this.row;
|
|
1276
|
+
}
|
|
1277
|
+
render() {
|
|
1278
|
+
return (React.createElement(React.Fragment, null,
|
|
1279
|
+
attachKey2click(React.createElement("tr", { onClick: () => this.row.toggle() },
|
|
1280
|
+
React.createElement("td", { key: 1, style: { paddingLeft: this.row.textMargin }, className: "svd-dark-border-color" },
|
|
1281
|
+
this.row.isNode ? (React.createElement("span", { style: { left: this.row.markerMargin }, className: "svd-test-results__marker " + (this.row.collapsed ? "" : "svd-test-results__marker--expanded") },
|
|
1282
|
+
React.createElement(SvgIcon, { iconName: "icon-expand_16x16", size: 16 }))) : null,
|
|
1283
|
+
this.row.question ? React.createElement(SurveyLocStringViewer, { locStr: this.row.question.locTitle }) : React.createElement("span", null, this.row.title)),
|
|
1284
|
+
React.createElement("td", { key: 2, className: this.row.isNode ? "svd-test-results__node-value" : "svd-dark-border-color" }, this.row.getString(this.row.displayValue)))),
|
|
1285
|
+
this.row.isNode && !this.row.collapsed ? SurveyResults.renderRows(this.row.data) : null));
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
class SurveyCreatorToolboxTool extends CreatorModelElement {
|
|
1290
|
+
constructor(props) {
|
|
1291
|
+
super(props);
|
|
1292
|
+
this.rootRef = React.createRef();
|
|
1293
|
+
}
|
|
1294
|
+
createModel(props) {
|
|
1295
|
+
this.model = new ToolboxToolViewModel(props.item, props.creator, props.parentModel);
|
|
1296
|
+
}
|
|
1297
|
+
getUpdatedModelProps() {
|
|
1298
|
+
return ["creator", "item"];
|
|
1299
|
+
}
|
|
1300
|
+
get item() {
|
|
1301
|
+
return this.props.item;
|
|
1302
|
+
}
|
|
1303
|
+
get creator() {
|
|
1304
|
+
return this.props.creator;
|
|
1305
|
+
}
|
|
1306
|
+
get isCompact() {
|
|
1307
|
+
return this.props.isCompact;
|
|
1308
|
+
}
|
|
1309
|
+
getStateElement() {
|
|
1310
|
+
return this.item;
|
|
1311
|
+
}
|
|
1312
|
+
render() {
|
|
1313
|
+
const item = this.item;
|
|
1314
|
+
const itemComponent = ReactElementFactory.Instance.createElement(this.model.itemComponent, {
|
|
1315
|
+
item: item,
|
|
1316
|
+
creator: this.creator,
|
|
1317
|
+
parentModel: this.creator.toolbox,
|
|
1318
|
+
model: this.model,
|
|
1319
|
+
isCompact: this.isCompact
|
|
1320
|
+
});
|
|
1321
|
+
return (React.createElement("div", { className: item.css, key: item.id, ref: this.rootRef },
|
|
1322
|
+
(item.needSeparator && !this.creator.toolbox.showCategoryTitles) ? (React.createElement("div", { className: "svc-toolbox__category-separator" })) : null,
|
|
1323
|
+
React.createElement("div", { className: "svc-toolbox__tool-content sv-action__content", onPointerDown: (event) => {
|
|
1324
|
+
event.persist();
|
|
1325
|
+
this.model.onPointerDown(event);
|
|
1326
|
+
} }, itemComponent)));
|
|
1327
|
+
}
|
|
1328
|
+
componentWillUnmount() {
|
|
1329
|
+
super.componentWillUnmount();
|
|
1330
|
+
this.item.updateModeCallback = undefined;
|
|
1331
|
+
}
|
|
1332
|
+
componentDidMount() {
|
|
1333
|
+
super.componentDidMount();
|
|
1334
|
+
this.item.updateModeCallback = (mode, callback) => {
|
|
1335
|
+
queueMicrotask(() => {
|
|
1336
|
+
if (ReactDOM["flushSync"]) {
|
|
1337
|
+
ReactDOM["flushSync"](() => {
|
|
1338
|
+
this.item.mode = mode;
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
else {
|
|
1342
|
+
this.item.mode = mode;
|
|
1343
|
+
}
|
|
1344
|
+
queueMicrotask(() => {
|
|
1345
|
+
callback(mode, this.rootRef.current);
|
|
1346
|
+
});
|
|
1347
|
+
});
|
|
1348
|
+
};
|
|
1349
|
+
this.item.afterRender();
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
class SurveyCreatorToolboxItem extends CreatorModelElement {
|
|
1353
|
+
constructor(props) {
|
|
1354
|
+
super(props);
|
|
1355
|
+
}
|
|
1356
|
+
getUpdatedModelProps() {
|
|
1357
|
+
return ["creator", "item"];
|
|
1358
|
+
}
|
|
1359
|
+
get item() {
|
|
1360
|
+
return this.props.item;
|
|
1361
|
+
}
|
|
1362
|
+
get creator() {
|
|
1363
|
+
return this.props.creator;
|
|
1364
|
+
}
|
|
1365
|
+
get model() {
|
|
1366
|
+
return this.props.model;
|
|
1367
|
+
}
|
|
1368
|
+
getStateElement() {
|
|
1369
|
+
return this.model;
|
|
1370
|
+
}
|
|
1371
|
+
render() {
|
|
1372
|
+
const banner = (this.props.isCompact ?
|
|
1373
|
+
React.createElement("span", { className: "svc-toolbox__item-banner", onClick: (event) => {
|
|
1374
|
+
event.persist();
|
|
1375
|
+
this.model.click(event);
|
|
1376
|
+
} },
|
|
1377
|
+
React.createElement(SvgIcon, { size: "auto", iconName: this.item.iconName, className: "svc-toolbox__item-icon", title: this.item.tooltip }),
|
|
1378
|
+
React.createElement("span", null, this.item.title))
|
|
1379
|
+
:
|
|
1380
|
+
null);
|
|
1381
|
+
const item = attachKey2click(React.createElement("div", { className: this.item.renderedCss, tabIndex: 0, role: "button", "aria-label": this.item.tooltip, onClick: (event) => {
|
|
1382
|
+
event.persist();
|
|
1383
|
+
this.model.click(event);
|
|
1384
|
+
} },
|
|
1385
|
+
React.createElement("span", { className: "svc-toolbox__item-container" }, !!this.item.iconName ? React.createElement(SvgIcon, { size: "auto", iconName: this.item.iconName, className: "svc-toolbox__item-icon" }) : null),
|
|
1386
|
+
(this.props.isCompact ?
|
|
1387
|
+
null
|
|
1388
|
+
:
|
|
1389
|
+
React.createElement("span", { className: "svc-toolbox__item-title" }, this.item.title))));
|
|
1390
|
+
return (React.createElement(React.Fragment, null,
|
|
1391
|
+
item,
|
|
1392
|
+
banner));
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
ReactElementFactory.Instance.registerElement("svc-toolbox-item", (props) => {
|
|
1396
|
+
return createElement(SurveyCreatorToolboxItem, props);
|
|
1397
|
+
});
|
|
1398
|
+
|
|
1399
|
+
class SurveyCreatorToolboxItemGroup extends CreatorModelElement {
|
|
1400
|
+
constructor(props) {
|
|
1401
|
+
super(props);
|
|
1402
|
+
}
|
|
1403
|
+
getUpdatedModelProps() {
|
|
1404
|
+
return ["creator", "item"];
|
|
1405
|
+
}
|
|
1406
|
+
get item() {
|
|
1407
|
+
return this.props.item;
|
|
1408
|
+
}
|
|
1409
|
+
get model() {
|
|
1410
|
+
return this.props.model;
|
|
1411
|
+
}
|
|
1412
|
+
get creator() {
|
|
1413
|
+
return this.props.creator;
|
|
1414
|
+
}
|
|
1415
|
+
get isCompact() {
|
|
1416
|
+
return this.props.isCompact;
|
|
1417
|
+
}
|
|
1418
|
+
get parentModel() {
|
|
1419
|
+
return this.props.parentModel;
|
|
1420
|
+
}
|
|
1421
|
+
getStateElement() {
|
|
1422
|
+
return this.item;
|
|
1423
|
+
}
|
|
1424
|
+
render() {
|
|
1425
|
+
return React.createElement(React.Fragment, null,
|
|
1426
|
+
React.createElement(SurveyCreatorToolboxItem, { item: this.item, creator: this.creator, model: this.model, parentModel: this.parentModel, isCompact: this.isCompact }),
|
|
1427
|
+
React.createElement("div", { className: "svc-toolbox__item-submenu-button", onMouseOver: (event) => this.model.onMouseOver(this.item, event), onMouseLeave: (event) => this.model.onMouseLeave(this.item, event) },
|
|
1428
|
+
React.createElement(SvgIcon, { size: "auto", iconName: this.item.subitemsButtonIcon }),
|
|
1429
|
+
React.createElement(Popup, { model: this.item.popupModel })));
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
ReactElementFactory.Instance.registerElement("svc-toolbox-item-group", (props) => {
|
|
1433
|
+
return React.createElement(SurveyCreatorToolboxItemGroup, props);
|
|
1434
|
+
});
|
|
1435
|
+
|
|
1436
|
+
class SurveyCreatorToolboxCategory extends SurveyElementBase {
|
|
1437
|
+
get category() {
|
|
1438
|
+
return this.props.category;
|
|
1439
|
+
}
|
|
1440
|
+
get toolbox() {
|
|
1441
|
+
return this.props.toolbox;
|
|
1442
|
+
}
|
|
1443
|
+
get class() {
|
|
1444
|
+
return "svc-toolbox__category" +
|
|
1445
|
+
(this.category.collapsed ? " svc-toolbox__category--collapsed" : "") +
|
|
1446
|
+
(this.category.empty ? " svc-toolbox__category--empty" : "");
|
|
1447
|
+
}
|
|
1448
|
+
getStateElement() {
|
|
1449
|
+
return this.category;
|
|
1450
|
+
}
|
|
1451
|
+
render() {
|
|
1452
|
+
const header = this.renderCategoryHeader();
|
|
1453
|
+
const items = this.renderCategoryContent();
|
|
1454
|
+
return (React.createElement("div", { className: this.class, key: this.category.name },
|
|
1455
|
+
React.createElement("div", { className: "svc-toolbox__category-header-wrapper" }, header),
|
|
1456
|
+
items));
|
|
1457
|
+
}
|
|
1458
|
+
renderCategoryHeader() {
|
|
1459
|
+
let className = "svc-toolbox__category-header";
|
|
1460
|
+
if (this.toolbox.canCollapseCategories) {
|
|
1461
|
+
className += " svc-toolbox__category-header--collapsed";
|
|
1462
|
+
}
|
|
1463
|
+
return attachKey2click(React.createElement("div", { className: className, onClick: e => this.category.toggleState() },
|
|
1464
|
+
React.createElement("span", { className: "svc-toolbox__category-title" }, this.category.title),
|
|
1465
|
+
this.renderButton()));
|
|
1466
|
+
}
|
|
1467
|
+
renderButton() {
|
|
1468
|
+
if (!this.toolbox.canCollapseCategories)
|
|
1469
|
+
return null;
|
|
1470
|
+
const iconName = this.category.collapsed ? "arrow-down" : "arrow-up";
|
|
1471
|
+
const suffixName = this.category.collapsed ? "expand" : "collapse";
|
|
1472
|
+
const svgIconClassName = "svc-toolbox__category-header__button svc-string-editor__button--" + suffixName;
|
|
1473
|
+
return (React.createElement("div", { className: "svc-toolbox__category-header__controls" },
|
|
1474
|
+
React.createElement(SvgIcon, { className: svgIconClassName, iconName: "icon-" + iconName, size: "auto" })));
|
|
1475
|
+
}
|
|
1476
|
+
renderCategoryContent() {
|
|
1477
|
+
return this.renderItems(this.category.items);
|
|
1478
|
+
}
|
|
1479
|
+
renderItems(items, isCompact = false) {
|
|
1480
|
+
return items.map((item, itemIndex) => React.createElement(SurveyCreatorToolboxTool, { item: item, creator: this.toolbox.creator, parentModel: this.toolbox, isCompact: isCompact, key: "item" + itemIndex }));
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
ReactElementFactory.Instance.registerElement("svc-toolbox-category", (props) => {
|
|
1484
|
+
return React.createElement(SurveyCreatorToolboxCategory, props);
|
|
1485
|
+
});
|
|
1486
|
+
|
|
1487
|
+
class ToolboxList extends SurveyElementBase {
|
|
1488
|
+
constructor(props) {
|
|
1489
|
+
super(props);
|
|
1490
|
+
}
|
|
1491
|
+
get model() {
|
|
1492
|
+
return this.props.model;
|
|
1493
|
+
}
|
|
1494
|
+
get creator() {
|
|
1495
|
+
return this.props.creator;
|
|
1496
|
+
}
|
|
1497
|
+
getStateElement() {
|
|
1498
|
+
return this.model;
|
|
1499
|
+
}
|
|
1500
|
+
render() {
|
|
1501
|
+
if (!this.model || !this.model.renderElements)
|
|
1502
|
+
return null;
|
|
1503
|
+
const items = this.renderItems();
|
|
1504
|
+
return (React.createElement("div", { className: this.model.cssClasses.root }, items));
|
|
1505
|
+
}
|
|
1506
|
+
renderItems() {
|
|
1507
|
+
const items = this.model.renderedActions;
|
|
1508
|
+
return items.map((item, itemIndex) => React.createElement(SurveyCreatorToolboxTool, { item: item, creator: this.creator, parentModel: this.model, isCompact: false, key: "item" + itemIndex }));
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
ReactElementFactory.Instance.registerElement("svc-toolbox-list", (props) => {
|
|
1512
|
+
return React.createElement(ToolboxList, props);
|
|
1513
|
+
});
|
|
1514
|
+
|
|
1515
|
+
class SearchComponent extends SurveyElementBase {
|
|
1516
|
+
get model() {
|
|
1517
|
+
return this.props.model;
|
|
1518
|
+
}
|
|
1519
|
+
getStateElement() {
|
|
1520
|
+
return this.model;
|
|
1521
|
+
}
|
|
1522
|
+
constructor(props) {
|
|
1523
|
+
super(props);
|
|
1524
|
+
this.state = {
|
|
1525
|
+
filterString: this.model.filterString || ""
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
renderElement() {
|
|
1529
|
+
if (!this.model.isVisible)
|
|
1530
|
+
return null;
|
|
1531
|
+
const onChange = (e) => {
|
|
1532
|
+
const { root } = settings.environment;
|
|
1533
|
+
if (e.target === root.activeElement) {
|
|
1534
|
+
this.model.filterString = e.target.value;
|
|
1535
|
+
}
|
|
1536
|
+
};
|
|
1537
|
+
return (React.createElement("div", { className: "svc-search" },
|
|
1538
|
+
React.createElement("div", { className: "svc-search__search-icon" },
|
|
1539
|
+
React.createElement(SvgIcon, { iconName: "icon-search", size: "auto" })),
|
|
1540
|
+
React.createElement("input", { type: "text", className: "svc-search__input", "aria-label": this.model.filterStringPlaceholder, placeholder: this.model.filterStringPlaceholder, value: this.state.filterString, onChange: onChange }),
|
|
1541
|
+
React.createElement("div", { className: "svc-search__toolbar" },
|
|
1542
|
+
React.createElement("div", { className: "svc-search__toolbar-counter" }, this.model.matchCounterText),
|
|
1543
|
+
React.createElement(SurveyActionBar, { model: this.model.searchActionBar }))));
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
ReactElementFactory.Instance.registerElement("svc-search", (props) => {
|
|
1547
|
+
return React.createElement(SearchComponent, props);
|
|
1548
|
+
});
|
|
1549
|
+
|
|
1550
|
+
class ScrollComponent extends React.Component {
|
|
1551
|
+
constructor(props) {
|
|
1552
|
+
super(props);
|
|
1553
|
+
this.rootRef = React.createRef();
|
|
1554
|
+
this.model = new ScrollViewModel();
|
|
1555
|
+
}
|
|
1556
|
+
componentDidMount() {
|
|
1557
|
+
const container = this.rootRef.current;
|
|
1558
|
+
if (!container)
|
|
1559
|
+
return;
|
|
1560
|
+
this.model.setRootElement(container);
|
|
1561
|
+
}
|
|
1562
|
+
componentWillUnmount() {
|
|
1563
|
+
this.model.unsubscribeRootElement();
|
|
1564
|
+
this.model.setRootElement(undefined);
|
|
1565
|
+
}
|
|
1566
|
+
render() {
|
|
1567
|
+
return React.createElement("div", { ref: this.rootRef, className: "svc-scroll__wrapper" },
|
|
1568
|
+
React.createElement("div", { className: "svc-scroll__scroller sv-drag-target-skipped", onScroll: () => this.model.onScrollContainer() },
|
|
1569
|
+
React.createElement("div", { className: "svc-scroll__container" }, this.props.children)),
|
|
1570
|
+
React.createElement("div", { className: "svc-scroll__scrollbar", onScroll: () => this.model.onScrollScrollbar() },
|
|
1571
|
+
React.createElement("div", { className: "svc-scroll__scrollbar-sizer" })));
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
ReactElementFactory.Instance.registerElement("svc-scroll", (props) => {
|
|
1575
|
+
return React.createElement(ScrollComponent, props);
|
|
1576
|
+
});
|
|
1577
|
+
|
|
1578
|
+
class AdaptiveToolbox extends SurveyElementBase {
|
|
1579
|
+
constructor(props) {
|
|
1580
|
+
super(props);
|
|
1581
|
+
this.rootRef = React.createRef();
|
|
1582
|
+
}
|
|
1583
|
+
componentDidMount() {
|
|
1584
|
+
super.componentDidMount();
|
|
1585
|
+
const container = this.rootRef.current;
|
|
1586
|
+
this.toolbox.setRootElement(container);
|
|
1587
|
+
if (!container)
|
|
1588
|
+
return;
|
|
1589
|
+
this.manager = new VerticalResponsivityManager(this.toolbox.containerElement, this.toolbox);
|
|
1590
|
+
}
|
|
1591
|
+
componentWillUnmount() {
|
|
1592
|
+
this.manager && (this.manager.dispose());
|
|
1593
|
+
this.toolbox.setRootElement(undefined);
|
|
1594
|
+
super.componentWillUnmount();
|
|
1595
|
+
}
|
|
1596
|
+
get creator() {
|
|
1597
|
+
return this.props.model;
|
|
1598
|
+
}
|
|
1599
|
+
get toolbox() {
|
|
1600
|
+
return this.creator.toolbox;
|
|
1601
|
+
}
|
|
1602
|
+
getStateElement() {
|
|
1603
|
+
return this.toolbox;
|
|
1604
|
+
}
|
|
1605
|
+
renderItems(items, isCompact = false) {
|
|
1606
|
+
return items.map((item, itemIndex) => {
|
|
1607
|
+
return React.createElement(SurveyCreatorToolboxTool, { item: item, creator: this.creator, parentModel: this.toolbox, isCompact: isCompact, key: item.renderedId });
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
renderCategories() {
|
|
1611
|
+
return this.toolbox.categories.map((category, index) => {
|
|
1612
|
+
return React.createElement(SurveyCreatorToolboxCategory, { category: category, toolbox: this.toolbox, key: "category" + index });
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
renderSearch() {
|
|
1616
|
+
const searchButton = this.toolbox.isCompactRendered ?
|
|
1617
|
+
React.createElement(React.Fragment, null,
|
|
1618
|
+
React.createElement(SurveyCreatorToolboxTool, { item: this.toolbox.searchItem, creator: this.creator, parentModel: this.toolbox, isCompact: this.toolbox.isCompactRendered, key: "searchitem" })) :
|
|
1619
|
+
null;
|
|
1620
|
+
return (React.createElement("div", { className: "svc-toolbox__search-container" },
|
|
1621
|
+
searchButton,
|
|
1622
|
+
React.createElement(SearchComponent, { model: this.toolbox.searchManager }),
|
|
1623
|
+
React.createElement("div", { className: "svc-toolbox__category-separator svc-toolbox__category-separator--search" })));
|
|
1624
|
+
}
|
|
1625
|
+
render() {
|
|
1626
|
+
if (!this.toolbox.hasActions)
|
|
1627
|
+
return null;
|
|
1628
|
+
const search = this.toolbox.showSearch ? this.renderSearch() : null;
|
|
1629
|
+
const placeholder = this.toolbox.showPlaceholder ? React.createElement("div", { className: "svc-toolbox__placeholder" }, this.toolbox.toolboxNoResultsFound) : null;
|
|
1630
|
+
return (React.createElement("div", { ref: this.rootRef, className: this.toolbox.classNames },
|
|
1631
|
+
React.createElement("div", { onBlur: (e) => this.toolbox.focusOut(e), className: "svc-toolbox__panel" },
|
|
1632
|
+
search,
|
|
1633
|
+
placeholder,
|
|
1634
|
+
React.createElement(ScrollComponent, null, (this.toolbox.showInSingleCategory) ?
|
|
1635
|
+
(React.createElement("div", { className: "svc-toolbox__category" }, this.renderItems(this.toolbox.renderedActions, this.toolbox.isCompactRendered)))
|
|
1636
|
+
: this.renderCategories()))));
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
ReactElementFactory.Instance.registerElement("svc-toolbox", (props) => {
|
|
1640
|
+
return React.createElement(AdaptiveToolbox, props);
|
|
1641
|
+
});
|
|
1642
|
+
|
|
1643
|
+
class SurveyNavigation extends SurveyElementBase {
|
|
1644
|
+
constructor() {
|
|
1645
|
+
super(...arguments);
|
|
1646
|
+
this.onPropChangedHandler = (sender, options) => {
|
|
1647
|
+
if (this.isRendering)
|
|
1648
|
+
return;
|
|
1649
|
+
const reactiveProps = [
|
|
1650
|
+
"showProgressBar",
|
|
1651
|
+
"progressBarType",
|
|
1652
|
+
"currentPageValue"
|
|
1653
|
+
];
|
|
1654
|
+
if (reactiveProps.indexOf(options.name) < 0)
|
|
1655
|
+
return;
|
|
1656
|
+
var val = {};
|
|
1657
|
+
for (var i = 0; i < reactiveProps.length; i++) {
|
|
1658
|
+
var propName = reactiveProps[i];
|
|
1659
|
+
val[propName] = this.survey[propName];
|
|
1660
|
+
}
|
|
1661
|
+
this.setState(val);
|
|
1662
|
+
};
|
|
1663
|
+
}
|
|
1664
|
+
componentDidMount() {
|
|
1665
|
+
super.componentDidMount();
|
|
1666
|
+
this.setHandler();
|
|
1667
|
+
}
|
|
1668
|
+
componentDidUpdate(prevProps, prevState) {
|
|
1669
|
+
super.componentDidUpdate(prevProps, prevState);
|
|
1670
|
+
this.setHandler();
|
|
1671
|
+
}
|
|
1672
|
+
setHandler() {
|
|
1673
|
+
if (!this.survey ||
|
|
1674
|
+
this.survey.onPropertyChanged.hasFunc(this.onPropChangedHandler))
|
|
1675
|
+
return;
|
|
1676
|
+
this.survey.onPropertyChanged.add(this.onPropChangedHandler);
|
|
1677
|
+
}
|
|
1678
|
+
componentWillUnmount() {
|
|
1679
|
+
super.componentWillUnmount();
|
|
1680
|
+
if (this.survey) {
|
|
1681
|
+
this.survey.onPropertyChanged.remove(this.onPropChangedHandler);
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
get survey() {
|
|
1685
|
+
return this.props.survey;
|
|
1686
|
+
}
|
|
1687
|
+
get location() {
|
|
1688
|
+
return this.props.location;
|
|
1689
|
+
}
|
|
1690
|
+
get isTop() {
|
|
1691
|
+
return this.location == "top";
|
|
1692
|
+
}
|
|
1693
|
+
canRender() {
|
|
1694
|
+
return this.isTop
|
|
1695
|
+
? this.survey.isShowProgressBarOnTop
|
|
1696
|
+
: this.survey.isShowProgressBarOnBottom;
|
|
1697
|
+
}
|
|
1698
|
+
renderElement() {
|
|
1699
|
+
return ReactElementFactory.Instance.createElement(this.survey.getProgressTypeComponent(), { survey: this.survey, css: this.survey.css, isTop: this.isTop });
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
class TabButtonComponent extends SurveyElementBase {
|
|
1704
|
+
constructor(props) {
|
|
1705
|
+
super(props);
|
|
1706
|
+
}
|
|
1707
|
+
getStateElement() {
|
|
1708
|
+
return this.props.model;
|
|
1709
|
+
}
|
|
1710
|
+
renderElement() {
|
|
1711
|
+
const button = attachKey2click(React.createElement("div", { className: this.props.model.buttonClassName, title: this.props.model.tooltip, onClick: () => { this.props.model.action(); } },
|
|
1712
|
+
React.createElement("div", { className: "svc-menu-action__icon" },
|
|
1713
|
+
React.createElement("div", { className: "svc-menu-action__icon-container" },
|
|
1714
|
+
React.createElement(SvgIcon, { iconName: this.props.model.iconName, size: "auto" })))), this.props.model);
|
|
1715
|
+
return (React.createElement("div", { className: "svc-menu-action" }, button));
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
class TabControl extends SurveyElementBase {
|
|
1720
|
+
constructor(props) {
|
|
1721
|
+
super(props);
|
|
1722
|
+
}
|
|
1723
|
+
getStateElement() {
|
|
1724
|
+
return this.props.model;
|
|
1725
|
+
}
|
|
1726
|
+
canRender() {
|
|
1727
|
+
if (!this.props.model)
|
|
1728
|
+
return false;
|
|
1729
|
+
return super.canRender();
|
|
1730
|
+
}
|
|
1731
|
+
renderElement() {
|
|
1732
|
+
return (React.createElement("div", { className: this.props.model.sideBarClassName },
|
|
1733
|
+
React.createElement("div", { className: "svc-sidebar-tabs__top-container" },
|
|
1734
|
+
React.createElement("div", { className: "svc-sidebar-tabs__collapse-button" },
|
|
1735
|
+
React.createElement(TabButtonComponent, { model: this.props.model.expandCollapseAction })),
|
|
1736
|
+
React.createElement("div", { className: "svc-sidebar-tabs__separator" },
|
|
1737
|
+
React.createElement("div", null)),
|
|
1738
|
+
React.createElement(ScrollComponent, null,
|
|
1739
|
+
React.createElement("div", { className: "svc-sidebar-tabs__items" },
|
|
1740
|
+
React.createElement(TabsComponent, { model: this.props.model.topToolbar })))),
|
|
1741
|
+
React.createElement("div", { className: "svc-sidebar-tabs__bottom-container" },
|
|
1742
|
+
React.createElement("div", { className: "svc-sidebar-tabs__items" },
|
|
1743
|
+
React.createElement(TabsComponent, { model: this.props.model.bottomToolbar })))));
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
ReactElementFactory.Instance.registerElement("svc-tab-control", (props) => {
|
|
1747
|
+
return React.createElement(TabControl, props);
|
|
1748
|
+
});
|
|
1749
|
+
class TabsComponent extends SurveyElementBase {
|
|
1750
|
+
constructor(props) {
|
|
1751
|
+
super(props);
|
|
1752
|
+
}
|
|
1753
|
+
getStateElement() {
|
|
1754
|
+
return this.props.model;
|
|
1755
|
+
}
|
|
1756
|
+
renderElement() {
|
|
1757
|
+
return React.createElement(React.Fragment, null, this.props.model.actions.map((item, itemIndex) => React.createElement(TabButtonComponent, { model: item, key: "item" + itemIndex })));
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
class SideBarDefaultHeader extends SurveyElementBase {
|
|
1762
|
+
get model() {
|
|
1763
|
+
return this.props.model;
|
|
1764
|
+
}
|
|
1765
|
+
getStateElement() {
|
|
1766
|
+
return this.model;
|
|
1767
|
+
}
|
|
1768
|
+
renderElement() {
|
|
1769
|
+
const title = !!this.model.title ? (React.createElement("div", { className: "svc-side-bar__container-title" }, this.model.title)) : null;
|
|
1770
|
+
return (React.createElement("div", { className: "svc-side-bar__container-header" },
|
|
1771
|
+
React.createElement("div", { className: "svc-side-bar__container-actions" },
|
|
1772
|
+
React.createElement(SurveyActionBar, { model: this.model.toolbar })),
|
|
1773
|
+
title));
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
ReactElementFactory.Instance.registerElement("svc-side-bar-default-header", (props) => {
|
|
1777
|
+
return React.createElement(SideBarDefaultHeader, props);
|
|
1778
|
+
});
|
|
1779
|
+
|
|
1780
|
+
class SideBarPropertyGridHeader extends SurveyElementBase {
|
|
1781
|
+
get objectSelectionAction() {
|
|
1782
|
+
return this.props.model;
|
|
1783
|
+
}
|
|
1784
|
+
getStateElement() {
|
|
1785
|
+
return this.objectSelectionAction;
|
|
1786
|
+
}
|
|
1787
|
+
renderElement() {
|
|
1788
|
+
const button = attachKey2click(React.createElement("div", { className: this.objectSelectionAction.buttonClassName, onClick: () => this.objectSelectionAction.action() },
|
|
1789
|
+
React.createElement("div", { className: "svc-sidebar__header-caption" },
|
|
1790
|
+
React.createElement("span", { className: "svc-sidebar__header-title" }, this.objectSelectionAction.title),
|
|
1791
|
+
React.createElement("span", { className: "svc-sidebar__header-subtitle" }, this.objectSelectionAction.tooltip))), this.props.model);
|
|
1792
|
+
return (React.createElement("div", { className: "svc-sidebar__header svc-sidebar__header--tabbed" },
|
|
1793
|
+
React.createElement("div", { className: "svc-sidebar__header-container svc-sidebar__header-container--with-subtitle" },
|
|
1794
|
+
React.createElement("div", { className: "svc-sidebar__header-content" },
|
|
1795
|
+
button,
|
|
1796
|
+
React.createElement(Popup, { model: this.objectSelectionAction.popupModel })))));
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
ReactElementFactory.Instance.registerElement("svc-side-bar-property-grid-header", (props) => {
|
|
1800
|
+
return React.createElement(SideBarPropertyGridHeader, props);
|
|
1801
|
+
});
|
|
1802
|
+
|
|
1803
|
+
class SideBarHeader extends SurveyElementBase {
|
|
1804
|
+
get model() {
|
|
1805
|
+
return this.props.model;
|
|
1806
|
+
}
|
|
1807
|
+
getStateElement() {
|
|
1808
|
+
return this.model;
|
|
1809
|
+
}
|
|
1810
|
+
renderElement() {
|
|
1811
|
+
return (React.createElement("div", { className: "svc-side-bar__container-header svc-sidebar__header-container" }, (this.model.subTitle) ?
|
|
1812
|
+
React.createElement("div", { className: "svc-sidebar__header-caption" },
|
|
1813
|
+
React.createElement("span", { className: "svc-sidebar__header-title" }, this.model.title),
|
|
1814
|
+
React.createElement("span", { className: "svc-sidebar__header-subtitle" }, this.model.subTitle))
|
|
1815
|
+
: React.createElement("div", { className: "svc-side-bar__container-title" }, this.model.title)));
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
ReactElementFactory.Instance.registerElement("svc-side-bar-header", (props) => {
|
|
1819
|
+
return React.createElement(SideBarHeader, props);
|
|
1820
|
+
});
|
|
1821
|
+
|
|
1822
|
+
class SidebarComponent extends SurveyElementBase {
|
|
1823
|
+
get model() {
|
|
1824
|
+
return this.props.model;
|
|
1825
|
+
}
|
|
1826
|
+
constructor(props) {
|
|
1827
|
+
super(props);
|
|
1828
|
+
this.containerRef = React.createRef();
|
|
1829
|
+
}
|
|
1830
|
+
getStateElement() {
|
|
1831
|
+
return this.model;
|
|
1832
|
+
}
|
|
1833
|
+
componentDidMount() {
|
|
1834
|
+
super.componentDidMount();
|
|
1835
|
+
this.model.initResizeManager(this.containerRef.current);
|
|
1836
|
+
}
|
|
1837
|
+
componentWillUnmount() {
|
|
1838
|
+
super.componentWillUnmount();
|
|
1839
|
+
this.model.resetResizeManager();
|
|
1840
|
+
}
|
|
1841
|
+
canRender() {
|
|
1842
|
+
if (!this.model)
|
|
1843
|
+
return false;
|
|
1844
|
+
return super.canRender();
|
|
1845
|
+
}
|
|
1846
|
+
renderElement() {
|
|
1847
|
+
const style = { display: this.model.renderRoot ? "" : "none" };
|
|
1848
|
+
const containerStyle = { display: this.model.renderContainer ? "" : "none" };
|
|
1849
|
+
const items = this.model.pages.map((page) => React.createElement(SidebarPage, { page: page, key: page.id }));
|
|
1850
|
+
const headerArea = ReactElementFactory.Instance.createElement(this.model.header.component, { model: this.model.header.componentModel });
|
|
1851
|
+
let sideArea = null;
|
|
1852
|
+
if (this.model.sideAreaComponentName) {
|
|
1853
|
+
sideArea = ReactElementFactory.Instance.createElement(this.model.sideAreaComponentName, { model: this.model.sideAreaComponentData });
|
|
1854
|
+
}
|
|
1855
|
+
return (React.createElement("div", { className: this.model.rootCss, style: style },
|
|
1856
|
+
React.createElement("div", { className: "svc-side-bar__shadow", onClick: () => this.model.collapseSidebar(), style: containerStyle }),
|
|
1857
|
+
React.createElement("div", { className: "svc-flex-row svc-side-bar__wrapper" },
|
|
1858
|
+
React.createElement("div", { className: "svc-side-bar__container-wrapper", style: containerStyle },
|
|
1859
|
+
React.createElement("div", { ref: this.containerRef, className: "svc-side-bar__container" },
|
|
1860
|
+
headerArea,
|
|
1861
|
+
React.createElement("div", { className: "svc-side-bar__container-content" }, items))),
|
|
1862
|
+
sideArea)));
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
class SidebarPage extends SurveyElementBase {
|
|
1866
|
+
get page() {
|
|
1867
|
+
return this.props.page;
|
|
1868
|
+
}
|
|
1869
|
+
getStateElement() {
|
|
1870
|
+
return this.page;
|
|
1871
|
+
}
|
|
1872
|
+
renderElement() {
|
|
1873
|
+
if (!this.page.visible)
|
|
1874
|
+
return null;
|
|
1875
|
+
const component = ReactElementFactory.Instance.createElement(this.page.componentName, { model: this.page.componentData });
|
|
1876
|
+
return component;
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
ReactQuestionFactory.Instance.registerQuestion("svc-side-bar-page", (props) => {
|
|
1880
|
+
return React.createElement(SidebarPage, props);
|
|
1881
|
+
});
|
|
1882
|
+
ReactElementFactory.Instance.registerElement("svc-side-bar", (props) => {
|
|
1883
|
+
return React.createElement(SidebarComponent, props);
|
|
1884
|
+
});
|
|
1885
|
+
|
|
1886
|
+
class TranslationLineSkeleton extends React.Component {
|
|
1887
|
+
render() {
|
|
1888
|
+
return (React.createElement("div", { className: "sd-translation-line-skeleton" }));
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
ReactElementFactory.Instance.registerElement("sd-translation-line-skeleton", (props) => {
|
|
1892
|
+
return React.createElement(TranslationLineSkeleton, props);
|
|
1893
|
+
});
|
|
1894
|
+
|
|
1895
|
+
class TranslateFromAction extends SurveyElementBase {
|
|
1896
|
+
get item() {
|
|
1897
|
+
return this.props.item;
|
|
1898
|
+
}
|
|
1899
|
+
getStateElement() {
|
|
1900
|
+
return this.item;
|
|
1901
|
+
}
|
|
1902
|
+
renderElement() {
|
|
1903
|
+
const item = this.item;
|
|
1904
|
+
return (React.createElement("div", { className: item.data.containerCss },
|
|
1905
|
+
React.createElement("span", { className: item.data.additionalTitleCss }, item.data.additionalTitle),
|
|
1906
|
+
ReactElementFactory.Instance.createElement("sv-action-bar-item-dropdown", { item: this.item })));
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
ReactElementFactory.Instance.registerElement("svc-translate-from-action", (props) => {
|
|
1910
|
+
return React.createElement(TranslateFromAction, props);
|
|
1911
|
+
});
|
|
1912
|
+
|
|
1913
|
+
class SurveyLocStringEditor extends CreatorModelElement {
|
|
1914
|
+
constructor(props) {
|
|
1915
|
+
var _a;
|
|
1916
|
+
super(props);
|
|
1917
|
+
this.onChangedHandler = (sender, options) => {
|
|
1918
|
+
this.setState({ changed: !!this.state && this.state.changed ? this.state.changed + 1 : 1 });
|
|
1919
|
+
};
|
|
1920
|
+
this.onBlur = (event) => {
|
|
1921
|
+
if (this.svStringEditorRef.current) {
|
|
1922
|
+
this.svStringEditorRef.current.spellcheck = false;
|
|
1923
|
+
}
|
|
1924
|
+
this.locString["__isEditing"] = false;
|
|
1925
|
+
this.justFocused = false;
|
|
1926
|
+
this.baseModel.onBlur(event.nativeEvent);
|
|
1927
|
+
return this.baseModel.errorText;
|
|
1928
|
+
};
|
|
1929
|
+
this.onCompositionStart = (event) => {
|
|
1930
|
+
this.baseModel.onCompositionStart(event.nativeEvent);
|
|
1931
|
+
};
|
|
1932
|
+
this.onCompositionEnd = (event) => {
|
|
1933
|
+
this.baseModel.onCompositionEnd(event.nativeEvent);
|
|
1934
|
+
};
|
|
1935
|
+
this.onInput = (event) => {
|
|
1936
|
+
this.baseModel.onInput(event.nativeEvent);
|
|
1937
|
+
};
|
|
1938
|
+
this.onPaste = (event) => {
|
|
1939
|
+
this.baseModel.onPaste(event.nativeEvent);
|
|
1940
|
+
};
|
|
1941
|
+
this.justFocused = false;
|
|
1942
|
+
this.onFocus = (event) => {
|
|
1943
|
+
this.baseModel.onFocus(event.nativeEvent);
|
|
1944
|
+
this.justFocused = true;
|
|
1945
|
+
};
|
|
1946
|
+
this.onKeyDown = (event) => {
|
|
1947
|
+
return this.baseModel.onKeyDown(event.nativeEvent);
|
|
1948
|
+
};
|
|
1949
|
+
this.onKeyUp = (event) => {
|
|
1950
|
+
return this.baseModel.onKeyUp(event.nativeEvent);
|
|
1951
|
+
};
|
|
1952
|
+
this.onMouseUp = (event) => {
|
|
1953
|
+
return this.baseModel.onMouseUp(event.nativeEvent);
|
|
1954
|
+
};
|
|
1955
|
+
this.done = (event) => {
|
|
1956
|
+
this.baseModel.done(event);
|
|
1957
|
+
this.locString["__isEditing"] = false;
|
|
1958
|
+
};
|
|
1959
|
+
this.edit = (event) => {
|
|
1960
|
+
this.svStringEditorRef.current.focus();
|
|
1961
|
+
// document.execCommand('selectAll', false, null);
|
|
1962
|
+
this.locString["__isEditing"] = true;
|
|
1963
|
+
this.baseModel.onClick(event);
|
|
1964
|
+
};
|
|
1965
|
+
this.htmlValue = {
|
|
1966
|
+
__html: (_a = this.locString) === null || _a === void 0 ? void 0 : _a.renderedHtml
|
|
1967
|
+
};
|
|
1968
|
+
this.state = { changed: 0 };
|
|
1969
|
+
this.svStringEditorRef = React.createRef();
|
|
1970
|
+
}
|
|
1971
|
+
createModel(props) {
|
|
1972
|
+
if (this.baseModel) {
|
|
1973
|
+
this.baseModel.dispose();
|
|
1974
|
+
}
|
|
1975
|
+
this.baseModel = new StringEditorViewModelBase(this.locString, this.creator);
|
|
1976
|
+
}
|
|
1977
|
+
getUpdatedModelProps() {
|
|
1978
|
+
return ["creator", "locString"];
|
|
1979
|
+
}
|
|
1980
|
+
get locString() {
|
|
1981
|
+
return this.props.locStr.locStr;
|
|
1982
|
+
}
|
|
1983
|
+
get creator() {
|
|
1984
|
+
return this.props.locStr.creator;
|
|
1985
|
+
}
|
|
1986
|
+
get style() {
|
|
1987
|
+
return this.props.style;
|
|
1988
|
+
}
|
|
1989
|
+
getStateElement() {
|
|
1990
|
+
return this.baseModel;
|
|
1991
|
+
}
|
|
1992
|
+
get errorText() {
|
|
1993
|
+
return this.baseModel.errorText;
|
|
1994
|
+
}
|
|
1995
|
+
componentDidMount() {
|
|
1996
|
+
super.componentDidMount();
|
|
1997
|
+
if (!this.locString)
|
|
1998
|
+
return;
|
|
1999
|
+
this.baseModel.setLocString(this.locString);
|
|
2000
|
+
this.baseModel.getEditorElement = () => this.svStringEditorRef.current;
|
|
2001
|
+
this.baseModel.blurEditor = () => {
|
|
2002
|
+
this.svStringEditorRef.current.blur();
|
|
2003
|
+
this.svStringEditorRef.current.spellcheck = false;
|
|
2004
|
+
};
|
|
2005
|
+
this.baseModel.afterRender();
|
|
2006
|
+
this.locString.onStringChanged.add(this.onChangedHandler);
|
|
2007
|
+
if (this.locString["__isEditing"]) {
|
|
2008
|
+
this.svStringEditorRef.current.focus();
|
|
2009
|
+
// document.execCommand('selectAll', false, null);
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
componentDidUpdate(prevProps, prevState) {
|
|
2013
|
+
super.componentDidUpdate(prevProps, prevState);
|
|
2014
|
+
this.baseModel.setLocString(this.locString);
|
|
2015
|
+
this.baseModel.afterRender();
|
|
2016
|
+
}
|
|
2017
|
+
componentWillUnmount() {
|
|
2018
|
+
super.componentWillUnmount();
|
|
2019
|
+
this.baseModel.detachFromUI();
|
|
2020
|
+
if (!this.locString)
|
|
2021
|
+
return;
|
|
2022
|
+
this.locString.onStringChanged.remove(this.onChangedHandler);
|
|
2023
|
+
}
|
|
2024
|
+
get placeholder() {
|
|
2025
|
+
return this.baseModel.placeholder;
|
|
2026
|
+
}
|
|
2027
|
+
get contentEditable() {
|
|
2028
|
+
return this.baseModel.contentEditable;
|
|
2029
|
+
}
|
|
2030
|
+
get className() {
|
|
2031
|
+
return this.baseModel.className(this.locString.renderedHtml);
|
|
2032
|
+
}
|
|
2033
|
+
render() {
|
|
2034
|
+
if (!this.locString) {
|
|
2035
|
+
return null;
|
|
2036
|
+
}
|
|
2037
|
+
let control = null;
|
|
2038
|
+
if (this.locString.hasHtml) {
|
|
2039
|
+
if (this.htmlValue.__html !== this.locString.renderedHtml) {
|
|
2040
|
+
this.htmlValue = { __html: this.locString.renderedHtml };
|
|
2041
|
+
}
|
|
2042
|
+
control = (React.createElement("span", { role: "textbox", ref: this.svStringEditorRef, className: "sv-string-editor sv-string-editor--html", contentEditable: this.contentEditable, spellCheck: false, "aria-placeholder": this.placeholder, "aria-label": this.placeholder || "content editable", suppressContentEditableWarning: true,
|
|
2043
|
+
// style={this.style}
|
|
2044
|
+
dangerouslySetInnerHTML: this.htmlValue, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeyDown, onMouseUp: this.onMouseUp, onClick: this.edit }));
|
|
2045
|
+
}
|
|
2046
|
+
else {
|
|
2047
|
+
control = (React.createElement("span", { role: "textbox", ref: this.svStringEditorRef, className: "sv-string-editor", contentEditable: this.contentEditable, spellCheck: false, "aria-placeholder": this.placeholder, "aria-label": this.placeholder || "content editable", suppressContentEditableWarning: true,
|
|
2048
|
+
// style={this.style}
|
|
2049
|
+
key: this.locString.renderedHtml, onBlur: this.onBlur, onInput: this.onInput, onPaste: this.onPaste, onCompositionStart: this.onCompositionStart, onCompositionEnd: this.onCompositionEnd, onFocus: this.onFocus, onKeyDown: this.onKeyDown, onKeyUp: this.onKeyUp, onMouseUp: this.onMouseUp, onClick: this.edit }, this.locString.renderedHtml));
|
|
2050
|
+
}
|
|
2051
|
+
const counter = this.baseModel.showCharacterCounter ? (React.createElement(CharacterCounterComponent, { counter: this.baseModel.characterCounter, remainingCharacterCounter: this.baseModel.getCharacterCounterClass })) : null;
|
|
2052
|
+
return (React.createElement("span", { className: this.className },
|
|
2053
|
+
React.createElement("span", { className: "svc-string-editor__content" },
|
|
2054
|
+
React.createElement("div", { className: "svc-string-editor__border svc-string-editor__border--hover", onClick: this.edit }),
|
|
2055
|
+
React.createElement("div", { className: "svc-string-editor__border svc-string-editor__border--focus", onClick: this.edit }),
|
|
2056
|
+
React.createElement("span", { className: "svc-string-editor__input" },
|
|
2057
|
+
control,
|
|
2058
|
+
React.createElement("div", { className: "svc-string-editor__controls", onClick: this.edit }),
|
|
2059
|
+
counter)),
|
|
2060
|
+
this.errorText ? React.createElement("span", { className: "svc-string-editor__error" }, this.errorText) : ""));
|
|
2061
|
+
}
|
|
2062
|
+
}
|
|
2063
|
+
ReactElementFactory.Instance.registerElement(editableStringRendererName, (props) => {
|
|
2064
|
+
return React.createElement(SurveyLocStringEditor, props);
|
|
2065
|
+
});
|
|
2066
|
+
|
|
2067
|
+
class QuestionErrorComponent extends React.Component {
|
|
2068
|
+
render() {
|
|
2069
|
+
return (React.createElement("div", null,
|
|
2070
|
+
React.createElement(SvgIcon, { "aria-hidden": "true", iconName: "icon-alert_24x24", size: "24", className: this.props.cssClasses.error.icon }),
|
|
2071
|
+
React.createElement("span", { className: this.props.cssClasses.error.item || undefined },
|
|
2072
|
+
React.createElement(SurveyLocStringViewer, { locStr: this.props.error.locText }))));
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
ReactElementFactory.Instance.registerElement("svc-question-error", (props) => {
|
|
2076
|
+
return React.createElement(QuestionErrorComponent, props);
|
|
2077
|
+
});
|
|
2078
|
+
|
|
2079
|
+
class SurveyLogicOpertor extends SurveyQuestionDropdown {
|
|
2080
|
+
constructor(props) {
|
|
2081
|
+
super(props);
|
|
2082
|
+
}
|
|
2083
|
+
renderInput() {
|
|
2084
|
+
const q = this.question;
|
|
2085
|
+
initLogicOperator(q);
|
|
2086
|
+
const text = (q.selectedItemLocText) ? this.renderLocString(q.selectedItemLocText) : "";
|
|
2087
|
+
return (React.createElement("div", { id: this.question.inputId, className: q.getControlClass(), tabIndex: this.question.isInputReadOnly ? undefined : 0,
|
|
2088
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2089
|
+
// @ts-ignore
|
|
2090
|
+
disabled: this.question.isInputReadOnly, required: this.question.isRequired, onChange: this.updateValueOnEvent, onInput: this.updateValueOnEvent, onKeyUp: this.keyhandler, role: this.question.ariaRole, "aria-required": this.question.ariaRequired, "aria-label": this.question.ariaLabel, "aria-invalid": this.question.ariaInvalid, "aria-describedby": this.question.ariaDescribedBy },
|
|
2091
|
+
React.createElement("div", { className: this.question.cssClasses.controlValue },
|
|
2092
|
+
text,
|
|
2093
|
+
React.createElement("div", null, q.readOnlyText)),
|
|
2094
|
+
this.createClearButton()));
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
ReactQuestionFactory.Instance.registerQuestion("sv-logic-operator", (props) => {
|
|
2098
|
+
return React.createElement(SurveyLogicOpertor, props);
|
|
2099
|
+
});
|
|
2100
|
+
RendererFactory.Instance.registerRenderer("dropdown", "logicoperator", "sv-logic-operator");
|
|
2101
|
+
|
|
2102
|
+
class SurveyPageNavigator extends CreatorModelElement {
|
|
2103
|
+
constructor(props) {
|
|
2104
|
+
super(props);
|
|
2105
|
+
this.containerRef = React.createRef();
|
|
2106
|
+
}
|
|
2107
|
+
createModel(props) {
|
|
2108
|
+
if (this.model) {
|
|
2109
|
+
this.model.dispose();
|
|
2110
|
+
}
|
|
2111
|
+
this.model = new PageNavigatorViewModel(props.pagesController, props.pageEditMode);
|
|
2112
|
+
}
|
|
2113
|
+
getUpdatedModelProps() {
|
|
2114
|
+
return ["pagesController", "pageEditMode"];
|
|
2115
|
+
}
|
|
2116
|
+
getStateElement() {
|
|
2117
|
+
return this.model;
|
|
2118
|
+
}
|
|
2119
|
+
componentDidMount() {
|
|
2120
|
+
super.componentDidMount();
|
|
2121
|
+
if (this.props.pageEditMode !== "bypage") {
|
|
2122
|
+
const el = this.containerRef.current;
|
|
2123
|
+
this.model.attachToUI(el);
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
componentWillUnmount() {
|
|
2127
|
+
super.componentWillUnmount();
|
|
2128
|
+
this.model.stopItemsContainerHeightObserver();
|
|
2129
|
+
this.model.setScrollableContainer(undefined);
|
|
2130
|
+
}
|
|
2131
|
+
renderElement() {
|
|
2132
|
+
let className = "svc-page-navigator__selector svc-page-navigator__button";
|
|
2133
|
+
if (this.model.isPopupOpened)
|
|
2134
|
+
className += " svc-page-navigator__button--pressed";
|
|
2135
|
+
return (React.createElement("div", { className: "svc-page-navigator", ref: this.containerRef, style: { display: this.model.visible ? "flex" : "none" } },
|
|
2136
|
+
attachKey2click(React.createElement("div", { className: className, onClick: () => this.model.togglePageSelector(), title: this.model.pageSelectorCaption },
|
|
2137
|
+
React.createElement(SvgIcon, { className: "svc-page-navigator__button-icon", iconName: this.model.icon, size: "auto", title: this.model.pageSelectorCaption }),
|
|
2138
|
+
React.createElement(Popup, { model: this.model.popupModel }))),
|
|
2139
|
+
React.createElement("div", null, this.model.visibleItems.map((item) => (React.createElement(SurveyPageNavigatorItem, { key: item.id, item: item }))))));
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
class SurveyPageNavigatorItem extends CreatorModelElement {
|
|
2143
|
+
getStateElement() {
|
|
2144
|
+
return this.props.item;
|
|
2145
|
+
}
|
|
2146
|
+
renderElement() {
|
|
2147
|
+
const item = this.props.item;
|
|
2148
|
+
let className = "svc-page-navigator-item-content";
|
|
2149
|
+
if (unwrap(item.active)) {
|
|
2150
|
+
className += " svc-page-navigator-item--selected";
|
|
2151
|
+
}
|
|
2152
|
+
if (unwrap(item.disabled)) {
|
|
2153
|
+
className += " svc-page-navigator-item--disabled";
|
|
2154
|
+
}
|
|
2155
|
+
return (React.createElement("div", { className: "svc-page-navigator-item" }, attachKey2click(React.createElement("div", { className: className, onClick: (e) => {
|
|
2156
|
+
item.action(item);
|
|
2157
|
+
e.stopPropagation();
|
|
2158
|
+
} },
|
|
2159
|
+
React.createElement("div", { className: "svc-page-navigator-item__dot", title: item.title },
|
|
2160
|
+
React.createElement("div", { className: "svc-page-navigator-item__dot-content" })),
|
|
2161
|
+
React.createElement("div", { className: "svc-page-navigator-item__banner" },
|
|
2162
|
+
React.createElement("span", { className: "svc-page-navigator-item__text" }, item.title),
|
|
2163
|
+
React.createElement("span", { className: "svc-page-navigator-item__dot" },
|
|
2164
|
+
React.createElement("span", { className: "svc-page-navigator-item__dot-content" })))))));
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
class SurfacePlaceholder extends React.Component {
|
|
2169
|
+
constructor(props) {
|
|
2170
|
+
super(props);
|
|
2171
|
+
}
|
|
2172
|
+
render() {
|
|
2173
|
+
return (React.createElement("div", { className: "svc-surface-placeholder" },
|
|
2174
|
+
React.createElement("div", { className: "svc-surface-placeholder__image svc-surface-placeholder__image--" + this.props.name }),
|
|
2175
|
+
React.createElement("div", { className: "svc-surface-placeholder__text" },
|
|
2176
|
+
React.createElement("div", { className: "svc-surface-placeholder__title" }, this.props.placeholderTitleText),
|
|
2177
|
+
React.createElement("div", { className: "svc-surface-placeholder__description" }, this.props.placeholderDescriptionText))));
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
ReactElementFactory.Instance.registerElement("svc-surface-placeholder", (props) => {
|
|
2181
|
+
return React.createElement(SurfacePlaceholder, props);
|
|
2182
|
+
});
|
|
2183
|
+
|
|
2184
|
+
class TabDesignerComponent extends SurveyElementBase {
|
|
2185
|
+
constructor() {
|
|
2186
|
+
super(...arguments);
|
|
2187
|
+
this.denyUpdate = () => {
|
|
2188
|
+
this.denyComponentUpdate();
|
|
2189
|
+
};
|
|
2190
|
+
this.allowUpdate = () => {
|
|
2191
|
+
this.allowComponentUpdate();
|
|
2192
|
+
};
|
|
2193
|
+
this.addDragDropEvents = () => {
|
|
2194
|
+
this.creator.onDragStart.add(this.denyUpdate);
|
|
2195
|
+
this.creator.onDragClear.add(this.allowUpdate);
|
|
2196
|
+
};
|
|
2197
|
+
this.clearDragDropEvents = () => {
|
|
2198
|
+
this.creator.onDragStart.remove(this.denyUpdate);
|
|
2199
|
+
this.creator.onDragClear.remove(this.allowUpdate);
|
|
2200
|
+
};
|
|
2201
|
+
}
|
|
2202
|
+
get model() {
|
|
2203
|
+
return this.props.data;
|
|
2204
|
+
}
|
|
2205
|
+
get creator() {
|
|
2206
|
+
return this.model.creator;
|
|
2207
|
+
}
|
|
2208
|
+
componentDidMount() {
|
|
2209
|
+
super.componentDidMount();
|
|
2210
|
+
this.addDragDropEvents();
|
|
2211
|
+
}
|
|
2212
|
+
componentWillUnmount() {
|
|
2213
|
+
super.componentWillUnmount();
|
|
2214
|
+
this.clearDragDropEvents();
|
|
2215
|
+
super.componentWillUnmount();
|
|
2216
|
+
}
|
|
2217
|
+
getStateElements() {
|
|
2218
|
+
return [this.model, this.model.survey, this.model.pagesController];
|
|
2219
|
+
}
|
|
2220
|
+
getRenderedPages() {
|
|
2221
|
+
const renderedPages = [];
|
|
2222
|
+
if (this.creator.pageEditMode !== "bypage") {
|
|
2223
|
+
const pages = this.model.pages;
|
|
2224
|
+
pages.forEach((page) => {
|
|
2225
|
+
renderedPages.push(this.createRenderedPage(page, page == this.model.newPage));
|
|
2226
|
+
});
|
|
2227
|
+
}
|
|
2228
|
+
else {
|
|
2229
|
+
const page2Display = this.model.pagesController.page2Display;
|
|
2230
|
+
if (!!page2Display) {
|
|
2231
|
+
renderedPages.push(this.createRenderedPage(page2Display, this.model.newPage === page2Display));
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
return renderedPages;
|
|
2235
|
+
}
|
|
2236
|
+
createRenderedPage(page, isGhostPage) {
|
|
2237
|
+
return (React.createElement("div", { className: "svc-page", "data-sv-drop-target-page": page.name, "data-sv-drop-target-survey-element": isGhostPage ? "newGhostPage" : page.name, key: page.id }, this.renderPage(page, isGhostPage)));
|
|
2238
|
+
}
|
|
2239
|
+
renderNewPage(className, key = "") {
|
|
2240
|
+
return (React.createElement(React.Fragment, { key: key },
|
|
2241
|
+
React.createElement("div", { className: className, "data-sv-drop-target-survey-element": "newGhostPage" }, !!this.model.newPage ? this.renderPage(this.model.newPage, true) : null)));
|
|
2242
|
+
}
|
|
2243
|
+
renderPage(pageV, isGhost) {
|
|
2244
|
+
return ReactElementFactory.Instance.createElement("svc-page", { survey: this.creator.survey, page: pageV, creator: this.creator, isGhost });
|
|
2245
|
+
}
|
|
2246
|
+
renderElement() {
|
|
2247
|
+
const designerTabClassName = "svc-tab-designer " + this.model.getRootCss();
|
|
2248
|
+
return (React.createElement(React.Fragment, null,
|
|
2249
|
+
React.createElement("div", { className: "svc-flex-column" }, this.model.isToolboxVisible ? ReactElementFactory.Instance.createElement("svc-toolbox", { model: this.creator }) : null),
|
|
2250
|
+
React.createElement("div", { className: designerTabClassName, onClick: () => this.model.clickDesigner() },
|
|
2251
|
+
React.createElement(ScrollComponent, null,
|
|
2252
|
+
React.createElement("div", { className: "svc-tab-designer_content" }, this.model.showPlaceholder ? this.renderPlaceHolder() : this.renderTabContent())))));
|
|
2253
|
+
}
|
|
2254
|
+
renderHeader(condition) {
|
|
2255
|
+
if (!condition)
|
|
2256
|
+
return null;
|
|
2257
|
+
const survey = this.creator.survey;
|
|
2258
|
+
return (React.createElement(React.Fragment, null,
|
|
2259
|
+
React.createElement("div", { className: "svc-designer-header" },
|
|
2260
|
+
React.createElement(SurveyHeader, { survey: survey }))));
|
|
2261
|
+
}
|
|
2262
|
+
renderPlaceHolder() {
|
|
2263
|
+
const surveyHeader = this.renderHeader(this.creator.allowEditSurveyTitle && this.creator.showHeaderInEmptySurvey);
|
|
2264
|
+
return (React.createElement(React.Fragment, null,
|
|
2265
|
+
surveyHeader,
|
|
2266
|
+
React.createElement("div", { className: "svc-designer__placeholder-container", "data-sv-drop-target-survey-element": "newGhostPage" },
|
|
2267
|
+
this.renderPlaceHolderContent(),
|
|
2268
|
+
this.renderNewPage("svc-designer-placeholder-page"))));
|
|
2269
|
+
}
|
|
2270
|
+
renderPlaceHolderContent() {
|
|
2271
|
+
return React.createElement(SurfacePlaceholder, { name: "designer", placeholderTitleText: this.model.placeholderTitleText, placeholderDescriptionText: this.model.placeholderDescriptionText });
|
|
2272
|
+
}
|
|
2273
|
+
renderTabContent() {
|
|
2274
|
+
const survey = this.creator.survey;
|
|
2275
|
+
const surveyHeader = this.renderHeader(this.creator.allowEditSurveyTitle);
|
|
2276
|
+
const style = Object.assign({}, this.model.surfaceCssVariables);
|
|
2277
|
+
style.maxWidth = survey.renderedWidth;
|
|
2278
|
+
const tabTools = this.renderTabTools();
|
|
2279
|
+
return (React.createElement(React.Fragment, null,
|
|
2280
|
+
React.createElement("div", { className: this.model.designerCss, style: style },
|
|
2281
|
+
surveyHeader,
|
|
2282
|
+
this.getRenderedPages()),
|
|
2283
|
+
tabTools));
|
|
2284
|
+
}
|
|
2285
|
+
renderTabTools() {
|
|
2286
|
+
if (!this.model.showSurfaceTools)
|
|
2287
|
+
return null;
|
|
2288
|
+
const pageNavigator = this.creator.showPageNavigator ?
|
|
2289
|
+
React.createElement("div", { className: "svc-tab-designer__page-navigator" },
|
|
2290
|
+
React.createElement(SurveyPageNavigator, { pagesController: this.model.pagesController, pageEditMode: this.model.creator.pageEditMode }))
|
|
2291
|
+
: null;
|
|
2292
|
+
const surfaceToolbar = this.model.showSurfaceToolbar ?
|
|
2293
|
+
React.createElement(SurveyActionBar, { model: this.model.surfaceToolbar, handleClick: false })
|
|
2294
|
+
: null;
|
|
2295
|
+
return React.createElement("div", { className: "svc-tab-designer__tools" },
|
|
2296
|
+
pageNavigator,
|
|
2297
|
+
surfaceToolbar);
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
ReactElementFactory.Instance.registerElement("svc-tab-designer", (props) => {
|
|
2301
|
+
return React.createElement(TabDesignerComponent, props);
|
|
2302
|
+
});
|
|
2303
|
+
|
|
2304
|
+
class TabJsonEditorErrorsComponent extends SurveyElementBase {
|
|
2305
|
+
getStateElement() {
|
|
2306
|
+
return this.model;
|
|
2307
|
+
}
|
|
2308
|
+
get model() {
|
|
2309
|
+
return this.props.data;
|
|
2310
|
+
}
|
|
2311
|
+
renderElement() {
|
|
2312
|
+
return React.createElement("div", { className: "svc-json-editor-tab__errros_list", style: { display: this.model.hasErrors ? "block" : "none" } },
|
|
2313
|
+
React.createElement(List, { model: this.model.errorList }));
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2316
|
+
class TabJsonEditorTextareaComponent extends SurveyElementBase {
|
|
2317
|
+
constructor(props) {
|
|
2318
|
+
super(props);
|
|
2319
|
+
}
|
|
2320
|
+
getStateElement() {
|
|
2321
|
+
return this.model;
|
|
2322
|
+
}
|
|
2323
|
+
get model() {
|
|
2324
|
+
return this.props.data;
|
|
2325
|
+
}
|
|
2326
|
+
renderElement() {
|
|
2327
|
+
const setControl = (el) => {
|
|
2328
|
+
this.model.textElement = el;
|
|
2329
|
+
};
|
|
2330
|
+
const errors = React.createElement(TabJsonEditorErrorsComponent, { data: this.model });
|
|
2331
|
+
return (React.createElement("div", { className: "svc-creator-tab__content" },
|
|
2332
|
+
React.createElement("div", { className: "svc-json-editor-tab__content" },
|
|
2333
|
+
React.createElement("textarea", { ref: input => (setControl(input)), className: "svc-json-editor-tab__content-area", value: this.model.text, onChange: (e) => (this.model.text = e.target.value), onKeyDown: (e) => this.model.checkKey(e, e), disabled: this.model.readOnly, "aria-label": this.model.ariaLabel }),
|
|
2334
|
+
errors)));
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
ReactElementFactory.Instance.registerElement("svc-tab-json-editor-textarea", (props) => {
|
|
2338
|
+
return React.createElement(TabJsonEditorTextareaComponent, props);
|
|
2339
|
+
});
|
|
2340
|
+
|
|
2341
|
+
class TabJsonEditorAceComponent extends SurveyElementBase {
|
|
2342
|
+
constructor(props) {
|
|
2343
|
+
super(props);
|
|
2344
|
+
this.aceEditorrRef = React.createRef();
|
|
2345
|
+
}
|
|
2346
|
+
getStateElement() {
|
|
2347
|
+
return this.model;
|
|
2348
|
+
}
|
|
2349
|
+
get model() {
|
|
2350
|
+
return this.props.data;
|
|
2351
|
+
}
|
|
2352
|
+
componentDidMount() {
|
|
2353
|
+
this.model.init(ace.edit(this.aceEditorrRef.current));
|
|
2354
|
+
}
|
|
2355
|
+
renderElement() {
|
|
2356
|
+
const errors = React.createElement(TabJsonEditorErrorsComponent, { data: this.model });
|
|
2357
|
+
return (React.createElement("div", { className: "svc-creator-tab__content" },
|
|
2358
|
+
React.createElement("div", { className: "svc-json-editor-tab__content" },
|
|
2359
|
+
React.createElement("div", { className: "svc-json-editor-tab__ace-editor", ref: this.aceEditorrRef }),
|
|
2360
|
+
errors)));
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
ReactElementFactory.Instance.registerElement("svc-tab-json-editor-ace", (props) => {
|
|
2364
|
+
return React.createElement(TabJsonEditorAceComponent, props);
|
|
2365
|
+
});
|
|
2366
|
+
|
|
2367
|
+
class TabLogicAddButtonComponent extends SurveyElementBase {
|
|
2368
|
+
get model() {
|
|
2369
|
+
return this.props.button;
|
|
2370
|
+
}
|
|
2371
|
+
getStateElement() {
|
|
2372
|
+
return this.model;
|
|
2373
|
+
}
|
|
2374
|
+
renderElement() {
|
|
2375
|
+
const buttonClassName = "svc-logic-tab__content-action svc-btn" + ((this.model.enabled !== undefined && !this.model.enabled) ? " svc-logic-tab__content-action--disabled" : "");
|
|
2376
|
+
return attachKey2click(React.createElement("div", { role: "button", onClick: (e) => {
|
|
2377
|
+
e.stopPropagation();
|
|
2378
|
+
this.model.action();
|
|
2379
|
+
}, className: buttonClassName, title: this.model.title },
|
|
2380
|
+
React.createElement("span", { className: "svc-btn__text" }, this.model.title)));
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
ReactElementFactory.Instance.registerElement("svc-tab-logic-add-button", (props) => {
|
|
2384
|
+
return React.createElement(TabLogicAddButtonComponent, props);
|
|
2385
|
+
});
|
|
2386
|
+
class TabLogicComponent extends SurveyElementBase {
|
|
2387
|
+
get model() {
|
|
2388
|
+
return this.props.data;
|
|
2389
|
+
}
|
|
2390
|
+
getStateElement() {
|
|
2391
|
+
return this.model;
|
|
2392
|
+
}
|
|
2393
|
+
renderElement() {
|
|
2394
|
+
this.model;
|
|
2395
|
+
var rootClass = "svc-creator-tab__content svc-logic-tab";
|
|
2396
|
+
var content = this.renderViewContent();
|
|
2397
|
+
return React.createElement("div", { className: rootClass }, content);
|
|
2398
|
+
}
|
|
2399
|
+
renderViewContent() {
|
|
2400
|
+
const logicTabClassName = "svc-plugin-tab__content svc-logic-tab svc-logic-tab__content " + (this.model.hasItems ? "" : "svc-logic-tab--empty");
|
|
2401
|
+
const addLogic = !this.model.readOnly ? React.createElement(TabLogicAddButtonComponent, { button: this.model.addNewButton }) : undefined;
|
|
2402
|
+
return (React.createElement(Fragment, null,
|
|
2403
|
+
React.createElement("div", { className: logicTabClassName }, this.model.hasItems ?
|
|
2404
|
+
(React.createElement(React.Fragment, null,
|
|
2405
|
+
React.createElement(Survey, { model: this.model.itemsSurvey }),
|
|
2406
|
+
addLogic))
|
|
2407
|
+
: (React.createElement("div", { className: "svc-logic-tab__content-empty" },
|
|
2408
|
+
React.createElement(SurfacePlaceholder, { name: "logic", placeholderTitleText: this.model.placeholderTitleText, placeholderDescriptionText: this.model.placeholderDescriptionText }),
|
|
2409
|
+
addLogic)))));
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
ReactElementFactory.Instance.registerElement("svc-tab-logic", (props) => {
|
|
2413
|
+
return React.createElement(TabLogicComponent, props);
|
|
2414
|
+
});
|
|
2415
|
+
|
|
2416
|
+
class SurveySimulator extends SurveyElementBase {
|
|
2417
|
+
get model() {
|
|
2418
|
+
return this.props.model;
|
|
2419
|
+
}
|
|
2420
|
+
getStateElement() {
|
|
2421
|
+
return this.model;
|
|
2422
|
+
}
|
|
2423
|
+
renderElement() {
|
|
2424
|
+
const mainSimulatorClass = this.model.getRootCss();
|
|
2425
|
+
if (!this.model.survey) {
|
|
2426
|
+
return React.createElement("div", { className: mainSimulatorClass });
|
|
2427
|
+
}
|
|
2428
|
+
if (this.model.hasFrame) {
|
|
2429
|
+
return (React.createElement("div", { className: mainSimulatorClass, onKeyDown: e => this.model.tryToZoom(e, e), onMouseEnter: this.model.device === "desktop" ? null : this.model.activateZoom, onMouseLeave: this.model.device === "desktop" ? null : this.model.deactivateZoom },
|
|
2430
|
+
React.createElement("div", { className: "svd-simulator-wrapper", id: "svd-simulator-wrapper", style: {
|
|
2431
|
+
width: this.model.simulatorFrame.frameWidth + "px",
|
|
2432
|
+
height: this.model.simulatorFrame.frameHeight + "px"
|
|
2433
|
+
} },
|
|
2434
|
+
React.createElement("div", { className: "svd-simulator", style: {
|
|
2435
|
+
width: this.model.simulatorFrame.deviceWidth + "px",
|
|
2436
|
+
height: this.model.simulatorFrame.deviceHeight + "px",
|
|
2437
|
+
transform: "scale(" +
|
|
2438
|
+
this.model.simulatorFrame.scale +
|
|
2439
|
+
") translate(-50%, -50%)"
|
|
2440
|
+
} },
|
|
2441
|
+
React.createElement("div", { className: "svd-simulator-content" },
|
|
2442
|
+
React.createElement(Survey, { model: this.model.survey }))))));
|
|
2443
|
+
}
|
|
2444
|
+
else {
|
|
2445
|
+
return (React.createElement("div", { className: mainSimulatorClass },
|
|
2446
|
+
React.createElement("div", { className: "svd-simulator-content" },
|
|
2447
|
+
React.createElement(Survey, { model: this.model.survey }))));
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
class TabPreviewTestSurveyAgainComponent extends SurveyElementBase {
|
|
2453
|
+
get model() {
|
|
2454
|
+
return this.props.model.testAgainAction;
|
|
2455
|
+
}
|
|
2456
|
+
getStateElement() {
|
|
2457
|
+
return this.model;
|
|
2458
|
+
}
|
|
2459
|
+
renderElement() {
|
|
2460
|
+
const buttonClassName = "svc-preview__test-again svc-btn";
|
|
2461
|
+
return attachKey2click(React.createElement("div", { role: "button", onClick: (e) => {
|
|
2462
|
+
e.stopPropagation();
|
|
2463
|
+
this.model.action();
|
|
2464
|
+
}, className: buttonClassName, title: this.model.title },
|
|
2465
|
+
React.createElement("span", { className: "svc-btn__text" }, this.model.title)));
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
ReactElementFactory.Instance.registerElement("svc-complete-page", (props) => {
|
|
2469
|
+
return React.createElement(TabPreviewTestSurveyAgainComponent, props);
|
|
2470
|
+
});
|
|
2471
|
+
class TabPreviewSurveyComponent extends SurveyElementBase {
|
|
2472
|
+
constructor(props) {
|
|
2473
|
+
super(props);
|
|
2474
|
+
}
|
|
2475
|
+
get model() {
|
|
2476
|
+
return this.props.data;
|
|
2477
|
+
}
|
|
2478
|
+
getStateElement() {
|
|
2479
|
+
return this.model;
|
|
2480
|
+
}
|
|
2481
|
+
renderPlaceholder() {
|
|
2482
|
+
return React.createElement(SurfacePlaceholder, { name: "preview", placeholderTitleText: this.model.placeholderTitleText, placeholderDescriptionText: this.model.placeholderDescriptionText });
|
|
2483
|
+
}
|
|
2484
|
+
renderSimulator() {
|
|
2485
|
+
return (React.createElement("div", { className: "svc-plugin-tab__content" },
|
|
2486
|
+
React.createElement(SurveySimulator, { model: this.model.simulator }),
|
|
2487
|
+
this.model.showResults ? React.createElement(SurveyResults, { survey: this.model.simulator.survey }) : null));
|
|
2488
|
+
}
|
|
2489
|
+
renderElement() {
|
|
2490
|
+
const tabContentClassName = "svc-creator-tab__content svc-test-tab__content" + (this.model.isPageToolbarVisible ? " svc-creator-tab__content--with-toolbar" : "");
|
|
2491
|
+
return (React.createElement("div", { className: tabContentClassName },
|
|
2492
|
+
this.model.simulator.survey.isEmpty ? this.renderPlaceholder() : this.renderSimulator(),
|
|
2493
|
+
this.getBottomToolbar()));
|
|
2494
|
+
}
|
|
2495
|
+
getBottomToolbar() {
|
|
2496
|
+
if (this.model.isPageToolbarVisible) {
|
|
2497
|
+
return (React.createElement("div", { className: "svc-test-tab__content-actions" },
|
|
2498
|
+
React.createElement(SurveyActionBar, { model: this.model.pages })));
|
|
2499
|
+
}
|
|
2500
|
+
else {
|
|
2501
|
+
return null;
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
ReactElementFactory.Instance.registerElement("svc-tab-preview", (props) => {
|
|
2506
|
+
return React.createElement(TabPreviewSurveyComponent, props);
|
|
2507
|
+
});
|
|
2508
|
+
|
|
2509
|
+
class PropertyGridPlaceholderComponent extends React.Component {
|
|
2510
|
+
render() {
|
|
2511
|
+
return (React.createElement("div", { className: "svc-property-grid-placeholder" },
|
|
2512
|
+
React.createElement("div", { className: "svc-property-grid-placeholder__header" },
|
|
2513
|
+
React.createElement("span", { className: "svc-property-grid-placeholder__title" }, editorLocalization.getString("ed.propertyGridPlaceholderTitle")),
|
|
2514
|
+
React.createElement("span", { className: "svc-property-grid-placeholder__description" }, editorLocalization.getString("ed.propertyGridPlaceholderDescription"))),
|
|
2515
|
+
React.createElement("div", { className: "svc-property-grid-placeholder__content" },
|
|
2516
|
+
React.createElement("div", { className: "svc-property-grid-placeholder__gap" }),
|
|
2517
|
+
React.createElement("div", { className: "svc-property-grid-placeholder__image" }))));
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
ReactElementFactory.Instance.registerElement("svc-property-grid-placeholder", (props) => {
|
|
2521
|
+
return React.createElement(PropertyGridPlaceholderComponent, props);
|
|
2522
|
+
});
|
|
2523
|
+
|
|
2524
|
+
class TabThemeSurveyComponent extends SurveyElementBase {
|
|
2525
|
+
get model() {
|
|
2526
|
+
return this.props.data;
|
|
2527
|
+
}
|
|
2528
|
+
getStateElement() {
|
|
2529
|
+
return this.model;
|
|
2530
|
+
}
|
|
2531
|
+
renderPlaceholder() {
|
|
2532
|
+
return React.createElement(SurfacePlaceholder, { name: "theme", placeholderTitleText: this.model.placeholderTitleText, placeholderDescriptionText: this.model.placeholderDescriptionText });
|
|
2533
|
+
}
|
|
2534
|
+
renderSimulator() {
|
|
2535
|
+
return (React.createElement("div", { className: "svc-plugin-tab__content" },
|
|
2536
|
+
React.createElement(SurveySimulator, { model: this.model.simulator }),
|
|
2537
|
+
this.model.showResults ? React.createElement(SurveyResults, { survey: this.model.simulator.survey }) : null));
|
|
2538
|
+
}
|
|
2539
|
+
renderElement() {
|
|
2540
|
+
const tabContentClassName = "svc-creator-tab__content svc-test-tab__content" + (this.model.isPageToolbarVisible ? " svc-creator-tab__content--with-toolbar" : "");
|
|
2541
|
+
return (React.createElement("div", { className: tabContentClassName },
|
|
2542
|
+
this.model.simulator.survey.isEmpty ? this.renderPlaceholder() : this.renderSimulator(),
|
|
2543
|
+
this.getBottomToolbar()));
|
|
2544
|
+
}
|
|
2545
|
+
getBottomToolbar() {
|
|
2546
|
+
if (this.model.isPageToolbarVisible) {
|
|
2547
|
+
return (React.createElement("div", { className: "svc-test-tab__content-actions" },
|
|
2548
|
+
React.createElement(SurveyActionBar, { model: this.model.pages })));
|
|
2549
|
+
}
|
|
2550
|
+
else {
|
|
2551
|
+
return null;
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
}
|
|
2555
|
+
ReactElementFactory.Instance.registerElement("svc-tab-theme", (props) => {
|
|
2556
|
+
return React.createElement(TabThemeSurveyComponent, props);
|
|
2557
|
+
});
|
|
2558
|
+
|
|
2559
|
+
class TabTranslationComponent extends SurveyElementBase {
|
|
2560
|
+
get model() {
|
|
2561
|
+
return this.props.data || this.props.model;
|
|
2562
|
+
}
|
|
2563
|
+
getStateElement() {
|
|
2564
|
+
return this.model;
|
|
2565
|
+
}
|
|
2566
|
+
renderElement() {
|
|
2567
|
+
if (!this.model)
|
|
2568
|
+
return null;
|
|
2569
|
+
return (React.createElement("div", { className: "svc-creator-tab__content svc-translation-tab" + (this.model.isEmpty ? " svc-translation-tab--empty" : "") }, this.renderElementContent()));
|
|
2570
|
+
}
|
|
2571
|
+
renderElementContent() {
|
|
2572
|
+
if (this.model.isEmpty) {
|
|
2573
|
+
return React.createElement(SurfacePlaceholder, { name: "translation", placeholderTitleText: this.model.placeholderTitleText, placeholderDescriptionText: this.model.placeholderDescriptionText });
|
|
2574
|
+
}
|
|
2575
|
+
else {
|
|
2576
|
+
return (React.createElement("div", { className: "st-content" },
|
|
2577
|
+
React.createElement("div", { className: "svc-flex-column st-strings-wrapper" },
|
|
2578
|
+
React.createElement("div", { className: "svc-flex-row st-strings-header" },
|
|
2579
|
+
React.createElement(Survey, { model: this.model.stringsHeaderSurvey })),
|
|
2580
|
+
React.createElement("div", { className: "svc-flex-row svc-plugin-tab__content st-strings" },
|
|
2581
|
+
React.createElement(Survey, { model: this.model.stringsSurvey })))));
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
ReactElementFactory.Instance.registerElement("svc-tab-translation", (props) => {
|
|
2586
|
+
return React.createElement(TabTranslationComponent, props);
|
|
2587
|
+
});
|
|
2588
|
+
|
|
2589
|
+
class ObjectSelectorComponent extends SurveyElementBase {
|
|
2590
|
+
get model() {
|
|
2591
|
+
return this.props.model;
|
|
2592
|
+
}
|
|
2593
|
+
getStateElement() {
|
|
2594
|
+
return this.model;
|
|
2595
|
+
}
|
|
2596
|
+
renderElement() {
|
|
2597
|
+
if (!this.model.isVisible)
|
|
2598
|
+
return null;
|
|
2599
|
+
return (React.createElement(List, { model: this.model.list }));
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
ReactElementFactory.Instance.registerElement("svc-object-selector", (props) => {
|
|
2603
|
+
return React.createElement(ObjectSelectorComponent, props);
|
|
2604
|
+
});
|
|
2605
|
+
|
|
2606
|
+
class PropertyGridComponent extends SurveyElementBase {
|
|
2607
|
+
get model() {
|
|
2608
|
+
return this.props.model;
|
|
2609
|
+
}
|
|
2610
|
+
getStateElement() {
|
|
2611
|
+
return this.model;
|
|
2612
|
+
}
|
|
2613
|
+
canRender() {
|
|
2614
|
+
if (!this.model)
|
|
2615
|
+
return false;
|
|
2616
|
+
return super.canRender();
|
|
2617
|
+
}
|
|
2618
|
+
renderElement() {
|
|
2619
|
+
return (React.createElement("div", { className: this.model.rootCss },
|
|
2620
|
+
React.createElement(SearchComponent, { model: this.model.searchManager }),
|
|
2621
|
+
React.createElement(ScrollComponent, null,
|
|
2622
|
+
React.createElement(Survey, { model: this.model.survey }))));
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
ReactQuestionFactory.Instance.registerQuestion("buttongroup", (props) => {
|
|
2626
|
+
return React.createElement(SurveyQuestionButtonGroup, props);
|
|
2627
|
+
});
|
|
2628
|
+
ReactElementFactory.Instance.registerElement("svc-property-grid", (props) => {
|
|
2629
|
+
return React.createElement(PropertyGridComponent, props);
|
|
2630
|
+
});
|
|
2631
|
+
|
|
2632
|
+
class SwitcherComponent extends SurveyElementBase {
|
|
2633
|
+
get item() {
|
|
2634
|
+
return this.props.item;
|
|
2635
|
+
}
|
|
2636
|
+
getStateElement() {
|
|
2637
|
+
return this.item;
|
|
2638
|
+
}
|
|
2639
|
+
renderElement() {
|
|
2640
|
+
const tooltip = this.item.tooltip || this.item.title;
|
|
2641
|
+
const title = this.item.hasTitle ? React.createElement("span", { className: "svc-switcher__title" }, this.item.title) : null;
|
|
2642
|
+
const button = attachKey2click(React.createElement("button", { className: this.item.getActionBarItemCss(), type: "button", disabled: this.item.disabled, onClick: (args) => this.item.action(this.item, this.item.getIsTrusted(args)), title: tooltip, "aria-checked": this.item.ariaChecked, "aria-expanded": this.item.ariaExpanded, role: this.item.ariaRole },
|
|
2643
|
+
React.createElement("div", { className: this.item.getSwitcherIconCss() },
|
|
2644
|
+
React.createElement("div", { className: "svc-switcher__icon-thumb" })),
|
|
2645
|
+
title), this.item, { processEsc: false });
|
|
2646
|
+
return button;
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
ReactElementFactory.Instance.registerElement("svc-switcher", (props) => {
|
|
2650
|
+
return React.createElement(SwitcherComponent, props);
|
|
2651
|
+
});
|
|
2652
|
+
|
|
2653
|
+
let ItemTemplateComponent$1 = class ItemTemplateComponent extends SurveyElementBase {
|
|
2654
|
+
render() {
|
|
2655
|
+
const item = this.props.item;
|
|
2656
|
+
return (React.createElement(React.Fragment, null,
|
|
2657
|
+
React.createElement(SvgIcon, { iconName: item.iconName, size: item.iconSize, className: "svc-json-error__icon" }),
|
|
2658
|
+
React.createElement("div", { className: "svc-json-error__container" },
|
|
2659
|
+
React.createElement("div", { className: "svc-json-error__title" },
|
|
2660
|
+
React.createElement("span", { key: 2 }, this.renderLocString(item.locTitle, undefined, "locString"))),
|
|
2661
|
+
this.renderFixButton())));
|
|
2662
|
+
}
|
|
2663
|
+
renderFixButton() {
|
|
2664
|
+
if (!this.props.item.data.showFixButton)
|
|
2665
|
+
return null;
|
|
2666
|
+
const item = this.props.item;
|
|
2667
|
+
return (attachKey2click(React.createElement("button", { type: "button", onClick: (event) => { event.stopPropagation(); item.data.fixError(); }, title: item.data.fixButtonTitle, className: "svc-json-error__fix-button" },
|
|
2668
|
+
React.createElement(SvgIcon, { iconName: item.data.fixButtonIcon, size: "auto" }))));
|
|
2669
|
+
}
|
|
2670
|
+
};
|
|
2671
|
+
ReactElementFactory.Instance.registerElement("json-error-item", (props) => {
|
|
2672
|
+
return React.createElement(ItemTemplateComponent$1, props);
|
|
2673
|
+
});
|
|
2674
|
+
|
|
2675
|
+
class SurveyQuestionSpinEditor extends SurveyQuestionText {
|
|
2676
|
+
constructor(props) {
|
|
2677
|
+
super(props);
|
|
2678
|
+
}
|
|
2679
|
+
get question() {
|
|
2680
|
+
return this.questionBase;
|
|
2681
|
+
}
|
|
2682
|
+
renderInput() {
|
|
2683
|
+
return (React.createElement(React.Fragment, null,
|
|
2684
|
+
React.createElement("input", { id: this.question.inputId, disabled: this.isDisplayMode, className: this.question.cssClasses.control, ref: (input) => (this.setControl(input)), placeholder: this.question.renderedPlaceholder, autoComplete: "off", onBlur: (event) => this.question.onBlur(event.nativeEvent), onFocus: (event) => this.question.onFocus(event.nativeEvent), onChange: this.question.onChange, onBeforeInput: event => this.question.onBeforeInput(event.nativeEvent), onKeyUp: (event) => this.question.onKeyUp(event.nativeEvent), onKeyDown: (event) => this.question.onInputKeyDown(event.nativeEvent), "aria-required": this.question.ariaRequired, "aria-label": this.question.ariaLabel, "aria-invalid": this.question.ariaInvalid, "aria-describedby": this.question.ariaDescribedBy })));
|
|
2685
|
+
}
|
|
2686
|
+
renderElement() {
|
|
2687
|
+
return (React.createElement("div", { className: this.question.cssClasses.root, onKeyDown: event => this.question.onKeyDown(event.nativeEvent) },
|
|
2688
|
+
this.renderInput(),
|
|
2689
|
+
this.renderButtons()));
|
|
2690
|
+
}
|
|
2691
|
+
getValueCore() {
|
|
2692
|
+
return this.question.renderedValue;
|
|
2693
|
+
}
|
|
2694
|
+
renderButtons() {
|
|
2695
|
+
return (React.createElement("span", { className: this.question.cssClasses.buttonsContainer },
|
|
2696
|
+
React.createElement("button", { tabIndex: -1, className: this.question.cssClasses.arrowButton, disabled: this.isDisplayMode, onClick: this.question.onDownButtonClick, onMouseDown: this.question.onDownButtonMouseDown, onMouseUp: this.question.onButtonMouseUp, onMouseLeave: this.question.onButtonMouseLeave, onBlur: event => this.question.onBlur(event.nativeEvent), onFocus: event => this.question.onFocus(event.nativeEvent) },
|
|
2697
|
+
React.createElement(SvgIcon, { iconName: this.question.cssClasses.decreaseButtonIcon, size: "auto" })),
|
|
2698
|
+
React.createElement("button", { tabIndex: -1, className: this.question.cssClasses.arrowButton, disabled: this.isDisplayMode, onClick: this.question.onUpButtonClick, onMouseDown: this.question.onUpButtonMouseDown, onMouseUp: this.question.onButtonMouseUp, onMouseLeave: this.question.onButtonMouseLeave, onBlur: event => this.question.onBlur(event.nativeEvent), onFocus: event => this.question.onFocus(event.nativeEvent) },
|
|
2699
|
+
React.createElement(SvgIcon, { iconName: this.question.cssClasses.increaseButtonIcon, size: "auto" }))));
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
ReactQuestionFactory.Instance.registerQuestion("spinedit", (props) => {
|
|
2703
|
+
return React.createElement(SurveyQuestionSpinEditor, props);
|
|
2704
|
+
});
|
|
2705
|
+
|
|
2706
|
+
class ItemTemplateComponent extends SurveyElementBase {
|
|
2707
|
+
render() {
|
|
2708
|
+
const item = this.props.item;
|
|
2709
|
+
return (React.createElement(React.Fragment, null,
|
|
2710
|
+
React.createElement("span", { className: "spg-color-editor__color-swatch", style: { backgroundColor: item.value } }),
|
|
2711
|
+
React.createElement("span", { key: 2 }, this.renderLocString(item.locTitle, undefined, "locString"))));
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
ReactElementFactory.Instance.registerElement("color-item", (props) => {
|
|
2715
|
+
return React.createElement(ItemTemplateComponent, props);
|
|
2716
|
+
});
|
|
2717
|
+
|
|
2718
|
+
class SurveyQuestionColor extends SurveyQuestionText {
|
|
2719
|
+
constructor(props) {
|
|
2720
|
+
super(props);
|
|
2721
|
+
}
|
|
2722
|
+
get question() {
|
|
2723
|
+
return this.questionBase;
|
|
2724
|
+
}
|
|
2725
|
+
renderInput() {
|
|
2726
|
+
return (React.createElement(React.Fragment, null,
|
|
2727
|
+
React.createElement("input", { id: this.question.inputId, disabled: this.isDisplayMode, className: this.question.cssClasses.control, ref: (input) => (this.setControl(input)), placeholder: this.question.renderedPlaceholder, autoComplete: "off", onKeyUp: (event) => this.question.onKeyUp(event.nativeEvent), onBlur: (event) => this.question.onBlur(event.nativeEvent), onChange: this.question.onChange, onBeforeInput: event => this.question.onBeforeInput(event.nativeEvent), "aria-required": this.question.ariaRequired, "aria-label": this.question.ariaLabel, "aria-invalid": this.question.ariaInvalid, "aria-describedby": this.question.ariaDescribedBy })));
|
|
2728
|
+
}
|
|
2729
|
+
renderElement() {
|
|
2730
|
+
return (React.createElement("div", { className: this.question.cssClasses.root, onKeyDown: event => this.question.onKeyDown(event.nativeEvent) },
|
|
2731
|
+
this.renderColorSwatch(),
|
|
2732
|
+
this.renderInput(),
|
|
2733
|
+
this.question.showDropdownAction ? this.renderDropdownAction() : null));
|
|
2734
|
+
}
|
|
2735
|
+
getValueCore() {
|
|
2736
|
+
return this.question.renderedValue;
|
|
2737
|
+
}
|
|
2738
|
+
renderColorSwatch() {
|
|
2739
|
+
return React.createElement("label", { className: this.question.getSwatchCss(), style: this.question.getSwatchStyle() },
|
|
2740
|
+
React.createElement(SvgIcon, { iconName: this.question.cssClasses.swatchIcon, size: "auto" }),
|
|
2741
|
+
React.createElement("input", { type: "color", disabled: this.isDisplayMode, value: this.question.renderedColorValue, className: this.question.cssClasses.colorInput, onChange: (event) => this.question.onColorInputChange(event.nativeEvent), tabIndex: -1 }));
|
|
2742
|
+
}
|
|
2743
|
+
renderDropdownAction() {
|
|
2744
|
+
return (React.createElement(React.Fragment, null,
|
|
2745
|
+
ReactElementFactory.Instance.createElement("sv-action-bar-item", { item: this.question.dropdownAction }),
|
|
2746
|
+
this.renderPopup()));
|
|
2747
|
+
}
|
|
2748
|
+
renderPopup() {
|
|
2749
|
+
return React.createElement(Popup, { model: this.question.dropdownAction.popupModel });
|
|
2750
|
+
}
|
|
2751
|
+
}
|
|
2752
|
+
ReactQuestionFactory.Instance.registerQuestion("color", (props) => {
|
|
2753
|
+
return React.createElement(SurveyQuestionColor, props);
|
|
2754
|
+
});
|
|
2755
|
+
|
|
2756
|
+
class SurveyQuestionFileEditor extends SurveyQuestionText {
|
|
2757
|
+
constructor(props) {
|
|
2758
|
+
super(props);
|
|
2759
|
+
}
|
|
2760
|
+
get questionFile() {
|
|
2761
|
+
return this.questionBase;
|
|
2762
|
+
}
|
|
2763
|
+
getValueCore() {
|
|
2764
|
+
return this.question.renderedValue;
|
|
2765
|
+
}
|
|
2766
|
+
renderInput() {
|
|
2767
|
+
return (React.createElement(React.Fragment, null,
|
|
2768
|
+
React.createElement("input", { disabled: this.isDisplayMode, className: this.questionFile.cssClasses.control, placeholder: this.questionFile.renderedPlaceholder, ref: (input) => (this.setControl(input)), autoComplete: "off", type: "text", onBlur: (event) => this.questionFile.onInputBlur(event.nativeEvent), onChange: (event) => this.questionFile.onInputChange(event.nativeEvent) })));
|
|
2769
|
+
}
|
|
2770
|
+
renderFileInput() {
|
|
2771
|
+
return (React.createElement("input", { type: "file", disabled: this.isDisplayMode, className: this.questionFile.cssClasses.fileInput, id: this.questionFile.inputId, "aria-required": this.questionFile.ariaRequired, "aria-label": this.questionFile.ariaLabel, "aria-invalid": this.questionFile.ariaInvalid, "aria-describedby": this.questionFile.ariaDescribedBy, multiple: false, title: this.questionFile.inputTitle, accept: this.questionFile.acceptedTypes, tabIndex: -1, onChange: (event) => this.questionFile.onFileInputChange(event.nativeEvent) }));
|
|
2772
|
+
}
|
|
2773
|
+
renderButtons() {
|
|
2774
|
+
return (React.createElement("div", { className: this.questionFile.cssClasses.buttonsContainer },
|
|
2775
|
+
this.renderClearButton(),
|
|
2776
|
+
this.renderChooseButton()));
|
|
2777
|
+
}
|
|
2778
|
+
renderClearButton() {
|
|
2779
|
+
return attachKey2click((React.createElement("button", { type: "button", className: this.questionFile.cssClasses.clearButton, disabled: this.questionFile.getIsClearButtonDisabled(), onClick: this.questionFile.doClean },
|
|
2780
|
+
React.createElement(SvgIcon, { iconName: this.questionFile.cssClasses.clearButtonIcon, size: "auto", title: this.questionFile.clearButtonCaption }))));
|
|
2781
|
+
}
|
|
2782
|
+
renderChooseButton() {
|
|
2783
|
+
return (attachKey2click(React.createElement("label", { role: "button", onClick: event => this.questionFile.chooseFiles(event.nativeEvent), className: this.questionFile.getChooseButtonCss(), htmlFor: this.questionFile.inputId, "aria-label": this.questionFile.chooseButtonCaption },
|
|
2784
|
+
React.createElement(SvgIcon, { iconName: this.questionFile.cssClasses.chooseButtonIcon, size: "auto", title: this.questionFile.chooseButtonCaption }))));
|
|
2785
|
+
}
|
|
2786
|
+
renderElement() {
|
|
2787
|
+
return (React.createElement("div", { className: this.questionFile.cssClasses.root, ref: el => this.setContent(el), onDragEnter: this.questionFile.onDragEnter, onDragOver: this.questionFile.onDragOver, onDrop: this.questionFile.onDrop, onDragLeave: this.questionFile.onDragLeave, onKeyDown: event => this.question.onKeyDown(event.nativeEvent) },
|
|
2788
|
+
this.renderInput(),
|
|
2789
|
+
this.renderFileInput(),
|
|
2790
|
+
this.renderButtons()));
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
ReactQuestionFactory.Instance.registerQuestion("fileedit", (props) => {
|
|
2794
|
+
return React.createElement(SurveyQuestionFileEditor, props);
|
|
2795
|
+
});
|
|
2796
|
+
|
|
2797
|
+
class SurveyQuestionTextWithReset extends SurveyQuestionElementBase {
|
|
2798
|
+
get question() {
|
|
2799
|
+
return this.questionBase;
|
|
2800
|
+
}
|
|
2801
|
+
renderElement() {
|
|
2802
|
+
const textElement = this.renderInput();
|
|
2803
|
+
const resetButton = this.renderResetButton();
|
|
2804
|
+
return (React.createElement("div", { className: this.question.getRootClass() },
|
|
2805
|
+
textElement,
|
|
2806
|
+
resetButton));
|
|
2807
|
+
}
|
|
2808
|
+
renderInput() {
|
|
2809
|
+
return ReactQuestionFactory.Instance.createQuestion(this.question.wrappedQuestionTemplate, {
|
|
2810
|
+
question: this.question,
|
|
2811
|
+
isDisplayMode: this.question.isInputReadOnly,
|
|
2812
|
+
creator: this,
|
|
2813
|
+
});
|
|
2814
|
+
}
|
|
2815
|
+
renderResetButton() {
|
|
2816
|
+
return (React.createElement("button", { className: this.question.cssClasses.resetButton, disabled: this.question.resetValueAdorner.isDisabled, title: this.question.resetValueAdorner.caption, onClick: () => this.question.resetValueAdorner.resetValue() },
|
|
2817
|
+
React.createElement(SvgIcon, { iconName: this.question.cssClasses.resetButtonIcon, size: "auto" })));
|
|
2818
|
+
}
|
|
2819
|
+
}
|
|
2820
|
+
ReactQuestionFactory.Instance.registerQuestion("textwithreset", (props) => {
|
|
2821
|
+
return React.createElement(SurveyQuestionTextWithReset, props);
|
|
2822
|
+
});
|
|
2823
|
+
ReactQuestionFactory.Instance.registerQuestion("commentwithreset", (props) => {
|
|
2824
|
+
return React.createElement(SurveyQuestionTextWithReset, props);
|
|
2825
|
+
});
|
|
2826
|
+
|
|
2827
|
+
class SurveyQuestionBooleanSwitch extends SurveyQuestionElementBase {
|
|
2828
|
+
renderElement() {
|
|
2829
|
+
const button = attachKey2click(React.createElement("div", { className: "spg-boolean-switch__button" + (this.questionBase.value ? " spg-boolean-switch__button--checked" : ""), tabIndex: 0, role: "checkbox", "aria-required": this.questionBase.ariaRequired, "aria-label": this.questionBase.ariaLabel, "aria-invalid": this.questionBase.ariaInvalid, "aria-errormessage": this.questionBase.ariaErrormessage },
|
|
2830
|
+
React.createElement("div", { className: "spg-boolean-switch__thumb" },
|
|
2831
|
+
React.createElement("div", { className: "spg-boolean-switch__thumb-circle spg-boolean-switch__thumb--left" })),
|
|
2832
|
+
React.createElement("div", { className: "spg-boolean-switch__thumb" },
|
|
2833
|
+
React.createElement("div", { className: "spg-boolean-switch__thumb-circle spg-boolean-switch__thumb--right" }))), this.questionBase, { processEsc: false });
|
|
2834
|
+
return (React.createElement("div", { className: "spg-boolean-switch", onClick: () => this.questionBase.value = !this.questionBase.value },
|
|
2835
|
+
button,
|
|
2836
|
+
React.createElement("div", { className: "spg-boolean-switch__caption" },
|
|
2837
|
+
React.createElement("div", { className: "spg-boolean-switch__title" }, SurveyElementBase.renderLocString(this.questionBase.locTitle)))));
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
ReactQuestionFactory.Instance.registerQuestion("sv-boolean-switch", (props) => {
|
|
2841
|
+
return React.createElement(SurveyQuestionBooleanSwitch, props);
|
|
2842
|
+
});
|
|
2843
|
+
RendererFactory.Instance.registerRenderer("boolean", "switch", "sv-boolean-switch");
|
|
2844
|
+
|
|
2845
|
+
let Version;
|
|
2846
|
+
Version = `${"2.0.0-rc.10"}`;
|
|
2847
|
+
checkLibraryVersion(`${"2.0.0-rc.10"}`, "survey-creator-react");
|
|
2848
|
+
|
|
2849
|
+
export { ActionButton, AdaptiveToolbox, CellQuestionAdornerComponent, CellQuestionDropdownAdornerComponent, CreatorSurveyPageComponent, ImageItemValueAdornerComponent, ItemValueAdornerComponent, LogoImageComponent, MatrixCellAdornerComponent, PanelAdornerComponent, PropertyGridComponent, PropertyGridPlaceholderComponent, QuestionAdornerComponent, QuestionBanner, QuestionDropdownAdornerComponent, QuestionEditorContentComponent, QuestionErrorComponent, QuestionImageAdornerComponent, QuestionRatingAdornerComponent, QuestionWidgetAdornerComponent, QuestionWrapperFooter, QuestionWrapperHeader, ReactDragEvent, ReactMouseEvent, RowWrapper, SearchComponent, SideBarDefaultHeader, SidebarComponent, SurveyCreator, SurveyCreatorComponent, SurveyCreatorToolboxCategory, SurveyCreatorToolboxItem, SurveyCreatorToolboxItemGroup, SurveyCreatorToolboxTool, SurveyElementEmbeddedSurvey, SurveyLocStringEditor, SurveyLogicOpertor, SurveyNavigation, SurveyQuestionBooleanSwitch, SurveyQuestionColor, SurveyQuestionFileEditor, SurveyQuestionLinkValue, SurveyQuestionSpinEditor, SurveyQuestionTextWithReset, SurveyResults, SurveyResultsByRow, SurveySimulator, SwitcherComponent, TabButtonComponent, TabDesignerComponent, TabJsonEditorAceComponent, TabJsonEditorErrorsComponent, TabJsonEditorTextareaComponent, TabLogicAddButtonComponent, TabLogicComponent, TabPreviewSurveyComponent, TabPreviewTestSurveyAgainComponent, TabThemeSurveyComponent, TabTranslationComponent, TabbedMenuComponent, TabbedMenuItemComponent, ToolboxList, TranslateFromAction, TranslationLineSkeleton, Version };
|
|
2850
|
+
//# sourceMappingURL=survey-creator-react.js.map
|