@@ -20,11 +20,17 @@ public class DfAdditionalDiv : AutoContext<DfAdditionalDiv>
2020 public DfAdditionalDiv ( )
2121 {
2222 ItemKey = "d" + Path . GetRandomFileName ( ) . Replace ( "." , "" ) ;
23- string strFunc = "createElement(\u0022 " + "aside" + "\u0022 , \u0022 " + ItemKey + "\u0022 )" ;
24- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
23+ string strFunc = "mapKeyEl.set('" + ItemKey + "', document.createElement('aside'));" + @"
24+ mapElKey.set(mapKeyEl.get('" + ItemKey + "'), '" + ItemKey + "');" ;
25+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
2526 DeclarativeForms . AddToHashtable ( ItemKey , this ) ;
2627 style = new DfStyle ( ) ;
2728 style . Owner = this ;
29+
30+ offsetTop = ValueFactory . Create ( 0 ) ;
31+ offsetHeight = ValueFactory . Create ( 0 ) ;
32+ offsetLeft = ValueFactory . Create ( 0 ) ;
33+ offsetWidth = ValueFactory . Create ( 0 ) ;
2834 }
2935
3036 public PropertyInfo this [ string p1 ]
@@ -40,9 +46,8 @@ public int ScrollTop
4046 set
4147 {
4248 scrollTop = value ;
43- //setProperty(nameElement, nameProperty, valueProperty)
44- string strFunc = "setProperty(\u0022 " + ItemKey + "\u0022 , \u0022 " + "scrollTop" + "\u0022 , \u0022 " + scrollTop + "\u0022 )" ;
45- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
49+ string strFunc = "mapKeyEl.get('" + ItemKey + "')['scrollTop'] = '" + scrollTop + "';" ;
50+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
4651 }
4752 }
4853
@@ -54,9 +59,8 @@ public int ScrollLeft
5459 set
5560 {
5661 scrollLeft = value ;
57- //setProperty(nameElement, nameProperty, valueProperty)
58- string strFunc = "setProperty(\u0022 " + ItemKey + "\u0022 , \u0022 " + "scrollLeft" + "\u0022 , \u0022 " + scrollLeft + "\u0022 )" ;
59- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
62+ string strFunc = "mapKeyEl.get('" + ItemKey + "')['scrollLeft'] = '" + scrollLeft + "';" ;
63+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
6064 }
6165 }
6266
@@ -68,9 +72,8 @@ public string Id
6872 set
6973 {
7074 id = value ;
71- //setProperty(nameElement, nameProperty, valueProperty)
72- string strFunc = "setProperty(\u0022 " + ItemKey + "\u0022 , \u0022 " + "id" + "\u0022 , \u0022 " + id + "\u0022 )" ;
73- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
75+ string strFunc = "mapKeyEl.get('" + ItemKey + "')['id'] = '" + id + "';" ;
76+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
7477 }
7578 }
7679
@@ -82,9 +85,8 @@ public string Name
8285 set
8386 {
8487 name = value ;
85- //setProperty(nameElement, nameProperty, valueProperty)
86- string strFunc = "setProperty(\u0022 " + ItemKey + "\u0022 , \u0022 " + "name" + "\u0022 , \u0022 " + name + "\u0022 )" ;
87- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
88+ string strFunc = "mapKeyEl.get('" + ItemKey + "')['name'] = '" + name + "';" ;
89+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
8890 }
8991 }
9092
@@ -96,9 +98,8 @@ public string AccessKey
9698 set
9799 {
98100 accessKey = value ;
99- //setProperty(nameElement, nameProperty, valueProperty)
100- string strFunc = "setProperty(\u0022 " + ItemKey + "\u0022 , \u0022 " + "accessKey" + "\u0022 , \u0022 " + accessKey + "\u0022 )" ;
101- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
101+ string strFunc = "mapKeyEl.get('" + ItemKey + "')['accessKey'] = '" + accessKey + "';" ;
102+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
102103 }
103104 }
104105
@@ -110,9 +111,8 @@ public string Class
110111 set
111112 {
112113 _class = value ;
113- //setProperty(nameElement, nameProperty, valueProperty)
114- string strFunc = "setProperty(\u0022 " + ItemKey + "\u0022 , \u0022 " + "className" + "\u0022 , \u0022 " + _class + "\u0022 )" ;
115- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
114+ string strFunc = "mapKeyEl.get('" + ItemKey + "')['className'] = '" + _class + "';" ;
115+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
116116 }
117117 }
118118
@@ -121,7 +121,7 @@ public string Class
121121 public string ItemKey
122122 {
123123 get { return itemKey ; }
124- set { itemKey = value ; }
124+ private set { itemKey = value ; }
125125 }
126126
127127 private string dir ;
@@ -132,9 +132,8 @@ public string Dir
132132 set
133133 {
134134 dir = value ;
135- //setProperty(nameElement, nameProperty, valueProperty)
136- string strFunc = "setProperty(\u0022 " + ItemKey + "\u0022 , \u0022 " + "dir" + "\u0022 , \u0022 " + dir + "\u0022 )" ;
137- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
135+ string strFunc = "mapKeyEl.get('" + ItemKey + "')['dir'] = '" + dir + "';" ;
136+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
138137 }
139138 }
140139
@@ -146,9 +145,8 @@ public int TabIndex
146145 set
147146 {
148147 tabIndex = value ;
149- //setProperty(nameElement, nameProperty, valueProperty)
150- string strFunc = "setProperty(\u0022 " + ItemKey + "\u0022 , \u0022 " + "tabIndex" + "\u0022 , \u0022 " + tabIndex + "\u0022 )" ;
151- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
148+ string strFunc = "mapKeyEl.get('" + ItemKey + "')['tabIndex'] = '" + tabIndex + "';" ;
149+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
152150 }
153151 }
154152
@@ -160,9 +158,8 @@ public bool ContentEditable
160158 set
161159 {
162160 contentEditable = value ;
163- //setProperty(nameElement, nameProperty, valueProperty)
164- string strFunc = "setProperty(\u0022 " + ItemKey + "\u0022 , \u0022 " + "contentEditable" + "\u0022 , \u0022 " + contentEditable . ToString ( ) . ToLower ( ) + "\u0022 )" ;
165- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
161+ string strFunc = "mapKeyEl.get('" + ItemKey + "')['contentEditable'] = " + contentEditable . ToString ( ) . ToLower ( ) + ";" ;
162+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
166163 }
167164 }
168165
@@ -174,15 +171,50 @@ public IValue Parent
174171 set
175172 {
176173 parent = value ;
177- //setParent(nameElement, nameparent)
178- string strFunc = "setParent(\u0022 " + ItemKey + "\u0022 , \u0022 " + parent . AsObject ( ) . GetPropValue ( "ItemKey" ) + "\u0022 )" ;
179- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
174+ string strFunc ;
175+ if ( parent . AsObject ( ) . GetPropValue ( "ItemKey" ) . AsString ( ) == "mainForm" )
176+ {
177+ strFunc = "document.body.appendChild(mapKeyEl.get('" + ItemKey + "'));" ;
178+ }
179+ else
180+ {
181+ strFunc = "mapKeyEl.get('" + parent . AsObject ( ) . GetPropValue ( "ItemKey" ) . AsString ( ) + "').appendChild(mapKeyEl.get('" + ItemKey + "'));" ;
182+ }
183+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
180184 // Родителю добавим потомка.
181185 ArrayImpl ArrayImpl1 = ( ( dynamic ) parent ) . Children ;
182186 ArrayImpl1 . Add ( this ) ;
183187 }
184188 }
185189
190+ public IValue offsetTop { get ; set ; }
191+ [ ContextProperty ( "СмещениеВерх" , "OffsetTop" ) ]
192+ public int OffsetTop
193+ {
194+ get { return Convert . ToInt32 ( offsetTop . AsNumber ( ) ) ; }
195+ }
196+
197+ public IValue offsetHeight { get ; set ; }
198+ [ ContextProperty ( "СмещениеВысота" , "OffsetHeight" ) ]
199+ public int OffsetHeight
200+ {
201+ get { return Convert . ToInt32 ( offsetHeight . AsNumber ( ) ) ; }
202+ }
203+
204+ public IValue offsetLeft { get ; set ; }
205+ [ ContextProperty ( "СмещениеЛево" , "OffsetLeft" ) ]
206+ public int OffsetLeft
207+ {
208+ get { return Convert . ToInt32 ( offsetLeft . AsNumber ( ) ) ; }
209+ }
210+
211+ public IValue offsetWidth { get ; set ; }
212+ [ ContextProperty ( "СмещениеШирина" , "OffsetWidth" ) ]
213+ public int OffsetWidth
214+ {
215+ get { return Convert . ToInt32 ( offsetWidth . AsNumber ( ) ) ; }
216+ }
217+
186218 private DfStyle style ;
187219 [ ContextProperty ( "Стиль" , "Style" ) ]
188220 public DfStyle Style
@@ -199,15 +231,14 @@ public IValue Text
199231 set
200232 {
201233 innerText = value ;
202- //setProperty(nameElement, nameProperty, valueProperty)
203234 string str = value . AsString ( ) ;
204235 str = str . Replace ( "\u005C " , @"\u005C" ) ; // Обратная косая черта
205236 str = str . Replace ( "\u003B " , @"\u003B" ) ; // Точка с запятой.
206237 str = str . Replace ( "\u000A " , @"\u000A" ) ; // Перевод строки
207238 str = str . Replace ( "\u007C " , @"\u007C" ) ; // Знак |
208239 str = str . Replace ( "\u0022 " , @"\u0022" ) ; // Кавычки.
209- string strFunc = "setProperty( \u0022 " + ItemKey + "\u0022 , \u0022 " + " innerText" + " \u0022 , \u0022 " + str + "\u0022 ) " ;
210- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
240+ string strFunc = "mapKeyEl.get(' " + ItemKey + "')[' innerText'] = '" + str + "'; " ;
241+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
211242 }
212243 }
213244
@@ -226,9 +257,8 @@ public DfAction DoubleClick
226257 set
227258 {
228259 dblclick = value ;
229- //mapKeyEl.get(nameElement).addEventListener(nameEvent, doEvent);
230260 string strFunc = "mapKeyEl.get(\u0022 " + ItemKey + "\u0022 ).addEventListener(\u0022 dblclick\u0022 , doEvent);" ;
231- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
261+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
232262 }
233263 }
234264
@@ -240,9 +270,8 @@ public DfAction Click
240270 set
241271 {
242272 click = value ;
243- //mapKeyEl.get(nameElement).addEventListener(nameEvent, doEvent);
244273 string strFunc = "mapKeyEl.get(\u0022 " + ItemKey + "\u0022 ).addEventListener(\u0022 click\u0022 , doEvent);" ;
245- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
274+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
246275 }
247276 }
248277
@@ -254,17 +283,22 @@ public DfAction MouseUp
254283 set
255284 {
256285 mouseup = value ;
257- //mapKeyEl.get(nameElement).addEventListener(nameEvent, doEvent);
258286 string strFunc = "mapKeyEl.get(\u0022 " + ItemKey + "\u0022 ).addEventListener(\u0022 mouseup\u0022 , doEvent);" ;
259- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
287+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
260288 }
261289 }
262290
263- [ ContextMethod ( "ДобавитьДочерний" , "АppendChild" ) ]
264- public IValue АppendChild ( IValue p1 )
291+ [ ContextMethod ( "Анимация" , "Animation" ) ]
292+ public DfAnimation Animation ( DfFrames p1 , DfAnimationOptions p2 )
293+ {
294+ return new DfAnimation ( ItemKey , p1 , p2 ) ;
295+ }
296+
297+ [ ContextMethod ( "ДобавитьДочерний" , "AppendChild" ) ]
298+ public IValue AppendChild ( IValue p1 )
265299 {
266300 string strFunc = "mapKeyEl.get(\u0022 " + ItemKey + "\u0022 ).appendChild(mapKeyEl.get(\u0022 " + ( ( dynamic ) p1 ) . ItemKey + "\u0022 ));" ;
267- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
301+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
268302 ( ( dynamic ) p1 ) . Parent = this ;
269303 return p1 ;
270304 }
@@ -281,38 +315,35 @@ public void ScrollIntoView(bool p1 = true)
281315 {
282316 strFunc = "mapKeyEl.get(\u0022 " + ItemKey + "\u0022 ).scrollIntoView();" ;
283317 }
284- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
318+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
285319 }
286320
287321 [ ContextMethod ( "СнятьФокус" , "Blur" ) ]
288322 public void Blur ( )
289323 {
290- //mapKeyEl.get(nameElement).blur();
291324 string strFunc = "mapKeyEl.get(\u0022 " + ItemKey + "\u0022 ).blur();" ;
292- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
325+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
293326 }
294327
295328 [ ContextMethod ( "Удалить" , "Remove" ) ]
296329 public void Remove ( )
297330 {
298- //mapKeyEl.get(nameElement).remove();
299331 string strFunc = "mapKeyEl.get(\u0022 " + ItemKey + "\u0022 ).remove();" ;
300- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
332+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
301333 }
302334
303335 [ ContextMethod ( "УдалитьДочерний" , "RemoveChild" ) ]
304336 public void RemoveChild ( IValue p1 )
305337 {
306338 string strFunc = "mapKeyEl.get(\u0022 " + ItemKey + "\u0022 ).removeChild(mapKeyEl.get(\u0022 " + ( ( dynamic ) p1 . AsObject ( ) ) . ItemKey + "\u0022 ));" ;
307- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
339+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
308340 }
309341
310342 [ ContextMethod ( "Фокус" , "Focus" ) ]
311343 public void Focus ( )
312344 {
313- //mapKeyEl.get(nameElement).focus();
314345 string strFunc = "mapKeyEl.get(\u0022 " + ItemKey + "\u0022 ).focus();" ;
315- DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + ";" ;
346+ DeclarativeForms . strFunctions = DeclarativeForms . strFunctions + strFunc + DeclarativeForms . funDelimiter ;
316347 }
317348
318349 }
0 commit comments