@openui5/sap.ui.integration 1.93.3 → 1.96.2
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/.reuse/dep5 +6 -11
- package/THIRDPARTY.txt +10 -16
- package/package.json +3 -3
- package/src/sap/ui/integration/.library +7 -2
- package/src/sap/ui/integration/ActionDefinition.js +1 -1
- package/src/sap/ui/integration/Designtime.js +1 -1
- package/src/sap/ui/integration/Extension.js +1 -1
- package/src/sap/ui/integration/Host.js +71 -8
- package/src/sap/ui/integration/cards/AdaptiveContent.js +18 -25
- package/src/sap/ui/integration/cards/AnalyticalContent.js +178 -147
- package/src/sap/ui/integration/cards/AnalyticsCloudContent.js +3 -2
- package/src/sap/ui/integration/cards/BaseContent.js +11 -2
- package/src/sap/ui/integration/cards/BaseListContent.js +23 -3
- package/src/sap/ui/integration/cards/CalendarContent.js +2 -2
- package/src/sap/ui/integration/cards/CalendarContentRenderer.js +8 -3
- package/src/sap/ui/integration/cards/ComponentContent.js +1 -1
- package/src/sap/ui/integration/cards/Footer.js +1 -1
- package/src/sap/ui/integration/cards/Header.js +7 -1
- package/src/sap/ui/integration/cards/ListContent.js +37 -13
- package/src/sap/ui/integration/cards/ListContentRenderer.js +38 -7
- package/src/sap/ui/integration/cards/NumericHeader.js +9 -2
- package/src/sap/ui/integration/cards/ObjectContent.js +1 -1
- package/src/sap/ui/integration/cards/TableContent.js +9 -2
- package/src/sap/ui/integration/cards/TimelineContent.js +1 -1
- package/src/sap/ui/integration/cards/WebPageContent.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputChoiceSet.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputDate.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputNumber.js +12 -5
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputText.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputTime.js +4 -4
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputToggle.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/overwrites/ActionRender.js +2 -2
- package/src/sap/ui/integration/cards/{Filter.js → filters/BaseFilter.js} +56 -128
- package/src/sap/ui/integration/cards/filters/DateRangeFilter.js +232 -0
- package/src/sap/ui/integration/{util → cards/filters}/FilterBarFactory.js +37 -12
- package/src/sap/ui/integration/cards/filters/SelectFilter.js +157 -0
- package/src/sap/ui/integration/controls/ActionsStrip.js +1 -3
- package/src/sap/ui/integration/controls/ActionsToolbar.js +1 -1
- package/src/sap/ui/integration/controls/ListContentItem.js +13 -2
- package/src/sap/ui/integration/controls/ListContentItemRenderer.js +65 -2
- package/src/sap/ui/integration/controls/Microchart.js +1 -1
- package/src/sap/ui/integration/controls/MicrochartLegend.js +1 -1
- package/src/sap/ui/integration/customElements/CustomElementEditor.js +29 -0
- package/src/sap/ui/integration/designtime/baseEditor/BaseEditor.js +26 -1
- package/src/sap/ui/integration/designtime/baseEditor/PropertyEditor.js +44 -2
- package/src/sap/ui/integration/designtime/baseEditor/PropertyEditors.js +27 -1
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n.properties +34 -25
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_ar.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_bg.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_ca.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_cs.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_cy.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_da.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_de.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_el.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_en.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_en_GB.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_en_US_sappsd.properties +4 -2
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_en_US_saprigi.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_en_US_saptrc.properties +4 -2
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_es.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_es_MX.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_et.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_fi.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_fr.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_fr_CA.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_hi.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_hr.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_hu.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_id.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_it.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_iw.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_ja.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_kk.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_ko.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_lt.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_lv.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_ms.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_nl.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_no.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_pl.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_pt.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_pt_PT.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_ro.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_ru.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_sh.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_sk.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_sl.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_sv.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_th.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_tr.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_uk.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_vi.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_zh_CN.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/i18n/i18n_zh_TW.properties +19 -13
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/BasePropertyEditor.js +48 -3
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/PropertyEditorFactory.js +2 -2
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/arrayEditor/ArrayEditor.js +4 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/booleanEditor/BooleanEditor.js +4 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/dateEditor/DateEditor.fragment.xml +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/dateEditor/DateEditor.js +65 -17
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/dateTimeEditor/DateTimeEditor.fragment.xml +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/dateTimeEditor/DateTimeEditor.js +17 -4
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/enumStringEditor/EnumStringEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/groupEditor/GroupEditor.js +4 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/iconEditor/IconEditor.js +10 -2
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/iconEditor/IsInIconPool.validator.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/integerEditor/IntegerEditor.js +10 -2
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/jsonEditor/JsonEditor.js +11 -2
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/listEditor/ListEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/mapEditor/MapEditor.fragment.xml +8 -2
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/mapEditor/MapEditor.js +62 -35
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/numberEditor/NumberEditor.js +10 -2
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/selectEditor/SelectEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/separatorEditor/SeparatorEditor.js +4 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/stringEditor/StringEditor.js +4 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/textAreaEditor/TextAreaEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/util/binding/ObjectBinding.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/util/unset.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsBoolean.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsDate.js +5 -4
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsInteger.js +1 -5
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsNumber.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsSelectedKey.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsStringList.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsUniqueKey.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsUniqueList.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsValidBinding.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/MaxLength.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/NotABinding.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/ValidatorRegistry.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/BASEditor.js +7 -1
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n.properties +6 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ar.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_bg.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ca.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_cs.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_cy.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_da.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_de.properties +6 -2
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_el.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_en.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_en_GB.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_en_US_sappsd.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_en_US_saprigi.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_en_US_saptrc.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_es.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_es_MX.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_et.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_fi.properties +7 -3
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_fr.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_fr_CA.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_hi.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_hr.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_hu.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_id.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_it.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_iw.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ja.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_kk.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ko.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_lt.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_lv.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ms.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_nl.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_no.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_pl.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_pt.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_pt_PT.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ro.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_ru.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_sh.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_sk.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_sl.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_sv.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_th.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_tr.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_uk.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_vi.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_zh_CN.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/i18n/i18n_zh_TW.properties +4 -0
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/complexMapEditor/ComplexMapEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/destinationsEditor/DestinationsEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/iconEditor/IconEditor.js +11 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/parametersEditor/ParametersEditor.js +12 -1
- package/src/sap/ui/integration/designtime/editor/CardEditor.js +39 -1904
- package/src/sap/ui/integration/designtime/editor/CardPreview.js +22 -1
- package/src/sap/ui/integration/designtime/editor/css/CardPreview.css +4 -0
- package/src/sap/ui/integration/editor/Editor.js +2883 -0
- package/src/sap/ui/integration/{designtime/editor/CardResourceBundles.js → editor/EditorResourceBundles.js} +16 -16
- package/src/sap/ui/integration/editor/Extension.js +103 -0
- package/src/sap/ui/integration/editor/Manifest.js +35 -0
- package/src/sap/ui/integration/editor/Merger.js +102 -0
- package/src/sap/ui/integration/editor/Settings.js +894 -0
- package/src/sap/ui/integration/{designtime/editor/css/CardEditor.css → editor/css/Editor.css} +135 -119
- package/src/sap/ui/integration/{designtime/editor → editor}/fields/BaseField.js +91 -149
- package/src/sap/ui/integration/{designtime/editor → editor}/fields/BooleanField.js +5 -5
- package/src/sap/ui/integration/{designtime/editor → editor}/fields/DateField.js +7 -6
- package/src/sap/ui/integration/{designtime/editor → editor}/fields/DateTimeField.js +7 -6
- package/src/sap/ui/integration/{designtime/editor → editor}/fields/DestinationField.js +5 -5
- package/src/sap/ui/integration/{designtime/editor → editor}/fields/IntegerField.js +5 -10
- package/src/sap/ui/integration/{designtime/editor → editor}/fields/ListField.js +43 -45
- package/src/sap/ui/integration/{designtime/editor → editor}/fields/NumberField.js +5 -10
- package/src/sap/ui/integration/{designtime/editor → editor}/fields/StringField.js +183 -124
- package/src/sap/ui/integration/{designtime/editor → editor}/fields/viz/ColorSelect.js +3 -3
- package/src/sap/ui/integration/{designtime/editor → editor}/fields/viz/IconSelect.js +28 -25
- package/src/sap/ui/integration/{designtime/editor → editor}/fields/viz/ShapeSelect.js +3 -3
- package/src/sap/ui/integration/editor/languages.json +51 -0
- package/src/sap/ui/integration/{designtime/editor → editor}/themes/base/CardEditor.less +0 -0
- package/src/sap/ui/integration/library.js +22 -2
- package/src/sap/ui/integration/messagebundle.properties +99 -60
- package/src/sap/ui/integration/messagebundle_ar.properties +67 -55
- package/src/sap/ui/integration/messagebundle_bg.properties +66 -54
- package/src/sap/ui/integration/messagebundle_ca.properties +67 -55
- package/src/sap/ui/integration/messagebundle_cs.properties +65 -53
- package/src/sap/ui/integration/messagebundle_cy.properties +67 -55
- package/src/sap/ui/integration/messagebundle_da.properties +66 -54
- package/src/sap/ui/integration/messagebundle_de.properties +66 -54
- package/src/sap/ui/integration/messagebundle_el.properties +67 -55
- package/src/sap/ui/integration/messagebundle_en.properties +16 -4
- package/src/sap/ui/integration/messagebundle_en_GB.properties +42 -30
- package/src/sap/ui/integration/messagebundle_en_US_sappsd.properties +16 -4
- package/src/sap/ui/integration/messagebundle_en_US_saprigi.properties +81 -55
- package/src/sap/ui/integration/messagebundle_en_US_saptrc.properties +16 -4
- package/src/sap/ui/integration/messagebundle_es.properties +66 -54
- package/src/sap/ui/integration/messagebundle_es_MX.properties +66 -54
- package/src/sap/ui/integration/messagebundle_et.properties +65 -53
- package/src/sap/ui/integration/messagebundle_fi.properties +66 -54
- package/src/sap/ui/integration/messagebundle_fr.properties +65 -53
- package/src/sap/ui/integration/messagebundle_fr_CA.properties +65 -53
- package/src/sap/ui/integration/messagebundle_hi.properties +67 -55
- package/src/sap/ui/integration/messagebundle_hr.properties +66 -54
- package/src/sap/ui/integration/messagebundle_hu.properties +66 -54
- package/src/sap/ui/integration/messagebundle_id.properties +68 -56
- package/src/sap/ui/integration/messagebundle_it.properties +66 -54
- package/src/sap/ui/integration/messagebundle_iw.properties +66 -54
- package/src/sap/ui/integration/messagebundle_ja.properties +65 -53
- package/src/sap/ui/integration/messagebundle_kk.properties +66 -54
- package/src/sap/ui/integration/messagebundle_ko.properties +67 -55
- package/src/sap/ui/integration/messagebundle_lt.properties +67 -55
- package/src/sap/ui/integration/messagebundle_lv.properties +67 -55
- package/src/sap/ui/integration/messagebundle_ms.properties +66 -54
- package/src/sap/ui/integration/messagebundle_nl.properties +65 -53
- package/src/sap/ui/integration/messagebundle_no.properties +66 -54
- package/src/sap/ui/integration/messagebundle_pl.properties +66 -54
- package/src/sap/ui/integration/messagebundle_pt.properties +66 -54
- package/src/sap/ui/integration/messagebundle_pt_PT.properties +66 -54
- package/src/sap/ui/integration/messagebundle_ro.properties +66 -54
- package/src/sap/ui/integration/messagebundle_ru.properties +67 -55
- package/src/sap/ui/integration/messagebundle_sh.properties +66 -54
- package/src/sap/ui/integration/messagebundle_sk.properties +66 -54
- package/src/sap/ui/integration/messagebundle_sl.properties +67 -55
- package/src/sap/ui/integration/messagebundle_sv.properties +66 -54
- package/src/sap/ui/integration/messagebundle_th.properties +67 -55
- package/src/sap/ui/integration/messagebundle_tr.properties +67 -55
- package/src/sap/ui/integration/messagebundle_uk.properties +66 -54
- package/src/sap/ui/integration/messagebundle_vi.properties +66 -54
- package/src/sap/ui/integration/messagebundle_zh_CN.properties +67 -55
- package/src/sap/ui/integration/messagebundle_zh_TW.properties +67 -55
- package/src/sap/ui/integration/model/ContextModel.js +1 -1
- package/src/sap/ui/integration/model/ObservableModel.js +2 -14
- package/src/sap/ui/integration/schemas/adaptive-card.json +2399 -1010
- package/src/sap/ui/integration/schemas/sap-card.json +359 -53
- package/src/sap/ui/integration/themes/base/AnalyticsCloudContent.less +4 -0
- package/src/sap/ui/integration/themes/base/ListContentItem.less +111 -64
- package/src/sap/ui/integration/themes/base/Microchart.less +0 -1
- package/src/sap/ui/integration/thirdparty/adaptivecards.js +9724 -7530
- package/src/sap/ui/integration/util/BaseFactory.js +1 -1
- package/src/sap/ui/integration/util/BindingHelper.js +1 -1
- package/src/sap/ui/integration/util/BindingResolver.js +1 -1
- package/src/sap/ui/integration/util/CacheAndRequestDataProvider.js +75 -24
- package/src/sap/ui/integration/util/CardActions.js +1 -1
- package/src/sap/ui/integration/util/CardMerger.js +5 -3
- package/src/sap/ui/integration/util/CardObserver.js +1 -1
- package/src/sap/ui/integration/util/ContentFactory.js +1 -1
- package/src/sap/ui/integration/util/DataProvider.js +28 -14
- package/src/sap/ui/integration/util/DataProviderFactory.js +39 -8
- package/src/sap/ui/integration/util/Destinations.js +1 -1
- package/src/sap/ui/integration/util/ExtensionDataProvider.js +1 -1
- package/src/sap/ui/integration/util/HeaderFactory.js +8 -7
- package/src/sap/ui/integration/util/JSONBindingHelper.js +4 -1
- package/src/sap/ui/integration/util/LoadingProvider.js +1 -1
- package/src/sap/ui/integration/util/Manifest.js +14 -3
- package/src/sap/ui/integration/util/RequestDataProvider.js +6 -4
- package/src/sap/ui/integration/util/ServiceDataProvider.js +1 -1
- package/src/sap/ui/integration/util/ServiceManager.js +1 -1
- package/src/sap/ui/integration/util/Utils.js +1 -1
- package/src/sap/ui/integration/widgets/Card.js +164 -71
- package/src/sap-ui-integration-card-editor.js +15 -0
- package/src/sap-ui-integration-editor.js +4 -2
- package/ui5.yaml +4 -1
- package/src/sap/ui/integration/designtime/editor/fields/Settings.js +0 -629
- package/src/sap/ui/integration/designtime/editor/languages.json +0 -51
|
@@ -0,0 +1,2883 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* OpenUI5
|
|
3
|
+
* (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
sap.ui.define([
|
|
8
|
+
"ui5loader",
|
|
9
|
+
"sap/ui/core/Control",
|
|
10
|
+
"sap/ui/core/Core",
|
|
11
|
+
"sap/ui/core/Manifest",
|
|
12
|
+
"sap/base/util/deepClone",
|
|
13
|
+
"sap/base/util/deepEqual",
|
|
14
|
+
"sap/base/util/merge",
|
|
15
|
+
"sap/ui/base/Interface",
|
|
16
|
+
"sap/ui/integration/Designtime",
|
|
17
|
+
"sap/ui/model/json/JSONModel",
|
|
18
|
+
"sap/ui/integration/util/Utils",
|
|
19
|
+
"sap/ui/integration/util/Destinations",
|
|
20
|
+
"sap/ui/integration/util/DataProviderFactory",
|
|
21
|
+
"sap/m/Label",
|
|
22
|
+
"sap/m/Title",
|
|
23
|
+
"sap/m/Panel",
|
|
24
|
+
"sap/m/HBox",
|
|
25
|
+
"sap/m/VBox",
|
|
26
|
+
"sap/ui/core/Icon",
|
|
27
|
+
"sap/m/ResponsivePopover",
|
|
28
|
+
"sap/m/Popover",
|
|
29
|
+
"sap/m/Text",
|
|
30
|
+
"sap/base/Log",
|
|
31
|
+
"sap/ui/core/Popup",
|
|
32
|
+
"sap/base/i18n/ResourceBundle",
|
|
33
|
+
"sap/ui/thirdparty/URI",
|
|
34
|
+
"sap/ui/dom/includeStylesheet",
|
|
35
|
+
"sap/base/util/LoaderExtensions",
|
|
36
|
+
"sap/ui/core/theming/Parameters",
|
|
37
|
+
"sap/base/util/ObjectPath",
|
|
38
|
+
"sap/m/FormattedText",
|
|
39
|
+
"sap/m/MessageStrip",
|
|
40
|
+
"sap/m/ToolbarSpacer",
|
|
41
|
+
"sap/base/util/includes",
|
|
42
|
+
"sap/ui/model/resource/ResourceModel",
|
|
43
|
+
"./Manifest",
|
|
44
|
+
"./Merger",
|
|
45
|
+
"./Settings",
|
|
46
|
+
"sap/m/FlexItemData",
|
|
47
|
+
"sap/m/FlexBox",
|
|
48
|
+
"sap/m/Button"
|
|
49
|
+
], function (
|
|
50
|
+
ui5loader,
|
|
51
|
+
Control,
|
|
52
|
+
Core,
|
|
53
|
+
Manifest,
|
|
54
|
+
deepClone,
|
|
55
|
+
deepEqual,
|
|
56
|
+
merge,
|
|
57
|
+
Interface,
|
|
58
|
+
Designtime,
|
|
59
|
+
JSONModel,
|
|
60
|
+
Utils,
|
|
61
|
+
Destinations,
|
|
62
|
+
DataProviderFactory,
|
|
63
|
+
Label,
|
|
64
|
+
Title,
|
|
65
|
+
Panel,
|
|
66
|
+
HBox,
|
|
67
|
+
VBox,
|
|
68
|
+
Icon,
|
|
69
|
+
RPopover,
|
|
70
|
+
Popover,
|
|
71
|
+
Text,
|
|
72
|
+
Log,
|
|
73
|
+
Popup,
|
|
74
|
+
ResourceBundle,
|
|
75
|
+
URI,
|
|
76
|
+
includeStylesheet,
|
|
77
|
+
LoaderExtensions,
|
|
78
|
+
Parameters,
|
|
79
|
+
ObjectPath,
|
|
80
|
+
FormattedText,
|
|
81
|
+
MessageStrip,
|
|
82
|
+
Separator,
|
|
83
|
+
includes,
|
|
84
|
+
ResourceModel,
|
|
85
|
+
EditorManifest,
|
|
86
|
+
Merger,
|
|
87
|
+
Settings,
|
|
88
|
+
FlexItemData,
|
|
89
|
+
FlexBox,
|
|
90
|
+
Button
|
|
91
|
+
) {
|
|
92
|
+
"use strict";
|
|
93
|
+
|
|
94
|
+
//workaround issue of orientation change fired that reapplies position and closes the popup
|
|
95
|
+
//issue is not predictable and depends on host environment. Solution - apply all, simply do not close for position changes.
|
|
96
|
+
var popoverInit = Popover.prototype.init;
|
|
97
|
+
Popover.prototype.init = function () {
|
|
98
|
+
popoverInit.apply(this, arguments);
|
|
99
|
+
var fn = this.oPopup._applyPosition,
|
|
100
|
+
that = this;
|
|
101
|
+
this.oPopup._applyPosition = function () {
|
|
102
|
+
var fnClose = that.close;
|
|
103
|
+
that.close = function () { };
|
|
104
|
+
fn.apply(this, arguments);
|
|
105
|
+
that.close = fnClose;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
function getHigherZIndex(source) {
|
|
110
|
+
if (source && source.nodeType !== 1) {
|
|
111
|
+
return 0;
|
|
112
|
+
}
|
|
113
|
+
var z = parseInt(window.getComputedStyle(source).getPropertyValue('z-index'));
|
|
114
|
+
if (isNaN(z)) {
|
|
115
|
+
return getHigherZIndex(source.parentNode);
|
|
116
|
+
}
|
|
117
|
+
return z + 1;
|
|
118
|
+
}
|
|
119
|
+
var REGEXP_TRANSLATABLE = /\{\{(?!parameters.)(?!destinations.)([^\}\}]+)\}\}/g,
|
|
120
|
+
REGEXP_PARAMETERS = /\{\{parameters\.([^\}\}]+)/g,
|
|
121
|
+
CONTEXT_TIMEOUT = 5000,
|
|
122
|
+
oResourceBundle = Core.getLibraryResourceBundle("sap.ui.integration"),
|
|
123
|
+
MessageStripId = "__strip0";
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Constructor for a new <code>Editor</code>.
|
|
127
|
+
*
|
|
128
|
+
* @param {string} [sId] ID for the new control, generated automatically if no ID is given
|
|
129
|
+
* @param {object} [mSettings] Initial settings for the new control
|
|
130
|
+
*
|
|
131
|
+
* @class
|
|
132
|
+
* A control allows to edit manifest settings from a designtime module.
|
|
133
|
+
*
|
|
134
|
+
* @extends sap.ui.core.Control
|
|
135
|
+
*
|
|
136
|
+
* @author SAP SE
|
|
137
|
+
* @version 1.96.2
|
|
138
|
+
* @constructor
|
|
139
|
+
* @since 1.94
|
|
140
|
+
* @private
|
|
141
|
+
* @experimental since 1.94.0
|
|
142
|
+
* @alias sap.ui.integration.editor.Editor
|
|
143
|
+
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
|
|
144
|
+
*/
|
|
145
|
+
var Editor = Control.extend("sap.ui.integration.editor.Editor", /** @lends sap.ui.integration.editor.Editor.prototype */ {
|
|
146
|
+
metadata: {
|
|
147
|
+
library: "sap.ui.integration",
|
|
148
|
+
properties: {
|
|
149
|
+
/**
|
|
150
|
+
* admin, content, translation
|
|
151
|
+
* Used to control the editors capabilities
|
|
152
|
+
*/
|
|
153
|
+
mode: {
|
|
154
|
+
type: "string",
|
|
155
|
+
defaultValue: "admin"
|
|
156
|
+
},
|
|
157
|
+
language: {
|
|
158
|
+
type: "string",
|
|
159
|
+
defaultValue: ""
|
|
160
|
+
},
|
|
161
|
+
allowDynamicValues: {
|
|
162
|
+
type: "boolean",
|
|
163
|
+
defaultValue: false
|
|
164
|
+
},
|
|
165
|
+
allowSettings: {
|
|
166
|
+
type: "boolean",
|
|
167
|
+
defaultValue: false
|
|
168
|
+
},
|
|
169
|
+
designtime: {
|
|
170
|
+
type: "object"
|
|
171
|
+
},
|
|
172
|
+
section: {
|
|
173
|
+
type: "string",
|
|
174
|
+
defaultValue: "sap.card"
|
|
175
|
+
},
|
|
176
|
+
host: {
|
|
177
|
+
type: "string",
|
|
178
|
+
defaultValue: ""
|
|
179
|
+
},
|
|
180
|
+
baseUrl: {
|
|
181
|
+
type: "sap.ui.core.URI",
|
|
182
|
+
defaultValue: null
|
|
183
|
+
},
|
|
184
|
+
json: {
|
|
185
|
+
type: "object"
|
|
186
|
+
},
|
|
187
|
+
previewPosition:{
|
|
188
|
+
type: "string",
|
|
189
|
+
defaultValue: "right" // value can be "top", "bottom", "left", "right"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
aggregations: {
|
|
193
|
+
/**
|
|
194
|
+
* Defines the header of the Editor.
|
|
195
|
+
*/
|
|
196
|
+
_formContent: {
|
|
197
|
+
type: "sap.ui.core.Control",
|
|
198
|
+
multiple: true,
|
|
199
|
+
visibility: "hidden"
|
|
200
|
+
},
|
|
201
|
+
_preview: {
|
|
202
|
+
type: "sap.ui.core.Control",
|
|
203
|
+
multiple: false,
|
|
204
|
+
visibility: "hidden"
|
|
205
|
+
},
|
|
206
|
+
_messageStrip: {
|
|
207
|
+
type: "sap.m.MessageStrip",
|
|
208
|
+
multiple: false,
|
|
209
|
+
visibility: "hidden"
|
|
210
|
+
},
|
|
211
|
+
_extension: {
|
|
212
|
+
type: "sap.ui.integration.editor.Extension",
|
|
213
|
+
multiple: false,
|
|
214
|
+
visibility: "hidden"
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
events: {
|
|
218
|
+
ready: {},
|
|
219
|
+
manifestReady: {}
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
renderer: function (oRm, oControl) {
|
|
223
|
+
var oPreview = oControl.getAggregation("_preview");
|
|
224
|
+
var bShowPreview = oControl.getMode() !== "translation" && oControl.hasPreview();
|
|
225
|
+
var sPreviewPosition = oControl.getPreviewPosition();
|
|
226
|
+
if (bShowPreview
|
|
227
|
+
&& (sPreviewPosition === "top" || sPreviewPosition === "bottom")) {
|
|
228
|
+
oRm.openStart("div");
|
|
229
|
+
oRm.writeElementData(oControl);
|
|
230
|
+
oRm.openEnd();
|
|
231
|
+
//render the additional content if alignment of it is "top"
|
|
232
|
+
if (oControl.isReady() && sPreviewPosition === "top") {
|
|
233
|
+
oRm.renderControl(oPreview);
|
|
234
|
+
oRm.close("div");
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
oRm.openStart("div");
|
|
238
|
+
oRm.addClass("sapUiIntegrationEditor");
|
|
239
|
+
if (bShowPreview && sPreviewPosition === "left") {
|
|
240
|
+
oRm.writeElementData(oControl);
|
|
241
|
+
oRm.openEnd();
|
|
242
|
+
if (oControl.isReady()){
|
|
243
|
+
oRm.renderControl(oPreview);
|
|
244
|
+
oRm.close("div");
|
|
245
|
+
}
|
|
246
|
+
} else if (bShowPreview
|
|
247
|
+
&& (sPreviewPosition === "bottom" || sPreviewPosition === "top")) {
|
|
248
|
+
oRm.openEnd();
|
|
249
|
+
} else {
|
|
250
|
+
oRm.writeElementData(oControl);
|
|
251
|
+
oRm.openEnd();
|
|
252
|
+
}
|
|
253
|
+
if (oControl.isReady()) {
|
|
254
|
+
//surrounding div tag for form <div class="sapUiIntegrationEditorForm"
|
|
255
|
+
oRm.openStart("div");
|
|
256
|
+
oRm.addClass("sapUiIntegrationEditorForm");
|
|
257
|
+
if (oControl.getMode() !== "translation") {
|
|
258
|
+
oRm.addClass("settingsButtonSpace");
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
oRm.writeClasses();
|
|
262
|
+
oRm.openEnd();
|
|
263
|
+
if (oControl.getMode() !== "translation") {
|
|
264
|
+
oRm.renderControl(oControl.getAggregation("_messageStrip"));
|
|
265
|
+
}
|
|
266
|
+
var aItems = oControl.getAggregation("_formContent");
|
|
267
|
+
//render items
|
|
268
|
+
if (aItems) {
|
|
269
|
+
var oPanel;
|
|
270
|
+
var oLanguagePanel;
|
|
271
|
+
var oLabelItemForNotWrapping;
|
|
272
|
+
var oColFields = [];
|
|
273
|
+
var oOriginalField;
|
|
274
|
+
var addColFields = function () {
|
|
275
|
+
if (oColFields.length > 0) {
|
|
276
|
+
var iLess = 2 - oColFields.length;
|
|
277
|
+
for (var n = 0; n < iLess; n++) {
|
|
278
|
+
oColFields.push(new VBox());
|
|
279
|
+
}
|
|
280
|
+
oPanel.addContent(new FlexBox({
|
|
281
|
+
alignItems: "Start",
|
|
282
|
+
justifyContent: "SpaceBetween",
|
|
283
|
+
items: oColFields
|
|
284
|
+
}));
|
|
285
|
+
oColFields = [];
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
for (var i = 0; i < aItems.length; i++) {
|
|
289
|
+
var oItem = aItems[i];
|
|
290
|
+
if (oControl.getMode() !== "translation") {
|
|
291
|
+
if (oItem.isA("sap.m.Panel")) {
|
|
292
|
+
if (oPanel) {
|
|
293
|
+
//add current col fields to previous panel, then empty the col fields list
|
|
294
|
+
addColFields();
|
|
295
|
+
//render previous panel
|
|
296
|
+
if (oPanel.getContent().length > 0) {
|
|
297
|
+
oRm.renderControl(oPanel);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
oPanel = oItem;
|
|
301
|
+
oPanel.addStyleClass("sapUiIntegrationEditorItem");
|
|
302
|
+
if (i === aItems.length - 1) {
|
|
303
|
+
//add current col fields to panel, then empty the col fields list
|
|
304
|
+
addColFields();
|
|
305
|
+
if (oPanel.getContent().length > 0) {
|
|
306
|
+
oRm.renderControl(oPanel);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
// add style class for the hint under group and checkbox/toggle
|
|
312
|
+
if (oItem.isA("sap.m.FormattedText")) {
|
|
313
|
+
oPanel.addContent(oItem.addStyleClass("sapUiIntegrationEditorHint"));
|
|
314
|
+
if (i === aItems.length - 1) {
|
|
315
|
+
//add current col fields to panel, then empty the col fields list
|
|
316
|
+
addColFields();
|
|
317
|
+
if (oPanel.getContent().length > 0) {
|
|
318
|
+
oRm.renderControl(oPanel);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
var oLayout = oItem._layout;
|
|
325
|
+
if (oItem.isA("sap.m.Label")) {
|
|
326
|
+
oItem.addStyleClass("sapUiIntegrationEditorItemLabel");
|
|
327
|
+
if (oLayout && !deepEqual(oLayout, {})) {
|
|
328
|
+
if (oLayout.alignment && oLayout.alignment.label === "end") {
|
|
329
|
+
oItem.setTextAlign("End");
|
|
330
|
+
}
|
|
331
|
+
oLabelItemForNotWrapping = oItem;
|
|
332
|
+
} else {
|
|
333
|
+
//if cols === 1 and reach the col size, add the col fields to panel, then empty the col fields list
|
|
334
|
+
//if cols === 2, add the col fields to panel, then empty the col fields list
|
|
335
|
+
if (oItem._cols === 2 || (oItem._cols === 1 && oColFields.length === 2)) {
|
|
336
|
+
addColFields();
|
|
337
|
+
}
|
|
338
|
+
oPanel.addContent(oItem);
|
|
339
|
+
}
|
|
340
|
+
} else if (oItem.isA("sap.m.ToolbarSpacer")) {
|
|
341
|
+
addColFields();
|
|
342
|
+
if (oItem._hasLine) {
|
|
343
|
+
oItem.addStyleClass("sapUiIntegrationEditorSpacerWithLine");
|
|
344
|
+
} else {
|
|
345
|
+
oItem.addStyleClass("sapUiIntegrationEditorSpacerWithoutLine");
|
|
346
|
+
}
|
|
347
|
+
oPanel.addContent(oItem);
|
|
348
|
+
} else {
|
|
349
|
+
var oConfig = oItem.getConfiguration(),
|
|
350
|
+
aInfoHBox = new HBox(),
|
|
351
|
+
iInfoHBoxWidth = 0.1,
|
|
352
|
+
iSettingsHBoxWidth = 0,
|
|
353
|
+
oLabelHBox;
|
|
354
|
+
if (oItem._descriptionIcon) {
|
|
355
|
+
aInfoHBox.addItem(oItem._descriptionIcon);
|
|
356
|
+
iInfoHBoxWidth += 0.9;
|
|
357
|
+
}
|
|
358
|
+
var oMessageIcon = Core.byId(oItem.getAssociation("_messageIcon"));
|
|
359
|
+
if (oItem.getAssociation("_messageIcon") && oMessageIcon) {
|
|
360
|
+
aInfoHBox.addItem(oMessageIcon);
|
|
361
|
+
iInfoHBoxWidth += 1.2;
|
|
362
|
+
}
|
|
363
|
+
if (oItem._settingsButton) {
|
|
364
|
+
oItem._settingsButton.addStyleClass("sapUiIntegrationEditorSettingsButton");
|
|
365
|
+
iSettingsHBoxWidth = 2;
|
|
366
|
+
}
|
|
367
|
+
var oFlexItemDataForSettings = new FlexItemData({
|
|
368
|
+
growFactor: 10,
|
|
369
|
+
maxWidth: "calc(100% - " + iSettingsHBoxWidth + "rem)"
|
|
370
|
+
});
|
|
371
|
+
var oFlexItemDataForInfo = new FlexItemData({
|
|
372
|
+
maxWidth: "calc(100% - " + iInfoHBoxWidth + "rem)"
|
|
373
|
+
});
|
|
374
|
+
if (oLabelItemForNotWrapping) {
|
|
375
|
+
var oHBox,
|
|
376
|
+
oFlexBox,
|
|
377
|
+
sLabelWidth = "50%";
|
|
378
|
+
if (oLayout && oLayout["label-width"]) {
|
|
379
|
+
sLabelWidth = oLayout["label-width"];
|
|
380
|
+
}
|
|
381
|
+
var iLabelWidth = parseInt(sLabelWidth);
|
|
382
|
+
var iFieldWidth = 100 - iLabelWidth;
|
|
383
|
+
if (oItem._cols === 2) {
|
|
384
|
+
iLabelWidth = iLabelWidth - 0.5;
|
|
385
|
+
iFieldWidth = iFieldWidth - 0.5;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (oLayout.alignment && oLayout.alignment.field === "end") {
|
|
389
|
+
oItem.addStyleClass("sapUiIntegrationEditorFieldAlignEnd");
|
|
390
|
+
}
|
|
391
|
+
if (oLayout.alignment && oLayout.alignment.label === "end") {
|
|
392
|
+
oLabelItemForNotWrapping.setLayoutData(new FlexItemData({
|
|
393
|
+
maxWidth: "calc(100% - " + iInfoHBoxWidth + "rem)",
|
|
394
|
+
minWidth: "calc(100% - " + iInfoHBoxWidth + "rem)"
|
|
395
|
+
}));
|
|
396
|
+
} else {
|
|
397
|
+
oLabelItemForNotWrapping.setLayoutData(oFlexItemDataForInfo);
|
|
398
|
+
}
|
|
399
|
+
if (aInfoHBox.getItems().length > 0) {
|
|
400
|
+
oLabelItemForNotWrapping.addStyleClass("sapUiIntegrationEditorItemLabelWithInfo");
|
|
401
|
+
oLabelHBox = new HBox({
|
|
402
|
+
items: [
|
|
403
|
+
oLabelItemForNotWrapping,
|
|
404
|
+
aInfoHBox
|
|
405
|
+
]
|
|
406
|
+
});
|
|
407
|
+
} else {
|
|
408
|
+
oLabelHBox = oLabelItemForNotWrapping;
|
|
409
|
+
}
|
|
410
|
+
if (oLayout && oLayout.position && oLayout.position === "field-label") {
|
|
411
|
+
oLabelHBox.setLayoutData(oFlexItemDataForSettings);
|
|
412
|
+
oFlexBox = new HBox({
|
|
413
|
+
alignItems: "Start",
|
|
414
|
+
justifyContent: "SpaceBetween",
|
|
415
|
+
items: [
|
|
416
|
+
oLabelHBox,
|
|
417
|
+
oItem._settingsButton
|
|
418
|
+
]
|
|
419
|
+
});
|
|
420
|
+
oFlexBox.setLayoutData(new FlexItemData({
|
|
421
|
+
growFactor: iLabelWidth,
|
|
422
|
+
maxWidth: iLabelWidth + "%"
|
|
423
|
+
}));
|
|
424
|
+
oItem.setLayoutData(new FlexItemData({
|
|
425
|
+
growFactor: iFieldWidth,
|
|
426
|
+
maxWidth: iFieldWidth + "%"
|
|
427
|
+
}));
|
|
428
|
+
oHBox = new HBox({
|
|
429
|
+
alignItems: "Start",
|
|
430
|
+
justifyContent: "SpaceBetween",
|
|
431
|
+
items: [
|
|
432
|
+
oItem,
|
|
433
|
+
oFlexBox
|
|
434
|
+
]
|
|
435
|
+
});
|
|
436
|
+
} else {
|
|
437
|
+
oItem.setLayoutData(oFlexItemDataForSettings);
|
|
438
|
+
oFlexBox = new HBox({
|
|
439
|
+
alignItems: "Start",
|
|
440
|
+
justifyContent: "SpaceBetween",
|
|
441
|
+
items: [
|
|
442
|
+
oItem,
|
|
443
|
+
oItem._settingsButton
|
|
444
|
+
]
|
|
445
|
+
});
|
|
446
|
+
oLabelHBox.setLayoutData(new FlexItemData({
|
|
447
|
+
growFactor: iLabelWidth,
|
|
448
|
+
maxWidth: iLabelWidth + "%"
|
|
449
|
+
}));
|
|
450
|
+
oFlexBox.setLayoutData(new FlexItemData({
|
|
451
|
+
growFactor: iFieldWidth,
|
|
452
|
+
maxWidth: iFieldWidth + "%"
|
|
453
|
+
}));
|
|
454
|
+
oHBox = new HBox({
|
|
455
|
+
alignItems: "Start",
|
|
456
|
+
justifyContent: "SpaceBetween",
|
|
457
|
+
items: [
|
|
458
|
+
oLabelHBox,
|
|
459
|
+
oFlexBox
|
|
460
|
+
]
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
//render lable and field for NotWrapping parameter
|
|
464
|
+
if (oItem._cols === 1) {
|
|
465
|
+
if (oColFields.length === 2) {
|
|
466
|
+
addColFields();
|
|
467
|
+
}
|
|
468
|
+
if (oConfig.hint) {
|
|
469
|
+
var oHint = oControl._createHint(oConfig.hint);
|
|
470
|
+
var oColVBox = new VBox({
|
|
471
|
+
items: [
|
|
472
|
+
oHBox,
|
|
473
|
+
oHint.addStyleClass("sapUiIntegrationEditorHint")
|
|
474
|
+
]
|
|
475
|
+
});
|
|
476
|
+
oColVBox.addStyleClass("col1");
|
|
477
|
+
oColFields.push(oColVBox);
|
|
478
|
+
} else {
|
|
479
|
+
oHBox.addStyleClass("col1");
|
|
480
|
+
oColFields.push(oHBox);
|
|
481
|
+
}
|
|
482
|
+
} else {
|
|
483
|
+
addColFields();
|
|
484
|
+
oPanel.addContent(oHBox);
|
|
485
|
+
}
|
|
486
|
+
oLabelItemForNotWrapping = null;
|
|
487
|
+
} else {
|
|
488
|
+
var oLabel = oPanel.getContent().pop();
|
|
489
|
+
oLabel.setLayoutData(oFlexItemDataForInfo);
|
|
490
|
+
if (aInfoHBox.getItems().length > 0) {
|
|
491
|
+
oLabel.addStyleClass("sapUiIntegrationEditorItemLabelWithInfo");
|
|
492
|
+
oLabelHBox = new HBox({
|
|
493
|
+
items: [
|
|
494
|
+
oLabel,
|
|
495
|
+
aInfoHBox
|
|
496
|
+
]
|
|
497
|
+
});
|
|
498
|
+
} else {
|
|
499
|
+
oLabelHBox = oLabel;
|
|
500
|
+
}
|
|
501
|
+
oLabelHBox.setLayoutData(oFlexItemDataForSettings);
|
|
502
|
+
var oLabelFlexBox = new FlexBox({
|
|
503
|
+
alignItems: "Start",
|
|
504
|
+
justifyContent: "SpaceBetween",
|
|
505
|
+
items: [
|
|
506
|
+
oLabelHBox,
|
|
507
|
+
oItem._settingsButton
|
|
508
|
+
]
|
|
509
|
+
});
|
|
510
|
+
if (oItem._cols === 1) {
|
|
511
|
+
var oColVBox = new VBox({
|
|
512
|
+
items: [
|
|
513
|
+
oLabelFlexBox,
|
|
514
|
+
oItem
|
|
515
|
+
]
|
|
516
|
+
});
|
|
517
|
+
if (oConfig.hint) {
|
|
518
|
+
var oHint = oControl._createHint(oConfig.hint);
|
|
519
|
+
oColVBox.addItem(oHint.addStyleClass("sapUiIntegrationEditorHint"));
|
|
520
|
+
}
|
|
521
|
+
oColVBox.addStyleClass("col1");
|
|
522
|
+
oColFields.push(oColVBox);
|
|
523
|
+
} else {
|
|
524
|
+
oPanel.addContent(oLabelFlexBox);
|
|
525
|
+
oPanel.addContent(oItem);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
if (i === aItems.length - 1) {
|
|
530
|
+
//add current col fields to panel, then empty the col fields list
|
|
531
|
+
addColFields();
|
|
532
|
+
if (oPanel.getContent().length > 0) {
|
|
533
|
+
oRm.renderControl(oPanel);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
} else {
|
|
537
|
+
if (i === 0) {
|
|
538
|
+
//render the top panel of translation
|
|
539
|
+
oLanguagePanel = oItem;
|
|
540
|
+
oRm.renderControl(oLanguagePanel);
|
|
541
|
+
oLanguagePanel.addStyleClass("sapUiIntegrationEditorTranslationPanel");
|
|
542
|
+
continue;
|
|
543
|
+
}
|
|
544
|
+
if (oItem.isA("sap.m.Panel")) {
|
|
545
|
+
//add sub panel if it has content into top panel
|
|
546
|
+
if (oPanel && oPanel.getContent().length > 0) {
|
|
547
|
+
oLanguagePanel.addContent(oPanel);
|
|
548
|
+
}
|
|
549
|
+
oPanel = oItem;
|
|
550
|
+
oPanel.addStyleClass("sapUiIntegrationEditorTranslationSubPanel");
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
if (oItem.isA("sap.m.ToolbarSpacer")) {
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
if (oItem.isA("sap.m.FormattedText")) {
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
559
|
+
if (oItem.isA("sap.m.Label")) {
|
|
560
|
+
oPanel.addContent(oItem);
|
|
561
|
+
continue;
|
|
562
|
+
}
|
|
563
|
+
//oItem.addStyleClass("language");
|
|
564
|
+
if (oItem.isOrigLangField) {
|
|
565
|
+
oOriginalField = oItem;
|
|
566
|
+
continue;
|
|
567
|
+
}
|
|
568
|
+
oOriginalField.addStyleClass("sapUiIntegrationFieldTranslationText");
|
|
569
|
+
//bind originalField and translation field together
|
|
570
|
+
var oHBox = new HBox({
|
|
571
|
+
items: [
|
|
572
|
+
oOriginalField,
|
|
573
|
+
oItem
|
|
574
|
+
]
|
|
575
|
+
}).addStyleClass("notWrappingRow");
|
|
576
|
+
oPanel.addContent(oHBox);
|
|
577
|
+
if (i === aItems.length - 1) {
|
|
578
|
+
oLanguagePanel.addContent(oPanel);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
oRm.close("div");
|
|
584
|
+
//render the additional content if alignment of it is "right"
|
|
585
|
+
if (bShowPreview && sPreviewPosition === "right") {
|
|
586
|
+
oRm.renderControl(oPreview);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
oRm.close("div");
|
|
590
|
+
//render the additional content if alignment of it is "right"
|
|
591
|
+
if (oControl.isReady() && bShowPreview && sPreviewPosition === "bottom") {
|
|
592
|
+
oRm.renderControl(oPreview);
|
|
593
|
+
oRm.close("div");
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
/**
|
|
598
|
+
* Init of the editor
|
|
599
|
+
*/
|
|
600
|
+
Editor.prototype.init = function () {
|
|
601
|
+
this._ready = false;
|
|
602
|
+
this._aFieldReadyPromise = [];
|
|
603
|
+
this._oResourceBundle = Core.getLibraryResourceBundle("sap.ui.integration");
|
|
604
|
+
this._appliedLayerManifestChanges = [];
|
|
605
|
+
this._currentLayerManifestChanges = {};
|
|
606
|
+
this._mDestinationDataProviders = {};
|
|
607
|
+
this.setAggregation("_messageStrip", new MessageStrip({
|
|
608
|
+
showIcon: false
|
|
609
|
+
}));
|
|
610
|
+
/**
|
|
611
|
+
* Facade of the {@link sap.ui.integration.editor.Editor} control.
|
|
612
|
+
* @interface
|
|
613
|
+
* @name sap.ui.integration.editor.EditorFacade
|
|
614
|
+
* @experimental since 1.94
|
|
615
|
+
* @public
|
|
616
|
+
* @author SAP SE
|
|
617
|
+
* @version 1.96.2
|
|
618
|
+
* @borrows sap.ui.integration.editor.Editor#getParameters as getParameters
|
|
619
|
+
* @borrows sap.ui.integration.editor.Editor#resolveDestination as resolveDestination
|
|
620
|
+
* @borrows sap.ui.integration.editor.Editor#request as request
|
|
621
|
+
* @borrows sap.ui.integration.editor.Editor#getModel as getModel
|
|
622
|
+
*/
|
|
623
|
+
this._oLimitedInterface = new Interface(this, [
|
|
624
|
+
"getParameters",
|
|
625
|
+
"resolveDestination",
|
|
626
|
+
"request",
|
|
627
|
+
"getModel"
|
|
628
|
+
]);
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
Editor.prototype.getParameters = function () {
|
|
632
|
+
if (!this._isManifestReady) {
|
|
633
|
+
Log.error("The manifest is not ready. Consider using the 'manifestReady' event.", "sap.ui.integration.editor.Editor");
|
|
634
|
+
return null;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
var oParams = this._oEditorManifest.getProcessedParameters(),
|
|
638
|
+
oResultParams = {},
|
|
639
|
+
sKey;
|
|
640
|
+
|
|
641
|
+
for (sKey in oParams) {
|
|
642
|
+
oResultParams[sKey] = oParams[sKey].value;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
return oResultParams;
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
Editor.prototype.resolveDestination = function (sKey) {
|
|
649
|
+
return this._oDestinations.getUrl(sKey);
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Returns whether the editor is ready to be used
|
|
654
|
+
*/
|
|
655
|
+
Editor.prototype.isReady = function () {
|
|
656
|
+
return this._ready;
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
Editor.prototype.hasPreview = function() {
|
|
660
|
+
var oPreview = this.getAggregation("_preview");
|
|
661
|
+
if (oPreview && oPreview.visible !== false) {
|
|
662
|
+
return true;
|
|
663
|
+
}
|
|
664
|
+
return false;
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
Editor.prototype.flattenData = function(oData, s, a, path) {
|
|
668
|
+
path = path || "";
|
|
669
|
+
a = a || [];
|
|
670
|
+
if (typeof oData === "object") {
|
|
671
|
+
if (!oData[s]) {
|
|
672
|
+
for (var n in oData) {
|
|
673
|
+
this.flattenData(oData[n], s, a, path + "/" + n);
|
|
674
|
+
}
|
|
675
|
+
} else {
|
|
676
|
+
//found leave
|
|
677
|
+
if (oData.type) {
|
|
678
|
+
a.push({
|
|
679
|
+
path: oData.pathvalue || path.substring(1),
|
|
680
|
+
value: oData.pathvalue || "{context>" + path.substring(1) + "/value}",
|
|
681
|
+
object: oData
|
|
682
|
+
});
|
|
683
|
+
} else {
|
|
684
|
+
a.push({
|
|
685
|
+
path: path.substring(1),
|
|
686
|
+
object: oData
|
|
687
|
+
});
|
|
688
|
+
for (var n in oData) {
|
|
689
|
+
this.flattenData(oData[n], s, a, path + "/" + n);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
return a;
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
Editor.prototype.setJson = function (vIdOrSettings, bSuppress) {
|
|
698
|
+
this._ready = false;
|
|
699
|
+
if (deepEqual(vIdOrSettings, this._preIdOrSettings)) {
|
|
700
|
+
return this;
|
|
701
|
+
}
|
|
702
|
+
this._preIdOrSettings = deepClone(vIdOrSettings, 500);
|
|
703
|
+
if (typeof vIdOrSettings === "string") {
|
|
704
|
+
try {
|
|
705
|
+
vIdOrSettings = JSON.parse(vIdOrSettings);
|
|
706
|
+
} catch (ex) {
|
|
707
|
+
//not json
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
if (typeof vIdOrSettings === "object") {
|
|
711
|
+
if (vIdOrSettings.manifestChanges) {
|
|
712
|
+
//remove the changes from the current layer
|
|
713
|
+
this._filterManifestChangesByLayer(vIdOrSettings);
|
|
714
|
+
}
|
|
715
|
+
if (this._manifestModel) {
|
|
716
|
+
//already created
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
if (this._oDesigntimeInstance) {
|
|
720
|
+
this._oDesigntimeInstance.destroy();
|
|
721
|
+
}
|
|
722
|
+
if (vIdOrSettings.host) {
|
|
723
|
+
this.setProperty("host", vIdOrSettings.host);
|
|
724
|
+
}
|
|
725
|
+
if (vIdOrSettings.baseUrl) {
|
|
726
|
+
this.setProperty("baseUrl", vIdOrSettings.baseUrl);
|
|
727
|
+
}
|
|
728
|
+
this._appliedLayerManifestChanges = vIdOrSettings.manifestChanges;
|
|
729
|
+
|
|
730
|
+
this.createManifest(vIdOrSettings, bSuppress);
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
|
|
734
|
+
Editor.prototype.createManifest = function (vIdOrSettings, bSuppress) {
|
|
735
|
+
var sBaseUrl = this.getBaseUrl();
|
|
736
|
+
var mOptions = {},
|
|
737
|
+
vManifest = vIdOrSettings.manifest;
|
|
738
|
+
this._isManifestReady = false;
|
|
739
|
+
|
|
740
|
+
if (typeof vManifest === "string") {
|
|
741
|
+
mOptions.manifestUrl = vManifest;
|
|
742
|
+
vManifest = null;
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
if (this._oEditorManifest) {
|
|
746
|
+
this._oEditorManifest.destroy();
|
|
747
|
+
}
|
|
748
|
+
this.destroyAggregation("_extension");
|
|
749
|
+
var iCurrentModeIndex = Merger.layers[this.getMode()];
|
|
750
|
+
|
|
751
|
+
this._oEditorManifest = new EditorManifest(this.getSection(), vManifest, sBaseUrl, vIdOrSettings.manifestChanges);
|
|
752
|
+
this._oEditorManifest
|
|
753
|
+
.load(mOptions)
|
|
754
|
+
.then(function () {
|
|
755
|
+
this._registerManifestModulePath();
|
|
756
|
+
this._oInitialManifestModel = new JSONModel(this._oEditorManifest._oInitialJson);
|
|
757
|
+
this.setProperty("json", this._oEditorManifest._oInitialJson, bSuppress);
|
|
758
|
+
var oManifestJson = this._oEditorManifest._oManifest.getRawJson();
|
|
759
|
+
var _beforeCurrentLayer = merge({}, oManifestJson);
|
|
760
|
+
this._beforeManifestModel = new JSONModel(_beforeCurrentLayer);
|
|
761
|
+
if (iCurrentModeIndex < Merger.layers["translation"] && this._currentLayerManifestChanges) {
|
|
762
|
+
//merge if not translation
|
|
763
|
+
oManifestJson = Merger.mergeDelta(oManifestJson, [this._currentLayerManifestChanges]);
|
|
764
|
+
}
|
|
765
|
+
//create a manifest model after the changes are merged
|
|
766
|
+
this._manifestModel = new JSONModel(oManifestJson);
|
|
767
|
+
this._isManifestReady = true;
|
|
768
|
+
this.fireManifestReady();
|
|
769
|
+
//use the translations
|
|
770
|
+
this._loadDefaultTranslations();
|
|
771
|
+
//add a context model
|
|
772
|
+
this._createContextModel();
|
|
773
|
+
if (this._oEditorManifest.getResourceBundle()) {
|
|
774
|
+
this._enhanceI18nModel(this._oEditorManifest.getResourceBundle());
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
return this._loadExtension().then(function() {
|
|
778
|
+
this._initInternal();
|
|
779
|
+
}.bind(this));
|
|
780
|
+
}.bind(this));
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Registers the manifest ID as a module path.
|
|
785
|
+
*/
|
|
786
|
+
Editor.prototype._registerManifestModulePath = function () {
|
|
787
|
+
if (!this._oEditorManifest) {
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
this._sAppId = this._oEditorManifest.get("/sap.app/id");
|
|
791
|
+
if (this._sAppId) {
|
|
792
|
+
LoaderExtensions.registerResourcePath(this._sAppId.replace(/\./g, "/"), this._oEditorManifest.getUrl() || "/");
|
|
793
|
+
} else {
|
|
794
|
+
Log.error("sap.app/id entry in the manifest is mandatory");
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
Editor.prototype._loadDefaultTranslations = function () {
|
|
799
|
+
if (this._defaultTranslationsLoaded) {
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
var oResourceBundle = Core.getLibraryResourceBundle("sap.ui.integration");
|
|
804
|
+
this._enhanceI18nModel(oResourceBundle);
|
|
805
|
+
this._defaultTranslationsLoaded = true;
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
Editor.prototype._enhanceI18nModel = function (oResourceBundle) {
|
|
809
|
+
var oResourceModel = this.getModel("i18n");
|
|
810
|
+
|
|
811
|
+
if (oResourceModel) {
|
|
812
|
+
if (oResourceModel.getResourceBundle().oUrlInfo.url !== oResourceBundle.oUrlInfo.url) {
|
|
813
|
+
oResourceModel.enhance(oResourceBundle);
|
|
814
|
+
this._oResourceBundle = oResourceModel.getResourceBundle();
|
|
815
|
+
}
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
oResourceModel = new ResourceModel({
|
|
820
|
+
bundle: oResourceBundle
|
|
821
|
+
});
|
|
822
|
+
|
|
823
|
+
this.setModel(oResourceModel, "i18n");
|
|
824
|
+
this._oResourceBundle = oResourceBundle;
|
|
825
|
+
};
|
|
826
|
+
|
|
827
|
+
Editor.prototype._loadExtension = function () {
|
|
828
|
+
var sExtensionPath = this._oEditorManifest.get(this.getConfigurationPath() + "/extension") || this._oEditorManifest.get("/" + this.getSection() + "/extension");
|
|
829
|
+
if (!sExtensionPath) {
|
|
830
|
+
Log.info("Extension is not defined in manifest, do not load it.");
|
|
831
|
+
return new Promise(function (resolve, reject) {
|
|
832
|
+
resolve();
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
var sFullExtensionPath = this._sAppId.replace(/\./g, "/") + "/" + sExtensionPath;
|
|
837
|
+
|
|
838
|
+
return new Promise(function (resolve, reject) {
|
|
839
|
+
sap.ui.require([sFullExtensionPath], function (ExtensionSubclass) {
|
|
840
|
+
var oExtension = new ExtensionSubclass();
|
|
841
|
+
oExtension._setEditor(this, this._oLimitedInterface);
|
|
842
|
+
this.setAggregation("_extension", oExtension); // the framework validates that the subclass extends "sap.ui.integration.Extension"
|
|
843
|
+
resolve();
|
|
844
|
+
}.bind(this), function (vErr) {
|
|
845
|
+
Log.error("Failed to load " + sExtensionPath + ". Check if the path is correct. Reason: " + vErr);
|
|
846
|
+
reject(vErr);
|
|
847
|
+
});
|
|
848
|
+
}.bind(this));
|
|
849
|
+
};
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Performs an HTTP request using the given configuration.
|
|
853
|
+
*
|
|
854
|
+
* @public
|
|
855
|
+
* @experimental since 1.94
|
|
856
|
+
* @param {object} oConfiguration The configuration of the request.
|
|
857
|
+
* @param {string} oConfiguration.URL The URL of the resource.
|
|
858
|
+
* @param {string} [oConfiguration.mode="cors"] The mode of the request. Possible values are "cors", "no-cors", "same-origin".
|
|
859
|
+
* @param {string} [oConfiguration.method="GET"] The HTTP method. Possible values are "GET", "POST".
|
|
860
|
+
* @param {Object} [oConfiguration.parameters] The request parameters. If the method is "POST" the parameters will be put as key/value pairs into the body of the request.
|
|
861
|
+
* @param {Object} [oConfiguration.dataType="json"] The expected Content-Type of the response. Possible values are "xml", "json", "text", "script", "html", "jsonp". Note: Complex Binding is not supported when a dataType is provided. Serialization of the response to an object is up to the developer.
|
|
862
|
+
* @param {Object} [oConfiguration.headers] The HTTP headers of the request.
|
|
863
|
+
* @param {boolean} [oConfiguration.withCredentials=false] Indicates whether cross-site requests should be made using credentials.
|
|
864
|
+
* @returns {Promise} Resolves when the request is successful, rejects otherwise.
|
|
865
|
+
*/
|
|
866
|
+
Editor.prototype.request = function (oConfiguration) {
|
|
867
|
+
return this._oDataProviderFactory
|
|
868
|
+
.create({ request: oConfiguration })
|
|
869
|
+
.setAllowCustomDataType(true)
|
|
870
|
+
.getData();
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
Editor.prototype.initDestinations = function (vHost) {
|
|
874
|
+
var oHostInstance = this.getHostInstance();
|
|
875
|
+
|
|
876
|
+
if (vHost && !oHostInstance) {
|
|
877
|
+
Log.error(
|
|
878
|
+
"Host with id '" + vHost + "' is not available during editor initialization. It must be available for host specific features to work.",
|
|
879
|
+
"Make sure that the host already exists, before assigning it to the editor.",
|
|
880
|
+
"sap.ui.integration.editor.Editor"
|
|
881
|
+
);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
if (this._oDestinations) {
|
|
885
|
+
this._oDestinations.setHost(oHostInstance);
|
|
886
|
+
} else {
|
|
887
|
+
var sConfigurationPath = this.getConfigurationPath();
|
|
888
|
+
this._oDestinations = new Destinations(oHostInstance, this._manifestModel.getProperty(sConfigurationPath + "/destinations"));
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
|
|
892
|
+
Editor.prototype.initDataProviderFactory = function () {
|
|
893
|
+
if (this._oDataProviderFactory) {
|
|
894
|
+
this._oDataProviderFactory.destroy();
|
|
895
|
+
}
|
|
896
|
+
var oExtension = this.getAggregation("_extension");
|
|
897
|
+
this._oDataProviderFactory = new DataProviderFactory(this._oDestinations, oExtension, undefined, this);
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Resolves the given URL relatively to the manifest base path.
|
|
902
|
+
* Absolute paths are not changed.
|
|
903
|
+
*
|
|
904
|
+
* @example
|
|
905
|
+
* oEditor.getRuntimeUrl("images/Avatar.png") === "sample/card/images/Avatar.png"
|
|
906
|
+
* oEditor.getRuntimeUrl("http://www.someurl.com/Avatar.png") === "http://www.someurl.com/Avatar.png"
|
|
907
|
+
* oEditor.getRuntimeUrl("https://www.someurl.com/Avatar.png") === "https://www.someurl.com/Avatar.png"
|
|
908
|
+
*
|
|
909
|
+
* @ui5-restricted
|
|
910
|
+
* @param {string} sUrl The URL to resolve.
|
|
911
|
+
* @returns {string} The resolved URL.
|
|
912
|
+
*/
|
|
913
|
+
Editor.prototype.getRuntimeUrl = function (sUrl) {
|
|
914
|
+
var sAppId = this._sAppId,
|
|
915
|
+
sAppName,
|
|
916
|
+
sSanitizedUrl = sUrl && sUrl.trim().replace(/^\//, "");
|
|
917
|
+
|
|
918
|
+
if (sAppId === null) {
|
|
919
|
+
Log.error("The manifest is not ready so the URL can not be resolved. Consider using the 'manifestReady' event.", "sap.ui.integration.editor.Editor");
|
|
920
|
+
return null;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
if (!sAppId ||
|
|
924
|
+
sUrl.startsWith("http://") ||
|
|
925
|
+
sUrl.startsWith("https://") ||
|
|
926
|
+
sUrl.startsWith("//")) {
|
|
927
|
+
return sUrl;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
sAppName = sAppId.replace(/\./g, "/");
|
|
931
|
+
|
|
932
|
+
// do not use sap.ui.require.toUrl(sAppName + "/" + sSanitizedUrl)
|
|
933
|
+
// because it doesn't work when the sSanitizedUrl starts with ".."
|
|
934
|
+
return sap.ui.require.toUrl(sAppName) + "/" + sSanitizedUrl;
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
* @private
|
|
939
|
+
* @ui5-restricted
|
|
940
|
+
* @returns {object} Local binding functions for this Editor
|
|
941
|
+
*/
|
|
942
|
+
Editor.prototype.getBindingNamespaces = function () {
|
|
943
|
+
var mNamespaces = {},
|
|
944
|
+
oExtension = this.getAggregation("_extension");
|
|
945
|
+
|
|
946
|
+
if (oExtension) {
|
|
947
|
+
mNamespaces.extension = {
|
|
948
|
+
formatters: oExtension.getFormatters()
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
return mNamespaces;
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* Gets the instance of the <code>host</code> association.
|
|
957
|
+
*
|
|
958
|
+
* @public
|
|
959
|
+
* @experimental Since 1.77
|
|
960
|
+
* @returns {sap.ui.integration.Host} The host object associated with this editor.
|
|
961
|
+
*/
|
|
962
|
+
Editor.prototype.getHostInstance = function () {
|
|
963
|
+
var sHost = this.getHost();
|
|
964
|
+
if (!sHost) {
|
|
965
|
+
return null;
|
|
966
|
+
}
|
|
967
|
+
return Core.byId(sHost);
|
|
968
|
+
};
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Sets the language of the editor
|
|
972
|
+
*
|
|
973
|
+
* @param {string} sValue the language in the format language_region or language-region
|
|
974
|
+
* @param {*} bSuppress suppress rerendering of the editor
|
|
975
|
+
*/
|
|
976
|
+
Editor.prototype.setLanguage = function (sValue, bSuppress) {
|
|
977
|
+
//unify the language-region to language_region
|
|
978
|
+
if (!sValue || typeof sValue !== "string") {
|
|
979
|
+
return this;
|
|
980
|
+
}
|
|
981
|
+
this._language = sValue.replaceAll('_', '-');
|
|
982
|
+
if (this.getLanguage() != sValue) {
|
|
983
|
+
//reload resource bundler if language changed
|
|
984
|
+
var oResourceBundle = Core.getLibraryResourceBundle("sap.ui.integration");
|
|
985
|
+
this._enhanceI18nModel(oResourceBundle);
|
|
986
|
+
}
|
|
987
|
+
this.setProperty("language", sValue, bSuppress);
|
|
988
|
+
if (!Editor._languages[this._language]) {
|
|
989
|
+
this._language = this._language.split("-")[0];
|
|
990
|
+
}
|
|
991
|
+
if (!Editor._languages[this._language]) {
|
|
992
|
+
Log.warning("The language: " + sValue + " is currently unknown, some UI controls might show " + sValue + " instead of the language name.");
|
|
993
|
+
}
|
|
994
|
+
return this;
|
|
995
|
+
};
|
|
996
|
+
/**
|
|
997
|
+
* Increases the zIndex to a higher value for all popups
|
|
998
|
+
*/
|
|
999
|
+
Editor.prototype.onAfterRendering = function () {
|
|
1000
|
+
if (this.getDomRef()) {
|
|
1001
|
+
this._iZIndex = getHigherZIndex(this.getDomRef());
|
|
1002
|
+
Popup.setInitialZIndex(this._iZIndex);
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
/**
|
|
1006
|
+
* Filters the manifestChanges array in the oManifestSettings
|
|
1007
|
+
* All changes that are done for layers > than current layer are removed (see also layers)
|
|
1008
|
+
* The current layers changes are stored in this._currentLayerManifestChanges to be applied later in the editor code.
|
|
1009
|
+
* All changes that are done for layers < that the current layer are kept in oManifestSettings.manifestChanges
|
|
1010
|
+
*
|
|
1011
|
+
* @param {*} oManifestSettings
|
|
1012
|
+
*/
|
|
1013
|
+
Editor.prototype._filterManifestChangesByLayer = function (oManifestSettings) {
|
|
1014
|
+
var aChanges = [],
|
|
1015
|
+
oCurrentLayerChanges = { ":layer": Merger.layers[this.getMode()] },
|
|
1016
|
+
iCurrentModeIndex = Merger.layers[this.getMode()];
|
|
1017
|
+
/* hide multi language function since there has a translation issue in Portal
|
|
1018
|
+
var sEditorLanguage = this._language || this.getLanguage() || Core.getConfiguration().getLanguage().replaceAll('_', '-');
|
|
1019
|
+
*/
|
|
1020
|
+
oManifestSettings.manifestChanges.forEach(function (oChange) {
|
|
1021
|
+
//filter manifest changes. only the changes before the current layer are needed
|
|
1022
|
+
//editor will merge the last layer locally to allow "reset" or properties
|
|
1023
|
+
//also for translation layer, the "original" value is needed
|
|
1024
|
+
var iLayer = oChange.hasOwnProperty(":layer") ? oChange[":layer"] : 1000;
|
|
1025
|
+
/* hide multi language function since there has a translation issue in Portal
|
|
1026
|
+
//backward compatibility for old changes which not have property "multipleLanguage"
|
|
1027
|
+
//replace the value property by valueTranslation property
|
|
1028
|
+
if (!oChange.hasOwnProperty(":multipleLanguage")) {
|
|
1029
|
+
var oChangeTransfered = {};
|
|
1030
|
+
var aKeys = Object.keys(oChange);
|
|
1031
|
+
for (var j = 0; j < aKeys.length; j++) {
|
|
1032
|
+
if (aKeys[j].endsWith("/value") && typeof oChange[aKeys[j]] === "string") {
|
|
1033
|
+
var sValueTranslationsPath = aKeys[j].substring(0, aKeys[j].lastIndexOf("/")) + "/valueTranslations";
|
|
1034
|
+
if (!includes(aKeys, sValueTranslationsPath)) {
|
|
1035
|
+
var oValueTranslation = {};
|
|
1036
|
+
if (iLayer === Merger.layers["translation"]) {
|
|
1037
|
+
oValueTranslation[sEditorLanguage] = oChange[aKeys[j]];
|
|
1038
|
+
} else {
|
|
1039
|
+
for (var p in Editor._languages) {
|
|
1040
|
+
oValueTranslation[p] = oChange[aKeys[j]];
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
oChangeTransfered[sValueTranslationsPath] = oValueTranslation;
|
|
1044
|
+
continue;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
oChangeTransfered[aKeys[j]] = oChange[aKeys[j]];
|
|
1048
|
+
}
|
|
1049
|
+
oChange = oChangeTransfered;
|
|
1050
|
+
}*/
|
|
1051
|
+
if (iLayer < iCurrentModeIndex) {
|
|
1052
|
+
aChanges.push(oChange);
|
|
1053
|
+
} else if (iLayer === iCurrentModeIndex) {
|
|
1054
|
+
//store the current layer changes locally for later processing
|
|
1055
|
+
oCurrentLayerChanges = oChange;
|
|
1056
|
+
}
|
|
1057
|
+
});
|
|
1058
|
+
oManifestSettings.manifestChanges = aChanges;
|
|
1059
|
+
this._currentLayerManifestChanges = oCurrentLayerChanges;
|
|
1060
|
+
};
|
|
1061
|
+
/**
|
|
1062
|
+
* Initializes the editor after the json is set
|
|
1063
|
+
*/
|
|
1064
|
+
Editor.prototype._initInternal = function () {
|
|
1065
|
+
var that = this;
|
|
1066
|
+
//handle keyword designtime removal
|
|
1067
|
+
var sConfigurationPath = that.getConfigurationPath();
|
|
1068
|
+
var sDesigntime = that._oEditorManifest.get(sConfigurationPath + "/editor");
|
|
1069
|
+
if (!sDesigntime) {
|
|
1070
|
+
sDesigntime = that._oEditorManifest.get("/" + that.getSection() + "/designtime");
|
|
1071
|
+
}
|
|
1072
|
+
//load the designtime control and bundles lazy
|
|
1073
|
+
var oConfiguration = that._manifestModel.getProperty(sConfigurationPath),
|
|
1074
|
+
oPromise,
|
|
1075
|
+
oDesigntimeConfig = that.getDesigntime();
|
|
1076
|
+
if (oDesigntimeConfig) {
|
|
1077
|
+
if (typeof oDesigntimeConfig === "function") {
|
|
1078
|
+
oPromise = new Promise(function (resolve, reject) {
|
|
1079
|
+
var oDesigntimeInstance = new oDesigntimeConfig();
|
|
1080
|
+
that._applyDesigntimeDefaults(oDesigntimeInstance.getSettings());
|
|
1081
|
+
resolve(oDesigntimeInstance);
|
|
1082
|
+
});
|
|
1083
|
+
} else if (typeof oDesigntimeConfig === "object") {
|
|
1084
|
+
oPromise = new Promise(function (resolve, reject) {
|
|
1085
|
+
sap.ui.require(["sap/ui/integration/Designtime"], function (Designtime) {
|
|
1086
|
+
var AdvancedDesigntime = Designtime.extend("test.Designtime");
|
|
1087
|
+
AdvancedDesigntime.prototype.create = function () {
|
|
1088
|
+
return oDesigntimeConfig;
|
|
1089
|
+
};
|
|
1090
|
+
var oDesigntime = new AdvancedDesigntime();
|
|
1091
|
+
that._applyDesigntimeDefaults(oDesigntime.getSettings());
|
|
1092
|
+
resolve(oDesigntime);
|
|
1093
|
+
});
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
} else if (sDesigntime) {
|
|
1097
|
+
//load designtime from module
|
|
1098
|
+
oPromise = that.loadDesigntime().then(function (oDesigntime) {
|
|
1099
|
+
that._applyDesigntimeDefaults(oDesigntime.getSettings());
|
|
1100
|
+
return oDesigntime;
|
|
1101
|
+
});
|
|
1102
|
+
} else {
|
|
1103
|
+
//stay compatible and create designtime configuration based on parameters/destinations
|
|
1104
|
+
oPromise = Promise.resolve(that._createParameterDesigntime(oConfiguration));
|
|
1105
|
+
}
|
|
1106
|
+
oPromise.then(function (oDesigntime) {
|
|
1107
|
+
that._oDesigntimeInstance = oDesigntime;
|
|
1108
|
+
that.initDestinations();
|
|
1109
|
+
that.initDataProviderFactory();
|
|
1110
|
+
if (that.getMode() === "admin" || that.getMode() === "all") {
|
|
1111
|
+
//always add destination settings
|
|
1112
|
+
that._addDestinationSettings(oConfiguration, that._oDesigntimeInstance);
|
|
1113
|
+
}
|
|
1114
|
+
//create a settings model
|
|
1115
|
+
that._settingsModel = new JSONModel(that._oDesigntimeInstance.getSettings());
|
|
1116
|
+
that.setModel(that._settingsModel, "currentSettings");
|
|
1117
|
+
that.setModel(that._settingsModel, "items");
|
|
1118
|
+
return that._loadValueContextInDesigntime();
|
|
1119
|
+
}).then(function () {
|
|
1120
|
+
that._applyDesigntimeLayers(); //changes done from admin to content on the dt values
|
|
1121
|
+
return that._requestExtensionData();
|
|
1122
|
+
}).then(function () {
|
|
1123
|
+
that._requireFields().then(function () {
|
|
1124
|
+
that._startEditor();
|
|
1125
|
+
});
|
|
1126
|
+
});
|
|
1127
|
+
};
|
|
1128
|
+
|
|
1129
|
+
Editor.prototype.loadDesigntime = function () {
|
|
1130
|
+
if (this._oDesigntime) {
|
|
1131
|
+
return Promise.resolve(this._oDesigntime);
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
if (!this._oEditorManifest) {
|
|
1135
|
+
return new Promise(function (resolve, reject) {
|
|
1136
|
+
this.attachManifestReady(function () {
|
|
1137
|
+
this.loadDesigntime().then(resolve, reject);
|
|
1138
|
+
}.bind(this));
|
|
1139
|
+
}.bind(this));
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
if (!this._sAppId) {
|
|
1143
|
+
return Promise.reject("App id not maintained");
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
return new Promise(function (resolve, reject) {
|
|
1147
|
+
//build the module path to load as part of the widgets module path
|
|
1148
|
+
//handle keyword designtime removal
|
|
1149
|
+
var sDesigntimePath = this._oEditorManifest.get(this.getConfigurationPath() + "/editor");
|
|
1150
|
+
if (!sDesigntimePath) {
|
|
1151
|
+
sDesigntimePath = this._oEditorManifest.get("/" + this.getSection() + "/designtime");
|
|
1152
|
+
}
|
|
1153
|
+
var sFullDesigntimePath = this._sAppId.replace(/\./g, "/") + "/" + sDesigntimePath;
|
|
1154
|
+
if (sFullDesigntimePath) {
|
|
1155
|
+
sap.ui.require([sFullDesigntimePath], function (oDesigntime) {
|
|
1156
|
+
//successfully loaded
|
|
1157
|
+
oDesigntime = new oDesigntime();
|
|
1158
|
+
oDesigntime._readyPromise(this._oLimitedInterface, this).then(function () {
|
|
1159
|
+
this._oDesigntime = oDesigntime;
|
|
1160
|
+
resolve(oDesigntime);
|
|
1161
|
+
}.bind(this));
|
|
1162
|
+
}.bind(this), function () {
|
|
1163
|
+
//error
|
|
1164
|
+
reject({
|
|
1165
|
+
error: sFullDesigntimePath + " not found"
|
|
1166
|
+
});
|
|
1167
|
+
});
|
|
1168
|
+
} else {
|
|
1169
|
+
reject();
|
|
1170
|
+
}
|
|
1171
|
+
}.bind(this));
|
|
1172
|
+
};
|
|
1173
|
+
|
|
1174
|
+
Editor.prototype.getConfigurationPath = function() {
|
|
1175
|
+
return "/" + this.getSection() + "/configuration";
|
|
1176
|
+
};
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* Returns the current settings as a json with a manifest path and the current value
|
|
1180
|
+
* additionally there is a layer number added as ":layer"
|
|
1181
|
+
*/
|
|
1182
|
+
Editor.prototype.getCurrentSettings = function () {
|
|
1183
|
+
var oSettings = this._settingsModel.getProperty("/"),
|
|
1184
|
+
mResult = {},
|
|
1185
|
+
mNext;
|
|
1186
|
+
if (oSettings && oSettings.form && oSettings.form.items) {
|
|
1187
|
+
for (var n in oSettings.form.items) {
|
|
1188
|
+
var oItem = oSettings.form.items[n];
|
|
1189
|
+
if (oItem.editable && oItem.visible) {
|
|
1190
|
+
/* hide multi language function since there has a translation issue in Portal
|
|
1191
|
+
var oValueTranslations;
|
|
1192
|
+
var sLanguage = this.getMode() !== "translation" ? Core.getConfiguration().getLanguage().replaceAll('_', '-') : this._language || this.getLanguage();
|
|
1193
|
+
*/
|
|
1194
|
+
var sValueTranslationsPath = "";
|
|
1195
|
+
if (oItem.manifestpath) {
|
|
1196
|
+
sValueTranslationsPath = oItem.manifestpath.substring(0, oItem.manifestpath.lastIndexOf("/")) + "/valueTranslations";
|
|
1197
|
+
}
|
|
1198
|
+
if (this.getMode() !== "translation") {
|
|
1199
|
+
if (oItem.translatable && !oItem._changed && oItem._translatedPlaceholder && !this._currentLayerManifestChanges[oItem.manifestpath] && !this._currentLayerManifestChanges[sValueTranslationsPath]) {
|
|
1200
|
+
//do not save a value that was not changed and comes from a translated default value
|
|
1201
|
+
//mResult[oItem.manifestpath] = oItem._translatedPlaceholder;
|
|
1202
|
+
//if we would save it
|
|
1203
|
+
continue;
|
|
1204
|
+
} else {
|
|
1205
|
+
/* hide multi language function since there has a translation issue in Portal
|
|
1206
|
+
* need to remove below line later if we want release multi language function again
|
|
1207
|
+
*/
|
|
1208
|
+
mResult[oItem.manifestpath] = oItem.value;
|
|
1209
|
+
if (oItem.valueItems) {
|
|
1210
|
+
mResult[oItem.manifestpath.substring(0, oItem.manifestpath.lastIndexOf("/")) + "/valueItems"] = oItem.valueItems;
|
|
1211
|
+
}
|
|
1212
|
+
/* hide multi language function since there has a translation issue in Portal
|
|
1213
|
+
//if current parameter is string and translatable, create or merge valueTranslations property of it.
|
|
1214
|
+
//set the current change to current language in valueTranslations.
|
|
1215
|
+
if (oItem.type === "string" && oItem.translatable) {
|
|
1216
|
+
if (!oItem.valueTranslations) {
|
|
1217
|
+
oValueTranslations = {};
|
|
1218
|
+
} else {
|
|
1219
|
+
oValueTranslations = deepClone(oItem.valueTranslations, 500);
|
|
1220
|
+
}
|
|
1221
|
+
oValueTranslations[sLanguage] = oItem.value;
|
|
1222
|
+
oItem.valueTranslations = oValueTranslations;
|
|
1223
|
+
mResult[sValueTranslationsPath] = oItem.valueTranslations;
|
|
1224
|
+
} else {
|
|
1225
|
+
mResult[oItem.manifestpath] = oItem.value;
|
|
1226
|
+
}*/
|
|
1227
|
+
}
|
|
1228
|
+
} else if (oItem.translatable && oItem.value) {
|
|
1229
|
+
//in translation mode create an entry if there is a value
|
|
1230
|
+
mResult[oItem.manifestpath] = oItem.value;
|
|
1231
|
+
}
|
|
1232
|
+
if (oItem._next && (this.getAllowSettings())) {
|
|
1233
|
+
var bVisibleDefault = typeof (oItem.visibleToUser) === "undefined" ? true : oItem.visibleToUser;
|
|
1234
|
+
var bEditableDefault = typeof (oItem.editableToUser) === "undefined" ? true : oItem.editableToUser;
|
|
1235
|
+
if (oItem._next.visible === !bVisibleDefault) {
|
|
1236
|
+
mNext = mNext || {};
|
|
1237
|
+
mNext[oItem._settingspath + "/visible"] = oItem._next.visible;
|
|
1238
|
+
}
|
|
1239
|
+
if (oItem._next.editable === !bEditableDefault) {
|
|
1240
|
+
mNext = mNext || {};
|
|
1241
|
+
mNext[oItem._settingspath + "/editable"] = oItem._next.editable;
|
|
1242
|
+
}
|
|
1243
|
+
if (oItem._next.pageAdminValues) {
|
|
1244
|
+
mNext = mNext || {};
|
|
1245
|
+
mNext[oItem._settingspath + "/pageAdminValues"] = oItem._next.pageAdminValues;
|
|
1246
|
+
}
|
|
1247
|
+
if (typeof oItem._next.allowDynamicValues === "boolean" && this.getAllowDynamicValues()) {
|
|
1248
|
+
mNext = mNext || {};
|
|
1249
|
+
mNext[oItem._settingspath + "/allowDynamicValues"] = oItem._next.allowDynamicValues;
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
//add a property ":multipleLanguage" for backward compatibility of multiple language feature
|
|
1256
|
+
if (this.getMode() !== "translation") {
|
|
1257
|
+
mResult[":multipleLanguage"] = true;
|
|
1258
|
+
}
|
|
1259
|
+
mResult[":layer"] = Merger.layers[this.getMode()];
|
|
1260
|
+
mResult[":errors"] = this.checkCurrentSettings()[":errors"];
|
|
1261
|
+
if (mNext) {
|
|
1262
|
+
mResult[":designtime"] = mNext;
|
|
1263
|
+
}
|
|
1264
|
+
return mResult;
|
|
1265
|
+
};
|
|
1266
|
+
/**
|
|
1267
|
+
* Checks for invalid values in the current settings and reports the errors
|
|
1268
|
+
* TODO: highlight issues and add states...
|
|
1269
|
+
*/
|
|
1270
|
+
Editor.prototype.checkCurrentSettings = function () {
|
|
1271
|
+
var oSettings = this._settingsModel.getProperty("/"),
|
|
1272
|
+
mChecks = {};
|
|
1273
|
+
if (oSettings && oSettings.form && oSettings.form.items) {
|
|
1274
|
+
for (var n in oSettings.form.items) {
|
|
1275
|
+
var oItem = oSettings.form.items[n];
|
|
1276
|
+
if (oItem.editable) {
|
|
1277
|
+
if ((oItem.isValid || oItem.required) && !(this.getMode() === "translation" && oItem.translatable)) {
|
|
1278
|
+
if (oItem.isValid) {
|
|
1279
|
+
mChecks[oItem.manifestpath] = oItem.isValid(oItem);
|
|
1280
|
+
}
|
|
1281
|
+
mChecks[oItem.manifestpath] = true;
|
|
1282
|
+
var value = oItem.value;
|
|
1283
|
+
var sType = oItem.type;
|
|
1284
|
+
if (sType === "string" && value === "") {
|
|
1285
|
+
mChecks[oItem.manifestpath] = value;
|
|
1286
|
+
//inform user of this error
|
|
1287
|
+
}
|
|
1288
|
+
if ((sType === "date" || sType === "datetime") && isNaN(Date.parse(value))) {
|
|
1289
|
+
mChecks[oItem.manifestpath] = value;
|
|
1290
|
+
//inform user of this error
|
|
1291
|
+
}
|
|
1292
|
+
if (sType === "integer") {
|
|
1293
|
+
if (isNaN(parseInt(value))) {
|
|
1294
|
+
mChecks[oItem.manifestpath] = value;
|
|
1295
|
+
//inform user of this error
|
|
1296
|
+
} else if (value < oItem.min || value > oItem.max) {
|
|
1297
|
+
mChecks[oItem.manifestpath] = value;
|
|
1298
|
+
//inform user of this error
|
|
1299
|
+
}
|
|
1300
|
+
} if (sType === "number") {
|
|
1301
|
+
if (isNaN(parseFloat(value))) {
|
|
1302
|
+
mChecks[oItem.manifestpath] = value;
|
|
1303
|
+
} else if (value < oItem.min || value > oItem.max) {
|
|
1304
|
+
mChecks[oItem.manifestpath] = value;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
mChecks[":layer"] = Merger.layers[this.getMode()];
|
|
1311
|
+
}
|
|
1312
|
+
mChecks[":errors"] = Object.values(mChecks).indexOf(false) > -1;
|
|
1313
|
+
return mChecks;
|
|
1314
|
+
};
|
|
1315
|
+
|
|
1316
|
+
/**
|
|
1317
|
+
* Creates a model for the context object of the host environment
|
|
1318
|
+
*/
|
|
1319
|
+
Editor.prototype._createContextModel = function () {
|
|
1320
|
+
var oHost = this.getHostInstance(),
|
|
1321
|
+
oContextModel = new JSONModel({}),
|
|
1322
|
+
oFlatContextModel = new JSONModel([]);
|
|
1323
|
+
|
|
1324
|
+
//add the models in any case
|
|
1325
|
+
this.setModel(oContextModel, "context");
|
|
1326
|
+
this.setModel(oFlatContextModel, "contextflat");
|
|
1327
|
+
oContextModel._aPendingPromises = [];
|
|
1328
|
+
oFlatContextModel._getPathObject = function (sPath) {
|
|
1329
|
+
var a = this.getData().filter(function (o) {
|
|
1330
|
+
if (o.path === sPath) {
|
|
1331
|
+
return true;
|
|
1332
|
+
}
|
|
1333
|
+
});
|
|
1334
|
+
return a.length ? a[0] : null;
|
|
1335
|
+
};
|
|
1336
|
+
oFlatContextModel._getValueObject = function (sValue) {
|
|
1337
|
+
var a = this.getData() || [];
|
|
1338
|
+
a = a.filter(function (o) {
|
|
1339
|
+
if (o.value === sValue || o.object.value === sValue) {
|
|
1340
|
+
return true;
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
return a.length ? a[0] : null;
|
|
1344
|
+
};
|
|
1345
|
+
var oContextDataPromise = new Promise(function (resolve, reject) {
|
|
1346
|
+
if (oHost && oHost.getContext) {
|
|
1347
|
+
var bResolved = false;
|
|
1348
|
+
setTimeout(function () {
|
|
1349
|
+
if (bResolved) {
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
Log.error("Editor context could not be determined with " + CONTEXT_TIMEOUT + ".");
|
|
1353
|
+
bResolved = true;
|
|
1354
|
+
resolve({});
|
|
1355
|
+
}, CONTEXT_TIMEOUT);
|
|
1356
|
+
oHost.getContext().then(function (oContextData) {
|
|
1357
|
+
if (bResolved) {
|
|
1358
|
+
Log.error("Editor context returned after more than " + CONTEXT_TIMEOUT + ". Context is ignored.");
|
|
1359
|
+
}
|
|
1360
|
+
bResolved = true;
|
|
1361
|
+
resolve(oContextData || {});
|
|
1362
|
+
});
|
|
1363
|
+
} else {
|
|
1364
|
+
resolve({});
|
|
1365
|
+
}
|
|
1366
|
+
});
|
|
1367
|
+
|
|
1368
|
+
//get the context from the host
|
|
1369
|
+
oContextDataPromise.then(function (oContextData) {
|
|
1370
|
+
var oData = this._mergeContextData(oContextData);
|
|
1371
|
+
oContextModel.setData(oData);
|
|
1372
|
+
oFlatContextModel.setData(this.flattenData(oData, "label"));
|
|
1373
|
+
}.bind(this));
|
|
1374
|
+
|
|
1375
|
+
//async update of the value via host call
|
|
1376
|
+
oContextModel.getProperty = function (sPath, oContext) {
|
|
1377
|
+
if (sPath && !sPath.startsWith("/") && !oContext) {
|
|
1378
|
+
sPath = "/" + sPath;
|
|
1379
|
+
}
|
|
1380
|
+
var sAbsolutePath = this.resolve(sPath, oContext),
|
|
1381
|
+
pGetProperty;
|
|
1382
|
+
if (sAbsolutePath.endsWith("/value")) {
|
|
1383
|
+
this._mValues = this._mValues || {};
|
|
1384
|
+
if (this._mValues.hasOwnProperty(sAbsolutePath)) {
|
|
1385
|
+
return this._mValues[sAbsolutePath];
|
|
1386
|
+
//when should this be invalidated?
|
|
1387
|
+
}
|
|
1388
|
+
this._mValues[sAbsolutePath] = undefined;
|
|
1389
|
+
// ask the host and timeout if it does not respond
|
|
1390
|
+
pGetProperty = Utils.timeoutPromise(oHost.getContextValue(sAbsolutePath.substring(1)));
|
|
1391
|
+
pGetProperty = pGetProperty.then(function (vValue) {
|
|
1392
|
+
this._mValues[sAbsolutePath] = vValue;
|
|
1393
|
+
this.checkUpdate();
|
|
1394
|
+
}.bind(this))
|
|
1395
|
+
.catch(function (sReason) {
|
|
1396
|
+
this._mValues[sAbsolutePath] = null;
|
|
1397
|
+
this.checkUpdate();
|
|
1398
|
+
Log.error("Path " + sAbsolutePath + " could not be resolved. Reason: " + sReason);
|
|
1399
|
+
}.bind(this));
|
|
1400
|
+
|
|
1401
|
+
this._aPendingPromises.push(pGetProperty);
|
|
1402
|
+
return undefined;
|
|
1403
|
+
} else {
|
|
1404
|
+
//resolve dt data locally
|
|
1405
|
+
return JSONModel.prototype.getProperty.apply(this, arguments);
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
};
|
|
1409
|
+
|
|
1410
|
+
Editor.prototype._mergeContextData = function (oContextData) {
|
|
1411
|
+
var oData = {};
|
|
1412
|
+
//empty entry
|
|
1413
|
+
oData["empty"] = Editor._contextEntries.empty;
|
|
1414
|
+
//custom entries
|
|
1415
|
+
for (var n in oContextData) {
|
|
1416
|
+
oData[n] = oContextData[n];
|
|
1417
|
+
}
|
|
1418
|
+
//editor internal
|
|
1419
|
+
oData["editor.internal"] = Editor._contextEntries["editor.internal"];
|
|
1420
|
+
return oData;
|
|
1421
|
+
};
|
|
1422
|
+
|
|
1423
|
+
Editor.prototype._loadValueContextInDesigntime = function () {
|
|
1424
|
+
var oContextModel = this.getModel("context");
|
|
1425
|
+
var oSettings = this._oDesigntimeInstance.getSettings();
|
|
1426
|
+
var sItemsString;
|
|
1427
|
+
if (oSettings && oSettings.form && oSettings.form.items) {
|
|
1428
|
+
sItemsString = JSON.stringify(oSettings.form.items);
|
|
1429
|
+
}
|
|
1430
|
+
if (sItemsString) {
|
|
1431
|
+
var contextParamRegExp = /\{context\>[\/?\w+.]+\}/g;
|
|
1432
|
+
var aResult = sItemsString.match(contextParamRegExp);
|
|
1433
|
+
var aContextEntries;
|
|
1434
|
+
if (aResult && aResult.length > 0) {
|
|
1435
|
+
// only value context need to load
|
|
1436
|
+
aResult = aResult.filter(function (sResult) {
|
|
1437
|
+
return sResult.endsWith("value}");
|
|
1438
|
+
});
|
|
1439
|
+
aContextEntries = aResult.map(function (sResult) {
|
|
1440
|
+
return sResult.substring("{context>".length, sResult.length - 1);
|
|
1441
|
+
});
|
|
1442
|
+
aContextEntries.forEach(function (sContextEntry) {
|
|
1443
|
+
oContextModel.getProperty(sContextEntry);
|
|
1444
|
+
});
|
|
1445
|
+
return Promise.all(oContextModel._aPendingPromises).then(function () {
|
|
1446
|
+
oContextModel._aPendingPromises = [];
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
return Promise.resolve();
|
|
1451
|
+
};
|
|
1452
|
+
|
|
1453
|
+
//map editors for a specific type
|
|
1454
|
+
Editor.fieldMap = {
|
|
1455
|
+
"string": "sap/ui/integration/editor/fields/StringField",
|
|
1456
|
+
"integer": "sap/ui/integration/editor/fields/IntegerField",
|
|
1457
|
+
"number": "sap/ui/integration/editor/fields/NumberField",
|
|
1458
|
+
"boolean": "sap/ui/integration/editor/fields/BooleanField",
|
|
1459
|
+
"date": "sap/ui/integration/editor/fields/DateField",
|
|
1460
|
+
"datetime": "sap/ui/integration/editor/fields/DateTimeField",
|
|
1461
|
+
"string[]": "sap/ui/integration/editor/fields/ListField",
|
|
1462
|
+
"destination": "sap/ui/integration/editor/fields/DestinationField"
|
|
1463
|
+
};
|
|
1464
|
+
Editor.Fields = null;
|
|
1465
|
+
/**
|
|
1466
|
+
* Loads all field modules registered in Editor.fieldMap and stores the classes in Editor.Fields
|
|
1467
|
+
*/
|
|
1468
|
+
Editor.prototype._requireFields = function () {
|
|
1469
|
+
if (Editor.Fields) {
|
|
1470
|
+
return Promise.resolve();
|
|
1471
|
+
}
|
|
1472
|
+
return new Promise(function (resolve) {
|
|
1473
|
+
sap.ui.require(Object.values(Editor.fieldMap), function () {
|
|
1474
|
+
Editor.Fields = {};
|
|
1475
|
+
for (var n in Editor.fieldMap) {
|
|
1476
|
+
Editor.Fields[n] = arguments[Object.keys(Editor.fieldMap).indexOf(n)];
|
|
1477
|
+
}
|
|
1478
|
+
resolve();
|
|
1479
|
+
});
|
|
1480
|
+
});
|
|
1481
|
+
};
|
|
1482
|
+
|
|
1483
|
+
Editor.prototype._createDescription = function (oConfig) {
|
|
1484
|
+
var oDescIcon = new Icon({
|
|
1485
|
+
src: "sap-icon://message-information",
|
|
1486
|
+
color: "Marker",
|
|
1487
|
+
size: "12px",
|
|
1488
|
+
useIconTooltip: false,
|
|
1489
|
+
visible: oConfig.visible,
|
|
1490
|
+
objectBindings: {
|
|
1491
|
+
currentSettings: {
|
|
1492
|
+
path: "currentSettings>" + oConfig._settingspath
|
|
1493
|
+
},
|
|
1494
|
+
items: {
|
|
1495
|
+
path: "items>/form/items"
|
|
1496
|
+
},
|
|
1497
|
+
context: {
|
|
1498
|
+
path: "context>/"
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
});
|
|
1502
|
+
oDescIcon.addStyleClass("sapUiIntegrationEditorDescriptionIcon");
|
|
1503
|
+
oDescIcon.onmouseover = function (oDescIcon) {
|
|
1504
|
+
this._getPopover().getContent()[0].applySettings({ text: oConfig.description });
|
|
1505
|
+
this._getPopover().openBy(oDescIcon);
|
|
1506
|
+
oDescIcon.addDependent(this._getPopover());
|
|
1507
|
+
}.bind(this, oDescIcon);
|
|
1508
|
+
oDescIcon.onmouseout = function (oDescIcon) {
|
|
1509
|
+
this._getPopover().close();
|
|
1510
|
+
oDescIcon.removeDependent(this._getPopover());
|
|
1511
|
+
}.bind(this, oDescIcon);
|
|
1512
|
+
return oDescIcon;
|
|
1513
|
+
};
|
|
1514
|
+
|
|
1515
|
+
Editor.prototype._createMessageIcon = function (oField) {
|
|
1516
|
+
var oConfig = oField.getConfiguration();
|
|
1517
|
+
var oMsgIcon = new Icon({
|
|
1518
|
+
src: "sap-icon://message-information",
|
|
1519
|
+
size: "12px",
|
|
1520
|
+
visible: oConfig.visible,
|
|
1521
|
+
useIconTooltip: false,
|
|
1522
|
+
objectBindings: {
|
|
1523
|
+
currentSettings: {
|
|
1524
|
+
path: "currentSettings>" + oConfig._settingspath
|
|
1525
|
+
},
|
|
1526
|
+
items: {
|
|
1527
|
+
path: "items>/form/items"
|
|
1528
|
+
},
|
|
1529
|
+
context: {
|
|
1530
|
+
path: "context>/"
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
});
|
|
1534
|
+
oMsgIcon.onmouseover = function (oField) {
|
|
1535
|
+
oField._showMessage();
|
|
1536
|
+
}.bind(this, oField);
|
|
1537
|
+
oMsgIcon.onmouseout = function (oField) {
|
|
1538
|
+
oField._hideMessage();
|
|
1539
|
+
}.bind(this, oField);
|
|
1540
|
+
oMsgIcon.addStyleClass("sapUiIntegrationEditorMessageIcon");
|
|
1541
|
+
return oMsgIcon;
|
|
1542
|
+
};
|
|
1543
|
+
|
|
1544
|
+
/**
|
|
1545
|
+
* Creates a label based on the configuration settings
|
|
1546
|
+
* @param {} oConfig
|
|
1547
|
+
*/
|
|
1548
|
+
Editor.prototype._createLabel = function (oConfig) {
|
|
1549
|
+
var oLabel = new Label({
|
|
1550
|
+
text: oConfig.label,
|
|
1551
|
+
tooltip: oConfig.tooltip || oConfig.label,
|
|
1552
|
+
//mark only fields that are required and editable,
|
|
1553
|
+
//otherwise this is confusing because user will not be able to correct it
|
|
1554
|
+
required: oConfig.required && oConfig.editable || false,
|
|
1555
|
+
visible: oConfig.visible,
|
|
1556
|
+
objectBindings: {
|
|
1557
|
+
currentSettings: {
|
|
1558
|
+
path: "currentSettings>" + oConfig._settingspath
|
|
1559
|
+
},
|
|
1560
|
+
items: {
|
|
1561
|
+
path: "items>/form/items"
|
|
1562
|
+
},
|
|
1563
|
+
context: {
|
|
1564
|
+
path: "context>/"
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
});
|
|
1568
|
+
oLabel._cols = oConfig.cols || 2; //by default 2 cols
|
|
1569
|
+
if (oConfig.layout) {
|
|
1570
|
+
oLabel._layout = oConfig.layout;
|
|
1571
|
+
}
|
|
1572
|
+
oLabel._sOriginalType = oConfig.type;
|
|
1573
|
+
return oLabel;
|
|
1574
|
+
};
|
|
1575
|
+
|
|
1576
|
+
/**
|
|
1577
|
+
* Create the settings button
|
|
1578
|
+
*/
|
|
1579
|
+
Editor.prototype._createSettingsButton = function (oField) {
|
|
1580
|
+
var oConfig = oField.getConfiguration();
|
|
1581
|
+
var oSettingsButton = new Button({
|
|
1582
|
+
icon: "{= ${currentSettings>_hasDynamicValue} ? 'sap-icon://display-more' : 'sap-icon://enter-more'}",
|
|
1583
|
+
type: "Transparent",
|
|
1584
|
+
tooltip: this._oResourceBundle.getText("EDITOR_FIELD_MORE_SETTINGS"),
|
|
1585
|
+
press: function (oEvent) {
|
|
1586
|
+
this._openSettingsDialog(200, oEvent.oSource, oField);
|
|
1587
|
+
}.bind(this),
|
|
1588
|
+
visible: oConfig.visible,
|
|
1589
|
+
objectBindings: {
|
|
1590
|
+
currentSettings: {
|
|
1591
|
+
path: "currentSettings>" + oConfig._settingspath
|
|
1592
|
+
},
|
|
1593
|
+
items: {
|
|
1594
|
+
path: "items>/form/items"
|
|
1595
|
+
},
|
|
1596
|
+
context: {
|
|
1597
|
+
path: "context>/"
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
});
|
|
1601
|
+
return oSettingsButton;
|
|
1602
|
+
};
|
|
1603
|
+
|
|
1604
|
+
Editor.prototype._getSettingsPanel = function (oField) {
|
|
1605
|
+
if (!oField._oSettingsPanel) {
|
|
1606
|
+
oField._oSettingsPanel = new Settings();
|
|
1607
|
+
}
|
|
1608
|
+
return oField._oSettingsPanel;
|
|
1609
|
+
};
|
|
1610
|
+
|
|
1611
|
+
Editor.prototype._openSettingsDialog = function (iDelay, oSettingsButton, oField) {
|
|
1612
|
+
var oSettingsPanel = this._getSettingsPanel(oField);
|
|
1613
|
+
window.setTimeout(function () {
|
|
1614
|
+
oSettingsPanel.setConfiguration(oField.getConfiguration());
|
|
1615
|
+
var oPreview = this.getAggregation("_preview");
|
|
1616
|
+
oSettingsPanel.open(
|
|
1617
|
+
oSettingsButton,
|
|
1618
|
+
oSettingsButton,
|
|
1619
|
+
oPreview,
|
|
1620
|
+
oField.getHost(),
|
|
1621
|
+
oField,
|
|
1622
|
+
oField._applySettings.bind(oField),
|
|
1623
|
+
oField._cancelSettings.bind(oField));
|
|
1624
|
+
}.bind(this), iDelay || 600);
|
|
1625
|
+
};
|
|
1626
|
+
|
|
1627
|
+
Editor.prototype._getPopover = function () {
|
|
1628
|
+
if (this._oPopover) {
|
|
1629
|
+
return this._oPopover;
|
|
1630
|
+
}
|
|
1631
|
+
var oText = new Text({
|
|
1632
|
+
text: ""
|
|
1633
|
+
});
|
|
1634
|
+
oText.addStyleClass("sapUiTinyMargin sapUiIntegrationEditorDescriptionText");
|
|
1635
|
+
this._oPopover = new RPopover({
|
|
1636
|
+
showHeader: false,
|
|
1637
|
+
content: [oText]
|
|
1638
|
+
});
|
|
1639
|
+
this._oPopover.addStyleClass("sapUiIntegrationEditorPopover");
|
|
1640
|
+
return this._oPopover;
|
|
1641
|
+
};
|
|
1642
|
+
|
|
1643
|
+
/**
|
|
1644
|
+
* Creates a Field based on the configuration settings
|
|
1645
|
+
* @param {*} oConfig
|
|
1646
|
+
*/
|
|
1647
|
+
Editor.prototype._createField = function (oConfig) {
|
|
1648
|
+
var oField = new Editor.Fields[oConfig.type]({
|
|
1649
|
+
configuration: oConfig,
|
|
1650
|
+
mode: this.getMode(),
|
|
1651
|
+
host: this.getHostInstance(),
|
|
1652
|
+
objectBindings: {
|
|
1653
|
+
currentSettings: {
|
|
1654
|
+
path: "currentSettings>" + oConfig._settingspath
|
|
1655
|
+
},
|
|
1656
|
+
items: {
|
|
1657
|
+
path: "items>/form/items"
|
|
1658
|
+
},
|
|
1659
|
+
context: {
|
|
1660
|
+
path: "context>/"
|
|
1661
|
+
}
|
|
1662
|
+
},
|
|
1663
|
+
visible: oConfig.visible
|
|
1664
|
+
});
|
|
1665
|
+
|
|
1666
|
+
this._aFieldReadyPromise.push(oField._readyPromise.then(function() {
|
|
1667
|
+
if (oConfig.require
|
|
1668
|
+
|| oConfig.validation
|
|
1669
|
+
|| (oConfig.validations && oConfig.validations.length > 0)
|
|
1670
|
+
|| (oConfig.values && oConfig.values.data && !oConfig.values.data.json)) {
|
|
1671
|
+
var oMsgIcon = this._createMessageIcon(oField);
|
|
1672
|
+
oField.setAssociation("_messageIcon", oMsgIcon);
|
|
1673
|
+
}
|
|
1674
|
+
if (oConfig.description && this.getMode() !== "translation") {
|
|
1675
|
+
oField._descriptionIcon = this._createDescription(oConfig);
|
|
1676
|
+
}
|
|
1677
|
+
if (oConfig._changeDynamicValues) {
|
|
1678
|
+
oField._settingsButton = this._createSettingsButton(oField);
|
|
1679
|
+
oField._applyButtonStyles();
|
|
1680
|
+
}
|
|
1681
|
+
}.bind(this)));
|
|
1682
|
+
//listen to value changes on the settings
|
|
1683
|
+
var oValueBinding = this._settingsModel.bindProperty(oConfig._settingspath + "/value");
|
|
1684
|
+
oValueBinding.attachChange(function () {
|
|
1685
|
+
if (!this._bIgnoreUpdates) {
|
|
1686
|
+
oConfig._changed = true;
|
|
1687
|
+
if (oConfig._dependentFields && oConfig._dependentFields.length > 0) {
|
|
1688
|
+
this._updateEditor(oConfig._dependentFields);
|
|
1689
|
+
}
|
|
1690
|
+
this._updatePreview();
|
|
1691
|
+
}
|
|
1692
|
+
}.bind(this));
|
|
1693
|
+
if (oField.isFilterBackend()) {
|
|
1694
|
+
//listen to suggest value changes on the settings if current field support filter backend feature
|
|
1695
|
+
var oSuggestValueBinding = this._settingsModel.bindProperty(oConfig._settingspath + "/suggestValue");
|
|
1696
|
+
oSuggestValueBinding.attachChange(function () {
|
|
1697
|
+
var oConfigTemp = merge({}, oConfig);
|
|
1698
|
+
oConfigTemp._cancel = false;
|
|
1699
|
+
this._addValueListModel(oConfigTemp, oField, true);
|
|
1700
|
+
}.bind(this));
|
|
1701
|
+
}
|
|
1702
|
+
this._addValueListModel(oConfig, oField);
|
|
1703
|
+
oField._cols = oConfig.cols || 2; //by default 2 cols
|
|
1704
|
+
if (oConfig.layout) {
|
|
1705
|
+
oField._layout = oConfig.layout;
|
|
1706
|
+
}
|
|
1707
|
+
oField._oDataProviderFactory = this._oDataProviderFactory;
|
|
1708
|
+
oField.setAssociation("_messageStrip", this.getAggregation("_messageStrip"));
|
|
1709
|
+
return oField;
|
|
1710
|
+
};
|
|
1711
|
+
|
|
1712
|
+
Editor.prototype._updateEditor = function (aDependentFields) {
|
|
1713
|
+
if (this._ready) {
|
|
1714
|
+
if (aDependentFields.length === 0) {
|
|
1715
|
+
return;
|
|
1716
|
+
}
|
|
1717
|
+
for (var i = 0; i < aDependentFields.length; i++) {
|
|
1718
|
+
var o = aDependentFields[i];
|
|
1719
|
+
o.config._cancel = true;
|
|
1720
|
+
}
|
|
1721
|
+
if (!this._oDataProviderFactory) {
|
|
1722
|
+
return;
|
|
1723
|
+
}
|
|
1724
|
+
this._bIgnoreUpdates = true;
|
|
1725
|
+
for (var i = 0; i < aDependentFields.length; i++) {
|
|
1726
|
+
var o = aDependentFields[i];
|
|
1727
|
+
o.config._cancel = false;
|
|
1728
|
+
this._addValueListModel(o.config, o.field, true, 500 * i);
|
|
1729
|
+
}
|
|
1730
|
+
this._bIgnoreUpdates = false;
|
|
1731
|
+
}
|
|
1732
|
+
};
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* updates the additional content
|
|
1736
|
+
* TODO: Track changes and call update of the additional content
|
|
1737
|
+
*/
|
|
1738
|
+
Editor.prototype._updatePreview = function () {
|
|
1739
|
+
var oPreview = this.getAggregation("_preview");
|
|
1740
|
+
if (oPreview && oPreview.update) {
|
|
1741
|
+
oPreview.update();
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
|
|
1745
|
+
/**
|
|
1746
|
+
* request data via data provider in RT
|
|
1747
|
+
* @param {object} oConfig
|
|
1748
|
+
* @param {BaseField} oField
|
|
1749
|
+
*/
|
|
1750
|
+
Editor.prototype._requestData = function (oConfig, oField) {
|
|
1751
|
+
var oDataProvider = this._oDataProviderFactory.create(oConfig.values.data);
|
|
1752
|
+
oDataProvider.bindObject({
|
|
1753
|
+
path: "items>/form/items"
|
|
1754
|
+
});
|
|
1755
|
+
oDataProvider.bindObject({
|
|
1756
|
+
path: "currentSettings>" + oConfig._settingspath
|
|
1757
|
+
});
|
|
1758
|
+
oDataProvider.bindObject({
|
|
1759
|
+
path: "context>/"
|
|
1760
|
+
});
|
|
1761
|
+
var oPromise = oDataProvider.getData();
|
|
1762
|
+
oPromise.then(function (oData) {
|
|
1763
|
+
if (oConfig._cancel) {
|
|
1764
|
+
oConfig._values = [];
|
|
1765
|
+
this._settingsModel.setProperty(oConfig._settingspath + "/_loading", false);
|
|
1766
|
+
return;
|
|
1767
|
+
}
|
|
1768
|
+
// filter data for page admin
|
|
1769
|
+
var oPath = oConfig.values.data.path,
|
|
1770
|
+
aPath,
|
|
1771
|
+
tResult = [];
|
|
1772
|
+
if (oPath && oPath !== "/") {
|
|
1773
|
+
if (oPath.startsWith("/")) {
|
|
1774
|
+
oPath = oPath.substring(1);
|
|
1775
|
+
}
|
|
1776
|
+
if (oPath.endsWith("/")) {
|
|
1777
|
+
oPath = oPath.substring(0, oPath.length - 1);
|
|
1778
|
+
}
|
|
1779
|
+
aPath = oPath.split("/");
|
|
1780
|
+
tResult = ObjectPath.get(aPath, oData);
|
|
1781
|
+
} else {
|
|
1782
|
+
tResult = oData;
|
|
1783
|
+
}
|
|
1784
|
+
if (this.getMode() === "content" && oConfig.pageAdminValues && oConfig.pageAdminValues.length > 0) {
|
|
1785
|
+
var paValues = oConfig.pageAdminValues,
|
|
1786
|
+
selValues = oConfig.value,
|
|
1787
|
+
selValueItems = oConfig.valueItems,
|
|
1788
|
+
results = [],
|
|
1789
|
+
selResults = [],
|
|
1790
|
+
selItemsResults = [];
|
|
1791
|
+
this.prepareFieldsInKey(oConfig);
|
|
1792
|
+
if (paValues.length > 0) {
|
|
1793
|
+
for (var i = 0; i < paValues.length; i++) {
|
|
1794
|
+
for (var j = 0; j < tResult.length; j++) {
|
|
1795
|
+
var keyValue = this.getKeyFromItem(tResult[j]);
|
|
1796
|
+
if (paValues[i] === keyValue) {
|
|
1797
|
+
results.push(tResult[j]);
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
if (Array.isArray(selValues)) {
|
|
1801
|
+
for (var k = 0; k < selValues.length; k++) {
|
|
1802
|
+
if (paValues[i] === selValues[k]) {
|
|
1803
|
+
selResults.push(selValues[k]);
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
for (var l = 0; l < selValueItems.length; l++) {
|
|
1807
|
+
var kValue = this.getKeyFromItem(selValueItems[l]);
|
|
1808
|
+
if (paValues[i] === kValue) {
|
|
1809
|
+
selItemsResults.push(selValueItems[l]);
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
if (selResults.length > 0) {
|
|
1815
|
+
oConfig.value = [];
|
|
1816
|
+
oConfig.value = selResults;
|
|
1817
|
+
}
|
|
1818
|
+
if (selItemsResults.length > 0) {
|
|
1819
|
+
oConfig.valueItems = [];
|
|
1820
|
+
oConfig.valueItems = selItemsResults;
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
if (oConfig.values.data.path && oConfig.values.data.path !== "/") {
|
|
1824
|
+
delete oData[aPath];
|
|
1825
|
+
ObjectPath.set(aPath, results, oData);
|
|
1826
|
+
} else {
|
|
1827
|
+
oData = [];
|
|
1828
|
+
oData = results;
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
//add group property "Selected" to each record for MultiComboBox in ListField
|
|
1832
|
+
//user configration of the field since its value maybe changed
|
|
1833
|
+
var oFieldConfig = oField.getConfiguration();
|
|
1834
|
+
if (oConfig.type === "string[]") {
|
|
1835
|
+
var sPath = oConfig.values.data.path;
|
|
1836
|
+
if (sPath && sPath !== "/") {
|
|
1837
|
+
if (sPath.startsWith("/")) {
|
|
1838
|
+
sPath = sPath.substring(1);
|
|
1839
|
+
}
|
|
1840
|
+
if (sPath.endsWith("/")) {
|
|
1841
|
+
sPath = sPath.substring(0, sPath.length - 1);
|
|
1842
|
+
}
|
|
1843
|
+
var aPath = sPath.split("/");
|
|
1844
|
+
var oResult = ObjectPath.get(aPath, oData);
|
|
1845
|
+
if (Array.isArray(oResult)) {
|
|
1846
|
+
for (var n in oResult) {
|
|
1847
|
+
var sKey = oField.getKeyFromItem(oResult[n]);
|
|
1848
|
+
if (Array.isArray(oFieldConfig.value) && oFieldConfig.value.length > 0 && includes(oFieldConfig.value, sKey)) {
|
|
1849
|
+
oResult[n].Selected = this._oResourceBundle.getText("EDITOR_ITEM_SELECTED");
|
|
1850
|
+
} else {
|
|
1851
|
+
oResult[n].Selected = this._oResourceBundle.getText("EDITOR_ITEM_UNSELECTED");
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
ObjectPath.set(aPath, oResult, oData);
|
|
1855
|
+
}
|
|
1856
|
+
} else if (Array.isArray(oData)) {
|
|
1857
|
+
for (var n in oData) {
|
|
1858
|
+
var sKey = oField.getKeyFromItem(oData[n]);
|
|
1859
|
+
if (Array.isArray(oFieldConfig.value) && oFieldConfig.value.length > 0 && includes(oFieldConfig.value, sKey)) {
|
|
1860
|
+
oData[n].Selected = this._oResourceBundle.getText("EDITOR_ITEM_SELECTED");
|
|
1861
|
+
} else {
|
|
1862
|
+
oData[n].Selected = this._oResourceBundle.getText("EDITOR_ITEM_UNSELECTED");
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
oConfig._values = oData;
|
|
1868
|
+
var oValueModel = oField.getModel();
|
|
1869
|
+
oValueModel.setData(oData);
|
|
1870
|
+
oValueModel.checkUpdate(true);
|
|
1871
|
+
oValueModel.firePropertyChange();
|
|
1872
|
+
this._settingsModel.setProperty(oConfig._settingspath + "/_loading", false);
|
|
1873
|
+
oField._hideValueState(true, true);
|
|
1874
|
+
}.bind(this)).catch(function (oError) {
|
|
1875
|
+
this._settingsModel.setProperty(oConfig._settingspath + "/_loading", false);
|
|
1876
|
+
var sError = this._oResourceBundle.getText("EDITOR_BAD_REQUEST");
|
|
1877
|
+
if (Array.isArray(oError) && oError.length > 0) {
|
|
1878
|
+
sError = oError[0];
|
|
1879
|
+
var jqXHR = oError[1];
|
|
1880
|
+
if (jqXHR) {
|
|
1881
|
+
var oErrorInResponse;
|
|
1882
|
+
if (jqXHR.responseJSON) {
|
|
1883
|
+
oErrorInResponse = jqXHR.responseJSON.error;
|
|
1884
|
+
} else if (jqXHR.responseText) {
|
|
1885
|
+
if (Utils.isJson(jqXHR.responseText)) {
|
|
1886
|
+
oErrorInResponse = JSON.parse(jqXHR.responseText).error;
|
|
1887
|
+
} else {
|
|
1888
|
+
sError = jqXHR.responseText;
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
if (oErrorInResponse) {
|
|
1892
|
+
sError = (oErrorInResponse.code || oErrorInResponse.errorCode || jqXHR.status) + ": " + oErrorInResponse.message;
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
} else if (typeof (oError) === "string") {
|
|
1896
|
+
sError = oError;
|
|
1897
|
+
}
|
|
1898
|
+
var oValueModel = oField.getModel();
|
|
1899
|
+
oValueModel.firePropertyChange();
|
|
1900
|
+
oField._showValueState("error", sError, true);
|
|
1901
|
+
}.bind(this));
|
|
1902
|
+
};
|
|
1903
|
+
|
|
1904
|
+
Editor.prototype._requestExtensionData = function () {
|
|
1905
|
+
var oExtension = this.getAggregation("_extension");
|
|
1906
|
+
if (!oExtension) {
|
|
1907
|
+
Log.info("Extension is not defined or created, do not load data of it.");
|
|
1908
|
+
return new Promise(function (resolve, reject) {
|
|
1909
|
+
resolve();
|
|
1910
|
+
});
|
|
1911
|
+
}
|
|
1912
|
+
var bHasExtensionData = false;
|
|
1913
|
+
var oExtensionConfig = {};
|
|
1914
|
+
var oExtensionProperty = this._oEditorManifest.get(this.getConfigurationPath() + "/data/extension");
|
|
1915
|
+
var sPath;
|
|
1916
|
+
if (oExtensionProperty) {
|
|
1917
|
+
bHasExtensionData = true;
|
|
1918
|
+
sPath = this._oEditorManifest.get(this.getConfigurationPath() + "/data/path");
|
|
1919
|
+
oExtensionConfig = {
|
|
1920
|
+
"extension": oExtensionProperty
|
|
1921
|
+
};
|
|
1922
|
+
if (sPath) {
|
|
1923
|
+
oExtensionConfig.path = sPath;
|
|
1924
|
+
}
|
|
1925
|
+
} else {
|
|
1926
|
+
oExtensionProperty = this._oEditorManifest.get("/" + this.getSection() + "/data/extension");
|
|
1927
|
+
if (oExtensionProperty) {
|
|
1928
|
+
bHasExtensionData = true;
|
|
1929
|
+
sPath = this._oEditorManifest.get("/" + this.getSection() + "/data/path");
|
|
1930
|
+
oExtensionConfig = {
|
|
1931
|
+
"extension": oExtensionProperty
|
|
1932
|
+
};
|
|
1933
|
+
if (sPath) {
|
|
1934
|
+
oExtensionConfig.path = sPath;
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
if (!bHasExtensionData) {
|
|
1939
|
+
Log.info("Extension data is not defined in manifest, do not load data of it.");
|
|
1940
|
+
return new Promise(function (resolve, reject) {
|
|
1941
|
+
resolve();
|
|
1942
|
+
});
|
|
1943
|
+
}
|
|
1944
|
+
var oDataProvider = this._oDataProviderFactory.create(oExtensionConfig);
|
|
1945
|
+
var oPromise = oDataProvider.getData();
|
|
1946
|
+
return oPromise.then(function (oData) {
|
|
1947
|
+
var oValueModel = oExtension.getModel();
|
|
1948
|
+
if (!oValueModel) {
|
|
1949
|
+
oValueModel = new JSONModel(oData || {});
|
|
1950
|
+
oExtension.setModel(oValueModel, undefined);
|
|
1951
|
+
} else {
|
|
1952
|
+
oValueModel.setData(oData);
|
|
1953
|
+
}
|
|
1954
|
+
oValueModel.checkUpdate(true);
|
|
1955
|
+
}).catch(function (oError) {
|
|
1956
|
+
var sError = this._oResourceBundle.getText("EDITOR_BAD_REQUEST");
|
|
1957
|
+
if (Array.isArray(oError) && oError.length > 0) {
|
|
1958
|
+
sError = oError[0];
|
|
1959
|
+
var jqXHR = oError[1];
|
|
1960
|
+
if (jqXHR) {
|
|
1961
|
+
var oErrorInResponse;
|
|
1962
|
+
if (jqXHR.responseJSON) {
|
|
1963
|
+
oErrorInResponse = jqXHR.responseJSON.error;
|
|
1964
|
+
} else if (jqXHR.responseText) {
|
|
1965
|
+
if (Utils.isJson(jqXHR.responseText)) {
|
|
1966
|
+
oErrorInResponse = JSON.parse(jqXHR.responseText).error;
|
|
1967
|
+
} else {
|
|
1968
|
+
sError = jqXHR.responseText;
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
if (oErrorInResponse) {
|
|
1972
|
+
sError = (oErrorInResponse.code || oErrorInResponse.errorCode || jqXHR.status) + ": " + oErrorInResponse.message;
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
} else if (typeof (oError) === "string") {
|
|
1976
|
+
sError = oError;
|
|
1977
|
+
}
|
|
1978
|
+
Log.error("Request extension data failed, " + sError);
|
|
1979
|
+
}.bind(this));
|
|
1980
|
+
};
|
|
1981
|
+
|
|
1982
|
+
/**
|
|
1983
|
+
* Creates a unnamed model if a values.data section exists in the configuration
|
|
1984
|
+
* @param {object} oConfig
|
|
1985
|
+
* @param {BaseField} oField
|
|
1986
|
+
*/
|
|
1987
|
+
Editor.prototype._addValueListModel = function (oConfig, oField, bIgnore, nTimeout) {
|
|
1988
|
+
if (oConfig.values) {
|
|
1989
|
+
var oValueModel;
|
|
1990
|
+
if (oConfig.values.data) {
|
|
1991
|
+
if (this._oDataProviderFactory) {
|
|
1992
|
+
oValueModel = oField.getModel();
|
|
1993
|
+
if (!oValueModel) {
|
|
1994
|
+
oValueModel = new JSONModel({});
|
|
1995
|
+
oField.setModel(oValueModel, undefined);
|
|
1996
|
+
}
|
|
1997
|
+
this._settingsModel.setProperty(oConfig._settingspath + "/_loading", true);
|
|
1998
|
+
if (!nTimeout) {
|
|
1999
|
+
this._requestData(oConfig, oField);
|
|
2000
|
+
} else {
|
|
2001
|
+
setTimeout(function() {
|
|
2002
|
+
this._requestData(oConfig, oField);
|
|
2003
|
+
}.bind(this), nTimeout);
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
//we use the binding context to connect the given path from oConfig.values.data.path
|
|
2007
|
+
//with that the result of the data request can be have also other structures.
|
|
2008
|
+
oField.bindObject({
|
|
2009
|
+
path: oConfig.values.data.path || "/"
|
|
2010
|
+
});
|
|
2011
|
+
} else if (this.getAggregation("_extension")) {
|
|
2012
|
+
oValueModel = this.getAggregation("_extension").getModel();
|
|
2013
|
+
//filter data for page admin
|
|
2014
|
+
if (oValueModel && this.getMode() === "content" && oConfig.pageAdminValues && oConfig.pageAdminValues.length > 0) {
|
|
2015
|
+
this.prepareFieldsInKey(oConfig);
|
|
2016
|
+
var ePath = oConfig.values.path;
|
|
2017
|
+
if (ePath.length > 1) {
|
|
2018
|
+
ePath = ePath.substring(1);
|
|
2019
|
+
}
|
|
2020
|
+
var oValueData = ObjectPath.get([ePath], oValueModel.getData()),
|
|
2021
|
+
paValues = oConfig.pageAdminValues,
|
|
2022
|
+
results = [];
|
|
2023
|
+
for (var m = 0; m < paValues.length; m++) {
|
|
2024
|
+
for (var j = 0; j < oValueData.length; j++) {
|
|
2025
|
+
var keyValue = this.getKeyFromItem(oValueData[j]);
|
|
2026
|
+
if (paValues[m] === keyValue) {
|
|
2027
|
+
results.push(oValueData[j]);
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
delete oValueData[ePath];
|
|
2032
|
+
ObjectPath.set(ePath, results, oValueData);
|
|
2033
|
+
oValueModel.setData(oValueData);
|
|
2034
|
+
}
|
|
2035
|
+
//we use the binding context to connect the given path from oConfig.values.path
|
|
2036
|
+
//with that the result of the data request can be have also other structures.
|
|
2037
|
+
oField.bindObject({
|
|
2038
|
+
path: oConfig.values.path || "/"
|
|
2039
|
+
});
|
|
2040
|
+
//in the designtime the item bindings will not use a named model, therefore we add a unnamed model for the field
|
|
2041
|
+
//to carry the values.
|
|
2042
|
+
oField.setModel(oValueModel, undefined);
|
|
2043
|
+
}
|
|
2044
|
+
if (!bIgnore) {
|
|
2045
|
+
var sData = JSON.stringify(oConfig.values.data);
|
|
2046
|
+
if (sData) {
|
|
2047
|
+
var destParamRegExp = /parameters\.([^\}\}]+)|destinations\.([^\}\}]+)|\{items\>[\/?\w+]+\}/g,
|
|
2048
|
+
aResult = sData.match(destParamRegExp);
|
|
2049
|
+
if (aResult) {
|
|
2050
|
+
//add the field to dependency to either the parameter or destination
|
|
2051
|
+
for (var i = 0; i < aResult.length; i++) {
|
|
2052
|
+
var sValueKey = "/value";
|
|
2053
|
+
var sDependentPath = this.getConfigurationPath();
|
|
2054
|
+
if (aResult[i].indexOf("destinations.") === 0 || aResult[i].indexOf("parameters.") === 0) {
|
|
2055
|
+
if (aResult[i].indexOf("destinations.") === 0) {
|
|
2056
|
+
sValueKey = "/name";
|
|
2057
|
+
}
|
|
2058
|
+
sDependentPath = sDependentPath + aResult[i].replace(".", "/") + "/" + sValueKey;
|
|
2059
|
+
} else if (aResult[i].indexOf("{items>") === 0) {
|
|
2060
|
+
sDependentPath = sDependentPath + "/parameters/" + aResult[i].slice(7, -1);
|
|
2061
|
+
}
|
|
2062
|
+
var oItem = this._mItemsByPaths[sDependentPath];
|
|
2063
|
+
if (oItem) {
|
|
2064
|
+
//DIGITALWORKPLACE-4802
|
|
2065
|
+
//clone the config since the item may dependent to itself in filter backend feature
|
|
2066
|
+
if (oItem._settingspath === oConfig._settingspath) {
|
|
2067
|
+
oConfig = merge({}, oConfig);
|
|
2068
|
+
}
|
|
2069
|
+
oItem._dependentFields = oItem._dependentFields || [];
|
|
2070
|
+
oItem._dependentFields.push({
|
|
2071
|
+
field: oField,
|
|
2072
|
+
config: oConfig
|
|
2073
|
+
});
|
|
2074
|
+
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
};
|
|
2082
|
+
/**
|
|
2083
|
+
* Adds an item to the _formContent aggregation based on the config settings
|
|
2084
|
+
* @param {} oConfig
|
|
2085
|
+
*/
|
|
2086
|
+
Editor.prototype._addItem = function (oConfig) {
|
|
2087
|
+
var sMode = this.getMode();
|
|
2088
|
+
//force to turn off features for settings and dynamic values and set the default if not configured
|
|
2089
|
+
if (this.getAllowDynamicValues() === false || !oConfig.allowDynamicValues) {
|
|
2090
|
+
oConfig.allowDynamicValues = false;
|
|
2091
|
+
}
|
|
2092
|
+
if (this.getAllowSettings() === false) {
|
|
2093
|
+
oConfig.allowSettings = false;
|
|
2094
|
+
}
|
|
2095
|
+
oConfig.__cols = oConfig.cols || 2;
|
|
2096
|
+
|
|
2097
|
+
//if the item is not visible or translation mode, continue immediately
|
|
2098
|
+
if (oConfig.visible === false || (!oConfig.translatable && sMode === "translation" && oConfig.type !== "group")) {
|
|
2099
|
+
return;
|
|
2100
|
+
}
|
|
2101
|
+
if (oConfig.type === "group") {
|
|
2102
|
+
var oPanel = new Panel({
|
|
2103
|
+
headerText: oConfig.label,
|
|
2104
|
+
visible: oConfig.visible,
|
|
2105
|
+
expandable: oConfig.expandable !== false,
|
|
2106
|
+
expanded: oConfig.expanded !== false,
|
|
2107
|
+
width: "auto",
|
|
2108
|
+
backgroundDesign: "Transparent",
|
|
2109
|
+
objectBindings: {
|
|
2110
|
+
currentSettings: {
|
|
2111
|
+
path: "currentSettings>" + oConfig._settingspath
|
|
2112
|
+
},
|
|
2113
|
+
items: {
|
|
2114
|
+
path: "items>/form/items"
|
|
2115
|
+
},
|
|
2116
|
+
context: {
|
|
2117
|
+
path: "context>/"
|
|
2118
|
+
}
|
|
2119
|
+
},
|
|
2120
|
+
expand: function (oEvent) {
|
|
2121
|
+
var oControl = oEvent.getSource();
|
|
2122
|
+
if (!oEvent.mParameters.expand && oControl.getParent().getAggregation("_messageStrip") !== null) {
|
|
2123
|
+
MessageStripId = oControl.getParent().getAggregation("_messageStrip").getId();
|
|
2124
|
+
}
|
|
2125
|
+
if (oEvent.mParameters.expand) {
|
|
2126
|
+
var oMessageStrip = Core.byId(MessageStripId);
|
|
2127
|
+
oControl.addContent(oMessageStrip);
|
|
2128
|
+
oControl.focus();
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
});
|
|
2132
|
+
this.addAggregation("_formContent", oPanel);
|
|
2133
|
+
oPanel._cols = oConfig.cols || 2; //by default 2 cols
|
|
2134
|
+
if (oConfig.hint) {
|
|
2135
|
+
this._addHint(oConfig.hint);
|
|
2136
|
+
}
|
|
2137
|
+
return;
|
|
2138
|
+
}
|
|
2139
|
+
if (oConfig.type === "separator") {
|
|
2140
|
+
var oSeparator = new Separator();
|
|
2141
|
+
this.addAggregation("_formContent", oSeparator);
|
|
2142
|
+
//currently do not publish the line property to customer
|
|
2143
|
+
//oSeparator._hasLine = oConfig.line || false;
|
|
2144
|
+
return;
|
|
2145
|
+
}
|
|
2146
|
+
var oNewLabel = null;
|
|
2147
|
+
if (sMode === "translation") {
|
|
2148
|
+
if ((typeof oConfig.value === "string" && oConfig.value.indexOf("{") === 0) || typeof oConfig.values !== "undefined") {
|
|
2149
|
+
//do not show dynamic values for translation
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
//adding an internal _language object to save the original value for the UI
|
|
2153
|
+
oConfig._language = {
|
|
2154
|
+
value: oConfig.value
|
|
2155
|
+
};
|
|
2156
|
+
|
|
2157
|
+
//force a 2 column layout in the form, remember the original to reset
|
|
2158
|
+
|
|
2159
|
+
oConfig.cols = 1;
|
|
2160
|
+
//delete values property of string field
|
|
2161
|
+
delete oConfig.values;
|
|
2162
|
+
|
|
2163
|
+
//create a configuration clone. map the _settingspath setting to _language, and set it to not editable
|
|
2164
|
+
var origLangField = deepClone(oConfig, 500);
|
|
2165
|
+
origLangField._settingspath += "/_language";
|
|
2166
|
+
origLangField.editable = false;
|
|
2167
|
+
origLangField.required = false;
|
|
2168
|
+
/* hide multi language function since there has a translation issue in Portal
|
|
2169
|
+
//if has valueTransaltions, get value via language setting in core
|
|
2170
|
+
if (origLangField.valueTranslations) {
|
|
2171
|
+
var sLanguage = Core.getConfiguration().getLanguage().replaceAll('_', '-');
|
|
2172
|
+
if (Editor._languages[sLanguage]) {
|
|
2173
|
+
if (origLangField.valueTranslations[sLanguage]) {
|
|
2174
|
+
origLangField.value = origLangField.valueTranslations[sLanguage];
|
|
2175
|
+
}
|
|
2176
|
+
} else if (sLanguage.indexOf"-") > -1) {
|
|
2177
|
+
sLanguage = sLanguage.substring(0, sLanguage.indexOf("-"));
|
|
2178
|
+
if (Editor._languages[sLanguage]) {
|
|
2179
|
+
if (origLangField.valueTranslations[sLanguage]) {
|
|
2180
|
+
origLangField.value = origLangField.valueTranslations[sLanguage];
|
|
2181
|
+
}
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
}*/
|
|
2185
|
+
if (!origLangField.value) {
|
|
2186
|
+
//the original language field shows only a text control. If empty we show a dash to avoid empty text.
|
|
2187
|
+
origLangField.value = "-";
|
|
2188
|
+
}
|
|
2189
|
+
var oLabel = this._createLabel(origLangField);
|
|
2190
|
+
this.addAggregation("_formContent",
|
|
2191
|
+
oLabel
|
|
2192
|
+
);
|
|
2193
|
+
var oField = this._createField(origLangField);
|
|
2194
|
+
oField.isOrigLangField = true;
|
|
2195
|
+
this.addAggregation("_formContent", oField);
|
|
2196
|
+
|
|
2197
|
+
oConfig.value = oConfig._translatedValue || "";
|
|
2198
|
+
//even if a item is not visible or not editable by another layer for translations it should always be editable and visible
|
|
2199
|
+
oConfig.editable = oConfig.visible = oConfig.translatable;
|
|
2200
|
+
//if there are changes for the current layer, read the already translated value from there
|
|
2201
|
+
//now merge these changes for translation into the item configs
|
|
2202
|
+
if (this._currentLayerManifestChanges) {
|
|
2203
|
+
oConfig.value = this._currentLayerManifestChanges[oConfig.manifestpath] || oConfig.value;
|
|
2204
|
+
}
|
|
2205
|
+
//change the label for the translation field
|
|
2206
|
+
oConfig.label = oConfig._translatedLabel || "";
|
|
2207
|
+
oConfig.required = false; //translation is never required
|
|
2208
|
+
var oField = this._createField(oConfig);
|
|
2209
|
+
this.addAggregation("_formContent",
|
|
2210
|
+
oField
|
|
2211
|
+
);
|
|
2212
|
+
} else {
|
|
2213
|
+
oNewLabel = this._createLabel(oConfig);
|
|
2214
|
+
this.addAggregation("_formContent",
|
|
2215
|
+
oNewLabel
|
|
2216
|
+
);
|
|
2217
|
+
//if there are changes for the current layer, read the already translated value from there
|
|
2218
|
+
//now merge these changes for translation into the item configs
|
|
2219
|
+
if (this._currentLayerManifestChanges) {
|
|
2220
|
+
oConfig.value = this._currentLayerManifestChanges[oConfig.manifestpath] || oConfig.value;
|
|
2221
|
+
}
|
|
2222
|
+
var oField = this._createField(oConfig);
|
|
2223
|
+
this.addAggregation("_formContent",
|
|
2224
|
+
oField
|
|
2225
|
+
);
|
|
2226
|
+
}
|
|
2227
|
+
//add hint in the new row.
|
|
2228
|
+
if (oConfig.hint && (!oConfig.cols || oConfig.cols === 2)) {
|
|
2229
|
+
this._addHint(oConfig.hint);
|
|
2230
|
+
}
|
|
2231
|
+
//reset the cols to original
|
|
2232
|
+
oConfig.cols = oConfig.__cols;
|
|
2233
|
+
delete oConfig.__cols;
|
|
2234
|
+
};
|
|
2235
|
+
|
|
2236
|
+
Editor.prototype._createHint = function (sHint) {
|
|
2237
|
+
sHint = sHint.replace(/<a href/g, "<a target='blank' href");
|
|
2238
|
+
var oFormattedText = new FormattedText({
|
|
2239
|
+
htmlText: sHint
|
|
2240
|
+
});
|
|
2241
|
+
return oFormattedText;
|
|
2242
|
+
};
|
|
2243
|
+
|
|
2244
|
+
Editor.prototype._addHint = function (sHint) {
|
|
2245
|
+
var oHint = this._createHint(sHint);
|
|
2246
|
+
this.addAggregation("_formContent", oHint);
|
|
2247
|
+
};
|
|
2248
|
+
/**
|
|
2249
|
+
* Returns the current language specific text for a given key or "" if no translation for the key exists
|
|
2250
|
+
*/
|
|
2251
|
+
Editor.prototype._getCurrentLanguageSpecificText = function (sKey) {
|
|
2252
|
+
var sLanguage = this._language;
|
|
2253
|
+
if (this._oTranslationBundle) {
|
|
2254
|
+
var sText = this._oTranslationBundle.getText(sKey, [], true);
|
|
2255
|
+
if (sText === undefined) {
|
|
2256
|
+
return "";
|
|
2257
|
+
}
|
|
2258
|
+
return sText;
|
|
2259
|
+
}
|
|
2260
|
+
if (!sLanguage) {
|
|
2261
|
+
return "";
|
|
2262
|
+
}
|
|
2263
|
+
var vI18n = this._oEditorManifest.get("/sap.app/i18n");
|
|
2264
|
+
if (!vI18n) {
|
|
2265
|
+
return "";
|
|
2266
|
+
}
|
|
2267
|
+
if (typeof vI18n === "string") {
|
|
2268
|
+
var aFallbacks = [sLanguage];
|
|
2269
|
+
if (sLanguage.indexOf("-") > -1) {
|
|
2270
|
+
aFallbacks.push(sLanguage.substring(0, sLanguage.indexOf("-")));
|
|
2271
|
+
}
|
|
2272
|
+
//add en into fallbacks
|
|
2273
|
+
if (!includes(aFallbacks, "en")) {
|
|
2274
|
+
aFallbacks.push("en");
|
|
2275
|
+
}
|
|
2276
|
+
// load the ResourceBundle relative to the manifest
|
|
2277
|
+
this._oTranslationBundle = ResourceBundle.create({
|
|
2278
|
+
url: this.getBaseUrl() + vI18n,
|
|
2279
|
+
async: false,
|
|
2280
|
+
locale: sLanguage,
|
|
2281
|
+
supportedLocales: aFallbacks,
|
|
2282
|
+
fallbackLocale: "en"
|
|
2283
|
+
});
|
|
2284
|
+
|
|
2285
|
+
return this._getCurrentLanguageSpecificText(sKey);
|
|
2286
|
+
}
|
|
2287
|
+
};
|
|
2288
|
+
|
|
2289
|
+
/**
|
|
2290
|
+
* Starts the editor, creates the fields
|
|
2291
|
+
*/
|
|
2292
|
+
Editor.prototype._startEditor = function () {
|
|
2293
|
+
var oContents = this.getAggregation("_formContent");
|
|
2294
|
+
if (oContents && oContents.length > 0) {
|
|
2295
|
+
this.destroyAggregation("_formContent");
|
|
2296
|
+
}
|
|
2297
|
+
var oSettings = this._settingsModel.getProperty("/");
|
|
2298
|
+
var aItems;
|
|
2299
|
+
if (oSettings.form && oSettings.form.items) {
|
|
2300
|
+
aItems = oSettings.form.items;
|
|
2301
|
+
//get current language
|
|
2302
|
+
var sLanguage = this._language || this.getLanguage() || Core.getConfiguration().getLanguage().replaceAll('_', '-');
|
|
2303
|
+
if (this.getMode() === "translation") {
|
|
2304
|
+
//add top panel of translation editor
|
|
2305
|
+
this._addItem({
|
|
2306
|
+
type: "group",
|
|
2307
|
+
translatable: true,
|
|
2308
|
+
expandable: false,
|
|
2309
|
+
label: this._oResourceBundle.getText("EDITOR_ORIGINALLANG") + ": " + Editor._languages[sLanguage]
|
|
2310
|
+
});
|
|
2311
|
+
}
|
|
2312
|
+
//add general configuration group
|
|
2313
|
+
var bAddGeneralSettingsPanel = false;
|
|
2314
|
+
for (var m in aItems) {
|
|
2315
|
+
var oItem = aItems[m];
|
|
2316
|
+
if (oItem.type === "group") {
|
|
2317
|
+
break;
|
|
2318
|
+
} else if (oItem.visible) {
|
|
2319
|
+
bAddGeneralSettingsPanel = true;
|
|
2320
|
+
break;
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
if (bAddGeneralSettingsPanel) {
|
|
2324
|
+
//add general settings panel
|
|
2325
|
+
this._addItem({
|
|
2326
|
+
type: "group",
|
|
2327
|
+
translatable: true,
|
|
2328
|
+
label: this._oResourceBundle.getText("EDITOR_PARAMETERS_GENERALSETTINGS")
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
this._mItemsByPaths = {};
|
|
2332
|
+
for (var n in aItems) {
|
|
2333
|
+
var oItem = aItems[n];
|
|
2334
|
+
if (oItem) {
|
|
2335
|
+
//force a label setting, set it to the name of the item
|
|
2336
|
+
oItem.label = oItem.label || n;
|
|
2337
|
+
//what is the current value from the change?
|
|
2338
|
+
/* hide multi language function since there has a translation issue in Portal
|
|
2339
|
+
var sCurrentLayerValue, sValueTranslationsPath, aTranslationLayerValueChanges;
|
|
2340
|
+
* remove below line if release this feature again
|
|
2341
|
+
*/
|
|
2342
|
+
var sCurrentLayerValue;
|
|
2343
|
+
if (oItem.manifestpath) {
|
|
2344
|
+
this._mItemsByPaths[oItem.manifestpath] = oItem;
|
|
2345
|
+
/* hide multi language function since there has a translation issue in Portal
|
|
2346
|
+
sValueTranslationsPath = oItem.manifestpath.substring(0, oItem.manifestpath.lastIndexOf("/")) + "/valueTranslations";
|
|
2347
|
+
if (this.getMode() === "translation") {
|
|
2348
|
+
if (this._currentLayerManifestChanges
|
|
2349
|
+
&& this._currentLayerManifestChanges[sValueTranslationsPath]) {
|
|
2350
|
+
//get valueTranslations from current layer changes if current mode is translation
|
|
2351
|
+
aTranslationLayerValueChanges = this._currentLayerManifestChanges[sValueTranslationsPath];
|
|
2352
|
+
}
|
|
2353
|
+
} else {
|
|
2354
|
+
sCurrentLayerValue = this._currentLayerManifestChanges[oItem.manifestpath];
|
|
2355
|
+
}*/
|
|
2356
|
+
/* hide multi language function since there has a translation issue in Portal
|
|
2357
|
+
* need to remove below line later if release multi language function again
|
|
2358
|
+
*/
|
|
2359
|
+
sCurrentLayerValue = this._currentLayerManifestChanges[oItem.manifestpath];
|
|
2360
|
+
}
|
|
2361
|
+
//if not changed it should be undefined, and ignore changes in tranlation layer
|
|
2362
|
+
oItem._changed = sCurrentLayerValue !== undefined && this.getMode() !== "translation";
|
|
2363
|
+
|
|
2364
|
+
if (oItem.values) {
|
|
2365
|
+
oItem.translatable = false;
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
oItem._beforeValue = this._getManifestBeforelValue(oItem.manifestpath);
|
|
2369
|
+
|
|
2370
|
+
//check if the provided value from the parameter or designtime default value is a translated value
|
|
2371
|
+
//restrict this to string types for now
|
|
2372
|
+
if (oItem.type === "string") {
|
|
2373
|
+
/* hide multi language function since there has a translation issue in Portal
|
|
2374
|
+
//get i18n path of the editor, and set it to item for initializing EditorResourceBundles
|
|
2375
|
+
var vI18n = this._oEditorManifest.get("/sap.app/i18n");
|
|
2376
|
+
if (!vI18n) {
|
|
2377
|
+
vI18n = "";
|
|
2378
|
+
}
|
|
2379
|
+
oItem._resourceBundleURL = this.getBaseUrl() + vI18n;
|
|
2380
|
+
if (oItem.manifestpath) {
|
|
2381
|
+
//merge valueTranslations in current mainfest mode and current layer changes
|
|
2382
|
+
var oValueTranslationsInManifest = this._manifestModel.getProperty(sValueTranslationsPath);
|
|
2383
|
+
oItem.valueTranslations = merge(oValueTranslationsInManifest, aTranslationLayerValueChanges);
|
|
2384
|
+
aTranslationLayerValueChanges = undefined;
|
|
2385
|
+
}*/
|
|
2386
|
+
//check if is translatable via default value, if default value match "{{sTranslationTextKey}}" or "{i18n>sTranslationTextKey}", it is translatable
|
|
2387
|
+
oItem._translatedDefaultPlaceholder = this._getManifestDefaultValue(oItem.manifestpath);
|
|
2388
|
+
var sTranslationTextKey = null,
|
|
2389
|
+
sPlaceholder = oItem._translatedDefaultPlaceholder;
|
|
2390
|
+
if (sPlaceholder) {
|
|
2391
|
+
//value with parameter syntax will not be translated
|
|
2392
|
+
if (this._isValueWithParameterSyntax(sPlaceholder)) {
|
|
2393
|
+
oItem.translatable = false;
|
|
2394
|
+
}
|
|
2395
|
+
//parameter translated value wins over designtime defaultValue
|
|
2396
|
+
if (this._isValueWithHandlebarsTranslation(sPlaceholder)) {
|
|
2397
|
+
sTranslationTextKey = sPlaceholder.substring(2, sPlaceholder.length - 2);
|
|
2398
|
+
} else if (sPlaceholder.startsWith("{i18n>")) {
|
|
2399
|
+
sTranslationTextKey = sPlaceholder.substring(6, sPlaceholder.length - 1);
|
|
2400
|
+
}
|
|
2401
|
+
//only if there is a translation key
|
|
2402
|
+
if (sTranslationTextKey) {
|
|
2403
|
+
//force translatable, even if it was not explicitly set already
|
|
2404
|
+
oItem.translatable = true;
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
//check if before value still has tranlation key
|
|
2408
|
+
oItem._translatedPlaceholder = oItem._beforeValue;
|
|
2409
|
+
sTranslationTextKey = null;
|
|
2410
|
+
sPlaceholder = oItem._translatedPlaceholder;
|
|
2411
|
+
if (sPlaceholder) {
|
|
2412
|
+
//value with parameter syntax will not be translated
|
|
2413
|
+
if (this._isValueWithParameterSyntax(sPlaceholder)) {
|
|
2414
|
+
oItem.translatable = false;
|
|
2415
|
+
}
|
|
2416
|
+
//parameter translated value wins over designtime defaultValue
|
|
2417
|
+
if (this._isValueWithHandlebarsTranslation(sPlaceholder)) {
|
|
2418
|
+
sTranslationTextKey = sPlaceholder.substring(2, sPlaceholder.length - 2);
|
|
2419
|
+
} else if (sPlaceholder.startsWith("{i18n>")) {
|
|
2420
|
+
sTranslationTextKey = sPlaceholder.substring(6, sPlaceholder.length - 1);
|
|
2421
|
+
}
|
|
2422
|
+
//only if there is a translation key
|
|
2423
|
+
if (sTranslationTextKey) {
|
|
2424
|
+
oItem._translatedValue = this.getModel("i18n").getResourceBundle().getText(sTranslationTextKey);
|
|
2425
|
+
if (oItem._changed) {
|
|
2426
|
+
//item was changed, take the current value
|
|
2427
|
+
oItem.value = sCurrentLayerValue;
|
|
2428
|
+
} else {
|
|
2429
|
+
oItem.value = oItem._translatedValue;
|
|
2430
|
+
}
|
|
2431
|
+
if (oItem.valueTranslations && oItem.valueTranslations[sLanguage]) {
|
|
2432
|
+
oItem.value = oItem.valueTranslations[sLanguage];
|
|
2433
|
+
}
|
|
2434
|
+
if (this.getMode() === "translation") {
|
|
2435
|
+
//if we are in translation mode the default value differs and depends on the language
|
|
2436
|
+
//TODO this does not work in SWZ, the base path is not taken into account...
|
|
2437
|
+
//get the translated default value for the language we want to translate this.getLanguage()
|
|
2438
|
+
oItem._translatedValue = this._getCurrentLanguageSpecificText(sTranslationTextKey);
|
|
2439
|
+
}
|
|
2440
|
+
} else if (oItem.translatable && this.getMode() === "translation") {
|
|
2441
|
+
//if no translation key which means item defined as string value directly.
|
|
2442
|
+
//set the _translatedValue with item manifest value or default value.
|
|
2443
|
+
oItem._translatedValue = oItem._translatedPlaceholder;
|
|
2444
|
+
oItem.value = oItem._beforeValue;
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2447
|
+
if (this.getMode() === "translation") {
|
|
2448
|
+
if (oItem.valueTranslations && oItem.valueTranslations[sLanguage]) {
|
|
2449
|
+
oItem._translatedValue = oItem.valueTranslations[sLanguage];
|
|
2450
|
+
}
|
|
2451
|
+
if (this._isValueWithHandlebarsTranslation(oItem.label)) {
|
|
2452
|
+
oItem._translatedLabel = this._getCurrentLanguageSpecificText(oItem.label.substring(2, oItem.label.length - 2), true);
|
|
2453
|
+
} else if (oItem.label && oItem.label.startsWith("{i18n>")) {
|
|
2454
|
+
//TODO this does not work in SWZ, the base path is not taken into account...
|
|
2455
|
+
//get the translated default value for the language we want to translate this.getLanguage()
|
|
2456
|
+
oItem._translatedLabel = this._getCurrentLanguageSpecificText(oItem.label.substring(6, oItem.label.length - 1), true);
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
} else if (oItem.type === "string[]") {
|
|
2460
|
+
var sValueItemsPath = oItem.manifestpath.substring(0, oItem.manifestpath.lastIndexOf("/")) + "/valueItems";
|
|
2461
|
+
var oValueItems = this._manifestModel.getProperty(sValueItemsPath);
|
|
2462
|
+
if (oValueItems) {
|
|
2463
|
+
oItem.valueItems = oValueItems;
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
//translate label if it is {{KEY}}
|
|
2468
|
+
if (oItem.label && this._isValueWithHandlebarsTranslation(oItem.label)) {
|
|
2469
|
+
var sTranslationLabelKey = oItem.label.substring(2, oItem.label.length - 2);
|
|
2470
|
+
if (sTranslationLabelKey) {
|
|
2471
|
+
oItem.label = this.getModel("i18n").getResourceBundle().getText(sTranslationLabelKey);
|
|
2472
|
+
}
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
for (var n in aItems) {
|
|
2479
|
+
var oItem = aItems[n];
|
|
2480
|
+
this._addItem(oItem);
|
|
2481
|
+
}
|
|
2482
|
+
//add additional content
|
|
2483
|
+
if (this.getMode() !== "translation") {
|
|
2484
|
+
Promise.resolve(this._initPreview()).then(function() {
|
|
2485
|
+
Promise.all(this._aFieldReadyPromise).then(function () {
|
|
2486
|
+
this._ready = true;
|
|
2487
|
+
this.fireReady();
|
|
2488
|
+
}.bind(this));
|
|
2489
|
+
}.bind(this));
|
|
2490
|
+
} else {
|
|
2491
|
+
Promise.all(this._aFieldReadyPromise).then(function () {
|
|
2492
|
+
this._ready = true;
|
|
2493
|
+
this.fireReady();
|
|
2494
|
+
}.bind(this));
|
|
2495
|
+
}
|
|
2496
|
+
};
|
|
2497
|
+
/**
|
|
2498
|
+
* Destroy the editor and the internal instances that it created
|
|
2499
|
+
*/
|
|
2500
|
+
Editor.prototype.destroy = function () {
|
|
2501
|
+
if (this._oPopover) {
|
|
2502
|
+
this._oPopover.destroy();
|
|
2503
|
+
}
|
|
2504
|
+
if (this._oDesigntimeInstance) {
|
|
2505
|
+
this._oDesigntimeInstance.destroy();
|
|
2506
|
+
}
|
|
2507
|
+
var oPreview = this.getAggregation("_preview");
|
|
2508
|
+
if (oPreview && oPreview.destroy) {
|
|
2509
|
+
oPreview.destroy();
|
|
2510
|
+
}
|
|
2511
|
+
var oMessageStrip = Core.byId(MessageStripId);
|
|
2512
|
+
if (oMessageStrip) {
|
|
2513
|
+
oMessageStrip.destroy();
|
|
2514
|
+
}
|
|
2515
|
+
this._manifestModel = null;
|
|
2516
|
+
this._beforeManifestModel = null;
|
|
2517
|
+
this._oInitialManifestModel = null;
|
|
2518
|
+
this._settingsModel = null;
|
|
2519
|
+
Control.prototype.destroy.apply(this, arguments);
|
|
2520
|
+
};
|
|
2521
|
+
|
|
2522
|
+
/**
|
|
2523
|
+
* Initializes the additional content
|
|
2524
|
+
*/
|
|
2525
|
+
Editor.prototype._initPreview = function () {
|
|
2526
|
+
return new Promise(function (resolve, reject) {
|
|
2527
|
+
resolve();
|
|
2528
|
+
});
|
|
2529
|
+
};
|
|
2530
|
+
|
|
2531
|
+
/**
|
|
2532
|
+
* Applies the defaults for the designtime settings
|
|
2533
|
+
*/
|
|
2534
|
+
Editor.prototype._applyDesigntimeDefaults = function (oSettings) {
|
|
2535
|
+
oSettings = oSettings || {};
|
|
2536
|
+
oSettings.form = oSettings.form || {};
|
|
2537
|
+
oSettings.form.items = oSettings.form.items || {};
|
|
2538
|
+
var mItems = oSettings.form.items || oSettings.form.items;
|
|
2539
|
+
for (var n in mItems) {
|
|
2540
|
+
var oItem = mItems[n];
|
|
2541
|
+
if (oItem.manifestpath) {
|
|
2542
|
+
oItem.value = this._manifestModel.getProperty(oItem.manifestpath);
|
|
2543
|
+
}
|
|
2544
|
+
if (oItem.visible === undefined || oItem.visible === null) {
|
|
2545
|
+
oItem.visible = true;
|
|
2546
|
+
}
|
|
2547
|
+
if (oItem.editable === undefined || oItem.editable === null) {
|
|
2548
|
+
oItem.editable = true;
|
|
2549
|
+
}
|
|
2550
|
+
if (this.getMode() !== "admin") {
|
|
2551
|
+
if (oItem.visibleToUser !== undefined) {
|
|
2552
|
+
oItem.visible = oItem.visibleToUser;
|
|
2553
|
+
}
|
|
2554
|
+
if (oItem.editableToUser !== undefined) {
|
|
2555
|
+
oItem.editable = oItem.editableToUser;
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
if (typeof oItem.translatable !== "boolean") {
|
|
2559
|
+
oItem.translatable = false;
|
|
2560
|
+
}
|
|
2561
|
+
if (!oItem.label) {
|
|
2562
|
+
oItem.label = n;
|
|
2563
|
+
}
|
|
2564
|
+
|
|
2565
|
+
if (!oItem.type || oItem.type === "enum") {
|
|
2566
|
+
|
|
2567
|
+
oItem.type = "string";
|
|
2568
|
+
}
|
|
2569
|
+
//only if the value is undefined from the this._manifestModel.getProperty(oItem.manifestpath)
|
|
2570
|
+
//false, "", 0... are valid values and should not apply the default
|
|
2571
|
+
if (oItem.value === undefined || oItem.value === null) {
|
|
2572
|
+
switch (oItem.type) {
|
|
2573
|
+
case "boolean": oItem.value = false; break;
|
|
2574
|
+
case "integer":
|
|
2575
|
+
case "number": oItem.value = 0; break;
|
|
2576
|
+
case "string[]": oItem.value = []; break;
|
|
2577
|
+
default: oItem.value = "";
|
|
2578
|
+
}
|
|
2579
|
+
}
|
|
2580
|
+
if (oItem.type === "group") {
|
|
2581
|
+
if (oItem.visible === undefined || oItem.value === null) {
|
|
2582
|
+
oItem.visible = true;
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
oItem._settingspath = "/form/items/" + n;
|
|
2586
|
+
}
|
|
2587
|
+
};
|
|
2588
|
+
/**
|
|
2589
|
+
* Applies previous layer designtime settings that were changed
|
|
2590
|
+
*/
|
|
2591
|
+
Editor.prototype._applyDesigntimeLayers = function (oSettings) {
|
|
2592
|
+
//pull current values
|
|
2593
|
+
if (this._appliedLayerManifestChanges && Array.isArray(this._appliedLayerManifestChanges)) {
|
|
2594
|
+
for (var i = 0; i < this._appliedLayerManifestChanges.length; i++) {
|
|
2595
|
+
var oChanges = this._appliedLayerManifestChanges[i][":designtime"];
|
|
2596
|
+
if (oChanges) {
|
|
2597
|
+
var aKeys = Object.keys(oChanges);
|
|
2598
|
+
for (var j = 0; j < aKeys.length; j++) {
|
|
2599
|
+
this._settingsModel.setProperty(aKeys[j], oChanges[aKeys[j]]);
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
if (this._currentLayerManifestChanges) {
|
|
2605
|
+
var oChanges = this._currentLayerManifestChanges[":designtime"];
|
|
2606
|
+
if (oChanges) {
|
|
2607
|
+
var aKeys = Object.keys(oChanges);
|
|
2608
|
+
for (var j = 0; j < aKeys.length; j++) {
|
|
2609
|
+
//apply the values to a "_next/editable", "_next/visible" entry to the settings.
|
|
2610
|
+
//the current layer needs to be able to change those values
|
|
2611
|
+
var sPath = aKeys[j],
|
|
2612
|
+
sNext = sPath.substring(0, sPath.lastIndexOf("/") + 1) + "_next";
|
|
2613
|
+
if (!this._settingsModel.getProperty(sNext)) {
|
|
2614
|
+
//create a _next entry if it does not exist
|
|
2615
|
+
this._settingsModel.setProperty(sNext, {});
|
|
2616
|
+
}
|
|
2617
|
+
var sNext = sPath.substring(0, sPath.lastIndexOf("/") + 1) + "_next",
|
|
2618
|
+
sProp = sPath.substring(sPath.lastIndexOf("/") + 1);
|
|
2619
|
+
this._settingsModel.setProperty(sNext + "/" + sProp, oChanges[aKeys[j]]);
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
};
|
|
2624
|
+
/**
|
|
2625
|
+
* Creates a designtime instance based on an configuration section within the manifest.
|
|
2626
|
+
* This is valid if there is no explicit sap.card/designtime module in the manifest itself.
|
|
2627
|
+
*/
|
|
2628
|
+
Editor.prototype._createParameterDesigntime = function (oConfiguration) {
|
|
2629
|
+
var oSettings = {},
|
|
2630
|
+
sBasePath = this.getConfigurationPath() + "/parameters",
|
|
2631
|
+
sMode = this.getMode();
|
|
2632
|
+
if (oConfiguration && oConfiguration.parameters) {
|
|
2633
|
+
oSettings.form = oSettings.form || {};
|
|
2634
|
+
oSettings.form.items = oSettings.form.items || {};
|
|
2635
|
+
var oItems = oSettings.form.items;
|
|
2636
|
+
Object.keys(oConfiguration.parameters).forEach(function (n) {
|
|
2637
|
+
oItems[n] = merge({
|
|
2638
|
+
manifestpath: sBasePath + "/" + n + "/value",
|
|
2639
|
+
editable: (sMode !== "translation"),
|
|
2640
|
+
_settingspath: "/form/items/" + n
|
|
2641
|
+
}, oConfiguration.parameters[n]);
|
|
2642
|
+
var oItem = oItems[n];
|
|
2643
|
+
if (!oItem.type) {
|
|
2644
|
+
oItem.type = "string";
|
|
2645
|
+
}
|
|
2646
|
+
if (!oItem.hasOwnProperty("visible")) {
|
|
2647
|
+
oItem.visible = true;
|
|
2648
|
+
}
|
|
2649
|
+
});
|
|
2650
|
+
}
|
|
2651
|
+
return new Designtime(oSettings);
|
|
2652
|
+
};
|
|
2653
|
+
/**
|
|
2654
|
+
* Adds additional settings for destinations section in admin mode
|
|
2655
|
+
* @param {} oConfiguration
|
|
2656
|
+
*/
|
|
2657
|
+
Editor.prototype._addDestinationSettings = function (oConfiguration) {
|
|
2658
|
+
var oSettings = this._oDesigntimeInstance.getSettings(),
|
|
2659
|
+
sBasePath = this.getConfigurationPath() + "/destinations";
|
|
2660
|
+
oSettings.form = oSettings.form || {};
|
|
2661
|
+
oSettings.form.items = oSettings.form.items || {};
|
|
2662
|
+
if (oSettings && oConfiguration && oConfiguration.destinations) {
|
|
2663
|
+
if (!oSettings.form.items["destination.group"]) {
|
|
2664
|
+
//destination section separated by a group header
|
|
2665
|
+
oSettings.form.items["destination.group"] = {
|
|
2666
|
+
label: this._oResourceBundle.getText("EDITOR_DESTINATIONS") || "Destinations",
|
|
2667
|
+
type: "group",
|
|
2668
|
+
visible: true
|
|
2669
|
+
};
|
|
2670
|
+
}
|
|
2671
|
+
var oItems = oSettings.form.items,
|
|
2672
|
+
oHost = this.getHostInstance();
|
|
2673
|
+
Object.keys(oConfiguration.destinations).forEach(function (n) {
|
|
2674
|
+
oItems[n + ".destinaton"] = merge({
|
|
2675
|
+
manifestpath: sBasePath + "/" + n + "/name", //destination points to name not value
|
|
2676
|
+
visible: true,
|
|
2677
|
+
type: "destination",
|
|
2678
|
+
editable: true,
|
|
2679
|
+
allowDynamicValues: false,
|
|
2680
|
+
allowSettings: false,
|
|
2681
|
+
value: oConfiguration.destinations[n].name,
|
|
2682
|
+
defaultValue: oConfiguration.destinations[n].defaultUrl,
|
|
2683
|
+
_settingspath: "/form/items/" + [n + ".destinaton"],
|
|
2684
|
+
_values: [],
|
|
2685
|
+
_destinationName: n
|
|
2686
|
+
}, oConfiguration.destinations[n]);
|
|
2687
|
+
if (typeof oItems[n + ".destinaton"].label === "undefined") {
|
|
2688
|
+
oItems[n + ".destinaton"].label = n;
|
|
2689
|
+
}
|
|
2690
|
+
if (oHost) {
|
|
2691
|
+
oItems[n + ".destinaton"]._loading = true;
|
|
2692
|
+
}
|
|
2693
|
+
});
|
|
2694
|
+
var getDestinationsDone = false;
|
|
2695
|
+
if (oHost) {
|
|
2696
|
+
this.getHostInstance().getDestinations().then(function (a) {
|
|
2697
|
+
getDestinationsDone = true;
|
|
2698
|
+
Object.keys(oConfiguration.destinations).forEach(function (n) {
|
|
2699
|
+
oItems[n + ".destinaton"]._values = a;
|
|
2700
|
+
oItems[n + ".destinaton"]._loading = false;
|
|
2701
|
+
this._settingsModel.checkUpdate(true);
|
|
2702
|
+
}.bind(this));
|
|
2703
|
+
}.bind(this)).catch(function () {
|
|
2704
|
+
//Fix DIGITALWORKPLACE-4359, retry once for the timeout issue
|
|
2705
|
+
return this.getHostInstance().getDestinations();
|
|
2706
|
+
}.bind(this)).then(function (b) {
|
|
2707
|
+
if (getDestinationsDone) {
|
|
2708
|
+
return;
|
|
2709
|
+
}
|
|
2710
|
+
Object.keys(oConfiguration.destinations).forEach(function (n) {
|
|
2711
|
+
oItems[n + ".destinaton"]._values = b;
|
|
2712
|
+
oItems[n + ".destinaton"]._loading = false;
|
|
2713
|
+
this._settingsModel.checkUpdate(true);
|
|
2714
|
+
}.bind(this));
|
|
2715
|
+
}.bind(this)).catch(function (e) {
|
|
2716
|
+
Object.keys(oConfiguration.destinations).forEach(function (n) {
|
|
2717
|
+
oItems[n + ".destinaton"]._loading = false;
|
|
2718
|
+
this._settingsModel.checkUpdate(true);
|
|
2719
|
+
}.bind(this));
|
|
2720
|
+
Log.error("Can not get destinations list from '" + oHost.getId() + "'.");
|
|
2721
|
+
}.bind(this));
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
};
|
|
2725
|
+
|
|
2726
|
+
/**
|
|
2727
|
+
* Returns the default value that was given by the developer for the given path
|
|
2728
|
+
* @param {string} sPath
|
|
2729
|
+
*/
|
|
2730
|
+
Editor.prototype._getManifestDefaultValue = function (sPath) {
|
|
2731
|
+
return this._oInitialManifestModel.getProperty(sPath);
|
|
2732
|
+
};
|
|
2733
|
+
Editor.prototype._getManifestBeforelValue = function (sPath) {
|
|
2734
|
+
return this._beforeManifestModel.getProperty(sPath);
|
|
2735
|
+
};
|
|
2736
|
+
/**
|
|
2737
|
+
* Returns whether the value is translatable via the handlbars translation syntax {{KEY}}
|
|
2738
|
+
* For other than string values false is returned
|
|
2739
|
+
* @param {any} vValue
|
|
2740
|
+
*/
|
|
2741
|
+
Editor.prototype._isValueWithHandlebarsTranslation = function (vValue) {
|
|
2742
|
+
if (typeof vValue === "string") {
|
|
2743
|
+
return !!vValue.match(REGEXP_TRANSLATABLE);
|
|
2744
|
+
}
|
|
2745
|
+
return false;
|
|
2746
|
+
};
|
|
2747
|
+
|
|
2748
|
+
Editor.prototype._isValueWithParameterSyntax = function (vValue) {
|
|
2749
|
+
if (typeof vValue === "string") {
|
|
2750
|
+
return !!vValue.match(REGEXP_PARAMETERS);
|
|
2751
|
+
}
|
|
2752
|
+
return false;
|
|
2753
|
+
};
|
|
2754
|
+
|
|
2755
|
+
//create static context entries
|
|
2756
|
+
Editor._contextEntries =
|
|
2757
|
+
{
|
|
2758
|
+
empty: {
|
|
2759
|
+
label: oResourceBundle.getText("EDITOR_CONTEXT_EMPTY_VAL"),
|
|
2760
|
+
type: "string",
|
|
2761
|
+
description: oResourceBundle.getText("EDITOR_CONTEXT_EMPTY_DESC"),
|
|
2762
|
+
placeholder: "",
|
|
2763
|
+
value: ""
|
|
2764
|
+
},
|
|
2765
|
+
"editor.internal": {
|
|
2766
|
+
label: oResourceBundle.getText("EDITOR_CONTEXT_EDITOR_INTERNAL_VAL"),
|
|
2767
|
+
todayIso: {
|
|
2768
|
+
type: "string",
|
|
2769
|
+
label: oResourceBundle.getText("EDITOR_CONTEXT_EDITOR_TODAY_VAL"),
|
|
2770
|
+
description: oResourceBundle.getText("EDITOR_CONTEXT_EDITOR_TODAY_DESC"),
|
|
2771
|
+
tags: [],
|
|
2772
|
+
placeholder: oResourceBundle.getText("EDITOR_CONTEXT_EDITOR_TODAY_VAL"),
|
|
2773
|
+
customize: ["format.dataTime"],
|
|
2774
|
+
value: "{{parameters.TODAY_ISO}}"
|
|
2775
|
+
},
|
|
2776
|
+
nowIso: {
|
|
2777
|
+
type: "string",
|
|
2778
|
+
label: oResourceBundle.getText("EDITOR_CONTEXT_EDITOR_NOW_VAL"),
|
|
2779
|
+
description: oResourceBundle.getText("EDITOR_CONTEXT_EDITOR_NOW_DESC"),
|
|
2780
|
+
tags: [],
|
|
2781
|
+
placeholder: oResourceBundle.getText("EDITOR_CONTEXT_EDITOR_NOW_VAL"),
|
|
2782
|
+
customize: ["dateFormatters"],
|
|
2783
|
+
value: "{{parameters.NOW_ISO}}"
|
|
2784
|
+
},
|
|
2785
|
+
currentLanguage: {
|
|
2786
|
+
type: "string",
|
|
2787
|
+
label: oResourceBundle.getText("EDITOR_CONTEXT_EDITOR_LANG_VAL"),
|
|
2788
|
+
description: oResourceBundle.getText("EDITOR_CONTEXT_EDITOR_LANG_VAL"),
|
|
2789
|
+
tags: ["technical"],
|
|
2790
|
+
customize: ["languageFormatters"],
|
|
2791
|
+
placeholder: oResourceBundle.getText("EDITOR_CONTEXT_EDITOR_LANG_VAL"),
|
|
2792
|
+
value: "{{parameters.LOCALE}}"
|
|
2793
|
+
}
|
|
2794
|
+
}
|
|
2795
|
+
};
|
|
2796
|
+
//map of language strings in their actual language representation, initialized in Editor.init
|
|
2797
|
+
Editor._languages = {};
|
|
2798
|
+
|
|
2799
|
+
//theming from parameters to css valiables if css variables are not turned on
|
|
2800
|
+
//find out if css vars are turned on
|
|
2801
|
+
Editor._appendThemeVars = function () {
|
|
2802
|
+
var aVars = [
|
|
2803
|
+
"sapUiButtonHoverBackground",
|
|
2804
|
+
"sapUiBaseBG",
|
|
2805
|
+
"sapUiContentLabelColor",
|
|
2806
|
+
"sapUiTileSeparatorColor",
|
|
2807
|
+
"sapUiHighlight",
|
|
2808
|
+
"sapUiListSelectionBackgroundColor",
|
|
2809
|
+
"sapUiNegativeText",
|
|
2810
|
+
"sapUiCriticalText",
|
|
2811
|
+
"sapUiPositiveText",
|
|
2812
|
+
"sapUiChartScrollbarBorderColor"
|
|
2813
|
+
];
|
|
2814
|
+
var mParams = Parameters.get({
|
|
2815
|
+
name: aVars,
|
|
2816
|
+
callback: function (_params) {
|
|
2817
|
+
// this will only be called if params weren’t available synchronously
|
|
2818
|
+
}
|
|
2819
|
+
});
|
|
2820
|
+
if (mParams) {
|
|
2821
|
+
for (var n in mParams) {
|
|
2822
|
+
document.body.style.setProperty("--" + n, mParams[n]);
|
|
2823
|
+
}
|
|
2824
|
+
}
|
|
2825
|
+
};
|
|
2826
|
+
|
|
2827
|
+
Editor.prototype.prepareFieldsInKey = function(oConfig) {
|
|
2828
|
+
//get field names in the item key
|
|
2829
|
+
this._sKeySeparator = oConfig.values.keySeparator;
|
|
2830
|
+
if (!this._sKeySeparator) {
|
|
2831
|
+
this._sKeySeparator = "#";
|
|
2832
|
+
}
|
|
2833
|
+
var sKey = oConfig.values.item.key;
|
|
2834
|
+
this._aFields = sKey.split(this._sKeySeparator);
|
|
2835
|
+
for (var n in this._aFields) {
|
|
2836
|
+
//remove the {} in the field
|
|
2837
|
+
if (this._aFields[n].startsWith("{")) {
|
|
2838
|
+
this._aFields[n] = this._aFields[n].substring(1);
|
|
2839
|
+
}
|
|
2840
|
+
if (this._aFields[n].endsWith("}")) {
|
|
2841
|
+
this._aFields[n] = this._aFields[n].substring(0, this._aFields[n].length - 1);
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
};
|
|
2845
|
+
|
|
2846
|
+
Editor.prototype.getKeyFromItem = function(oItem) {
|
|
2847
|
+
var sItemKey = "";
|
|
2848
|
+
this._aFields.forEach(function (field) {
|
|
2849
|
+
sItemKey += oItem[field].toString() + this._sKeySeparator;
|
|
2850
|
+
}.bind(this));
|
|
2851
|
+
if (sItemKey.endsWith(this._sKeySeparator)) {
|
|
2852
|
+
sItemKey = sItemKey.substring(0, sItemKey.length - this._sKeySeparator.length);
|
|
2853
|
+
}
|
|
2854
|
+
return sItemKey;
|
|
2855
|
+
};
|
|
2856
|
+
|
|
2857
|
+
//initializes global settings
|
|
2858
|
+
Editor.init = function () {
|
|
2859
|
+
this.init = function () { }; //replace self
|
|
2860
|
+
|
|
2861
|
+
//add theming variables if css vars are not turned on
|
|
2862
|
+
//if (!window.getComputedStyle(document.documentElement).getPropertyValue('--sapBackgroundColor')) {
|
|
2863
|
+
Editor._appendThemeVars();
|
|
2864
|
+
Core.attachThemeChanged(function () {
|
|
2865
|
+
Editor._appendThemeVars();
|
|
2866
|
+
});
|
|
2867
|
+
//}
|
|
2868
|
+
|
|
2869
|
+
var sCssURL = sap.ui.require.toUrl("sap.ui.integration.editor.css.Editor".replace(/\./g, "/") + ".css");
|
|
2870
|
+
includeStylesheet(sCssURL);
|
|
2871
|
+
LoaderExtensions.loadResource("sap/ui/integration/editor/languages.json", {
|
|
2872
|
+
dataType: "json",
|
|
2873
|
+
failOnError: false,
|
|
2874
|
+
async: true
|
|
2875
|
+
}).then(function (o) {
|
|
2876
|
+
Editor._languages = o;
|
|
2877
|
+
});
|
|
2878
|
+
};
|
|
2879
|
+
|
|
2880
|
+
Editor.init();
|
|
2881
|
+
|
|
2882
|
+
return Editor;
|
|
2883
|
+
});
|