@controleonline/ui-default 1.0.272 → 1.0.274
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/.github/workflows/publish-npm.yml +91 -0
- package/AGENTS.md +1 -1
- package/docs/technical/DefaultTable.md +70 -1
- package/package.json +22 -22
- package/src/react/components/address/DefaultAddress.js +20 -9
- package/src/react/components/address/DefaultAddressCoordFields.js +59 -0
- package/src/react/components/address/LatLonReadonlyFields.js +2 -2
- package/src/react/components/address/defaultAddressStyles.js +13 -1
- package/src/react/components/files/DefaultFile.js +2 -2
- package/src/react/components/files/DefaultFileColumn.js +1 -1
- package/src/react/components/filters/DefaultColumnFilter.js +2 -7
- package/src/react/components/filters/DefaultExternalFilters.js +4 -11
- package/src/react/components/filters/filterValue.js +65 -0
- package/src/react/components/help/DefaultTooltip.js +73 -63
- package/src/react/components/help/DefaultTooltip.styles.js +23 -23
- package/src/react/components/inputs/DefaultInput.js +301 -210
- package/src/react/components/inputs/defaultInputUtils.js +193 -170
- package/src/react/components/table/DefaultColumnMenu.js +127 -109
- package/src/react/components/table/DefaultTable.js +43 -92
- package/src/react/components/table/DefaultTable.styles.js +10 -4
- package/src/react/components/table/DefaultTable.utils.js +38 -4
- package/src/react/components/table/DefaultTableRows.js +324 -153
- package/src/react/components/table/DefaultTableToolbar.js +17 -7
- package/src/react/components/table/DefaultTableView.js +118 -0
- package/src/react/components/upload/DefaultUpload.js +6 -36
- package/src/react/components/upload/DefaultUpload.styles.js +5 -5
- package/src/react/components/upload/DefaultUploadAttachmentsList.js +11 -3
- package/src/react/hooks/usePostalCodeLookup.js +15 -1
- package/src/react/services/addressFormUtils.js +104 -38
- package/src/react/services/addressGeo.js +6 -3
- package/src/react/utils/tableVisibleColumnsPreferences.js +84 -3
- package/src/tests/react/components/files/DefaultFile.test.js +16 -0
- package/src/tests/react/components/files/DefaultFileColumn.company.test.js +24 -0
- package/src/tests/react/components/help/DefaultTooltip.test.js +93 -0
- package/src/tests/react/components/table/DefaultTable.test.js +37 -0
- package/src/tests/react/components/table/DefaultTable.utils.test.js +10 -0
- package/src/tests/react/components/table/DefaultTableRowActions.test.js +23 -0
- package/src/tests/react/components/table/DefaultTableRows.rowActions.test.js +152 -0
- package/src/tests/react/components/table/DefaultTableToolbar.waiter.test.js +42 -0
- package/src/tests/react/components/upload/defaultUploadLibrary.test.js +31 -9
- package/src/tests/react/filters/filterValue.test.js +46 -0
- package/src/tests/react/hooks/usePostalCodeLookup.test.js +67 -0
- package/src/tests/react/inputs/defaultInputUtils.test.js +9 -1
- package/src/tests/react/services/addressFormUtils.test.js +6 -3
- package/src/tests/react/utils/tableVisibleColumnsPreferences.test.js +12 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mergePostalCodeData,
|
|
3
|
+
clearPostalCodeDerivedFields,
|
|
3
4
|
onlyDigits,
|
|
4
5
|
hydrateAddressFromRow,
|
|
5
6
|
hasCoordinates,
|
|
@@ -47,13 +48,13 @@ describe('addressFormUtils', () => {
|
|
|
47
48
|
expect(next.city).toBe('São Paulo');
|
|
48
49
|
expect(next.uf).toBe('SP');
|
|
49
50
|
expect(next.cep).toBe('01310100');
|
|
50
|
-
expect(next.number).toBe('
|
|
51
|
+
expect(next.number).toBe(''); // cleared on CEP lookup (#746)
|
|
51
52
|
expect(next.complement).toBe('Apto 1');
|
|
52
53
|
expect(next.nickname).toBe('Casa');
|
|
53
54
|
expect(next.countryCode).toBe('BR');
|
|
54
55
|
});
|
|
55
56
|
|
|
56
|
-
test('mergePostalCodeData
|
|
57
|
+
test('mergePostalCodeData clears number but keeps complement/nickname (#746)', () => {
|
|
57
58
|
const prev = {
|
|
58
59
|
nickname: 'Trabalho',
|
|
59
60
|
number: '42',
|
|
@@ -75,7 +76,7 @@ describe('addressFormUtils', () => {
|
|
|
75
76
|
country: 'Brazil',
|
|
76
77
|
};
|
|
77
78
|
const next = mergePostalCodeData(prev, data);
|
|
78
|
-
expect(next.number).toBe('
|
|
79
|
+
expect(next.number).toBe('');
|
|
79
80
|
expect(next.complement).toBe('Sala 3');
|
|
80
81
|
expect(next.nickname).toBe('Trabalho');
|
|
81
82
|
expect(next.street).toBe('Av Paulista');
|
|
@@ -137,6 +138,8 @@ describe('addressFormUtils', () => {
|
|
|
137
138
|
test('hasCoordinates requires finite lat/lng', () => {
|
|
138
139
|
expect(hasCoordinates({latitude: -23, longitude: -46})).toBe(true);
|
|
139
140
|
expect(hasCoordinates({latitude: null, longitude: -46})).toBe(false);
|
|
141
|
+
expect(hasCoordinates({latitude: 0, longitude: 0})).toBe(false);
|
|
142
|
+
expect(hasCoordinates({latitude: '0', longitude: '0'})).toBe(false);
|
|
140
143
|
});
|
|
141
144
|
|
|
142
145
|
test('parseOptionalCoordinate returns null for empty/invalid', () => {
|
|
@@ -5,6 +5,7 @@ const {
|
|
|
5
5
|
TABLE_VISIBLE_COLUMNS_PREFERENCES_KEY,
|
|
6
6
|
TABLE_VIEW_MODE_PREFERENCES_KEY,
|
|
7
7
|
buildDefaultVisibleColumns,
|
|
8
|
+
canHideVisibleColumn,
|
|
8
9
|
persistTableFiltersPreference,
|
|
9
10
|
persistTableSortPreference,
|
|
10
11
|
persistTableViewModePreference,
|
|
@@ -71,12 +72,22 @@ describe('tableVisibleColumnsPreferences', () => {
|
|
|
71
72
|
},
|
|
72
73
|
}),
|
|
73
74
|
).toEqual({
|
|
74
|
-
id:
|
|
75
|
+
id: true,
|
|
75
76
|
status: true,
|
|
76
77
|
price: false,
|
|
77
78
|
});
|
|
78
79
|
});
|
|
79
80
|
|
|
81
|
+
it('does not allow hiding the last remaining column', () => {
|
|
82
|
+
expect(
|
|
83
|
+
canHideVisibleColumn({
|
|
84
|
+
columns,
|
|
85
|
+
fieldName: 'status',
|
|
86
|
+
visibleColumns: {id: true, status: false, price: false},
|
|
87
|
+
}),
|
|
88
|
+
).toBe(false);
|
|
89
|
+
});
|
|
90
|
+
|
|
80
91
|
it('builds the company, route and store preference scope', () => {
|
|
81
92
|
global.location = {pathname: '/order-history-page'};
|
|
82
93
|
|