@flexem/fc-gui 3.0.0-alpha.16 → 3.0.0-alpha.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +492 -69
- package/README.md +4 -4
- package/assets/img/alert.svg +18 -18
- package/assets/img/black_first_page.png +0 -0
- package/assets/img/black_last_page.png +0 -0
- package/assets/img/black_next_page.png +0 -0
- package/assets/img/black_previous_page.png +0 -0
- package/assets/img/first_page.svg +19 -19
- package/assets/img/last_page.svg +19 -19
- package/assets/img/next_page.svg +14 -14
- package/assets/img/previous_page.svg +14 -14
- package/bundles/@flexem/fc-gui.umd.js +25472 -20764
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +5 -5
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/communication/index.d.ts +1 -1
- package/communication/index.js +1 -1
- package/communication/variable/index.d.ts +5 -5
- package/communication/variable/index.js +4 -4
- package/communication/variable/variable-communicator.d.ts +16 -12
- package/communication/variable/variable-definition.d.ts +10 -10
- package/communication/variable/variable-definition.js +14 -14
- package/communication/variable/variable-state-enum.d.ts +8 -7
- package/communication/variable/variable-state-enum.js +9 -8
- package/communication/variable/variable-state-enum.metadata.json +1 -1
- package/communication/variable/variable-state.d.ts +6 -6
- package/communication/variable/variable-state.js +6 -6
- package/communication/variable/variable-value.d.ts +11 -8
- package/communication/variable/variable-value.js +11 -8
- package/communication/variable/variable-value.metadata.json +1 -1
- package/config/alarm/alarm.store.d.ts +6 -0
- package/config/alarm/alarm.store.js +0 -0
- package/config/alarm/alarm.store.metadata.json +1 -0
- package/config/alarm/get-alarms-args.d.ts +12 -0
- package/config/alarm/get-alarms-args.js +13 -0
- package/config/alarm/get-alarms-args.metadata.json +1 -0
- package/config/alarm/index.d.ts +2 -0
- package/config/alarm/index.js +1 -0
- package/config/alarm/index.metadata.json +1 -0
- package/config/config-store.d.ts +17 -15
- package/config/graph/graph-result.d.ts +9 -9
- package/config/graph/graph-result.js +13 -13
- package/config/graph/graph-store.d.ts +9 -9
- package/config/graph/graph-type.d.ts +4 -4
- package/config/graph/graph-type.js +5 -5
- package/config/graph/graph.d.ts +6 -6
- package/config/graph/graph.js +6 -6
- package/config/gui-feature-config.d.ts +3 -0
- package/config/gui-feature-config.js +3 -0
- package/config/gui-feature-config.metadata.json +1 -0
- package/config/history-data/get-history-data-args.d.ts +22 -22
- package/config/history-data/get-history-data-args.js +21 -21
- package/config/history-data/historical-curve.time-range.d.ts +18 -18
- package/config/history-data/historical-curve.time-range.js +19 -19
- package/config/history-data/history-data-value.d.ts +6 -6
- package/config/history-data/history-data-value.js +6 -6
- package/config/history-data/history-data.model.d.ts +7 -7
- package/config/history-data/history-data.model.js +7 -7
- package/config/history-data/history-data.store.d.ts +10 -10
- package/config/history-data/index.d.ts +4 -4
- package/config/history-data/index.js +3 -3
- package/config/image/image-store.d.ts +6 -6
- package/config/index.d.ts +12 -10
- package/config/index.js +8 -6
- package/config/index.metadata.json +1 -1
- package/config/variable/get-variable-name-args.d.ts +6 -6
- package/config/variable/get-variable-name-args.js +7 -7
- package/config/variable/index.d.ts +2 -2
- package/config/variable/index.js +1 -1
- package/config/variable/variable-store.d.ts +8 -7
- package/config/view/view-store.d.ts +20 -20
- package/config/view/view.model.d.ts +4 -4
- package/config/view/view.model.js +5 -5
- package/core/index.d.ts +1 -1
- package/core/index.js +1 -1
- package/core/stringifying-map.d.ts +11 -11
- package/core/stringifying-map.js +24 -24
- package/core/stringifying-set.d.ts +10 -10
- package/core/stringifying-set.js +21 -21
- package/elements/air-quality/air-quality-element.d.ts +31 -0
- package/elements/air-quality/air-quality-element.js +194 -0
- package/elements/air-quality/air-quality-element.metadata.json +1 -0
- package/elements/alarm/alarm-element.d.ts +69 -0
- package/elements/alarm/alarm-element.js +497 -0
- package/elements/alarm/alarm-element.metadata.json +1 -0
- package/elements/bar-graph-element.d.ts +29 -21
- package/elements/bar-graph-element.js +244 -114
- package/elements/bar-graph-element.metadata.json +1 -1
- package/elements/base/base-element.d.ts +11 -11
- package/elements/base/base-element.js +9 -9
- package/elements/base/conditional-control-element.d.ts +16 -16
- package/elements/base/conditional-control-element.js +87 -87
- package/elements/base/conditional-display-element.d.ts +24 -24
- package/elements/base/conditional-display-element.js +86 -86
- package/elements/base/conditional-dynamic-display-element.d.ts +26 -26
- package/elements/base/conditional-dynamic-display-element.js +142 -142
- package/elements/base/conditional-enable-element.d.ts +21 -21
- package/elements/base/conditional-enable-element.js +100 -100
- package/elements/base/index.d.ts +3 -3
- package/elements/base/index.js +3 -3
- package/elements/base/readable-element.d.ts +20 -15
- package/elements/base/readable-element.js +122 -58
- package/elements/base/readable-element.metadata.json +1 -1
- package/elements/base/state-control-element.d.ts +26 -24
- package/elements/base/state-control-element.js +196 -180
- package/elements/character-display/character-display-element.d.ts +35 -35
- package/elements/character-display/character-display-element.js +312 -311
- package/elements/character-display/character-display-element.metadata.json +1 -1
- package/elements/datetime-display/datetime-display-element.d.ts +22 -21
- package/elements/datetime-display/datetime-display-element.js +140 -132
- package/elements/datetime-display/datetime-display-element.metadata.json +1 -1
- package/elements/datetime-display/time-zone-select-json.d.ts +8 -0
- package/elements/datetime-display/time-zone-select-json.js +558 -0
- package/elements/historical-curve/historical-curve-element-status.d.ts +6 -6
- package/elements/historical-curve/historical-curve-element-status.js +7 -7
- package/elements/historical-curve/historical-curve.element.d.ts +96 -59
- package/elements/historical-curve/historical-curve.element.js +990 -364
- package/elements/historical-curve/historical-curve.element.metadata.json +1 -1
- package/elements/historical-curve/historical-curve.element.option.d.ts +13 -13
- package/elements/historical-curve/historical-curve.time-period.d.ts +4 -4
- package/elements/main-element.d.ts +46 -45
- package/elements/main-element.js +373 -307
- package/elements/main-element.metadata.json +1 -1
- package/elements/meter-element.d.ts +26 -20
- package/elements/meter-element.js +139 -70
- package/elements/meter-element.metadata.json +1 -1
- package/elements/numerical-display/numerical-display-element.d.ts +60 -41
- package/elements/numerical-display/numerical-display-element.js +476 -361
- package/elements/numerical-display/numerical-display-element.metadata.json +1 -1
- package/elements/per-view-variable-communicator.d.ts +20 -17
- package/elements/per-view-variable-communicator.js +59 -45
- package/elements/per-view-variable-communicator.metadata.json +1 -1
- package/elements/pipe/pipe-element.d.ts +19 -19
- package/elements/pipe/pipe-element.js +141 -141
- package/elements/ring-graph/ring-graph-element.d.ts +31 -19
- package/elements/ring-graph/ring-graph-element.js +250 -89
- package/elements/ring-graph/ring-graph-element.metadata.json +1 -1
- package/elements/scroll-alarm/scroll-alarm-element.d.ts +74 -0
- package/elements/scroll-alarm/scroll-alarm-element.js +761 -0
- package/elements/scroll-alarm/scroll-alarm-element.metadata.json +1 -0
- package/elements/shared/graph/graph-state-element.d.ts +28 -27
- package/elements/shared/graph/graph-state-element.js +139 -110
- package/elements/shared/graph/graph-state-element.metadata.json +1 -1
- package/elements/shared/math-utils.d.ts +2 -2
- package/elements/shared/math-utils.js +14 -14
- package/elements/shared/text/text-element.d.ts +22 -8
- package/elements/shared/text/text-element.js +106 -68
- package/elements/shared/text/text-element.metadata.json +1 -1
- package/elements/shared/text/text-state-element.d.ts +58 -23
- package/elements/shared/text/text-state-element.js +286 -136
- package/elements/shared/text/text-state-element.metadata.json +1 -1
- package/elements/shared/text/text-state.model.d.ts +5 -5
- package/elements/shared/text/text-utils.d.ts +5 -5
- package/elements/shared/text/text-utils.js +45 -45
- package/elements/static-elements/hyperlink-element.d.ts +40 -14
- package/elements/static-elements/hyperlink-element.js +197 -48
- package/elements/static-elements/hyperlink-element.metadata.json +1 -1
- package/elements/static-elements/image-element.d.ts +14 -14
- package/elements/static-elements/image-element.js +41 -41
- package/elements/static-elements/text-element.d.ts +42 -16
- package/elements/static-elements/text-element.js +205 -55
- package/elements/static-elements/text-element.metadata.json +1 -1
- package/elements/switch-indicator-light/bit-indicator-light-operator.d.ts +21 -20
- package/elements/switch-indicator-light/bit-indicator-light-operator.js +85 -78
- package/elements/switch-indicator-light/bit-indicator-light-operator.metadata.json +1 -1
- package/elements/switch-indicator-light/bit-switch-operator.d.ts +19 -19
- package/elements/switch-indicator-light/bit-switch-operator.js +107 -107
- package/elements/switch-indicator-light/current-stateId-value.d.ts +6 -6
- package/elements/switch-indicator-light/current-stateId-value.js +8 -8
- package/elements/switch-indicator-light/indicator-light-operator.d.ts +8 -8
- package/elements/switch-indicator-light/switch-indicator-light-element.d.ts +48 -39
- package/elements/switch-indicator-light/switch-indicator-light-element.js +302 -251
- package/elements/switch-indicator-light/switch-indicator-light-element.metadata.json +1 -1
- package/elements/switch-indicator-light/switch-operator.d.ts +6 -6
- package/elements/switch-indicator-light/word-indicator-light-operator.d.ts +19 -18
- package/elements/switch-indicator-light/word-indicator-light-operator.js +72 -65
- package/elements/switch-indicator-light/word-indicator-light-operator.metadata.json +1 -1
- package/elements/switch-indicator-light/word-switch-operator.d.ts +18 -18
- package/elements/switch-indicator-light/word-switch-operator.js +75 -75
- package/elements/table/table-element.d.ts +9 -9
- package/elements/table/table-element.js +6 -6
- package/elements/vector-graphics/ellipse-element.d.ts +9 -9
- package/elements/vector-graphics/ellipse-element.js +6 -6
- package/elements/vector-graphics/poly-line-element.d.ts +12 -12
- package/elements/vector-graphics/poly-line-element.js +19 -19
- package/elements/vector-graphics/polygon-element.d.ts +12 -12
- package/elements/vector-graphics/polygon-element.js +19 -19
- package/elements/vector-graphics/rectangle-element.d.ts +9 -9
- package/elements/vector-graphics/rectangle-element.js +6 -6
- package/elements/vector-graphics/sector-element.d.ts +9 -9
- package/elements/vector-graphics/sector-element.js +6 -6
- package/elements/vector-graphics/straight-line-element.d.ts +12 -12
- package/elements/vector-graphics/straight-line-element.js +19 -19
- package/elements/video/video-element.d.ts +37 -27
- package/elements/video/video-element.js +258 -160
- package/elements/video/video-element.metadata.json +1 -1
- package/elements/view-operation/view-operation.element.d.ts +62 -36
- package/elements/view-operation/view-operation.element.js +348 -194
- package/elements/view-operation/view-operation.element.metadata.json +1 -1
- package/elements/weather/weater-element.d.ts +38 -38
- package/elements/weather/weater-element.js +237 -238
- package/gui/gui-context.d.ts +33 -16
- package/gui/gui-host.d.ts +50 -50
- package/gui/gui-host.js +173 -173
- package/gui/gui-view.d.ts +45 -42
- package/gui/gui-view.js +265 -204
- package/gui/gui-view.metadata.json +1 -1
- package/gui/gui.component.d.ts +45 -42
- package/gui/gui.component.html +3 -3
- package/gui/gui.component.js +240 -227
- package/gui/gui.component.metadata.json +1 -1
- package/gui/interfaces/gui-options.d.ts +6 -6
- package/gui.module.d.ts +2 -2
- package/gui.module.js +78 -78
- package/localization/index.d.ts +2 -2
- package/localization/index.js +2 -2
- package/localization/localization.service.d.ts +62 -51
- package/localization/localization.service.js +61 -50
- package/localization/localization.service.metadata.json +1 -1
- package/localization/localization.service.zh_CN.d.ts +2 -2
- package/localization/localization.service.zh_CN.js +59 -48
- package/localization/localization.service.zh_CN.metadata.json +1 -1
- package/logger/console-logger.service.d.ts +13 -13
- package/logger/console-logger.service.js +38 -38
- package/logger/index.d.ts +2 -2
- package/logger/index.js +2 -2
- package/logger/logger.service.d.ts +14 -14
- package/logger/logger.service.js +2 -2
- package/modal/alert/alert-modal.component.d.ts +10 -10
- package/modal/alert/alert-modal.component.html +11 -11
- package/modal/alert/alert-modal.component.js +38 -38
- package/modal/alert/alert-modal.component.less +59 -59
- package/modal/confirm-operation/confirm-operation-modal.component.d.ts +10 -10
- package/modal/confirm-operation/confirm-operation-modal.component.html +16 -16
- package/modal/confirm-operation/confirm-operation-modal.component.js +41 -41
- package/modal/confirm-operation/confirm-operation-modal.component.less +58 -58
- package/modal/verify-password/verify-password-modal.component.d.ts +18 -18
- package/modal/verify-password/verify-password-modal.component.html +22 -22
- package/modal/verify-password/verify-password-modal.component.js +66 -66
- package/modal/verify-password/verify-password-modal.component.less +65 -65
- package/modal/write-character/write-character-modal-args.d.ts +7 -7
- package/modal/write-character/write-character-modal-args.js +8 -8
- package/modal/write-character/write-character-modal.component.d.ts +25 -25
- package/modal/write-character/write-character-modal.component.html +21 -21
- package/modal/write-character/write-character-modal.component.js +74 -74
- package/modal/write-character/write-character-modal.component.less +49 -49
- package/modal/write-value/write-value-modal-args.d.ts +16 -12
- package/modal/write-value/write-value-modal-args.js +14 -12
- package/modal/write-value/write-value-modal-args.metadata.json +1 -1
- package/modal/write-value/write-value-modal.component.d.ts +60 -54
- package/modal/write-value/write-value-modal.component.html +26 -21
- package/modal/write-value/write-value-modal.component.js +279 -204
- package/modal/write-value/write-value-modal.component.less +56 -56
- package/modal/write-value/write-value-modal.component.metadata.json +1 -1
- package/modal/write-value/write-value-model-result.d.ts +3 -3
- package/model/air-quality/air-quality-info.d.ts +23 -0
- package/model/air-quality/air-quality-info.js +4 -0
- package/model/air-quality/air-quality-info.metadata.json +1 -0
- package/model/air-quality/air-quality.model.d.ts +7 -0
- package/model/air-quality/air-quality.model.js +0 -0
- package/model/air-quality/air-quality.model.metadata.json +1 -0
- package/model/alarm/alarm.model.d.ts +13 -0
- package/model/alarm/alarm.model.js +0 -0
- package/model/alarm/alarm.model.metadata.json +1 -0
- package/model/bar-graph/FontStyleData.d.ts +7 -7
- package/model/bar-graph/bar-graph-direction.d.ts +6 -6
- package/model/bar-graph/bar-graph-direction.js +7 -7
- package/model/bar-graph/bar-graph.d.ts +26 -22
- package/model/base/base-element-model.d.ts +5 -5
- package/model/base/base-element-model.js +2 -2
- package/model/base/conditional-control-model.d.ts +6 -6
- package/model/base/conditional-display-model.d.ts +9 -9
- package/model/base/conditional-dynamic-display-model.d.ts +13 -13
- package/model/base/conditional-enable-model.d.ts +9 -9
- package/model/base/font-setting-model.d.ts +29 -8
- package/model/base/font-setting-model.metadata.json +1 -1
- package/model/base/index.d.ts +7 -7
- package/model/base/index.js +1 -1
- package/model/base/readable-model.d.ts +14 -10
- package/model/base/security-model.d.ts +6 -6
- package/model/character-display/character-display.d.ts +19 -19
- package/model/datetime-display/date-format-type.d.ts +5 -5
- package/model/datetime-display/date-format-type.js +6 -6
- package/model/datetime-display/datetime-display-settings.d.ts +17 -17
- package/model/datetime-display/datetime-display.d.ts +21 -20
- package/model/datetime-display/datetime-separator-type.d.ts +6 -6
- package/model/datetime-display/datetime-separator-type.js +7 -7
- package/model/datetime-display/time-format-type.d.ts +4 -4
- package/model/datetime-display/time-format-type.js +5 -5
- package/model/historical-curve/curve-type.d.ts +5 -5
- package/model/historical-curve/curve-type.js +6 -6
- package/model/historical-curve/historical-curve-axis-settings.d.ts +17 -6
- package/model/historical-curve/historical-curve-axis-settings.js +5 -0
- package/model/historical-curve/historical-curve-axis-settings.metadata.json +1 -1
- package/model/historical-curve/historical-curve-chanel.model.d.ts +22 -14
- package/model/historical-curve/historical-curve.data-settings.d.ts +9 -9
- package/model/historical-curve/historical-curve.display-settings.d.ts +19 -19
- package/model/historical-curve/historical-curve.model.d.ts +8 -8
- package/model/historical-curve/index.d.ts +4 -4
- package/model/hyperlink/hyperlink.model.d.ts +8 -8
- package/model/image/image-fill-type.d.ts +4 -4
- package/model/image/image-fill-type.js +5 -5
- package/model/image/image.d.ts +9 -9
- package/model/index.d.ts +15 -15
- package/model/index.js +8 -8
- package/model/meter/meter.d.ts +17 -13
- package/model/numerical-display/index.d.ts +8 -8
- package/model/numerical-display/index.js +2 -2
- package/model/numerical-display/numerical-display.d.ts +29 -29
- package/model/numerical-display/numerical-operation-settings.d.ts +6 -6
- package/model/numerical-display/numerical-operation-type.d.ts +4 -4
- package/model/numerical-display/numerical-operation-type.js +5 -5
- package/model/numerical-display/numerical-operation.d.ts +19 -11
- package/model/numerical-display/proportional-conversion.d.ts +4 -4
- package/model/numerical-display/type-settings.d.ts +6 -6
- package/model/numerical-display/zoom.d.ts +4 -4
- package/model/pipe/flow-direction-type.d.ts +4 -4
- package/model/pipe/flow-direction-type.js +5 -5
- package/model/pipe/index.d.ts +2 -2
- package/model/pipe/index.js +1 -1
- package/model/pipe/pipe.d.ts +17 -17
- package/model/poly-line/poly-line-model.d.ts +4 -4
- package/model/polygon/polygon-model.d.ts +4 -4
- package/model/ring-graph/ring-graph.model.d.ts +33 -25
- package/model/scroll-alarm/scroll-alarm.model.d.ts +21 -0
- package/model/scroll-alarm/scroll-alarm.model.js +0 -0
- package/model/scroll-alarm/scroll-alarm.model.metadata.json +1 -0
- package/model/settings/background/view-background-fill-type.d.ts +5 -5
- package/model/settings/background/view-background-fill-type.js +6 -6
- package/model/settings/background/view-background.model.d.ts +8 -8
- package/model/settings/index.d.ts +3 -3
- package/model/settings/index.js +2 -2
- package/model/settings/popup/view-popup-backdrop-type.d.ts +4 -4
- package/model/settings/popup/view-popup-backdrop-type.js +5 -5
- package/model/settings/popup/view-popup-location-type.d.ts +4 -4
- package/model/settings/popup/view-popup-location-type.js +5 -5
- package/model/settings/popup/view-popup-setting.model.d.ts +17 -17
- package/model/settings/popup/view-popup-setting.model.js +2 -2
- package/model/settings/view-settings.model.d.ts +6 -6
- package/model/shared/alarm/alarm-range.model.d.ts +6 -6
- package/model/shared/arc.model.d.ts +4 -4
- package/model/shared/binary.d.ts +7 -7
- package/model/shared/binary.js +37 -37
- package/model/shared/condition/bit-condition-item-observer.d.ts +14 -14
- package/model/shared/condition/bit-condition-item-observer.js +53 -53
- package/model/shared/condition/bit-condition-logic.d.ts +4 -4
- package/model/shared/condition/bit-condition-logic.js +5 -5
- package/model/shared/condition/bit-condition-model.d.ts +8 -8
- package/model/shared/condition/bit-condition.d.ts +4 -4
- package/model/shared/condition/condition-control-result-value.d.ts +5 -5
- package/model/shared/condition/condition-helper.d.ts +4 -4
- package/model/shared/condition/condition-helper.js +22 -22
- package/model/shared/condition/condition-item-model.d.ts +10 -10
- package/model/shared/condition/condition-item-observer.d.ts +12 -12
- package/model/shared/condition/condition-item-observer.js +14 -14
- package/model/shared/condition/condition-items-observer.d.ts +5 -5
- package/model/shared/condition/condition-items-result-observer.d.ts +16 -16
- package/model/shared/condition/condition-items-result-observer.js +87 -87
- package/model/shared/condition/condition-model.d.ts +6 -6
- package/model/shared/condition/condition-type.d.ts +4 -4
- package/model/shared/condition/condition-type.js +5 -5
- package/model/shared/condition/convert-condition-model.d.ts +5 -5
- package/model/shared/condition/index.d.ts +11 -11
- package/model/shared/condition/index.js +4 -4
- package/model/shared/condition/relation-condition-result-state.d.ts +6 -6
- package/model/shared/condition/relation-condition-result-state.js +8 -8
- package/model/shared/condition/relation-condition-result.d.ts +8 -8
- package/model/shared/condition/relation-condition-result.js +7 -7
- package/model/shared/condition/relation-type.d.ts +5 -5
- package/model/shared/condition/relation-type.js +6 -6
- package/model/shared/condition/relational-operator.d.ts +8 -8
- package/model/shared/condition/relational-operator.js +9 -9
- package/model/shared/condition/variable-value-logic-model.d.ts +11 -11
- package/model/shared/condition/variable-value-type.d.ts +4 -4
- package/model/shared/condition/variable-value-type.js +5 -5
- package/model/shared/condition/word-condition-item-observer.d.ts +21 -21
- package/model/shared/condition/word-condition-item-observer.js +165 -165
- package/model/shared/condition/word-condition-model.d.ts +8 -8
- package/model/shared/condition/word-condition.d.ts +5 -5
- package/model/shared/data-type/display-data-type.d.ts +5 -5
- package/model/shared/data-type/display-data-type.js +6 -6
- package/model/shared/data-type/fbox-data-type.d.ts +15 -15
- package/model/shared/data-type/fbox-data-type.js +16 -16
- package/model/shared/data-type/fcloud-data-Type.d.ts +8 -8
- package/model/shared/data-type/fcloud-data-Type.js +9 -9
- package/model/shared/dynamic-display/dynamic-behavior-type.d.ts +5 -5
- package/model/shared/dynamic-display/dynamic-behavior-type.js +6 -6
- package/model/shared/dynamic-display/dynamic-display-behavior-model.d.ts +5 -5
- package/model/shared/dynamic-display/dynamic-display-model.d.ts +10 -10
- package/model/shared/dynamic-display/dynamic-display-result-model.d.ts +7 -7
- package/model/shared/dynamic-display/dynamic-display-result-model.js +7 -7
- package/model/shared/dynamic-display/dynamic-display.d.ts +11 -11
- package/model/shared/dynamic-display/dynamic-display.js +35 -35
- package/model/shared/graph/custom-style.d.ts +14 -14
- package/model/shared/graph/graph-setting.d.ts +10 -10
- package/model/shared/index.d.ts +8 -8
- package/model/shared/index.js +3 -3
- package/model/shared/point.model.d.ts +4 -4
- package/model/shared/rotation/rotation-behavior-model.d.ts +4 -4
- package/model/shared/rotation/rotation-behavior.d.ts +9 -9
- package/model/shared/rotation/rotation-behavior.js +101 -101
- package/model/shared/rotation/rotation-direction-type.d.ts +4 -4
- package/model/shared/rotation/rotation-direction-type.js +5 -5
- package/model/shared/rotation/rotation-model.d.ts +14 -14
- package/model/shared/rotation/rotation-observer-model.d.ts +4 -4
- package/model/shared/rotation/rotation-observer.d.ts +11 -11
- package/model/shared/rotation/rotation-observer.js +28 -28
- package/model/shared/scale/scale-mark.model.d.ts +6 -6
- package/model/shared/scale/scale-model.d.ts +20 -20
- package/model/shared/size.model.d.ts +7 -7
- package/model/shared/size.model.js +12 -12
- package/model/shared/state/index.d.ts +1 -1
- package/model/shared/state/index.js +1 -1
- package/model/shared/state/state.d.ts +9 -8
- package/model/shared/state/state.js +10 -9
- package/model/shared/state/state.metadata.json +1 -1
- package/model/shared/text/font.d.ts +10 -10
- package/model/shared/text/index.d.ts +2 -2
- package/model/shared/text/text.d.ts +8 -5
- package/model/shared/translation/translation-behavior-model.d.ts +4 -4
- package/model/shared/translation/translation-behavior.d.ts +12 -12
- package/model/shared/translation/translation-behavior.js +63 -63
- package/model/shared/translation/translation-direction-type.d.ts +4 -4
- package/model/shared/translation/translation-direction-type.js +5 -5
- package/model/shared/translation/translation-model.d.ts +12 -12
- package/model/shared/translation/translation-observer-model.d.ts +4 -4
- package/model/shared/translation/translation-observer.d.ts +10 -10
- package/model/shared/translation/translation-observer.js +27 -27
- package/model/shared/variable/variable-identifier.model.d.ts +5 -5
- package/model/shared/variable/variable-name.model.d.ts +5 -5
- package/model/straight-line/straight-line-model.d.ts +4 -4
- package/model/switch-indicator-light/bit-indicator-light-settings.d.ts +8 -8
- package/model/switch-indicator-light/bit-switch-operation.d.ts +6 -6
- package/model/switch-indicator-light/bit-switch-operation.js +7 -7
- package/model/switch-indicator-light/bit-switch-settings.d.ts +11 -11
- package/model/switch-indicator-light/fault-flicker.d.ts +5 -5
- package/model/switch-indicator-light/flicker.d.ts +5 -5
- package/model/switch-indicator-light/flicker.js +6 -6
- package/model/switch-indicator-light/index.d.ts +14 -14
- package/model/switch-indicator-light/index.js +5 -5
- package/model/switch-indicator-light/indicator-light-fault-flicker.d.ts +5 -5
- package/model/switch-indicator-light/indicator-light-settings.d.ts +7 -7
- package/model/switch-indicator-light/indicator-light-type.d.ts +4 -4
- package/model/switch-indicator-light/indicator-light-type.js +5 -5
- package/model/switch-indicator-light/switch-indicator-light.d.ts +35 -33
- package/model/switch-indicator-light/switch-indicator-state.d.ts +8 -8
- package/model/switch-indicator-light/switch-settings.d.ts +7 -7
- package/model/switch-indicator-light/switch-type.d.ts +4 -4
- package/model/switch-indicator-light/switch-type.js +5 -5
- package/model/switch-indicator-light/word-indicator-light-settings.d.ts +6 -6
- package/model/switch-indicator-light/word-switch-operation.d.ts +5 -5
- package/model/switch-indicator-light/word-switch-operation.js +6 -6
- package/model/switch-indicator-light/word-switch-settings.d.ts +13 -13
- package/model/table/table-model.d.ts +9 -9
- package/model/text/text.model.d.ts +7 -7
- package/model/video/video.model.d.ts +8 -8
- package/model/view-operation/index.d.ts +2 -2
- package/model/view-operation/index.js +1 -1
- package/model/view-operation/view-operation-element.model.d.ts +25 -19
- package/model/view-operation/view-operation-type.d.ts +18 -18
- package/model/view-operation/view-operation-type.js +19 -19
- package/model/weather/weather-info.d.ts +11 -11
- package/model/weather/weather-info.js +2 -2
- package/model/weather/weather.model.d.ts +7 -7
- package/package.json +1 -1
- package/public_api.d.ts +14 -14
- package/public_api.js +12 -11
- package/remote/communication/variable/remote-variable-communicator.d.ts +59 -30
- package/remote/communication/variable/remote-variable-communicator.js +395 -215
- package/remote/communication/variable/remote-variable-communicator.metadata.json +1 -1
- package/remote/communication/variable/remote-variable-protocol.d.ts +18 -13
- package/remote/config/graph/get-released-graph-state-result.d.ts +6 -6
- package/remote/config/graph/get-released-graph-states.d.ts +4 -4
- package/remote/config/graph/graph-state-key.d.ts +6 -6
- package/remote/config/graph/graph-state-result.d.ts +5 -5
- package/remote/config/graph/graph-state.d.ts +4 -4
- package/remote/config/graph/remote-graph-protocol.d.ts +11 -11
- package/remote/config/graph/remote-graph-store.d.ts +16 -16
- package/remote/config/graph/remote-graph-store.js +101 -101
- package/remote/config/image/remote-image-protocol.d.ts +4 -4
- package/remote/config/image/remote-image-store.d.ts +8 -8
- package/remote/config/image/remote-image-store.js +19 -19
- package/remote/config/view/remote-view-protocol.d.ts +8 -8
- package/remote/config/view/remote-view-store.d.ts +13 -13
- package/remote/config/view/remote-view-store.js +39 -39
- package/remote/config/view/view-result.d.ts +4 -4
- package/remote/index.d.ts +14 -14
- package/remote/index.js +4 -4
- package/security/index.d.ts +1 -1
- package/security/security-checker.d.ts +3 -3
- package/service/index.d.ts +8 -4
- package/service/index.js +1 -0
- package/service/index.metadata.json +1 -1
- package/service/language.service.d.ts +37 -0
- package/service/language.service.js +0 -0
- package/service/language.service.metadata.json +1 -0
- package/service/operation-record/create-operation-record-args.d.ts +5 -5
- package/service/operation-record/index.d.ts +3 -3
- package/service/operation-record/operation-record.service.d.ts +4 -4
- package/service/operation-record/variable-option.model.d.ts +5 -5
- package/service/permission-checker.d.ts +3 -3
- package/service/released-variable/index.d.ts +1 -0
- package/service/released-variable/index.js +0 -0
- package/service/released-variable/index.metadata.json +1 -0
- package/service/released-variable/released-variable.service.d.ts +4 -0
- package/service/released-variable/released-variable.service.js +0 -0
- package/service/released-variable/released-variable.service.metadata.json +1 -0
- package/service/system-text-library.service.d.ts +77 -0
- package/service/system-text-library.service.js +29 -0
- package/service/system-text-library.service.metadata.json +1 -0
- package/service/text-library.service.d.ts +49 -0
- package/service/text-library.service.js +0 -0
- package/service/text-library.service.metadata.json +1 -0
- package/service/video/index.d.ts +2 -2
- package/service/video/video-url.d.ts +4 -4
- package/service/video/video.service.d.ts +4 -4
- package/service/weather.service.d.ts +4 -3
- package/settings/display-mode.d.ts +10 -10
- package/settings/display-mode.js +11 -11
- package/settings/global-settings.d.ts +7 -7
- package/settings/global-settings.js +13 -13
- package/settings/index.d.ts +3 -3
- package/settings/index.js +3 -3
- package/settings/view-resize-mode.d.ts +10 -10
- package/settings/view-resize-mode.js +11 -11
- package/shared/config-is-empty-error.d.ts +3 -3
- package/shared/config-is-empty-error.js +7 -7
- package/shared/disposable.d.ts +3 -3
- package/shared/graph-extended-style.d.ts +4 -4
- package/shared/gui-consts.d.ts +33 -30
- package/shared/gui-consts.js +33 -30
- package/shared/gui-consts.metadata.json +1 -1
- package/shared/index.d.ts +5 -5
- package/shared/index.js +3 -3
- package/shared/operation-helper.d.ts +6 -6
- package/shared/operation-helper.js +38 -38
- package/utils/access-permission.d.ts +5 -5
- package/utils/access-permission.js +6 -6
- package/utils/access-permission.service.d.ts +11 -11
- package/utils/access-permission.service.js +30 -30
- package/utils/auto-focus.directive.d.ts +6 -6
- package/utils/auto-focus.directive.js +27 -27
- package/utils/bs-modal-drag.directive.d.ts +7 -7
- package/utils/bs-modal-drag.directive.js +38 -38
- package/utils/data-type/data-type.service.d.ts +57 -57
- package/utils/data-type/data-type.service.js +155 -155
- package/utils/data-type/fbox-data-type.service.d.ts +54 -54
- package/utils/data-type/fbox-data-type.service.js +300 -260
- package/utils/data-type/fcloud-data-type.service.d.ts +55 -55
- package/utils/data-type/fcloud-data-type.service.js +203 -203
- package/utils/fraction-digit.service.d.ts +41 -41
- package/utils/fraction-digit.service.js +133 -133
- package/utils/graph-util.d.ts +5 -5
- package/utils/graph-util.js +19 -19
- package/utils/guid.d.ts +6 -6
- package/utils/guid.js +27 -27
- package/utils/index.d.ts +7 -7
- package/utils/index.js +7 -7
- package/utils/numerical-operation-type.d.ts +4 -4
- package/utils/numerical-operation-type.js +5 -5
- package/utils/numerical-operation.service.d.ts +17 -17
- package/utils/numerical-operation.service.js +201 -177
- package/utils/variable-util.d.ts +5 -5
- package/utils/variable-util.js +11 -11
- package/view/popup-view.service.d.ts +7 -7
- package/view/view.service.d.ts +6 -6
- package/view/view.service.js +20 -20
|
@@ -1,364 +1,990 @@
|
|
|
1
|
-
import * as d3 from 'd3';
|
|
2
|
-
import { each, first, last } from 'lodash';
|
|
3
|
-
import * as moment from 'moment';
|
|
4
|
-
import * as nv from 'nvd3';
|
|
5
|
-
import { GetHistoryDataArgs } from '../../config';
|
|
6
|
-
import { HistoricalCurveTimeRange } from '../../config/history-data/historical-curve.time-range';
|
|
7
|
-
import { LOCALIZATION } from '../../localization';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (this.
|
|
55
|
-
this.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
timePeriods
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
this.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
this.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
if (this.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
this.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
this.
|
|
272
|
-
this.
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
.
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if (
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
1
|
+
import * as d3 from 'd3';
|
|
2
|
+
import { each, first, last } from 'lodash';
|
|
3
|
+
import * as moment from 'moment';
|
|
4
|
+
import * as nv from 'nvd3';
|
|
5
|
+
import { GetHistoryDataArgs } from '../../config';
|
|
6
|
+
import { HistoricalCurveTimeRange } from '../../config/history-data/historical-curve.time-range';
|
|
7
|
+
import { LOCALIZATION } from '../../localization';
|
|
8
|
+
import { SYSTEM_TEXT_LIBRARY_TYPES, TIME_PERIOD_KEYS } from '../../service';
|
|
9
|
+
import { ConditionalDisplayElement } from '../base/conditional-display-element';
|
|
10
|
+
import { HistoricalCurveElementStatus } from './historical-curve-element-status';
|
|
11
|
+
import { LOGGER_SERVICE_TOKEN } from '../../logger';
|
|
12
|
+
import { GlobalSettings, DisplayMode } from '../../settings';
|
|
13
|
+
import { CurveType } from '../../model/historical-curve/curve-type';
|
|
14
|
+
import { AxisRangeType } from '../../model/historical-curve/historical-curve-axis-settings';
|
|
15
|
+
export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
16
|
+
constructor(element, injector, permissionChecker, variableCommunicator, variableStore, historyDataStore, signalRAppId, systemTextLibraryService, languageService, guiContext) {
|
|
17
|
+
super(element, permissionChecker, variableCommunicator, variableStore, signalRAppId);
|
|
18
|
+
this.historyDataStore = historyDataStore;
|
|
19
|
+
this.systemTextLibraryService = systemTextLibraryService;
|
|
20
|
+
this.languageService = languageService;
|
|
21
|
+
this.guiContext = guiContext;
|
|
22
|
+
this.displayOption = {
|
|
23
|
+
dataLimit: 500,
|
|
24
|
+
dataZoomHeight: 32,
|
|
25
|
+
marginLeft: 40,
|
|
26
|
+
marginRight: 20,
|
|
27
|
+
mobileMinWidth: 450,
|
|
28
|
+
operationAreaHeight: 32,
|
|
29
|
+
operationAreaMarginTop: 25,
|
|
30
|
+
operationSelectFontSize: '16px',
|
|
31
|
+
operationButtonWidth: 24,
|
|
32
|
+
operationButtonHeight: 24,
|
|
33
|
+
operationButtonMargin: 4
|
|
34
|
+
};
|
|
35
|
+
this.customStartTime = null;
|
|
36
|
+
this.customEndTime = null;
|
|
37
|
+
this.elementStatus = HistoricalCurveElementStatus.Loading;
|
|
38
|
+
this.data = [];
|
|
39
|
+
this.needResize = true;
|
|
40
|
+
this.dropdownListEl = null;
|
|
41
|
+
this.dropdownTriggerEl = null;
|
|
42
|
+
this.setNeedResize = () => {
|
|
43
|
+
this.needResize = false;
|
|
44
|
+
setTimeout(() => this.needResize = true, 500);
|
|
45
|
+
};
|
|
46
|
+
this.logger = injector.get(LOGGER_SERVICE_TOKEN);
|
|
47
|
+
this.localization = injector.get(LOCALIZATION);
|
|
48
|
+
this.updateTimeRange(this.model.displaySetting.displayTimePeriod);
|
|
49
|
+
this.refreshIntervalId = setInterval(() => {
|
|
50
|
+
this.loadFirstPage();
|
|
51
|
+
this.logger.debug(`[GUI]Refresh Histoical Curve:${d3.time.format('%x %X')(new Date())}`);
|
|
52
|
+
}, this.model.displaySetting.refreshInterval * 1000);
|
|
53
|
+
this.isMobileMode = DisplayMode.Mobile === injector.get(GlobalSettings).displayMode;
|
|
54
|
+
if (this.isMobileMode) {
|
|
55
|
+
this.displayOption.operationAreaMarginTop = 35;
|
|
56
|
+
if (this.model.displaySetting.size.width >= this.displayOption.mobileMinWidth) {
|
|
57
|
+
this.displayOption.operationAreaHeight = 68;
|
|
58
|
+
this.displayOption.operationSelectFontSize = '24px';
|
|
59
|
+
this.displayOption.operationButtonWidth = 60;
|
|
60
|
+
this.displayOption.operationButtonHeight = 60;
|
|
61
|
+
this.displayOption.operationButtonMargin = 6;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// 初始化时间段数据(此时文本库可能未加载,先填充空文本占位)
|
|
65
|
+
this.timePeriods = this.getValidTimePeriods();
|
|
66
|
+
this.loadFirstPage();
|
|
67
|
+
this.initKeyboardListener();
|
|
68
|
+
// 订阅语种变化事件 和 文本库缓存更新事件
|
|
69
|
+
this.subscribeLanguageChange();
|
|
70
|
+
}
|
|
71
|
+
dispose() {
|
|
72
|
+
clearInterval(this.refreshIntervalId);
|
|
73
|
+
if (this.chartElement) {
|
|
74
|
+
this.chartElement.tooltip.hidden(true);
|
|
75
|
+
}
|
|
76
|
+
if (this.resizeEventListener) {
|
|
77
|
+
this.resizeEventListener.clear();
|
|
78
|
+
}
|
|
79
|
+
if (this.isAndroid) {
|
|
80
|
+
window.removeEventListener('native.keyboardshow', this.setNeedResize);
|
|
81
|
+
window.removeEventListener('native.keyboardhide', this.setNeedResize);
|
|
82
|
+
}
|
|
83
|
+
// 取消语种变化订阅
|
|
84
|
+
if (this.languageChangeSubscription) {
|
|
85
|
+
this.languageChangeSubscription.unsubscribe();
|
|
86
|
+
this.languageChangeSubscription = undefined;
|
|
87
|
+
}
|
|
88
|
+
this.logger.debug(`[GUI]Dispose Histoical Curve Refresh Interval:${d3.time.format('%x %X')(new Date())}`);
|
|
89
|
+
}
|
|
90
|
+
initKeyboardListener() {
|
|
91
|
+
this.isAndroid = !!navigator.userAgent.match(/(Android)/i);
|
|
92
|
+
if (this.isAndroid) {
|
|
93
|
+
window.addEventListener('native.keyboardshow', this.setNeedResize);
|
|
94
|
+
window.addEventListener('native.keyboardhide', this.setNeedResize);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* 订阅语种变化事件
|
|
99
|
+
*/
|
|
100
|
+
subscribeLanguageChange() {
|
|
101
|
+
var _a;
|
|
102
|
+
if (this.guiContext && this.guiContext.languageChanged$) {
|
|
103
|
+
this.languageChangeSubscription = this.guiContext.languageChanged$.subscribe(() => {
|
|
104
|
+
// 只更新时间段选择器的文案,不重新查询数据
|
|
105
|
+
this.updateLanguageTexts();
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
// 订阅文本库缓存更新事件,解决首次加载时文本库未就绪导致下拉选项为空的问题
|
|
109
|
+
if ((_a = this.systemTextLibraryService) === null || _a === void 0 ? void 0 : _a.cacheUpdated) {
|
|
110
|
+
const cacheSubscription = this.systemTextLibraryService.cacheUpdated.subscribe(() => {
|
|
111
|
+
this.updateLanguageTexts();
|
|
112
|
+
});
|
|
113
|
+
if (this.languageChangeSubscription) {
|
|
114
|
+
this.languageChangeSubscription.add(cacheSubscription);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
this.languageChangeSubscription = cacheSubscription;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* 更新语种相关的文案(时间段选择器)
|
|
123
|
+
*/
|
|
124
|
+
updateLanguageTexts() {
|
|
125
|
+
const updatedTimePeriods = this.getValidTimePeriods();
|
|
126
|
+
this.timePeriods = updatedTimePeriods;
|
|
127
|
+
// 更新下拉列表各选项文字
|
|
128
|
+
if (this.dropdownListEl) {
|
|
129
|
+
const items = this.dropdownListEl.querySelectorAll('.hc-dropdown-item');
|
|
130
|
+
items.forEach((item, i) => {
|
|
131
|
+
if (i < updatedTimePeriods.length) {
|
|
132
|
+
item.textContent = updatedTimePeriods[i].name;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
// 文字更新后重新测量宽度,修正首次加载时文字为空导致宽度过小的问题
|
|
136
|
+
const prevDisplay = this.dropdownListEl.style.display;
|
|
137
|
+
const prevVisibility = this.dropdownListEl.style.visibility;
|
|
138
|
+
this.dropdownListEl.style.display = 'block';
|
|
139
|
+
this.dropdownListEl.style.visibility = 'hidden';
|
|
140
|
+
this.dropdownListEl.style.width = '';
|
|
141
|
+
const newWidth = this.dropdownListEl.offsetWidth;
|
|
142
|
+
this.dropdownListEl.style.display = prevDisplay;
|
|
143
|
+
this.dropdownListEl.style.visibility = prevVisibility;
|
|
144
|
+
this.dropdownListEl.style.width = newWidth + 'px';
|
|
145
|
+
if (this.dropdownTriggerEl) {
|
|
146
|
+
this.dropdownTriggerEl.style.width = newWidth + 'px';
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// 更新触发按钮文字(显示当前选中项的最新语言文案)
|
|
150
|
+
if (this.dropdownTriggerEl) {
|
|
151
|
+
const selected = updatedTimePeriods.find(p => p.key === Number(this.currentTimePeriod));
|
|
152
|
+
if (selected) {
|
|
153
|
+
const textNode = Array.from(this.dropdownTriggerEl.childNodes).find(n => n.nodeType === Node.TEXT_NODE);
|
|
154
|
+
if (textNode) {
|
|
155
|
+
textNode.textContent = selected.name;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
this.dropdownTriggerEl.insertBefore(document.createTextNode(selected.name), this.dropdownTriggerEl.firstChild);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* 获取当前语种的 culture 代码
|
|
165
|
+
*/
|
|
166
|
+
getCurrentCulture() {
|
|
167
|
+
var _a, _b, _c, _d, _e, _f;
|
|
168
|
+
// 获取当前语种ID
|
|
169
|
+
const currentLanguageId = (_c = (_b = (_a = this.guiContext) === null || _a === void 0 ? void 0 : _a.getCurrentLanguageId) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : null;
|
|
170
|
+
// 确定要使用的语种代码(culture)
|
|
171
|
+
const defaultLanguage = ((_d = this.languageService) === null || _d === void 0 ? void 0 : _d.getDefaultLanguage()) || 'zh-CN';
|
|
172
|
+
if (currentLanguageId === null || currentLanguageId === undefined) {
|
|
173
|
+
// 设备未设置当前语种,使用默认语种
|
|
174
|
+
return defaultLanguage;
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
// 设备已设置当前语种,获取对应的语种代码
|
|
178
|
+
const currentLanguage = (_f = (_e = this.guiContext) === null || _e === void 0 ? void 0 : _e.getLanguageCultureById) === null || _f === void 0 ? void 0 : _f.call(_e, currentLanguageId);
|
|
179
|
+
if (currentLanguage) {
|
|
180
|
+
return currentLanguage;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
// 无法获取语种代码,使用默认语种
|
|
184
|
+
return defaultLanguage;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
getValidTimePeriods() {
|
|
189
|
+
const timePeriods = new Array();
|
|
190
|
+
timePeriods.push({ key: 6, name: this.getTimePeriodText(TIME_PERIOD_KEYS.LAST_THIRTY_MINUTES) });
|
|
191
|
+
timePeriods.push({ key: 1, name: this.getTimePeriodText(TIME_PERIOD_KEYS.LAST_ONE_HOUR) });
|
|
192
|
+
timePeriods.push({ key: 7, name: this.getTimePeriodText(TIME_PERIOD_KEYS.LAST_EIGHT_HOURS) });
|
|
193
|
+
timePeriods.push({ key: 2, name: this.getTimePeriodText(TIME_PERIOD_KEYS.LAST_TWENTY_FOUR_HOURS) });
|
|
194
|
+
timePeriods.push({ key: 3, name: this.getTimePeriodText(TIME_PERIOD_KEYS.LAST_SEVEN_DAYS) });
|
|
195
|
+
timePeriods.push({ key: 4, name: this.getTimePeriodText(TIME_PERIOD_KEYS.LAST_THIRTY_DAYS) });
|
|
196
|
+
timePeriods.push({ key: 5, name: this.getTimePeriodText(TIME_PERIOD_KEYS.LAST_ONE_YEAR) });
|
|
197
|
+
timePeriods.push({ key: 8, name: this.getTimePeriodText(TIME_PERIOD_KEYS.CUSTOM, this.localization.customTimeRange) });
|
|
198
|
+
return timePeriods;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* 获取时间段文案(从系统文本库获取多语种翻译,fallback 到 localization)
|
|
202
|
+
*/
|
|
203
|
+
getTimePeriodText(textKey, fallback = '') {
|
|
204
|
+
const currentCulture = this.getCurrentCulture();
|
|
205
|
+
const systemType = SYSTEM_TEXT_LIBRARY_TYPES.COMPONENT_BUILTIN;
|
|
206
|
+
if (this.systemTextLibraryService) {
|
|
207
|
+
const translation = this.systemTextLibraryService.getSystemTextValue(systemType, textKey, currentCulture);
|
|
208
|
+
if (translation) {
|
|
209
|
+
return translation;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return fallback;
|
|
213
|
+
}
|
|
214
|
+
updateTimeRange(timePeriodType) {
|
|
215
|
+
this.currentTimePeriod = +timePeriodType;
|
|
216
|
+
this.updateQueryTimeRange();
|
|
217
|
+
}
|
|
218
|
+
updateQueryTimeRange() {
|
|
219
|
+
if (this.currentTimePeriod === 8) {
|
|
220
|
+
if (this.customStartTime && this.customEndTime) {
|
|
221
|
+
this.startTime = this.customStartTime.clone();
|
|
222
|
+
this.endTime = this.customEndTime.clone();
|
|
223
|
+
}
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
this.endTime = moment();
|
|
227
|
+
switch (this.currentTimePeriod) {
|
|
228
|
+
case 1:
|
|
229
|
+
this.startTime = moment().subtract(1, 'hours');
|
|
230
|
+
break;
|
|
231
|
+
case 3:
|
|
232
|
+
this.startTime = moment().subtract(7, 'days');
|
|
233
|
+
break;
|
|
234
|
+
case 4:
|
|
235
|
+
this.startTime = moment().subtract(30, 'days');
|
|
236
|
+
break;
|
|
237
|
+
case 5:
|
|
238
|
+
this.startTime = moment().subtract(1, 'years');
|
|
239
|
+
break;
|
|
240
|
+
case 6:
|
|
241
|
+
this.startTime = moment().subtract(30, 'minutes');
|
|
242
|
+
break;
|
|
243
|
+
case 7:
|
|
244
|
+
this.startTime = moment().subtract(8, 'hours');
|
|
245
|
+
break;
|
|
246
|
+
default:
|
|
247
|
+
this.startTime = moment().subtract(1, 'days');
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
reRenderElement(startTime, endTime, limit, rangeType) {
|
|
251
|
+
// 清理图表实例
|
|
252
|
+
if (this.chartElement) {
|
|
253
|
+
// 隐藏 tooltip
|
|
254
|
+
if (this.chartElement.tooltip) {
|
|
255
|
+
this.chartElement.tooltip.hidden(true);
|
|
256
|
+
}
|
|
257
|
+
// 清理图表引用
|
|
258
|
+
this.chartElement = null;
|
|
259
|
+
}
|
|
260
|
+
// 清除 DOM 元素
|
|
261
|
+
this.rootElement.selectAll('*').remove();
|
|
262
|
+
// 重新渲染
|
|
263
|
+
this.renderElement(startTime, endTime, limit, rangeType);
|
|
264
|
+
}
|
|
265
|
+
renderElement(startTime, endTime, limit, rangeType) {
|
|
266
|
+
if (!this.model.dataSetting) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const dataItemName = this.model.dataSetting.dataName;
|
|
270
|
+
const dataSourceCode = this.model.dataSetting.dataSourceCode;
|
|
271
|
+
const channelNames = this.model.dataSetting.channels.map(c => c.name);
|
|
272
|
+
this.updateElementStatus(HistoricalCurveElementStatus.Loading);
|
|
273
|
+
const input = new GetHistoryDataArgs(dataSourceCode, dataItemName, channelNames, startTime, endTime, limit, rangeType);
|
|
274
|
+
this.historyDataStore.getHistoryData(input).subscribe(result => {
|
|
275
|
+
if (result.error) {
|
|
276
|
+
this.updateElementStatus(HistoricalCurveElementStatus.LoadFailed, result.error);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
this.clearStatus();
|
|
280
|
+
if (result.isUnbind) {
|
|
281
|
+
this.updateElementStatus(HistoricalCurveElementStatus.Unbound);
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
this.updateElementStatus(HistoricalCurveElementStatus.Normal);
|
|
285
|
+
}
|
|
286
|
+
if (result.values.length) {
|
|
287
|
+
this.currentStartTime = moment(first(result.values).time);
|
|
288
|
+
this.currentEndTime = moment(last(result.values).time);
|
|
289
|
+
}
|
|
290
|
+
this.chartElement = this.renderChart(result.values);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
setupTooltipAutoHide(chart) {
|
|
295
|
+
const chartContainer = this.rootElement.select('.nv-focus').node();
|
|
296
|
+
if (!chartContainer || !chart)
|
|
297
|
+
return;
|
|
298
|
+
let timeoutId;
|
|
299
|
+
// 鼠标移入图表时显示 tooltip
|
|
300
|
+
chartContainer.addEventListener('mouseover', () => {
|
|
301
|
+
hideTooltipAfterDelay();
|
|
302
|
+
});
|
|
303
|
+
const clearTooltipTimeout = () => {
|
|
304
|
+
if (timeoutId) {
|
|
305
|
+
clearTimeout(timeoutId);
|
|
306
|
+
timeoutId = null;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
const hideTooltipAfterDelay = () => {
|
|
310
|
+
clearTooltipTimeout();
|
|
311
|
+
timeoutId = setTimeout(() => {
|
|
312
|
+
chart.tooltip.hidden(true);
|
|
313
|
+
}, 2000); // 2秒延迟
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
renderChart(result) {
|
|
317
|
+
const chartWidth = this.model.displaySetting.size.width;
|
|
318
|
+
const chartHeight = this.model.displaySetting.size.height - this.displayOption.operationAreaHeight - this.displayOption.operationAreaMarginTop;
|
|
319
|
+
const data = new Array();
|
|
320
|
+
each(this.model.dataSetting.channels, (channel, key) => {
|
|
321
|
+
const values = new Array();
|
|
322
|
+
each(result, v => values.push({ x: moment(v.time).local().toDate().valueOf(), y: v.values[key] }));
|
|
323
|
+
data.push({ key: channel.name, area: channel.projectEnabled, values: values });
|
|
324
|
+
});
|
|
325
|
+
this.data = data;
|
|
326
|
+
let chart;
|
|
327
|
+
if (this.model.displaySetting.curveType === CurveType.BarGroup || this.model.displaySetting.curveType === CurveType.BarStack) {
|
|
328
|
+
chart = this.getMultiBarWithFocusChart(chartWidth, chartHeight, data);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
chart = this.getLineChart(chartWidth, chartHeight, data);
|
|
332
|
+
}
|
|
333
|
+
// 设置 tooltip 自动隐藏逻辑
|
|
334
|
+
this.setupTooltipAutoHide(chart);
|
|
335
|
+
return chart;
|
|
336
|
+
}
|
|
337
|
+
initPoint() {
|
|
338
|
+
try {
|
|
339
|
+
const legendList = this.$element
|
|
340
|
+
.find('.nv-legend')
|
|
341
|
+
.find('.nv-series');
|
|
342
|
+
let hiddenCount = 0;
|
|
343
|
+
for (let i = 0; i < this.data.length; i++) {
|
|
344
|
+
const channel = this.model.dataSetting.channels[i];
|
|
345
|
+
if (legendList.eq(i).children().eq(0).css('fill-opacity') === '1') {
|
|
346
|
+
const pointList = this.$element
|
|
347
|
+
.find('.nv-scatterWrap')
|
|
348
|
+
.find('.nv-series-' + (i - hiddenCount))
|
|
349
|
+
.find('.nv-point');
|
|
350
|
+
if (pointList && pointList.length) {
|
|
351
|
+
for (let j = 0; j < pointList.length; j++) {
|
|
352
|
+
const point = pointList.eq(j);
|
|
353
|
+
const previousPoint = pointList.eq(j - 1);
|
|
354
|
+
if (j && point.attr('transform').split(',')[1] !== previousPoint.attr('transform').split(',')[1]) {
|
|
355
|
+
if (channel.enablePoint && channel.pointColor) {
|
|
356
|
+
const pointStyle = {
|
|
357
|
+
'stroke-opacity': 1,
|
|
358
|
+
'stroke-width': '2px',
|
|
359
|
+
'stroke': channel.pointColor,
|
|
360
|
+
'fill-opacity': 1,
|
|
361
|
+
'fill': channel.pointColor
|
|
362
|
+
};
|
|
363
|
+
point.addClass('nv-mark-point');
|
|
364
|
+
point.css(pointStyle);
|
|
365
|
+
previousPoint.addClass('nv-mark-point');
|
|
366
|
+
previousPoint.css(pointStyle);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
hiddenCount++;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
catch (e) {
|
|
378
|
+
console.log(e);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
getLineChart(chartWidth, chartHeight, data) {
|
|
382
|
+
const chart = nv.models.lineChart().showLegend(true)
|
|
383
|
+
.margin({ top: 0, bottom: 0, left: this.displayOption.marginLeft, right: this.displayOption.marginRight })
|
|
384
|
+
.noData(this.localization.chartNoData);
|
|
385
|
+
if (this.model.displaySetting.axisSetting.yAxisRangeType === AxisRangeType.Custom) {
|
|
386
|
+
chart.yDomain([this.model.displaySetting.axisSetting.yAxisMin, this.model.displaySetting.axisSetting.yAxisMax]);
|
|
387
|
+
}
|
|
388
|
+
if (!this.isMobileMode) {
|
|
389
|
+
chart.focusEnable(true);
|
|
390
|
+
chart.focus.margin({ top: 10, right: 0, bottom: 0, left: 0 });
|
|
391
|
+
chart.focus.height(40);
|
|
392
|
+
chart.focus.showXAxis(false);
|
|
393
|
+
}
|
|
394
|
+
this.renderCommonProperty(chart, chartWidth, chartHeight, data);
|
|
395
|
+
this.renderOperationArea(chartWidth, chartHeight);
|
|
396
|
+
this.initPoint();
|
|
397
|
+
chart.legend.dispatch.on('legendClick', () => {
|
|
398
|
+
setTimeout(() => {
|
|
399
|
+
this.$element.find('.nv-mark-point').css({
|
|
400
|
+
'stroke-opacity': 0,
|
|
401
|
+
'stroke-width': 0,
|
|
402
|
+
'stroke': 'unset',
|
|
403
|
+
'fill-opacity': 0,
|
|
404
|
+
'fill': 'unset'
|
|
405
|
+
}).removeClass('nv-mark-point');
|
|
406
|
+
this.initPoint();
|
|
407
|
+
}, 1);
|
|
408
|
+
});
|
|
409
|
+
return chart;
|
|
410
|
+
}
|
|
411
|
+
getMultiBarWithFocusChart(chartWidth, chartHeight, data) {
|
|
412
|
+
const chart = nv.models.multiBarWithFocusChart()
|
|
413
|
+
.margin({
|
|
414
|
+
top: 0, bottom: 0, left: this.displayOption.marginLeft, right: this.displayOption.marginRight
|
|
415
|
+
})
|
|
416
|
+
.controlLabels({
|
|
417
|
+
grouped: this.localization.grouped, stacked: this.localization.stacked
|
|
418
|
+
})
|
|
419
|
+
.noData(this.localization.chartNoData);
|
|
420
|
+
if (this.model.displaySetting.curveType === CurveType.BarStack) {
|
|
421
|
+
chart.stacked(true);
|
|
422
|
+
chart.multibar.stacked(true);
|
|
423
|
+
chart.multibar2.stacked(true);
|
|
424
|
+
}
|
|
425
|
+
if (this.model.displaySetting.axisSetting.yAxisRangeType === AxisRangeType.Custom) {
|
|
426
|
+
chart.yDomain([this.model.displaySetting.axisSetting.yAxisMin, this.model.displaySetting.axisSetting.yAxisMax]);
|
|
427
|
+
}
|
|
428
|
+
if (!this.isMobileMode) {
|
|
429
|
+
chart.focusEnable(true);
|
|
430
|
+
chart.focusShowAxisX(false);
|
|
431
|
+
}
|
|
432
|
+
chart.xAxis.tickFormat(d => this.timeFormat(d, '%x %X'));
|
|
433
|
+
this.renderCommonProperty(chart, chartWidth, chartHeight, data);
|
|
434
|
+
this.renderOperationArea(chartWidth, chartHeight);
|
|
435
|
+
const focusContext = this.rootElement.select('.nv-context');
|
|
436
|
+
focusContext.select('.nv-barsWrap.nvd3-svg').attr('transform', 'translate(0,30)');
|
|
437
|
+
focusContext.select('.nv-brushBackground').attr('transform', 'translate(0,30)');
|
|
438
|
+
focusContext.select('.nv-x.nv-brush').attr('transform', 'translate(0,30)');
|
|
439
|
+
if (!this.model.displaySetting.showAxis) {
|
|
440
|
+
this.rootElement.select('.tick.zero').style('display', 'none');
|
|
441
|
+
this.rootElement.select('.nv-x.nv-axis.nvd3-svg').style('display', 'none');
|
|
442
|
+
this.rootElement.select('.nv-y.nv-axis.nvd3-svg').style('display', 'none');
|
|
443
|
+
}
|
|
444
|
+
chart.update();
|
|
445
|
+
return chart;
|
|
446
|
+
}
|
|
447
|
+
renderCommonProperty(chart, chartWidth, chartHeight, data) {
|
|
448
|
+
var _a, _b;
|
|
449
|
+
chart.tooltip.headerFormatter(d => this.timeFormat(d, '%x %X'));
|
|
450
|
+
if (this.model.displaySetting.showAxis) {
|
|
451
|
+
chart.xAxis.showMaxMin(true).tickFormat(d => {
|
|
452
|
+
this.$element.find('.nv-mark-point').css({
|
|
453
|
+
'stroke-opacity': 0,
|
|
454
|
+
'stroke-width': 0,
|
|
455
|
+
'stroke': 'unset',
|
|
456
|
+
'fill-opacity': 0,
|
|
457
|
+
'fill': 'unset'
|
|
458
|
+
}).removeClass('nv-mark-point');
|
|
459
|
+
clearTimeout(this.timer);
|
|
460
|
+
this.timer = undefined;
|
|
461
|
+
this.timer = setTimeout(() => {
|
|
462
|
+
this.initPoint();
|
|
463
|
+
}, 100);
|
|
464
|
+
if (this.currentTimePeriod === 3 || this.currentTimePeriod === 4 || this.currentTimePeriod === 5) {
|
|
465
|
+
return this.timeFormat(d, '%y-%m-%d');
|
|
466
|
+
}
|
|
467
|
+
return this.timeFormat(Number(d), '%X');
|
|
468
|
+
});
|
|
469
|
+
if (this.model.displaySetting.axisSetting) {
|
|
470
|
+
if (this.model.displaySetting.axisSetting.showAxisLabel && this.model.displaySetting.axisSetting.axisLabelFont) {
|
|
471
|
+
chart.xAxis.fontSize(this.model.displaySetting.axisSetting.axisLabelFont.fontSize);
|
|
472
|
+
chart.yAxis.fontSize(this.model.displaySetting.axisSetting.axisLabelFont.fontSize).tickFormat(d => +d3.format('.9g')(d));
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
chart.xAxis.tickFormat(() => '');
|
|
476
|
+
chart.yAxis.tickFormat(() => '');
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
chart.showXAxis(false);
|
|
482
|
+
chart.showYAxis(false);
|
|
483
|
+
}
|
|
484
|
+
chart.width(chartWidth);
|
|
485
|
+
chart.height(chartHeight);
|
|
486
|
+
chart.color(this.model.dataSetting.channels.map(c => c.connectorColor));
|
|
487
|
+
this.rootElement.append('g').datum(data).call(chart);
|
|
488
|
+
this.rootElement.selectAll('.nv-noData').attr('x', chartWidth / 2).attr('y', chartHeight / 2 + this.displayOption.operationAreaHeight);
|
|
489
|
+
this.resizeEventListener = nv.utils.windowResize(() => {
|
|
490
|
+
if (!this.needResize)
|
|
491
|
+
return;
|
|
492
|
+
chart.update();
|
|
493
|
+
this.rootElement.selectAll('.nv-noData').attr('x', chartWidth / 2).attr('y', chartHeight / 2 + this.displayOption.operationAreaHeight);
|
|
494
|
+
});
|
|
495
|
+
const fontSize = (_b = (_a = this.model.displaySetting.axisSetting) === null || _a === void 0 ? void 0 : _a.axisLabelFont) === null || _b === void 0 ? void 0 : _b.fontSize;
|
|
496
|
+
this.rootElement.selectAll('.domain').style('stroke-opacity', 1);
|
|
497
|
+
if (this.model.displaySetting.showAxis && this.model.displaySetting.axisSetting) {
|
|
498
|
+
const axisColor = this.model.displaySetting.axisSetting.axisColor;
|
|
499
|
+
this.rootElement.selectAll('.domain').style('stroke', axisColor);
|
|
500
|
+
if (fontSize && this.model.displaySetting.axisSetting.showAxisLabel) {
|
|
501
|
+
this.rootElement.selectAll('.nv-axisMaxMin').select('text').style('font-size', fontSize);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
let strokeWidth = 0;
|
|
505
|
+
if (this.model.displaySetting.axisSetting.showTick !== false) {
|
|
506
|
+
strokeWidth = 1;
|
|
507
|
+
}
|
|
508
|
+
this.rootElement
|
|
509
|
+
.selectAll('.nv-x')
|
|
510
|
+
.selectAll('.tick')
|
|
511
|
+
.selectAll('line')
|
|
512
|
+
.attr('style', `stroke:${this.model.displaySetting.axisSetting.xAxisTickColor || 'rgb(127, 147, 159)'};stroke-width:${strokeWidth};`);
|
|
513
|
+
this.rootElement
|
|
514
|
+
.selectAll('.nv-y')
|
|
515
|
+
.selectAll('.tick')
|
|
516
|
+
.selectAll('line')
|
|
517
|
+
.attr('style', `stroke:${this.model.displaySetting.axisSetting.yAxisTickColor || 'rgb(127, 147, 159)'};stroke-width:${strokeWidth};`);
|
|
518
|
+
if (fontSize && this.currentTimePeriod === 3 || this.currentTimePeriod === 4 || this.currentTimePeriod === 5) {
|
|
519
|
+
const self = this;
|
|
520
|
+
this.rootElement
|
|
521
|
+
.selectAll('.nv-x')
|
|
522
|
+
.selectAll('.tick')
|
|
523
|
+
.selectAll('text')
|
|
524
|
+
.data(function (d) {
|
|
525
|
+
return [self.timeFormat(Number(d), '%y-%m-%d'), self.timeFormat(Number(d), '%H:%M:%S')];
|
|
526
|
+
})
|
|
527
|
+
.enter()
|
|
528
|
+
.append('text')
|
|
529
|
+
.attr('class', 'full-date')
|
|
530
|
+
.attr('x', 0)
|
|
531
|
+
.attr('y', 0)
|
|
532
|
+
.attr('dy', '2.3em')
|
|
533
|
+
.style('text-anchor', 'middle')
|
|
534
|
+
.style('font-size', fontSize)
|
|
535
|
+
.text((d) => d);
|
|
536
|
+
this.rootElement
|
|
537
|
+
.selectAll('.nv-axisMaxMin-x')
|
|
538
|
+
.selectAll('text')
|
|
539
|
+
.data(function (d) {
|
|
540
|
+
return [self.timeFormat(Number(d), '%y-%m-%d'), self.timeFormat(Number(d), '%H:%M:%S')];
|
|
541
|
+
})
|
|
542
|
+
.enter()
|
|
543
|
+
.append('text')
|
|
544
|
+
.attr('class', 'full-date')
|
|
545
|
+
.attr('x', 0)
|
|
546
|
+
.attr('y', 0)
|
|
547
|
+
.attr('dy', '2.3em')
|
|
548
|
+
.style('text-anchor', 'middle')
|
|
549
|
+
.style('font-size', fontSize)
|
|
550
|
+
.text((d) => d);
|
|
551
|
+
const focusWrap = this.rootElement.selectAll('.nv-focusWrap');
|
|
552
|
+
if (focusWrap.size()) {
|
|
553
|
+
let h = focusWrap.attr('transform');
|
|
554
|
+
if (h && h.length && h.indexOf(',') !== -1) {
|
|
555
|
+
h = h.slice(0, -1).split(',')[1];
|
|
556
|
+
this.rootElement
|
|
557
|
+
.selectAll('.nv-focusWrap')
|
|
558
|
+
.attr('transform', `translate(0,${Number(h) + 15})`);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
const resizeObserver = new window.MutationObserver(() => {
|
|
562
|
+
this.rootElement
|
|
563
|
+
.selectAll('.nv-x')
|
|
564
|
+
.selectAll('.tick')
|
|
565
|
+
.selectAll('.full-date')
|
|
566
|
+
.remove();
|
|
567
|
+
this.rootElement
|
|
568
|
+
.selectAll('.nv-x')
|
|
569
|
+
.selectAll('.tick')
|
|
570
|
+
.selectAll('text')
|
|
571
|
+
.data(function (d) {
|
|
572
|
+
return [self.timeFormat(Number(d), '%y-%m-%d'), self.timeFormat(Number(d), '%H:%M:%S')];
|
|
573
|
+
})
|
|
574
|
+
.enter()
|
|
575
|
+
.append('text')
|
|
576
|
+
.attr('class', 'full-date')
|
|
577
|
+
.attr('x', 0)
|
|
578
|
+
.attr('y', 0)
|
|
579
|
+
.attr('dy', '2.3em')
|
|
580
|
+
.style('text-anchor', 'middle')
|
|
581
|
+
.style('font-size', fontSize)
|
|
582
|
+
.text((d) => d);
|
|
583
|
+
});
|
|
584
|
+
const extent = document.getElementsByClassName('extent');
|
|
585
|
+
if (extent.length) {
|
|
586
|
+
resizeObserver.observe(extent[0], { attributes: true });
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
else {
|
|
590
|
+
this.rootElement
|
|
591
|
+
.selectAll('.full-date')
|
|
592
|
+
.remove();
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
renderOperationArea(chartWidth, chartHeight) {
|
|
596
|
+
const backgroundColor = this.model.displaySetting.axisSetting.filterBackgroudColor || 'inherit';
|
|
597
|
+
const operationArea = this.rootElement.append('g').attr('transform', `translate(0,${chartHeight + this.displayOption.operationAreaMarginTop})`)
|
|
598
|
+
.append('foreignObject').attr('width', chartWidth).attr('height', this.displayOption.operationAreaHeight).attr('fill', 'none')
|
|
599
|
+
.append('xhtml:div').style('height', (this.displayOption.operationAreaHeight - 4) + 'px').style('overflow', 'hidden').style('margin-top', '4px');
|
|
600
|
+
const rect = this.$element.parent().parent().find('rect');
|
|
601
|
+
const fillColor = rect.attr('fill');
|
|
602
|
+
const dropdownBg = this.model.displaySetting.axisSetting.filterBackgroudColor || fillColor || '#fff';
|
|
603
|
+
const dropdownWrapper = operationArea.append('div')
|
|
604
|
+
.style('display', 'inline-block')
|
|
605
|
+
.style('position', 'relative')
|
|
606
|
+
.style('margin-left', this.displayOption.marginLeft + 'px')
|
|
607
|
+
.style('vertical-align', 'middle');
|
|
608
|
+
const selectedText = this.timePeriods.find(t => t.key === Number(this.currentTimePeriod));
|
|
609
|
+
const dropdownTrigger = dropdownWrapper.append('div')
|
|
610
|
+
.attr('class', 'hc-dropdown-trigger')
|
|
611
|
+
.style('background-color', backgroundColor)
|
|
612
|
+
.style('font-size', this.displayOption.operationSelectFontSize)
|
|
613
|
+
.style('cursor', 'pointer')
|
|
614
|
+
.style('padding', '0 18px 0 4px')
|
|
615
|
+
.style('border', '1px solid #ccc')
|
|
616
|
+
.style('border-radius', '2px')
|
|
617
|
+
.style('position', 'relative')
|
|
618
|
+
.style('white-space', 'nowrap')
|
|
619
|
+
.style('line-height', (this.displayOption.operationAreaHeight - 8) + 'px')
|
|
620
|
+
.style('min-height', (this.displayOption.operationAreaHeight - 8) + 'px')
|
|
621
|
+
.text(selectedText ? selectedText.name : '');
|
|
622
|
+
dropdownTrigger.append('span')
|
|
623
|
+
.style('position', 'absolute')
|
|
624
|
+
.style('right', '4px')
|
|
625
|
+
.style('top', '50%')
|
|
626
|
+
.style('transform', 'translateY(-50%)')
|
|
627
|
+
.style('font-size', '10px')
|
|
628
|
+
.style('pointer-events', 'none')
|
|
629
|
+
.text('▼');
|
|
630
|
+
const dropdownListEl = document.createElement('div');
|
|
631
|
+
dropdownListEl.style.cssText = 'display:none;position:fixed;background:' + dropdownBg
|
|
632
|
+
+ ';border:1px solid #ccc;border-radius:2px;z-index:9999;box-shadow:0 2px 6px rgba(0,0,0,0.15);';
|
|
633
|
+
document.body.appendChild(dropdownListEl);
|
|
634
|
+
this.dropdownListEl = dropdownListEl;
|
|
635
|
+
this.dropdownTriggerEl = dropdownTrigger.node();
|
|
636
|
+
const dropdownList = d3.select(dropdownListEl);
|
|
637
|
+
this.timePeriods.forEach(tp => {
|
|
638
|
+
dropdownList.append('div')
|
|
639
|
+
.attr('class', 'hc-dropdown-item')
|
|
640
|
+
.style('padding', '4px 8px')
|
|
641
|
+
.style('cursor', 'pointer')
|
|
642
|
+
.style('white-space', 'nowrap')
|
|
643
|
+
.style('font-size', this.displayOption.operationSelectFontSize)
|
|
644
|
+
.style('line-height', (this.displayOption.operationAreaHeight - 8) + 'px')
|
|
645
|
+
.style('min-height', (this.displayOption.operationAreaHeight - 8) + 'px')
|
|
646
|
+
.style('background', tp.key === Number(this.currentTimePeriod) ? '#1890ff' : 'transparent')
|
|
647
|
+
.style('color', tp.key === Number(this.currentTimePeriod) ? '#fff' : '#333')
|
|
648
|
+
.text(tp.name)
|
|
649
|
+
.on('mouseover', function () {
|
|
650
|
+
const el = d3.select(this);
|
|
651
|
+
if (!el.classed('hc-dropdown-selected')) {
|
|
652
|
+
el.style('background', '#e6f7ff').style('color', '#333');
|
|
653
|
+
}
|
|
654
|
+
})
|
|
655
|
+
.on('mouseout', function () {
|
|
656
|
+
const el = d3.select(this);
|
|
657
|
+
if (!el.classed('hc-dropdown-selected')) {
|
|
658
|
+
el.style('background', 'transparent').style('color', '#333');
|
|
659
|
+
}
|
|
660
|
+
})
|
|
661
|
+
.on('click', () => {
|
|
662
|
+
dropdownListEl.style.display = 'none';
|
|
663
|
+
// 从 this.timePeriods 实时查找,确保语种切换后显示最新文案
|
|
664
|
+
const currentPeriod = this.timePeriods.find(p => p.key === tp.key);
|
|
665
|
+
const currentName = currentPeriod ? currentPeriod.name : tp.name;
|
|
666
|
+
dropdownTrigger.text(currentName);
|
|
667
|
+
dropdownTrigger.append('span')
|
|
668
|
+
.style('position', 'absolute')
|
|
669
|
+
.style('right', '4px')
|
|
670
|
+
.style('top', '50%')
|
|
671
|
+
.style('transform', 'translateY(-50%)')
|
|
672
|
+
.style('font-size', '10px')
|
|
673
|
+
.style('pointer-events', 'none')
|
|
674
|
+
.text('▼');
|
|
675
|
+
// 更新选中状态
|
|
676
|
+
dropdownList.selectAll('.hc-dropdown-item')
|
|
677
|
+
.classed('hc-dropdown-selected', false)
|
|
678
|
+
.style('background', 'transparent')
|
|
679
|
+
.style('color', '#333');
|
|
680
|
+
d3.select(d3.event.currentTarget)
|
|
681
|
+
.classed('hc-dropdown-selected', true)
|
|
682
|
+
.style('background', '#1890ff')
|
|
683
|
+
.style('color', '#fff');
|
|
684
|
+
if (tp.key === 8) {
|
|
685
|
+
this.showCustomTimeRangeModal();
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
this.updateTimeRange(tp.key);
|
|
689
|
+
this.reRenderElement(this.startTime, this.endTime, this.displayOption.dataLimit, HistoricalCurveTimeRange.BeginOpenEndOpen);
|
|
690
|
+
});
|
|
691
|
+
});
|
|
692
|
+
// 测量下拉列表最大宽度,让 trigger 和列表宽度一致
|
|
693
|
+
dropdownListEl.style.display = 'block';
|
|
694
|
+
dropdownListEl.style.visibility = 'hidden';
|
|
695
|
+
const listContentWidth = dropdownListEl.offsetWidth;
|
|
696
|
+
dropdownListEl.style.display = 'none';
|
|
697
|
+
dropdownListEl.style.visibility = '';
|
|
698
|
+
dropdownListEl.style.width = listContentWidth + 'px';
|
|
699
|
+
dropdownTrigger.node().style.width = listContentWidth + 'px';
|
|
700
|
+
dropdownTrigger.node().style.boxSizing = 'border-box';
|
|
701
|
+
const hideDropdown = () => { dropdownListEl.style.display = 'none'; };
|
|
702
|
+
dropdownTrigger.on('click', () => {
|
|
703
|
+
const isVisible = dropdownListEl.style.display !== 'none';
|
|
704
|
+
if (isVisible) {
|
|
705
|
+
hideDropdown();
|
|
706
|
+
}
|
|
707
|
+
else {
|
|
708
|
+
const triggerNode = dropdownTrigger.node();
|
|
709
|
+
const triggerRect = triggerNode.getBoundingClientRect();
|
|
710
|
+
// 设置宽度至少和 trigger 一样宽
|
|
711
|
+
dropdownListEl.style.minWidth = triggerRect.width + 'px';
|
|
712
|
+
dropdownListEl.style.left = triggerRect.left + 'px';
|
|
713
|
+
dropdownListEl.style.display = 'block';
|
|
714
|
+
const listHeight = dropdownListEl.offsetHeight;
|
|
715
|
+
const spaceBelow = window.innerHeight - triggerRect.bottom;
|
|
716
|
+
if (spaceBelow < listHeight) {
|
|
717
|
+
// 向上展开
|
|
718
|
+
dropdownListEl.style.top = '';
|
|
719
|
+
dropdownListEl.style.bottom = (window.innerHeight - triggerRect.top) + 'px';
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
// 向下展开
|
|
723
|
+
dropdownListEl.style.bottom = '';
|
|
724
|
+
dropdownListEl.style.top = triggerRect.bottom + 'px';
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
// 点击外部收起
|
|
729
|
+
document.addEventListener('click', (event) => {
|
|
730
|
+
const triggerNode = dropdownTrigger.node();
|
|
731
|
+
if (!dropdownListEl.contains(event.target) && !triggerNode.contains(event.target)) {
|
|
732
|
+
hideDropdown();
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
// 滚动时收起
|
|
736
|
+
document.addEventListener('scroll', hideDropdown, true);
|
|
737
|
+
const buttonWidth = this.displayOption.operationButtonWidth + 'px', buttonHeight = this.displayOption.operationButtonHeight + 'px';
|
|
738
|
+
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
739
|
+
.style('float', 'right').style('background-image', 'url(assets/img/black_last_page.png)')
|
|
740
|
+
.style('background-color', backgroundColor).style('background-size', 'cover')
|
|
741
|
+
.on('click', () => { this.loadLastPage(); });
|
|
742
|
+
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
743
|
+
.style('float', 'right').style('background-image', 'url(assets/img/black_next_page.png)')
|
|
744
|
+
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
745
|
+
.style('background-color', backgroundColor).style('background-size', 'cover')
|
|
746
|
+
.on('click', () => { this.loadNextPage(); });
|
|
747
|
+
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
748
|
+
.style('float', 'right').style('background-image', 'url(assets/img/black_previous_page.png)')
|
|
749
|
+
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
750
|
+
.style('background-color', backgroundColor).style('background-size', 'cover')
|
|
751
|
+
.on('click', () => { this.loadPreviousPage(); });
|
|
752
|
+
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
753
|
+
.style('float', 'right').style('background-image', 'url(assets/img/black_first_page.png)')
|
|
754
|
+
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
755
|
+
.style('background-color', backgroundColor).style('background-size', 'cover')
|
|
756
|
+
.on('click', () => { this.loadFirstPage(); });
|
|
757
|
+
}
|
|
758
|
+
timeFormat(datetime, specifier) {
|
|
759
|
+
return d3.time.format(specifier)(new Date(datetime));
|
|
760
|
+
}
|
|
761
|
+
fmtDatetimeLocal(d) {
|
|
762
|
+
const p2 = (n) => (n < 10 ? '0' : '') + n;
|
|
763
|
+
return d.getFullYear() + '-' + p2(d.getMonth() + 1) + '-' + p2(d.getDate())
|
|
764
|
+
+ 'T' + p2(d.getHours()) + ':' + p2(d.getMinutes()) + ':' + p2(d.getSeconds());
|
|
765
|
+
}
|
|
766
|
+
showCustomTimeRangeModal() {
|
|
767
|
+
const now = new Date();
|
|
768
|
+
const defaultStart = this.customStartTime ? this.customStartTime.toDate()
|
|
769
|
+
: new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0);
|
|
770
|
+
const defaultEnd = this.customEndTime ? this.customEndTime.toDate()
|
|
771
|
+
: new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59);
|
|
772
|
+
if (this.guiContext && this.guiContext.showCustomTimeRangeModal) {
|
|
773
|
+
this.guiContext.showCustomTimeRangeModal({ startTime: defaultStart, endTime: defaultEnd }).then(result => {
|
|
774
|
+
if (result) {
|
|
775
|
+
const momentAny = moment;
|
|
776
|
+
this.customStartTime = momentAny(result.startTime);
|
|
777
|
+
this.customEndTime = momentAny(result.endTime);
|
|
778
|
+
this.updateTimeRange(8);
|
|
779
|
+
this.reRenderElement(this.startTime, this.endTime, this.displayOption.dataLimit, HistoricalCurveTimeRange.BeginOpenEndOpen);
|
|
780
|
+
}
|
|
781
|
+
});
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
this.showCustomTimeRangeModalFallback();
|
|
785
|
+
}
|
|
786
|
+
showCustomTimeRangeModalFallback() {
|
|
787
|
+
const prevTimePeriod = this.currentTimePeriod;
|
|
788
|
+
const now = new Date();
|
|
789
|
+
const defaultStart = this.fmtDatetimeLocal(this.customStartTime ? this.customStartTime.toDate()
|
|
790
|
+
: new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0));
|
|
791
|
+
const defaultEnd = this.fmtDatetimeLocal(this.customEndTime ? this.customEndTime.toDate()
|
|
792
|
+
: new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59));
|
|
793
|
+
const overlay = document.createElement('div');
|
|
794
|
+
overlay.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:9999;';
|
|
795
|
+
const modal = document.createElement('div');
|
|
796
|
+
const modalCss = 'position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);'
|
|
797
|
+
+ 'background:#fff;border-radius:4px;min-width:460px;'
|
|
798
|
+
+ 'box-shadow:0 4px 12px rgba(0,0,0,0.15);font-family:inherit;font-size:14px;';
|
|
799
|
+
modal.style.cssText = modalCss;
|
|
800
|
+
const header = document.createElement('div');
|
|
801
|
+
header.style.cssText = 'display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid #e8e8e8;';
|
|
802
|
+
const title = document.createElement('span');
|
|
803
|
+
title.style.cssText = 'font-size:16px;font-weight:500;color:#333;';
|
|
804
|
+
title.textContent = this.localization.customTimeRange || '自定义';
|
|
805
|
+
const closeBtn = document.createElement('span');
|
|
806
|
+
closeBtn.style.cssText = 'cursor:pointer;font-size:18px;color:#999;line-height:1;';
|
|
807
|
+
closeBtn.textContent = '×';
|
|
808
|
+
header.appendChild(title);
|
|
809
|
+
header.appendChild(closeBtn);
|
|
810
|
+
const body = document.createElement('div');
|
|
811
|
+
body.style.cssText = 'padding:20px 16px;display:flex;align-items:center;flex-wrap:wrap;gap:8px;';
|
|
812
|
+
const label = document.createElement('span');
|
|
813
|
+
label.style.cssText = 'color:#333;white-space:nowrap;';
|
|
814
|
+
label.textContent = '时间范围:';
|
|
815
|
+
const inputStyle = 'border:1px solid #d9d9d9;border-radius:4px;padding:4px 8px;font-size:14px;height:32px;outline:none;color:#333;';
|
|
816
|
+
const startInput = document.createElement('input');
|
|
817
|
+
startInput.type = 'datetime-local';
|
|
818
|
+
startInput.setAttribute('step', '1');
|
|
819
|
+
startInput.value = defaultStart;
|
|
820
|
+
startInput.style.cssText = inputStyle;
|
|
821
|
+
const separator = document.createElement('span');
|
|
822
|
+
separator.textContent = ' - ';
|
|
823
|
+
separator.style.cssText = 'color:#333;';
|
|
824
|
+
const endInput = document.createElement('input');
|
|
825
|
+
endInput.type = 'datetime-local';
|
|
826
|
+
endInput.setAttribute('step', '1');
|
|
827
|
+
endInput.value = defaultEnd;
|
|
828
|
+
endInput.style.cssText = inputStyle;
|
|
829
|
+
body.appendChild(label);
|
|
830
|
+
body.appendChild(startInput);
|
|
831
|
+
body.appendChild(separator);
|
|
832
|
+
body.appendChild(endInput);
|
|
833
|
+
const footer = document.createElement('div');
|
|
834
|
+
footer.style.cssText = 'display:flex;justify-content:flex-end;gap:8px;padding:12px 16px;border-top:1px solid #e8e8e8;';
|
|
835
|
+
const cancelBtn = document.createElement('button');
|
|
836
|
+
cancelBtn.textContent = this.localization.cancel || '取消';
|
|
837
|
+
cancelBtn.style.cssText = 'padding:5px 16px;border:1px solid #d9d9d9;border-radius:4px;background:#fff;cursor:pointer;font-size:14px;color:#333;';
|
|
838
|
+
const saveBtn = document.createElement('button');
|
|
839
|
+
saveBtn.textContent = '保存';
|
|
840
|
+
saveBtn.style.cssText = 'padding:5px 16px;border:none;border-radius:4px;background:#1890ff;color:#fff;cursor:pointer;font-size:14px;';
|
|
841
|
+
footer.appendChild(cancelBtn);
|
|
842
|
+
footer.appendChild(saveBtn);
|
|
843
|
+
modal.appendChild(header);
|
|
844
|
+
modal.appendChild(body);
|
|
845
|
+
modal.appendChild(footer);
|
|
846
|
+
overlay.appendChild(modal);
|
|
847
|
+
document.body.appendChild(overlay);
|
|
848
|
+
const close = (revert) => {
|
|
849
|
+
document.body.removeChild(overlay);
|
|
850
|
+
if (revert) {
|
|
851
|
+
const selectEl = this.$element && this.$element.find('select');
|
|
852
|
+
if (selectEl && selectEl.length) {
|
|
853
|
+
selectEl.val(prevTimePeriod.toString());
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
};
|
|
857
|
+
closeBtn.addEventListener('click', () => close(true));
|
|
858
|
+
cancelBtn.addEventListener('click', () => close(true));
|
|
859
|
+
saveBtn.addEventListener('click', () => {
|
|
860
|
+
const startVal = startInput.value;
|
|
861
|
+
const endVal = endInput.value;
|
|
862
|
+
if (!startVal) {
|
|
863
|
+
startInput.style.borderColor = 'red';
|
|
864
|
+
return;
|
|
865
|
+
}
|
|
866
|
+
const startDate = new Date(startVal);
|
|
867
|
+
const endDate = endVal
|
|
868
|
+
? new Date(endVal)
|
|
869
|
+
: new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate(), 23, 59, 59);
|
|
870
|
+
if (isNaN(startDate.getTime())) {
|
|
871
|
+
startInput.style.borderColor = 'red';
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
if (endDate.getTime() <= startDate.getTime()) {
|
|
875
|
+
endInput.style.borderColor = 'red';
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
const momentAny = moment;
|
|
879
|
+
this.customStartTime = momentAny(startDate);
|
|
880
|
+
this.customEndTime = momentAny(endDate);
|
|
881
|
+
close(false);
|
|
882
|
+
this.updateTimeRange(8);
|
|
883
|
+
this.reRenderElement(this.startTime, this.endTime, this.displayOption.dataLimit, HistoricalCurveTimeRange.BeginOpenEndOpen);
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
loadFirstPage() {
|
|
887
|
+
this.updateQueryTimeRange();
|
|
888
|
+
this.reRenderElement(this.startTime, this.endTime, this.displayOption.dataLimit, HistoricalCurveTimeRange.BeginOpenEndOpen);
|
|
889
|
+
}
|
|
890
|
+
loadNextPage() {
|
|
891
|
+
this.reRenderElement(this.currentEndTime, this.endTime, this.displayOption.dataLimit, HistoricalCurveTimeRange.BeginOpenEndClose);
|
|
892
|
+
}
|
|
893
|
+
loadPreviousPage() {
|
|
894
|
+
this.reRenderElement(this.startTime, this.currentStartTime, -this.displayOption.dataLimit, HistoricalCurveTimeRange.BeginCloseEndOpen);
|
|
895
|
+
}
|
|
896
|
+
loadLastPage() {
|
|
897
|
+
this.updateQueryTimeRange();
|
|
898
|
+
this.reRenderElement(this.startTime, this.endTime, -this.displayOption.dataLimit, HistoricalCurveTimeRange.BeginOpenEndOpen);
|
|
899
|
+
}
|
|
900
|
+
initElementStatus() {
|
|
901
|
+
if (this.model.dataSetting && null != this.model.dataSetting.dataSourceCode) {
|
|
902
|
+
this.updateElementStatus(HistoricalCurveElementStatus.Loading);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
updateElementStatus(status, error) {
|
|
906
|
+
switch (status) {
|
|
907
|
+
case HistoricalCurveElementStatus.Normal:
|
|
908
|
+
if (this.elementStatus !== HistoricalCurveElementStatus.Normal) {
|
|
909
|
+
this.elementStatus = HistoricalCurveElementStatus.Normal;
|
|
910
|
+
}
|
|
911
|
+
break;
|
|
912
|
+
case HistoricalCurveElementStatus.Unbound:
|
|
913
|
+
this.elementStatus = HistoricalCurveElementStatus.Unbound;
|
|
914
|
+
this.setStatusAsUnbound();
|
|
915
|
+
break;
|
|
916
|
+
case HistoricalCurveElementStatus.Loading:
|
|
917
|
+
if (this.elementStatus !== HistoricalCurveElementStatus.Unbound) {
|
|
918
|
+
this.elementStatus = HistoricalCurveElementStatus.Loading;
|
|
919
|
+
this.setStatusAsLoading();
|
|
920
|
+
}
|
|
921
|
+
break;
|
|
922
|
+
case HistoricalCurveElementStatus.LoadFailed:
|
|
923
|
+
if (this.elementStatus !== HistoricalCurveElementStatus.Unbound) {
|
|
924
|
+
this.elementStatus = HistoricalCurveElementStatus.LoadFailed;
|
|
925
|
+
this.setStatusAsLoadFailed(error ? error : this.localization.abnormal);
|
|
926
|
+
}
|
|
927
|
+
break;
|
|
928
|
+
default:
|
|
929
|
+
this.logger.error(`Invalid HistoricalCurveElementStatus:${status}`);
|
|
930
|
+
break;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
setStatusAsUnbound() {
|
|
934
|
+
this.renderStatus('assets/img/unbind.svg', this.localization.unbind, '#586e7c');
|
|
935
|
+
}
|
|
936
|
+
setStatusAsLoading() {
|
|
937
|
+
this.renderStatus('assets/img/loading.svg', this.localization.loading, '#226abc');
|
|
938
|
+
}
|
|
939
|
+
setStatusAsLoadFailed(error) {
|
|
940
|
+
this.logger.error(`[GUI]Failed to load historical curve:${error}`);
|
|
941
|
+
this.renderStatus('assets/img/abnormal.svg', error, '#f6a520');
|
|
942
|
+
}
|
|
943
|
+
renderStatus(icon, tip, stroke) {
|
|
944
|
+
if (this.elementStatus === HistoricalCurveElementStatus.Normal) {
|
|
945
|
+
this.clearStatus();
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
this.rootElement.append('rect').attr('id', 'StateFrame').attr('fill', 'transparent')
|
|
949
|
+
.attr('width', this.model.displaySetting.size.width)
|
|
950
|
+
.attr('height', this.model.displaySetting.size.height);
|
|
951
|
+
const document = this.$element[0].ownerDocument;
|
|
952
|
+
const currentRect = this.$element.find('rect#StateFrame').first();
|
|
953
|
+
if (!currentRect.length) {
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
this.$element.find('image#StateImage').remove();
|
|
957
|
+
const imgObj = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
|
958
|
+
if (imgObj) {
|
|
959
|
+
let x = Number(currentRect[0].getAttribute('width')) - 20;
|
|
960
|
+
const currentRectX = currentRect[0].getAttribute('x');
|
|
961
|
+
if (currentRectX !== null) {
|
|
962
|
+
x += Number(currentRectX);
|
|
963
|
+
}
|
|
964
|
+
currentRect[0].setAttribute('stroke', stroke);
|
|
965
|
+
currentRect[0].setAttribute('stroke-opacity', '0.5');
|
|
966
|
+
imgObj.href.baseVal = icon;
|
|
967
|
+
imgObj.setAttributeNS(null, 'id', 'StateImage');
|
|
968
|
+
imgObj.setAttributeNS(null, 'x', x.toString());
|
|
969
|
+
imgObj.setAttributeNS(null, 'y', '0');
|
|
970
|
+
imgObj.setAttributeNS(null, 'height', '20px');
|
|
971
|
+
imgObj.setAttributeNS(null, 'width', '20px');
|
|
972
|
+
const titleElement = document.createElementNS('http://www.w3.org/2000/svg', 'title');
|
|
973
|
+
const text = document.createTextNode(tip);
|
|
974
|
+
titleElement.appendChild(text);
|
|
975
|
+
imgObj.appendChild(titleElement);
|
|
976
|
+
this.$element.append(imgObj);
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
clearStatus() {
|
|
980
|
+
const currentRect = this.$element.find('rect#StateFrame').first();
|
|
981
|
+
if (!currentRect.length) {
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
const stroke = currentRect[0].getAttribute('stroke');
|
|
985
|
+
if (stroke) {
|
|
986
|
+
currentRect[0].removeAttribute('stroke');
|
|
987
|
+
}
|
|
988
|
+
this.$element.find('image#StateImage').remove();
|
|
989
|
+
}
|
|
990
|
+
}
|