@controleonline/ui-common 1.2.91 → 1.2.92
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/.release/rc-manifest.json +16 -0
- package/package.json +4 -3
- package/src/react/components/DefaultProvider.native.js +25 -3
- package/src/react/components/RuntimeFooterMarqueeText.js +5 -0
- package/src/react/utils/runtimeZoom.js +6 -0
- package/src/tests/react/components/RuntimeFooterMarqueeText.test.js +22 -0
- package/src/tests/react/utils/runtimeZoom.test.js +6 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.2.92",
|
|
3
|
+
"rc": 1,
|
|
4
|
+
"branch": "rc/1.2.92-rc.1",
|
|
5
|
+
"baseMaster": "03e8ae44638497cb992d2c6e6d00c898abb24cde",
|
|
6
|
+
"tasks": [77, 1051],
|
|
7
|
+
"repositories": {
|
|
8
|
+
"ControleOnline/ui-common": "e500e5f96b022f7a626824683ae1f2bd3bd63471"
|
|
9
|
+
},
|
|
10
|
+
"compositionNotes": [
|
|
11
|
+
"ui-common#77 (footer device info width 0 on Android) and app-community#1051 (zoom < 100 leaves screen detached from bottom).",
|
|
12
|
+
"Base is staging 03e8ae4 (= npm ui-common 1.2.91 consumed by app-community master); ui-common master is behind (1.2.87).",
|
|
13
|
+
"Individual task commits 19683a9 and 9e3a93b merged with --no-ff; no other dev content."
|
|
14
|
+
],
|
|
15
|
+
"frozen": true
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@controleonline/ui-common",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.92",
|
|
4
4
|
"author": "ControleOnline",
|
|
5
5
|
"description": "ControleOnline Common Quasar UI Component",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/react/index.js",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"test": "npm run test:receita-federal && npm run test:imports-status && npm run test:runtime-language && npm run test:runtime-footer && npm run test:runtime-footer-marquee && npm run test:invoice-presentation && npm run test:system-error-message && npm run test:bottom-navigation-toolbar && npm run test:copy-device-configs && npm run test:print-routing && npm run test:device-detail-dependencies",
|
|
9
|
+
"test": "npm run test:receita-federal && npm run test:imports-status && npm run test:runtime-language && npm run test:runtime-footer && npm run test:runtime-footer-marquee && npm run test:invoice-presentation && npm run test:system-error-message && npm run test:bottom-navigation-toolbar && npm run test:copy-device-configs && npm run test:print-routing && npm run test:device-detail-dependencies && npm run test:runtime-zoom",
|
|
10
10
|
"test:receita-federal": "node --test src/tests/react/pages/receitaFederalIntegrationContract.test.mjs",
|
|
11
11
|
"test:imports-status": "mkdir -p node_modules/@controleonline && rm -rf node_modules/@controleonline/ui-common && ln -s ../.. node_modules/@controleonline/ui-common && node --test src/tests/react/utils/importStatus.test.js",
|
|
12
12
|
"test:runtime-language": "node --test src/tests/react/utils/runtimeLanguage.test.js",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"test:copy-device-configs": "node --test src/tests/react/utils/copyDeviceConfigs.test.mjs",
|
|
19
19
|
"test:print-routing": "node --test src/tests/react/utils/printRouting.test.mjs src/tests/react/utils/printSpoolUtils.test.mjs",
|
|
20
20
|
"test:runtime-footer-marquee": "node --test src/tests/react/components/RuntimeFooterMarqueeText.test.js src/tests/react/components/RuntimeFooterMarqueeText.build.test.js",
|
|
21
|
-
"test:device-detail-dependencies": "node --test src/tests/react/pages/deviceDetailLoaderDependencies.test.mjs"
|
|
21
|
+
"test:device-detail-dependencies": "node --test src/tests/react/pages/deviceDetailLoaderDependencies.test.mjs",
|
|
22
|
+
"test:runtime-zoom": "node --test src/tests/react/utils/runtimeZoom.test.js"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"c8": "^10.1.3",
|
|
@@ -172,12 +172,26 @@ export const DefaultProvider = ({
|
|
|
172
172
|
deviceInfo: device || {},
|
|
173
173
|
});
|
|
174
174
|
const {width: windowWidth, height: windowHeight} = useWindowDimensions();
|
|
175
|
+
// app-community#1051: size the scaled content from the area it really
|
|
176
|
+
// occupies (shell minus runtime footer), not from the full window.
|
|
177
|
+
const [contentSize, setContentSize] = useState(null);
|
|
178
|
+
const handleContentLayout = useCallback(({nativeEvent}) => {
|
|
179
|
+
const {width, height} = nativeEvent?.layout || {};
|
|
180
|
+
setContentSize(current =>
|
|
181
|
+
current?.width === width && current?.height === height
|
|
182
|
+
? current
|
|
183
|
+
: {width, height},
|
|
184
|
+
);
|
|
185
|
+
}, []);
|
|
175
186
|
const runtimeUiScaleStyle = useMemo(
|
|
176
187
|
() =>
|
|
177
188
|
buildRuntimeZoomStyle(APP_ENV?.ZOOM, {
|
|
178
|
-
viewport: {
|
|
189
|
+
viewport: {
|
|
190
|
+
width: contentSize?.width || windowWidth,
|
|
191
|
+
height: contentSize?.height || windowHeight,
|
|
192
|
+
},
|
|
179
193
|
}),
|
|
180
|
-
[windowHeight, windowWidth],
|
|
194
|
+
[contentSize, windowHeight, windowWidth],
|
|
181
195
|
);
|
|
182
196
|
const deviceConfigPeopleIri = resolveDeviceConfigPeopleIri({
|
|
183
197
|
appType,
|
|
@@ -371,7 +385,15 @@ export const DefaultProvider = ({
|
|
|
371
385
|
backgroundColor: colors?.background || runtimeColors.background,
|
|
372
386
|
},
|
|
373
387
|
]}>
|
|
374
|
-
<View
|
|
388
|
+
<View
|
|
389
|
+
style={providerStyles.content}
|
|
390
|
+
onLayout={runtimeUiScaleStyle ? handleContentLayout : undefined}>
|
|
391
|
+
{runtimeUiScaleStyle ? (
|
|
392
|
+
<View style={runtimeUiScaleStyle}>{children}</View>
|
|
393
|
+
) : (
|
|
394
|
+
children
|
|
395
|
+
)}
|
|
396
|
+
</View>
|
|
375
397
|
{!isShopClientApp && bottomNavigationCount === 0 && (
|
|
376
398
|
<RuntimeInfoFooter
|
|
377
399
|
appVersion={appVersion}
|
|
@@ -105,6 +105,10 @@ const RuntimeFooterMarqueeText = props => {
|
|
|
105
105
|
color: color,
|
|
106
106
|
flexShrink: 0,
|
|
107
107
|
flexGrow: 0,
|
|
108
|
+
// primaryText carries `flex: 1` (flexBasis 0 on native), which collapsed
|
|
109
|
+
// the Text to width 0 inside the row on Android. Force intrinsic sizing.
|
|
110
|
+
flexBasis: 'auto',
|
|
111
|
+
minWidth: 0,
|
|
108
112
|
minHeight: 14,
|
|
109
113
|
},
|
|
110
114
|
];
|
|
@@ -164,6 +168,7 @@ const RuntimeFooterMarqueeText = props => {
|
|
|
164
168
|
alignItems: 'center',
|
|
165
169
|
opacity: 1,
|
|
166
170
|
transform: [{translateX: translateX}],
|
|
171
|
+
justifyContent: shouldMarquee ? 'flex-start' : 'center',
|
|
167
172
|
alignSelf: shouldMarquee ? 'flex-start' : 'stretch',
|
|
168
173
|
},
|
|
169
174
|
},
|
|
@@ -37,10 +37,16 @@ export const buildRuntimeZoomStyle = (
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const inverseScale = 1 / scale;
|
|
40
|
+
// app-community#1051: the container also carries `flex: 1` (flexBasis 0),
|
|
41
|
+
// which overrides the compensated height. Disable flex sizing so the
|
|
42
|
+
// compensated size survives and the scaled content fills the viewport.
|
|
40
43
|
const nativeBase = {
|
|
41
44
|
transform: [{scale}],
|
|
42
45
|
transformOrigin: 'top left',
|
|
43
46
|
alignSelf: 'flex-start',
|
|
47
|
+
flexGrow: 0,
|
|
48
|
+
flexShrink: 0,
|
|
49
|
+
flexBasis: 'auto',
|
|
44
50
|
};
|
|
45
51
|
|
|
46
52
|
const viewportWidth = Number(viewport?.width);
|
|
@@ -169,3 +169,25 @@ test('long text enables marquee duplicate and starts loop animation', async () =
|
|
|
169
169
|
assert.ok(lastLoopConfig, 'Animated.loop should start when overflowing');
|
|
170
170
|
assert.ok(animationStarts >= 1);
|
|
171
171
|
});
|
|
172
|
+
|
|
173
|
+
test('native text keeps intrinsic width even when style carries flex: 1 (android #77)', () => {
|
|
174
|
+
const RuntimeFooterMarqueeText = loadComponent();
|
|
175
|
+
const renderer = require('react-test-renderer');
|
|
176
|
+
|
|
177
|
+
let tree;
|
|
178
|
+
renderer.act(() => {
|
|
179
|
+
tree = renderer.create(
|
|
180
|
+
React.createElement(RuntimeFooterMarqueeText, {
|
|
181
|
+
text: 'Samsung • DEVICE / v1.10.55',
|
|
182
|
+
color: '#111',
|
|
183
|
+
style: {flex: 1, minWidth: 0, fontSize: 11},
|
|
184
|
+
}),
|
|
185
|
+
);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
const text = tree.root.findAllByType('Text')[0];
|
|
189
|
+
const flat = Object.assign({}, ...[].concat(text.props.style));
|
|
190
|
+
assert.equal(flat.flexBasis, 'auto');
|
|
191
|
+
assert.equal(flat.flexGrow, 0);
|
|
192
|
+
assert.equal(flat.flexShrink, 0);
|
|
193
|
+
});
|
|
@@ -31,6 +31,9 @@ test('builds compensated container dimensions for native scaled content', () =>
|
|
|
31
31
|
buildRuntimeZoomStyle(70),
|
|
32
32
|
{
|
|
33
33
|
alignSelf: 'flex-start',
|
|
34
|
+
flexBasis: 'auto',
|
|
35
|
+
flexGrow: 0,
|
|
36
|
+
flexShrink: 0,
|
|
34
37
|
height: '142.85714285714286%',
|
|
35
38
|
transform: [{scale: 0.7}],
|
|
36
39
|
transformOrigin: 'top left',
|
|
@@ -44,6 +47,9 @@ test('uses viewport pixels on native so scale origin stays top-left without dist
|
|
|
44
47
|
buildRuntimeZoomStyle(70, {viewport: {width: 360, height: 800}}),
|
|
45
48
|
{
|
|
46
49
|
alignSelf: 'flex-start',
|
|
50
|
+
flexBasis: 'auto',
|
|
51
|
+
flexGrow: 0,
|
|
52
|
+
flexShrink: 0,
|
|
47
53
|
height: 800 / 0.7,
|
|
48
54
|
transform: [{scale: 0.7}],
|
|
49
55
|
transformOrigin: 'top left',
|