1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15if (!("finalizeConstruction" in ViewPU.prototype)) { 16 Reflect.set(ViewPU.prototype, "finalizeConstruction", () => { }); 17} 18const LengthMetrics = requireNapi('arkui.node').LengthMetrics; 19 20export var CounterType; 21(function (j21) { 22 j21[j21["LIST"] = 0] = "LIST"; 23 j21[j21["COMPACT"] = 1] = "COMPACT"; 24 j21[j21["INLINE"] = 2] = "INLINE"; 25 j21[j21["INLINE_DATE"] = 3] = "INLINE_DATE"; 26})(CounterType || (CounterType = {})); 27var FocusText; 28(function (i21) { 29 i21[i21["NONE"] = 0] = "NONE"; 30 i21[i21["TEXT1"] = 1] = "TEXT1"; 31 i21[i21["TEXT2"] = 2] = "TEXT2"; 32 i21[i21["TEXT3"] = 3] = "TEXT3"; 33})(FocusText || (FocusText = {})); 34 35export class CommonOptions { 36} 37 38export class InlineStyleOptions extends CommonOptions { 39} 40 41export class NumberStyleOptions extends InlineStyleOptions { 42} 43 44export class DateData { 45 constructor(f21, g21, h21) { 46 this.year = f21; 47 this.month = g21; 48 this.day = h21; 49 } 50 51 toString() { 52 let c21 = this.year.toString() + '-'; 53 let d21 = this.month < 10 ? '0' + this.month.toString() : this.month.toString(); 54 c21 += d21 + '-'; 55 let e21 = this.day < 10 ? '0' + this.day.toString() : this.day.toString(); 56 c21 += e21; 57 return c21; 58 } 59} 60 61export class DateStyleOptions extends CommonOptions { 62} 63 64export class CounterOptions { 65} 66 67class CounterResource { 68} 69 70CounterResource.BUTTON_BACKGROUD_COLOR = { 71 "id": -1, 72 "type": 10001, 73 params: ['sys.color.ohos_id_color_button_normal'], 74 "bundleName": "__harDefaultBundleName__", 75 "moduleName": "__harDefaultModuleName__" 76}; 77CounterResource.BUTTON_ICON_COLOR = { 78 "id": -1, 79 "type": 10001, 80 params: ['sys.color.ohos_id_color_primary'], 81 "bundleName": "__harDefaultBundleName__", 82 "moduleName": "__harDefaultModuleName__" 83}; 84CounterResource.BUTTON_BORDER_FOCUSED_COLOR = { 85 "id": -1, 86 "type": 10001, 87 params: ['sys.color.ohos_id_color_focused_outline'], 88 "bundleName": "__harDefaultBundleName__", 89 "moduleName": "__harDefaultModuleName__" 90}; 91CounterResource.COUNTER_TEXT_COLOR = { 92 "id": -1, 93 "type": 10001, 94 params: ['sys.color.ohos_id_color_text_primary'], 95 "bundleName": "__harDefaultBundleName__", 96 "moduleName": "__harDefaultModuleName__" 97}; 98CounterResource.COUNTER_BORDER_COLOR = { 99 "id": -1, 100 "type": 10001, 101 params: ['sys.color.ohos_id_color_component_normal'], 102 "bundleName": "__harDefaultBundleName__", 103 "moduleName": "__harDefaultModuleName__" 104}; 105CounterResource.BUTTON_ADD_ICON = { 106 "id": -1, 107 "type": 20000, 108 params: ["sys.media.ohos_ic_public_add"], 109 "bundleName": "__harDefaultBundleName__", 110 "moduleName": "__harDefaultModuleName__" 111}; 112CounterResource.BUTTON_SUB_ICON = { 113 "id": -1, 114 "type": 20000, 115 params: ["sys.media.ohos_ic_public_minus"], 116 "bundleName": "__harDefaultBundleName__", 117 "moduleName": "__harDefaultModuleName__" 118}; 119CounterResource.BUTTON_ARROW_UP = { 120 "id": -1, 121 "type": 20000, 122 params: ['sys.media.ohos_ic_public_arrow_up'], 123 "bundleName": "__harDefaultBundleName__", 124 "moduleName": "__harDefaultModuleName__" 125}; 126CounterResource.BUTTON_ARROW_DOWN = { 127 "id": -1, 128 "type": 20000, 129 params: ['sys.media.ohos_ic_public_arrow_down'], 130 "bundleName": "__harDefaultBundleName__", 131 "moduleName": "__harDefaultModuleName__" 132}; 133CounterResource.BUTTON_BORDER_FOCUSED_WIDTH = '2vp'; 134CounterResource.BUTTON_BORDER_BLUR_WIDTH = '0vp'; 135CounterResource.COUNTER_BORDER_WIDTH = '1vp'; 136CounterResource.COUNTER_BORDER_WIDTH_NUMBER = 1; 137CounterResource.COUNTER_LIST_LABEL_SIZE = { 138 "id": -1, 139 "type": 10002, 140 params: ['sys.float.ohos_id_text_size_body1'], 141 "bundleName": "__harDefaultBundleName__", 142 "moduleName": "__harDefaultModuleName__" 143}; 144CounterResource.COUNTER_LIST_NUMBER_SIZE = { 145 "id": -1, 146 "type": 10002, 147 params: ['sys.float.ohos_id_text_size_body1'], 148 "bundleName": "__harDefaultBundleName__", 149 "moduleName": "__harDefaultModuleName__" 150}; 151CounterResource.COUNTER_COMPACT_LABEL_SIZE = { 152 "id": -1, 153 "type": 10002, 154 params: ['sys.float.ohos_id_text_size_body2'], 155 "bundleName": "__harDefaultBundleName__", 156 "moduleName": "__harDefaultModuleName__" 157}; 158CounterResource.COUNTER_NUMBER_SIZE = { 159 "id": -1, 160 "type": 10002, 161 params: ['sys.float.ohos_id_text_size_body1'], 162 "bundleName": "__harDefaultBundleName__", 163 "moduleName": "__harDefaultModuleName__" 164}; 165CounterResource.COUNTER_LIST_LEFT_PADDING = { 166 "id": -1, 167 "type": 10002, 168 params: ['sys.float.ohos_id_default_padding_start'], 169 "bundleName": "__harDefaultBundleName__", 170 "moduleName": "__harDefaultModuleName__" 171}; 172CounterResource.COUNTER_LIST_RIGHT_PADDING = { 173 "id": -1, 174 "type": 10002, 175 params: ['sys.float.ohos_id_default_padding_end'], 176 "bundleName": "__harDefaultBundleName__", 177 "moduleName": "__harDefaultModuleName__" 178}; 179CounterResource.COUNTER_LIST_PADDING = 12; 180CounterResource.COUNTER_LIST_HEIGHT = '48vp'; 181CounterResource.COUNTER_LIST_BUTTON_ICON_SIZE = '20vp'; 182CounterResource.COUNTER_LIST_BUTTON_SIZE = '32vp'; 183CounterResource.COUNTER_LIST_BUTTON_RADIUS = '16vp'; 184CounterResource.COUNTER_LIST_BUTTON_TEXT_DISTANCE = '8vp'; 185CounterResource.COUNTER_LIST_BUTTON_TEXT_MARGIN = 8; 186CounterResource.COUNTER_LIST_FOCUS_BORDER_SIZE = '30vp'; 187CounterResource.COUNTER_LIST_FOCUS_BORDER_RADIUS = '15vp'; 188CounterResource.COUNTER_LIST_BUTTON_HOT_SPOT_X = '-8vp'; 189CounterResource.COUNTER_LIST_BUTTON_HOT_SPOT_Y = '-8vp'; 190CounterResource.COUNTER_COMPACT_BUTTON_ICON_SIZE = '16vp'; 191CounterResource.COUNTER_COMPACT_BUTTON_SIZE = '24vp'; 192CounterResource.COUNTER_COMPACT_BUTTON_RADIUS = '12vp'; 193CounterResource.COUNTER_COMPACT_BUTTON_TEXT_DISTANCE = '10vp'; 194CounterResource.COUNTER_COMPACT_BUTTON_TEXT_MARGIN = 10; 195CounterResource.COUNTER_COMPACT_CONTAINER_HEIGHT = '28vp'; 196CounterResource.COUNTER_COMPACT_CONTAINER_RADIUS = '14vp'; 197CounterResource.COUNTER_COMPACT_CONTAINER_LABEL_DISTANCE = '8vp'; 198CounterResource.COUNTER_COMPACT_FOCUS_BORDER_SIZE = '22vp'; 199CounterResource.COUNTER_COMPACT_FOCUS_BORDER_RADIUS = '11vp'; 200CounterResource.COUNTER_INLINE_BUTTON_ICON_WIDTH = '24vp'; 201CounterResource.COUNTER_INLINE_BUTTON_ICON_HEIGHT = '12vp'; 202CounterResource.COUNTER_INLINE_BUTTON_TEXT_DISTANCE = '12vp'; 203CounterResource.COUNTER_INLINE_CONTAINER_HEIGHT = '32vp'; 204CounterResource.COUNTER_INLINE_BUTTON_WIDTH = '32vp'; 205CounterResource.COUNTER_INLINE_BUTTON_HEIGHT = '16vp'; 206CounterResource.COUNTER_INLINE_RADIUS = '8vp'; 207CounterResource.COUNTER_INLINE_FOCUS_BORDER_WIDTH = '28vp'; 208CounterResource.COUNTER_INLINE_FOCUS_BORDER_HEIGHT = '13.5vp'; 209CounterResource.COUNTER_INLINE_DATE_TEXT_MARGIN = 12; 210CounterResource.COUNTER_INLINE_INPUT_TEXT_MARGIN = 12; 211CounterResource.COUNTER_BUTTON_INITIAL_OPACITY = 1; 212CounterResource.COUNTER_BUTTON_DISABLE_OPACITY = 0.4; 213 214class CounterConstant { 215} 216 217CounterConstant.COUNTER_MAX_YEAR = 5000; 218CounterConstant.COUNTER_MIN_YEAR = 1; 219CounterConstant.COUNTER_INITIAL_MONTH = 1; 220CounterConstant.COUNTER_INITIAL_DAY = 1; 221CounterConstant.COUNTER_INITIAL_STEP = 1; 222CounterConstant.COUNTER_TEN_NUMBER = 10; 223CounterConstant.COUNTER_MIN_MONTH = 1; 224CounterConstant.COUNTER_MAX_MONTH = 12; 225CounterConstant.COUNTER_MIN_DAY = 1; 226CounterConstant.KEYCODE_DPAD_UP = 2012; 227CounterConstant.KEYCODE_DPAD_DOWN = 2013; 228CounterConstant.KEYCODE_DPAD_LEFT = 2014; 229CounterConstant.KEYCODE_DPAD_RIGHT = 2015; 230CounterConstant.KEYCODE_MOVE_HOME = 2081; 231CounterConstant.KEYCODE_MOVE_END = 2082; 232CounterConstant.KEYCODE_TAB = 2049; 233CounterConstant.KEYCODE_ESC = 2070; 234CounterConstant.COUNTER_MIN_VALUE = 0; 235CounterConstant.COUNTER_MAX_VALUE = 999; 236CounterConstant.JANUARY = 1; 237CounterConstant.FEBRUARY = 2; 238CounterConstant.MARCH = 3; 239CounterConstant.APRIL = 4; 240CounterConstant.MAY = 5; 241CounterConstant.JUNE = 6; 242CounterConstant.JULY = 7; 243CounterConstant.AUGUST = 8; 244CounterConstant.SEPTEMBER = 9; 245CounterConstant.OCTOBER = 10; 246CounterConstant.NOVEMBER = 11; 247CounterConstant.DECEMBER = 12; 248CounterConstant.BIG_MONTH_DAYS = 31; 249CounterConstant.SMALL_MONTH_DAYS = 30; 250CounterConstant.FEBRUARY_DAYS = 28; 251CounterConstant.AUSPICIOUS_FEBRUARY_DAYS = 29; 252CounterConstant.AUSPICIOUS_FOUR = 4; 253CounterConstant.AUSPICIOUS_HUNDRED = 100; 254CounterConstant.AUSPICIOUS_FOUR_HUNDRED = 400; 255 256export class CounterComponent extends ViewPU { 257 constructor(w20, x20, y20, z20 = -1, a21 = undefined, b21) { 258 super(w20, y20, z20, b21); 259 if (typeof a21 === "function") { 260 this.paramsGenerator_ = a21; 261 } 262 this.__options = new SynchedPropertyObjectOneWayPU(x20.options, this, "options"); 263 this.__type = new ObservedPropertySimplePU(-1, this, "type"); 264 this.__counterDirection = new ObservedPropertySimplePU(Direction.Auto, this, "counterDirection"); 265 this.__choverEffect = new ObservedPropertySimplePU(HoverEffect.Auto, this, "choverEffect"); 266 this.__focusEnable = new ObservedPropertySimplePU(true, this, "focusEnable"); 267 this.__step = new ObservedPropertySimplePU(CounterConstant.COUNTER_INITIAL_STEP, this, "step"); 268 this.__inputValue = new ObservedPropertySimplePU('0', this, "inputValue"); 269 this.__inputYear = new ObservedPropertySimplePU(CounterConstant.COUNTER_MIN_YEAR, this, "inputYear"); 270 this.__inputMoon = new ObservedPropertySimplePU(0, this, "inputMoon"); 271 this.__inputDay = new ObservedPropertySimplePU(0, this, "inputDay"); 272 this.__inputHour = new ObservedPropertySimplePU(0, this, "inputHour"); 273 this.__inputMinute = new ObservedPropertySimplePU(0, this, "inputMinute"); 274 this.__inputSecond = new ObservedPropertySimplePU(0, this, "inputSecond"); 275 this.__subOpacity = new ObservedPropertySimplePU(CounterResource.COUNTER_BUTTON_INITIAL_OPACITY, this, "subOpacity"); 276 this.__addOpacity = new ObservedPropertySimplePU(CounterResource.COUNTER_BUTTON_INITIAL_OPACITY, this, "addOpacity"); 277 this.__subBtnStateEffect = new ObservedPropertySimplePU(true, this, "subBtnStateEffect"); 278 this.__addBtnStateEffect = new ObservedPropertySimplePU(true, this, "addBtnStateEffect"); 279 this.__focusText = new ObservedPropertySimplePU(FocusText.NONE, this, "focusText"); 280 this.__hasFocusText1 = new ObservedPropertySimplePU(false, this, "hasFocusText1"); 281 this.__hasFocusText2 = new ObservedPropertySimplePU(false, this, "hasFocusText2"); 282 this.__hasFocusText3 = new ObservedPropertySimplePU(false, this, "hasFocusText3"); 283 this.__subBtnFocusWidh = new ObservedPropertySimplePU('0vp', this, "subBtnFocusWidh"); 284 this.__addBtnFocusWidh = new ObservedPropertySimplePU('0vp', this, "addBtnFocusWidh"); 285 this.__value = new ObservedPropertyObjectPU(undefined, this, "value"); 286 this.__year = new ObservedPropertySimplePU(0, this, "year"); 287 this.__month = new ObservedPropertySimplePU(0, this, "month"); 288 this.__day = new ObservedPropertySimplePU(0, this, "day"); 289 this.__hour = new ObservedPropertySimplePU(0, this, "hour"); 290 this.__minute = new ObservedPropertySimplePU(0, this, "minute"); 291 this.__second = new ObservedPropertySimplePU(0, this, "second"); 292 this.__subBtnEnabled = new ObservedPropertySimplePU(true, this, "subBtnEnabled"); 293 this.__addBtnEnabled = new ObservedPropertySimplePU(true, this, "addBtnEnabled"); 294 this.__hasInputText1 = new ObservedPropertySimplePU(false, this, "hasInputText1"); 295 this.__hasInputText2 = new ObservedPropertySimplePU(false, this, "hasInputText2"); 296 this.__hasInputText3 = new ObservedPropertySimplePU(false, this, "hasInputText3"); 297 this.__textWidth = new ObservedPropertySimplePU(0, this, "textWidth"); 298 this.__min = new ObservedPropertySimplePU(CounterConstant.COUNTER_MIN_VALUE, this, "min"); 299 this.__max = new ObservedPropertySimplePU(CounterConstant.COUNTER_MAX_VALUE, this, "max"); 300 this.maxYear = CounterConstant.COUNTER_MAX_YEAR; 301 this.minYear = CounterConstant.COUNTER_MIN_YEAR; 302 this.numberStrList = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09']; 303 this.onHoverIncrease = undefined; 304 this.onHoverDecrease = undefined; 305 this.onFocusIncrease = undefined; 306 this.onFocusDecrease = undefined; 307 this.onBlurIncrease = undefined; 308 this.onBlurDecrease = undefined; 309 this.onChange = undefined; 310 this.onDateChange = undefined; 311 this.timeoutID1 = -1; 312 this.timeoutID2 = -1; 313 this.timeoutID3 = -1; 314 this.numberStyleOptions = undefined; 315 this.dateStyleOptions = undefined; 316 this.inlineStyleOptions = undefined; 317 this.timeStamp = 0; 318 this.hasTextWidth = false; 319 this.controller1 = new TextInputController(); 320 this.controller2 = new TextInputController(); 321 this.controller3 = new TextInputController(); 322 this.setInitiallyProvidedValue(x20); 323 this.declareWatch("options", this.onOptionsChange); 324 this.finalizeConstruction(); 325 } 326 327 setInitiallyProvidedValue(v20) { 328 if (v20.type !== undefined) { 329 this.type = v20.type; 330 } 331 if (v20.counterDirection !== undefined) { 332 this.counterDirection = v20.counterDirection; 333 } 334 if (v20.choverEffect !== undefined) { 335 this.choverEffect = v20.choverEffect; 336 } 337 if (v20.focusEnable !== undefined) { 338 this.focusEnable = v20.focusEnable; 339 } 340 if (v20.step !== undefined) { 341 this.step = v20.step; 342 } 343 if (v20.inputValue !== undefined) { 344 this.inputValue = v20.inputValue; 345 } 346 if (v20.inputYear !== undefined) { 347 this.inputYear = v20.inputYear; 348 } 349 if (v20.inputMoon !== undefined) { 350 this.inputMoon = v20.inputMoon; 351 } 352 if (v20.inputDay !== undefined) { 353 this.inputDay = v20.inputDay; 354 } 355 if (v20.inputHour !== undefined) { 356 this.inputHour = v20.inputHour; 357 } 358 if (v20.inputMinute !== undefined) { 359 this.inputMinute = v20.inputMinute; 360 } 361 if (v20.inputSecond !== undefined) { 362 this.inputSecond = v20.inputSecond; 363 } 364 if (v20.subOpacity !== undefined) { 365 this.subOpacity = v20.subOpacity; 366 } 367 if (v20.addOpacity !== undefined) { 368 this.addOpacity = v20.addOpacity; 369 } 370 if (v20.subBtnStateEffect !== undefined) { 371 this.subBtnStateEffect = v20.subBtnStateEffect; 372 } 373 if (v20.addBtnStateEffect !== undefined) { 374 this.addBtnStateEffect = v20.addBtnStateEffect; 375 } 376 if (v20.focusText !== undefined) { 377 this.focusText = v20.focusText; 378 } 379 if (v20.hasFocusText1 !== undefined) { 380 this.hasFocusText1 = v20.hasFocusText1; 381 } 382 if (v20.hasFocusText2 !== undefined) { 383 this.hasFocusText2 = v20.hasFocusText2; 384 } 385 if (v20.hasFocusText3 !== undefined) { 386 this.hasFocusText3 = v20.hasFocusText3; 387 } 388 if (v20.subBtnFocusWidh !== undefined) { 389 this.subBtnFocusWidh = v20.subBtnFocusWidh; 390 } 391 if (v20.addBtnFocusWidh !== undefined) { 392 this.addBtnFocusWidh = v20.addBtnFocusWidh; 393 } 394 if (v20.value !== undefined) { 395 this.value = v20.value; 396 } 397 if (v20.year !== undefined) { 398 this.year = v20.year; 399 } 400 if (v20.month !== undefined) { 401 this.month = v20.month; 402 } 403 if (v20.day !== undefined) { 404 this.day = v20.day; 405 } 406 if (v20.hour !== undefined) { 407 this.hour = v20.hour; 408 } 409 if (v20.minute !== undefined) { 410 this.minute = v20.minute; 411 } 412 if (v20.second !== undefined) { 413 this.second = v20.second; 414 } 415 if (v20.subBtnEnabled !== undefined) { 416 this.subBtnEnabled = v20.subBtnEnabled; 417 } 418 if (v20.addBtnEnabled !== undefined) { 419 this.addBtnEnabled = v20.addBtnEnabled; 420 } 421 if (v20.hasInputText1 !== undefined) { 422 this.hasInputText1 = v20.hasInputText1; 423 } 424 if (v20.hasInputText2 !== undefined) { 425 this.hasInputText2 = v20.hasInputText2; 426 } 427 if (v20.hasInputText3 !== undefined) { 428 this.hasInputText3 = v20.hasInputText3; 429 } 430 if (v20.textWidth !== undefined) { 431 this.textWidth = v20.textWidth; 432 } 433 if (v20.min !== undefined) { 434 this.min = v20.min; 435 } 436 if (v20.max !== undefined) { 437 this.max = v20.max; 438 } 439 if (v20.maxYear !== undefined) { 440 this.maxYear = v20.maxYear; 441 } 442 if (v20.minYear !== undefined) { 443 this.minYear = v20.minYear; 444 } 445 if (v20.numberStrList !== undefined) { 446 this.numberStrList = v20.numberStrList; 447 } 448 if (v20.onHoverIncrease !== undefined) { 449 this.onHoverIncrease = v20.onHoverIncrease; 450 } 451 if (v20.onHoverDecrease !== undefined) { 452 this.onHoverDecrease = v20.onHoverDecrease; 453 } 454 if (v20.onFocusIncrease !== undefined) { 455 this.onFocusIncrease = v20.onFocusIncrease; 456 } 457 if (v20.onFocusDecrease !== undefined) { 458 this.onFocusDecrease = v20.onFocusDecrease; 459 } 460 if (v20.onBlurIncrease !== undefined) { 461 this.onBlurIncrease = v20.onBlurIncrease; 462 } 463 if (v20.onBlurDecrease !== undefined) { 464 this.onBlurDecrease = v20.onBlurDecrease; 465 } 466 if (v20.onChange !== undefined) { 467 this.onChange = v20.onChange; 468 } 469 if (v20.onDateChange !== undefined) { 470 this.onDateChange = v20.onDateChange; 471 } 472 if (v20.timeoutID1 !== undefined) { 473 this.timeoutID1 = v20.timeoutID1; 474 } 475 if (v20.timeoutID2 !== undefined) { 476 this.timeoutID2 = v20.timeoutID2; 477 } 478 if (v20.timeoutID3 !== undefined) { 479 this.timeoutID3 = v20.timeoutID3; 480 } 481 if (v20.numberStyleOptions !== undefined) { 482 this.numberStyleOptions = v20.numberStyleOptions; 483 } 484 if (v20.dateStyleOptions !== undefined) { 485 this.dateStyleOptions = v20.dateStyleOptions; 486 } 487 if (v20.inlineStyleOptions !== undefined) { 488 this.inlineStyleOptions = v20.inlineStyleOptions; 489 } 490 if (v20.timeStamp !== undefined) { 491 this.timeStamp = v20.timeStamp; 492 } 493 if (v20.hasTextWidth !== undefined) { 494 this.hasTextWidth = v20.hasTextWidth; 495 } 496 if (v20.controller1 !== undefined) { 497 this.controller1 = v20.controller1; 498 } 499 if (v20.controller2 !== undefined) { 500 this.controller2 = v20.controller2; 501 } 502 if (v20.controller3 !== undefined) { 503 this.controller3 = v20.controller3; 504 } 505 } 506 507 updateStateVars(u20) { 508 this.__options.reset(u20.options); 509 } 510 511 purgeVariableDependenciesOnElmtId(t20) { 512 this.__options.purgeDependencyOnElmtId(t20); 513 this.__type.purgeDependencyOnElmtId(t20); 514 this.__counterDirection.purgeDependencyOnElmtId(t20); 515 this.__choverEffect.purgeDependencyOnElmtId(t20); 516 this.__focusEnable.purgeDependencyOnElmtId(t20); 517 this.__step.purgeDependencyOnElmtId(t20); 518 this.__inputValue.purgeDependencyOnElmtId(t20); 519 this.__inputYear.purgeDependencyOnElmtId(t20); 520 this.__inputMoon.purgeDependencyOnElmtId(t20); 521 this.__inputDay.purgeDependencyOnElmtId(t20); 522 this.__inputHour.purgeDependencyOnElmtId(t20); 523 this.__inputMinute.purgeDependencyOnElmtId(t20); 524 this.__inputSecond.purgeDependencyOnElmtId(t20); 525 this.__subOpacity.purgeDependencyOnElmtId(t20); 526 this.__addOpacity.purgeDependencyOnElmtId(t20); 527 this.__subBtnStateEffect.purgeDependencyOnElmtId(t20); 528 this.__addBtnStateEffect.purgeDependencyOnElmtId(t20); 529 this.__focusText.purgeDependencyOnElmtId(t20); 530 this.__hasFocusText1.purgeDependencyOnElmtId(t20); 531 this.__hasFocusText2.purgeDependencyOnElmtId(t20); 532 this.__hasFocusText3.purgeDependencyOnElmtId(t20); 533 this.__subBtnFocusWidh.purgeDependencyOnElmtId(t20); 534 this.__addBtnFocusWidh.purgeDependencyOnElmtId(t20); 535 this.__value.purgeDependencyOnElmtId(t20); 536 this.__year.purgeDependencyOnElmtId(t20); 537 this.__month.purgeDependencyOnElmtId(t20); 538 this.__day.purgeDependencyOnElmtId(t20); 539 this.__hour.purgeDependencyOnElmtId(t20); 540 this.__minute.purgeDependencyOnElmtId(t20); 541 this.__second.purgeDependencyOnElmtId(t20); 542 this.__subBtnEnabled.purgeDependencyOnElmtId(t20); 543 this.__addBtnEnabled.purgeDependencyOnElmtId(t20); 544 this.__hasInputText1.purgeDependencyOnElmtId(t20); 545 this.__hasInputText2.purgeDependencyOnElmtId(t20); 546 this.__hasInputText3.purgeDependencyOnElmtId(t20); 547 this.__textWidth.purgeDependencyOnElmtId(t20); 548 this.__min.purgeDependencyOnElmtId(t20); 549 this.__max.purgeDependencyOnElmtId(t20); 550 } 551 552 aboutToBeDeleted() { 553 this.__options.aboutToBeDeleted(); 554 this.__type.aboutToBeDeleted(); 555 this.__counterDirection.aboutToBeDeleted(); 556 this.__choverEffect.aboutToBeDeleted(); 557 this.__focusEnable.aboutToBeDeleted(); 558 this.__step.aboutToBeDeleted(); 559 this.__inputValue.aboutToBeDeleted(); 560 this.__inputYear.aboutToBeDeleted(); 561 this.__inputMoon.aboutToBeDeleted(); 562 this.__inputDay.aboutToBeDeleted(); 563 this.__inputHour.aboutToBeDeleted(); 564 this.__inputMinute.aboutToBeDeleted(); 565 this.__inputSecond.aboutToBeDeleted(); 566 this.__subOpacity.aboutToBeDeleted(); 567 this.__addOpacity.aboutToBeDeleted(); 568 this.__subBtnStateEffect.aboutToBeDeleted(); 569 this.__addBtnStateEffect.aboutToBeDeleted(); 570 this.__focusText.aboutToBeDeleted(); 571 this.__hasFocusText1.aboutToBeDeleted(); 572 this.__hasFocusText2.aboutToBeDeleted(); 573 this.__hasFocusText3.aboutToBeDeleted(); 574 this.__subBtnFocusWidh.aboutToBeDeleted(); 575 this.__addBtnFocusWidh.aboutToBeDeleted(); 576 this.__value.aboutToBeDeleted(); 577 this.__year.aboutToBeDeleted(); 578 this.__month.aboutToBeDeleted(); 579 this.__day.aboutToBeDeleted(); 580 this.__hour.aboutToBeDeleted(); 581 this.__minute.aboutToBeDeleted(); 582 this.__second.aboutToBeDeleted(); 583 this.__subBtnEnabled.aboutToBeDeleted(); 584 this.__addBtnEnabled.aboutToBeDeleted(); 585 this.__hasInputText1.aboutToBeDeleted(); 586 this.__hasInputText2.aboutToBeDeleted(); 587 this.__hasInputText3.aboutToBeDeleted(); 588 this.__textWidth.aboutToBeDeleted(); 589 this.__min.aboutToBeDeleted(); 590 this.__max.aboutToBeDeleted(); 591 SubscriberManager.Get().delete(this.id__()); 592 this.aboutToBeDeletedInternal(); 593 } 594 595 get options() { 596 return this.__options.get(); 597 } 598 599 set options(s20) { 600 this.__options.set(s20); 601 } 602 603 get type() { 604 return this.__type.get(); 605 } 606 607 set type(r20) { 608 this.__type.set(r20); 609 } 610 611 get counterDirection() { 612 return this.__counterDirection.get(); 613 } 614 615 set counterDirection(q20) { 616 this.__counterDirection.set(q20); 617 } 618 619 get choverEffect() { 620 return this.__choverEffect.get(); 621 } 622 623 set choverEffect(p20) { 624 this.__choverEffect.set(p20); 625 } 626 627 get focusEnable() { 628 return this.__focusEnable.get(); 629 } 630 631 set focusEnable(o20) { 632 this.__focusEnable.set(o20); 633 } 634 635 get step() { 636 return this.__step.get(); 637 } 638 639 set step(n20) { 640 this.__step.set(n20); 641 } 642 643 get inputValue() { 644 return this.__inputValue.get(); 645 } 646 647 set inputValue(m20) { 648 this.__inputValue.set(m20); 649 } 650 651 get inputYear() { 652 return this.__inputYear.get(); 653 } 654 655 set inputYear(l20) { 656 this.__inputYear.set(l20); 657 } 658 659 get inputMoon() { 660 return this.__inputMoon.get(); 661 } 662 663 set inputMoon(k20) { 664 this.__inputMoon.set(k20); 665 } 666 667 get inputDay() { 668 return this.__inputDay.get(); 669 } 670 671 set inputDay(j20) { 672 this.__inputDay.set(j20); 673 } 674 675 get inputHour() { 676 return this.__inputHour.get(); 677 } 678 679 set inputHour(i20) { 680 this.__inputHour.set(i20); 681 } 682 683 get inputMinute() { 684 return this.__inputMinute.get(); 685 } 686 687 set inputMinute(h20) { 688 this.__inputMinute.set(h20); 689 } 690 691 get inputSecond() { 692 return this.__inputSecond.get(); 693 } 694 695 set inputSecond(g20) { 696 this.__inputSecond.set(g20); 697 } 698 699 get subOpacity() { 700 return this.__subOpacity.get(); 701 } 702 703 set subOpacity(f20) { 704 this.__subOpacity.set(f20); 705 } 706 707 get addOpacity() { 708 return this.__addOpacity.get(); 709 } 710 711 set addOpacity(e20) { 712 this.__addOpacity.set(e20); 713 } 714 715 get subBtnStateEffect() { 716 return this.__subBtnStateEffect.get(); 717 } 718 719 set subBtnStateEffect(d20) { 720 this.__subBtnStateEffect.set(d20); 721 } 722 723 get addBtnStateEffect() { 724 return this.__addBtnStateEffect.get(); 725 } 726 727 set addBtnStateEffect(c20) { 728 this.__addBtnStateEffect.set(c20); 729 } 730 731 get focusText() { 732 return this.__focusText.get(); 733 } 734 735 set focusText(b20) { 736 this.__focusText.set(b20); 737 } 738 739 get hasFocusText1() { 740 return this.__hasFocusText1.get(); 741 } 742 743 set hasFocusText1(a20) { 744 this.__hasFocusText1.set(a20); 745 } 746 747 get hasFocusText2() { 748 return this.__hasFocusText2.get(); 749 } 750 751 set hasFocusText2(z19) { 752 this.__hasFocusText2.set(z19); 753 } 754 755 get hasFocusText3() { 756 return this.__hasFocusText3.get(); 757 } 758 759 set hasFocusText3(y19) { 760 this.__hasFocusText3.set(y19); 761 } 762 763 get subBtnFocusWidh() { 764 return this.__subBtnFocusWidh.get(); 765 } 766 767 set subBtnFocusWidh(x19) { 768 this.__subBtnFocusWidh.set(x19); 769 } 770 771 get addBtnFocusWidh() { 772 return this.__addBtnFocusWidh.get(); 773 } 774 775 set addBtnFocusWidh(w19) { 776 this.__addBtnFocusWidh.set(w19); 777 } 778 779 get value() { 780 return this.__value.get(); 781 } 782 783 set value(v19) { 784 this.__value.set(v19); 785 } 786 787 get year() { 788 return this.__year.get(); 789 } 790 791 set year(u19) { 792 this.__year.set(u19); 793 } 794 795 get month() { 796 return this.__month.get(); 797 } 798 799 set month(t19) { 800 this.__month.set(t19); 801 } 802 803 get day() { 804 return this.__day.get(); 805 } 806 807 set day(s19) { 808 this.__day.set(s19); 809 } 810 811 get hour() { 812 return this.__hour.get(); 813 } 814 815 set hour(r19) { 816 this.__hour.set(r19); 817 } 818 819 get minute() { 820 return this.__minute.get(); 821 } 822 823 set minute(q19) { 824 this.__minute.set(q19); 825 } 826 827 get second() { 828 return this.__second.get(); 829 } 830 831 set second(p19) { 832 this.__second.set(p19); 833 } 834 835 get subBtnEnabled() { 836 return this.__subBtnEnabled.get(); 837 } 838 839 set subBtnEnabled(o19) { 840 this.__subBtnEnabled.set(o19); 841 } 842 843 get addBtnEnabled() { 844 return this.__addBtnEnabled.get(); 845 } 846 847 set addBtnEnabled(n19) { 848 this.__addBtnEnabled.set(n19); 849 } 850 851 get hasInputText1() { 852 return this.__hasInputText1.get(); 853 } 854 855 set hasInputText1(m19) { 856 this.__hasInputText1.set(m19); 857 } 858 859 get hasInputText2() { 860 return this.__hasInputText2.get(); 861 } 862 863 set hasInputText2(l19) { 864 this.__hasInputText2.set(l19); 865 } 866 867 get hasInputText3() { 868 return this.__hasInputText3.get(); 869 } 870 871 set hasInputText3(k19) { 872 this.__hasInputText3.set(k19); 873 } 874 875 get textWidth() { 876 return this.__textWidth.get(); 877 } 878 879 set textWidth(j19) { 880 this.__textWidth.set(j19); 881 } 882 883 get min() { 884 return this.__min.get(); 885 } 886 887 set min(i19) { 888 this.__min.set(i19); 889 } 890 891 get max() { 892 return this.__max.get(); 893 } 894 895 set max(h19) { 896 this.__max.set(h19); 897 } 898 899 convertNumberToString(g19) { 900 if (g19 >= 0 && g19 < CounterConstant.COUNTER_TEN_NUMBER) { 901 return this.numberStrList[g19]; 902 } 903 else { 904 return g19.toString(); 905 } 906 } 907 908 aboutToAppear() { 909 let f19 = new Date(); 910 this.timeStamp = f19.getTime(); 911 if (this.options !== undefined && this.options !== null) { 912 this.onOptionsChange(); 913 } 914 } 915 916 updateNumberStyleOptions() { 917 if (this.numberStyleOptions.label === undefined) { 918 this.numberStyleOptions.label = ''; 919 } 920 if (this.value === undefined) { 921 this.value = this.numberStyleOptions.value !== undefined ? this.numberStyleOptions.value : 0; 922 this.onChange?.(this.value); 923 this.inputValue = this.value.toString(); 924 } 925 if (this.numberStyleOptions.min !== undefined) { 926 this.min = this.numberStyleOptions.min; 927 } 928 if (this.numberStyleOptions.max !== undefined) { 929 this.max = this.numberStyleOptions.max; 930 } 931 if (this.min > this.max) { 932 this.min = this.max; 933 } 934 if (this.numberStyleOptions.textWidth !== undefined) { 935 this.textWidth = this.numberStyleOptions.textWidth; 936 if (this.textWidth < 0) { 937 this.textWidth = 0; 938 } 939 this.hasTextWidth = true; 940 } 941 if (this.value <= this.min) { 942 this.value = this.min; 943 this.onChange?.(this.value); 944 this.inputValue = this.value.toString(); 945 } 946 if (this.value >= this.max) { 947 this.value = this.max; 948 this.onChange?.(this.value); 949 this.inputValue = this.value.toString(); 950 } 951 if (this.numberStyleOptions.step !== undefined) { 952 if (this.numberStyleOptions.step < 1) { 953 this.step = 1; 954 } 955 else { 956 this.step = this.numberStyleOptions.step; 957 } 958 } 959 this.updateButtonStatus(); 960 this.updateNumberStyleOptionsEvent(); 961 } 962 963 updateNumberStyleOptionsEvent() { 964 if (this.numberStyleOptions.onHoverIncrease !== undefined) { 965 this.onHoverIncrease = this.numberStyleOptions.onHoverIncrease; 966 } 967 if (this.numberStyleOptions.onHoverDecrease !== undefined) { 968 this.onHoverDecrease = this.numberStyleOptions.onHoverDecrease; 969 } 970 if (this.numberStyleOptions.onFocusIncrease !== undefined) { 971 this.onFocusIncrease = this.numberStyleOptions.onFocusIncrease; 972 } 973 if (this.numberStyleOptions.onFocusDecrease !== undefined) { 974 this.onFocusDecrease = this.numberStyleOptions.onFocusDecrease; 975 } 976 if (this.numberStyleOptions.onBlurIncrease !== undefined) { 977 this.onBlurIncrease = this.numberStyleOptions.onBlurIncrease; 978 } 979 if (this.numberStyleOptions.onBlurDecrease !== undefined) { 980 this.onBlurDecrease = this.numberStyleOptions.onBlurDecrease; 981 } 982 if (this.numberStyleOptions.onChange !== undefined) { 983 this.onChange = this.numberStyleOptions.onChange; 984 } 985 if (this.numberStyleOptions.focusable !== undefined) { 986 this.focusEnable = this.numberStyleOptions.focusable; 987 } 988 } 989 990 updateInlineStyleOptions() { 991 if (this.value === undefined) { 992 this.value = this.inlineStyleOptions.value !== undefined ? this.inlineStyleOptions.value : 0; 993 this.onChange?.(this.value); 994 this.inputValue = this.value.toString(); 995 } 996 if (this.inlineStyleOptions.min !== undefined) { 997 this.min = this.inlineStyleOptions.min; 998 } 999 if (this.inlineStyleOptions.max !== undefined) { 1000 this.max = this.inlineStyleOptions.max; 1001 } 1002 if (this.min > this.max) { 1003 this.min = this.max; 1004 } 1005 if (this.inlineStyleOptions.textWidth !== undefined) { 1006 this.textWidth = this.inlineStyleOptions.textWidth; 1007 if (this.textWidth < 0) { 1008 this.textWidth = 0; 1009 } 1010 this.hasTextWidth = true; 1011 } 1012 if (this.value <= this.min) { 1013 this.value = this.min; 1014 this.onChange?.(this.value); 1015 this.inputValue = this.value.toString(); 1016 } 1017 if (this.value >= this.max) { 1018 this.value = this.max; 1019 this.onChange?.(this.value); 1020 this.inputValue = this.value.toString(); 1021 } 1022 if (this.inlineStyleOptions.step !== undefined) { 1023 if (this.inlineStyleOptions.step < 1) { 1024 this.step = 1; 1025 } 1026 else { 1027 this.step = this.inlineStyleOptions.step; 1028 } 1029 } 1030 this.updateButtonStatus(); 1031 this.updateInlineStyleOptionsEvent(); 1032 } 1033 1034 updateInlineStyleOptionsEvent() { 1035 if (this.inlineStyleOptions.onHoverIncrease !== undefined) { 1036 this.onHoverIncrease = this.inlineStyleOptions.onHoverIncrease; 1037 } 1038 if (this.inlineStyleOptions.onHoverDecrease !== undefined) { 1039 this.onHoverDecrease = this.inlineStyleOptions.onHoverDecrease; 1040 } 1041 if (this.inlineStyleOptions.onChange !== undefined) { 1042 this.onChange = this.inlineStyleOptions.onChange; 1043 } 1044 if (this.inlineStyleOptions.focusable !== undefined) { 1045 this.focusEnable = this.inlineStyleOptions.focusable; 1046 } 1047 } 1048 1049 updateDateStyleOptions() { 1050 if (this.dateStyleOptions.step !== undefined) { 1051 if (this.dateStyleOptions.step < 1) { 1052 this.step = 1; 1053 } 1054 else { 1055 this.step = this.dateStyleOptions.step; 1056 } 1057 } 1058 if (this.dateStyleOptions.onHoverIncrease !== undefined) { 1059 this.onHoverIncrease = this.dateStyleOptions.onHoverIncrease; 1060 } 1061 if (this.dateStyleOptions.onHoverDecrease !== undefined) { 1062 this.onHoverDecrease = this.dateStyleOptions.onHoverDecrease; 1063 } 1064 if (this.dateStyleOptions.year !== undefined && 1065 this.dateStyleOptions.year >= this.minYear && 1066 this.dateStyleOptions.year <= this.maxYear) { 1067 if (this.year === 0) { 1068 this.year = this.dateStyleOptions.year; 1069 } 1070 } 1071 else { 1072 this.year = CounterConstant.COUNTER_MIN_YEAR; 1073 } 1074 if (this.dateStyleOptions.month !== undefined && 1075 this.dateStyleOptions.month <= CounterConstant.COUNTER_MAX_MONTH && 1076 this.dateStyleOptions.month >= CounterConstant.COUNTER_MIN_MONTH) { 1077 if (this.month === 0) { 1078 this.month = this.dateStyleOptions.month; 1079 } 1080 } 1081 else { 1082 this.month = CounterConstant.COUNTER_INITIAL_MONTH; 1083 } 1084 if (this.dateStyleOptions.day !== undefined && 1085 this.dateStyleOptions.day <= this.getDayNumber() && 1086 this.dateStyleOptions.day >= CounterConstant.COUNTER_MIN_DAY) { 1087 if (this.day === 0) { 1088 this.day = this.dateStyleOptions.day; 1089 } 1090 } 1091 else { 1092 this.day = CounterConstant.COUNTER_INITIAL_DAY; 1093 } 1094 if (this.dateStyleOptions.onDateChange !== undefined) { 1095 this.onDateChange = this.dateStyleOptions.onDateChange; 1096 } 1097 if (this.dateStyleOptions.focusable !== undefined) { 1098 this.focusEnable = this.dateStyleOptions.focusable; 1099 } 1100 this.updateDay(); 1101 } 1102 1103 onOptionsChange() { 1104 this.type = this.options.type; 1105 if (this.options.direction) { 1106 this.counterDirection = this.options.direction; 1107 } 1108 else { 1109 this.counterDirection = Direction.Auto; 1110 } 1111 if (this.type === CounterType.LIST || 1112 this.type === CounterType.COMPACT) { 1113 this.numberStyleOptions = this.options.numberOptions; 1114 this.updateNumberStyleOptions(); 1115 } 1116 else if (this.type === CounterType.INLINE) { 1117 this.inlineStyleOptions = this.options.inlineOptions; 1118 this.updateInlineStyleOptions(); 1119 } 1120 else if (this.type === CounterType.INLINE_DATE) { 1121 let y18 = this.options.dateOptions; 1122 y18.year = y18.year ? y18.year : CounterConstant.COUNTER_MIN_YEAR; 1123 y18.month = y18.month ? y18.month : CounterConstant.COUNTER_MIN_MONTH; 1124 y18.day = y18.day ? y18.day : CounterConstant.COUNTER_MIN_DAY; 1125 this.dateStyleOptions = y18; 1126 this.updateDateStyleOptions(); 1127 } 1128 else { 1129 } 1130 } 1131 1132 subValue() { 1133 if (this.subBtnStateEffect) { 1134 this.value -= this.step; 1135 } 1136 if (!this.addBtnStateEffect) { 1137 this.addBtnStateEffect = true; 1138 this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1139 this.addBtnEnabled = true; 1140 } 1141 if (this.value <= this.min) { 1142 this.value = this.min; 1143 this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1144 this.subBtnStateEffect = false; 1145 this.subBtnEnabled = false; 1146 } 1147 else { 1148 if (this.subOpacity === CounterResource.COUNTER_BUTTON_DISABLE_OPACITY) { 1149 this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1150 } 1151 if (!this.subBtnStateEffect) { 1152 this.subBtnStateEffect = true; 1153 } 1154 if (!this.subBtnEnabled) { 1155 this.subBtnEnabled = true; 1156 } 1157 } 1158 this.focusText1(); 1159 } 1160 1161 focusText1() { 1162 if (this.type === CounterType.INLINE) { 1163 if (this.focusText === FocusText.NONE) { 1164 this.focusText = FocusText.TEXT1; 1165 this.hasFocusText1 = true; 1166 this.focusWithTarget('InlineTextInput' + this.timeStamp.toString()); 1167 } 1168 } 1169 } 1170 1171 addValue() { 1172 if (this.addBtnStateEffect) { 1173 this.value += this.step; 1174 } 1175 if (!this.subBtnStateEffect) { 1176 this.subBtnStateEffect = true; 1177 this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1178 this.subBtnEnabled = true; 1179 } 1180 if (this.value >= this.max) { 1181 this.value = this.max; 1182 this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1183 this.addBtnStateEffect = false; 1184 this.addBtnEnabled = false; 1185 } 1186 else { 1187 if (this.addOpacity === CounterResource.COUNTER_BUTTON_DISABLE_OPACITY) { 1188 this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1189 } 1190 if (!this.addBtnStateEffect) { 1191 this.addBtnStateEffect = true; 1192 } 1193 if (!this.addBtnEnabled) { 1194 this.addBtnEnabled = true; 1195 } 1196 } 1197 this.focusText1(); 1198 } 1199 1200 getDayNumber() { 1201 switch (this.month) { 1202 case CounterConstant.JANUARY: 1203 case CounterConstant.MARCH: 1204 case CounterConstant.MAY: 1205 case CounterConstant.JULY: 1206 case CounterConstant.AUGUST: 1207 case CounterConstant.OCTOBER: 1208 case CounterConstant.DECEMBER: 1209 return CounterConstant.BIG_MONTH_DAYS; 1210 break; 1211 case CounterConstant.APRIL: 1212 case CounterConstant.JUNE: 1213 case CounterConstant.SEPTEMBER: 1214 case CounterConstant.NOVEMBER: 1215 return CounterConstant.SMALL_MONTH_DAYS; 1216 break; 1217 case CounterConstant.FEBRUARY: 1218 if ((this.year % CounterConstant.AUSPICIOUS_FOUR === 0 && 1219 this.year % CounterConstant.AUSPICIOUS_HUNDRED !== 0) || 1220 this.year % CounterConstant.AUSPICIOUS_FOUR_HUNDRED === 0) { 1221 return CounterConstant.AUSPICIOUS_FEBRUARY_DAYS; 1222 } 1223 else { 1224 return CounterConstant.FEBRUARY_DAYS; 1225 } 1226 break; 1227 default: 1228 break; 1229 } 1230 } 1231 1232 subDate() { 1233 if (this.focusText === FocusText.TEXT1) { 1234 if (this.subBtnStateEffect) { 1235 this.inputYear = this.year; 1236 this.year -= this.step; 1237 if (!this.hasFocusText1) { 1238 this.hasFocusText1 = true; 1239 } 1240 } 1241 if (!this.addBtnStateEffect) { 1242 this.addBtnStateEffect = true; 1243 this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1244 this.addBtnEnabled = true; 1245 } 1246 if (this.year <= this.minYear) { 1247 this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1248 this.subBtnStateEffect = false; 1249 this.subBtnEnabled = false; 1250 } 1251 else { 1252 if (this.subOpacity === CounterResource.COUNTER_BUTTON_DISABLE_OPACITY) { 1253 this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1254 } 1255 if (!this.subBtnStateEffect) { 1256 this.subBtnStateEffect = true; 1257 } 1258 if (!this.subBtnEnabled) { 1259 this.subBtnEnabled = true; 1260 } 1261 } 1262 } 1263 else if (this.focusText === FocusText.TEXT2) { 1264 this.month -= this.step % CounterConstant.COUNTER_MAX_MONTH; 1265 if (this.month < CounterConstant.COUNTER_MIN_MONTH) { 1266 this.month += CounterConstant.COUNTER_MAX_MONTH; 1267 } 1268 if (!this.hasFocusText2) { 1269 this.hasFocusText2 = true; 1270 } 1271 } 1272 else if (this.focusText === FocusText.TEXT3) { 1273 this.day -= this.step % this.getDayNumber(); 1274 if (this.day < CounterConstant.COUNTER_MIN_DAY) { 1275 this.day += this.getDayNumber(); 1276 } 1277 if (!this.hasFocusText3) { 1278 this.hasFocusText3 = true; 1279 } 1280 } 1281 else { 1282 this.focusDayWitdhSub(); 1283 } 1284 } 1285 1286 focusDayWitdhSub() { 1287 this.focusText = FocusText.TEXT3; 1288 this.hasFocusText3 = true; 1289 this.day -= this.step % this.getDayNumber(); 1290 if (this.day < CounterConstant.COUNTER_MIN_DAY) { 1291 this.day += this.getDayNumber(); 1292 } 1293 this.focusWithTarget('DateTextInput3' + this.timeStamp.toString()); 1294 } 1295 1296 addDate() { 1297 if (this.focusText === FocusText.TEXT1) { 1298 if (this.addBtnStateEffect) { 1299 this.inputYear = this.year; 1300 this.year += this.step; 1301 if (!this.hasFocusText1) { 1302 this.hasFocusText1 = true; 1303 } 1304 } 1305 if (!this.subBtnStateEffect) { 1306 this.subBtnStateEffect = true; 1307 this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1308 this.subBtnEnabled = true; 1309 } 1310 if (this.year >= this.maxYear) { 1311 this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1312 this.addBtnStateEffect = false; 1313 this.addBtnEnabled = false; 1314 } 1315 else { 1316 if (this.addOpacity === CounterResource.COUNTER_BUTTON_DISABLE_OPACITY) { 1317 this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1318 } 1319 if (!this.addBtnStateEffect) { 1320 this.addBtnStateEffect = true; 1321 } 1322 if (!this.addBtnEnabled) { 1323 this.addBtnEnabled = true; 1324 } 1325 } 1326 } 1327 else if (this.focusText === FocusText.TEXT2) { 1328 this.month += this.step % CounterConstant.COUNTER_MAX_MONTH; 1329 if (this.month > CounterConstant.COUNTER_MAX_MONTH) { 1330 this.month -= CounterConstant.COUNTER_MAX_MONTH; 1331 } 1332 if (!this.hasFocusText2) { 1333 this.hasFocusText2 = true; 1334 } 1335 } 1336 else if (this.focusText === FocusText.TEXT3) { 1337 this.day += this.step % this.getDayNumber(); 1338 if (this.day > this.getDayNumber()) { 1339 this.day -= this.getDayNumber(); 1340 } 1341 if (!this.hasFocusText3) { 1342 this.hasFocusText3 = true; 1343 } 1344 } 1345 else { 1346 this.focusDayWithAdd(); 1347 } 1348 } 1349 1350 focusDayWithAdd() { 1351 this.focusText = FocusText.TEXT3; 1352 this.hasFocusText3 = true; 1353 this.day += this.step % this.getDayNumber(); 1354 if (this.day > this.getDayNumber()) { 1355 this.day -= this.getDayNumber(); 1356 } 1357 this.focusWithTarget('DateTextInput3' + this.timeStamp.toString()); 1358 } 1359 1360 updateInlineEnableSate() { 1361 if (this.value >= this.max) { 1362 this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1363 this.addBtnStateEffect = false; 1364 this.addBtnEnabled = false; 1365 } 1366 else { 1367 this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1368 this.addBtnStateEffect = true; 1369 this.addBtnEnabled = true; 1370 } 1371 if (this.value <= this.min) { 1372 this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1373 this.subBtnStateEffect = false; 1374 this.subBtnEnabled = false; 1375 } 1376 else { 1377 this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1378 this.subBtnStateEffect = true; 1379 this.subBtnEnabled = true; 1380 } 1381 } 1382 1383 updateDateEnableSate() { 1384 if (this.year === this.maxYear && this.focusText === FocusText.TEXT1) { 1385 this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1386 this.addBtnStateEffect = false; 1387 this.addBtnEnabled = false; 1388 } 1389 else { 1390 if (this.addOpacity === CounterResource.COUNTER_BUTTON_DISABLE_OPACITY) { 1391 this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1392 } 1393 if (!this.addBtnStateEffect) { 1394 this.addBtnStateEffect = true; 1395 } 1396 if (!this.addBtnEnabled) { 1397 this.addBtnEnabled = true; 1398 } 1399 } 1400 if (this.year === this.minYear && this.focusText === FocusText.TEXT1) { 1401 this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1402 this.subBtnStateEffect = false; 1403 this.subBtnEnabled = false; 1404 } 1405 else { 1406 if (this.subOpacity === CounterResource.COUNTER_BUTTON_DISABLE_OPACITY) { 1407 this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1408 } 1409 if (!this.subBtnStateEffect) { 1410 this.subBtnStateEffect = true; 1411 } 1412 if (!this.subBtnEnabled) { 1413 this.subBtnEnabled = true; 1414 } 1415 } 1416 } 1417 1418 updateDay() { 1419 if (this.day > this.getDayNumber()) { 1420 this.day = this.getDayNumber(); 1421 } 1422 } 1423 1424 resetFocusText() { 1425 this.focusText = FocusText.NONE; 1426 this.hasFocusText1 = false; 1427 this.hasFocusText2 = false; 1428 this.hasFocusText3 = false; 1429 } 1430 1431 resetFocusButton() { 1432 if (this.addBtnFocusWidh === CounterResource.BUTTON_BORDER_FOCUSED_WIDTH) { 1433 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 1434 this.onBlurIncrease && this.onBlurIncrease(); 1435 } 1436 if (this.subBtnFocusWidh === CounterResource.BUTTON_BORDER_FOCUSED_WIDTH) { 1437 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 1438 this.onBlurDecrease && this.onBlurDecrease(); 1439 } 1440 } 1441 1442 homeFocusText() { 1443 this.focusWithTarget('DateTextInput1' + this.timeStamp.toString()); 1444 } 1445 1446 endFocusText() { 1447 this.focusWithTarget('DateTextInput3' + this.timeStamp.toString()); 1448 } 1449 1450 homeFirstValue() { 1451 this.value = this.min; 1452 if (!this.addBtnStateEffect) { 1453 this.addBtnStateEffect = true; 1454 this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1455 this.addBtnEnabled = true; 1456 } 1457 } 1458 1459 endLastValue() { 1460 this.value = this.max; 1461 if (!this.subBtnStateEffect) { 1462 this.subBtnStateEffect = true; 1463 this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1464 this.subBtnEnabled = true; 1465 } 1466 } 1467 1468 updateButtonStatus() { 1469 if (this.value <= this.min) { 1470 if (!this.addBtnStateEffect && this.max != this.min) { 1471 this.addBtnStateEffect = true; 1472 this.addOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1473 this.addBtnEnabled = true; 1474 } 1475 this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1476 this.subBtnStateEffect = false; 1477 this.subBtnEnabled = false; 1478 } 1479 if (this.value >= this.max) { 1480 if (!this.subBtnStateEffect && this.max != this.min) { 1481 this.subBtnStateEffect = true; 1482 this.subOpacity = CounterResource.COUNTER_BUTTON_INITIAL_OPACITY; 1483 this.subBtnEnabled = true; 1484 } 1485 this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1486 this.addBtnStateEffect = false; 1487 this.addBtnEnabled = false; 1488 } 1489 } 1490 1491 getValue() { 1492 if (this.inputValue == undefined) { 1493 this.inputValue = ''; 1494 } 1495 return this.hasInputText1 ? this.inputValue : this.value.toString(); 1496 } 1497 1498 getValueLength() { 1499 return this.getValue().length > 0 ? this.getValue().length : 1; 1500 } 1501 1502 getYear() { 1503 let x18 = this.year.toString(); 1504 if (x18.length === 1) { 1505 x18 = '000' + x18; 1506 } 1507 else if (x18.length === 2) { 1508 x18 = '00' + x18; 1509 } 1510 else if (x18.length === 3) { 1511 x18 = '0' + x18; 1512 } 1513 else { 1514 x18 = x18; 1515 } 1516 return x18; 1517 } 1518 1519 focusWithTarget(u18) { 1520 setTimeout(() => { 1521 var w18 = focusControl.requestFocus(u18); 1522 if (w18) { 1523 console.log('Request success'); 1524 } 1525 else { 1526 console.log('Request failed'); 1527 } 1528 }); 1529 } 1530 1531 focusCurrentText(t18) { 1532 if (t18 === FocusText.TEXT1) { 1533 if (this.focusText === FocusText.NONE) { 1534 this.focusText = FocusText.TEXT1; 1535 } 1536 if (!this.hasFocusText1) { 1537 this.hasFocusText1 = true; 1538 } 1539 } 1540 else if (t18 === FocusText.TEXT2) { 1541 if (this.focusText === FocusText.NONE) { 1542 this.focusText = FocusText.TEXT2; 1543 } 1544 if (!this.hasFocusText2) { 1545 this.hasFocusText2 = true; 1546 } 1547 } 1548 else if (t18 === FocusText.TEXT3) { 1549 if (this.focusText === FocusText.NONE) { 1550 this.focusText = FocusText.TEXT3; 1551 } 1552 if (!this.hasFocusText3) { 1553 this.hasFocusText3 = true; 1554 } 1555 } 1556 else { 1557 } 1558 } 1559 1560 getMaxLength() { 1561 if (this.max.toString().length > this.min.toString().length) { 1562 return this.max.toString().length + 1; 1563 } 1564 else { 1565 return this.min.toString().length + 1; 1566 } 1567 } 1568 1569 resourceToVp(r18) { 1570 try { 1571 if (r18.id !== -1) { 1572 return px2vp(getContext(this).resourceManager.getNumber(r18.id)); 1573 } 1574 else { 1575 return px2vp(getContext(this) 1576 .resourceManager 1577 .getNumberByName((r18.params[0]).split('.')[2])); 1578 } 1579 } 1580 catch (s18) { 1581 return CounterResource.COUNTER_LIST_PADDING; 1582 } 1583 } 1584 1585 initialRender() { 1586 this.observeComponentCreation2((g6, h6) => { 1587 If.create(); 1588 if (this.type === CounterType.LIST) { 1589 this.ifElseBranchUpdateFunction(0, () => { 1590 this.observeComponentCreation2((p18, q18) => { 1591 RelativeContainer.create(); 1592 RelativeContainer.direction(this.counterDirection); 1593 RelativeContainer.width('100%'); 1594 RelativeContainer.height(CounterResource.COUNTER_LIST_HEIGHT); 1595 }, RelativeContainer); 1596 this.observeComponentCreation2((n18, o18) => { 1597 Text.create(this.numberStyleOptions.label); 1598 Text.direction(this.counterDirection); 1599 Text.fontSize(CounterResource.COUNTER_LIST_LABEL_SIZE); 1600 Text.fontColor(CounterResource.COUNTER_TEXT_COLOR); 1601 Text.margin({ 1602 start: LengthMetrics.vp(this.resourceToVp(CounterResource.COUNTER_LIST_LEFT_PADDING)) 1603 }); 1604 Text.alignRules({ 1605 center: { anchor: '__container__', align: VerticalAlign.Center }, 1606 start: { anchor: '__container__', align: HorizontalAlign.Start }, 1607 end: { anchor: 'Row1', align: HorizontalAlign.Start } 1608 }); 1609 Text.id('Text'); 1610 }, Text); 1611 Text.pop(); 1612 this.observeComponentCreation2((l18, m18) => { 1613 Row.create(); 1614 Row.direction(this.counterDirection); 1615 Row.height(CounterResource.COUNTER_LIST_BUTTON_SIZE); 1616 Row.margin({ 1617 end: LengthMetrics.vp(this.resourceToVp(CounterResource.COUNTER_LIST_RIGHT_PADDING)) 1618 }); 1619 Row.alignRules({ 1620 center: { anchor: '__container__', align: VerticalAlign.Center }, 1621 end: { anchor: '__container__', align: HorizontalAlign.End } 1622 }); 1623 Row.tabIndex(0); 1624 Row.id('Row1'); 1625 }, Row); 1626 this.observeComponentCreation2((j18, k18) => { 1627 Stack.create(); 1628 Stack.direction(this.counterDirection); 1629 Stack.width(CounterResource.COUNTER_LIST_BUTTON_SIZE); 1630 Stack.height(CounterResource.COUNTER_LIST_BUTTON_SIZE); 1631 Stack.borderRadius(CounterResource.COUNTER_LIST_BUTTON_RADIUS); 1632 Stack.borderWidth(this.subBtnFocusWidh); 1633 Stack.borderColor(CounterResource.BUTTON_BORDER_FOCUSED_COLOR); 1634 Stack.clip(true); 1635 }, Stack); 1636 this.observeComponentCreation2((h18, i18) => { 1637 Image.create(CounterResource.BUTTON_SUB_ICON); 1638 Image.direction(this.counterDirection); 1639 Image.width(CounterResource.COUNTER_LIST_BUTTON_ICON_SIZE); 1640 Image.height(CounterResource.COUNTER_LIST_BUTTON_ICON_SIZE); 1641 Image.fillColor(CounterResource.BUTTON_ICON_COLOR); 1642 Image.opacity(this.subOpacity); 1643 }, Image); 1644 this.observeComponentCreation2((v17, w17) => { 1645 Button.createWithLabel({ type: ButtonType.Circle, stateEffect: this.subBtnStateEffect }); 1646 Button.direction(this.counterDirection); 1647 Button.width(CounterResource.COUNTER_LIST_BUTTON_SIZE); 1648 Button.height(CounterResource.COUNTER_LIST_BUTTON_SIZE); 1649 Button.responseRegion({ 1650 x: CounterResource.COUNTER_LIST_BUTTON_HOT_SPOT_X, 1651 y: CounterResource.COUNTER_LIST_BUTTON_HOT_SPOT_Y, 1652 width: '150%', 1653 height: '150%' 1654 }); 1655 Button.groupDefaultFocus(true); 1656 Button.backgroundColor(CounterResource.BUTTON_BACKGROUD_COLOR); 1657 Button.opacity(this.subOpacity); 1658 Button.enabled(this.subBtnEnabled); 1659 Button.key('ListSubButton' + this.timeStamp.toString()); 1660 Button.onKeyEvent((g18) => { 1661 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH; 1662 if (g18.keyCode === CounterConstant.KEYCODE_ESC) { 1663 this.resetFocusButton(); 1664 g18.stopPropagation(); 1665 } 1666 if (g18.type === KeyType.Down && 1667 g18.keyCode === CounterConstant.KEYCODE_MOVE_HOME) { 1668 g18.stopPropagation(); 1669 this.homeFirstValue(); 1670 this.focusWithTarget('ListAddButton' + this.timeStamp.toString()); 1671 } 1672 if (g18.type === KeyType.Down && 1673 g18.keyCode === CounterConstant.KEYCODE_MOVE_END) { 1674 g18.stopPropagation(); 1675 if (this.addBtnStateEffect) { 1676 this.addBtnStateEffect = false; 1677 this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1678 this.addBtnEnabled = false; 1679 } 1680 this.endLastValue(); 1681 this.focusWithTarget('ListAddButton' + this.timeStamp.toString()); 1682 } 1683 }); 1684 Button.onClick((f18) => { 1685 this.subValue(); 1686 this.onChange?.(ObservedObject.GetRawObject(this.value)); 1687 if (f18.source === SourceType.Mouse || 1688 f18.source === SourceType.TouchScreen) { 1689 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 1690 } 1691 }); 1692 Gesture.create(GesturePriority.Low); 1693 LongPressGesture.create({ repeat: true }); 1694 LongPressGesture.onAction((e18) => { 1695 if (e18.repeat) { 1696 this.subValue(); 1697 this.onChange?.(ObservedObject.GetRawObject(this.value)); 1698 } 1699 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 1700 }); 1701 LongPressGesture.pop(); 1702 Gesture.pop(); 1703 Button.hoverEffect(this.choverEffect); 1704 Button.onHover((d18) => { 1705 this.onHoverDecrease && this.onHoverDecrease(d18); 1706 }); 1707 Button.focusable(this.focusEnable); 1708 Button.onFocus(() => { 1709 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH; 1710 this.onFocusDecrease && this.onFocusDecrease(); 1711 this.updateButtonStatus(); 1712 }); 1713 Button.onBlur(() => { 1714 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 1715 this.onBlurDecrease && this.onBlurDecrease(); 1716 }); 1717 }, Button); 1718 Button.pop(); 1719 Stack.pop(); 1720 this.observeComponentCreation2((l17, m17) => { 1721 If.create(); 1722 if (this.hasTextWidth) { 1723 this.ifElseBranchUpdateFunction(0, () => { 1724 this.observeComponentCreation2((t17, u17) => { 1725 Text.create(this.value.toString()); 1726 Text.direction(this.counterDirection); 1727 Text.width(this.textWidth.toString()); 1728 Text.textAlign(TextAlign.Center); 1729 Text.fontSize(CounterResource.COUNTER_LIST_NUMBER_SIZE); 1730 Text.fontColor(CounterResource.COUNTER_TEXT_COLOR); 1731 Text.margin({ 1732 start: LengthMetrics.vp(CounterResource.COUNTER_LIST_BUTTON_TEXT_MARGIN), 1733 end: LengthMetrics.vp(CounterResource.COUNTER_LIST_BUTTON_TEXT_MARGIN) 1734 }); 1735 }, Text); 1736 Text.pop(); 1737 }); 1738 } 1739 else { 1740 this.ifElseBranchUpdateFunction(1, () => { 1741 this.observeComponentCreation2((p17, q17) => { 1742 Text.create(this.value.toString()); 1743 Text.direction(this.counterDirection); 1744 Text.textAlign(TextAlign.Center); 1745 Text.fontSize(CounterResource.COUNTER_LIST_NUMBER_SIZE); 1746 Text.fontColor(CounterResource.COUNTER_TEXT_COLOR); 1747 Text.margin({ 1748 start: LengthMetrics.vp(CounterResource.COUNTER_LIST_BUTTON_TEXT_MARGIN), 1749 end: LengthMetrics.vp(CounterResource.COUNTER_LIST_BUTTON_TEXT_MARGIN) 1750 }); 1751 }, Text); 1752 Text.pop(); 1753 }); 1754 } 1755 }, If); 1756 If.pop(); 1757 this.observeComponentCreation2((j17, k17) => { 1758 Stack.create(); 1759 Stack.direction(this.counterDirection); 1760 Stack.width(CounterResource.COUNTER_LIST_BUTTON_SIZE); 1761 Stack.height(CounterResource.COUNTER_LIST_BUTTON_SIZE); 1762 Stack.borderRadius(CounterResource.COUNTER_LIST_BUTTON_RADIUS); 1763 Stack.borderWidth(this.addBtnFocusWidh); 1764 Stack.borderColor(CounterResource.BUTTON_BORDER_FOCUSED_COLOR); 1765 Stack.clip(true); 1766 }, Stack); 1767 this.observeComponentCreation2((h17, i17) => { 1768 Image.create(CounterResource.BUTTON_ADD_ICON); 1769 Image.direction(this.counterDirection); 1770 Image.width(CounterResource.COUNTER_LIST_BUTTON_ICON_SIZE); 1771 Image.height(CounterResource.COUNTER_LIST_BUTTON_ICON_SIZE); 1772 Image.fillColor(CounterResource.BUTTON_ICON_COLOR); 1773 Image.opacity(this.addOpacity); 1774 }, Image); 1775 this.observeComponentCreation2((v16, w16) => { 1776 Button.createWithLabel({ type: ButtonType.Circle, stateEffect: this.addBtnStateEffect }); 1777 Button.direction(this.counterDirection); 1778 Button.width(CounterResource.COUNTER_LIST_BUTTON_SIZE); 1779 Button.height(CounterResource.COUNTER_LIST_BUTTON_SIZE); 1780 Button.responseRegion({ 1781 x: CounterResource.COUNTER_LIST_BUTTON_HOT_SPOT_X, 1782 y: CounterResource.COUNTER_LIST_BUTTON_HOT_SPOT_Y, 1783 width: '150%', 1784 height: '150%' 1785 }); 1786 Button.backgroundColor(CounterResource.BUTTON_BACKGROUD_COLOR); 1787 Button.opacity(this.addOpacity); 1788 Button.enabled(this.addBtnEnabled); 1789 Button.key('ListAddButton' + this.timeStamp.toString()); 1790 Button.onKeyEvent((g17) => { 1791 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH; 1792 if (g17.keyCode === CounterConstant.KEYCODE_ESC) { 1793 this.resetFocusButton(); 1794 g17.stopPropagation(); 1795 } 1796 if (g17.type === KeyType.Down && 1797 g17.keyCode === CounterConstant.KEYCODE_MOVE_HOME) { 1798 g17.stopPropagation(); 1799 this.homeFirstValue(); 1800 if (this.subBtnStateEffect) { 1801 this.subBtnStateEffect = false; 1802 this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1803 this.subBtnEnabled = false; 1804 } 1805 this.focusWithTarget('ListAddButton' + this.timeStamp.toString()); 1806 } 1807 if (g17.type === KeyType.Down && 1808 g17.keyCode === CounterConstant.KEYCODE_MOVE_END) { 1809 g17.stopPropagation(); 1810 this.endLastValue(); 1811 this.focusWithTarget('ListSubButton' + this.timeStamp.toString()); 1812 } 1813 }); 1814 Button.onClick((f17) => { 1815 this.addValue(); 1816 this.onChange?.(ObservedObject.GetRawObject(this.value)); 1817 if (f17.source === SourceType.Mouse || 1818 f17.source === SourceType.TouchScreen) { 1819 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 1820 } 1821 }); 1822 Gesture.create(GesturePriority.Low); 1823 LongPressGesture.create({ repeat: true }); 1824 LongPressGesture.onAction((e17) => { 1825 if (e17.repeat) { 1826 this.addValue(); 1827 this.onChange?.(ObservedObject.GetRawObject(this.value)); 1828 } 1829 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 1830 }); 1831 LongPressGesture.pop(); 1832 Gesture.pop(); 1833 Button.hoverEffect(this.choverEffect); 1834 Button.onHover((d17) => { 1835 this.onHoverIncrease && this.onHoverIncrease(d17); 1836 }); 1837 Button.focusable(this.focusEnable); 1838 Button.onFocus(() => { 1839 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH; 1840 this.onFocusIncrease && this.onFocusIncrease(); 1841 this.updateButtonStatus(); 1842 }); 1843 Button.onBlur(() => { 1844 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 1845 this.onBlurIncrease && this.onBlurIncrease(); 1846 }); 1847 }, Button); 1848 Button.pop(); 1849 Stack.pop(); 1850 Row.pop(); 1851 RelativeContainer.pop(); 1852 }); 1853 } 1854 else if (this.type === CounterType.COMPACT) { 1855 this.ifElseBranchUpdateFunction(1, () => { 1856 this.observeComponentCreation2((i16, j16) => { 1857 Column.create(); 1858 }, Column); 1859 this.observeComponentCreation2((g16, h16) => { 1860 Row.create(); 1861 Row.direction(this.counterDirection); 1862 Row.tabIndex(0); 1863 Row.height(CounterResource.COUNTER_COMPACT_CONTAINER_HEIGHT); 1864 Row.align(Alignment.Center); 1865 Row.borderWidth(CounterResource.COUNTER_BORDER_WIDTH); 1866 Row.borderColor(CounterResource.COUNTER_BORDER_COLOR); 1867 Row.borderRadius(CounterResource.COUNTER_COMPACT_CONTAINER_RADIUS); 1868 }, Row); 1869 this.observeComponentCreation2((e16, f16) => { 1870 Stack.create(); 1871 Stack.width(CounterResource.COUNTER_COMPACT_BUTTON_SIZE); 1872 Stack.height(CounterResource.COUNTER_COMPACT_BUTTON_SIZE); 1873 Stack.borderRadius(CounterResource.COUNTER_COMPACT_BUTTON_RADIUS); 1874 Stack.borderWidth(this.subBtnFocusWidh); 1875 Stack.borderColor(CounterResource.BUTTON_BORDER_FOCUSED_COLOR); 1876 Stack.margin({ start: LengthMetrics.vp(1) }); 1877 Stack.clip(true); 1878 }, Stack); 1879 this.observeComponentCreation2((c16, d16) => { 1880 Image.create(CounterResource.BUTTON_SUB_ICON); 1881 Image.direction(this.counterDirection); 1882 Image.width(CounterResource.COUNTER_COMPACT_BUTTON_ICON_SIZE); 1883 Image.height(CounterResource.COUNTER_COMPACT_BUTTON_ICON_SIZE); 1884 Image.fillColor(CounterResource.BUTTON_ICON_COLOR); 1885 Image.opacity(this.subOpacity); 1886 }, Image); 1887 this.observeComponentCreation2((q15, r15) => { 1888 Button.createWithLabel({ type: ButtonType.Circle, stateEffect: this.subBtnStateEffect }); 1889 Button.direction(this.counterDirection); 1890 Button.width(CounterResource.COUNTER_COMPACT_BUTTON_SIZE); 1891 Button.height(CounterResource.COUNTER_COMPACT_BUTTON_SIZE); 1892 Button.backgroundColor(CounterResource.BUTTON_BACKGROUD_COLOR); 1893 Button.opacity(this.subOpacity); 1894 Button.enabled(this.subBtnEnabled); 1895 Button.key('CompactSubButton' + this.timeStamp.toString()); 1896 Button.onKeyEvent((b16) => { 1897 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH; 1898 if (b16.keyCode === CounterConstant.KEYCODE_ESC) { 1899 this.resetFocusButton(); 1900 b16.stopPropagation(); 1901 } 1902 if (b16.type === KeyType.Down && 1903 b16.keyCode === CounterConstant.KEYCODE_MOVE_HOME) { 1904 b16.stopPropagation(); 1905 this.homeFirstValue(); 1906 this.focusWithTarget('CompactAddButton' + this.timeStamp.toString()); 1907 } 1908 if (b16.type === KeyType.Down && 1909 b16.keyCode === CounterConstant.KEYCODE_MOVE_END) { 1910 b16.stopPropagation(); 1911 this.endLastValue(); 1912 if (this.addBtnStateEffect) { 1913 this.addBtnStateEffect = false; 1914 this.addOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 1915 this.addBtnEnabled = false; 1916 } 1917 this.focusWithTarget('CompactSubButton' + this.timeStamp.toString()); 1918 } 1919 }); 1920 Button.onClick((a16) => { 1921 this.subValue(); 1922 this.onChange?.(ObservedObject.GetRawObject(this.value)); 1923 if (a16.source === SourceType.Mouse || 1924 a16.source === SourceType.TouchScreen) { 1925 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 1926 } 1927 }); 1928 Gesture.create(GesturePriority.Low); 1929 LongPressGesture.create({ repeat: true }); 1930 LongPressGesture.onAction((z15) => { 1931 if (z15.repeat) { 1932 this.subValue(); 1933 this.onChange?.(ObservedObject.GetRawObject(this.value)); 1934 } 1935 if (z15.source === SourceType.Mouse || 1936 z15.source === SourceType.TouchScreen) { 1937 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 1938 } 1939 }); 1940 LongPressGesture.pop(); 1941 Gesture.pop(); 1942 Button.hoverEffect(this.choverEffect); 1943 Button.onHover((y15) => { 1944 this.onHoverDecrease && this.onHoverDecrease(y15); 1945 }); 1946 Button.focusable(this.focusEnable); 1947 Button.groupDefaultFocus(true); 1948 Button.onFocus(() => { 1949 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH; 1950 this.onFocusDecrease && this.onFocusDecrease(); 1951 this.updateButtonStatus(); 1952 }); 1953 Button.onBlur(() => { 1954 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 1955 this.onBlurDecrease && this.onBlurDecrease(); 1956 }); 1957 }, Button); 1958 Button.pop(); 1959 Stack.pop(); 1960 this.observeComponentCreation2((g15, h15) => { 1961 If.create(); 1962 if (this.hasTextWidth) { 1963 this.ifElseBranchUpdateFunction(0, () => { 1964 this.observeComponentCreation2((o15, p15) => { 1965 Text.create(this.value.toString()); 1966 Text.textAlign(TextAlign.Center); 1967 Text.fontSize(CounterResource.COUNTER_NUMBER_SIZE); 1968 Text.fontColor(CounterResource.COUNTER_TEXT_COLOR); 1969 Text.width(this.textWidth.toString()); 1970 Text.margin({ 1971 start: LengthMetrics.vp(CounterResource.COUNTER_COMPACT_BUTTON_TEXT_MARGIN), 1972 end: LengthMetrics.vp(CounterResource.COUNTER_COMPACT_BUTTON_TEXT_MARGIN) 1973 }); 1974 }, Text); 1975 Text.pop(); 1976 }); 1977 } 1978 else { 1979 this.ifElseBranchUpdateFunction(1, () => { 1980 this.observeComponentCreation2((k15, l15) => { 1981 Text.create(this.value.toString()); 1982 Text.direction(this.counterDirection); 1983 Text.textAlign(TextAlign.Center); 1984 Text.fontSize(CounterResource.COUNTER_NUMBER_SIZE); 1985 Text.fontColor(CounterResource.COUNTER_TEXT_COLOR); 1986 Text.margin({ 1987 start: LengthMetrics.vp(CounterResource.COUNTER_COMPACT_BUTTON_TEXT_MARGIN), 1988 end: LengthMetrics.vp(CounterResource.COUNTER_COMPACT_BUTTON_TEXT_MARGIN) 1989 }); 1990 }, Text); 1991 Text.pop(); 1992 }); 1993 } 1994 }, If); 1995 If.pop(); 1996 this.observeComponentCreation2((e15, f15) => { 1997 Stack.create(); 1998 Stack.direction(this.counterDirection); 1999 Stack.width(CounterResource.COUNTER_COMPACT_BUTTON_SIZE); 2000 Stack.height(CounterResource.COUNTER_COMPACT_BUTTON_SIZE); 2001 Stack.borderRadius(CounterResource.COUNTER_COMPACT_BUTTON_RADIUS); 2002 Stack.borderWidth(this.addBtnFocusWidh); 2003 Stack.borderColor(CounterResource.BUTTON_BORDER_FOCUSED_COLOR); 2004 Stack.margin({ end: LengthMetrics.vp(1) }); 2005 Stack.clip(true); 2006 }, Stack); 2007 this.observeComponentCreation2((c15, d15) => { 2008 Image.create(CounterResource.BUTTON_ADD_ICON); 2009 Image.direction(this.counterDirection); 2010 Image.width(CounterResource.COUNTER_COMPACT_BUTTON_ICON_SIZE); 2011 Image.height(CounterResource.COUNTER_COMPACT_BUTTON_ICON_SIZE); 2012 Image.fillColor(CounterResource.BUTTON_ICON_COLOR); 2013 Image.opacity(this.addOpacity); 2014 }, Image); 2015 this.observeComponentCreation2((q14, r14) => { 2016 Button.createWithLabel({ type: ButtonType.Circle, stateEffect: this.addBtnStateEffect }); 2017 Button.direction(this.counterDirection); 2018 Button.width(CounterResource.COUNTER_COMPACT_BUTTON_SIZE); 2019 Button.height(CounterResource.COUNTER_COMPACT_BUTTON_SIZE); 2020 Button.backgroundColor(CounterResource.BUTTON_BACKGROUD_COLOR); 2021 Button.opacity(this.addOpacity); 2022 Button.enabled(this.addBtnEnabled); 2023 Button.key('CompactAddButton' + this.timeStamp.toString()); 2024 Button.onKeyEvent((b15) => { 2025 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH; 2026 if (b15.keyCode === CounterConstant.KEYCODE_ESC) { 2027 this.resetFocusButton(); 2028 b15.stopPropagation(); 2029 } 2030 if (b15.type === KeyType.Down && 2031 b15.keyCode === CounterConstant.KEYCODE_MOVE_HOME) { 2032 b15.stopPropagation(); 2033 this.homeFirstValue(); 2034 if (this.subBtnStateEffect) { 2035 this.subBtnStateEffect = false; 2036 this.subOpacity = CounterResource.COUNTER_BUTTON_DISABLE_OPACITY; 2037 this.subBtnEnabled = false; 2038 } 2039 this.focusWithTarget('CompactAddButton' + this.timeStamp.toString()); 2040 } 2041 if (b15.type === KeyType.Down && 2042 b15.keyCode === CounterConstant.KEYCODE_MOVE_END) { 2043 b15.stopPropagation(); 2044 this.endLastValue(); 2045 this.focusWithTarget('CompactSubButton' + this.timeStamp.toString()); 2046 } 2047 }); 2048 Button.onClick((a15) => { 2049 this.addValue(); 2050 this.onChange?.(ObservedObject.GetRawObject(this.value)); 2051 if (a15.source === SourceType.Mouse || 2052 a15.source === SourceType.TouchScreen) { 2053 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 2054 } 2055 }); 2056 Gesture.create(GesturePriority.Low); 2057 LongPressGesture.create({ repeat: true }); 2058 LongPressGesture.onAction((z14) => { 2059 if (z14.repeat) { 2060 this.addValue(); 2061 this.onChange?.(ObservedObject.GetRawObject(this.value)); 2062 } 2063 if (z14.source === SourceType.Mouse || 2064 z14.source === SourceType.TouchScreen) { 2065 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 2066 } 2067 }); 2068 LongPressGesture.pop(); 2069 Gesture.pop(); 2070 Button.hoverEffect(this.choverEffect); 2071 Button.onHover((y14) => { 2072 this.onHoverIncrease && this.onHoverIncrease(y14); 2073 }); 2074 Button.focusable(this.focusEnable); 2075 Button.onFocus(() => { 2076 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH; 2077 this.onFocusIncrease && this.onFocusIncrease(); 2078 this.updateButtonStatus(); 2079 }); 2080 Button.onBlur(() => { 2081 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 2082 this.onBlurIncrease && this.onBlurIncrease(); 2083 }); 2084 }, Button); 2085 Button.pop(); 2086 Stack.pop(); 2087 Row.pop(); 2088 this.observeComponentCreation2((o14, p14) => { 2089 Text.create(this.numberStyleOptions.label); 2090 Text.direction(this.counterDirection); 2091 Text.margin({ top: CounterResource.COUNTER_COMPACT_CONTAINER_LABEL_DISTANCE }); 2092 Text.fontSize(CounterResource.COUNTER_COMPACT_LABEL_SIZE); 2093 Text.fontColor(CounterResource.COUNTER_TEXT_COLOR); 2094 Text.align(Alignment.Top); 2095 }, Text); 2096 Text.pop(); 2097 Column.pop(); 2098 }); 2099 } 2100 else if (this.type === CounterType.INLINE) { 2101 this.ifElseBranchUpdateFunction(2, () => { 2102 this.observeComponentCreation2((b14, c14) => { 2103 Row.create(); 2104 Row.direction(this.counterDirection); 2105 Row.height(CounterResource.COUNTER_INLINE_CONTAINER_HEIGHT); 2106 Row.borderWidth(CounterResource.COUNTER_BORDER_WIDTH); 2107 Row.borderColor(CounterResource.COUNTER_BORDER_COLOR); 2108 Row.borderRadius(CounterResource.COUNTER_INLINE_RADIUS); 2109 Row.clip(true); 2110 }, Row); 2111 this.observeComponentCreation2((j12, k12) => { 2112 If.create(); 2113 if (this.hasTextWidth) { 2114 this.ifElseBranchUpdateFunction(0, () => { 2115 this.observeComponentCreation2((z13, a14) => { 2116 RelativeContainer.create(); 2117 RelativeContainer.direction(this.counterDirection); 2118 RelativeContainer.margin({ 2119 start: LengthMetrics.vp(CounterResource.COUNTER_INLINE_INPUT_TEXT_MARGIN), 2120 end: LengthMetrics.vp(CounterResource.COUNTER_INLINE_INPUT_TEXT_MARGIN) 2121 }); 2122 RelativeContainer.height('100%'); 2123 RelativeContainer.width(this.textWidth); 2124 }, RelativeContainer); 2125 this.observeComponentCreation2((j13, k13) => { 2126 TextInput.create({ 2127 text: this.hasInputText1 ? this.inputValue : this.value.toString(), 2128 controller: this.controller1 2129 }); 2130 TextInput.alignRules({ 2131 center: { anchor: '__container__', align: VerticalAlign.Center }, 2132 middle: { anchor: '__container__', align: HorizontalAlign.Center } 2133 }); 2134 TextInput.width(Math.min(this.getValueLength() * 9.6, this.textWidth)); 2135 TextInput.height('20vp'); 2136 TextInput.padding(0); 2137 TextInput.borderRadius(0); 2138 TextInput.textAlign(TextAlign.Center); 2139 TextInput.type(InputType.PhoneNumber); 2140 TextInput.caretColor(Color.Transparent); 2141 TextInput.copyOption(CopyOptions.None); 2142 TextInput.fontSize(CounterResource.COUNTER_NUMBER_SIZE); 2143 TextInput.fontWeight(FontWeight.Medium); 2144 TextInput.fontColor(this.hasFocusText1 ? Color.White : CounterResource.COUNTER_TEXT_COLOR); 2145 TextInput.maxLength(this.getMaxLength()); 2146 TextInput.backgroundColor(this.hasFocusText1 ? CounterResource.BUTTON_BORDER_FOCUSED_COLOR : Color.Transparent); 2147 TextInput.key('InlineTextInput' + this.timeStamp.toString()); 2148 TextInput.onKeyEvent((y13) => { 2149 this.focusCurrentText(FocusText.TEXT1); 2150 if (y13.keyCode === CounterConstant.KEYCODE_ESC) { 2151 this.resetFocusText(); 2152 y13.stopPropagation(); 2153 } 2154 if (y13.type === KeyType.Down && 2155 y13.keyCode === CounterConstant.KEYCODE_DPAD_UP) { 2156 this.addValue(); 2157 y13.stopPropagation(); 2158 } 2159 if (y13.type === KeyType.Down && 2160 y13.keyCode === CounterConstant.KEYCODE_MOVE_HOME) { 2161 y13.stopPropagation(); 2162 this.focusWithTarget('InlineTextInput' + this.timeStamp.toString()); 2163 } 2164 if (y13.type === KeyType.Down && 2165 y13.keyCode === CounterConstant.KEYCODE_MOVE_END) { 2166 y13.stopPropagation(); 2167 this.focusWithTarget('InlineTextInput' + this.timeStamp.toString()); 2168 } 2169 if (y13.type === KeyType.Down && 2170 y13.keyCode === CounterConstant.KEYCODE_DPAD_DOWN) { 2171 this.subValue(); 2172 y13.stopPropagation(); 2173 } 2174 if (y13.type === KeyType.Down && 2175 y13.keyCode === CounterConstant.KEYCODE_DPAD_LEFT) { 2176 this.focusWithTarget('InlineTextInput' + this.timeStamp.toString()); 2177 y13.stopPropagation(); 2178 } 2179 if (y13.type === KeyType.Down && 2180 y13.keyCode === CounterConstant.KEYCODE_DPAD_RIGHT) { 2181 this.focusWithTarget('InlineTextInput' + this.timeStamp.toString()); 2182 y13.stopPropagation(); 2183 } 2184 }); 2185 TextInput.onChange((t13) => { 2186 this.inputValue = t13; 2187 for (let w13 = 0; w13 < t13.length; w13++) { 2188 let x13 = t13[w13]; 2189 if (x13 === '+' || x13 === '*' || x13 === '#') { 2190 this.value -= 1; 2191 this.value += 1; 2192 this.inputValue = this.value.toString(); 2193 return; 2194 } 2195 if (x13 === '-' && w13 !== 0) { 2196 this.inputValue = x13; 2197 break; 2198 } 2199 } 2200 this.hasInputText1 = true; 2201 let u13 = t13[t13.length - 1]; 2202 if (t13.length === this.getMaxLength()) { 2203 this.inputValue = u13; 2204 } 2205 if (this.timeoutID1 !== -1) { 2206 clearTimeout(this.timeoutID1); 2207 this.timeoutID1 = -1; 2208 } 2209 if (this.inputValue !== '' && Number(this.inputValue) <= this.max && 2210 Number(this.inputValue) >= this.min) { 2211 this.value = Number(this.inputValue); 2212 this.onChange?.(ObservedObject.GetRawObject(this.value)); 2213 this.hasInputText1 = false; 2214 } 2215 else { 2216 if (Number(this.inputValue) > this.max || 2217 (Number(this.inputValue) < this.min && 2218 this.inputValue.length <= this.min.toString().length)) { 2219 this.inputValue = u13; 2220 } 2221 if (t13.length < this.getMaxLength()) { 2222 this.timeoutID1 = setTimeout(() => { 2223 if (this.inputValue !== '' && Number(this.inputValue) <= this.max && 2224 Number(this.inputValue) >= this.min) { 2225 this.value = Number(this.inputValue); 2226 this.onChange?.(ObservedObject.GetRawObject(this.value)); 2227 } 2228 this.inputValue = this.value.toString(); 2229 this.hasInputText1 = false; 2230 this.updateInlineEnableSate(); 2231 }, 1500); 2232 } 2233 } 2234 this.updateInlineEnableSate(); 2235 }); 2236 TextInput.onSubmit((s13) => { 2237 if (this.timeoutID1 != -1) { 2238 clearTimeout(this.timeoutID1); 2239 this.timeoutID1 = -1; 2240 } 2241 this.hasInputText1 = false; 2242 this.value -= 1; 2243 if (Number(this.inputValue) >= this.min && Number(this.inputValue) <= this.max) { 2244 this.value = Number(this.inputValue); 2245 this.onChange?.(ObservedObject.GetRawObject(this.value)); 2246 this.updateInlineEnableSate(); 2247 } 2248 else { 2249 this.value += 1; 2250 this.inputValue = this.value.toString(); 2251 } 2252 }); 2253 TextInput.focusable(true); 2254 TextInput.focusOnTouch(true); 2255 TextInput.onFocus(() => { 2256 this.focusText = FocusText.TEXT1; 2257 this.hasFocusText1 = true; 2258 this.controller1.caretPosition(this.value.toString().length); 2259 }); 2260 TextInput.onBlur(() => { 2261 this.focusText = FocusText.NONE; 2262 this.hasFocusText1 = false; 2263 }); 2264 TextInput.onClick((r13) => { 2265 this.focusText = FocusText.TEXT1; 2266 this.hasFocusText1 = true; 2267 this.focusWithTarget('InlineTextInput' + this.timeStamp.toString()); 2268 this.controller1.caretPosition(this.value.toString().length); 2269 }); 2270 }, TextInput); 2271 RelativeContainer.pop(); 2272 }); 2273 } 2274 else { 2275 this.ifElseBranchUpdateFunction(1, () => { 2276 this.observeComponentCreation2((e13, f13) => { 2277 Row.create(); 2278 Row.direction(this.counterDirection); 2279 Row.margin({ 2280 start: LengthMetrics.vp(CounterResource.COUNTER_INLINE_INPUT_TEXT_MARGIN), 2281 end: LengthMetrics.vp(CounterResource.COUNTER_INLINE_INPUT_TEXT_MARGIN) 2282 }); 2283 }, Row); 2284 this.observeComponentCreation2((o12, p12) => { 2285 TextInput.create({ 2286 text: this.hasInputText1 ? this.inputValue : this.value.toString(), 2287 controller: this.controller1 2288 }); 2289 TextInput.direction(this.counterDirection); 2290 TextInput.width(this.getValueLength() * 9.6); 2291 TextInput.height('20vp'); 2292 TextInput.padding(0); 2293 TextInput.borderRadius(0); 2294 TextInput.textAlign(TextAlign.Center); 2295 TextInput.type(InputType.PhoneNumber); 2296 TextInput.caretColor(Color.Transparent); 2297 TextInput.copyOption(CopyOptions.None); 2298 TextInput.fontSize(CounterResource.COUNTER_NUMBER_SIZE); 2299 TextInput.fontWeight(FontWeight.Medium); 2300 TextInput.fontColor(this.hasFocusText1 ? Color.White : CounterResource.COUNTER_TEXT_COLOR); 2301 TextInput.maxLength(this.getMaxLength()); 2302 TextInput.backgroundColor(this.hasFocusText1 ? CounterResource.BUTTON_BORDER_FOCUSED_COLOR : Color.Transparent); 2303 TextInput.key('InlineTextInput' + this.timeStamp.toString()); 2304 TextInput.onKeyEvent((d13) => { 2305 this.focusCurrentText(FocusText.TEXT1); 2306 if (d13.keyCode === CounterConstant.KEYCODE_ESC) { 2307 this.resetFocusText(); 2308 d13.stopPropagation(); 2309 } 2310 if (d13.type === KeyType.Down && 2311 d13.keyCode === CounterConstant.KEYCODE_DPAD_UP) { 2312 this.addValue(); 2313 d13.stopPropagation(); 2314 } 2315 if (d13.type === KeyType.Down && 2316 d13.keyCode === CounterConstant.KEYCODE_DPAD_DOWN) { 2317 this.subValue(); 2318 d13.stopPropagation(); 2319 } 2320 if (d13.type === KeyType.Down && 2321 d13.keyCode === CounterConstant.KEYCODE_DPAD_LEFT) { 2322 this.focusWithTarget('InlineTextInput' + this.timeStamp.toString()); 2323 d13.stopPropagation(); 2324 } 2325 if (d13.type === KeyType.Down && 2326 d13.keyCode === CounterConstant.KEYCODE_DPAD_RIGHT) { 2327 this.focusWithTarget('InlineTextInput' + this.timeStamp.toString()); 2328 d13.stopPropagation(); 2329 } 2330 }); 2331 TextInput.onChange((y12) => { 2332 this.inputValue = y12; 2333 for (let b13 = 0; b13 < y12.length; b13++) { 2334 let c13 = y12[b13]; 2335 if (c13 === '+' || c13 === '*' || c13 === '#') { 2336 this.value -= 1; 2337 this.value += 1; 2338 this.inputValue = this.value.toString(); 2339 return; 2340 } 2341 if (c13 === '-' && b13 !== 0) { 2342 this.inputValue = c13; 2343 break; 2344 } 2345 } 2346 this.hasInputText1 = true; 2347 let z12 = y12[y12.length - 1]; 2348 if (y12.length === this.getMaxLength()) { 2349 this.inputValue = z12; 2350 } 2351 if (this.timeoutID1 !== -1) { 2352 clearTimeout(this.timeoutID1); 2353 this.timeoutID1 = -1; 2354 } 2355 if (this.inputValue !== '' && Number(this.inputValue) <= this.max && 2356 Number(this.inputValue) >= this.min) { 2357 this.value = Number(this.inputValue); 2358 this.onChange?.(ObservedObject.GetRawObject(this.value)); 2359 this.hasInputText1 = false; 2360 } 2361 else { 2362 if (Number(this.inputValue) > this.max || 2363 (Number(this.inputValue) < this.min && 2364 this.inputValue.length <= this.min.toString().length)) { 2365 this.inputValue = z12; 2366 } 2367 if (y12.length < this.getMaxLength()) { 2368 this.timeoutID1 = setTimeout(() => { 2369 if (this.inputValue !== '' && Number(this.inputValue) <= this.max && 2370 Number(this.inputValue) >= this.min) { 2371 this.value = Number(this.inputValue); 2372 this.onChange?.(ObservedObject.GetRawObject(this.value)); 2373 } 2374 this.inputValue = this.value.toString(); 2375 this.hasInputText1 = false; 2376 this.updateInlineEnableSate(); 2377 }, 1500); 2378 } 2379 } 2380 this.updateInlineEnableSate(); 2381 }); 2382 TextInput.onSubmit((x12) => { 2383 if (this.timeoutID1 !== -1) { 2384 clearTimeout(this.timeoutID1); 2385 this.timeoutID1 = -1; 2386 } 2387 this.hasInputText1 = false; 2388 this.value -= 1; 2389 if (Number(this.inputValue) >= this.min && Number(this.inputValue) <= this.max) { 2390 this.value = Number(this.inputValue); 2391 this.onChange?.(ObservedObject.GetRawObject(this.value)); 2392 this.updateInlineEnableSate(); 2393 } 2394 else { 2395 this.value += 1; 2396 this.inputValue = this.value.toString(); 2397 } 2398 }); 2399 TextInput.focusable(true); 2400 TextInput.focusOnTouch(true); 2401 TextInput.onFocus(() => { 2402 this.focusText = FocusText.TEXT1; 2403 this.hasFocusText1 = true; 2404 this.controller1.caretPosition(this.value.toString().length); 2405 }); 2406 TextInput.onBlur(() => { 2407 this.focusText = FocusText.NONE; 2408 this.hasFocusText1 = false; 2409 }); 2410 TextInput.onClick((w12) => { 2411 this.focusText = FocusText.TEXT1; 2412 this.hasFocusText1 = true; 2413 this.focusWithTarget('InlineTextInput' + this.timeStamp.toString()); 2414 this.controller1.caretPosition(this.value.toString().length); 2415 }); 2416 }, TextInput); 2417 Row.pop(); 2418 }); 2419 } 2420 }, If); 2421 If.pop(); 2422 this.observeComponentCreation2((h12, i12) => { 2423 Column.create(); 2424 Column.direction(this.counterDirection); 2425 Column.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH); 2426 Column.height(CounterResource.COUNTER_INLINE_CONTAINER_HEIGHT); 2427 Column.borderWidth({ start: LengthMetrics.vp(CounterResource.COUNTER_BORDER_WIDTH_NUMBER) }); 2428 Column.borderColor(CounterResource.COUNTER_BORDER_COLOR); 2429 }, Column); 2430 this.observeComponentCreation2((f12, g12) => { 2431 Stack.create(); 2432 Stack.direction(this.counterDirection); 2433 Stack.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH); 2434 Stack.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT); 2435 Stack.padding({ top: '1vp' }); 2436 Stack.borderWidth({ bottom: '1vp' }); 2437 Stack.borderColor(CounterResource.COUNTER_BORDER_COLOR); 2438 Stack.clip(true); 2439 }, Stack); 2440 this.observeComponentCreation2((d12, e12) => { 2441 Rect.create(); 2442 Rect.direction(this.counterDirection); 2443 Rect.width(CounterResource.COUNTER_INLINE_FOCUS_BORDER_WIDTH); 2444 Rect.height(CounterResource.COUNTER_INLINE_FOCUS_BORDER_HEIGHT); 2445 Rect.radius([ 2446 ['0vp', '0vp'], 2447 [CounterResource.COUNTER_INLINE_RADIUS, CounterResource.COUNTER_INLINE_RADIUS], 2448 ['0vp', '0vp'], 2449 ['0vp', '0vp'] 2450 ]); 2451 Rect.strokeWidth(this.addBtnFocusWidh); 2452 Rect.stroke(CounterResource.BUTTON_BORDER_FOCUSED_COLOR); 2453 Rect.margin({ end: LengthMetrics.vp(2) }); 2454 Rect.fillOpacity(0); 2455 }, Rect); 2456 this.observeComponentCreation2((b12, c12) => { 2457 Image.create(CounterResource.BUTTON_ARROW_UP); 2458 Image.direction(this.counterDirection); 2459 Image.width(CounterResource.COUNTER_INLINE_BUTTON_ICON_WIDTH); 2460 Image.height(CounterResource.COUNTER_INLINE_BUTTON_ICON_HEIGHT); 2461 Image.fillColor(CounterResource.BUTTON_ICON_COLOR); 2462 Image.opacity(this.addOpacity); 2463 }, Image); 2464 this.observeComponentCreation2((r11, s11) => { 2465 Button.createWithLabel({ type: ButtonType.Normal, stateEffect: this.addBtnStateEffect }); 2466 Button.direction(this.counterDirection); 2467 Button.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH); 2468 Button.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT); 2469 Button.backgroundColor(Color.Transparent); 2470 Button.opacity(this.addOpacity); 2471 Button.enabled(this.addBtnEnabled); 2472 Button.onClick((a12) => { 2473 this.addValue(); 2474 if (a12.source === SourceType.Mouse || 2475 a12.source === SourceType.TouchScreen) { 2476 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 2477 } 2478 }); 2479 Gesture.create(GesturePriority.Low); 2480 LongPressGesture.create({ repeat: true }); 2481 LongPressGesture.onAction((z11) => { 2482 if (z11.repeat) { 2483 this.addValue(); 2484 } 2485 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 2486 }); 2487 LongPressGesture.pop(); 2488 Gesture.pop(); 2489 Button.hoverEffect(this.choverEffect); 2490 Button.onHover((y11) => { 2491 this.onHoverIncrease && this.onHoverIncrease(y11); 2492 }); 2493 Button.focusable(false); 2494 Button.onFocus(() => { 2495 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH; 2496 this.onFocusIncrease && this.onFocusIncrease(); 2497 }); 2498 Button.onBlur(() => { 2499 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 2500 this.onBlurIncrease && this.onBlurIncrease(); 2501 }); 2502 }, Button); 2503 Button.pop(); 2504 Stack.pop(); 2505 this.observeComponentCreation2((p11, q11) => { 2506 Stack.create(); 2507 Stack.direction(this.counterDirection); 2508 Stack.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH); 2509 Stack.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT); 2510 Stack.clip(true); 2511 }, Stack); 2512 this.observeComponentCreation2((n11, o11) => { 2513 Rect.create(); 2514 Rect.direction(this.counterDirection); 2515 Rect.width(CounterResource.COUNTER_INLINE_FOCUS_BORDER_WIDTH); 2516 Rect.height(CounterResource.COUNTER_INLINE_FOCUS_BORDER_HEIGHT); 2517 Rect.radius([ 2518 ['0vp', '0vp'], 2519 ['0vp', '0vp'], 2520 [CounterResource.COUNTER_INLINE_RADIUS, CounterResource.COUNTER_INLINE_RADIUS], 2521 ['0vp', '0vp'] 2522 ]); 2523 Rect.strokeWidth(this.subBtnFocusWidh); 2524 Rect.stroke(CounterResource.BUTTON_BORDER_FOCUSED_COLOR); 2525 Rect.margin({ 2526 top: LengthMetrics.vp(1), 2527 end: LengthMetrics.vp(1), 2528 bottom: LengthMetrics.vp(2) 2529 }); 2530 Rect.fillOpacity(0); 2531 }, Rect); 2532 this.observeComponentCreation2((l11, m11) => { 2533 Image.create(CounterResource.BUTTON_ARROW_DOWN); 2534 Image.direction(this.counterDirection); 2535 Image.width(CounterResource.COUNTER_INLINE_BUTTON_ICON_WIDTH); 2536 Image.height(CounterResource.COUNTER_INLINE_BUTTON_ICON_HEIGHT); 2537 Image.fillColor(CounterResource.BUTTON_ICON_COLOR); 2538 Image.opacity(this.subOpacity); 2539 }, Image); 2540 this.observeComponentCreation2((b11, c11) => { 2541 Button.createWithLabel({ type: ButtonType.Normal, stateEffect: this.subBtnStateEffect }); 2542 Button.direction(this.counterDirection); 2543 Button.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH); 2544 Button.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT); 2545 Button.backgroundColor(Color.Transparent); 2546 Button.opacity(this.subOpacity); 2547 Button.enabled(this.subBtnEnabled); 2548 Button.onClick((k11) => { 2549 this.subValue(); 2550 if (k11.source === SourceType.Mouse || 2551 k11.source === SourceType.TouchScreen) { 2552 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 2553 } 2554 }); 2555 Gesture.create(GesturePriority.Low); 2556 LongPressGesture.create({ repeat: true }); 2557 LongPressGesture.onAction((j11) => { 2558 if (j11.repeat) { 2559 this.subValue(); 2560 } 2561 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 2562 }); 2563 LongPressGesture.pop(); 2564 Gesture.pop(); 2565 Button.hoverEffect(this.choverEffect); 2566 Button.onHover((i11) => { 2567 this.onHoverDecrease && this.onHoverDecrease(i11); 2568 }); 2569 Button.focusable(false); 2570 Button.onFocus(() => { 2571 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH; 2572 this.onFocusDecrease && this.onFocusDecrease(); 2573 }); 2574 Button.onBlur(() => { 2575 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 2576 this.onBlurDecrease && this.onBlurDecrease(); 2577 }); 2578 }, Button); 2579 Button.pop(); 2580 Stack.pop(); 2581 Column.pop(); 2582 Row.pop(); 2583 }); 2584 } 2585 else if (this.type === CounterType.INLINE_DATE) { 2586 this.ifElseBranchUpdateFunction(3, () => { 2587 this.observeComponentCreation2((n10, o10) => { 2588 Row.create(); 2589 Row.direction(this.counterDirection); 2590 Row.height(CounterResource.COUNTER_INLINE_CONTAINER_HEIGHT); 2591 Row.borderWidth(CounterResource.COUNTER_BORDER_WIDTH); 2592 Row.borderColor(CounterResource.COUNTER_BORDER_COLOR); 2593 Row.borderRadius(CounterResource.COUNTER_INLINE_RADIUS); 2594 Row.clip(true); 2595 }, Row); 2596 this.observeComponentCreation2((l10, m10) => { 2597 Row.create(); 2598 Row.direction(this.counterDirection); 2599 Row.width('92vp'); 2600 Row.height(CounterResource.COUNTER_INLINE_CONTAINER_HEIGHT); 2601 Row.margin({ 2602 start: LengthMetrics.vp(CounterResource.COUNTER_INLINE_DATE_TEXT_MARGIN), 2603 end: LengthMetrics.vp(CounterResource.COUNTER_INLINE_DATE_TEXT_MARGIN) 2604 }); 2605 }, Row); 2606 this.observeComponentCreation2((w9, x9) => { 2607 TextInput.create({ 2608 text: this.hasInputText1 ? this.inputYear.toString() : this.getYear(), 2609 controller: this.controller1 2610 }); 2611 TextInput.direction(this.counterDirection); 2612 TextInput.type(InputType.Number); 2613 TextInput.caretColor(Color.Transparent); 2614 TextInput.copyOption(CopyOptions.None); 2615 TextInput.fontSize(CounterResource.COUNTER_NUMBER_SIZE); 2616 TextInput.fontWeight(FontWeight.Medium); 2617 TextInput.fontColor(this.hasFocusText1 ? Color.White : CounterResource.COUNTER_TEXT_COLOR); 2618 TextInput.maxLength(5); 2619 TextInput.padding(0); 2620 TextInput.backgroundColor(this.hasFocusText1 ? CounterResource.BUTTON_BORDER_FOCUSED_COLOR : Color.Transparent); 2621 TextInput.width('38vp'); 2622 TextInput.height('20vp'); 2623 TextInput.borderRadius(0); 2624 TextInput.borderWidth(0); 2625 TextInput.key('DateTextInput1' + this.timeStamp.toString()); 2626 TextInput.onKeyEvent((k10) => { 2627 this.focusCurrentText(FocusText.TEXT1); 2628 if (k10.keyCode === CounterConstant.KEYCODE_ESC) { 2629 this.resetFocusText(); 2630 k10.stopPropagation(); 2631 } 2632 if (k10.type === KeyType.Down && 2633 k10.keyCode === CounterConstant.KEYCODE_DPAD_UP) { 2634 this.addDate(); 2635 k10.stopPropagation(); 2636 } 2637 if (k10.type === KeyType.Down && 2638 k10.keyCode === CounterConstant.KEYCODE_DPAD_DOWN) { 2639 this.subDate(); 2640 k10.stopPropagation(); 2641 } 2642 if (k10.type === KeyType.Down && 2643 k10.keyCode === CounterConstant.KEYCODE_MOVE_HOME) { 2644 this.homeFocusText(); 2645 k10.stopPropagation(); 2646 } 2647 if (k10.type === KeyType.Down && 2648 k10.keyCode === CounterConstant.KEYCODE_MOVE_END) { 2649 this.endFocusText(); 2650 k10.stopPropagation(); 2651 } 2652 if (k10.type === KeyType.Down && 2653 k10.keyCode === CounterConstant.KEYCODE_DPAD_LEFT) { 2654 this.focusWithTarget('DateTextInput1' + this.timeStamp.toString()); 2655 k10.stopPropagation(); 2656 } 2657 if (k10.type === KeyType.Down && 2658 k10.keyCode === CounterConstant.KEYCODE_DPAD_RIGHT) { 2659 this.focusWithTarget('DateTextInput2' + this.timeStamp.toString()); 2660 } 2661 }); 2662 TextInput.onChange((h10) => { 2663 if (h10.length !== 4) { 2664 this.hasInputText1 = true; 2665 } 2666 this.inputYear = Number(h10); 2667 if (h10.length === 5) { 2668 this.inputYear = this.inputYear % 10; 2669 } 2670 if (this.timeoutID1 !== -1) { 2671 clearTimeout(this.timeoutID1); 2672 this.timeoutID1 = -1; 2673 } 2674 this.timeoutID1 = setTimeout(() => { 2675 this.hasInputText1 = false; 2676 this.inputYear = this.year; 2677 this.updateDateEnableSate(); 2678 this.updateDay(); 2679 }, 1500); 2680 if (this.inputYear >= this.minYear && this.inputYear <= this.maxYear) { 2681 this.year = this.inputYear; 2682 this.updateDateEnableSate(); 2683 this.updateDay(); 2684 } 2685 if (h10.length === 4) { 2686 let j10 = new DateData(this.year, this.month, this.day); 2687 this.onDateChange?.(j10); 2688 } 2689 }); 2690 TextInput.onSubmit((f10) => { 2691 if (this.timeoutID1 !== -1) { 2692 clearTimeout(this.timeoutID1); 2693 this.timeoutID1 = -1; 2694 } 2695 this.hasInputText1 = false; 2696 this.year -= 1; 2697 if (this.inputYear >= this.minYear && this.inputYear <= this.maxYear) { 2698 this.year = this.inputYear; 2699 } 2700 else { 2701 this.year += 1; 2702 this.inputYear = this.year; 2703 } 2704 this.updateDateEnableSate(); 2705 this.updateDay(); 2706 }); 2707 TextInput.tabIndex(0); 2708 TextInput.focusOnTouch(true); 2709 TextInput.focusable(true); 2710 TextInput.onFocus(() => { 2711 this.focusText = FocusText.TEXT1; 2712 this.hasFocusText1 = true; 2713 this.updateDateEnableSate(); 2714 this.controller1.caretPosition(this.getYear().length); 2715 }); 2716 TextInput.onBlur(() => { 2717 this.focusText = FocusText.NONE; 2718 this.hasFocusText1 = false; 2719 this.updateDateEnableSate(); 2720 }); 2721 TextInput.onClick((e10) => { 2722 this.focusText = FocusText.TEXT1; 2723 this.hasFocusText1 = true; 2724 this.updateDateEnableSate(); 2725 this.controller1.caretPosition(this.getYear().length); 2726 }); 2727 }, TextInput); 2728 this.observeComponentCreation2((u9, v9) => { 2729 Text.create('/'); 2730 Text.direction(this.counterDirection); 2731 Text.textAlign(TextAlign.Center); 2732 Text.fontSize(CounterResource.COUNTER_NUMBER_SIZE); 2733 Text.fontColor(CounterResource.COUNTER_TEXT_COLOR); 2734 Text.width('8vp'); 2735 }, Text); 2736 Text.pop(); 2737 this.observeComponentCreation2((e9, f9) => { 2738 TextInput.create({ 2739 text: this.hasInputText2 ? this.inputMoon.toString() : this.convertNumberToString(this.month), 2740 controller: this.controller2 2741 }); 2742 TextInput.direction(this.counterDirection); 2743 TextInput.type(InputType.Number); 2744 TextInput.caretColor(Color.Transparent); 2745 TextInput.copyOption(CopyOptions.None); 2746 TextInput.fontSize(CounterResource.COUNTER_NUMBER_SIZE); 2747 TextInput.fontWeight(FontWeight.Medium); 2748 TextInput.fontColor(this.hasFocusText2 ? Color.White : CounterResource.COUNTER_TEXT_COLOR); 2749 TextInput.maxLength(3); 2750 TextInput.padding(0); 2751 TextInput.backgroundColor(this.hasFocusText2 ? CounterResource.BUTTON_BORDER_FOCUSED_COLOR : Color.Transparent); 2752 TextInput.width('19vp'); 2753 TextInput.height('20vp'); 2754 TextInput.borderRadius(0); 2755 TextInput.key('DateTextInput2' + this.timeStamp.toString()); 2756 TextInput.onKeyEvent((t9) => { 2757 this.focusCurrentText(FocusText.TEXT2); 2758 if (t9.keyCode === CounterConstant.KEYCODE_ESC) { 2759 this.resetFocusText(); 2760 t9.stopPropagation(); 2761 } 2762 if (t9.type === KeyType.Down && 2763 t9.keyCode === CounterConstant.KEYCODE_DPAD_DOWN) { 2764 this.subDate(); 2765 this.updateDay(); 2766 t9.stopPropagation(); 2767 } 2768 if (t9.type === KeyType.Down && 2769 t9.keyCode === CounterConstant.KEYCODE_DPAD_UP) { 2770 this.addDate(); 2771 this.updateDay(); 2772 t9.stopPropagation(); 2773 } 2774 if (t9.type === KeyType.Down && 2775 t9.keyCode === CounterConstant.KEYCODE_MOVE_HOME) { 2776 this.homeFocusText(); 2777 t9.stopPropagation(); 2778 } 2779 if (t9.type === KeyType.Down && 2780 t9.keyCode === CounterConstant.KEYCODE_MOVE_END) { 2781 this.endFocusText(); 2782 t9.stopPropagation(); 2783 } 2784 if (t9.type === KeyType.Down && 2785 t9.keyCode === CounterConstant.KEYCODE_DPAD_LEFT) { 2786 this.focusWithTarget('DateTextInput1' + this.timeStamp.toString()); 2787 } 2788 if (t9.type === KeyType.Down && 2789 t9.keyCode === CounterConstant.KEYCODE_DPAD_RIGHT) { 2790 this.focusWithTarget('DateTextInput3' + this.timeStamp.toString()); 2791 } 2792 if (t9.type === KeyType.Down && 2793 t9.keyCode === CounterConstant.KEYCODE_TAB) { 2794 t9.stopPropagation(); 2795 this.focusWithTarget('DateTextInput1' + this.timeStamp.toString()); 2796 } 2797 }); 2798 TextInput.onChange((p9) => { 2799 this.inputMoon = Number(p9); 2800 if (p9.length !== 2) { 2801 this.hasInputText2 = true; 2802 } 2803 if (p9.length === 3) { 2804 this.inputMoon = this.inputMoon % 10; 2805 } 2806 if (this.timeoutID2 !== -1) { 2807 clearTimeout(this.timeoutID2); 2808 this.timeoutID2 = -1; 2809 } 2810 this.timeoutID2 = setTimeout(() => { 2811 this.hasInputText2 = false; 2812 this.month -= 1; 2813 if (this.inputMoon >= 1 && this.inputMoon <= 12) { 2814 this.month = this.inputMoon; 2815 } 2816 else { 2817 this.month += 1; 2818 this.inputMoon = this.month; 2819 } 2820 this.updateDay(); 2821 }, 1000); 2822 if (p9.length === 2) { 2823 this.hasInputText2 = false; 2824 this.month -= 1; 2825 if (this.inputMoon >= 1 && this.inputMoon <= 12) { 2826 this.month = this.inputMoon; 2827 let r9 = new DateData(this.year, this.month, this.day); 2828 this.onDateChange?.(r9); 2829 } 2830 else { 2831 this.month += 1; 2832 this.inputMoon = this.month; 2833 } 2834 this.updateDay(); 2835 } 2836 }); 2837 TextInput.onSubmit((n9) => { 2838 if (this.timeoutID2 !== -1) { 2839 clearTimeout(this.timeoutID2); 2840 this.timeoutID2 = -1; 2841 } 2842 this.hasInputText2 = false; 2843 this.month -= 1; 2844 if (this.inputMoon >= 1 && this.inputMoon <= 12) { 2845 this.month = this.inputMoon; 2846 this.updateDay(); 2847 } 2848 else { 2849 this.month += 1; 2850 } 2851 }); 2852 TextInput.focusOnTouch(true); 2853 TextInput.tabIndex(-1); 2854 TextInput.focusable(true); 2855 TextInput.onFocus(() => { 2856 this.focusText = FocusText.TEXT2; 2857 this.hasFocusText2 = true; 2858 this.controller2.caretPosition(this.convertNumberToString(this.month).length); 2859 }); 2860 TextInput.onBlur(() => { 2861 this.focusText = FocusText.NONE; 2862 this.hasFocusText2 = false; 2863 }); 2864 TextInput.onClick((m9) => { 2865 this.focusText = FocusText.TEXT2; 2866 this.hasFocusText2 = true; 2867 this.controller2.caretPosition(this.convertNumberToString(this.month).length); 2868 }); 2869 }, TextInput); 2870 this.observeComponentCreation2((c9, d9) => { 2871 Text.create('/'); 2872 Text.direction(this.counterDirection); 2873 Text.textAlign(TextAlign.Center); 2874 Text.fontSize(CounterResource.COUNTER_NUMBER_SIZE); 2875 Text.fontColor(CounterResource.COUNTER_TEXT_COLOR); 2876 Text.width('8vp'); 2877 }, Text); 2878 Text.pop(); 2879 this.observeComponentCreation2((m8, n8) => { 2880 TextInput.create({ 2881 text: this.hasInputText3 ? this.inputDay.toString() : this.convertNumberToString(this.day), 2882 controller: this.controller3 2883 }); 2884 TextInput.direction(this.counterDirection); 2885 TextInput.type(InputType.Number); 2886 TextInput.caretColor(Color.Transparent); 2887 TextInput.copyOption(CopyOptions.None); 2888 TextInput.fontSize(CounterResource.COUNTER_NUMBER_SIZE); 2889 TextInput.fontWeight(FontWeight.Medium); 2890 TextInput.fontColor(this.hasFocusText3 ? Color.White : CounterResource.COUNTER_TEXT_COLOR); 2891 TextInput.maxLength(3); 2892 TextInput.padding(0); 2893 TextInput.backgroundColor(this.hasFocusText3 ? CounterResource.BUTTON_BORDER_FOCUSED_COLOR : Color.Transparent); 2894 TextInput.width('19vp'); 2895 TextInput.height('20vp'); 2896 TextInput.borderRadius(0); 2897 TextInput.key('DateTextInput3' + this.timeStamp.toString()); 2898 TextInput.onKeyEvent((b9) => { 2899 this.focusCurrentText(FocusText.TEXT3); 2900 if (b9.keyCode === CounterConstant.KEYCODE_ESC) { 2901 this.resetFocusText(); 2902 b9.stopPropagation(); 2903 } 2904 if (b9.type === KeyType.Down && 2905 b9.keyCode === CounterConstant.KEYCODE_DPAD_DOWN) { 2906 this.subDate(); 2907 b9.stopPropagation(); 2908 } 2909 if (b9.type === KeyType.Down && 2910 b9.keyCode === CounterConstant.KEYCODE_DPAD_UP) { 2911 this.addDate(); 2912 b9.stopPropagation(); 2913 } 2914 if (b9.type === KeyType.Down && 2915 b9.keyCode === CounterConstant.KEYCODE_MOVE_HOME) { 2916 this.homeFocusText(); 2917 b9.stopPropagation(); 2918 } 2919 if (b9.type === KeyType.Down && 2920 b9.keyCode === CounterConstant.KEYCODE_MOVE_END) { 2921 this.endFocusText(); 2922 b9.stopPropagation(); 2923 } 2924 if (b9.type === KeyType.Down && 2925 b9.keyCode === CounterConstant.KEYCODE_DPAD_LEFT) { 2926 this.focusWithTarget('DateTextInput2' + this.timeStamp.toString()); 2927 } 2928 if (b9.type === KeyType.Down && 2929 b9.keyCode === CounterConstant.KEYCODE_DPAD_RIGHT) { 2930 this.focusWithTarget('DateTextInput3' + this.timeStamp.toString()); 2931 b9.stopPropagation(); 2932 } 2933 if (b9.type === KeyType.Down && 2934 b9.keyCode === CounterConstant.KEYCODE_TAB) { 2935 b9.stopPropagation(); 2936 this.focusWithTarget('DateTextInput1' + this.timeStamp.toString()); 2937 } 2938 }); 2939 TextInput.onChange((x8) => { 2940 this.inputDay = Number(x8); 2941 if (x8.length !== 2) { 2942 this.hasInputText3 = true; 2943 } 2944 if (x8.length === 3) { 2945 this.inputDay = this.inputDay % 10; 2946 } 2947 if (this.timeoutID3 !== -1) { 2948 clearTimeout(this.timeoutID3); 2949 this.timeoutID3 = -1; 2950 } 2951 this.timeoutID3 = setTimeout(() => { 2952 this.hasInputText3 = false; 2953 this.day -= 1; 2954 if (this.inputDay >= 1 && this.inputDay <= this.getDayNumber()) { 2955 this.day = this.inputDay; 2956 } 2957 else { 2958 this.day += 1; 2959 this.inputDay = this.day; 2960 } 2961 }, 1000); 2962 if (x8.length === 2) { 2963 this.hasInputText3 = false; 2964 this.day -= 1; 2965 if (this.inputDay >= 1 && this.inputDay <= this.getDayNumber()) { 2966 this.day = this.inputDay; 2967 let z8 = new DateData(this.year, this.month, this.day); 2968 this.onDateChange?.(z8); 2969 } 2970 else { 2971 this.day += 1; 2972 this.inputDay = this.day; 2973 } 2974 } 2975 }); 2976 TextInput.onSubmit((v8) => { 2977 if (this.timeoutID3 !== -1) { 2978 clearTimeout(this.timeoutID3); 2979 this.timeoutID3 = -1; 2980 } 2981 this.hasInputText3 = false; 2982 this.day -= 1; 2983 if (this.inputDay >= 1 && this.inputDay <= this.getDayNumber()) { 2984 this.day = this.inputDay; 2985 } 2986 else { 2987 this.day += 1; 2988 } 2989 }); 2990 TextInput.tabIndex(-2); 2991 TextInput.focusOnTouch(true); 2992 TextInput.focusable(true); 2993 TextInput.onFocus(() => { 2994 this.focusText = FocusText.TEXT3; 2995 this.hasFocusText3 = true; 2996 this.controller3.caretPosition(this.convertNumberToString(this.day).length); 2997 }); 2998 TextInput.onBlur(() => { 2999 this.focusText = FocusText.NONE; 3000 this.hasFocusText3 = false; 3001 }); 3002 TextInput.onClick((u8) => { 3003 this.focusText = FocusText.TEXT3; 3004 this.hasFocusText3 = true; 3005 this.controller3.caretPosition(this.convertNumberToString(this.day).length); 3006 }); 3007 }, TextInput); 3008 Row.pop(); 3009 this.observeComponentCreation2((k8, l8) => { 3010 Column.create(); 3011 Column.direction(this.counterDirection); 3012 Column.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH); 3013 Column.height(CounterResource.COUNTER_INLINE_CONTAINER_HEIGHT); 3014 Column.borderWidth({ start: LengthMetrics.vp(CounterResource.COUNTER_BORDER_WIDTH_NUMBER) }); 3015 Column.borderColor(CounterResource.COUNTER_BORDER_COLOR); 3016 }, Column); 3017 this.observeComponentCreation2((i8, j8) => { 3018 Stack.create(); 3019 Stack.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH); 3020 Stack.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT); 3021 Stack.padding({ top: '1vp' }); 3022 Stack.borderWidth({ bottom: '1vp' }); 3023 Stack.borderColor(CounterResource.COUNTER_BORDER_COLOR); 3024 Stack.clip(true); 3025 }, Stack); 3026 this.observeComponentCreation2((g8, h8) => { 3027 Rect.create(); 3028 Rect.direction(this.counterDirection); 3029 Rect.width(CounterResource.COUNTER_INLINE_FOCUS_BORDER_WIDTH); 3030 Rect.height(CounterResource.COUNTER_INLINE_FOCUS_BORDER_HEIGHT); 3031 Rect.radius([ 3032 ['0vp', '0vp'], 3033 [CounterResource.COUNTER_INLINE_RADIUS, CounterResource.COUNTER_INLINE_RADIUS], 3034 ['0vp', '0vp'], 3035 ['0vp', '0vp'] 3036 ]); 3037 Rect.strokeWidth(this.addBtnFocusWidh); 3038 Rect.stroke(CounterResource.BUTTON_BORDER_FOCUSED_COLOR); 3039 Rect.margin({ end: LengthMetrics.vp(1) }); 3040 Rect.fillOpacity(0); 3041 }, Rect); 3042 this.observeComponentCreation2((e8, f8) => { 3043 Image.create(CounterResource.BUTTON_ARROW_UP); 3044 Image.direction(this.counterDirection); 3045 Image.width(CounterResource.COUNTER_INLINE_BUTTON_ICON_WIDTH); 3046 Image.height(CounterResource.COUNTER_INLINE_BUTTON_ICON_HEIGHT); 3047 Image.fillColor(CounterResource.BUTTON_ICON_COLOR); 3048 Image.opacity(this.addOpacity); 3049 }, Image); 3050 this.observeComponentCreation2((s7, t7) => { 3051 Button.createWithLabel({ type: ButtonType.Normal, stateEffect: this.addBtnStateEffect }); 3052 Button.direction(this.counterDirection); 3053 Button.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH); 3054 Button.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT); 3055 Button.backgroundColor(Color.Transparent); 3056 Button.opacity(this.addOpacity); 3057 Button.enabled(this.addBtnEnabled); 3058 Button.onClick((c8) => { 3059 this.addDate(); 3060 if (c8.source === SourceType.Mouse || 3061 c8.source === SourceType.TouchScreen) { 3062 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 3063 } 3064 }); 3065 Gesture.create(GesturePriority.Low); 3066 LongPressGesture.create({ repeat: true }); 3067 LongPressGesture.onAction((a8) => { 3068 if (a8.repeat) { 3069 this.addDate(); 3070 } 3071 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 3072 }); 3073 LongPressGesture.pop(); 3074 Gesture.pop(); 3075 Button.hoverEffect(this.choverEffect); 3076 Button.onHover((z7) => { 3077 this.onHoverIncrease && this.onHoverIncrease(z7); 3078 }); 3079 Button.focusable(false); 3080 Button.onFocus(() => { 3081 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH; 3082 this.onFocusIncrease && this.onFocusIncrease(); 3083 }); 3084 Button.onBlur(() => { 3085 this.addBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 3086 this.onBlurIncrease && this.onBlurIncrease(); 3087 }); 3088 }, Button); 3089 Button.pop(); 3090 Stack.pop(); 3091 this.observeComponentCreation2((q7, r7) => { 3092 Stack.create(); 3093 Stack.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH); 3094 Stack.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT); 3095 Stack.clip(true); 3096 }, Stack); 3097 this.observeComponentCreation2((o7, p7) => { 3098 Rect.create(); 3099 Rect.direction(this.counterDirection); 3100 Rect.width(CounterResource.COUNTER_INLINE_FOCUS_BORDER_WIDTH); 3101 Rect.height(CounterResource.COUNTER_INLINE_FOCUS_BORDER_HEIGHT); 3102 Rect.radius([ 3103 ['0vp', '0vp'], 3104 ['0vp', '0vp'], 3105 [CounterResource.COUNTER_INLINE_RADIUS, CounterResource.COUNTER_INLINE_RADIUS], 3106 ['0vp', '0vp'] 3107 ]); 3108 Rect.strokeWidth(this.subBtnFocusWidh); 3109 Rect.stroke(CounterResource.BUTTON_BORDER_FOCUSED_COLOR); 3110 Rect.margin({ 3111 top: LengthMetrics.vp(1), 3112 end: LengthMetrics.vp(1), 3113 bottom: LengthMetrics.vp(2) 3114 }); 3115 Rect.fillOpacity(0); 3116 }, Rect); 3117 this.observeComponentCreation2((m7, n7) => { 3118 Image.create(CounterResource.BUTTON_ARROW_DOWN); 3119 Image.direction(this.counterDirection); 3120 Image.width(CounterResource.COUNTER_INLINE_BUTTON_ICON_WIDTH); 3121 Image.height(CounterResource.COUNTER_INLINE_BUTTON_ICON_HEIGHT); 3122 Image.fillColor(CounterResource.BUTTON_ICON_COLOR); 3123 Image.opacity(this.subOpacity); 3124 }, Image); 3125 this.observeComponentCreation2((a7, b7) => { 3126 Button.createWithLabel({ type: ButtonType.Normal, stateEffect: this.subBtnStateEffect }); 3127 Button.direction(this.counterDirection); 3128 Button.width(CounterResource.COUNTER_INLINE_BUTTON_WIDTH); 3129 Button.height(CounterResource.COUNTER_INLINE_BUTTON_HEIGHT); 3130 Button.backgroundColor(Color.Transparent); 3131 Button.opacity(this.subOpacity); 3132 Button.enabled(this.subBtnEnabled); 3133 Button.onClick((k7) => { 3134 this.subDate(); 3135 if (k7.source === SourceType.Mouse || 3136 k7.source === SourceType.TouchScreen) { 3137 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 3138 } 3139 }); 3140 Gesture.create(GesturePriority.Low); 3141 LongPressGesture.create({ repeat: true }); 3142 LongPressGesture.onAction((i7) => { 3143 if (i7.repeat) { 3144 this.subDate(); 3145 } 3146 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 3147 }); 3148 LongPressGesture.pop(); 3149 Gesture.pop(); 3150 Button.hoverEffect(this.choverEffect); 3151 Button.onHover((h7) => { 3152 this.onHoverDecrease && this.onHoverDecrease(h7); 3153 }); 3154 Button.focusable(false); 3155 Button.onFocus(() => { 3156 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_FOCUSED_WIDTH; 3157 this.onFocusDecrease && this.onFocusDecrease(); 3158 }); 3159 Button.onBlur(() => { 3160 this.subBtnFocusWidh = CounterResource.BUTTON_BORDER_BLUR_WIDTH; 3161 this.onBlurDecrease && this.onBlurDecrease(); 3162 }); 3163 }, Button); 3164 Button.pop(); 3165 Stack.pop(); 3166 Column.pop(); 3167 Row.pop(); 3168 }); 3169 } 3170 else { 3171 this.ifElseBranchUpdateFunction(4, () => { 3172 }); 3173 } 3174 }, If); 3175 If.pop(); 3176 } 3177 3178 rerender() { 3179 this.updateDirtyElements(); 3180 } 3181} 3182 3183export default {CounterType, CommonOptions, InlineStyleOptions, NumberStyleOptions, 3184 DateData, DateStyleOptions, CounterOptions, CounterComponent}; 3185