@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
|
@@ -5,109 +5,17 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
|
-
"
|
|
9
|
-
"sap/ui/core/Control",
|
|
8
|
+
"sap/ui/integration/editor/Editor",
|
|
10
9
|
"sap/ui/core/Core",
|
|
11
|
-
"sap/
|
|
12
|
-
"sap/base/util/merge",
|
|
13
|
-
"sap/ui/integration/widgets/Card",
|
|
14
|
-
"sap/ui/integration/Designtime",
|
|
15
|
-
"sap/ui/model/json/JSONModel",
|
|
16
|
-
"sap/ui/integration/util/CardMerger",
|
|
17
|
-
"sap/ui/integration/util/Utils",
|
|
18
|
-
"sap/m/Label",
|
|
19
|
-
"sap/m/Title",
|
|
20
|
-
"sap/m/Panel",
|
|
21
|
-
"sap/m/HBox",
|
|
22
|
-
"sap/m/VBox",
|
|
23
|
-
"sap/ui/core/Icon",
|
|
24
|
-
"sap/m/ResponsivePopover",
|
|
25
|
-
"sap/m/Popover",
|
|
26
|
-
"sap/m/Text",
|
|
27
|
-
"sap/base/Log",
|
|
28
|
-
"sap/ui/core/Popup",
|
|
29
|
-
"sap/base/i18n/ResourceBundle",
|
|
30
|
-
"sap/ui/thirdparty/URI",
|
|
31
|
-
"sap/ui/dom/includeStylesheet",
|
|
32
|
-
"sap/base/util/LoaderExtensions",
|
|
33
|
-
"sap/ui/core/theming/Parameters",
|
|
34
|
-
"sap/base/util/ObjectPath",
|
|
35
|
-
"sap/m/FormattedText",
|
|
36
|
-
"sap/m/MessageStrip",
|
|
37
|
-
"sap/m/ToolbarSpacer",
|
|
38
|
-
"sap/base/util/includes"
|
|
10
|
+
"sap/ui/integration/widgets/Card"
|
|
39
11
|
], function (
|
|
40
|
-
|
|
41
|
-
Control,
|
|
12
|
+
Editor,
|
|
42
13
|
Core,
|
|
43
|
-
|
|
44
|
-
merge,
|
|
45
|
-
Card,
|
|
46
|
-
Designtime,
|
|
47
|
-
JSONModel,
|
|
48
|
-
CardMerger,
|
|
49
|
-
Utils,
|
|
50
|
-
Label,
|
|
51
|
-
Title,
|
|
52
|
-
Panel,
|
|
53
|
-
HBox,
|
|
54
|
-
VBox,
|
|
55
|
-
Icon,
|
|
56
|
-
RPopover,
|
|
57
|
-
Popover,
|
|
58
|
-
Text,
|
|
59
|
-
Log,
|
|
60
|
-
Popup,
|
|
61
|
-
ResourceBundle,
|
|
62
|
-
URI,
|
|
63
|
-
includeStylesheet,
|
|
64
|
-
LoaderExtensions,
|
|
65
|
-
Parameters,
|
|
66
|
-
ObjectPath,
|
|
67
|
-
FormattedText,
|
|
68
|
-
MessageStrip,
|
|
69
|
-
Separator,
|
|
70
|
-
includes
|
|
14
|
+
Card
|
|
71
15
|
) {
|
|
72
16
|
"use strict";
|
|
73
17
|
|
|
74
|
-
|
|
75
|
-
//workaround issue of orientation change fired that reapplies position and closes the popup
|
|
76
|
-
//issue is not predictable and depends on host environment. Solution - apply all, simply do not close for position changes.
|
|
77
|
-
var popoverInit = Popover.prototype.init;
|
|
78
|
-
Popover.prototype.init = function () {
|
|
79
|
-
popoverInit.apply(this, arguments);
|
|
80
|
-
var fn = this.oPopup._applyPosition,
|
|
81
|
-
that = this;
|
|
82
|
-
this.oPopup._applyPosition = function () {
|
|
83
|
-
var fnClose = that.close;
|
|
84
|
-
that.close = function () { };
|
|
85
|
-
fn.apply(this, arguments);
|
|
86
|
-
that.close = fnClose;
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
function getHigherZIndex(source) {
|
|
91
|
-
if (source && source.nodeType !== 1) {
|
|
92
|
-
return 0;
|
|
93
|
-
}
|
|
94
|
-
var z = parseInt(window.getComputedStyle(source).getPropertyValue('z-index'));
|
|
95
|
-
if (isNaN(z)) {
|
|
96
|
-
return getHigherZIndex(source.parentNode);
|
|
97
|
-
}
|
|
98
|
-
return z + 1;
|
|
99
|
-
}
|
|
100
|
-
var REGEXP_TRANSLATABLE = /\{\{(?!parameters.)(?!destinations.)([^\}\}]+)\}\}/g,
|
|
101
|
-
CONTEXT_TIMEOUT = 5000,
|
|
102
|
-
oResourceBundle = Core.getLibraryResourceBundle("sap.ui.integration"),
|
|
103
|
-
MessageStripId = "__strip0";
|
|
104
|
-
/* hide multi language function since there has a translation issue in Portal
|
|
105
|
-
aLanguageList = LoaderExtensions.loadResource("sap/ui/integration/designtime/editor/languages.json", {
|
|
106
|
-
dataType: "json",
|
|
107
|
-
failOnError: false,
|
|
108
|
-
async: false
|
|
109
|
-
});*/
|
|
110
|
-
|
|
18
|
+
var oResourceBundle = Core.getLibraryResourceBundle("sap.ui.integration");
|
|
111
19
|
/**
|
|
112
20
|
* Constructor for a new <code>Card Editor</code>.
|
|
113
21
|
*
|
|
@@ -120,7 +28,7 @@ sap.ui.define([
|
|
|
120
28
|
* @extends sap.ui.core.Control
|
|
121
29
|
*
|
|
122
30
|
* @author SAP SE
|
|
123
|
-
* @version 1.
|
|
31
|
+
* @version 1.96.2
|
|
124
32
|
* @constructor
|
|
125
33
|
* @see {@link topic:5b46b03f024542ba802d99d67bc1a3f4 Cards}
|
|
126
34
|
* @since 1.83
|
|
@@ -129,7 +37,7 @@ sap.ui.define([
|
|
|
129
37
|
* @alias sap.ui.integration.designtime.CardEditor
|
|
130
38
|
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
|
|
131
39
|
*/
|
|
132
|
-
var CardEditor =
|
|
40
|
+
var CardEditor = Editor.extend("sap.ui.integration.designtime.editor.CardEditor", /** @lends sap.ui.integration.designtime.editor.CardEditor.prototype */ {
|
|
133
41
|
metadata: {
|
|
134
42
|
library: "sap.ui.integration",
|
|
135
43
|
properties: {
|
|
@@ -146,449 +54,40 @@ sap.ui.define([
|
|
|
146
54
|
card: {
|
|
147
55
|
type: "any",
|
|
148
56
|
defaultValue: null
|
|
149
|
-
},
|
|
150
|
-
/**
|
|
151
|
-
* admin, content, translation
|
|
152
|
-
* Used to control the editors capabilities
|
|
153
|
-
*/
|
|
154
|
-
mode: {
|
|
155
|
-
type: "string",
|
|
156
|
-
defaultValue: "admin"
|
|
157
|
-
},
|
|
158
|
-
language: {
|
|
159
|
-
type: "string",
|
|
160
|
-
defaultValue: ""
|
|
161
|
-
},
|
|
162
|
-
allowDynamicValues: {
|
|
163
|
-
type: "boolean",
|
|
164
|
-
defaultValue: false
|
|
165
|
-
},
|
|
166
|
-
allowSettings: {
|
|
167
|
-
type: "boolean",
|
|
168
|
-
defaultValue: false
|
|
169
|
-
},
|
|
170
|
-
designtime: {
|
|
171
|
-
type: "object"
|
|
172
57
|
}
|
|
173
58
|
},
|
|
174
59
|
aggregations: {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
*/
|
|
178
|
-
_formContent: {
|
|
179
|
-
type: "sap.ui.core.Control",
|
|
180
|
-
multiple: true,
|
|
181
|
-
visibility: "hidden"
|
|
182
|
-
},
|
|
183
|
-
_preview: {
|
|
184
|
-
type: "sap.ui.integration.designtime.editor.CardPreview",
|
|
185
|
-
multiple: false,
|
|
186
|
-
visibility: "hidden"
|
|
187
|
-
},
|
|
188
|
-
_messageStrip: {
|
|
189
|
-
type: "sap.m.MessageStrip",
|
|
60
|
+
_extension: {
|
|
61
|
+
type: "sap.ui.integration.Extension",
|
|
190
62
|
multiple: false,
|
|
191
63
|
visibility: "hidden"
|
|
192
64
|
}
|
|
193
|
-
},
|
|
194
|
-
events: {
|
|
195
|
-
ready: {}
|
|
196
65
|
}
|
|
197
66
|
},
|
|
198
|
-
renderer:
|
|
199
|
-
//surrounding div tag <div class="sapUiIntegrationCardEditor sapUiIntegrationCardEditor(Translation|Preview)"
|
|
200
|
-
oRm.openStart("div");
|
|
201
|
-
oControl.getMode() === "translation" ? oRm.addClass("sapUiIntegrationCardEditorTranslation") : oRm.addClass("sapUiIntegrationCardEditorPreview");
|
|
202
|
-
oRm.addClass("sapUiIntegrationCardEditor");
|
|
203
|
-
oRm.writeClasses();
|
|
204
|
-
oRm.writeElementData(oControl);
|
|
205
|
-
oRm.openEnd();
|
|
206
|
-
if (oControl.isReady()) {
|
|
207
|
-
var oPreview = oControl.getAggregation("_preview");
|
|
208
|
-
var bPreviewNotExist = false;
|
|
209
|
-
if (oPreview && oPreview.getSettings() && oPreview.getSettings().preview && oPreview.getSettings().preview.modes === "None") {
|
|
210
|
-
bPreviewNotExist = true;
|
|
211
|
-
}
|
|
212
|
-
//surrounding div tag for form <div class="sapUiIntegrationCardEditorForm"
|
|
213
|
-
oRm.openStart("div");
|
|
214
|
-
oControl.getMode() === "translation" || bPreviewNotExist ? oRm.addClass("sapUiIntegrationCardEditorFormWithNoPreview") : oRm.addClass("sapUiIntegrationCardEditorForm");
|
|
215
|
-
if (oControl.getMode() !== "translation") {
|
|
216
|
-
oRm.addClass("settingsButtonSpace");
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
oRm.writeClasses();
|
|
220
|
-
oRm.openEnd();
|
|
221
|
-
if (oControl.getMode() !== "translation") {
|
|
222
|
-
oRm.renderControl(oControl.getAggregation("_messageStrip"));
|
|
223
|
-
}
|
|
224
|
-
var aItems = oControl.getAggregation("_formContent");
|
|
225
|
-
//render items
|
|
226
|
-
if (aItems) {
|
|
227
|
-
var oPanel;
|
|
228
|
-
var oLanguagePanel;
|
|
229
|
-
var oLabelItemForNotWrapping;
|
|
230
|
-
var olabelItemForCol;
|
|
231
|
-
var oColFields = [];
|
|
232
|
-
var iColSize = 2;
|
|
233
|
-
var oOriginalField;
|
|
234
|
-
var addColFields = function () {
|
|
235
|
-
if (oColFields.length > 0) {
|
|
236
|
-
var iLess = iColSize - oColFields.length;
|
|
237
|
-
for (var n = 0; n < iLess; n++) {
|
|
238
|
-
oColFields.push(new VBox({
|
|
239
|
-
|
|
240
|
-
}));
|
|
241
|
-
}
|
|
242
|
-
oPanel.addContent(new HBox({
|
|
243
|
-
items: oColFields
|
|
244
|
-
}));
|
|
245
|
-
oColFields = [];
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
for (var i = 0; i < aItems.length; i++) {
|
|
249
|
-
var oItem = aItems[i];
|
|
250
|
-
if (oControl.getMode() !== "translation") {
|
|
251
|
-
if (oItem.isA("sap.m.Panel")) {
|
|
252
|
-
if (oPanel) {
|
|
253
|
-
//add current col fields to previous panel, then empty the col fields list
|
|
254
|
-
addColFields();
|
|
255
|
-
//render previous panel
|
|
256
|
-
if (oPanel.getContent().length > 0) {
|
|
257
|
-
oRm.renderControl(oPanel);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
oPanel = oItem;
|
|
261
|
-
oPanel.addStyleClass("sapUiIntegrationCardEditorItem");
|
|
262
|
-
if (i === aItems.length - 1) {
|
|
263
|
-
//add current col fields to panel, then empty the col fields list
|
|
264
|
-
addColFields();
|
|
265
|
-
if (oPanel.getContent().length > 0) {
|
|
266
|
-
oRm.renderControl(oPanel);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
continue;
|
|
270
|
-
}
|
|
271
|
-
// add style class for the hint under group and checkbox/toggle
|
|
272
|
-
if (oItem.isA("sap.m.FormattedText")) {
|
|
273
|
-
oPanel.addContent(new HBox({
|
|
274
|
-
items: oItem
|
|
275
|
-
}).addStyleClass("sapUiIntegrationCardEditorHint"));
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (oItem.isA("sap.m.Label")) {
|
|
280
|
-
oItem.addStyleClass("sapUiIntegrationCardEditorItemLabel");
|
|
281
|
-
var oDependent = oItem.getDependents() && oItem.getDependents()[0];
|
|
282
|
-
var oLabelWithDependentHBox = new HBox({
|
|
283
|
-
items: [
|
|
284
|
-
oItem.addStyleClass("description")
|
|
285
|
-
]
|
|
286
|
-
});
|
|
287
|
-
if (oDependent) {
|
|
288
|
-
oLabelWithDependentHBox.addItem(oDependent);
|
|
289
|
-
}
|
|
290
|
-
if (oItem._oMessageIcon) {
|
|
291
|
-
oLabelWithDependentHBox.addItem(oItem._oMessageIcon);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
//add the col fields to panel
|
|
295
|
-
if (oItem._cols === 1) {
|
|
296
|
-
//if reach the col size, add the col fields to panel, then empty the col fields list
|
|
297
|
-
if (oColFields.length === iColSize) {
|
|
298
|
-
oPanel.addContent(new HBox({
|
|
299
|
-
items: oColFields
|
|
300
|
-
}));
|
|
301
|
-
oColFields = [];
|
|
302
|
-
}
|
|
303
|
-
olabelItemForCol = oLabelWithDependentHBox.addStyleClass("col1box");
|
|
304
|
-
continue;
|
|
305
|
-
}
|
|
306
|
-
//add current col fields to panel, then empty the col fields list
|
|
307
|
-
addColFields();
|
|
308
|
-
//now only Not wrap the label and field of boolean parameters
|
|
309
|
-
if (oItem._sOriginalType === "boolean") {
|
|
310
|
-
oLabelItemForNotWrapping = oLabelWithDependentHBox.addStyleClass("notWrappingRowLabelBox"); //store the label of boolean and render it together with the next field
|
|
311
|
-
} else {
|
|
312
|
-
oPanel.addContent(oLabelWithDependentHBox);
|
|
313
|
-
}
|
|
314
|
-
} else if (oItem._cols === 1) {
|
|
315
|
-
var oColVBox = new VBox({
|
|
316
|
-
items: [
|
|
317
|
-
olabelItemForCol,
|
|
318
|
-
oItem
|
|
319
|
-
]
|
|
320
|
-
});
|
|
321
|
-
oColVBox.addStyleClass("col1");
|
|
322
|
-
|
|
323
|
-
oColFields.push(oColVBox);
|
|
324
|
-
olabelItemForCol = null;
|
|
325
|
-
} else if (oLabelItemForNotWrapping) {
|
|
326
|
-
//render lable and field for NotWrapping parameter
|
|
327
|
-
oPanel.addContent(new HBox({
|
|
328
|
-
items: [
|
|
329
|
-
oLabelItemForNotWrapping,
|
|
330
|
-
oItem
|
|
331
|
-
]
|
|
332
|
-
}).addStyleClass("notWrappingRow"));
|
|
333
|
-
oLabelItemForNotWrapping = null;
|
|
334
|
-
} else if (oItem.isA("sap.m.ToolbarSpacer")) {
|
|
335
|
-
addColFields();
|
|
336
|
-
if (oItem._hasLine) {
|
|
337
|
-
oItem.addStyleClass("sapUiIntegrationCardEditorSpacerWithLine");
|
|
338
|
-
} else {
|
|
339
|
-
oItem.addStyleClass("sapUiIntegrationCardEditorSpacerWithoutLine");
|
|
340
|
-
}
|
|
341
|
-
oPanel.addContent(oItem);
|
|
342
|
-
} else {
|
|
343
|
-
oPanel.addContent(oItem);
|
|
344
|
-
}
|
|
345
|
-
if (i === aItems.length - 1) {
|
|
346
|
-
//add current col fields to panel, then empty the col fields list
|
|
347
|
-
addColFields();
|
|
348
|
-
if (oPanel.getContent().length > 0) {
|
|
349
|
-
oRm.renderControl(oPanel);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
} else {
|
|
353
|
-
if (i === 0) {
|
|
354
|
-
//render the top panel of translation
|
|
355
|
-
oLanguagePanel = oItem;
|
|
356
|
-
oRm.renderControl(oLanguagePanel);
|
|
357
|
-
oLanguagePanel.addStyleClass("sapUiIntegrationCardEditorTranslationPanel");
|
|
358
|
-
continue;
|
|
359
|
-
}
|
|
360
|
-
if (oItem.isA("sap.m.Panel")) {
|
|
361
|
-
//add sub panel if it has content into top panel
|
|
362
|
-
if (oPanel && oPanel.getContent().length > 0) {
|
|
363
|
-
oLanguagePanel.addContent(oPanel);
|
|
364
|
-
}
|
|
365
|
-
oPanel = oItem;
|
|
366
|
-
oPanel.addStyleClass("sapUiIntegrationCardEditorTranslationSubPanel");
|
|
367
|
-
continue;
|
|
368
|
-
}
|
|
369
|
-
if (oItem.isA("sap.m.ToolbarSpacer")) {
|
|
370
|
-
continue;
|
|
371
|
-
}
|
|
372
|
-
if (oItem.isA("sap.m.FormattedText")) {
|
|
373
|
-
continue;
|
|
374
|
-
}
|
|
375
|
-
if (oItem.isA("sap.m.Label")) {
|
|
376
|
-
oPanel.addContent(oItem);
|
|
377
|
-
continue;
|
|
378
|
-
}
|
|
379
|
-
//oItem.addStyleClass("language");
|
|
380
|
-
if (oItem.isOrigLangField) {
|
|
381
|
-
oOriginalField = oItem;
|
|
382
|
-
continue;
|
|
383
|
-
}
|
|
384
|
-
oOriginalField.addStyleClass("sapUiIntegrationFieldTranslationText");
|
|
385
|
-
//bind originalField and translation field together
|
|
386
|
-
var oHBox = new HBox({
|
|
387
|
-
items: [
|
|
388
|
-
oOriginalField,
|
|
389
|
-
oItem
|
|
390
|
-
]
|
|
391
|
-
}).addStyleClass("notWrappingRow");
|
|
392
|
-
oPanel.addContent(oHBox);
|
|
393
|
-
if (i === aItems.length - 1) {
|
|
394
|
-
oLanguagePanel.addContent(oPanel);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
oRm.close("div");
|
|
400
|
-
//render the preview
|
|
401
|
-
oPreview && oRm.renderControl(oPreview);
|
|
402
|
-
}
|
|
403
|
-
oRm.close("div");
|
|
404
|
-
}
|
|
67
|
+
renderer: Editor.getMetadata().getRenderer().render
|
|
405
68
|
});
|
|
406
|
-
/**
|
|
407
|
-
* Init of the editor
|
|
408
|
-
*/
|
|
409
|
-
CardEditor.prototype.init = function () {
|
|
410
|
-
this._ready = false;
|
|
411
|
-
this._aFieldReadyPromise = [];
|
|
412
|
-
//load translations
|
|
413
|
-
this._oResourceBundle = oResourceBundle;
|
|
414
|
-
this._appliedLayerManifestChanges = [];
|
|
415
|
-
this._currentLayerManifestChanges = {};
|
|
416
|
-
this._mDestinationDataProviders = {};
|
|
417
|
-
this.setAggregation("_messageStrip", new MessageStrip({
|
|
418
|
-
showIcon: false
|
|
419
|
-
}));
|
|
420
|
-
};
|
|
421
|
-
/**
|
|
422
|
-
* Returns whether the editor is ready to be used
|
|
423
|
-
*/
|
|
424
|
-
CardEditor.prototype.isReady = function () {
|
|
425
|
-
return this._ready;
|
|
426
|
-
};
|
|
427
69
|
|
|
428
|
-
function
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
if (!oData[s]) {
|
|
433
|
-
for (var n in oData) {
|
|
434
|
-
flattenData(oData[n], s, a, path + "/" + n);
|
|
435
|
-
}
|
|
436
|
-
} else {
|
|
437
|
-
//found leave
|
|
438
|
-
if (oData.type) {
|
|
439
|
-
a.push({
|
|
440
|
-
path: oData.pathvalue || path.substring(1),
|
|
441
|
-
value: oData.pathvalue || "{context>" + path.substring(1) + "/value}",
|
|
442
|
-
object: oData
|
|
443
|
-
});
|
|
444
|
-
} else {
|
|
445
|
-
a.push({
|
|
446
|
-
path: path.substring(1),
|
|
447
|
-
object: oData
|
|
448
|
-
});
|
|
449
|
-
for (var n in oData) {
|
|
450
|
-
flattenData(oData[n], s, a, path + "/" + n);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
70
|
+
CardEditor.prototype.hasPreview = function() {
|
|
71
|
+
var oPreview = this.getAggregation("_preview");
|
|
72
|
+
if (oPreview && oPreview.getSettings() && oPreview.getSettings().preview && oPreview.getSettings().preview.modes === "None") {
|
|
73
|
+
return false;
|
|
454
74
|
}
|
|
455
|
-
return
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
/**
|
|
459
|
-
* Filters the manifestChanges array in the oManifestSettings
|
|
460
|
-
* All changes that are done for layers > than current layer are removed (see also CardMerger.layers)
|
|
461
|
-
* The current layers changes are stored in this._currentLayerManifestChanges to be applied later in the editor code.
|
|
462
|
-
* All changes that are done for layers < that the current layer are kept in oManifestSettings.manifestChanges
|
|
463
|
-
*
|
|
464
|
-
* @param {*} oManifestSettings
|
|
465
|
-
*/
|
|
466
|
-
CardEditor.prototype._filterManifestChangesByLayer = function (oManifestSettings) {
|
|
467
|
-
var that = this;
|
|
468
|
-
var aChanges = [],
|
|
469
|
-
oCurrentLayerChanges = { ":layer": CardMerger.layers[that.getMode()] },
|
|
470
|
-
iCurrentModeIndex = CardMerger.layers[this.getMode()];
|
|
471
|
-
/* hide multi language function since there has a translation issue in Portal
|
|
472
|
-
var sEditorLanguage = that._language || that.getLanguage() || Core.getConfiguration().getLanguage().replaceAll('-', '_');
|
|
473
|
-
*/
|
|
474
|
-
oManifestSettings.manifestChanges.forEach(function (oChange) {
|
|
475
|
-
//filter manifest changes. only the changes before the current layer are needed
|
|
476
|
-
//card editor will merge the last layer locally to allow "reset" or properties
|
|
477
|
-
//also for translation layer, the "original" value is needed
|
|
478
|
-
var iLayer = oChange.hasOwnProperty(":layer") ? oChange[":layer"] : 1000;
|
|
479
|
-
/* hide multi language function since there has a translation issue in Portal
|
|
480
|
-
//backward compatibility for old changes which not have property "multipleLanguage"
|
|
481
|
-
//replace the value property by valueTranslation property
|
|
482
|
-
if (!oChange.hasOwnProperty(":multipleLanguage")) {
|
|
483
|
-
var oChangeTransfered = {};
|
|
484
|
-
var aKeys = Object.keys(oChange);
|
|
485
|
-
for (var j = 0; j < aKeys.length; j++) {
|
|
486
|
-
if (aKeys[j].endsWith("/value") && typeof oChange[aKeys[j]] === "string") {
|
|
487
|
-
var sValueTranslationsPath = aKeys[j].substring(0, aKeys[j].lastIndexOf("/")) + "/valueTranslations";
|
|
488
|
-
if (!includes(aKeys, sValueTranslationsPath)) {
|
|
489
|
-
var oValueTranslation = {};
|
|
490
|
-
if (iLayer === CardMerger.layers["translation"]) {
|
|
491
|
-
oValueTranslation[sEditorLanguage] = oChange[aKeys[j]];
|
|
492
|
-
} else {
|
|
493
|
-
for (var p in aLanguageList) {
|
|
494
|
-
oValueTranslation[p] = oChange[aKeys[j]];
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
oChangeTransfered[sValueTranslationsPath] = oValueTranslation;
|
|
498
|
-
continue;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
oChangeTransfered[aKeys[j]] = oChange[aKeys[j]];
|
|
502
|
-
}
|
|
503
|
-
oChange = oChangeTransfered;
|
|
504
|
-
}*/
|
|
505
|
-
if (iLayer < iCurrentModeIndex) {
|
|
506
|
-
aChanges.push(oChange);
|
|
507
|
-
} else if (iLayer === iCurrentModeIndex) {
|
|
508
|
-
//store the current layer changes locally for later processing
|
|
509
|
-
oCurrentLayerChanges = oChange;
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
oManifestSettings.manifestChanges = aChanges;
|
|
513
|
-
that._currentLayerManifestChanges = oCurrentLayerChanges;
|
|
75
|
+
return true;
|
|
514
76
|
};
|
|
77
|
+
|
|
515
78
|
/**
|
|
516
79
|
* Sets the card property as a string, object {manifest:{}, baseUrl:{}} or a reference to a card instance
|
|
517
80
|
* @param {any} vCardIdOrSettings
|
|
518
81
|
* @param {boolean} bSuppressRerendering
|
|
519
82
|
*/
|
|
520
83
|
CardEditor.prototype.setCard = function (vCardIdOrSettings, bSuppressRerendering) {
|
|
521
|
-
this._ready = false;
|
|
522
84
|
if (vCardIdOrSettings === this.getProperty("card")) {
|
|
523
85
|
return this;
|
|
524
86
|
}
|
|
525
87
|
if (this._oEditorCard) {
|
|
526
88
|
this._oEditorCard.destroy();
|
|
527
89
|
}
|
|
528
|
-
if (this._oDesigntimeInstance) {
|
|
529
|
-
this._oDesigntimeInstance.destroy();
|
|
530
|
-
}
|
|
531
90
|
this.setProperty("card", vCardIdOrSettings, bSuppressRerendering);
|
|
532
|
-
//Waiting for additional settings on the card that are applied synchronously
|
|
533
|
-
Promise.resolve().then(function () {
|
|
534
|
-
this._initCard(vCardIdOrSettings);
|
|
535
|
-
}.bind(this));
|
|
536
|
-
return this;
|
|
537
|
-
};
|
|
538
|
-
/**
|
|
539
|
-
* Sets the language of the editor
|
|
540
|
-
*
|
|
541
|
-
* @param {string} sValue the language in the format language_region or language-region
|
|
542
|
-
* @param {*} bSuppress suppress rerendering of the editor
|
|
543
|
-
*/
|
|
544
|
-
CardEditor.prototype.setLanguage = function (sValue, bSuppress) {
|
|
545
|
-
//unify the language-region to language_region
|
|
546
|
-
if (!sValue || typeof sValue !== "string") {
|
|
547
|
-
return this;
|
|
548
|
-
}
|
|
549
|
-
this._language = sValue.replace("-", "_");
|
|
550
|
-
if (this.getLanguage() != sValue) {
|
|
551
|
-
//reload resource bundler if language changed
|
|
552
|
-
oResourceBundle = Core.getLibraryResourceBundle("sap.ui.integration");
|
|
553
|
-
this._oResourceBundle = oResourceBundle;
|
|
554
|
-
}
|
|
555
|
-
this.setProperty("language", sValue, bSuppress);
|
|
556
|
-
if (!CardEditor._languages[this._language]) {
|
|
557
|
-
this._language = this._language.split("_")[0];
|
|
558
|
-
}
|
|
559
|
-
if (!CardEditor._languages[this._language]) {
|
|
560
|
-
Log.warning("The language: " + sValue + " is currently unknown, some UI controls might show " + sValue + " instead of the language name.");
|
|
561
|
-
}
|
|
562
|
-
return this;
|
|
563
|
-
};
|
|
564
|
-
/**
|
|
565
|
-
* Increases the zIndex to a higher value for all popups
|
|
566
|
-
*/
|
|
567
|
-
CardEditor.prototype.onAfterRendering = function () {
|
|
568
|
-
if (this.getDomRef()) {
|
|
569
|
-
this._iZIndex = getHigherZIndex(this.getDomRef());
|
|
570
|
-
Popup.setInitialZIndex(this._iZIndex);
|
|
571
|
-
}
|
|
572
|
-
};
|
|
573
|
-
/**
|
|
574
|
-
* Returns the original manifest json without processed parameters, handlebar translation
|
|
575
|
-
*/
|
|
576
|
-
CardEditor.prototype._getOriginalManifestJson = function () {
|
|
577
|
-
try {
|
|
578
|
-
/* hide multi language function since there has a translation issue in Portal
|
|
579
|
-
return this._oEditorCard.getManifestRawJson();
|
|
580
|
-
* remove below line if release multi language function again
|
|
581
|
-
*/
|
|
582
|
-
return this._oEditorCard._oCardManifest._oManifest.getRawJson();
|
|
583
|
-
} catch (ex) {
|
|
584
|
-
return {};
|
|
585
|
-
}
|
|
586
|
-
};
|
|
587
|
-
/**
|
|
588
|
-
* Initializes the editors card settings
|
|
589
|
-
* @param {} vCardIdOrSettings
|
|
590
|
-
*/
|
|
591
|
-
CardEditor.prototype._initCard = function (vCardIdOrSettings) {
|
|
592
91
|
if (typeof vCardIdOrSettings === "string") {
|
|
593
92
|
try {
|
|
594
93
|
vCardIdOrSettings = JSON.parse(vCardIdOrSettings);
|
|
@@ -616,1121 +115,25 @@ sap.ui.define([
|
|
|
616
115
|
};
|
|
617
116
|
}
|
|
618
117
|
if (typeof vCardIdOrSettings === "object") {
|
|
619
|
-
var iCurrentModeIndex = CardMerger.layers[this.getMode()];
|
|
620
|
-
if (vCardIdOrSettings.manifestChanges) {
|
|
621
|
-
//remove the changes from the current layer
|
|
622
|
-
this._filterManifestChangesByLayer(vCardIdOrSettings);
|
|
623
|
-
}
|
|
624
|
-
//create a new card settings for a new card
|
|
625
118
|
this._oEditorCard = new Card(vCardIdOrSettings);
|
|
626
|
-
var that = this;
|
|
627
|
-
this._oEditorCard._prepareToApplyManifestSettings = function () {
|
|
628
|
-
Card.prototype._prepareToApplyManifestSettings.apply(this, arguments);
|
|
629
|
-
if (!that._oEditorCard._isManifestReady) {
|
|
630
|
-
//TODO: manifestReady is fired even if the manifest is not ready. Check why.
|
|
631
|
-
return;
|
|
632
|
-
}
|
|
633
|
-
if (that._manifestModel) {
|
|
634
|
-
//already created
|
|
635
|
-
return;
|
|
636
|
-
}
|
|
637
|
-
that._appliedLayerManifestChanges = vCardIdOrSettings.manifestChanges;
|
|
638
|
-
var oManifestData = that._oEditorCard.getManifestEntry("/");
|
|
639
|
-
var _beforeCurrentLayer = merge({}, oManifestData);
|
|
640
|
-
that._oProviderCard = that._oEditorCard;
|
|
641
|
-
that._oProviderCard._editorManifest = oManifestData;
|
|
642
|
-
that._beforeManifestModel = new JSONModel(_beforeCurrentLayer);
|
|
643
|
-
if (iCurrentModeIndex < CardMerger.layers["translation"] && that._currentLayerManifestChanges) {
|
|
644
|
-
//merge if not translation
|
|
645
|
-
oManifestData = CardMerger.mergeCardDelta(oManifestData, [that._currentLayerManifestChanges]);
|
|
646
|
-
}
|
|
647
|
-
//create a manifest model after the changes are merged
|
|
648
|
-
that._manifestModel = new JSONModel(oManifestData);
|
|
649
|
-
//create a manifest model for the original "raw" manifest that was initially loaded
|
|
650
|
-
|
|
651
|
-
that._originalManifestModel = new JSONModel(that._getOriginalManifestJson());
|
|
652
|
-
that._initInternal();
|
|
653
|
-
//use the translations from the card
|
|
654
|
-
if (!that._oEditorCard.getModel("i18n")) {
|
|
655
|
-
that._oEditorCard._loadDefaultTranslations();
|
|
656
|
-
}
|
|
657
|
-
that.setModel(that._oEditorCard.getModel("i18n"), "i18n");
|
|
658
|
-
//add a context model
|
|
659
|
-
that._createContextModel();
|
|
660
|
-
};
|
|
661
119
|
this._oEditorCard.onBeforeRendering();
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Initializes the editor after the card is set
|
|
666
|
-
*/
|
|
667
|
-
CardEditor.prototype._initInternal = function () {
|
|
668
|
-
//handle keyword designtime removal
|
|
669
|
-
var sDesigntime = this._oEditorCard.getManifestEntry("/sap.card/configuration/editor");
|
|
670
|
-
if (sDesigntime === undefined) {
|
|
671
|
-
sDesigntime = this._oEditorCard.getManifestEntry("/sap.card/designtime");
|
|
672
|
-
}
|
|
673
|
-
//load the designtime control and bundles lazy
|
|
674
|
-
// var sDesigntime = this._oEditorCard.getManifestEntry("/sap.card/designtime"),
|
|
675
|
-
var oConfiguration = this._manifestModel.getProperty("/sap.card/configuration"),
|
|
676
|
-
oPromise,
|
|
677
|
-
oDesigntimeConfig = this.getDesigntime();
|
|
678
|
-
if (oDesigntimeConfig) {
|
|
679
|
-
if (typeof oDesigntimeConfig === "function") {
|
|
680
|
-
oPromise = new Promise(function (resolve, reject) {
|
|
681
|
-
var oDesigntimeInstance = new oDesigntimeConfig();
|
|
682
|
-
this._applyDesigntimeDefaults(oDesigntimeInstance.getSettings());
|
|
683
|
-
resolve(oDesigntimeInstance);
|
|
684
|
-
}.bind(this));
|
|
685
|
-
} else if (typeof oDesigntimeConfig === "object") {
|
|
686
|
-
oPromise = new Promise(function (resolve, reject) {
|
|
687
|
-
sap.ui.require(["sap/ui/integration/Designtime"], function (Designtime) {
|
|
688
|
-
var AdvancedDesigntime = Designtime.extend("test.Designtime");
|
|
689
|
-
AdvancedDesigntime.prototype.create = function () {
|
|
690
|
-
return oDesigntimeConfig;
|
|
691
|
-
};
|
|
692
|
-
var oDesigntime = new AdvancedDesigntime();
|
|
693
|
-
this._applyDesigntimeDefaults(oDesigntime.getSettings());
|
|
694
|
-
resolve(oDesigntime);
|
|
695
|
-
}.bind(this));
|
|
696
|
-
}.bind(this));
|
|
697
|
-
}
|
|
698
|
-
} else if (sDesigntime) {
|
|
699
|
-
//load designtime from module
|
|
700
|
-
oPromise = this._oEditorCard.loadDesigntime().then(function (oDesigntime) {
|
|
701
|
-
this._applyDesigntimeDefaults(oDesigntime.getSettings());
|
|
702
|
-
return oDesigntime;
|
|
120
|
+
this._oEditorCard.attachEventOnce("_cardReady", function () {
|
|
121
|
+
this.setJson(vCardIdOrSettings, bSuppressRerendering);
|
|
703
122
|
}.bind(this));
|
|
704
|
-
} else {
|
|
705
|
-
//stay compatible and create designtime configuration based on parameters/destinations
|
|
706
|
-
oPromise = Promise.resolve(this._createParameterDesigntime(oConfiguration));
|
|
707
|
-
}
|
|
708
|
-
oPromise.then(function (oDesigntime) {
|
|
709
|
-
this._oDesigntimeInstance = oDesigntime;
|
|
710
|
-
if (this.getMode() === "admin" || this.getMode() === "all") {
|
|
711
|
-
//always add destination settings
|
|
712
|
-
this._addDestinationSettings(oConfiguration, this._oDesigntimeInstance);
|
|
713
|
-
}
|
|
714
|
-
//create a settings model
|
|
715
|
-
this._settingsModel = new JSONModel(this._oDesigntimeInstance.getSettings());
|
|
716
|
-
this.setModel(this._settingsModel, "currentSettings");
|
|
717
|
-
this.setModel(this._settingsModel, "items");
|
|
718
|
-
this._oProviderCard.setModel(this._settingsModel, "currentSettings");
|
|
719
|
-
this._oProviderCard.setModel(this._settingsModel, "items");
|
|
720
|
-
this._applyDesigntimeLayers(); //changes done from admin to content on the dt values
|
|
721
|
-
this._requireFields().then(function () {
|
|
722
|
-
this._startEditor();
|
|
723
|
-
}.bind(this));
|
|
724
|
-
}.bind(this));
|
|
725
|
-
};
|
|
726
|
-
/**
|
|
727
|
-
* Returns the current settings as a json with a manifest path and the current value
|
|
728
|
-
* additionally there is a layer number added as ":layer"
|
|
729
|
-
*/
|
|
730
|
-
CardEditor.prototype.getCurrentSettings = function () {
|
|
731
|
-
var oSettings = this._settingsModel.getProperty("/"),
|
|
732
|
-
mResult = {},
|
|
733
|
-
mNext;
|
|
734
|
-
if (oSettings && oSettings.form && oSettings.form.items) {
|
|
735
|
-
for (var n in oSettings.form.items) {
|
|
736
|
-
var oItem = oSettings.form.items[n];
|
|
737
|
-
if (oItem.editable && oItem.visible) {
|
|
738
|
-
/* hide multi language function since there has a translation issue in Portal
|
|
739
|
-
var oValueTranslations;
|
|
740
|
-
var sLanguage = this.getMode() !== "translation" ? Core.getConfiguration().getLanguage().replaceAll('-', '_') : this._language || this.getLanguage();
|
|
741
|
-
*/
|
|
742
|
-
var sValueTranslationsPath = "";
|
|
743
|
-
if (oItem.manifestpath) {
|
|
744
|
-
sValueTranslationsPath = oItem.manifestpath.substring(0, oItem.manifestpath.lastIndexOf("/")) + "/valueTranslations";
|
|
745
|
-
}
|
|
746
|
-
if (this.getMode() !== "translation") {
|
|
747
|
-
if (oItem.translatable && !oItem._changed && oItem._translatedDefaultPlaceholder && !this._currentLayerManifestChanges[oItem.manifestpath] && !this._currentLayerManifestChanges[sValueTranslationsPath]) {
|
|
748
|
-
//do not save a value that was not changed and comes from a translated default value
|
|
749
|
-
//mResult[oItem.manifestpath] = oItem._translatedDefaultPlaceholder;
|
|
750
|
-
//if we would save it
|
|
751
|
-
continue;
|
|
752
|
-
} else {
|
|
753
|
-
/* hide multi language function since there has a translation issue in Portal
|
|
754
|
-
* need to remove below line later if we want release multi language function again
|
|
755
|
-
*/
|
|
756
|
-
mResult[oItem.manifestpath] = oItem.value;
|
|
757
|
-
if (oItem.valueItems) {
|
|
758
|
-
mResult[oItem.manifestpath.substring(0, oItem.manifestpath.lastIndexOf("/")) + "/valueItems"] = oItem.valueItems;
|
|
759
|
-
}
|
|
760
|
-
/* hide multi language function since there has a translation issue in Portal
|
|
761
|
-
//if current parameter is string and translatable, create or merge valueTranslations property of it.
|
|
762
|
-
//set the current change to current language in valueTranslations.
|
|
763
|
-
if (oItem.type === "string" && oItem.translatable) {
|
|
764
|
-
if (!oItem.valueTranslations) {
|
|
765
|
-
oValueTranslations = {};
|
|
766
|
-
} else {
|
|
767
|
-
oValueTranslations = deepClone(oItem.valueTranslations);
|
|
768
|
-
}
|
|
769
|
-
oValueTranslations[sLanguage] = oItem.value;
|
|
770
|
-
oItem.valueTranslations = oValueTranslations;
|
|
771
|
-
mResult[sValueTranslationsPath] = oItem.valueTranslations;
|
|
772
|
-
} else {
|
|
773
|
-
mResult[oItem.manifestpath] = oItem.value;
|
|
774
|
-
}*/
|
|
775
|
-
}
|
|
776
|
-
} else if (oItem.translatable && oItem.value) {
|
|
777
|
-
//in translation mode create an entry if there is a value
|
|
778
|
-
mResult[oItem.manifestpath] = oItem.value;
|
|
779
|
-
}
|
|
780
|
-
if (oItem._next && (this.getAllowSettings())) {
|
|
781
|
-
var bVisibleDefault = typeof (oItem.visibleToUser) === "undefined" ? true : oItem.visibleToUser;
|
|
782
|
-
var bEditableDefault = typeof (oItem.editableToUser) === "undefined" ? true : oItem.editableToUser;
|
|
783
|
-
if (oItem._next.visible === !bVisibleDefault) {
|
|
784
|
-
mNext = mNext || {};
|
|
785
|
-
mNext[oItem._settingspath + "/visible"] = oItem._next.visible;
|
|
786
|
-
}
|
|
787
|
-
if (oItem._next.editable === !bEditableDefault) {
|
|
788
|
-
mNext = mNext || {};
|
|
789
|
-
mNext[oItem._settingspath + "/editable"] = oItem._next.editable;
|
|
790
|
-
}
|
|
791
|
-
if (typeof oItem._next.allowDynamicValues === "boolean" && this.getAllowDynamicValues()) {
|
|
792
|
-
mNext = mNext || {};
|
|
793
|
-
mNext[oItem._settingspath + "/allowDynamicValues"] = oItem._next.allowDynamicValues;
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
//add a property ":multipleLanguage" for backward compatibility of multiple language feature
|
|
800
|
-
if (this.getMode() !== "translation") {
|
|
801
|
-
mResult[":multipleLanguage"] = true;
|
|
802
|
-
}
|
|
803
|
-
mResult[":layer"] = CardMerger.layers[this.getMode()];
|
|
804
|
-
mResult[":errors"] = this.checkCurrentSettings()[":errors"];
|
|
805
|
-
if (mNext) {
|
|
806
|
-
mResult[":designtime"] = mNext;
|
|
807
|
-
}
|
|
808
|
-
return mResult;
|
|
809
|
-
};
|
|
810
|
-
/**
|
|
811
|
-
* Checks for invalid values in the current settings and reports the errors
|
|
812
|
-
* TODO: highlight issues and add states...
|
|
813
|
-
*/
|
|
814
|
-
CardEditor.prototype.checkCurrentSettings = function () {
|
|
815
|
-
var oSettings = this._settingsModel.getProperty("/"),
|
|
816
|
-
mChecks = {};
|
|
817
|
-
if (oSettings && oSettings.form && oSettings.form.items) {
|
|
818
|
-
for (var n in oSettings.form.items) {
|
|
819
|
-
var oItem = oSettings.form.items[n];
|
|
820
|
-
if (oItem.editable) {
|
|
821
|
-
if ((oItem.isValid || oItem.required) && !(this.getMode() === "translation" && oItem.translatable)) {
|
|
822
|
-
if (oItem.isValid) {
|
|
823
|
-
mChecks[oItem.manifestpath] = oItem.isValid(oItem);
|
|
824
|
-
}
|
|
825
|
-
mChecks[oItem.manifestpath] = true;
|
|
826
|
-
var value = oItem.value;
|
|
827
|
-
var sType = oItem.type;
|
|
828
|
-
if (sType === "string" && value === "") {
|
|
829
|
-
mChecks[oItem.manifestpath] = value;
|
|
830
|
-
//inform user of this error
|
|
831
|
-
}
|
|
832
|
-
if ((sType === "date" || sType === "datetime") && isNaN(Date.parse(value))) {
|
|
833
|
-
mChecks[oItem.manifestpath] = value;
|
|
834
|
-
//inform user of this error
|
|
835
|
-
}
|
|
836
|
-
if (sType === "integer") {
|
|
837
|
-
if (isNaN(parseInt(value))) {
|
|
838
|
-
mChecks[oItem.manifestpath] = value;
|
|
839
|
-
//inform user of this error
|
|
840
|
-
} else if (value < oItem.min || value > oItem.max) {
|
|
841
|
-
mChecks[oItem.manifestpath] = value;
|
|
842
|
-
//inform user of this error
|
|
843
|
-
}
|
|
844
|
-
} if (sType === "number") {
|
|
845
|
-
if (isNaN(parseFloat(value))) {
|
|
846
|
-
mChecks[oItem.manifestpath] = value;
|
|
847
|
-
} else if (value < oItem.min || value > oItem.max) {
|
|
848
|
-
mChecks[oItem.manifestpath] = value;
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
mChecks[":layer"] = CardMerger.layers[this.getMode()];
|
|
855
|
-
}
|
|
856
|
-
mChecks[":errors"] = Object.values(mChecks).indexOf(false) > -1;
|
|
857
|
-
return mChecks;
|
|
858
|
-
};
|
|
859
|
-
|
|
860
|
-
/**
|
|
861
|
-
* Creates a model for the context object of the host environment
|
|
862
|
-
*/
|
|
863
|
-
CardEditor.prototype._createContextModel = function () {
|
|
864
|
-
var oHost = this._oEditorCard.getHostInstance(),
|
|
865
|
-
oContextModel = new JSONModel({}),
|
|
866
|
-
oFlatContextModel = new JSONModel([]);
|
|
867
|
-
|
|
868
|
-
//add the models in any case
|
|
869
|
-
this.setModel(oContextModel, "context");
|
|
870
|
-
this.setModel(oFlatContextModel, "contextflat");
|
|
871
|
-
oFlatContextModel._getPathObject = function (sPath) {
|
|
872
|
-
var a = this.getData().filter(function (o) {
|
|
873
|
-
if (o.path === sPath) {
|
|
874
|
-
return true;
|
|
875
|
-
}
|
|
876
|
-
});
|
|
877
|
-
return a.length ? a[0] : null;
|
|
878
|
-
};
|
|
879
|
-
oFlatContextModel._getValueObject = function (sValue) {
|
|
880
|
-
var a = this.getData() || [];
|
|
881
|
-
a = a.filter(function (o) {
|
|
882
|
-
if (o.value === sValue || o.object.value === sValue) {
|
|
883
|
-
return true;
|
|
884
|
-
}
|
|
885
|
-
});
|
|
886
|
-
return a.length ? a[0] : null;
|
|
887
|
-
};
|
|
888
|
-
var oContextDataPromise = new Promise(function (resolve, reject) {
|
|
889
|
-
if (oHost && oHost.getContext) {
|
|
890
|
-
var bResolved = false;
|
|
891
|
-
setTimeout(function () {
|
|
892
|
-
if (bResolved) {
|
|
893
|
-
return;
|
|
894
|
-
}
|
|
895
|
-
Log.error("Card Editor context could not be determined with " + CONTEXT_TIMEOUT + ".");
|
|
896
|
-
bResolved = true;
|
|
897
|
-
resolve({});
|
|
898
|
-
}, CONTEXT_TIMEOUT);
|
|
899
|
-
oHost.getContext().then(function (oContextData) {
|
|
900
|
-
if (bResolved) {
|
|
901
|
-
Log.error("Card Editor context returned after more than " + CONTEXT_TIMEOUT + ". Context is ignored.");
|
|
902
|
-
}
|
|
903
|
-
bResolved = true;
|
|
904
|
-
resolve(oContextData || {});
|
|
905
|
-
});
|
|
906
|
-
} else {
|
|
907
|
-
resolve({});
|
|
908
|
-
}
|
|
909
|
-
});
|
|
910
|
-
|
|
911
|
-
//get the context from the host
|
|
912
|
-
oContextDataPromise.then(function (oContextData) {
|
|
913
|
-
var oData = {};
|
|
914
|
-
//empty entry
|
|
915
|
-
oData["empty"] = CardEditor._contextEntries.empty;
|
|
916
|
-
//custom entries
|
|
917
|
-
for (var n in oContextData) {
|
|
918
|
-
oData[n] = oContextData[n];
|
|
919
|
-
}
|
|
920
|
-
//card internal
|
|
921
|
-
oData["card.internal"] = CardEditor._contextEntries["card.internal"];
|
|
922
|
-
oContextModel.setData(oData);
|
|
923
|
-
oFlatContextModel.setData(flattenData(oData, "label"));
|
|
924
|
-
});
|
|
925
|
-
|
|
926
|
-
//async update of the value via host call
|
|
927
|
-
oContextModel.getProperty = function (sPath, oContext) {
|
|
928
|
-
var sAbsolutePath = this.resolve(sPath, oContext);
|
|
929
|
-
if (sAbsolutePath.endsWith("/value")) {
|
|
930
|
-
this._mValues = this._mValues || {};
|
|
931
|
-
if (this._mValues.hasOwnProperty(sAbsolutePath)) {
|
|
932
|
-
return this._mValues[sAbsolutePath];
|
|
933
|
-
//when should this be invalidated?
|
|
934
|
-
}
|
|
935
|
-
this._mValues[sAbsolutePath] = undefined;
|
|
936
|
-
//ask the host
|
|
937
|
-
oHost.getContextValue(sAbsolutePath.substring(1)).then(function (vValue) {
|
|
938
|
-
this._mValues[sAbsolutePath] = vValue;
|
|
939
|
-
this.checkUpdate();
|
|
940
|
-
}.bind(this));
|
|
941
|
-
return undefined;
|
|
942
|
-
} else {
|
|
943
|
-
//resolve dt data locally
|
|
944
|
-
return JSONModel.prototype.getProperty.apply(this, arguments);
|
|
945
|
-
}
|
|
946
|
-
};
|
|
947
|
-
};
|
|
948
|
-
//map editors for a specific type
|
|
949
|
-
CardEditor.fieldMap = {
|
|
950
|
-
"string": "sap/ui/integration/designtime/editor/fields/StringField",
|
|
951
|
-
"integer": "sap/ui/integration/designtime/editor/fields/IntegerField",
|
|
952
|
-
"number": "sap/ui/integration/designtime/editor/fields/NumberField",
|
|
953
|
-
"boolean": "sap/ui/integration/designtime/editor/fields/BooleanField",
|
|
954
|
-
"date": "sap/ui/integration/designtime/editor/fields/DateField",
|
|
955
|
-
"datetime": "sap/ui/integration/designtime/editor/fields/DateTimeField",
|
|
956
|
-
"string[]": "sap/ui/integration/designtime/editor/fields/ListField",
|
|
957
|
-
"destination": "sap/ui/integration/designtime/editor/fields/DestinationField"
|
|
958
|
-
};
|
|
959
|
-
CardEditor.Fields = null;
|
|
960
|
-
/**
|
|
961
|
-
* Loads all field modules registered in CardEditor.fieldMap and stores the classes in CardEditor.Fields
|
|
962
|
-
*/
|
|
963
|
-
CardEditor.prototype._requireFields = function () {
|
|
964
|
-
if (CardEditor.Fields) {
|
|
965
|
-
return Promise.resolve();
|
|
966
|
-
}
|
|
967
|
-
return new Promise(function (resolve) {
|
|
968
|
-
sap.ui.require(Object.values(CardEditor.fieldMap), function () {
|
|
969
|
-
CardEditor.Fields = {};
|
|
970
|
-
for (var n in CardEditor.fieldMap) {
|
|
971
|
-
CardEditor.Fields[n] = arguments[Object.keys(CardEditor.fieldMap).indexOf(n)];
|
|
972
|
-
}
|
|
973
|
-
resolve();
|
|
974
|
-
});
|
|
975
|
-
});
|
|
976
|
-
};
|
|
977
|
-
/**
|
|
978
|
-
* Creates a label based on the configuration settings
|
|
979
|
-
* @param {} oConfig
|
|
980
|
-
*/
|
|
981
|
-
CardEditor.prototype._createLabel = function (oConfig) {
|
|
982
|
-
var oLabel = new Label({
|
|
983
|
-
text: oConfig.label,
|
|
984
|
-
tooltip: oConfig.tooltip || oConfig.label,
|
|
985
|
-
//mark only fields that are required and editable,
|
|
986
|
-
//otherwise this is confusing because user will not be able to correct it
|
|
987
|
-
required: oConfig.required && oConfig.editable || false,
|
|
988
|
-
visible: oConfig.visible,
|
|
989
|
-
objectBindings: {
|
|
990
|
-
currentSettings: {
|
|
991
|
-
path: "currentSettings>" + oConfig._settingspath
|
|
992
|
-
},
|
|
993
|
-
items: {
|
|
994
|
-
path: "items>/form/items"
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
});
|
|
998
|
-
oLabel._cols = oConfig.cols || 2; //by default 2 cols
|
|
999
|
-
oLabel._sOriginalType = oConfig.type;
|
|
1000
|
-
if (oConfig.description) {
|
|
1001
|
-
var oDescIcon = new Icon({
|
|
1002
|
-
src: "sap-icon://message-information",
|
|
1003
|
-
color: "Marker",
|
|
1004
|
-
size: "12px",
|
|
1005
|
-
useIconTooltip: false,
|
|
1006
|
-
visible: this.getMode() !== "translation"
|
|
1007
|
-
});
|
|
1008
|
-
oDescIcon.addStyleClass("sapUiIntegrationCardEditorDescriptionIcon");
|
|
1009
|
-
oLabel.addDependent(oDescIcon);
|
|
1010
|
-
oLabel._oDescriptionIcon = oDescIcon;
|
|
1011
|
-
oDescIcon.onmouseover = function (oDescIcon) {
|
|
1012
|
-
this._getPopover().getContent()[0].applySettings({ text: oConfig.description });
|
|
1013
|
-
this._getPopover().openBy(oDescIcon);
|
|
1014
|
-
oDescIcon.addDependent(this._getPopover());
|
|
1015
|
-
}.bind(this, oDescIcon);
|
|
1016
|
-
oDescIcon.onmouseout = function (oDescIcon) {
|
|
1017
|
-
this._getPopover().close();
|
|
1018
|
-
oDescIcon.removeDependent(this._getPopover());
|
|
1019
|
-
}.bind(this, oDescIcon);
|
|
1020
|
-
}
|
|
1021
|
-
var oMsgIcon = new Icon({
|
|
1022
|
-
src: "sap-icon://message-information",
|
|
1023
|
-
size: "12px",
|
|
1024
|
-
useIconTooltip: false
|
|
1025
|
-
});
|
|
1026
|
-
oMsgIcon.addStyleClass("sapUiIntegrationCardEditorMessageIcon");
|
|
1027
|
-
oLabel._oMessageIcon = oMsgIcon;
|
|
1028
|
-
return oLabel;
|
|
1029
|
-
};
|
|
1030
|
-
|
|
1031
|
-
CardEditor.prototype._getPopover = function () {
|
|
1032
|
-
if (this._oPopover) {
|
|
1033
|
-
return this._oPopover;
|
|
1034
|
-
}
|
|
1035
|
-
var oText = new Text({
|
|
1036
|
-
text: ""
|
|
1037
|
-
});
|
|
1038
|
-
oText.addStyleClass("sapUiTinyMargin sapUiIntegrationCardEditorDescriptionText");
|
|
1039
|
-
this._oPopover = new RPopover({
|
|
1040
|
-
showHeader: false,
|
|
1041
|
-
content: [oText]
|
|
1042
|
-
});
|
|
1043
|
-
this._oPopover.addStyleClass("sapUiIntegrationCardEditorPopover");
|
|
1044
|
-
return this._oPopover;
|
|
1045
|
-
};
|
|
1046
|
-
|
|
1047
|
-
CardEditor.prototype._updateProviderCard = function (aDependentFields) {
|
|
1048
|
-
if (this._ready) {
|
|
1049
|
-
var oManifestData = this._oProviderCard._editorManifest;
|
|
1050
|
-
|
|
1051
|
-
if (aDependentFields.length === 0) {
|
|
1052
|
-
return;
|
|
1053
|
-
}
|
|
1054
|
-
for (var i = 0; i < aDependentFields.length; i++) {
|
|
1055
|
-
var o = aDependentFields[i];
|
|
1056
|
-
o.config._cancel = true;
|
|
1057
|
-
}
|
|
1058
|
-
delete oManifestData["sap.card"].header;
|
|
1059
|
-
delete oManifestData["sap.card"].content;
|
|
1060
|
-
delete oManifestData["sap.card"].data;
|
|
1061
|
-
oManifestData["sap.card"].type = "List";
|
|
1062
|
-
var oCurrentCard = this._oProviderCard;
|
|
1063
|
-
this._oProviderCard = new Card({
|
|
1064
|
-
manifest: oManifestData,
|
|
1065
|
-
baseUrl: this._getBaseUrl(),
|
|
1066
|
-
host: this._oProviderCard.getHost()
|
|
1067
|
-
});
|
|
1068
|
-
this._oProviderCard.setManifestChanges([this.getCurrentSettings()]);
|
|
1069
|
-
this._oProviderCard._editorManifest = oManifestData;
|
|
1070
|
-
var that = this;
|
|
1071
|
-
this._oProviderCard._fillFiltersModel = function () {
|
|
1072
|
-
if (!that._oProviderCard._oDataProviderFactory) {
|
|
1073
|
-
return;
|
|
1074
|
-
}
|
|
1075
|
-
that._bIgnoreUpdates = true;
|
|
1076
|
-
for (var i = 0; i < aDependentFields.length; i++) {
|
|
1077
|
-
var o = aDependentFields[i];
|
|
1078
|
-
o.config._cancel = false;
|
|
1079
|
-
that._addValueListModel(o.config, o.field, true, 500 * i);
|
|
1080
|
-
}
|
|
1081
|
-
that._bIgnoreUpdates = false;
|
|
1082
|
-
};
|
|
1083
|
-
this._oProviderCard.setVisible(false);
|
|
1084
|
-
this._oProviderCard.setModel(this._settingsModel, "items");
|
|
1085
|
-
this._oProviderCard.setModel(this._settingsModel, "currentSettings");
|
|
1086
|
-
this._oProviderCard.onBeforeRendering();
|
|
1087
|
-
if (oCurrentCard && oCurrentCard !== this._oEditorCard) {
|
|
1088
|
-
oCurrentCard.destroy();
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
};
|
|
1092
|
-
|
|
1093
|
-
/**
|
|
1094
|
-
* Creates a Field based on the configuration settings
|
|
1095
|
-
* @param {*} oConfig
|
|
1096
|
-
*/
|
|
1097
|
-
CardEditor.prototype._createField = function (oConfig) {
|
|
1098
|
-
var oField = new CardEditor.Fields[oConfig.type]({
|
|
1099
|
-
configuration: oConfig,
|
|
1100
|
-
mode: this.getMode(),
|
|
1101
|
-
host: this._oEditorCard.getHostInstance(),
|
|
1102
|
-
objectBindings: {
|
|
1103
|
-
currentSettings: {
|
|
1104
|
-
path: "currentSettings>" + oConfig._settingspath
|
|
1105
|
-
},
|
|
1106
|
-
items: {
|
|
1107
|
-
path: "items>/form/items"
|
|
1108
|
-
}
|
|
1109
|
-
},
|
|
1110
|
-
visible: oConfig.visible
|
|
1111
|
-
});
|
|
1112
|
-
|
|
1113
|
-
this._aFieldReadyPromise.push(oField._readyPromise);
|
|
1114
|
-
//listen to value changes on the settings
|
|
1115
|
-
var oValueBinding = this._settingsModel.bindProperty(oConfig._settingspath + "/value");
|
|
1116
|
-
oValueBinding.attachChange(function () {
|
|
1117
|
-
if (!this._bIgnoreUpdates) {
|
|
1118
|
-
oConfig._changed = true;
|
|
1119
|
-
if (oConfig._dependentFields && oConfig._dependentFields.length > 0) {
|
|
1120
|
-
this._updateProviderCard(oConfig._dependentFields);
|
|
1121
|
-
}
|
|
1122
|
-
this._updatePreview();
|
|
1123
|
-
}
|
|
1124
|
-
}.bind(this));
|
|
1125
|
-
if (oField.isFilterBackend()) {
|
|
1126
|
-
//listen to suggest value changes on the settings if current field support filter backend feature
|
|
1127
|
-
var oSuggestValueBinding = this._settingsModel.bindProperty(oConfig._settingspath + "/suggestValue");
|
|
1128
|
-
oSuggestValueBinding.attachChange(function () {
|
|
1129
|
-
var oConfigTemp = merge({}, oConfig);
|
|
1130
|
-
oConfigTemp._cancel = false;
|
|
1131
|
-
this._addValueListModel(oConfigTemp, oField, true);
|
|
1132
|
-
}.bind(this));
|
|
1133
|
-
}
|
|
1134
|
-
this._addValueListModel(oConfig, oField);
|
|
1135
|
-
oField._cols = oConfig.cols || 2; //by default 2 cols
|
|
1136
|
-
oField._oProviderCard = this._oProviderCard;
|
|
1137
|
-
oField.setAssociation("_messageStrip", this.getAggregation("_messageStrip"));
|
|
1138
|
-
return oField;
|
|
1139
|
-
};
|
|
1140
|
-
|
|
1141
|
-
/**
|
|
1142
|
-
* request data via data provider in RT
|
|
1143
|
-
* @param {object} oConfig
|
|
1144
|
-
* @param {BaseField} oField
|
|
1145
|
-
*/
|
|
1146
|
-
CardEditor.prototype._requestData = function (oConfig, oField) {
|
|
1147
|
-
var oDataProvider = this._oProviderCard._oDataProviderFactory.create(oConfig.values.data);
|
|
1148
|
-
oDataProvider.bindObject({
|
|
1149
|
-
path: "items>/form/items"
|
|
1150
|
-
});
|
|
1151
|
-
oDataProvider.bindObject({
|
|
1152
|
-
path: "currentSettings>" + oConfig._settingspath
|
|
1153
|
-
});
|
|
1154
|
-
var oPromise = oDataProvider.getData();
|
|
1155
|
-
oPromise.then(function (oData) {
|
|
1156
|
-
if (oConfig._cancel) {
|
|
1157
|
-
oConfig._values = [];
|
|
1158
|
-
this._settingsModel.setProperty(oConfig._settingspath + "/_loading", false);
|
|
1159
|
-
return;
|
|
1160
|
-
}
|
|
1161
|
-
//add group property "Selected" to each record for MultiComboBox in ListField
|
|
1162
|
-
//user configration of the field since its value maybe changed
|
|
1163
|
-
var oFieldConfig = oField.getConfiguration();
|
|
1164
|
-
if (oConfig.type === "string[]") {
|
|
1165
|
-
var sPath = oConfig.values.data.path;
|
|
1166
|
-
if (sPath && sPath !== "/") {
|
|
1167
|
-
if (sPath.startsWith("/")) {
|
|
1168
|
-
sPath = sPath.substring(1);
|
|
1169
|
-
}
|
|
1170
|
-
if (sPath.endsWith("/")) {
|
|
1171
|
-
sPath = sPath.substring(0, sPath.length - 1);
|
|
1172
|
-
}
|
|
1173
|
-
var aPath = sPath.split("/");
|
|
1174
|
-
var oResult = ObjectPath.get(aPath, oData);
|
|
1175
|
-
if (Array.isArray(oResult)) {
|
|
1176
|
-
for (var n in oResult) {
|
|
1177
|
-
var sKey = oField.getKeyFromItem(oResult[n]);
|
|
1178
|
-
if (Array.isArray(oFieldConfig.value) && oFieldConfig.value.length > 0 && includes(oFieldConfig.value, sKey)) {
|
|
1179
|
-
oResult[n].Selected = oResourceBundle.getText("CARDEDITOR_ITEM_SELECTED");
|
|
1180
|
-
} else {
|
|
1181
|
-
oResult[n].Selected = oResourceBundle.getText("CARDEDITOR_ITEM_UNSELECTED");
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
ObjectPath.set(aPath, oResult, oData);
|
|
1185
|
-
}
|
|
1186
|
-
} else if (Array.isArray(oData)) {
|
|
1187
|
-
for (var n in oData) {
|
|
1188
|
-
var sKey = oField.getKeyFromItem(oData[n]);
|
|
1189
|
-
if (Array.isArray(oFieldConfig.value) && oFieldConfig.value.length > 0 && includes(oFieldConfig.value, sKey)) {
|
|
1190
|
-
oData[n].Selected = oResourceBundle.getText("CARDEDITOR_ITEM_SELECTED");
|
|
1191
|
-
} else {
|
|
1192
|
-
oData[n].Selected = oResourceBundle.getText("CARDEDITOR_ITEM_UNSELECTED");
|
|
1193
|
-
}
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
oConfig._values = oData;
|
|
1198
|
-
var oValueModel = oField.getModel();
|
|
1199
|
-
oValueModel.setData(oData);
|
|
1200
|
-
oValueModel.checkUpdate(true);
|
|
1201
|
-
oValueModel.firePropertyChange();
|
|
1202
|
-
this._settingsModel.setProperty(oConfig._settingspath + "/_loading", false);
|
|
1203
|
-
oField._hideValueState(true, true);
|
|
1204
|
-
}.bind(this)).catch(function (oError) {
|
|
1205
|
-
this._settingsModel.setProperty(oConfig._settingspath + "/_loading", false);
|
|
1206
|
-
var sError = oResourceBundle.getText("CARDEDITOR_BAD_REQUEST");
|
|
1207
|
-
if (Array.isArray(oError) && oError.length > 0) {
|
|
1208
|
-
sError = oError[0];
|
|
1209
|
-
var jqXHR = oError[1];
|
|
1210
|
-
if (jqXHR) {
|
|
1211
|
-
var oErrorInResponse;
|
|
1212
|
-
if (jqXHR.responseJSON) {
|
|
1213
|
-
oErrorInResponse = jqXHR.responseJSON.error;
|
|
1214
|
-
} else if (jqXHR.responseText) {
|
|
1215
|
-
if (Utils.isJson(jqXHR.responseText)) {
|
|
1216
|
-
oErrorInResponse = JSON.parse(jqXHR.responseText).error;
|
|
1217
|
-
} else {
|
|
1218
|
-
sError = jqXHR.responseText;
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
if (oErrorInResponse) {
|
|
1222
|
-
sError = (oErrorInResponse.code || oErrorInResponse.errorCode || jqXHR.status) + ": " + oErrorInResponse.message;
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
} else if (typeof (oError) === "string") {
|
|
1226
|
-
sError = oError;
|
|
1227
|
-
}
|
|
1228
|
-
var oValueModel = oField.getModel();
|
|
1229
|
-
oValueModel.firePropertyChange();
|
|
1230
|
-
oField._showValueState("error", sError, true);
|
|
1231
|
-
}.bind(this));
|
|
1232
|
-
};
|
|
1233
|
-
|
|
1234
|
-
/**
|
|
1235
|
-
* Creates a unnamed model if a values.data section exists in the configuration
|
|
1236
|
-
* @param {object} oConfig
|
|
1237
|
-
* @param {BaseField} oField
|
|
1238
|
-
*/
|
|
1239
|
-
CardEditor.prototype._addValueListModel = function (oConfig, oField, bIgnore, nTimeout) {
|
|
1240
|
-
if (oConfig.values) {
|
|
1241
|
-
var oValueModel;
|
|
1242
|
-
if (oConfig.values.data) {
|
|
1243
|
-
if (this._oProviderCard && this._oProviderCard._oDataProviderFactory) {
|
|
1244
|
-
oValueModel = oField.getModel();
|
|
1245
|
-
if (!oValueModel) {
|
|
1246
|
-
oValueModel = new JSONModel({});
|
|
1247
|
-
oField.setModel(oValueModel, undefined);
|
|
1248
|
-
}
|
|
1249
|
-
this._settingsModel.setProperty(oConfig._settingspath + "/_loading", true);
|
|
1250
|
-
if (!nTimeout) {
|
|
1251
|
-
this._requestData(oConfig, oField);
|
|
1252
|
-
} else {
|
|
1253
|
-
setTimeout(function() {
|
|
1254
|
-
this._requestData(oConfig, oField);
|
|
1255
|
-
}.bind(this), nTimeout);
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
//we use the binding context to connect the given path from oConfig.values.data.path
|
|
1259
|
-
//with that the result of the data request can be have also other structures.
|
|
1260
|
-
oField.bindObject({
|
|
1261
|
-
path: oConfig.values.data.path || "/"
|
|
1262
|
-
});
|
|
1263
|
-
} else if (this._oProviderCard && this._oProviderCard.getAggregation("_extension")) {
|
|
1264
|
-
//get extension data model of the current card
|
|
1265
|
-
oValueModel = this._oProviderCard.getAggregation("_extension").getModel();
|
|
1266
|
-
//we use the binding context to connect the given path from oConfig.values.path
|
|
1267
|
-
//with that the result of the data request can be have also other structures.
|
|
1268
|
-
oField.bindObject({
|
|
1269
|
-
path: oConfig.values.path || "/"
|
|
1270
|
-
});
|
|
1271
|
-
//in the designtime the item bindings will not use a named model, therefore we add a unnamed model for the field
|
|
1272
|
-
//to carry the values.
|
|
1273
|
-
oField.setModel(oValueModel, undefined);
|
|
1274
|
-
}
|
|
1275
|
-
if (!bIgnore) {
|
|
1276
|
-
var sData = JSON.stringify(oConfig.values.data);
|
|
1277
|
-
if (sData) {
|
|
1278
|
-
var destParamRegExp = /parameters\.([^\}\}]+)|destinations\.([^\}\}]+)|\{items\>[\/?\w+]+\}/g,
|
|
1279
|
-
aResult = sData.match(destParamRegExp);
|
|
1280
|
-
if (aResult) {
|
|
1281
|
-
//add the field to dependency to either the parameter or destination
|
|
1282
|
-
for (var i = 0; i < aResult.length; i++) {
|
|
1283
|
-
var sValueKey = "/value";
|
|
1284
|
-
var sDependentPath = "/sap.card/configuration/";
|
|
1285
|
-
if (aResult[i].indexOf("destinations.") === 0 || aResult[i].indexOf("parameters.") === 0) {
|
|
1286
|
-
if (aResult[i].indexOf("destinations.") === 0) {
|
|
1287
|
-
sValueKey = "/name";
|
|
1288
|
-
}
|
|
1289
|
-
sDependentPath = sDependentPath + aResult[i].replace(".", "/") + sValueKey;
|
|
1290
|
-
} else if (aResult[i].indexOf("{items>") === 0) {
|
|
1291
|
-
sDependentPath = sDependentPath + "parameters/" + aResult[i].slice(7, -1);
|
|
1292
|
-
}
|
|
1293
|
-
var oItem = this._mItemsByPaths[sDependentPath];
|
|
1294
|
-
if (oItem) {
|
|
1295
|
-
//DIGITALWORKPLACE-4802
|
|
1296
|
-
//clone the config since the item may dependent to itself in filter backend feature
|
|
1297
|
-
if (oItem._settingspath === oConfig._settingspath) {
|
|
1298
|
-
oConfig = merge({}, oConfig);
|
|
1299
|
-
}
|
|
1300
|
-
oItem._dependentFields = oItem._dependentFields || [];
|
|
1301
|
-
oItem._dependentFields.push({
|
|
1302
|
-
field: oField,
|
|
1303
|
-
config: oConfig
|
|
1304
|
-
});
|
|
1305
|
-
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
123
|
}
|
|
1312
124
|
};
|
|
1313
|
-
/**
|
|
1314
|
-
* Adds an item to the _formContent aggregation based on the config settings
|
|
1315
|
-
* @param {} oConfig
|
|
1316
|
-
*/
|
|
1317
|
-
CardEditor.prototype._addItem = function (oConfig) {
|
|
1318
|
-
var sMode = this.getMode();
|
|
1319
|
-
//force to turn off features for settings and dynamic values and set the default if not configured
|
|
1320
|
-
if (this.getAllowDynamicValues() === false || !oConfig.allowDynamicValues) {
|
|
1321
|
-
oConfig.allowDynamicValues = false;
|
|
1322
|
-
}
|
|
1323
|
-
if (this.getAllowSettings() === false) {
|
|
1324
|
-
oConfig.allowSettings = false;
|
|
1325
|
-
}
|
|
1326
|
-
oConfig._beforeValue = this._beforeManifestModel.getProperty(oConfig.manifestpath);
|
|
1327
|
-
oConfig.__cols = oConfig.cols || 2;
|
|
1328
125
|
|
|
1329
|
-
//if the item is not visible or translation mode, continue immediately
|
|
1330
|
-
if (oConfig.visible === false || (!oConfig.translatable && sMode === "translation" && oConfig.type !== "group")) {
|
|
1331
|
-
return;
|
|
1332
|
-
}
|
|
1333
|
-
if (oConfig.type === "group") {
|
|
1334
|
-
var oPanel = new Panel({
|
|
1335
|
-
headerText: oConfig.label,
|
|
1336
|
-
visible: oConfig.visible,
|
|
1337
|
-
expandable: oConfig.expandable !== false,
|
|
1338
|
-
expanded: oConfig.expanded !== false,
|
|
1339
|
-
width: "auto",
|
|
1340
|
-
backgroundDesign: "Transparent",
|
|
1341
|
-
objectBindings: {
|
|
1342
|
-
currentSettings: {
|
|
1343
|
-
path: "currentSettings>" + oConfig._settingspath
|
|
1344
|
-
},
|
|
1345
|
-
items: {
|
|
1346
|
-
path: "items>/form/items"
|
|
1347
|
-
}
|
|
1348
|
-
},
|
|
1349
|
-
expand: function (oEvent) {
|
|
1350
|
-
var oControl = oEvent.getSource();
|
|
1351
|
-
if (!oEvent.mParameters.expand && oControl.getParent().getAggregation("_messageStrip") !== null) {
|
|
1352
|
-
MessageStripId = oControl.getParent().getAggregation("_messageStrip").getId();
|
|
1353
|
-
}
|
|
1354
|
-
if (oEvent.mParameters.expand) {
|
|
1355
|
-
var oMessageStrip = Core.byId(MessageStripId);
|
|
1356
|
-
oControl.addContent(oMessageStrip);
|
|
1357
|
-
oControl.focus();
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
});
|
|
1361
|
-
this.addAggregation("_formContent", oPanel);
|
|
1362
|
-
oPanel._cols = oConfig.cols || 2; //by default 2 cols
|
|
1363
|
-
if (oConfig.hint) {
|
|
1364
|
-
this._addHint(oConfig.hint);
|
|
1365
|
-
}
|
|
1366
|
-
return;
|
|
1367
|
-
}
|
|
1368
|
-
if (oConfig.type === "separator") {
|
|
1369
|
-
var oSeparator = new Separator({});
|
|
1370
|
-
this.addAggregation("_formContent", oSeparator);
|
|
1371
|
-
//currently do not publish the line property to customer
|
|
1372
|
-
//oSeparator._hasLine = oConfig.line || false;
|
|
1373
|
-
return;
|
|
1374
|
-
}
|
|
1375
|
-
var oNewLabel = null;
|
|
1376
|
-
if (sMode === "translation") {
|
|
1377
|
-
if ((typeof oConfig.value === "string" && oConfig.value.indexOf("{") === 0) || typeof oConfig.values !== "undefined") {
|
|
1378
|
-
//do not show dynamic values for translation
|
|
1379
|
-
return;
|
|
1380
|
-
}
|
|
1381
|
-
//adding an internal _language object to save the original value for the UI
|
|
1382
|
-
oConfig._language = {
|
|
1383
|
-
value: oConfig.value
|
|
1384
|
-
};
|
|
1385
|
-
|
|
1386
|
-
//force a 2 column layout in the form, remember the original to reset
|
|
1387
|
-
|
|
1388
|
-
oConfig.cols = 1;
|
|
1389
|
-
//delete values property of string field
|
|
1390
|
-
delete oConfig.values;
|
|
1391
|
-
|
|
1392
|
-
//create a configuration clone. map the _settingspath setting to _language, and set it to not editable
|
|
1393
|
-
var origLangField = deepClone(oConfig, 10);
|
|
1394
|
-
origLangField._settingspath += "/_language";
|
|
1395
|
-
origLangField.editable = false;
|
|
1396
|
-
origLangField.required = false;
|
|
1397
|
-
//fix issue SMPADMSH4-3282 about i18n not translated issue in translation mode
|
|
1398
|
-
//if the _beforeValue is in pattern "{i18n>KEY}", do not replace the current value using it.
|
|
1399
|
-
if (typeof (origLangField._beforeValue) !== "undefined" && !(origLangField._beforeValue.startsWith("{i18n>") && origLangField._beforeValue.endsWith("}"))) {
|
|
1400
|
-
origLangField.value = origLangField._beforeValue;
|
|
1401
|
-
}
|
|
1402
|
-
/* hide multi language function since there has a translation issue in Portal
|
|
1403
|
-
//if has valueTransaltions, get value via language setting in core
|
|
1404
|
-
if (origLangField.valueTranslations) {
|
|
1405
|
-
var sLanguage = Core.getConfiguration().getLanguage().replaceAll('-', '_');
|
|
1406
|
-
if (aLanguageList[sLanguage]) {
|
|
1407
|
-
if (origLangField.valueTranslations[sLanguage]) {
|
|
1408
|
-
origLangField.value = origLangField.valueTranslations[sLanguage];
|
|
1409
|
-
}
|
|
1410
|
-
} else if (sLanguage.indexOf("_") > -1) {
|
|
1411
|
-
sLanguage = sLanguage.substring(0, sLanguage.indexOf("_"));
|
|
1412
|
-
if (aLanguageList[sLanguage]) {
|
|
1413
|
-
if (origLangField.valueTranslations[sLanguage]) {
|
|
1414
|
-
origLangField.value = origLangField.valueTranslations[sLanguage];
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
}*/
|
|
1419
|
-
if (!origLangField.value) {
|
|
1420
|
-
//the original language field shows only a text control. If empty we show a dash to avoid empty text.
|
|
1421
|
-
origLangField.value = "-";
|
|
1422
|
-
}
|
|
1423
|
-
var oLabel = this._createLabel(origLangField);
|
|
1424
|
-
this.addAggregation("_formContent",
|
|
1425
|
-
oLabel
|
|
1426
|
-
);
|
|
1427
|
-
var oField = this._createField(origLangField);
|
|
1428
|
-
oField.isOrigLangField = true;
|
|
1429
|
-
this.addAggregation("_formContent", oField);
|
|
1430
|
-
|
|
1431
|
-
oConfig.value = oConfig._translatedDefaultValue || "";
|
|
1432
|
-
//even if a item is not visible or not editable by another layer for translations it should always be editable and visible
|
|
1433
|
-
oConfig.editable = oConfig.visible = oConfig.translatable;
|
|
1434
|
-
//if there are changes for the current layer, read the already translated value from there
|
|
1435
|
-
//now merge these changes for translation into the item configs
|
|
1436
|
-
if (this._currentLayerManifestChanges) {
|
|
1437
|
-
oConfig.value = this._currentLayerManifestChanges[oConfig.manifestpath] || oConfig.value;
|
|
1438
|
-
}
|
|
1439
|
-
//change the label for the translation field
|
|
1440
|
-
oConfig.label = oConfig._translatedLabel || "";
|
|
1441
|
-
oConfig.required = false; //translation is never required
|
|
1442
|
-
//now continue with the default...
|
|
1443
|
-
} else {
|
|
1444
|
-
oNewLabel = this._createLabel(oConfig);
|
|
1445
|
-
this.addAggregation("_formContent",
|
|
1446
|
-
oNewLabel
|
|
1447
|
-
);
|
|
1448
|
-
|
|
1449
|
-
}
|
|
1450
|
-
//default for all modes
|
|
1451
|
-
var oField = this._createField(oConfig);
|
|
1452
|
-
oField.setAssociation("_messageIcon", oNewLabel && oNewLabel._oMessageIcon);
|
|
1453
|
-
this.addAggregation("_formContent",
|
|
1454
|
-
oField
|
|
1455
|
-
);
|
|
1456
|
-
//add hint in the new row for boolean data type.
|
|
1457
|
-
if (oConfig.hint && oConfig.type === "boolean" && (!oConfig.cols || oConfig.cols === 2)) {
|
|
1458
|
-
this._addHint(oConfig.hint);
|
|
1459
|
-
}
|
|
1460
|
-
if (oNewLabel) {
|
|
1461
|
-
oNewLabel._oMessageIcon.onmouseover = function (oField) {
|
|
1462
|
-
oField._showMessage();
|
|
1463
|
-
}.bind(this, oField);
|
|
1464
|
-
oNewLabel._oMessageIcon.onmouseout = function (oField) {
|
|
1465
|
-
oField._hideMessage();
|
|
1466
|
-
}.bind(this, oField);
|
|
1467
|
-
}
|
|
1468
|
-
//reset the cols to original
|
|
1469
|
-
oConfig.cols = oConfig.__cols;
|
|
1470
|
-
delete oConfig.__cols;
|
|
1471
|
-
};
|
|
1472
|
-
|
|
1473
|
-
CardEditor.prototype._addHint = function (sHint) {
|
|
1474
|
-
sHint = sHint.replace(/<a href/g, "<a target='blank' href");
|
|
1475
|
-
var oFormattedText = new FormattedText({
|
|
1476
|
-
htmlText: sHint
|
|
1477
|
-
});
|
|
1478
|
-
this.addAggregation("_formContent", oFormattedText);
|
|
1479
|
-
};
|
|
1480
126
|
/**
|
|
1481
|
-
*
|
|
1482
|
-
*/
|
|
1483
|
-
CardEditor.prototype._getCurrentLanguageSpecificText = function (sKey) {
|
|
1484
|
-
var sLanguage = this._language;
|
|
1485
|
-
if (this._oTranslationBundle) {
|
|
1486
|
-
var sText = this._oTranslationBundle.getText(sKey, [], true);
|
|
1487
|
-
if (sText === undefined) {
|
|
1488
|
-
return "";
|
|
1489
|
-
}
|
|
1490
|
-
return sText;
|
|
1491
|
-
}
|
|
1492
|
-
if (!sLanguage) {
|
|
1493
|
-
return "";
|
|
1494
|
-
}
|
|
1495
|
-
var vI18n = this._oEditorCard.getManifestEntry("/sap.app/i18n");
|
|
1496
|
-
if (!vI18n) {
|
|
1497
|
-
return "";
|
|
1498
|
-
}
|
|
1499
|
-
if (typeof vI18n === "string") {
|
|
1500
|
-
var aFallbacks = [sLanguage];
|
|
1501
|
-
if (sLanguage.indexOf("_") > -1) {
|
|
1502
|
-
aFallbacks.push(sLanguage.substring(0, sLanguage.indexOf("_")));
|
|
1503
|
-
}
|
|
1504
|
-
//add en into fallbacks
|
|
1505
|
-
if (!includes(aFallbacks, "en")) {
|
|
1506
|
-
aFallbacks.push("en");
|
|
1507
|
-
}
|
|
1508
|
-
// load the ResourceBundle relative to the manifest
|
|
1509
|
-
this._oTranslationBundle = ResourceBundle.create({
|
|
1510
|
-
url: this._getBaseUrl() + vI18n,
|
|
1511
|
-
async: false,
|
|
1512
|
-
locale: sLanguage,
|
|
1513
|
-
supportedLocales: aFallbacks,
|
|
1514
|
-
fallbackLocale: "en"
|
|
1515
|
-
});
|
|
1516
|
-
|
|
1517
|
-
return this._getCurrentLanguageSpecificText(sKey);
|
|
1518
|
-
}
|
|
1519
|
-
};
|
|
1520
|
-
|
|
1521
|
-
CardEditor.prototype._getBaseUrl = function () {
|
|
1522
|
-
if (this._oEditorCard && this._oEditorCard.isReady()) {
|
|
1523
|
-
return this._oEditorCard.getBaseUrl() || this.oCardEditor._oEditorCard._oCardManifest.getUrl();
|
|
1524
|
-
} else if (this._oEditorCard) {
|
|
1525
|
-
return this._oEditorCard.getBaseUrl();
|
|
1526
|
-
}
|
|
1527
|
-
return "";
|
|
1528
|
-
};
|
|
1529
|
-
|
|
1530
|
-
/**
|
|
1531
|
-
* Starts the editor, creates the fields and preview
|
|
1532
|
-
*/
|
|
1533
|
-
CardEditor.prototype._startEditor = function () {
|
|
1534
|
-
var oSettings = this._settingsModel.getProperty("/");
|
|
1535
|
-
var aItems;
|
|
1536
|
-
if (oSettings.form && oSettings.form.items) {
|
|
1537
|
-
aItems = oSettings.form.items;
|
|
1538
|
-
//get current language
|
|
1539
|
-
var sLanguage = this._language || this.getLanguage() || Core.getConfiguration().getLanguage().replaceAll('-', '_');
|
|
1540
|
-
if (this.getMode() === "translation") {
|
|
1541
|
-
//add top panel of translation editor
|
|
1542
|
-
this._addItem({
|
|
1543
|
-
type: "group",
|
|
1544
|
-
translatable: true,
|
|
1545
|
-
expandable: false,
|
|
1546
|
-
label: oResourceBundle.getText("CARDEDITOR_ORIGINALLANG") + ": " + CardEditor._languages[sLanguage]
|
|
1547
|
-
});
|
|
1548
|
-
}
|
|
1549
|
-
//add general configuration group
|
|
1550
|
-
var bAddGeneralSettingsPanel = false;
|
|
1551
|
-
for (var m in aItems) {
|
|
1552
|
-
var oItem = aItems[m];
|
|
1553
|
-
if (oItem.type === "group") {
|
|
1554
|
-
break;
|
|
1555
|
-
} else if (oItem.visible) {
|
|
1556
|
-
bAddGeneralSettingsPanel = true;
|
|
1557
|
-
break;
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1560
|
-
if (bAddGeneralSettingsPanel) {
|
|
1561
|
-
//add general settings panel
|
|
1562
|
-
this._addItem({
|
|
1563
|
-
type: "group",
|
|
1564
|
-
translatable: true,
|
|
1565
|
-
label: oResourceBundle.getText("CARDEDITOR_PARAMETERS_GENERALSETTINGS")
|
|
1566
|
-
});
|
|
1567
|
-
}
|
|
1568
|
-
this._mItemsByPaths = {};
|
|
1569
|
-
for (var n in aItems) {
|
|
1570
|
-
var oItem = aItems[n];
|
|
1571
|
-
if (oItem) {
|
|
1572
|
-
//force a label setting, set it to the name of the item
|
|
1573
|
-
oItem.label = oItem.label || n;
|
|
1574
|
-
//what is the current value from the change?
|
|
1575
|
-
/* hide multi language function since there has a translation issue in Portal
|
|
1576
|
-
var sCurrentLayerValue, sValueTranslationsPath, aTranslationLayerValueChanges;
|
|
1577
|
-
* remove below line if release this feature again
|
|
1578
|
-
*/
|
|
1579
|
-
var sCurrentLayerValue;
|
|
1580
|
-
if (oItem.manifestpath) {
|
|
1581
|
-
this._mItemsByPaths[oItem.manifestpath] = oItem;
|
|
1582
|
-
/* hide multi language function since there has a translation issue in Portal
|
|
1583
|
-
sValueTranslationsPath = oItem.manifestpath.substring(0, oItem.manifestpath.lastIndexOf("/")) + "/valueTranslations";
|
|
1584
|
-
if (this.getMode() === "translation") {
|
|
1585
|
-
if (this._currentLayerManifestChanges
|
|
1586
|
-
&& this._currentLayerManifestChanges[sValueTranslationsPath]) {
|
|
1587
|
-
//get valueTranslations from current layer changes if current mode is translation
|
|
1588
|
-
aTranslationLayerValueChanges = this._currentLayerManifestChanges[sValueTranslationsPath];
|
|
1589
|
-
}
|
|
1590
|
-
} else {
|
|
1591
|
-
sCurrentLayerValue = this._currentLayerManifestChanges[oItem.manifestpath];
|
|
1592
|
-
}*/
|
|
1593
|
-
/* hide multi language function since there has a translation issue in Portal
|
|
1594
|
-
* need to remove below line later if release multi language function again
|
|
1595
|
-
*/
|
|
1596
|
-
sCurrentLayerValue = this._currentLayerManifestChanges[oItem.manifestpath];
|
|
1597
|
-
}
|
|
1598
|
-
//if not changed it should be undefined
|
|
1599
|
-
oItem._changed = sCurrentLayerValue !== undefined;
|
|
1600
|
-
|
|
1601
|
-
if (oItem.values) {
|
|
1602
|
-
oItem.translatable = false;
|
|
1603
|
-
}
|
|
1604
|
-
|
|
1605
|
-
//check if the provided value from the parameter or designtime default value is a translated value
|
|
1606
|
-
//restrict this to string types for now
|
|
1607
|
-
if (oItem.type === "string") {
|
|
1608
|
-
/* hide multi language function since there has a translation issue in Portal
|
|
1609
|
-
//get i18n path of the card, and set it to item for initializing CardResourceBundles
|
|
1610
|
-
var vI18n = this._oEditorCard.getManifestEntry("/sap.app/i18n");
|
|
1611
|
-
if (!vI18n) {
|
|
1612
|
-
vI18n = "";
|
|
1613
|
-
}
|
|
1614
|
-
oItem._resourceBundleURL = this._oEditorCard.getBaseUrl() + vI18n;
|
|
1615
|
-
if (oItem.manifestpath) {
|
|
1616
|
-
//merge valueTranslations in current mainfest mode and current layer changes
|
|
1617
|
-
var oValueTranslationsInManifest = this._manifestModel.getProperty(sValueTranslationsPath);
|
|
1618
|
-
oItem.valueTranslations = merge(oValueTranslationsInManifest, aTranslationLayerValueChanges);
|
|
1619
|
-
aTranslationLayerValueChanges = undefined;
|
|
1620
|
-
}*/
|
|
1621
|
-
oItem._translatedDefaultPlaceholder = this._getManifestDefaultValue(oItem.manifestpath);
|
|
1622
|
-
var sTranslationTextKey = null,
|
|
1623
|
-
sPlaceholder = oItem._translatedDefaultPlaceholder;
|
|
1624
|
-
if (sPlaceholder) {
|
|
1625
|
-
//parameter translated value wins over designtime defaultValue
|
|
1626
|
-
if (this._isValueWithHandlebarsTranslation(sPlaceholder)) {
|
|
1627
|
-
sTranslationTextKey = sPlaceholder.substring(2, sPlaceholder.length - 2);
|
|
1628
|
-
} else if (sPlaceholder.startsWith("{i18n>")) {
|
|
1629
|
-
sTranslationTextKey = sPlaceholder.substring(6, sPlaceholder.length - 1);
|
|
1630
|
-
}
|
|
1631
|
-
//only if there is a translation key
|
|
1632
|
-
if (sTranslationTextKey) {
|
|
1633
|
-
//force translatable, even if it was not explicitly set already
|
|
1634
|
-
oItem.translatable = true;
|
|
1635
|
-
oItem._translatedDefaultValue = this.getModel("i18n").getResourceBundle().getText(sTranslationTextKey);
|
|
1636
|
-
if (oItem._changed) {
|
|
1637
|
-
//item was changed, take the current value
|
|
1638
|
-
oItem.value = sCurrentLayerValue;
|
|
1639
|
-
} else {
|
|
1640
|
-
oItem.value = oItem._translatedDefaultValue;
|
|
1641
|
-
}
|
|
1642
|
-
if (oItem.valueTranslations && oItem.valueTranslations[sLanguage]) {
|
|
1643
|
-
oItem.value = oItem.valueTranslations[sLanguage];
|
|
1644
|
-
}
|
|
1645
|
-
if (this.getMode() === "translation") {
|
|
1646
|
-
//if we are in translation mode the default value differs and depends on the language
|
|
1647
|
-
//TODO this does not work in SWZ, the base path is not taken into account...
|
|
1648
|
-
//get the translated default value for the language we want to translate this.getLanguage()
|
|
1649
|
-
oItem._translatedDefaultValue = this._getCurrentLanguageSpecificText(sTranslationTextKey);
|
|
1650
|
-
}
|
|
1651
|
-
} else if (oItem.translatable && this.getMode() === "translation") {
|
|
1652
|
-
//if no translation key which means item defined as string value directly.
|
|
1653
|
-
//set the _translatedDefaultValue with item manifest value or default value.
|
|
1654
|
-
oItem._translatedDefaultValue = oItem._translatedDefaultPlaceholder;
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
if (this.getMode() === "translation") {
|
|
1658
|
-
if (oItem.valueTranslations && oItem.valueTranslations[sLanguage]) {
|
|
1659
|
-
oItem._translatedDefaultValue = oItem.valueTranslations[sLanguage];
|
|
1660
|
-
}
|
|
1661
|
-
if (this._isValueWithHandlebarsTranslation(oItem.label)) {
|
|
1662
|
-
oItem._translatedLabel = this._getCurrentLanguageSpecificText(oItem.label.substring(2, oItem.label.length - 2), true);
|
|
1663
|
-
} else if (oItem.label && oItem.label.startsWith("{i18n>")) {
|
|
1664
|
-
//TODO this does not work in SWZ, the base path is not taken into account...
|
|
1665
|
-
//get the translated default value for the language we want to translate this.getLanguage()
|
|
1666
|
-
oItem._translatedLabel = this._getCurrentLanguageSpecificText(oItem.label.substring(6, oItem.label.length - 1), true);
|
|
1667
|
-
}
|
|
1668
|
-
}
|
|
1669
|
-
} else if (oItem.type === "string[]") {
|
|
1670
|
-
var sValueItemsPath = oItem.manifestpath.substring(0, oItem.manifestpath.lastIndexOf("/")) + "/valueItems";
|
|
1671
|
-
var oValueItems = this._manifestModel.getProperty(sValueItemsPath);
|
|
1672
|
-
if (oValueItems) {
|
|
1673
|
-
oItem.valueItems = oValueItems;
|
|
1674
|
-
}
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
|
-
for (var n in aItems) {
|
|
1682
|
-
var oItem = aItems[n];
|
|
1683
|
-
this._addItem(oItem);
|
|
1684
|
-
}
|
|
1685
|
-
//add preview
|
|
1686
|
-
if (this.getMode() !== "translation") {
|
|
1687
|
-
this._initPreview().then(function () {
|
|
1688
|
-
Promise.all(this._aFieldReadyPromise).then(function () {
|
|
1689
|
-
this._ready = true;
|
|
1690
|
-
this.fireReady();
|
|
1691
|
-
}.bind(this));
|
|
1692
|
-
}.bind(this));
|
|
1693
|
-
} else {
|
|
1694
|
-
Promise.all(this._aFieldReadyPromise).then(function () {
|
|
1695
|
-
this._ready = true;
|
|
1696
|
-
this.fireReady();
|
|
1697
|
-
}.bind(this));
|
|
1698
|
-
}
|
|
1699
|
-
};
|
|
1700
|
-
/**
|
|
1701
|
-
* Destroy the editor and the internal card instance that it created
|
|
1702
|
-
*/
|
|
1703
|
-
CardEditor.prototype.destroy = function () {
|
|
1704
|
-
if (this._oEditorCard) {
|
|
1705
|
-
this._oEditorCard.destroy();
|
|
1706
|
-
}
|
|
1707
|
-
if (this._oPopover) {
|
|
1708
|
-
this._oPopover.destroy();
|
|
1709
|
-
}
|
|
1710
|
-
if (this._oDesigntimeInstance) {
|
|
1711
|
-
this._oDesigntimeInstance.destroy();
|
|
1712
|
-
}
|
|
1713
|
-
var oPreview = this.getAggregation("_preview");
|
|
1714
|
-
if (oPreview) {
|
|
1715
|
-
oPreview.destroy();
|
|
1716
|
-
}
|
|
1717
|
-
var oMessageStrip = Core.byId(MessageStripId);
|
|
1718
|
-
if (oMessageStrip) {
|
|
1719
|
-
oMessageStrip.destroy();
|
|
1720
|
-
}
|
|
1721
|
-
this._manifestModel = null;
|
|
1722
|
-
this._originalManifestModel = null;
|
|
1723
|
-
this._settingsModel = null;
|
|
1724
|
-
Control.prototype.destroy.apply(this, arguments);
|
|
1725
|
-
};
|
|
1726
|
-
/**
|
|
1727
|
-
* Initializes the preview
|
|
127
|
+
* Initializes the additional content
|
|
1728
128
|
*/
|
|
1729
129
|
CardEditor.prototype._initPreview = function () {
|
|
130
|
+
var oSettings = this._oDesigntimeInstance.getSettings() || {};
|
|
131
|
+
oSettings.preview = oSettings.preview || {};
|
|
132
|
+
oSettings.preview.position = this.getPreviewPosition();
|
|
1730
133
|
return new Promise(function (resolve, reject) {
|
|
1731
134
|
sap.ui.require(["sap/ui/integration/designtime/editor/CardPreview"], function (Preview) {
|
|
1732
135
|
var oPreview = new Preview({
|
|
1733
|
-
settings:
|
|
136
|
+
settings: oSettings,
|
|
1734
137
|
card: this._oEditorCard
|
|
1735
138
|
});
|
|
1736
139
|
this.setAggregation("_preview", oPreview);
|
|
@@ -1738,231 +141,26 @@ sap.ui.define([
|
|
|
1738
141
|
}.bind(this));
|
|
1739
142
|
}.bind(this));
|
|
1740
143
|
};
|
|
1741
|
-
/**
|
|
1742
|
-
* updates the preview
|
|
1743
|
-
* TODO: Track changes and call update of the preview
|
|
1744
|
-
*/
|
|
1745
|
-
CardEditor.prototype._updatePreview = function () {
|
|
1746
|
-
var oPreview = this.getAggregation("_preview");
|
|
1747
|
-
if (oPreview) {
|
|
1748
|
-
oPreview.update();
|
|
1749
|
-
}
|
|
1750
|
-
};
|
|
1751
|
-
/**
|
|
1752
|
-
* Applies the defaults for the designtime settings
|
|
1753
|
-
*/
|
|
1754
|
-
CardEditor.prototype._applyDesigntimeDefaults = function (oSettings) {
|
|
1755
|
-
oSettings = oSettings || {};
|
|
1756
|
-
oSettings.form = oSettings.form || {};
|
|
1757
|
-
oSettings.form.items = oSettings.form.items || {};
|
|
1758
|
-
oSettings.preview = oSettings.preview || {
|
|
1759
|
-
modes: "Abstract"
|
|
1760
|
-
};
|
|
1761
|
-
var mItems = oSettings.form.items || oSettings.form.items;
|
|
1762
|
-
for (var n in mItems) {
|
|
1763
|
-
var oItem = mItems[n];
|
|
1764
|
-
if (oItem.manifestpath) {
|
|
1765
|
-
oItem.value = this._manifestModel.getProperty(oItem.manifestpath);
|
|
1766
|
-
}
|
|
1767
|
-
if (oItem.visible === undefined || oItem.visible === null) {
|
|
1768
|
-
oItem.visible = true;
|
|
1769
|
-
}
|
|
1770
|
-
if (oItem.editable === undefined || oItem.editable === null) {
|
|
1771
|
-
oItem.editable = true;
|
|
1772
|
-
}
|
|
1773
|
-
if (this.getMode() !== "admin") {
|
|
1774
|
-
if (oItem.visibleToUser !== undefined) {
|
|
1775
|
-
oItem.visible = oItem.visibleToUser;
|
|
1776
|
-
}
|
|
1777
|
-
if (oItem.editableToUser !== undefined) {
|
|
1778
|
-
oItem.editable = oItem.editableToUser;
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
if (typeof oItem.translatable !== "boolean") {
|
|
1782
|
-
oItem.translatable = false;
|
|
1783
|
-
}
|
|
1784
|
-
if (!oItem.label) {
|
|
1785
|
-
oItem.label = n;
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
if (!oItem.type || oItem.type === "enum") {
|
|
1789
144
|
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
case "boolean": oItem.value = false; break;
|
|
1797
|
-
case "integer":
|
|
1798
|
-
case "number": oItem.value = 0; break;
|
|
1799
|
-
case "string[]": oItem.value = []; break;
|
|
1800
|
-
default: oItem.value = "";
|
|
1801
|
-
}
|
|
1802
|
-
}
|
|
1803
|
-
if (oItem.type === "group") {
|
|
1804
|
-
if (oItem.visible === undefined || oItem.value === null) {
|
|
1805
|
-
oItem.visible = true;
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
oItem._settingspath = "/form/items/" + n;
|
|
1809
|
-
}
|
|
1810
|
-
};
|
|
1811
|
-
/**
|
|
1812
|
-
* Applies previous layer designtime settings that were changed
|
|
1813
|
-
*/
|
|
1814
|
-
CardEditor.prototype._applyDesigntimeLayers = function (oSettings) {
|
|
1815
|
-
//pull current values
|
|
1816
|
-
if (this._appliedLayerManifestChanges && Array.isArray(this._appliedLayerManifestChanges)) {
|
|
1817
|
-
for (var i = 0; i < this._appliedLayerManifestChanges.length; i++) {
|
|
1818
|
-
var oChanges = this._appliedLayerManifestChanges[i][":designtime"];
|
|
1819
|
-
if (oChanges) {
|
|
1820
|
-
var aKeys = Object.keys(oChanges);
|
|
1821
|
-
for (var j = 0; j < aKeys.length; j++) {
|
|
1822
|
-
this._settingsModel.setProperty(aKeys[j], oChanges[aKeys[j]]);
|
|
1823
|
-
}
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
if (this._currentLayerManifestChanges) {
|
|
1828
|
-
var oChanges = this._currentLayerManifestChanges[":designtime"];
|
|
1829
|
-
if (oChanges) {
|
|
1830
|
-
var aKeys = Object.keys(oChanges);
|
|
1831
|
-
for (var j = 0; j < aKeys.length; j++) {
|
|
1832
|
-
//apply the values to a "_next/editable", "_next/visible" entry to the settings.
|
|
1833
|
-
//the current layer needs to be able to change those values
|
|
1834
|
-
var sPath = aKeys[j],
|
|
1835
|
-
sNext = sPath.substring(0, sPath.lastIndexOf("/") + 1) + "_next";
|
|
1836
|
-
if (!this._settingsModel.getProperty(sNext)) {
|
|
1837
|
-
//create a _next entry if it does not exist
|
|
1838
|
-
this._settingsModel.setProperty(sNext, {});
|
|
1839
|
-
}
|
|
1840
|
-
var sNext = sPath.substring(0, sPath.lastIndexOf("/") + 1) + "_next",
|
|
1841
|
-
sProp = sPath.substring(sPath.lastIndexOf("/") + 1);
|
|
1842
|
-
this._settingsModel.setProperty(sNext + "/" + sProp, oChanges[aKeys[j]]);
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
}
|
|
1846
|
-
};
|
|
1847
|
-
/**
|
|
1848
|
-
* Creates a designtime instance based on an configuration section within the manifest.
|
|
1849
|
-
* This is valid if there is no explicit sap.card/designtime module in the manifest itself.
|
|
1850
|
-
*/
|
|
1851
|
-
CardEditor.prototype._createParameterDesigntime = function (oConfiguration) {
|
|
1852
|
-
var oSettings = {},
|
|
1853
|
-
sBasePath = "/sap.card/configuration/parameters/",
|
|
1854
|
-
sMode = this.getMode();
|
|
1855
|
-
if (oConfiguration && oConfiguration.parameters) {
|
|
1856
|
-
oSettings.form = oSettings.form || {};
|
|
1857
|
-
oSettings.form.items = oSettings.form.items || {};
|
|
1858
|
-
var oItems = oSettings.form.items;
|
|
1859
|
-
Object.keys(oConfiguration.parameters).forEach(function (n) {
|
|
1860
|
-
oItems[n] = merge({
|
|
1861
|
-
manifestpath: sBasePath + n + "/value",
|
|
1862
|
-
editable: (sMode !== "translation"),
|
|
1863
|
-
_settingspath: "/form/items/" + n
|
|
1864
|
-
}, oConfiguration.parameters[n]);
|
|
1865
|
-
var oItem = oItems[n];
|
|
1866
|
-
if (!oItem.type) {
|
|
1867
|
-
oItem.type = "string";
|
|
1868
|
-
}
|
|
1869
|
-
if (!oItem.hasOwnProperty("visible")) {
|
|
1870
|
-
oItem.visible = true;
|
|
1871
|
-
}
|
|
1872
|
-
});
|
|
1873
|
-
}
|
|
1874
|
-
return new Designtime(oSettings);
|
|
1875
|
-
};
|
|
1876
|
-
/**
|
|
1877
|
-
* Adds additional settings for destinations section in admin mode
|
|
1878
|
-
* @param {} oConfiguration
|
|
1879
|
-
*/
|
|
1880
|
-
CardEditor.prototype._addDestinationSettings = function (oConfiguration) {
|
|
1881
|
-
var oSettings = this._oDesigntimeInstance.getSettings(),
|
|
1882
|
-
sBasePath = "/sap.card/configuration/destinations/";
|
|
1883
|
-
oSettings.form = oSettings.form || {};
|
|
1884
|
-
oSettings.form.items = oSettings.form.items || {};
|
|
1885
|
-
if (oSettings && oConfiguration && oConfiguration.destinations) {
|
|
1886
|
-
if (!oSettings.form.items["destination.group"]) {
|
|
1887
|
-
//destination section separated by a group header
|
|
1888
|
-
oSettings.form.items["destination.group"] = {
|
|
1889
|
-
label: oResourceBundle.getText("CARDEDITOR_DESTINATIONS") || "Destinations",
|
|
1890
|
-
type: "group",
|
|
1891
|
-
visible: true
|
|
1892
|
-
};
|
|
1893
|
-
}
|
|
1894
|
-
var oItems = oSettings.form.items,
|
|
1895
|
-
oHost = this._oEditorCard.getHostInstance();
|
|
1896
|
-
Object.keys(oConfiguration.destinations).forEach(function (n) {
|
|
1897
|
-
oItems[n + ".destinaton"] = merge({
|
|
1898
|
-
manifestpath: sBasePath + n + "/name", //destination points to name not value
|
|
1899
|
-
visible: true,
|
|
1900
|
-
type: "destination",
|
|
1901
|
-
editable: true,
|
|
1902
|
-
allowDynamicValues: false,
|
|
1903
|
-
allowSettings: false,
|
|
1904
|
-
value: oConfiguration.destinations[n].name,
|
|
1905
|
-
defaultValue: oConfiguration.destinations[n].defaultUrl,
|
|
1906
|
-
_settingspath: "/form/items/" + [n + ".destinaton"],
|
|
1907
|
-
_values: [],
|
|
1908
|
-
_destinationName: n
|
|
1909
|
-
}, oConfiguration.destinations[n]);
|
|
1910
|
-
if (typeof oItems[n + ".destinaton"].label === "undefined") {
|
|
1911
|
-
oItems[n + ".destinaton"].label = n;
|
|
1912
|
-
}
|
|
1913
|
-
if (oHost) {
|
|
1914
|
-
oItems[n + ".destinaton"]._loading = true;
|
|
1915
|
-
}
|
|
1916
|
-
});
|
|
1917
|
-
var getDestinationsDone = false;
|
|
1918
|
-
if (oHost) {
|
|
1919
|
-
this._oEditorCard.getHostInstance().getDestinations().then(function (a) {
|
|
1920
|
-
getDestinationsDone = true;
|
|
1921
|
-
Object.keys(oConfiguration.destinations).forEach(function (n) {
|
|
1922
|
-
oItems[n + ".destinaton"]._values = a;
|
|
1923
|
-
oItems[n + ".destinaton"]._loading = false;
|
|
1924
|
-
this._settingsModel.checkUpdate(true);
|
|
1925
|
-
}.bind(this));
|
|
1926
|
-
}.bind(this)).catch(function () {
|
|
1927
|
-
//Fix DIGITALWORKPLACE-4359, retry once for the timeout issue
|
|
1928
|
-
return this._oEditorCard.getHostInstance().getDestinations();
|
|
1929
|
-
}.bind(this)).then(function (b) {
|
|
1930
|
-
if (getDestinationsDone) {
|
|
1931
|
-
return;
|
|
1932
|
-
}
|
|
1933
|
-
Object.keys(oConfiguration.destinations).forEach(function (n) {
|
|
1934
|
-
oItems[n + ".destinaton"]._values = b;
|
|
1935
|
-
oItems[n + ".destinaton"]._loading = false;
|
|
1936
|
-
this._settingsModel.checkUpdate(true);
|
|
1937
|
-
}.bind(this));
|
|
1938
|
-
}.bind(this)).catch(function (e) {
|
|
1939
|
-
Object.keys(oConfiguration.destinations).forEach(function (n) {
|
|
1940
|
-
oItems[n + ".destinaton"]._loading = false;
|
|
1941
|
-
this._settingsModel.checkUpdate(true);
|
|
1942
|
-
}.bind(this));
|
|
1943
|
-
Log.error("Can not get destinations list from '" + oHost.getId() + "'.");
|
|
1944
|
-
}.bind(this));
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
145
|
+
CardEditor.prototype._loadExtension = function () {
|
|
146
|
+
return new Promise(function (resolve, reject) {
|
|
147
|
+
var oExtension = this._oEditorCard.getAggregation("_extension");
|
|
148
|
+
this.setAggregation("_extension", oExtension); // the framework validates that the subclass extends "sap.ui.integration.Extension"
|
|
149
|
+
resolve();
|
|
150
|
+
}.bind(this));
|
|
1947
151
|
};
|
|
1948
152
|
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
/**
|
|
1957
|
-
* Returns whether the value is translatable via the handlbars translation syntax {{KEY}}
|
|
1958
|
-
* For other than string values false is returned
|
|
1959
|
-
* @param {any} vValue
|
|
1960
|
-
*/
|
|
1961
|
-
CardEditor.prototype._isValueWithHandlebarsTranslation = function (vValue) {
|
|
1962
|
-
if (typeof vValue === "string") {
|
|
1963
|
-
return !!vValue.match(REGEXP_TRANSLATABLE);
|
|
153
|
+
CardEditor.prototype._mergeContextData = function (oContextData) {
|
|
154
|
+
var oData = {};
|
|
155
|
+
//empty entry
|
|
156
|
+
oData["empty"] = CardEditor._contextEntries.empty;
|
|
157
|
+
//custom entries
|
|
158
|
+
for (var n in oContextData) {
|
|
159
|
+
oData[n] = oContextData[n];
|
|
1964
160
|
}
|
|
1965
|
-
|
|
161
|
+
//editor internal
|
|
162
|
+
oData["card.internal"] = CardEditor._contextEntries["card.internal"];
|
|
163
|
+
return oData;
|
|
1966
164
|
};
|
|
1967
165
|
|
|
1968
166
|
//create static context entries
|
|
@@ -2006,69 +204,6 @@ sap.ui.define([
|
|
|
2006
204
|
}
|
|
2007
205
|
}
|
|
2008
206
|
};
|
|
2009
|
-
//map of language strings in their actual language representation, initialized in CardEditor.init
|
|
2010
|
-
CardEditor._languages = {};
|
|
2011
|
-
|
|
2012
|
-
//theming from parameters to css valiables if css variables are not turned on
|
|
2013
|
-
//find out if css vars are turned on
|
|
2014
|
-
CardEditor._appendThemeVars = function () {
|
|
2015
|
-
var oOldElement = document.getElementById("sap-ui-integration-editor-style");
|
|
2016
|
-
if (oOldElement && oOldElement.parentNode) {
|
|
2017
|
-
oOldElement.parentNode.removeChild(oOldElement);
|
|
2018
|
-
}
|
|
2019
|
-
var aVars = [
|
|
2020
|
-
"sapUiButtonHoverBackground",
|
|
2021
|
-
"sapUiBaseBG",
|
|
2022
|
-
"sapUiContentLabelColor",
|
|
2023
|
-
"sapUiTileSeparatorColor",
|
|
2024
|
-
"sapUiHighlight",
|
|
2025
|
-
"sapUiListSelectionBackgroundColor",
|
|
2026
|
-
"sapUiNegativeText",
|
|
2027
|
-
"sapUiCriticalText",
|
|
2028
|
-
"sapUiPositiveText",
|
|
2029
|
-
"sapUiChartScrollbarBorderColor"
|
|
2030
|
-
];
|
|
2031
|
-
var mParams = Parameters.get({
|
|
2032
|
-
name: aVars,
|
|
2033
|
-
callback: function (_params) {
|
|
2034
|
-
// this will only be called if params weren’t available synchronously
|
|
2035
|
-
}
|
|
2036
|
-
});
|
|
2037
|
-
if (mParams) {
|
|
2038
|
-
var aResult = [],
|
|
2039
|
-
oStyle = document.createElement("style");
|
|
2040
|
-
oStyle.setAttribute("id", "sap-ui-integration-editor-style");
|
|
2041
|
-
for (var n in mParams) {
|
|
2042
|
-
aResult.push("--" + n + ":" + mParams[n]);
|
|
2043
|
-
}
|
|
2044
|
-
oStyle.innerHTML = ".sapUiIntegrationCardEditor, .sapUiIntegrationFieldSettings, .sapUiIntegrationIconSelectList {" + aResult.join(";") + "}";
|
|
2045
|
-
document.body.appendChild(oStyle);
|
|
2046
|
-
}
|
|
2047
|
-
};
|
|
2048
|
-
|
|
2049
|
-
//initializes global settings
|
|
2050
|
-
CardEditor.init = function () {
|
|
2051
|
-
this.init = function () { }; //replace self
|
|
2052
|
-
|
|
2053
|
-
//add theming variables if css vars are not turned on
|
|
2054
|
-
//if (!window.getComputedStyle(document.documentElement).getPropertyValue('--sapBackgroundColor')) {
|
|
2055
|
-
CardEditor._appendThemeVars();
|
|
2056
|
-
Core.attachThemeChanged(function () {
|
|
2057
|
-
CardEditor._appendThemeVars();
|
|
2058
|
-
});
|
|
2059
|
-
//}
|
|
2060
|
-
|
|
2061
|
-
var sCssURL = sap.ui.require.toUrl("sap.ui.integration.designtime.editor.css.CardEditor".replace(/\./g, "/") + ".css");
|
|
2062
|
-
includeStylesheet(sCssURL);
|
|
2063
|
-
LoaderExtensions.loadResource("sap/ui/integration/designtime/editor/languages.json", {
|
|
2064
|
-
dataType: "json",
|
|
2065
|
-
failOnError: false,
|
|
2066
|
-
async: true
|
|
2067
|
-
}).then(function (o) {
|
|
2068
|
-
CardEditor._languages = o;
|
|
2069
|
-
});
|
|
2070
|
-
};
|
|
2071
|
-
CardEditor.init();
|
|
2072
207
|
|
|
2073
208
|
return CardEditor;
|
|
2074
209
|
});
|