ui-soxo-bootstrap-core 2.6.49 → 2.6.50-dev.0

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.
@@ -90,41 +90,6 @@ export function getRedirectLink(entry = {}, record = {}, CustomComponents = {})
90
90
  return redirectLink;
91
91
  }
92
92
 
93
- /**
94
- * Resolves the PDF/file location for file-based action entries.
95
- *
96
- * Supports either:
97
- * - `entry.file_location` as a direct URL/path
98
- * - `entry.file_location` as a record field name
99
- *
100
- * @param {DisplayColumnEntry} entry
101
- * @param {DisplayRecord} record
102
- * @returns {string}
103
- */
104
- export function getFileLocation(entry = {}, record = {}) {
105
- if (entry.file_location && typeof entry.file_location === 'string' && record[entry.file_location]) {
106
- return record[entry.file_location];
107
- }
108
-
109
- return record.file_location || entry.file_location || '';
110
- }
111
-
112
- /**
113
- * Resolves a value from the row when a config field points to a record key,
114
- * otherwise returns the provided literal value.
115
- *
116
- * @param {*} value
117
- * @param {DisplayRecord} record
118
- * @returns {*}
119
- */
120
- function resolveRecordValue(value, record = {}) {
121
- if (typeof value === 'string' && Object.prototype.hasOwnProperty.call(record, value)) {
122
- return record[value];
123
- }
124
-
125
- return value;
126
- }
127
-
128
93
  /**
129
94
  * Resolves action label text with backward-compatible precedence.
130
95
  *
@@ -219,26 +184,17 @@ function renderCustomComponent({ entry, record, CustomComponents, refresh }) {
219
184
  */
220
185
  function FileActionLink({ entry, record, CustomComponents }) {
221
186
  const [isPdfVisible, setIsPdfVisible] = useState(false);
222
- const fileUrl = getFileLocation(entry, record);
223
187
  const actionLabel = getActionLabel(entry, record);
224
188
  const FileLoaderComponent = CustomComponents?.FileLoader;
225
189
 
226
- if (!fileUrl) {
227
- return null;
228
- }
190
+
229
191
 
230
192
  const fileLoaderProps = {
231
- url: fileUrl,
232
- type: resolveRecordValue(entry.file_type, record) || 'pdf',
233
- defaultScale: resolveRecordValue(entry.default_scale, record),
234
- viewerType: resolveRecordValue(entry.viewer_type, record),
193
+ url: record?.file_location + record?.file_name,
235
194
  config: {
236
- requireLinuxPath: resolveRecordValue(entry.require_linux_path, record),
237
- replaceBranch: resolveRecordValue(entry.replace_branch, record),
238
195
  ...(entry.file_loader_config || {}),
239
196
  },
240
- entry,
241
- record,
197
+ type:record?.Native_filetype,
242
198
  };
243
199
 
244
200
  return (
@@ -3,7 +3,6 @@ import {
3
3
  isLegacyActionEntry,
4
4
  isActionTypeEntry,
5
5
  getRedirectLink,
6
- getFileLocation,
7
6
  getActionLabel,
8
7
  renderDisplayCell,
9
8
  } from './display-cell-renderer';
@@ -29,13 +28,6 @@ describe('display-cell-renderer', () => {
29
28
  expect(link).toBe('/bill/10/visit/OP100');
30
29
  });
31
30
 
32
- test('resolves file location from direct config value or record field', () => {
33
- expect(getFileLocation({ file_location: 'https://example.com/report.pdf' }, {})).toBe('https://example.com/report.pdf');
34
- expect(getFileLocation({ file_location: 'document_url' }, { document_url: 'https://example.com/record.pdf' })).toBe(
35
- 'https://example.com/record.pdf',
36
- );
37
- });
38
-
39
31
  test('keeps legacy action label behavior unchanged', () => {
40
32
  const entry = {
41
33
  field: 'action',
@@ -111,24 +103,15 @@ describe('display-cell-renderer', () => {
111
103
  type: 'action',
112
104
  field: 'action_text',
113
105
  redirect_link_type: 'file',
114
- file_location: 'document_path',
115
- file_type: 'document_type',
116
- default_scale: 'zoom_level',
117
- viewer_type: 'inline_viewer',
118
- require_linux_path: 'needs_linux_path',
119
- replace_branch: 'should_replace_branch',
120
106
  file_loader_config: {
121
107
  sample: true,
122
108
  },
123
109
  },
124
110
  record: {
125
111
  action_text: 'Preview',
126
- document_path: '\\\\server\\reports\\doc.pdf',
127
- document_type: 'pdf',
128
- zoom_level: 1.25,
129
- inline_viewer: true,
130
- needs_linux_path: true,
131
- should_replace_branch: false,
112
+ file_location: '\\\\server\\reports\\',
113
+ file_name: 'doc.pdf',
114
+ Native_filetype: 'pdf',
132
115
  },
133
116
  refresh: jest.fn(),
134
117
  CustomComponents: { FileUpload },
@@ -140,14 +123,11 @@ describe('display-cell-renderer', () => {
140
123
  expect(modalContent.type).toBe(FileUpload);
141
124
  expect(modalContent.props.url).toBe('\\\\server\\reports\\doc.pdf');
142
125
  expect(modalContent.props.type).toBe('pdf');
143
- expect(modalContent.props.defaultScale).toBe(1.25);
144
- expect(modalContent.props.viewerType).toBe(true);
145
126
  expect(modalContent.props.config).toEqual({
146
127
  requireLinuxPath: true,
147
128
  replaceBranch: false,
148
129
  sample: true,
149
130
  });
150
- expect(modalContent.props.record.document_path).toBe('\\\\server\\reports\\doc.pdf');
151
131
  });
152
132
 
153
133
  test('renders styled tag/span/icon/text for non-action path', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-soxo-bootstrap-core",
3
- "version": "2.6.49",
3
+ "version": "2.6.50-dev.0",
4
4
  "description": "All the Core Components for you to start",
5
5
  "keywords": [
6
6
  "all in one"