@wavemaker/app-rn-runtime 12.0.0-next.141165 → 12.0.0-next.141174
Sign up to get free protection for your applications and to get access to all the features.
- app-rn-runtime/components/basic/lottie/lottie.component.js +3 -1
- app-rn-runtime/components/basic/lottie/lottie.component.js.map +1 -1
- app-rn-runtime/components/container/tabs/tabpane/tabpane.component.js +3 -1
- app-rn-runtime/components/container/tabs/tabpane/tabpane.component.js.map +1 -1
- app-rn-runtime/components/container/tabs/tabpane/tabpane.props.js +1 -0
- app-rn-runtime/components/container/tabs/tabpane/tabpane.props.js.map +1 -1
- app-rn-runtime/components/container/tabs/tabs.component.js +3 -1
- app-rn-runtime/components/container/tabs/tabs.component.js.map +1 -1
- app-rn-runtime/components/container/tile/tile.component.js +5 -1
- app-rn-runtime/components/container/tile/tile.component.js.map +1 -1
- app-rn-runtime/components/input/baseinput/baseinput.component.js +8 -1
- app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
- app-rn-runtime/components/input/basenumber/basenumber.component.js +9 -1
- app-rn-runtime/components/input/basenumber/basenumber.component.js.map +1 -1
- app-rn-runtime/components/input/checkboxset/checkboxset.component.js +1 -1
- app-rn-runtime/components/input/checkboxset/checkboxset.component.js.map +1 -1
- app-rn-runtime/components/input/checkboxset/checkboxset.styles.js +1 -0
- app-rn-runtime/components/input/checkboxset/checkboxset.styles.js.map +1 -1
- app-rn-runtime/components/input/currency/currency.component.js +2 -1
- app-rn-runtime/components/input/currency/currency.component.js.map +1 -1
- app-rn-runtime/components/input/currency/currency.styles.js +3 -0
- app-rn-runtime/components/input/currency/currency.styles.js.map +1 -1
- app-rn-runtime/components/input/number/number.component.js +2 -1
- app-rn-runtime/components/input/number/number.component.js.map +1 -1
- app-rn-runtime/components/input/number/number.styles.js +3 -0
- app-rn-runtime/components/input/number/number.styles.js.map +1 -1
- app-rn-runtime/components/input/radioset/radioset.component.js +1 -1
- app-rn-runtime/components/input/radioset/radioset.component.js.map +1 -1
- app-rn-runtime/components/input/radioset/radioset.styles.js +1 -0
- app-rn-runtime/components/input/radioset/radioset.styles.js.map +1 -1
- app-rn-runtime/components/input/text/text.component.js +2 -1
- app-rn-runtime/components/input/text/text.component.js.map +1 -1
- app-rn-runtime/components/input/text/text.styles.js +3 -0
- app-rn-runtime/components/input/text/text.styles.js.map +1 -1
- app-rn-runtime/components/input/textarea/textarea.component.js +2 -1
- app-rn-runtime/components/input/textarea/textarea.component.js.map +1 -1
- app-rn-runtime/components/input/textarea/textarea.styles.js +3 -0
- app-rn-runtime/components/input/textarea/textarea.styles.js.map +1 -1
- app-rn-runtime/core/components/textinput.component.js +2 -5
- app-rn-runtime/core/components/textinput.component.js.map +1 -1
- app-rn-runtime/core/props.provider.js +0 -1
- app-rn-runtime/core/props.provider.js.map +1 -1
- app-rn-runtime/core/tappable.component.js +10 -4
- app-rn-runtime/core/tappable.component.js.map +1 -1
- app-rn-runtime/package.json +3 -3
- app-rn-runtime/runtime/base-partial.component.js +3 -0
- app-rn-runtime/runtime/base-partial.component.js.map +1 -1
- app-rn-runtime/runtime/services/app-security.service.js +9 -2
- app-rn-runtime/runtime/services/app-security.service.js.map +1 -1
- app-rn-runtime/styles/theme.variables.js +1 -1
- app-rn-runtime/styles/theme.variables.js.map +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","padding","borderWidth","borderStyle","borderColor","inputBorderColor","backgroundColor","inputBackgroundColor","borderRadius","fontFamily","baseFont","minHeight","text","fontSize","textAlignVertical","floatingLabel","activeFloatingLabel","invalid","borderBottomColor","placeholderText","color","inputPlaceholderColor","skeleton","width","height","inputDisabledBgColor","textAlign","paddingTop","position","top","left","floatingLabelColor","activeFloatingLabelColor"],"sources":["textarea.styles.ts"],"sourcesContent":["import BASE_THEME, { AllStyle } from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { WmSkeletonStyles } from '@wavemaker/app-rn-runtime/components/basic/skeleton/skeleton.styles';\n\nexport type WmTextareaStyles = BaseStyles & {\n invalid: AllStyle;\n placeholderText: AllStyle;\n floatingLabel: AllStyle;\n activeFloatingLabel: AllStyle;\n skeleton: WmSkeletonStyles;\n};\n\nexport const DEFAULT_CLASS = 'app-textarea';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: WmTextareaStyles = defineStyles({\n root: {\n padding:12,\n borderWidth:1,\n borderStyle: 'solid',\n borderColor: themeVariables.inputBorderColor,\n backgroundColor: themeVariables.inputBackgroundColor,\n borderRadius: 6,\n fontFamily: themeVariables.baseFont,\n minHeight: 160,\n },\n text: {\n fontSize: 16,\n textAlignVertical: 'top'\n },\n floatingLabel: {},\n activeFloatingLabel: {},\n invalid: {\n borderBottomColor: 'red'\n },\n placeholderText: {\n color: themeVariables.inputPlaceholderColor\n },\n skeleton: {\n root: {\n width: '100%',\n height: 84,\n borderRadius: 4\n }\n } as any as WmSkeletonStyles\n });\n\n addStyle(DEFAULT_CLASS, '', defaultStyles);\n addStyle(DEFAULT_CLASS + '-disabled', '', {\n root : {\n backgroundColor: themeVariables.inputDisabledBgColor\n }\n });\n addStyle(DEFAULT_CLASS + '-rtl', '', {\n root:{\n textAlign: 'right'\n }\n })\n addStyle(DEFAULT_CLASS + '-with-label', '', {\n text:{\n paddingTop: 24\n },\n floatingLabel: {\n position: 'absolute',\n top: 12,\n left: 16,\n fontSize: 14,\n color: themeVariables.floatingLabelColor\n },\n activeFloatingLabel: {\n color: themeVariables.activeFloatingLabelColor\n }\n })\n});"],"mappings":"AAAA,OAAOA,UAAU,MAAoB,wCAAwC;AAC7E,SAAqBC,YAAY,QAAQ,+CAA+C;
|
1
|
+
{"version":3,"names":["BASE_THEME","defineStyles","DEFAULT_CLASS","registerStyle","themeVariables","addStyle","defaultStyles","root","padding","borderWidth","borderStyle","borderColor","inputBorderColor","backgroundColor","inputBackgroundColor","borderRadius","fontFamily","baseFont","minHeight","text","fontSize","textAlignVertical","floatingLabel","activeFloatingLabel","invalid","borderBottomColor","focused","inputFocusBorderColor","placeholderText","color","inputPlaceholderColor","skeleton","width","height","inputDisabledBgColor","textAlign","paddingTop","position","top","left","floatingLabelColor","activeFloatingLabelColor"],"sources":["textarea.styles.ts"],"sourcesContent":["import BASE_THEME, { AllStyle } from '@wavemaker/app-rn-runtime/styles/theme';\nimport { BaseStyles, defineStyles } from '@wavemaker/app-rn-runtime/core/base.component';\nimport { WmSkeletonStyles } from '@wavemaker/app-rn-runtime/components/basic/skeleton/skeleton.styles';\n\nexport type WmTextareaStyles = BaseStyles & {\n invalid: AllStyle;\n focused: AllStyle;\n placeholderText: AllStyle;\n floatingLabel: AllStyle;\n activeFloatingLabel: AllStyle;\n skeleton: WmSkeletonStyles;\n};\n\nexport const DEFAULT_CLASS = 'app-textarea';\nBASE_THEME.registerStyle((themeVariables, addStyle) => {\n const defaultStyles: WmTextareaStyles = defineStyles({\n root: {\n padding:12,\n borderWidth:1,\n borderStyle: 'solid',\n borderColor: themeVariables.inputBorderColor,\n backgroundColor: themeVariables.inputBackgroundColor,\n borderRadius: 6,\n fontFamily: themeVariables.baseFont,\n minHeight: 160,\n },\n text: {\n fontSize: 16,\n textAlignVertical: 'top'\n },\n floatingLabel: {},\n activeFloatingLabel: {},\n invalid: {\n borderBottomColor: 'red'\n },\n focused : {\n borderColor: themeVariables.inputFocusBorderColor,\n },\n placeholderText: {\n color: themeVariables.inputPlaceholderColor\n },\n skeleton: {\n root: {\n width: '100%',\n height: 84,\n borderRadius: 4\n }\n } as any as WmSkeletonStyles\n });\n\n addStyle(DEFAULT_CLASS, '', defaultStyles);\n addStyle(DEFAULT_CLASS + '-disabled', '', {\n root : {\n backgroundColor: themeVariables.inputDisabledBgColor\n }\n });\n addStyle(DEFAULT_CLASS + '-rtl', '', {\n root:{\n textAlign: 'right'\n }\n })\n addStyle(DEFAULT_CLASS + '-with-label', '', {\n text:{\n paddingTop: 24\n },\n floatingLabel: {\n position: 'absolute',\n top: 12,\n left: 16,\n fontSize: 14,\n color: themeVariables.floatingLabelColor\n },\n activeFloatingLabel: {\n color: themeVariables.activeFloatingLabelColor\n }\n })\n});"],"mappings":"AAAA,OAAOA,UAAU,MAAoB,wCAAwC;AAC7E,SAAqBC,YAAY,QAAQ,+CAA+C;AAYxF,OAAO,MAAMC,aAAa,GAAG,cAAc;AAC3CF,UAAU,CAACG,aAAa,CAAC,CAACC,cAAc,EAAEC,QAAQ,KAAK;EACrD,MAAMC,aAA+B,GAAGL,YAAY,CAAC;IACjDM,IAAI,EAAE;MACJC,OAAO,EAAC,EAAE;MACVC,WAAW,EAAC,CAAC;MACbC,WAAW,EAAE,OAAO;MACpBC,WAAW,EAAEP,cAAc,CAACQ,gBAAgB;MAC5CC,eAAe,EAAET,cAAc,CAACU,oBAAoB;MACpDC,YAAY,EAAE,CAAC;MACfC,UAAU,EAAEZ,cAAc,CAACa,QAAQ;MACnCC,SAAS,EAAE;IACb,CAAC;IACDC,IAAI,EAAE;MACJC,QAAQ,EAAE,EAAE;MACZC,iBAAiB,EAAE;IACrB,CAAC;IACDC,aAAa,EAAE,CAAC,CAAC;IACjBC,mBAAmB,EAAE,CAAC,CAAC;IACvBC,OAAO,EAAE;MACPC,iBAAiB,EAAE;IACrB,CAAC;IACDC,OAAO,EAAG;MACRf,WAAW,EAAEP,cAAc,CAACuB;IAC9B,CAAC;IACDC,eAAe,EAAE;MACfC,KAAK,EAAEzB,cAAc,CAAC0B;IACxB,CAAC;IACDC,QAAQ,EAAE;MACRxB,IAAI,EAAE;QACJyB,KAAK,EAAE,MAAM;QACbC,MAAM,EAAE,EAAE;QACVlB,YAAY,EAAE;MAChB;IACF;EACJ,CAAC,CAAC;EAEFV,QAAQ,CAACH,aAAa,EAAE,EAAE,EAAEI,aAAa,CAAC;EAC1CD,QAAQ,CAACH,aAAa,GAAG,WAAW,EAAE,EAAE,EAAE;IACtCK,IAAI,EAAG;MACLM,eAAe,EAAET,cAAc,CAAC8B;IAClC;EACJ,CAAC,CAAC;EACF7B,QAAQ,CAACH,aAAa,GAAG,MAAM,EAAE,EAAE,EAAE;IACnCK,IAAI,EAAC;MACH4B,SAAS,EAAE;IACb;EACF,CAAC,CAAC;EACF9B,QAAQ,CAACH,aAAa,GAAG,aAAa,EAAE,EAAE,EAAE;IAC1CiB,IAAI,EAAC;MACHiB,UAAU,EAAE;IACd,CAAC;IACDd,aAAa,EAAE;MACbe,QAAQ,EAAE,UAAU;MACpBC,GAAG,EAAE,EAAE;MACPC,IAAI,EAAE,EAAE;MACRnB,QAAQ,EAAE,EAAE;MACZS,KAAK,EAAEzB,cAAc,CAACoC;IACxB,CAAC;IACDjB,mBAAmB,EAAE;MACnBM,KAAK,EAAEzB,cAAc,CAACqC;IACxB;EACF,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
@@ -36,7 +36,6 @@ const WmCursor = /*#__PURE__*/React.memo(props => {
|
|
36
36
|
export const WMTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
|
37
37
|
var _props$customDisplayV, _props$floatingLabel;
|
38
38
|
const [selectRange, setSelectRange] = useState(null);
|
39
|
-
const [isInputFocused, setIsInputFocused] = useState(false);
|
40
39
|
const [iMask, setIMask] = useState(null);
|
41
40
|
const [displayCursor, setDisplayCursor] = useState(false);
|
42
41
|
const value = useRef(props.value || '');
|
@@ -128,11 +127,11 @@ export const WMTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
128
127
|
const textStyle = Object.assign({}, ...(isArray(props.style) ? props.style : [props.style]));
|
129
128
|
const hideInput = props.displayformat || props.maskchar;
|
130
129
|
return /*#__PURE__*/React.createElement(React.Fragment, null, props.floatingLabel ? /*#__PURE__*/React.createElement(FloatingLabel, {
|
131
|
-
moveUp: !!(value.current || isInputFocused || displayValue),
|
130
|
+
moveUp: !!(value.current || props.isInputFocused || displayValue),
|
132
131
|
label: (_props$floatingLabel = props.floatingLabel) !== null && _props$floatingLabel !== void 0 ? _props$floatingLabel : props.placeholder,
|
133
132
|
style: {
|
134
133
|
...(props.floatingLabelStyle || []),
|
135
|
-
...(isInputFocused ? props.activeFloatingLabelStyle || {} : {})
|
134
|
+
...(props.isInputFocused ? props.activeFloatingLabelStyle || {} : {})
|
136
135
|
}
|
137
136
|
}) : null, /*#__PURE__*/React.createElement(TextInput, _extends({}, props, hideInput || props.customDisplayValue ? opts : {}, {
|
138
137
|
placeholder: props.floatingLabel || displayValue ? '' : props.placeholder,
|
@@ -145,14 +144,12 @@ export const WMTextInput = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
145
144
|
onFocus: e => {
|
146
145
|
var _props$onFocus;
|
147
146
|
(_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 || _props$onFocus.call(props, e);
|
148
|
-
setIsInputFocused(true);
|
149
147
|
setDisplayCursor(true);
|
150
148
|
element.current = e.target;
|
151
149
|
},
|
152
150
|
onBlur: e => {
|
153
151
|
var _props$onBlur;
|
154
152
|
props === null || props === void 0 || (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 || _props$onBlur.call(props, e);
|
155
|
-
setIsInputFocused(false);
|
156
153
|
setDisplayCursor(false);
|
157
154
|
},
|
158
155
|
ref: ref,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useRef","useState","Animated","Platform","Text","TextInput","View","isArray","IMask","FloatingLabel","WmCursor","memo","props","opacityAnimation","Value","current","runAnimation","timing","toValue","duration","useNativeDriver","start","createElement","testID","style","backgroundColor","color","width","marginHorizontal","height","opacity","WMTextInput","forwardRef","ref","_props$customDisplayV","_props$floatingLabel","selectRange","setSelectRange","isInputFocused","setIsInputFocused","iMask","setIMask","displayCursor","setDisplayCursor","value","x","forceUpdate","displayValue","setDisplayValue","element","displayformat","MaskedPattern","mask","skipInvalid","lazy","definitions","typedValue","defaultValue","onChangeText","setTimeout","OS","maskchar","_element$current","setSelectionRange","length","onSelectionChange","e","_e$nativeEvent","selection","nativeEvent","allowContentSelection","end","text","_value","substring","slice","formattedValue","replace","valueExpr","opts","customDisplayValue","textStyle","Object","assign","hideInput","Fragment","floatingLabel","moveUp","label","placeholder","floatingLabelStyle","activeFloatingLabelStyle","_extends","borderColor","zIndex","onFocus","_props$onFocus","call","target","onBlur","_props$onBlur","caretHidden","selectionColor","cursorColor","onChange","contextMenuHidden","display","flexDirection","alignItems","marginTop","minHeight","undefined","padding","fontFamily","fontSize","fontWeight"],"sources":["textinput.component.tsx"],"sourcesContent":["import React, { ForwardedRef, useCallback, useEffect, useRef, useState } from 'react';\nimport { Animated, Platform, Text, TextInput, TextInputProps, TextStyle, View } from 'react-native';\nimport { isArray } from 'lodash';\nimport IMask from 'imask';\nimport { FloatingLabel } from './floatinglabel.component';\n\ninterface SelectRange {\n start: number,\n end: number\n}\n\nconst WmCursor = React.memo((props: {\n color: string,\n height: number\n}) => {\n const opacityAnimation = useRef(new Animated.Value(0.5)).current;\n const runAnimation = useCallback(() => {\n Animated.timing(opacityAnimation, {\n toValue: 0.2,\n duration: 500,\n useNativeDriver: true\n }).start(() => {\n Animated.timing(opacityAnimation, {\n toValue: 0.6,\n duration: 500,\n useNativeDriver: true\n }).start(runAnimation);\n });\n }, []);\n useEffect(() => {\n runAnimation();\n }, []);\n return (\n <Animated.View \n testID=\"wm-custom-cursor\"\n style={{\n backgroundColor: props.color,\n width: 2,\n marginHorizontal: 1,\n height: props.height,\n opacity: opacityAnimation\n }}></Animated.View>\n );\n});\n\nexport const WMTextInput = React.forwardRef((props: (TextInputProps & \n {allowContentSelection: boolean,\n displayformat: string,\n maskchar: string,\n floatingLabel: string\n floatingLabelStyle: TextStyle,\n activeFloatingLabelStyle: TextStyle,\n customDisplayValue?: string\n }), \n ref: ForwardedRef<TextInput>) => {\n const [selectRange, setSelectRange] = useState<SelectRange>(null as any);\n const [isInputFocused, setIsInputFocused] = useState(false);\n const [iMask, setIMask] = useState(null as any);\n const [displayCursor, setDisplayCursor] = useState(false);\n const value = useRef(props.value || '');\n const [x, forceUpdate] = useState(1);\n const [displayValue, setDisplayValue] = useState('');\n const element = useRef(null as any);\n // iMask initialization\n useEffect(() => {\n const iMask: any = props.displayformat ? new IMask.MaskedPattern({\n mask: props.displayformat,\n skipInvalid: true,\n lazy: false,\n definitions: {\n '9': /\\d/,\n 'A': /[a-zA-Z]/,\n 'a': /[a-z]/,\n '*': /\\w/\n }\n }) : null;\n if (iMask) {\n iMask.typedValue = value;\n setDisplayValue(iMask.displayValue)\n setIMask(iMask);\n }\n },[props.displayformat]);\n // set default value\n useEffect(() => {\n const defaultValue = props.defaultValue || props.value || '';\n if (defaultValue && !value.current) {\n value.current = defaultValue;\n onChangeText(defaultValue);\n }\n },[props.defaultValue, props.value]);\n // set cursor position in windows\n useEffect(() => {\n setTimeout(() => {\n if (Platform.OS === 'web' && (props.displayformat || props.maskchar)) {\n element?.current?.setSelectionRange(value.current.length, value.current.length);\n }\n }, 100);\n }, [value.current, props]);\n const onSelectionChange = useCallback((e: any) => {\n if (Platform.OS !== 'android') {\n return;\n }\n const selection = e?.nativeEvent?.selection;\n if (!props.allowContentSelection\n && selection\n && selection.end - selection.start > 0) {\n setSelectRange({\n start: value.current.length + 2,\n end: value.current.length + 2\n });\n } else if (selectRange && selectRange.end > 0){\n setSelectRange(null as any);\n }\n }, [props.allowContentSelection, value]);\n // when text changes\n const onChangeText = useCallback((text: string) => {\n if (!(iMask || props.maskchar)) {\n value.current = text;\n props.onChangeText && props.onChangeText(text);\n return;\n }\n let _value = value.current || '';\n if (value.current.length - text.length > 0) {\n _value = _value.substring(0, _value.length - (value.current.length - text.length));\n } else if (text.length - value.current.length > 0) {\n _value += text.slice(-1 * (text.length - value.current.length));\n }\n let formattedValue = _value;\n if(props.maskchar) {\n formattedValue = (_value.replace(/./g, props.maskchar));\n }\n if (iMask) {\n iMask.typedValue = _value;\n formattedValue = iMask.displayValue;\n }\n if (formattedValue !== displayValue) {\n value.current = _value;\n props.onChangeText && props.onChangeText(_value);\n }\n forceUpdate(x+ 1);\n setDisplayValue(formattedValue);\n }, [iMask, value, displayValue, props.onChangeText]);\n const valueExpr = Platform.OS === 'web' ? 'value' : 'defaultValue';\n const opts = {} as any;\n opts[valueExpr] = props.customDisplayValue ?? value.current;\n const textStyle = Object.assign({}, ...isArray(props.style) ? props.style: [props.style]);\n const hideInput = props.displayformat || props.maskchar;\n return (\n <>\n {props.floatingLabel ? (\n <FloatingLabel\n moveUp={!!(value.current || isInputFocused || displayValue)}\n label={props.floatingLabel ?? props.placeholder} \n style={{\n ...(props.floatingLabelStyle || []),\n ...(isInputFocused ? (props.activeFloatingLabelStyle || {}) : {})\n }}/>\n ) : null}\n <TextInput\n {...props}\n {...hideInput || props.customDisplayValue ? opts: {}}\n placeholder={props.floatingLabel || displayValue ? '' : props.placeholder }\n style={[props.style, hideInput ? {\n color: 'transparent', \n backgroundColor: 'transparent',\n borderColor: 'transparent',\n zIndex: 1\n } : {}]}\n onFocus={(e) => {\n props.onFocus?.(e);\n setIsInputFocused(true);\n setDisplayCursor(true);\n element.current = e.target;\n }}\n onBlur={(e) => {\n props?.onBlur?.(e);\n setIsInputFocused(false);\n setDisplayCursor(false);\n }}\n ref={ref}\n selection={selectRange}\n onSelectionChange={onSelectionChange}\n caretHidden={!!selectRange?.end}\n onChangeText={(text) => {\n onChangeText(text);\n }}\n {...hideInput ? {\n selectionColor: 'transparent',\n cursorColor: 'transparent',\n onChange : () => {}\n }: {}}\n contextMenuHidden={!props.allowContentSelection}\n ></TextInput>\n {\n hideInput ? (\n <View style={[props.style, {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n marginTop: -1 * (textStyle.height || textStyle.minHeight || 0)\n + (textStyle.marginTop || 0)}]}>\n <Text style={{ \n width: undefined,\n backgroundColor: 'transparent', \n borderColor: 'transparent',\n padding: 0,\n display: 'flex',\n color: textStyle.color,\n fontFamily: textStyle.fontFamily,\n fontSize: textStyle.fontSize,\n fontWeight: textStyle.fontWeight\n }}>\n {displayValue}\n </Text>\n {\n (displayCursor && !props.displayformat) ? React.createElement(WmCursor, {\n color: textStyle.color || '#000000',\n height: textStyle.fontSize || 14\n }) : null\n }\n </View>\n ) : null\n }\n </>\n );\n});"],"mappings":";AAAA,OAAOA,KAAK,IAAkBC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACrF,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,SAAS,EAA6BC,IAAI,QAAQ,cAAc;AACnG,SAASC,OAAO,QAAQ,QAAQ;AAChC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAQ,2BAA2B;AAOzD,MAAMC,QAAQ,gBAAGb,KAAK,CAACc,IAAI,CAAEC,KAG5B,IAAK;EACJ,MAAMC,gBAAgB,GAAGb,MAAM,CAAC,IAAIE,QAAQ,CAACY,KAAK,CAAC,GAAG,CAAC,CAAC,CAACC,OAAO;EAChE,MAAMC,YAAY,GAAGlB,WAAW,CAAC,MAAM;IACrCI,QAAQ,CAACe,MAAM,CAACJ,gBAAgB,EAAE;MAChCK,OAAO,EAAE,GAAG;MACZC,QAAQ,EAAE,GAAG;MACbC,eAAe,EAAE;IACnB,CAAC,CAAC,CAACC,KAAK,CAAC,MAAM;MACbnB,QAAQ,CAACe,MAAM,CAACJ,gBAAgB,EAAE;QAChCK,OAAO,EAAE,GAAG;QACZC,QAAQ,EAAE,GAAG;QACbC,eAAe,EAAE;MACnB,CAAC,CAAC,CAACC,KAAK,CAACL,YAAY,CAAC;IACxB,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EACNjB,SAAS,CAAC,MAAM;IACdiB,YAAY,CAAC,CAAC;EAChB,CAAC,EAAE,EAAE,CAAC;EACN,oBACEnB,KAAA,CAAAyB,aAAA,CAACpB,QAAQ,CAACI,IAAI;IACdiB,MAAM,EAAC,kBAAkB;IACzBC,KAAK,EAAE;MACLC,eAAe,EAAEb,KAAK,CAACc,KAAK;MAC5BC,KAAK,EAAE,CAAC;MACRC,gBAAgB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KAAK,EAAEoF,SAAS;MAChBtF,eAAe,EAAE,aAAa;MAC9BoE,WAAW,EAAE,aAAa;MAC1BmB,OAAO,EAAE,CAAC;MACVN,OAAO,EAAE,MAAM;MACfhF,KAAK,EAAEuD,SAAS,CAACvD,KAAK;MACtBuF,UAAU,EAAEhC,SAAS,CAACgC,UAAU;MAChCC,QAAQ,EAAEjC,SAAS,CAACiC,QAAQ;MAC5BC,UAAU,EAAElC,SAAS,CAACkC;IACtB;EAAE,GACDpE,YACG,CAAC,EAEJL,aAAa,IAAI,CAAC9B,KAAK,CAACsC,aAAa,gBAAIrD,KAAK,CAACyB,aAAa,CAACZ,QAAQ,EAAE;IACtEgB,KAAK,EAAEuD,SAAS,CAACvD,KAAK,IAAI,SAAS;IACnCG,MAAM,EAAEoD,SAAS,CAACiC,QAAQ,IAAI;EAChC,CAAC,CAAC,GAAG,IAEH,CAAC,GACL,IAEN,CAAC;AAET,CAAC,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useRef","useState","Animated","Platform","Text","TextInput","View","isArray","IMask","FloatingLabel","WmCursor","memo","props","opacityAnimation","Value","current","runAnimation","timing","toValue","duration","useNativeDriver","start","createElement","testID","style","backgroundColor","color","width","marginHorizontal","height","opacity","WMTextInput","forwardRef","ref","_props$customDisplayV","_props$floatingLabel","selectRange","setSelectRange","iMask","setIMask","displayCursor","setDisplayCursor","value","x","forceUpdate","displayValue","setDisplayValue","element","displayformat","MaskedPattern","mask","skipInvalid","lazy","definitions","typedValue","defaultValue","onChangeText","setTimeout","OS","maskchar","_element$current","setSelectionRange","length","onSelectionChange","e","_e$nativeEvent","selection","nativeEvent","allowContentSelection","end","text","_value","substring","slice","formattedValue","replace","valueExpr","opts","customDisplayValue","textStyle","Object","assign","hideInput","Fragment","floatingLabel","moveUp","isInputFocused","label","placeholder","floatingLabelStyle","activeFloatingLabelStyle","_extends","borderColor","zIndex","onFocus","_props$onFocus","call","target","onBlur","_props$onBlur","caretHidden","selectionColor","cursorColor","onChange","contextMenuHidden","display","flexDirection","alignItems","marginTop","minHeight","undefined","padding","fontFamily","fontSize","fontWeight"],"sources":["textinput.component.tsx"],"sourcesContent":["import React, { ForwardedRef, useCallback, useEffect, useRef, useState } from 'react';\nimport { Animated, Platform, Text, TextInput, TextInputProps, TextStyle, View } from 'react-native';\nimport { isArray } from 'lodash';\nimport IMask from 'imask';\nimport { FloatingLabel } from './floatinglabel.component';\n\ninterface SelectRange {\n start: number,\n end: number\n}\n\nconst WmCursor = React.memo((props: {\n color: string,\n height: number\n}) => {\n const opacityAnimation = useRef(new Animated.Value(0.5)).current;\n const runAnimation = useCallback(() => {\n Animated.timing(opacityAnimation, {\n toValue: 0.2,\n duration: 500,\n useNativeDriver: true\n }).start(() => {\n Animated.timing(opacityAnimation, {\n toValue: 0.6,\n duration: 500,\n useNativeDriver: true\n }).start(runAnimation);\n });\n }, []);\n useEffect(() => {\n runAnimation();\n }, []);\n return (\n <Animated.View \n testID=\"wm-custom-cursor\"\n style={{\n backgroundColor: props.color,\n width: 2,\n marginHorizontal: 1,\n height: props.height,\n opacity: opacityAnimation\n }}></Animated.View>\n );\n});\n\nexport const WMTextInput = React.forwardRef((props: (TextInputProps & \n {allowContentSelection: boolean,\n displayformat: string,\n maskchar: string,\n floatingLabel: string\n floatingLabelStyle: TextStyle,\n activeFloatingLabelStyle: TextStyle,\n customDisplayValue?: string,\n isInputFocused: boolean\n }), \n ref: ForwardedRef<TextInput>) => {\n const [selectRange, setSelectRange] = useState<SelectRange>(null as any);\n const [iMask, setIMask] = useState(null as any);\n const [displayCursor, setDisplayCursor] = useState(false);\n const value = useRef(props.value || '');\n const [x, forceUpdate] = useState(1);\n const [displayValue, setDisplayValue] = useState('');\n const element = useRef(null as any);\n // iMask initialization\n useEffect(() => {\n const iMask: any = props.displayformat ? new IMask.MaskedPattern({\n mask: props.displayformat,\n skipInvalid: true,\n lazy: false,\n definitions: {\n '9': /\\d/,\n 'A': /[a-zA-Z]/,\n 'a': /[a-z]/,\n '*': /\\w/\n }\n }) : null;\n if (iMask) {\n iMask.typedValue = value;\n setDisplayValue(iMask.displayValue)\n setIMask(iMask);\n }\n },[props.displayformat]);\n // set default value\n useEffect(() => {\n const defaultValue = props.defaultValue || props.value || '';\n if (defaultValue && !value.current) {\n value.current = defaultValue;\n onChangeText(defaultValue);\n }\n },[props.defaultValue, props.value]);\n // set cursor position in windows\n useEffect(() => {\n setTimeout(() => {\n if (Platform.OS === 'web' && (props.displayformat || props.maskchar)) {\n element?.current?.setSelectionRange(value.current.length, value.current.length);\n }\n }, 100);\n }, [value.current, props]);\n const onSelectionChange = useCallback((e: any) => {\n if (Platform.OS !== 'android') {\n return;\n }\n const selection = e?.nativeEvent?.selection;\n if (!props.allowContentSelection\n && selection\n && selection.end - selection.start > 0) {\n setSelectRange({\n start: value.current.length + 2,\n end: value.current.length + 2\n });\n } else if (selectRange && selectRange.end > 0){\n setSelectRange(null as any);\n }\n }, [props.allowContentSelection, value]);\n // when text changes\n const onChangeText = useCallback((text: string) => {\n if (!(iMask || props.maskchar)) {\n value.current = text;\n props.onChangeText && props.onChangeText(text);\n return;\n }\n let _value = value.current || '';\n if (value.current.length - text.length > 0) {\n _value = _value.substring(0, _value.length - (value.current.length - text.length));\n } else if (text.length - value.current.length > 0) {\n _value += text.slice(-1 * (text.length - value.current.length));\n }\n let formattedValue = _value;\n if(props.maskchar) {\n formattedValue = (_value.replace(/./g, props.maskchar));\n }\n if (iMask) {\n iMask.typedValue = _value;\n formattedValue = iMask.displayValue;\n }\n if (formattedValue !== displayValue) {\n value.current = _value;\n props.onChangeText && props.onChangeText(_value);\n }\n forceUpdate(x+ 1);\n setDisplayValue(formattedValue);\n }, [iMask, value, displayValue, props.onChangeText]);\n const valueExpr = Platform.OS === 'web' ? 'value' : 'defaultValue';\n const opts = {} as any;\n opts[valueExpr] = props.customDisplayValue ?? value.current;\n const textStyle = Object.assign({}, ...isArray(props.style) ? props.style: [props.style]);\n const hideInput = props.displayformat || props.maskchar;\n return (\n <>\n {props.floatingLabel ? (\n <FloatingLabel\n moveUp={!!(value.current || props.isInputFocused || displayValue)}\n label={props.floatingLabel ?? props.placeholder} \n style={{\n ...(props.floatingLabelStyle || []),\n ...(props.isInputFocused ? (props.activeFloatingLabelStyle || {}) : {})\n }}/>\n ) : null}\n <TextInput\n {...props}\n {...hideInput || props.customDisplayValue ? opts: {}}\n placeholder={props.floatingLabel || displayValue ? '' : props.placeholder }\n style={[props.style, hideInput ? {\n color: 'transparent', \n backgroundColor: 'transparent',\n borderColor: 'transparent',\n zIndex: 1\n } : {}]}\n onFocus={(e) => {\n props.onFocus?.(e);\n setDisplayCursor(true);\n element.current = e.target;\n }}\n onBlur={(e) => {\n props?.onBlur?.(e);\n setDisplayCursor(false);\n }}\n ref={ref}\n selection={selectRange}\n onSelectionChange={onSelectionChange}\n caretHidden={!!selectRange?.end}\n onChangeText={(text) => {\n onChangeText(text);\n }}\n {...hideInput ? {\n selectionColor: 'transparent',\n cursorColor: 'transparent',\n onChange : () => {}\n }: {}}\n contextMenuHidden={!props.allowContentSelection}\n ></TextInput>\n {\n hideInput ? (\n <View style={[props.style, {\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n marginTop: -1 * (textStyle.height || textStyle.minHeight || 0)\n + (textStyle.marginTop || 0)}]}>\n <Text style={{ \n width: undefined,\n backgroundColor: 'transparent', \n borderColor: 'transparent',\n padding: 0,\n display: 'flex',\n color: textStyle.color,\n fontFamily: textStyle.fontFamily,\n fontSize: textStyle.fontSize,\n fontWeight: textStyle.fontWeight\n }}>\n {displayValue}\n </Text>\n {\n (displayCursor && !props.displayformat) ? React.createElement(WmCursor, {\n color: textStyle.color || '#000000',\n height: textStyle.fontSize || 14\n }) : null\n }\n </View>\n ) : null\n }\n </>\n );\n});"],"mappings":";AAAA,OAAOA,KAAK,IAAkBC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACrF,SAASC,QAAQ,EA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AEJL,aAAa,IAAI,CAAC5B,KAAK,CAACoC,aAAa,gBAAInD,KAAK,CAACyB,aAAa,CAACZ,QAAQ,EAAE;IACtEgB,KAAK,EAAEqD,SAAS,CAACrD,KAAK,IAAI,SAAS;IACnCG,MAAM,EAAEkD,SAAS,CAACkC,QAAQ,IAAI;EAChC,CAAC,CAAC,GAAG,IAEH,CAAC,GACL,IAEN,CAAC;AAET,CAAC,CAAC","ignoreList":[]}
|
@@ -72,7 +72,6 @@ export class PropsProvider {
|
|
72
72
|
|
73
73
|
// sets the property. But, value gets overriden when the original prop changes.
|
74
74
|
set(name, value) {
|
75
|
-
this.oldProps[name] = value;
|
76
75
|
const oldValue = this.oldProps[name];
|
77
76
|
if (oldValue !== value) {
|
78
77
|
this.oldProps[name] = value;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["assign","isNil","PropsProvider","constructor","defaultProps","initprops","onChange","name","$new","$old","_defineProperty","Object","keys","forEach","k","propertyNames","propsProxy","Proxy","get","target","prop","receiver","propName","toString","value","overriddenProps","hasOwnProperty","oldProps","set","has","isDirty","oldValue","setDefault","overrideProp","check","nextProps","result","reduce","b","flag"],"sources":["props.provider.ts"],"sourcesContent":["import { assign, isNil } from \"lodash-es\";\nimport { BaseProps } from \"./base.component\";\n\nexport class PropsProvider<T extends BaseProps> {\n private oldProps: any = {};\n private overriddenProps: any = {};\n private propsProxy: T;\n private isDirty = false;\n private propertyNames = {} as any;\n\n constructor(private defaultProps: T, private initprops: T, private onChange = (name: string, $new: any, $old: any) => {}) {\n this.initprops = this.initprops || {};\n Object.keys(defaultProps).forEach(k => this.propertyNames[k] = true);\n Object.keys(initprops).forEach(k => this.propertyNames[k] = true);\n //@ts-ignore\n this.propsProxy = (new Proxy({}, {\n get: (target, prop, receiver): any => {\n const propName = prop.toString();\n let value = (this.defaultProps as any)[propName];\n if (this.overriddenProps.hasOwnProperty(propName)) {\n value = this.overriddenProps[propName];\n } else if (this.oldProps.hasOwnProperty(propName)) {\n value = this.oldProps[propName];\n }\n return value;\n },\n set: (target: any, prop, value: any): any => {\n const propName = prop.toString();\n if (!this.has(propName)) {\n return true;\n }\n this.isDirty = this.isDirty || this.overriddenProps[propName] !== value;\n this.overriddenProps[propName] = value;\n if (this.oldProps[propName] !== value) {\n const oldValue = this.oldProps[propName];\n this.onChange(propName, value, oldValue);\n this.oldProps[propName] = value;\n }\n return true;\n }\n }));\n }\n\n setDefault(propName: string, value: any) {\n (this.defaultProps as any)[propName] = value;\n }\n overrideProp(propName: string, value: any) {\n (this.overriddenProps as any)[propName] = value;\n this.isDirty = true;\n }\n\n check(nextProps?: T) {\n if (!nextProps) {\n nextProps = assign({}, this.defaultProps, this.initprops);\n }\n const result = Object.keys(nextProps).reduce((b, k) => {\n let flag = false;\n //@ts-ignore\n const value = nextProps[k];\n const oldValue = this.oldProps[k];\n if (isNil(this.overriddenProps[k])\n && (!this.oldProps.hasOwnProperty(k)\n || this.oldProps[k] !== value)) {\n this.oldProps[k] = value;\n this.onChange(k, value, oldValue);\n flag = true;\n }\n return b || flag;\n }, false) || this.isDirty;\n\n this.isDirty = false;\n return result;\n }\n\n // sets the property. But, value gets overriden when the original prop changes.\n set(name: string, value: any) {\n
|
1
|
+
{"version":3,"names":["assign","isNil","PropsProvider","constructor","defaultProps","initprops","onChange","name","$new","$old","_defineProperty","Object","keys","forEach","k","propertyNames","propsProxy","Proxy","get","target","prop","receiver","propName","toString","value","overriddenProps","hasOwnProperty","oldProps","set","has","isDirty","oldValue","setDefault","overrideProp","check","nextProps","result","reduce","b","flag"],"sources":["props.provider.ts"],"sourcesContent":["import { assign, isNil } from \"lodash-es\";\nimport { BaseProps } from \"./base.component\";\n\nexport class PropsProvider<T extends BaseProps> {\n private oldProps: any = {};\n private overriddenProps: any = {};\n private propsProxy: T;\n private isDirty = false;\n private propertyNames = {} as any;\n\n constructor(private defaultProps: T, private initprops: T, private onChange = (name: string, $new: any, $old: any) => {}) {\n this.initprops = this.initprops || {};\n Object.keys(defaultProps).forEach(k => this.propertyNames[k] = true);\n Object.keys(initprops).forEach(k => this.propertyNames[k] = true);\n //@ts-ignore\n this.propsProxy = (new Proxy({}, {\n get: (target, prop, receiver): any => {\n const propName = prop.toString();\n let value = (this.defaultProps as any)[propName];\n if (this.overriddenProps.hasOwnProperty(propName)) {\n value = this.overriddenProps[propName];\n } else if (this.oldProps.hasOwnProperty(propName)) {\n value = this.oldProps[propName];\n }\n return value;\n },\n set: (target: any, prop, value: any): any => {\n const propName = prop.toString();\n if (!this.has(propName)) {\n return true;\n }\n this.isDirty = this.isDirty || this.overriddenProps[propName] !== value;\n this.overriddenProps[propName] = value;\n if (this.oldProps[propName] !== value) {\n const oldValue = this.oldProps[propName];\n this.onChange(propName, value, oldValue);\n this.oldProps[propName] = value;\n }\n return true;\n }\n }));\n }\n\n setDefault(propName: string, value: any) {\n (this.defaultProps as any)[propName] = value;\n }\n overrideProp(propName: string, value: any) {\n (this.overriddenProps as any)[propName] = value;\n this.isDirty = true;\n }\n\n check(nextProps?: T) {\n if (!nextProps) {\n nextProps = assign({}, this.defaultProps, this.initprops);\n }\n const result = Object.keys(nextProps).reduce((b, k) => {\n let flag = false;\n //@ts-ignore\n const value = nextProps[k];\n const oldValue = this.oldProps[k];\n if (isNil(this.overriddenProps[k])\n && (!this.oldProps.hasOwnProperty(k)\n || this.oldProps[k] !== value)) {\n this.oldProps[k] = value;\n this.onChange(k, value, oldValue);\n flag = true;\n }\n return b || flag;\n }, false) || this.isDirty;\n\n this.isDirty = false;\n return result;\n }\n\n // sets the property. But, value gets overriden when the original prop changes.\n set(name: string, value: any) {\n const oldValue = this.oldProps[name];\n if(oldValue !== value) {\n this.oldProps[name] = value;\n this.onChange(name, value, oldValue);\n }\n }\n\n has(propName: string) {\n return !!this.propertyNames[propName];\n }\n\n get() {\n return this.propsProxy;\n }\n}\n"],"mappings":";;;AAAA,SAASA,MAAM,EAAEC,KAAK,QAAQ,WAAW;AAGzC,OAAO,MAAMC,aAAa,CAAsB;EAO5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native-paper";
|
10
10
|
export const TappableContext = /*#__PURE__*/React.createContext(null);
|
11
11
|
import { UIPreferencesConsumer } from "./ui-preferences.context";
|
12
|
+
export const ParentTappableContext = /*#__PURE__*/React.createContext(null);
|
12
13
|
export class SyntheticEvent {
|
13
14
|
constructor() {
|
14
15
|
// as the event is being used in onPress, onPressOut and onLongTap the TapEvent is renamed to SyntheticEvent
|
@@ -131,10 +132,15 @@ export class Tappable extends React.Component {
|
|
131
132
|
};
|
132
133
|
if (target !== null && target !== void 0 && target.props.onTap || target !== null && target !== void 0 && target.props.onLongtap || target !== null && target !== void 0 && target.props.onDoubletap || this.props.onTap || this.props.onLongTap || this.props.onDoubleTap) {
|
133
134
|
return /*#__PURE__*/React.createElement(UIPreferencesConsumer, null, preferences => {
|
134
|
-
return preferences.enableRipple != false ? /*#__PURE__*/React.createElement(
|
135
|
-
|
136
|
-
|
137
|
-
|
135
|
+
return preferences.enableRipple != false ? /*#__PURE__*/React.createElement(ParentTappableContext.Consumer, null, parent => {
|
136
|
+
this.setParent(parent);
|
137
|
+
return /*#__PURE__*/React.createElement(ParentTappableContext.Provider, {
|
138
|
+
value: this
|
139
|
+
}, /*#__PURE__*/React.createElement(TouchableRipple, _extends({
|
140
|
+
rippleColor: this.props.rippleColor,
|
141
|
+
borderless: true
|
142
|
+
}, commonProps), /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children)));
|
143
|
+
}) : /*#__PURE__*/React.createElement(TouchableOpacity, commonProps, /*#__PURE__*/React.createElement(React.Fragment, null, this.props.children));
|
138
144
|
});
|
139
145
|
}
|
140
146
|
return /*#__PURE__*/React.createElement(View, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","Platform","View","TouchableOpacity","get","injector","TouchableRipple","TappableContext","createContext","UIPreferencesConsumer","SyntheticEvent","constructor","_defineProperty","stopPropagation","propagationEnabled","Tappable","Component","props","triggerTap","e","_this$parent","target","onTap","invokeEventCallback","parent","onPress","_this$props$target","lastPress","Date","now","onTouchStart","currentTime","tapDelta","lastTap","isLongTap","_injector$FOCUSED_ELE","FOCUSED_ELEMENT","blur","lastDoubleTap","onDoubleTap","setTimeout","_this$parent2","onLongTap","_this$props$target2","_this$parent3","onPressOut","onTouchEnd","_this$props$target3","_this$parent4","setParent","render","commonProps","OS","accessibilityLabel","testID","accessibilityProps","disabled","proxy","style","styles","_e$target","tagName","onLongPress","onLongtap","onDoubletap","createElement","preferences","enableRipple","_extends","rippleColor","borderless","Fragment","children"],"sources":["tappable.component.tsx"],"sourcesContent":["import { BaseComponent } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport React from \"react\";\nimport { GestureResponderEvent, Platform, View, TouchableOpacity } from \"react-native\";\nimport { get } from \"lodash\";\nimport injector from \"./injector\";\nimport { TouchableRipple } from \"react-native-paper\";\nimport ThemeVariables from \"../styles/theme.variables\";\nimport { isDefined } from \"./utils\";\n\nexport const TappableContext = React.createContext<Tappable>(null as any);\nimport { UIPreferencesConsumer, UI_PREFERENCES } from \"./ui-preferences.context\";\n\ninterface TappableProps {\n testID?: string;\n children?: any\n styles?: any;\n target?: BaseComponent<any, any, any>;\n onTap?: (e: any) => void;\n onLongTap?: (e: any) => void; \n onDoubleTap?: (e: any) => void;\n onTouchStart? : (e: any) => void;\n onTouchEnd? : (e: any) => void;\n rippleColor?: string;\n accessibilityProps?: any;\n}\n\nexport class SyntheticEvent {\n // as the event is being used in onPress, onPressOut and onLongTap the TapEvent is renamed to SyntheticEvent\n propagationEnabled = true;\n \n constructor() {\n\n }\n\n stopPropagation() {\n this.propagationEnabled = false;\n }\n}\n\nexport class Tappable extends React.Component<TappableProps, any> {\n private lastPress = 0;\n private lastTap = 0;\n private lastDoubleTap = 0;\n private isLongTap = false;\n private parent:Tappable = null as any;\n \n constructor(props: any) {\n super(props);\n }\n\n async triggerTap(e = new SyntheticEvent()) {\n if (!e.propagationEnabled) {\n return;\n }\n const target = this.props.target;\n if (this.props.onTap) {\n await this.props.onTap(e);\n } else {\n await target?.invokeEventCallback('onTap', [e, target]);\n }\n this.parent?.triggerTap(e);\n }\n\n onPress(e: SyntheticEvent): void { \n this.lastPress = Date.now();\n const target = this.props.target;\n this.props.onTouchStart && this.props.onTouchStart(e);\n this.props.target?.invokeEventCallback('onTouchstart', [e, this.props.target]);\n const currentTime = Date.now();\n const tapDelta = currentTime - this.lastTap;\n if (this.isLongTap) {\n this.isLongTap = false;\n return;\n }\n if (e.propagationEnabled) {\n injector.FOCUSED_ELEMENT.get()?.blur();\n if(this.lastDoubleTap !== this.lastTap \n && tapDelta < 500) {\n this.props.onDoubleTap && this.props.onDoubleTap(e);\n setTimeout(() => {\n target?.invokeEventCallback('onDoubletap', [e, target]);\n }, 200);\n this.lastDoubleTap = currentTime;\n }\n setTimeout(() => {\n if (!e.propagationEnabled) {\n return;\n }\n if (this.props.onTap) {\n this.props.onTap(e);\n } else {\n target?.invokeEventCallback('onTap', [e, target]);\n }\n this.parent?.onPress(e);\n }, 200);\n this.lastTap = currentTime;\n }\n }\n\n onLongTap(e: SyntheticEvent): void {\n if(!e.propagationEnabled){\n return;\n }\n this.props.onLongTap && this.props.onLongTap(e);\n setTimeout(() => {\n this.props.target?.invokeEventCallback('onLongtap', [e, this.props.target]);\n this.parent?.onPressOut(e);\n }, 200);\n this.isLongTap = true;\n }\n \n onPressOut(e: SyntheticEvent): void {\n if(!e.propagationEnabled){\n return;\n } \n this.props.onTouchEnd && this.props.onTouchEnd(e);\n setTimeout(() => {\n this.props.target?.invokeEventCallback('onTouchend', [e, this.props.target]);\n this.parent?.onPressOut(e);\n }, 200);\n this.isLongTap = false;\n }\n private setParent(parent: Tappable) {\n if (parent && this.parent !== parent) {\n this.parent = parent;\n }\n }\n\n render() {\n const target = this.props.target;\n const commonProps = {\n ...(Platform.OS === 'android' || Platform.OS === 'web') ? {\n accessibilityLabel: this.props.testID,\n testID: this.props.testID\n }: {\n // accessible: false,\n testID: this.props.testID\n },\n ...this.props.accessibilityProps,\n disabled:get(target?.proxy, 'disabled'),\n style:this.props.styles,\n onPress:(e?: GestureResponderEvent) => {\n if ((e?.target as any)?.tagName === 'INPUT') {\n return;\n }\n this.onPress(new SyntheticEvent())\n },\n onLongPress:(e?: GestureResponderEvent) => this.onLongTap(new SyntheticEvent()),\n onPressOut:(e?: GestureResponderEvent) => this.onPressOut(new SyntheticEvent())\n };\n if (target?.props.onTap \n || target?.props.onLongtap \n || target?.props.onDoubletap \n || this.props.onTap \n || this.props.onLongTap \n || this.props.onDoubleTap) {\n return (\n <UIPreferencesConsumer>\n {(preferences: UI_PREFERENCES) => {\n return preferences.enableRipple != false ? (\n <TouchableRipple rippleColor={this.props.rippleColor} borderless={true} {...commonProps}>\n <>{this.props.children}</>\n </TouchableRipple>): (\n <TouchableOpacity {...commonProps}>\n <>{this.props.children}</>\n </TouchableOpacity>);\n }}\n </UIPreferencesConsumer>\n );\n }\n return (<View style={this.props.styles}>{this.props.children}</View>);\n }\n}\n"],"mappings":";;;;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAgCC,QAAQ,EAAEC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AACtF,SAASC,GAAG,QAAQ,QAAQ;AAC5B,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,eAAe,QAAQ,oBAAoB;AAIpD,OAAO,MAAMC,eAAe,gBAAGP,KAAK,CAACQ,aAAa,CAAW,IAAW,CAAC;AACzE,SAASC,qBAAqB,QAAwB,0BAA0B;AAgBhF,OAAO,MAAMC,cAAc,CAAC;EAIxBC,WAAWA,CAAA,EAAG;IAHd;IAAAC,eAAA,6BACqB,IAAI;EAIzB;EAEAC,eAAeA,CAAA,EAAG;IACd,IAAI,CAACC,kBAAkB,GAAG,KAAK;EACnC;AACJ;AAEA,OAAO,MAAMC,QAAQ,SAASf,KAAK,CAACgB,SAAS,CAAqB;EAO9DL,WAAWA,CAACM,KAAU,EAAE;IACpB,KAAK,CAACA,KAAK,CAAC;IAACL,eAAA,oBAPG,CAAC;IAAAA,eAAA,kBACH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SAAS,IACvB1C,MAAM,aAANA,MAAM,eAANA,MAAM,CAAEJ,KAAK,CAAC+C,WAAW,IACzB,IAAI,CAAC/C,KAAK,CAACK,KAAK,IAChB,IAAI,CAACL,KAAK,CAACyB,SAAS,IACpB,IAAI,CAACzB,KAAK,CAACsB,WAAW,EAAE;MAC3B,oBACAvC,KAAA,CAAAiE,aAAA,CAACxD,qBAAqB,QAChByD,WAA2B,IAAK;QAC9B,OAAOA,WAAW,CAACC,YAAY,IAAI,KAAK,gBACxCnE,KAAA,CAAAiE,aAAA,CAAC3D,eAAe,EAAA8D,QAAA;UAACC,WAAW,EAAE,IAAI,CAACpD,KAAK,CAACoD,WAAY;UAACC,UAAU,EAAE;QAAK,GAAKnB,WAAW,gBACnFnD,KAAA,CAAAiE,aAAA,CAAAjE,KAAA,CAAAuE,QAAA,QAAG,IAAI,CAACtD,KAAK,CAACuD,QAAW,CACZ,CAAC,gBAClBxE,KAAA,CAAAiE,aAAA,CAAC9D,gBAAgB,EAAKgD,WAAW,eAC7BnD,KAAA,CAAAiE,aAAA,CAAAjE,KAAA,CAAAuE,QAAA,QAAG,IAAI,CAACtD,KAAK,CAACuD,QAAW,CACX,CAAE;MACxB,CACmB,CAAC;IAE5B;IACA,oBAAQxE,KAAA,CAAAiE,aAAA,CAAC/D,IAAI;MAACwD,KAAK,EAAE,IAAI,CAACzC,KAAK,CAAC0C;IAAO,GAAE,IAAI,CAAC1C,KAAK,CAACuD,QAAe,CAAC;EACxE;AACJ","ignoreList":[]}
|
1
|
+
{"version":3,"names":["React","Platform","View","TouchableOpacity","get","injector","TouchableRipple","TappableContext","createContext","UIPreferencesConsumer","ParentTappableContext","SyntheticEvent","constructor","_defineProperty","stopPropagation","propagationEnabled","Tappable","Component","props","triggerTap","e","_this$parent","target","onTap","invokeEventCallback","parent","onPress","_this$props$target","lastPress","Date","now","onTouchStart","currentTime","tapDelta","lastTap","isLongTap","_injector$FOCUSED_ELE","FOCUSED_ELEMENT","blur","lastDoubleTap","onDoubleTap","setTimeout","_this$parent2","onLongTap","_this$props$target2","_this$parent3","onPressOut","onTouchEnd","_this$props$target3","_this$parent4","setParent","render","commonProps","OS","accessibilityLabel","testID","accessibilityProps","disabled","proxy","style","styles","_e$target","tagName","onLongPress","onLongtap","onDoubletap","createElement","preferences","enableRipple","Consumer","Provider","value","_extends","rippleColor","borderless","Fragment","children"],"sources":["tappable.component.tsx"],"sourcesContent":["import { BaseComponent } from \"@wavemaker/app-rn-runtime/core/base.component\";\nimport React from \"react\";\nimport { GestureResponderEvent, Platform, View, TouchableOpacity } from \"react-native\";\nimport { get } from \"lodash\";\nimport injector from \"./injector\";\nimport { TouchableRipple } from \"react-native-paper\";\nimport ThemeVariables from \"../styles/theme.variables\";\nimport { isDefined } from \"./utils\";\n\nexport const TappableContext = React.createContext<Tappable>(null as any);\nimport { UIPreferencesConsumer, UI_PREFERENCES } from \"./ui-preferences.context\";\n\nexport const ParentTappableContext = React.createContext<Tappable>(null as any);\ninterface TappableProps {\n testID?: string;\n children?: any\n styles?: any;\n target?: BaseComponent<any, any, any>;\n onTap?: (e: any) => void;\n onLongTap?: (e: any) => void; \n onDoubleTap?: (e: any) => void;\n onTouchStart? : (e: any) => void;\n onTouchEnd? : (e: any) => void;\n rippleColor?: string;\n accessibilityProps?: any;\n}\n\nexport class SyntheticEvent {\n // as the event is being used in onPress, onPressOut and onLongTap the TapEvent is renamed to SyntheticEvent\n propagationEnabled = true;\n \n constructor() {\n\n }\n\n stopPropagation() {\n this.propagationEnabled = false;\n }\n}\n\nexport class Tappable extends React.Component<TappableProps, any> {\n private lastPress = 0;\n private lastTap = 0;\n private lastDoubleTap = 0;\n private isLongTap = false;\n private parent:Tappable = null as any;\n \n constructor(props: any) {\n super(props);\n }\n\n async triggerTap(e = new SyntheticEvent()) {\n if (!e.propagationEnabled) {\n return;\n }\n const target = this.props.target;\n if (this.props.onTap) {\n await this.props.onTap(e);\n } else {\n await target?.invokeEventCallback('onTap', [e, target]);\n }\n this.parent?.triggerTap(e);\n }\n\n onPress(e: SyntheticEvent): void { \n this.lastPress = Date.now();\n const target = this.props.target;\n this.props.onTouchStart && this.props.onTouchStart(e);\n this.props.target?.invokeEventCallback('onTouchstart', [e, this.props.target]);\n const currentTime = Date.now();\n const tapDelta = currentTime - this.lastTap;\n if (this.isLongTap) {\n this.isLongTap = false;\n return;\n }\n if (e.propagationEnabled) {\n injector.FOCUSED_ELEMENT.get()?.blur();\n if(this.lastDoubleTap !== this.lastTap \n && tapDelta < 500) {\n this.props.onDoubleTap && this.props.onDoubleTap(e);\n setTimeout(() => {\n target?.invokeEventCallback('onDoubletap', [e, target]);\n }, 200);\n this.lastDoubleTap = currentTime;\n }\n setTimeout(() => {\n if (!e.propagationEnabled) {\n return;\n }\n if (this.props.onTap) {\n this.props.onTap(e);\n } else {\n target?.invokeEventCallback('onTap', [e, target]);\n }\n this.parent?.onPress(e);\n }, 200);\n this.lastTap = currentTime;\n }\n }\n\n onLongTap(e: SyntheticEvent): void {\n if(!e.propagationEnabled){\n return;\n }\n this.props.onLongTap && this.props.onLongTap(e);\n setTimeout(() => {\n this.props.target?.invokeEventCallback('onLongtap', [e, this.props.target]);\n this.parent?.onPressOut(e);\n }, 200);\n this.isLongTap = true;\n }\n \n onPressOut(e: SyntheticEvent): void {\n if(!e.propagationEnabled){\n return;\n } \n this.props.onTouchEnd && this.props.onTouchEnd(e);\n setTimeout(() => {\n this.props.target?.invokeEventCallback('onTouchend', [e, this.props.target]);\n this.parent?.onPressOut(e);\n }, 200);\n this.isLongTap = false;\n }\n private setParent(parent: Tappable) {\n if (parent && this.parent !== parent) {\n this.parent = parent;\n }\n }\n\n render() {\n const target = this.props.target;\n const commonProps = {\n ...(Platform.OS === 'android' || Platform.OS === 'web') ? {\n accessibilityLabel: this.props.testID,\n testID: this.props.testID\n }: {\n // accessible: false,\n testID: this.props.testID\n },\n ...this.props.accessibilityProps,\n disabled:get(target?.proxy, 'disabled'),\n style:this.props.styles,\n onPress:(e?: GestureResponderEvent) => {\n if ((e?.target as any)?.tagName === 'INPUT') {\n return;\n }\n this.onPress(new SyntheticEvent())\n },\n onLongPress:(e?: GestureResponderEvent) => this.onLongTap(new SyntheticEvent()),\n onPressOut:(e?: GestureResponderEvent) => this.onPressOut(new SyntheticEvent())\n };\n if (target?.props.onTap \n || target?.props.onLongtap \n || target?.props.onDoubletap \n || this.props.onTap \n || this.props.onLongTap \n || this.props.onDoubleTap) {\n return (\n <UIPreferencesConsumer>\n {(preferences: UI_PREFERENCES) => {\n return preferences.enableRipple != false ? (\n <ParentTappableContext.Consumer>{(parent) => {\n this.setParent(parent);\n return( <ParentTappableContext.Provider value={this}>\n <TouchableRipple rippleColor={this.props.rippleColor} borderless={true} {...commonProps}>\n <>{this.props.children}</>\n </TouchableRipple>\n </ParentTappableContext.Provider>)}}</ParentTappableContext.Consumer>): (\n <TouchableOpacity {...commonProps}>\n <>{this.props.children}</>\n </TouchableOpacity>);\n }}\n </UIPreferencesConsumer>\n );\n }\n return (<View style={this.props.styles}>{this.props.children}</View>);\n }\n}\n"],"mappings":";;;;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAgCC,QAAQ,EAAEC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AACtF,SAASC,GAAG,QAAQ,QAAQ;AAC5B,OAAOC,QAAQ,MAAM,YAAY;AACjC,SAASC,eAAe,QAAQ,oBAAoB;AAIpD,OAAO,MAAMC,eAAe,gBAAGP,KAAK,CAACQ,aAAa,CAAW,IAAW,CAAC;AACzE,SAASC,qBAAqB,QAAwB,0BAA0B;AAEhF,OAAO,MAAMC,qBAAqB,gBAAGV,KAAK,CAACQ,aAAa,CAAW,IAAW,CAAC;AAe/E,OAAO,MAAMG,cAAc,CAAC;EAIxBC,WAAWA,CAAA,EAAG;IAHd;IAAAC,eAAA,6BACqB,IAAI;EAIzB;EAEAC,eAAeA,CAAA,EAAG;IACd,IAAI,CAACC,kBAAkB,GAAG,KAAK;EACnC;AACJ;AAEA,OAAO,MAA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I,CAACzC,KAAK,CAAC0C;IAAO,GAAE,IAAI,CAAC1C,KAAK,CAAC0D,QAAe,CAAC;EACxE;AACJ","ignoreList":[]}
|
app-rn-runtime/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wavemaker/app-rn-runtime",
|
3
|
-
"version": "12.0.0-next.
|
3
|
+
"version": "12.0.0-next.141174",
|
4
4
|
"description": "''",
|
5
5
|
"main": "index",
|
6
6
|
"module": "index",
|
@@ -50,7 +50,7 @@
|
|
50
50
|
"@react-navigation/drawer": "6.6.3",
|
51
51
|
"@react-navigation/native": "6.1.7",
|
52
52
|
"@react-navigation/stack": "6.3.29",
|
53
|
-
"@wavemaker/variables": "12.0.0-next.
|
53
|
+
"@wavemaker/variables": "12.0.0-next.141174",
|
54
54
|
"axios": "1.6.8",
|
55
55
|
"color": "4.2.3",
|
56
56
|
"cross-env": "7.0.3",
|
@@ -141,7 +141,7 @@
|
|
141
141
|
"typescript": "5.1.3",
|
142
142
|
"victory-native": "36.6.11",
|
143
143
|
"yargs": "16.2.0",
|
144
|
-
"@wavemaker/variables": "12.0.0-next.
|
144
|
+
"@wavemaker/variables": "12.0.0-next.141174"
|
145
145
|
},
|
146
146
|
"jest": {
|
147
147
|
"preset": "jest-expo",
|
@@ -20,6 +20,9 @@ export default class BasePartial extends BaseFragment {
|
|
20
20
|
this.watcher = props.parentWatcher.create();
|
21
21
|
}
|
22
22
|
onFragmentReady() {
|
23
|
+
if (this.props.invokeVariables === false) {
|
24
|
+
return Promise.resolve();
|
25
|
+
}
|
23
26
|
return super.onFragmentReady().then(() => {
|
24
27
|
this.onContentReady();
|
25
28
|
this.invokeEventCallback('onLoad', [this]);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["WmPartial","BaseFragment","BasePartial","constructor","props","_defineProperty","isPartOfPrefab","prefab","App","appConfig","app","Actions","Object","assign","Variables","serviceDefinitions","Prefab","baseUrl","watcher","parentWatcher","create","onFragmentReady","then","onContentReady","invokeEventCallback","prefabname","_this$Prefab","onComponentInit","w","targetWidget","onComponentDestroy","parent","Widgets","componentDidUpdate","prevProps","prevState","snapshot","pageParams","partialParams","fragmentVariables","renderWidget","renderPartial"],"sources":["base-partial.component.tsx"],"sourcesContent":["import React from 'react';\nimport { BaseComponent } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmPartial from '@wavemaker/app-rn-runtime/components/page/partial/partial.component';\nimport BaseFragment, { FragmentProps, FragmentState } from './base-fragment.component';\nimport { ReactNode } from 'react';\nimport BasePrefab from './base-prefab.component';\nimport { Watcher } from './watcher';\nimport { View } from 'react-native';\nimport WmLottie from '../components/basic/lottie/lottie.component';\n\nexport interface PartialProps extends FragmentProps {\n serviceDefinitions: any;\n prefab: any;\n parent: any;\n onLoad?: Function;\n parentWatcher: Watcher;\n}\n\nexport interface PartialState extends FragmentState<PartialProps> {}\n\nexport default abstract class BasePartial extends BaseFragment<PartialProps, PartialState> {\n private partialParams: any = {};\n Prefab: BasePrefab = null as any;\n\n constructor(props: PartialProps) {\n super(props);\n const isPartOfPrefab = !!this.props.prefab;\n this.App = this.appConfig.app;\n this.Actions = Object.assign({}, isPartOfPrefab ? {} : this.App.Actions);\n this.Variables = Object.assign({}, isPartOfPrefab ? {} : this.App.Variables);\n this.serviceDefinitions = this.props.serviceDefinitions;\n if (isPartOfPrefab) {\n this.Prefab = this.props.prefab;\n this.baseUrl =this.Prefab.baseUrl;\n }\n this.watcher = props.parentWatcher.create();\n }\n\n onFragmentReady() {\n return super.onFragmentReady().then(() => {\n this.onContentReady();\n this.invokeEventCallback('onLoad', [this]);\n });\n }\n\n get prefabname() {\n return this.Prefab?.props.prefabname;\n }\n\n onComponentInit(w: BaseComponent<any, any, any>) {\n super.onComponentInit(w);\n if (w instanceof WmPartial) {\n this.targetWidget = w;\n }\n }\n\n onComponentDestroy(w: BaseComponent<any, any, any>): void {\n super.onComponentDestroy(w);\n const parent: any = this.props.parent;\n if (parent) {\n delete (parent as any).Widgets;\n delete (parent as any).Variables;\n }\n }\n\n componentDidUpdate(prevProps: Readonly<PartialProps>, prevState: Readonly<PartialState>, snapshot?: any): void {\n super.componentDidUpdate(prevProps, prevState, snapshot);\n const parent: any = this.props.parent;\n if (parent) {\n parent.pageParams = (this as any).pageParams;\n parent.partialParams = (this as any).pageParams;\n parent.Widgets = this.Widgets;\n parent.Variables = this.fragmentVariables;\n }\n }\n \n abstract renderPartial(): ReactNode;\n\n renderWidget(props: PartialProps) {\n return this.renderPartial();\n }\n}\n"],"mappings":";;;AAEA,OAAOA,SAAS,MAAM,qEAAqE;AAC3F,OAAOC,YAAY,MAAwC,2BAA2B;
|
1
|
+
{"version":3,"names":["WmPartial","BaseFragment","BasePartial","constructor","props","_defineProperty","isPartOfPrefab","prefab","App","appConfig","app","Actions","Object","assign","Variables","serviceDefinitions","Prefab","baseUrl","watcher","parentWatcher","create","onFragmentReady","invokeVariables","Promise","resolve","then","onContentReady","invokeEventCallback","prefabname","_this$Prefab","onComponentInit","w","targetWidget","onComponentDestroy","parent","Widgets","componentDidUpdate","prevProps","prevState","snapshot","pageParams","partialParams","fragmentVariables","renderWidget","renderPartial"],"sources":["base-partial.component.tsx"],"sourcesContent":["import React from 'react';\nimport { BaseComponent } from '@wavemaker/app-rn-runtime/core/base.component';\nimport WmPartial from '@wavemaker/app-rn-runtime/components/page/partial/partial.component';\nimport BaseFragment, { FragmentProps, FragmentState } from './base-fragment.component';\nimport { ReactNode } from 'react';\nimport BasePrefab from './base-prefab.component';\nimport { Watcher } from './watcher';\nimport { View } from 'react-native';\nimport WmLottie from '../components/basic/lottie/lottie.component';\n\nexport interface PartialProps extends FragmentProps {\n serviceDefinitions: any;\n prefab: any;\n parent: any;\n onLoad?: Function;\n parentWatcher: Watcher;\n invokeVariables: boolean;\n}\n\nexport interface PartialState extends FragmentState<PartialProps> {}\n\nexport default abstract class BasePartial extends BaseFragment<PartialProps, PartialState> {\n private partialParams: any = {};\n Prefab: BasePrefab = null as any;\n\n constructor(props: PartialProps) {\n super(props);\n const isPartOfPrefab = !!this.props.prefab;\n this.App = this.appConfig.app;\n this.Actions = Object.assign({}, isPartOfPrefab ? {} : this.App.Actions);\n this.Variables = Object.assign({}, isPartOfPrefab ? {} : this.App.Variables);\n this.serviceDefinitions = this.props.serviceDefinitions;\n if (isPartOfPrefab) {\n this.Prefab = this.props.prefab;\n this.baseUrl =this.Prefab.baseUrl;\n }\n this.watcher = props.parentWatcher.create();\n }\n\n onFragmentReady() {\n if(this.props.invokeVariables === false) {\n return Promise.resolve();\n }\n return super.onFragmentReady().then(() => {\n this.onContentReady();\n this.invokeEventCallback('onLoad', [this]);\n });\n }\n\n get prefabname() {\n return this.Prefab?.props.prefabname;\n }\n\n onComponentInit(w: BaseComponent<any, any, any>) {\n super.onComponentInit(w);\n if (w instanceof WmPartial) {\n this.targetWidget = w;\n }\n }\n\n onComponentDestroy(w: BaseComponent<any, any, any>): void {\n super.onComponentDestroy(w);\n const parent: any = this.props.parent;\n if (parent) {\n delete (parent as any).Widgets;\n delete (parent as any).Variables;\n }\n }\n\n componentDidUpdate(prevProps: Readonly<PartialProps>, prevState: Readonly<PartialState>, snapshot?: any): void {\n super.componentDidUpdate(prevProps, prevState, snapshot);\n const parent: any = this.props.parent;\n if (parent) {\n parent.pageParams = (this as any).pageParams;\n parent.partialParams = (this as any).pageParams;\n parent.Widgets = this.Widgets;\n parent.Variables = this.fragmentVariables;\n }\n }\n \n abstract renderPartial(): ReactNode;\n\n renderWidget(props: PartialProps) {\n return this.renderPartial();\n }\n}\n"],"mappings":";;;AAEA,OAAOA,SAAS,MAAM,qEAAqE;AAC3F,OAAOC,YAAY,MAAwC,2BAA2B;AAkBtF,eAAe,MAAeC,WAAW,SAASD,YAAY,CAA6B;EAIvFE,WAAWA,CAACC,KAAmB,EAAE;IAC7B,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,wBAJY,CAAC,CAAC;IAAAA,eAAA,iBACV,IAAI;IAIrB,MAAMC,cAAc,GAA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AAe,CAACC,CAAC,CAAC;IACxB,IAAIA,CAAC,YAAY/B,SAAS,EAAE;MAC1B,IAAI,CAACgC,YAAY,GAAGD,CAAC;IACvB;EACF;EAEAE,kBAAkBA,CAACF,CAA+B,EAAQ;IACxD,KAAK,CAACE,kBAAkB,CAACF,CAAC,CAAC;IAC3B,MAAMG,MAAW,GAAG,IAAI,CAAC9B,KAAK,CAAC8B,MAAM;IACrC,IAAIA,MAAM,EAAE;MACV,OAAQA,MAAM,CAASC,OAAO;MAC9B,OAAQD,MAAM,CAASpB,SAAS;IAClC;EACF;EAEAsB,kBAAkBA,CAACC,SAAiC,EAAEC,SAAiC,EAAEC,QAAc,EAAQ;IAC7G,KAAK,CAACH,kBAAkB,CAACC,SAAS,EAAEC,SAAS,EAAEC,QAAQ,CAAC;IACxD,MAAML,MAAW,GAAG,IAAI,CAAC9B,KAAK,CAAC8B,MAAM;IACrC,IAAIA,MAAM,EAAE;MACVA,MAAM,CAACM,UAAU,GAAI,IAAI,CAASA,UAAU;MAC5CN,MAAM,CAACO,aAAa,GAAK,IAAI,CAASD,UAAU;MAChDN,MAAM,CAACC,OAAO,GAAG,IAAI,CAACA,OAAO;MAC7BD,MAAM,CAACpB,SAAS,GAAG,IAAI,CAAC4B,iBAAiB;IAC3C;EACF;EAIAC,YAAYA,CAACvC,KAAmB,EAAE;IAChC,OAAO,IAAI,CAACwC,aAAa,CAAC,CAAC;EAC7B;AACJ","ignoreList":[]}
|
@@ -198,8 +198,15 @@ class AppSecurityService {
|
|
198
198
|
}).catch(() => {}).then(response => {
|
199
199
|
var _response$data;
|
200
200
|
if (response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && _response$data.result) {
|
201
|
-
|
202
|
-
|
201
|
+
if (isWebPreviewMode()) {
|
202
|
+
location.href = response.data.result;
|
203
|
+
return new Promise(r => setTimeout(r, 5000));
|
204
|
+
} else {
|
205
|
+
var _response$data2;
|
206
|
+
return axios.get(`${response === null || response === void 0 || (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.result}`, {
|
207
|
+
withCredentials: true
|
208
|
+
});
|
209
|
+
}
|
203
210
|
}
|
204
211
|
return Promise.reject();
|
205
212
|
}).catch(e => {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["Platform","axios","each","includes","networkService","injector","StorageService","WebProcessService","isWebPreviewMode","USER_ROLE","authCookieStr","XSRF_COOKIE_NAME","xsrf_header_name","AppSecurityService","constructor","_defineProperty","str","wm_xsrf_token_index","indexOf","index","regExp","substring","RegExp","data","regex","getRegex","JSON","parse","replace","interceptors","request","use","config","onBeforeServiceCall","appConfig","getAppConfig","baseUrl","url","getXsrfToken","then","token","_config$url","startsWith","headers","Promise","resolve","getItem","xsrf_token","get","navigateToLandingPage","_this$appConfig$curre","_this$appConfig$logge","currentPage","goToPage","loggedInUser","landingPage","setTimeout","_this$appConfig$curre2","openUrl","appLogin","options","payload","formData","value","name","encodeURIComponent","defaults","withCredentials","post","baseURL","response","xsrfCookieValue","setItem","isLoggedIn","load","userData","getLoggedInUserDetails","useDefaultSuccessHandler","app","triggerStartUpVariables","_document","document","cookie","split","filter","item","length","wm_xsrf_token","isConnected","getServiceDefinitions","defaultSecurityConfig","details","securityConfig","isSecurityEnabled","securityEnabled","authenticated","_appConfig$appPropert","isAuthenticated","roles","userInfo","userRoles","userName","id","userId","tenantId","userAttributes","dataSet","appProperties","homePage","redirectToLogin","redirectTo","_this$securityConfig","loginConfig","type","authUrl","OS","window","parent","location","href","execute","output","formateData","reject","refresh","_this$securityConfig$","_this$appConfig$curre3","loginPage","pageName","appLogout","catch","_response$data","result","_response$data2","e","console","error","canUserAccessPage","_this$securityConfig2","res","status","matchRoles","widgetRoles","some","hasAccessToWidget","_this$loggedInUser$da","_this$loggedInUser$da2","_this$loggedInUser$da3","_this$loggedInUser$da4","widgetRolesArr","EVERYONE","ANONYMOUS","AUTHENTICATED","appSecurityService"],"sources":["app-security.service.tsx"],"sourcesContent":["import { Platform } from 'react-native';\nimport axios, { InternalAxiosRequestConfig, AxiosResponse } from 'axios';\nimport { each, includes } from 'lodash';\n\nimport networkService from '@wavemaker/app-rn-runtime/core/network.service';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\nimport StorageService from '@wavemaker/app-rn-runtime/core/storage.service';\nimport { SecurityService } from '@wavemaker/app-rn-runtime/core/security.service';\n\nimport WebProcessService from './webprocess.service';\nimport { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\n\ndeclare const window: any;\n\ninterface LoggedInUserConfig {\n isAuthenticated: Boolean;\n isSecurityEnabled: Boolean;\n roles: Array<string>;\n name: String;\n id: String;\n tenantId: String;\n userAttributes: any;\n landingPage: string;\n}\n\nenum USER_ROLE {\n EVERYONE = 'Everyone',\n ANONYMOUS = 'Anonymous',\n AUTHENTICATED = 'Authenticated'\n}\n\nconst authCookieStr = 'AUTH_COOKIE';\nconst XSRF_COOKIE_NAME = 'wm_xsrf_token';\nconst xsrf_header_name = 'X-WM-XSRF-TOKEN';\n\nclass AppSecurityService implements SecurityService {\n\n securityConfig: any;\n isLoggedIn = false;\n loggedInUser: any = {};\n token: any;\n appConfig: any;\n baseUrl: string = '';\n defaultSecurityConfig: any;\n landingPage = '';\n\n constructor() {\n axios.interceptors.request.use((config: InternalAxiosRequestConfig) => this.onBeforeServiceCall(config));\n }\n\n getRegex = (str: string) =>{\n const wm_xsrf_token_index = str.indexOf('wm_xsrf_token') + 13; // 13 is the length of 'wm_xsrf_token' string\n let index = wm_xsrf_token_index;\n\n while(str[index] !== ':'){\n index++;\n }\n \n const regExp = str.substring(wm_xsrf_token_index, index);\n return new RegExp(regExp, \"g\");\n }\n \n formateData = (data: string) => {\n const regex = this.getRegex(data)\n return JSON.parse(data.replace(regex, \"\\\"\"));\n }\n\n onBeforeServiceCall(config: InternalAxiosRequestConfig) {\n if (!this.appConfig) {\n this.appConfig = this.getAppConfig();\n this.baseUrl = this.appConfig.url;\n }\n return this.getXsrfToken().then((token: string) => {\n if (config.url?.startsWith(this.baseUrl) && token) {\n if(config.headers) config.headers[xsrf_header_name] = token;\n }\n return config\n });\n }\n\n private getXsrfToken(): Promise<string> {\n if (this.token) {\n return Promise.resolve(this.token);\n }\n return StorageService.getItem(XSRF_COOKIE_NAME).then(xsrf_token => {\n this.token = xsrf_token;\n return this.token;\n });\n }\n\n private getAppConfig() {\n return injector.get<AppConfig>('APP_CONFIG');\n }\n\n public navigateToLandingPage() {\n this.appConfig.currentPage?.goToPage(\n this.appConfig.loggedInUser?.landingPage \n || this.appConfig.landingPage \n || 'Main', null, true);\n if (this.landingPage) {\n const landingPage = this.landingPage;\n this.landingPage = '';\n setTimeout(() => {\n this.appConfig.currentPage?.openUrl(landingPage);\n }, 100);\n }\n }\n\n public appLogin(options: any) {\n // encode all parameters\n let payload = '';\n each(options.formData, function (value, name) {\n payload += (payload ? '&' : '') + encodeURIComponent(name) + '=' + encodeURIComponent(value);\n });\n axios.defaults.withCredentials = true;\n return axios.post(options.baseURL + '/j_spring_security_check', payload, {\n withCredentials: true,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded'\n }}).then((response: AxiosResponse) => {\n const xsrfCookieValue = response.data ? response.data[XSRF_COOKIE_NAME] : '';\n this.token = xsrfCookieValue;\n StorageService.setItem(XSRF_COOKIE_NAME, xsrfCookieValue);\n this.isLoggedIn = true;\n }).then(() => this.load(options.baseURL))\n .then(async () => {\n const userData = await this.getLoggedInUserDetails(options.baseURL, options.useDefaultSuccessHandler);\n await this.appConfig.app.triggerStartUpVariables();\n return userData;\n });\n }\n\n public load(baseURL: string) {\n if (isWebPreviewMode()) {\n const token = document?.cookie?.split(';').filter(item => item.includes('wm_xsrf_token'))\n if (token && token.length > 0) {\n const wm_xsrf_token = token[0].split('=')[1];\n wm_xsrf_token && StorageService.setItem(XSRF_COOKIE_NAME, wm_xsrf_token);\n }\n }\n\n return Promise.resolve().then(() => {\n if (networkService.isConnected()) {\n return axios.get(baseURL + '/services/security/info')\n .then((response: AxiosResponse) => response.data);\n }\n return this.appConfig.getServiceDefinitions(this.appConfig.url)\n .then(() => Promise.resolve(this.defaultSecurityConfig));\n }).then((details: any) => {\n const loggedInUser = {} as LoggedInUserConfig;\n this.securityConfig = details || {};\n this.securityConfig.isSecurityEnabled = !!details?.securityEnabled;\n const appConfig = this.appConfig;\n if (typeof details !== 'string' && (!details.securityEnabled || details.authenticated)) {\n if (details.authenticated) {\n loggedInUser.isAuthenticated = details.authenticated;\n loggedInUser.isSecurityEnabled = details.authenticated;\n loggedInUser.roles = details.userInfo.userRoles;\n loggedInUser.name = details.userInfo.userName;\n loggedInUser.id = details.userInfo.userId;\n loggedInUser.tenantId = details.userInfo.tenantId;\n loggedInUser.userAttributes = details.userInfo.userAttributes;\n loggedInUser.landingPage = details.userInfo.landingPage;\n appConfig.loggedInUser = loggedInUser;\n this.loggedInUser.dataSet = loggedInUser;\n appConfig.landingPage = appConfig.appProperties?.homePage;\n }\n return appConfig.getServiceDefinitions(appConfig.url)\n .then(() => {\n return details;\n });\n } else {\n return appConfig.getServiceDefinitions(appConfig.url)\n .then(() => {\n this.redirectToLogin();\n });\n }\n });\n }\n\n private getLoggedInUserDetails(baseURL: string, useDefaultSuccessHandler: boolean = true) {\n if (!baseURL) {\n this.loggedInUser = {};\n return Promise.resolve({});\n }\n return this.load(baseURL);\n }\n\n \n public redirectToLogin(redirectTo?: string) {\n if (this.securityConfig?.loginConfig?.type === 'SSO') {\n const authUrl = this.appConfig.url + '/services/security/ssologin';\n if (Platform.OS === 'web') {\n (window.parent || window).location.href = authUrl;\n } else {\n setTimeout(() => {\n WebProcessService.execute('LOGIN', '/services/security/ssologin', false, true)\n .then((output: any) => {\n if (output) {\n if(output.data){\n return this.formateData(`${output.data}`);\n }\n }\n return Promise.reject();\n }).then((output: any) => {\n if (output[XSRF_COOKIE_NAME]) {\n this.token = output[XSRF_COOKIE_NAME];\n StorageService.setItem(XSRF_COOKIE_NAME, output[XSRF_COOKIE_NAME]);\n }\n }).then(() => {\n this.appConfig.refresh(true);\n }).then(() => this.load(this.baseUrl)).then(() => {\n return this.getLoggedInUserDetails(this.baseUrl);\n });\n }, 1000);\n }\n } else {\n const loginPage = this.securityConfig.loginConfig?.pageName || 'Login';\n if (redirectTo && !redirectTo.startsWith('#/'+ loginPage)) {\n this.landingPage = redirectTo;\n }\n injector.get<AppConfig>('APP_CONFIG').landingPage = loginPage;\n this.appConfig.currentPage?.goToPage(loginPage, null, true);\n }\n this.appConfig.refresh();\n }\n\n public appLogout(options: any) {\n return axios.post(options.baseURL + '/j_spring_security_logout', null, {\n withCredentials: true\n })\n .catch(() => {})\n .then((response) => {\n if(response?.data?.result){\n return axios.get(`${response?.data?.result}`);\n }\n return Promise.reject();\n })\n .catch((e) => {\n console.error(e);\n })\n .then(()=>{\n this.isLoggedIn = false;\n this.redirectToLogin();\n });\n }\n\n public canUserAccessPage(pageName: string) {\n if (this.baseUrl && this.securityConfig?.isSecurityEnabled) {\n return axios.get(this.baseUrl + `/pages/${pageName}/${pageName}.html`)\n .catch((res) => res)\n .then((res) => res.status === 200 || res.status === 304); \n } else {\n return Promise.resolve(true);\n }\n }\n\n private matchRoles(widgetRoles: Array<String>, userRoles: Array<String>) {\n return widgetRoles.some(function (item) {\n return includes(userRoles, item);\n });\n }\n\n public hasAccessToWidget(widgetRoles: String) {\n const widgetRolesArr = widgetRoles.split(',');\n // access the widget when 'Everyone' is chosen\n if (includes(widgetRolesArr, USER_ROLE.EVERYONE)) {\n return true;\n }\n\n // access the widget when 'Anonymous' is chosen and user is not authenticated\n if (includes(widgetRolesArr, USER_ROLE.ANONYMOUS) && !this.loggedInUser.dataSet?.isAuthenticated) {\n return true;\n }\n\n // access the widget when 'Only Authenticated Users' is chosen and user is authenticated\n if (includes(widgetRolesArr, USER_ROLE.AUTHENTICATED) && this.loggedInUser.dataSet?.isAuthenticated) {\n return true;\n }\n\n // access the widget when widget role and logged in user role matches\n return this.loggedInUser.dataSet?.isAuthenticated && this.matchRoles(widgetRolesArr, this.loggedInUser.dataSet?.roles);\n }\n}\n\nconst appSecurityService = new AppSecurityService();\n\nexport default appSecurityService;\n"],"mappings":";;;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,KAAK,MAAqD,OAAO;AACxE,SAASC,IAAI,EAAEC,QAAQ,QAAQ,QAAQ;AAEvC,OAAOC,cAAc,MAAM,gDAAgD;AAC3E,OAAOC,QAAQ,MAAM,yCAAyC;AAE9D,OAAOC,cAAc,MAAM,gDAAgD;AAG3E,OAAOC,iBAAiB,MAAM,sBAAsB;AACpD,SAASC,gBAAgB,QAAQ,sCAAsC;AAAC,IAenEC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA,EAATA,SAAS;AAMd,MAAMC,aAAa,GAAG,aAAa;AACnC,MAAMC,gBAAgB,GAAG,eAAe;AACxC,MAAMC,gBAAgB,GAAG,iBAAiB;AAE1C,MAAMC,kBAAkB,CAA4B;EAWhDC,WAAWA,CAAA,EAAG;IAAAC,eAAA;IAAAA,eAAA,qBARD,KAAK;IAAAA,eAAA,uBACE,CAAC,CAAC;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,kBAGJ,EAAE;IAAAA,eAAA;IAAAA,eAAA,sBAEN,EAAE;IAAAA,eAAA,mBAMJC,GAAW,IAAI;MACzB,MAAMC,mBAAmB,GAAGD,GAAG,CAACE,OAAO,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAE;MAChE,IAAIC,KAAK,GAAGF,mBAAmB;MAE/B,OAAMD,GAAG,CAACG,KAAK,CAAC,KAAK,GAAG,EAAC;QACvBA,KAAK,EAAE;MACT;MAEA,MAAMC,MAAM,GAAGJ,GAAG,CAACK,SAAS,CAACJ,mBAAmB,EAAEE,KAAK,CAAC;MACxD,OAAO,IAAIG,MAAM,CAACF,MAAM,EAAE,GAAG,CAAC;IAChC,CAAC;IA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SAAS,CAAC8I,SAAS,CAAC,IAAI,GAAAN,qBAAA,GAAC,IAAI,CAAC3F,YAAY,CAACoD,OAAO,cAAAuC,qBAAA,eAAzBA,qBAAA,CAA2BhD,eAAe,GAAE;MAC9F,OAAO,IAAI;IACf;;IAEA;IACA,IAAI9F,QAAQ,CAACkJ,cAAc,EAAE5I,SAAS,CAAC+I,aAAa,CAAC,KAAAN,sBAAA,GAAI,IAAI,CAAC5F,YAAY,CAACoD,OAAO,cAAAwC,sBAAA,eAAzBA,sBAAA,CAA2BjD,eAAe,EAAE;MACjG,OAAO,IAAI;IACf;;IAEA;IACA,OAAO,EAAAkD,sBAAA,OAAI,CAAC7F,YAAY,CAACoD,OAAO,cAAAyC,sBAAA,uBAAzBA,sBAAA,CAA2BlD,eAAe,KAAI,IAAI,CAAC4C,UAAU,CAACQ,cAAc,GAAAD,sBAAA,GAAE,IAAI,CAAC9F,YAAY,CAACoD,OAAO,cAAA0C,sBAAA,uBAAzBA,sBAAA,CAA2BlD,KAAK,CAAC;EAC1H;AACJ;AAEA,MAAMuD,kBAAkB,GAAG,IAAI5I,kBAAkB,CAAC,CAAC;AAEnD,eAAe4I,kBAAkB","ignoreList":[]}
|
1
|
+
{"version":3,"names":["Platform","axios","each","includes","networkService","injector","StorageService","WebProcessService","isWebPreviewMode","USER_ROLE","authCookieStr","XSRF_COOKIE_NAME","xsrf_header_name","AppSecurityService","constructor","_defineProperty","str","wm_xsrf_token_index","indexOf","index","regExp","substring","RegExp","data","regex","getRegex","JSON","parse","replace","interceptors","request","use","config","onBeforeServiceCall","appConfig","getAppConfig","baseUrl","url","getXsrfToken","then","token","_config$url","startsWith","headers","Promise","resolve","getItem","xsrf_token","get","navigateToLandingPage","_this$appConfig$curre","_this$appConfig$logge","currentPage","goToPage","loggedInUser","landingPage","setTimeout","_this$appConfig$curre2","openUrl","appLogin","options","payload","formData","value","name","encodeURIComponent","defaults","withCredentials","post","baseURL","response","xsrfCookieValue","setItem","isLoggedIn","load","userData","getLoggedInUserDetails","useDefaultSuccessHandler","app","triggerStartUpVariables","_document","document","cookie","split","filter","item","length","wm_xsrf_token","isConnected","getServiceDefinitions","defaultSecurityConfig","details","securityConfig","isSecurityEnabled","securityEnabled","authenticated","_appConfig$appPropert","isAuthenticated","roles","userInfo","userRoles","userName","id","userId","tenantId","userAttributes","dataSet","appProperties","homePage","redirectToLogin","redirectTo","_this$securityConfig","loginConfig","type","authUrl","OS","window","parent","location","href","execute","output","formateData","reject","refresh","_this$securityConfig$","_this$appConfig$curre3","loginPage","pageName","appLogout","catch","_response$data","result","r","_response$data2","e","console","error","canUserAccessPage","_this$securityConfig2","res","status","matchRoles","widgetRoles","some","hasAccessToWidget","_this$loggedInUser$da","_this$loggedInUser$da2","_this$loggedInUser$da3","_this$loggedInUser$da4","widgetRolesArr","EVERYONE","ANONYMOUS","AUTHENTICATED","appSecurityService"],"sources":["app-security.service.tsx"],"sourcesContent":["import { Platform } from 'react-native';\nimport axios, { InternalAxiosRequestConfig, AxiosResponse } from 'axios';\nimport { each, includes } from 'lodash';\n\nimport networkService from '@wavemaker/app-rn-runtime/core/network.service';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\nimport StorageService from '@wavemaker/app-rn-runtime/core/storage.service';\nimport { SecurityService } from '@wavemaker/app-rn-runtime/core/security.service';\n\nimport WebProcessService from './webprocess.service';\nimport { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\n\ndeclare const window: any;\n\ninterface LoggedInUserConfig {\n isAuthenticated: Boolean;\n isSecurityEnabled: Boolean;\n roles: Array<string>;\n name: String;\n id: String;\n tenantId: String;\n userAttributes: any;\n landingPage: string;\n}\n\nenum USER_ROLE {\n EVERYONE = 'Everyone',\n ANONYMOUS = 'Anonymous',\n AUTHENTICATED = 'Authenticated'\n}\n\nconst authCookieStr = 'AUTH_COOKIE';\nconst XSRF_COOKIE_NAME = 'wm_xsrf_token';\nconst xsrf_header_name = 'X-WM-XSRF-TOKEN';\n\nclass AppSecurityService implements SecurityService {\n\n securityConfig: any;\n isLoggedIn = false;\n loggedInUser: any = {};\n token: any;\n appConfig: any;\n baseUrl: string = '';\n defaultSecurityConfig: any;\n landingPage = '';\n\n constructor() {\n axios.interceptors.request.use((config: InternalAxiosRequestConfig) => this.onBeforeServiceCall(config));\n }\n\n getRegex = (str: string) =>{\n const wm_xsrf_token_index = str.indexOf('wm_xsrf_token') + 13; // 13 is the length of 'wm_xsrf_token' string\n let index = wm_xsrf_token_index;\n\n while(str[index] !== ':'){\n index++;\n }\n \n const regExp = str.substring(wm_xsrf_token_index, index);\n return new RegExp(regExp, \"g\");\n }\n \n formateData = (data: string) => {\n const regex = this.getRegex(data)\n return JSON.parse(data.replace(regex, \"\\\"\"));\n }\n\n onBeforeServiceCall(config: InternalAxiosRequestConfig) {\n if (!this.appConfig) {\n this.appConfig = this.getAppConfig();\n this.baseUrl = this.appConfig.url;\n }\n return this.getXsrfToken().then((token: string) => {\n if (config.url?.startsWith(this.baseUrl) && token) {\n if(config.headers) config.headers[xsrf_header_name] = token;\n }\n return config\n });\n }\n\n private getXsrfToken(): Promise<string> {\n if (this.token) {\n return Promise.resolve(this.token);\n }\n return StorageService.getItem(XSRF_COOKIE_NAME).then(xsrf_token => {\n this.token = xsrf_token;\n return this.token;\n });\n }\n\n private getAppConfig() {\n return injector.get<AppConfig>('APP_CONFIG');\n }\n\n public navigateToLandingPage() {\n this.appConfig.currentPage?.goToPage(\n this.appConfig.loggedInUser?.landingPage \n || this.appConfig.landingPage \n || 'Main', null, true);\n if (this.landingPage) {\n const landingPage = this.landingPage;\n this.landingPage = '';\n setTimeout(() => {\n this.appConfig.currentPage?.openUrl(landingPage);\n }, 100);\n }\n }\n\n public appLogin(options: any) {\n // encode all parameters\n let payload = '';\n each(options.formData, function (value, name) {\n payload += (payload ? '&' : '') + encodeURIComponent(name) + '=' + encodeURIComponent(value);\n });\n axios.defaults.withCredentials = true;\n return axios.post(options.baseURL + '/j_spring_security_check', payload, {\n withCredentials: true,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded'\n }}).then((response: AxiosResponse) => {\n const xsrfCookieValue = response.data ? response.data[XSRF_COOKIE_NAME] : '';\n this.token = xsrfCookieValue;\n StorageService.setItem(XSRF_COOKIE_NAME, xsrfCookieValue);\n this.isLoggedIn = true;\n }).then(() => this.load(options.baseURL))\n .then(async () => {\n const userData = await this.getLoggedInUserDetails(options.baseURL, options.useDefaultSuccessHandler);\n await this.appConfig.app.triggerStartUpVariables();\n return userData;\n });\n }\n\n public load(baseURL: string) {\n if (isWebPreviewMode()) {\n const token = document?.cookie?.split(';').filter(item => item.includes('wm_xsrf_token'))\n if (token && token.length > 0) {\n const wm_xsrf_token = token[0].split('=')[1];\n wm_xsrf_token && StorageService.setItem(XSRF_COOKIE_NAME, wm_xsrf_token);\n }\n }\n\n return Promise.resolve().then(() => {\n if (networkService.isConnected()) {\n return axios.get(baseURL + '/services/security/info')\n .then((response: AxiosResponse) => response.data);\n }\n return this.appConfig.getServiceDefinitions(this.appConfig.url)\n .then(() => Promise.resolve(this.defaultSecurityConfig));\n }).then((details: any) => {\n const loggedInUser = {} as LoggedInUserConfig;\n this.securityConfig = details || {};\n this.securityConfig.isSecurityEnabled = !!details?.securityEnabled;\n const appConfig = this.appConfig;\n if (typeof details !== 'string' && (!details.securityEnabled || details.authenticated)) {\n if (details.authenticated) {\n loggedInUser.isAuthenticated = details.authenticated;\n loggedInUser.isSecurityEnabled = details.authenticated;\n loggedInUser.roles = details.userInfo.userRoles;\n loggedInUser.name = details.userInfo.userName;\n loggedInUser.id = details.userInfo.userId;\n loggedInUser.tenantId = details.userInfo.tenantId;\n loggedInUser.userAttributes = details.userInfo.userAttributes;\n loggedInUser.landingPage = details.userInfo.landingPage;\n appConfig.loggedInUser = loggedInUser;\n this.loggedInUser.dataSet = loggedInUser;\n appConfig.landingPage = appConfig.appProperties?.homePage;\n }\n return appConfig.getServiceDefinitions(appConfig.url)\n .then(() => {\n return details;\n });\n } else {\n return appConfig.getServiceDefinitions(appConfig.url)\n .then(() => {\n this.redirectToLogin();\n });\n }\n });\n }\n\n private getLoggedInUserDetails(baseURL: string, useDefaultSuccessHandler: boolean = true) {\n if (!baseURL) {\n this.loggedInUser = {};\n return Promise.resolve({});\n }\n return this.load(baseURL);\n }\n\n \n public redirectToLogin(redirectTo?: string) {\n if (this.securityConfig?.loginConfig?.type === 'SSO') {\n const authUrl = this.appConfig.url + '/services/security/ssologin';\n if (Platform.OS === 'web') {\n (window.parent || window).location.href = authUrl;\n } else {\n setTimeout(() => {\n WebProcessService.execute('LOGIN', '/services/security/ssologin', false, true)\n .then((output: any) => {\n if (output) {\n if(output.data){\n return this.formateData(`${output.data}`);\n }\n }\n return Promise.reject();\n }).then((output: any) => {\n if (output[XSRF_COOKIE_NAME]) {\n this.token = output[XSRF_COOKIE_NAME];\n StorageService.setItem(XSRF_COOKIE_NAME, output[XSRF_COOKIE_NAME]);\n }\n }).then(() => {\n this.appConfig.refresh(true);\n }).then(() => this.load(this.baseUrl)).then(() => {\n return this.getLoggedInUserDetails(this.baseUrl);\n });\n }, 1000);\n }\n } else {\n const loginPage = this.securityConfig.loginConfig?.pageName || 'Login';\n if (redirectTo && !redirectTo.startsWith('#/'+ loginPage)) {\n this.landingPage = redirectTo;\n }\n injector.get<AppConfig>('APP_CONFIG').landingPage = loginPage;\n this.appConfig.currentPage?.goToPage(loginPage, null, true);\n }\n this.appConfig.refresh();\n }\n\n public appLogout(options: any) {\n return axios.post(options.baseURL + '/j_spring_security_logout', null, {\n withCredentials: true\n })\n .catch(() => {})\n .then((response) => {\n if(response?.data?.result){\n if (isWebPreviewMode()) {\n location.href = response.data.result;\n return new Promise(r => setTimeout(r, 5000));\n } else {\n return axios.get(`${response?.data?.result}`, {\n withCredentials: true,\n });\n }\n }\n return Promise.reject();\n })\n .catch((e) => {\n console.error(e);\n })\n .then(()=>{\n this.isLoggedIn = false;\n this.redirectToLogin();\n });\n }\n\n public canUserAccessPage(pageName: string) {\n if (this.baseUrl && this.securityConfig?.isSecurityEnabled) {\n return axios.get(this.baseUrl + `/pages/${pageName}/${pageName}.html`)\n .catch((res) => res)\n .then((res) => res.status === 200 || res.status === 304); \n } else {\n return Promise.resolve(true);\n }\n }\n\n private matchRoles(widgetRoles: Array<String>, userRoles: Array<String>) {\n return widgetRoles.some(function (item) {\n return includes(userRoles, item);\n });\n }\n\n public hasAccessToWidget(widgetRoles: String) {\n const widgetRolesArr = widgetRoles.split(',');\n // access the widget when 'Everyone' is chosen\n if (includes(widgetRolesArr, USER_ROLE.EVERYONE)) {\n return true;\n }\n\n // access the widget when 'Anonymous' is chosen and user is not authenticated\n if (includes(widgetRolesArr, USER_ROLE.ANONYMOUS) && !this.loggedInUser.dataSet?.isAuthenticated) {\n return true;\n }\n\n // access the widget when 'Only Authenticated Users' is chosen and user is authenticated\n if (includes(widgetRolesArr, USER_ROLE.AUTHENTICATED) && this.loggedInUser.dataSet?.isAuthenticated) {\n return true;\n }\n\n // access the widget when widget role and logged in user role matches\n return this.loggedInUser.dataSet?.isAuthenticated && this.matchRoles(widgetRolesArr, this.loggedInUser.dataSet?.roles);\n }\n}\n\nconst appSecurityService = new AppSecurityService();\n\nexport default appSecurityService;\n"],"mappings":";;;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,KAAK,MAAqD,OAAO;AACxE,SAASC,IAAI,EAAEC,QAAQ,QAAQ,QAAQ;AAEvC,OAAOC,cAAc,MAAM,gDAAgD;AAC3E,OAAOC,QAAQ,MAAM,yCAAyC;AAE9D,OAAOC,cAAc,MAAM,gDAAgD;AAG3E,OAAOC,iBAAiB,MAAM,sBAAsB;AACpD,SAASC,gBAAgB,QAAQ,sCAAsC;AAAC,IAenEC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA,EAATA,SAAS;AAMd,MAAMC,aAAa,GAAG,aAAa;AACnC,MAA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,cAAAyC,sBAAA,eAAzBA,sBAAA,CAA2BlD,eAAe,EAAE;MACjG,OAAO,IAAI;IACf;;IAEA;IACA,OAAO,EAAAmD,sBAAA,OAAI,CAAC9F,YAAY,CAACoD,OAAO,cAAA0C,sBAAA,uBAAzBA,sBAAA,CAA2BnD,eAAe,KAAI,IAAI,CAAC6C,UAAU,CAACQ,cAAc,GAAAD,sBAAA,GAAE,IAAI,CAAC/F,YAAY,CAACoD,OAAO,cAAA2C,sBAAA,uBAAzBA,sBAAA,CAA2BnD,KAAK,CAAC;EAC1H;AACJ;AAEA,MAAMwD,kBAAkB,GAAG,IAAI7I,kBAAkB,CAAC,CAAC;AAEnD,eAAe6I,kBAAkB","ignoreList":[]}
|
@@ -191,7 +191,7 @@ export default class ThemeVariables {
|
|
191
191
|
_defineProperty(this, "inputBorderColor", this.defaultColorD);
|
192
192
|
_defineProperty(this, "inputBackgroundColor", this.defaultColorF);
|
193
193
|
_defineProperty(this, "inputDisabledBgColor", '#f6f6f6');
|
194
|
-
_defineProperty(this, "inputFocusBorderColor", this.
|
194
|
+
_defineProperty(this, "inputFocusBorderColor", this.transparent);
|
195
195
|
_defineProperty(this, "inputInvalidBorderColor", this.dangerColor);
|
196
196
|
_defineProperty(this, "inputPlaceholderColor", this.defaultColorB);
|
197
197
|
//wheel picker variables
|