1
- import { Action , ActionContainer , AdaptiveActionContainer , classesToSelector , ComputedUpdater , DragOrClickHelper , DragTypeOverMeEnum , IAction , IElement , PageModel , property , QuestionRowModel , SurveyElement , settings as SurveySettings } from "survey-core" ;
1
+ import { ActionContainer , classesToSelector , ComputedUpdater , DragOrClickHelper , IAction , PageModel , property , QuestionRowModel , settings as SurveySettings } from "survey-core" ;
2
2
import { SurveyCreatorModel } from "../creator-base" ;
3
3
import { IPortableMouseEvent } from "../utils/events" ;
4
4
import { SurveyElementActionContainer , SurveyElementAdornerBase } from "./action-container-view-model" ;
5
5
import { getLocString } from "../editorLocalization" ;
6
6
import { SurveyHelper } from "../survey-helper" ;
7
7
import { settings } from "../creator-settings" ;
8
- import { DragDropSurveyElements } from "../survey-elements" ;
8
+ import { DragDropSurveyElements , DropTo } from "../dragdrop- survey-elements" ;
9
9
10
10
import "./page.scss" ;
11
11
@@ -16,18 +16,7 @@ export class PageAdorner extends SurveyElementAdornerBase<PageModel> {
16
16
public questionTypeSelectorModel : any ;
17
17
private dragOrClickHelper : DragOrClickHelper ;
18
18
@property ( { defaultValue : "" } ) currentAddQuestionType : string ;
19
- @property ( { defaultValue : null } ) dragTypeOverMe : DragTypeOverMeEnum ;
20
- @property ( { defaultValue : false } ) isDragMe : boolean ;
21
- private updateDragTypeOverMe ( ) {
22
- if ( ! this . isDisposed ) {
23
- this . dragTypeOverMe = this . page ?. dragTypeOverMe ;
24
- }
25
- }
26
- private updateIsDragMe ( ) {
27
- if ( ! this . isDisposed ) {
28
- this . isDragMe = this . page ?. isDragMe ;
29
- }
30
- }
19
+
31
20
private updateShowPlaceholder ( visibleRows ?: Array < QuestionRowModel > ) {
32
21
this . showPlaceholder = ! this . isGhost && ( visibleRows || this . page . visibleRows ) . length === 0 ;
33
22
}
@@ -68,20 +57,6 @@ export class PageAdorner extends SurveyElementAdornerBase<PageModel> {
68
57
if ( this . isGhost ) {
69
58
this . addGhostPageSubsribes ( surveyElement ) ;
70
59
}
71
- surveyElement . registerFunctionOnPropertiesValueChanged (
72
- [ "dragTypeOverMe" ] ,
73
- ( ) => {
74
- this . updateDragTypeOverMe ( ) ;
75
- } ,
76
- "dragOver"
77
- ) ;
78
- surveyElement . registerFunctionOnPropertiesValueChanged (
79
- [ "isDragMe" ] ,
80
- ( ) => {
81
- this . updateIsDragMe ( ) ;
82
- } ,
83
- "dragOver"
84
- ) ;
85
60
surveyElement . registerFunctionOnPropertiesValueChanged ( [ "visibleRows" ] , ( newValue : Array < QuestionRowModel > ) => {
86
61
this . updateShowPlaceholder ( newValue ) ;
87
62
} , "updatePlaceholder" ) ;
@@ -90,9 +65,7 @@ export class PageAdorner extends SurveyElementAdornerBase<PageModel> {
90
65
surveyElement . updateCustomWidgets ( ) ;
91
66
surveyElement . setWasShown ( true ) ;
92
67
this . checkActionProperties ( ) ;
93
- this . dragTypeOverMe = surveyElement . dragTypeOverMe ;
94
- this . isDragMe = surveyElement . isDragMe ;
95
- if ( this . creator . pageEditMode !== "single" ) {
68
+ if ( this . creator . pageEditMode !== "single" ) {
96
69
( < any > surveyElement . locTitle ) . placeholder = ( ) => { return surveyElement . isStartPage ? "pe.startPageTitlePlaceholder" : "pe.pageTitlePlaceholder" ; } ;
97
70
( < any > surveyElement . locDescription ) . placeholder = "pe.pageDescriptionPlaceholder" ;
98
71
}
@@ -104,7 +77,6 @@ export class PageAdorner extends SurveyElementAdornerBase<PageModel> {
104
77
delete ( < any > surveyElement . locTitle ) . placeholder ;
105
78
delete ( < any > surveyElement . locDescription ) . placeholder ;
106
79
surveyElement . unRegisterFunctionOnPropertiesValueChanged ( [ "elements" ] , "updatePlaceholder" ) ;
107
- surveyElement . unRegisterFunctionOnPropertiesValueChanged ( [ "dragTypeOverMe" , "isDragMe" ] , "dragOver" ) ;
108
80
surveyElement . unRegisterFunctionOnPropertiesValueChanged ( [ "title" , "description" ] , "add_ghost" ) ;
109
81
surveyElement . unRegisterFunctionOnPropertiesValueChanged ( [ "visibleRows" ] , "updatePlaceholder" ) ;
110
82
surveyElement [ "surveyChangedCallback" ] = undefined ;
@@ -256,10 +228,10 @@ export class PageAdorner extends SurveyElementAdornerBase<PageModel> {
256
228
get css ( ) : string {
257
229
let result = super . getCss ( ) ;
258
230
if ( this . dragDropHelper . draggedElement && this . dragDropHelper . draggedElement . isPage ) {
259
- if ( this . dragTypeOverMe === DragTypeOverMeEnum . Top ) {
231
+ if ( this . dragTypeOverMe === DropTo . Top ) {
260
232
result += " svc-question__content--drag-over-top" ;
261
233
}
262
- if ( this . dragTypeOverMe === DragTypeOverMeEnum . Bottom ) {
234
+ if ( this . dragTypeOverMe === DropTo . Bottom ) {
263
235
result += " svc-question__content--drag-over-bottom" ;
264
236
}
265
237
} else {
0 commit comments