@controleonline/ui-customers 1.0.86 → 1.0.88

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@controleonline/ui-customers",
3
- "version": "1.0.86",
3
+ "version": "1.0.88",
4
4
  "author": "ControleOnline",
5
5
  "description": "ControleOnline customers Quasar UI Component",
6
6
  "license": "MIT",
@@ -14,14 +14,13 @@ import {
14
14
  import Icon from 'react-native-vector-icons/MaterialIcons';
15
15
  import { useMessage } from '@controleonline/ui-common/src/react/components/MessageService';
16
16
  import { resolveFileDownloadUrl } from '@controleonline/ui-common/src/react/utils/fileUrl';
17
- import { colors } from '@controleonline/../../src/styles/colors';
17
+ import { colors } from '@controleonline/ui-layout/src/styles/colors';
18
18
  import DefaultUpload from '@controleonline/ui-default/src/react/components/upload/DefaultUpload';
19
19
  import {
20
20
  extractId,
21
21
  isImageFile,
22
22
  isPdfFile,
23
23
  normalizeDocumentFiles,
24
- toDocumentIri,
25
24
  ACCEPTED_DOCUMENT_FILE_TYPES,
26
25
  } from './documentsTabHelpers';
27
26
  import {
@@ -214,7 +213,8 @@ const DocumentAttachments = ({
214
213
  <DefaultUpload
215
214
  relationStoreName="document_file"
216
215
  relationField="document"
217
- relationResource={toDocumentIri(documentId)}
216
+ // DefaultUpload builds `/${relationResource}/${entityId}`, so pass the bare collection name.
217
+ relationResource="documents"
218
218
  entityId={documentId}
219
219
  companyId={companyId}
220
220
  context="document"
@@ -10,7 +10,7 @@ import {
10
10
  import { Picker } from '@react-native-picker/picker';
11
11
  import Icon from 'react-native-vector-icons/MaterialIcons';
12
12
  import AnimatedModal from '@controleonline/ui-common/src/react/components/AnimatedModal';
13
- import { colors } from '@controleonline/../../src/styles/colors';
13
+ import { colors } from '@controleonline/ui-layout/src/styles/colors';
14
14
 
15
15
  const styles = {
16
16
  modalCard: {
@@ -13,7 +13,7 @@ import { useStore } from '@store';
13
13
  import PeopleAvatar from '@controleonline/ui-people/src/react/components/PeopleAvatar';
14
14
  import { useMessage } from '@controleonline/ui-common/src/react/components/MessageService';
15
15
  import Icon from 'react-native-vector-icons/MaterialIcons';
16
- import { colors } from '@controleonline/../../src/styles/colors';
16
+ import { colors } from '@controleonline/ui-layout/src/styles/colors';
17
17
 
18
18
  import {
19
19
  buildFranchiseLinkReadParams,
@@ -7,10 +7,11 @@ import {
7
7
  } from 'react-native';
8
8
  import { useStore } from '@store';
9
9
  import DefaultUpload from '@controleonline/ui-default/src/react/components/upload/DefaultUpload';
10
+ import DefaultFile from '@controleonline/ui-default/src/react/components/files/DefaultFile';
10
11
  import { extractFileId } from '@controleonline/ui-default/src/react/components/upload/fileUpload';
11
12
  import { useMessage } from '@controleonline/ui-common/src/react/components/MessageService';
12
- import { resolveThemePalette, withOpacity } from '@controleonline/../../src/styles/branding';
13
- import { colors } from '@controleonline/../../src/styles/colors';
13
+ import { resolveThemePalette, withOpacity } from '@controleonline/ui-layout/src/styles/branding';
14
+ import { colors } from '@controleonline/ui-layout/src/styles/colors';
14
15
 
15
16
  const COMPANY_MEDIA_ACCEPT_ATTRIBUTE = 'image/png,image/jpeg,.png,.jpg,.jpeg';
16
17
 
@@ -214,6 +215,46 @@ const MediaTab = ({ client, onChanged = null }) => {
214
215
  },
215
216
  ]}
216
217
  >
218
+ <View
219
+ style={[
220
+ styles.mediaPreviewFrame,
221
+ styles.mediaPreviewTransparencyGrid,
222
+ {
223
+ borderColor: withOpacity(palette.primary || '#2563EB', 0.14),
224
+ },
225
+ ]}>
226
+ {(() => {
227
+ const rawFile = currentMedia?.file;
228
+ const fileId = extractFileId(rawFile);
229
+ const file =
230
+ rawFile && typeof rawFile === 'object' && !Array.isArray(rawFile)
231
+ ? rawFile
232
+ : fileId
233
+ ? {id: fileId, '@id': `/files/${fileId}`}
234
+ : null;
235
+ if (!file) {
236
+ return (
237
+ <View style={styles.mediaEmptyState}>
238
+ <Text
239
+ style={[
240
+ styles.mediaEmptyText,
241
+ {color: palette.textSecondary || '#64748B'},
242
+ ]}>
243
+ Sem imagem
244
+ </Text>
245
+ </View>
246
+ );
247
+ }
248
+ return (
249
+ <DefaultFile
250
+ file={file}
251
+ company={client}
252
+ resizeMode="cover"
253
+ style={styles.mediaPreviewImage}
254
+ />
255
+ );
256
+ })()}
257
+ </View>
217
258
  <DefaultUpload
218
259
  relationStoreName="people"
219
260
  relationField="people"
@@ -319,6 +360,38 @@ const styles = StyleSheet.create({
319
360
  fontSize: 12,
320
361
  fontWeight: '700',
321
362
  },
363
+ // app-community#813: preview 320x320
364
+ mediaPreviewFrame: {
365
+ width: 320,
366
+ height: 320,
367
+ maxWidth: 320,
368
+ alignSelf: 'center',
369
+ borderRadius: 14,
370
+ borderWidth: 1,
371
+ overflow: 'hidden',
372
+ alignItems: 'center',
373
+ justifyContent: 'center',
374
+ },
375
+ mediaPreviewTransparencyGrid: {
376
+ // RN StyleSheet (web) rejects multi-value backgroundPosition / CSS backgroundImage gradients.
377
+ // Keep solid preview background; checkerboard was cosmetic only.
378
+ backgroundColor: '#F8FAFC',
379
+ },
380
+ mediaPreviewImage: {
381
+ width: 320,
382
+ height: 320,
383
+ },
384
+ mediaEmptyState: {
385
+ width: 320,
386
+ height: 320,
387
+ alignItems: 'center',
388
+ justifyContent: 'center',
389
+ gap: 8,
390
+ },
391
+ mediaEmptyText: {
392
+ fontSize: 13,
393
+ fontWeight: '500',
394
+ },
322
395
  mediaHelpText: {
323
396
  fontSize: 12,
324
397
  lineHeight: 18,
@@ -2,7 +2,7 @@ import React, { useMemo, useCallback } from 'react';
2
2
  import { Text, TouchableOpacity, View } from 'react-native';
3
3
  import { useNavigation } from '@react-navigation/native';
4
4
  import Icon from 'react-native-vector-icons/MaterialIcons';
5
- import { colors } from '@controleonline/../../src/styles/colors';
5
+ import { colors } from '@controleonline/ui-layout/src/styles/colors';
6
6
  import styles from './ProductsTab.styles';
7
7
  import {
8
8
  buildCreateProductParams,
@@ -10,7 +10,7 @@ import {
10
10
  import { Picker } from '@react-native-picker/picker';
11
11
  import Icon from 'react-native-vector-icons/MaterialIcons';
12
12
  import AnimatedModal from '@controleonline/ui-common/src/react/components/AnimatedModal';
13
- import { colors } from '@controleonline/../../src/styles/colors';
13
+ import { colors } from '@controleonline/ui-layout/src/styles/colors';
14
14
 
15
15
  const styles = {
16
16
  modalCard: {
@@ -31,7 +31,7 @@ import { normalizeSalesmanLink } from './salesmanTab.helpers';
31
31
  import SalesmanManageModal from './SalesmanManageModal';
32
32
  import { useSalesmanManage } from './useSalesmanManage';
33
33
  import Icon from 'react-native-vector-icons/MaterialIcons';
34
- import { colors } from '@controleonline/../../src/styles/colors';
34
+ import { colors } from '@controleonline/ui-layout/src/styles/colors';
35
35
  import SalesmanCommissionBlock from './SalesmanCommissionBlock';
36
36
 
37
37
  import {
@@ -1,5 +1,5 @@
1
1
  import { StyleSheet } from 'react-native';
2
- import { colors } from '@controleonline/../../src/styles/colors';
2
+ import { colors } from '@controleonline/ui-layout/src/styles/colors';
3
3
 
4
4
  const styles = StyleSheet.create({
5
5
  container: {
@@ -28,20 +28,6 @@ const styles = StyleSheet.create({
28
28
  color: '#64748B',
29
29
  fontWeight: '500',
30
30
  },
31
- removeButton: {
32
- marginTop: 12,
33
- paddingHorizontal: 16,
34
- paddingVertical: 8,
35
- borderRadius: 8,
36
- borderWidth: 1,
37
- borderColor: '#FECACA',
38
- backgroundColor: '#FEF2F2',
39
- },
40
- removeButtonText: {
41
- fontSize: 14,
42
- fontWeight: '600',
43
- color: '#B91C1C',
44
- },
45
31
  tabsHeader: {
46
32
  flexDirection: 'row',
47
33
  backgroundColor: '#fff',
@@ -27,6 +27,9 @@ test('DocumentAttachments exposes view/share/print/remove via DefaultUpload', ()
27
27
  assert.match(attachments, /handleShare|Share\.share/);
28
28
  assert.match(attachments, /handlePrint|print\(/);
29
29
  assert.match(attachments, /ACCEPTED_DOCUMENT_FILE_TYPES/);
30
+ // app-community#1392: a full IRI here produced `//documents/N/N` and the relation was never saved.
31
+ assert.match(attachments, /relationResource="documents"/);
32
+ assert.doesNotMatch(attachments, /relationResource=\{/);
30
33
  assert.ok(attachments.split('\n').length <= 500, 'DocumentAttachments must stay under 500 lines');
31
34
  });
32
35