@tellescope/react-components 1.172.0 → 1.173.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.
- package/lib/cjs/Forms/forms.d.ts.map +1 -1
- package/lib/cjs/Forms/forms.js +1 -1
- package/lib/cjs/Forms/forms.js.map +1 -1
- package/lib/cjs/Forms/hooks.d.ts +6 -2
- package/lib/cjs/Forms/hooks.d.ts.map +1 -1
- package/lib/cjs/Forms/hooks.js +25 -1
- package/lib/cjs/Forms/hooks.js.map +1 -1
- package/lib/cjs/Forms/inputs.d.ts +1 -1
- package/lib/cjs/Forms/inputs.d.ts.map +1 -1
- package/lib/cjs/Forms/inputs.js +17 -7
- package/lib/cjs/Forms/inputs.js.map +1 -1
- package/lib/cjs/table.d.ts +5 -2
- package/lib/cjs/table.d.ts.map +1 -1
- package/lib/cjs/table.js +7 -7
- package/lib/cjs/table.js.map +1 -1
- package/lib/esm/Forms/form_responses.d.ts +0 -1
- package/lib/esm/Forms/form_responses.d.ts.map +1 -1
- package/lib/esm/Forms/forms.d.ts +1 -1
- package/lib/esm/Forms/forms.d.ts.map +1 -1
- package/lib/esm/Forms/forms.js +1 -1
- package/lib/esm/Forms/forms.js.map +1 -1
- package/lib/esm/Forms/hooks.d.ts +6 -2
- package/lib/esm/Forms/hooks.d.ts.map +1 -1
- package/lib/esm/Forms/hooks.js +25 -1
- package/lib/esm/Forms/hooks.js.map +1 -1
- package/lib/esm/Forms/inputs.d.ts +2 -2
- package/lib/esm/Forms/inputs.d.ts.map +1 -1
- package/lib/esm/Forms/inputs.js +17 -7
- package/lib/esm/Forms/inputs.js.map +1 -1
- package/lib/esm/controls.d.ts +2 -2
- package/lib/esm/table.d.ts +5 -2
- package/lib/esm/table.d.ts.map +1 -1
- package/lib/esm/table.js +7 -7
- package/lib/esm/table.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/Forms/forms.tsx +4 -1
- package/src/Forms/hooks.tsx +27 -2
- package/src/Forms/inputs.tsx +28 -6
- package/src/table.tsx +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tellescope/react-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.173.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"@reduxjs/toolkit": "^1.6.2",
|
|
48
48
|
"@stripe/react-stripe-js": "^2.9.0",
|
|
49
49
|
"@stripe/stripe-js": "^1.52.1",
|
|
50
|
-
"@tellescope/constants": "^1.
|
|
51
|
-
"@tellescope/sdk": "^1.
|
|
52
|
-
"@tellescope/types-client": "^1.
|
|
53
|
-
"@tellescope/types-models": "^1.
|
|
54
|
-
"@tellescope/types-utilities": "^1.
|
|
55
|
-
"@tellescope/utilities": "^1.
|
|
56
|
-
"@tellescope/validation": "^1.
|
|
50
|
+
"@tellescope/constants": "^1.173.0",
|
|
51
|
+
"@tellescope/sdk": "^1.173.0",
|
|
52
|
+
"@tellescope/types-client": "^1.173.0",
|
|
53
|
+
"@tellescope/types-models": "^1.173.0",
|
|
54
|
+
"@tellescope/types-utilities": "^1.173.0",
|
|
55
|
+
"@tellescope/utilities": "^1.173.0",
|
|
56
|
+
"@tellescope/validation": "^1.173.0",
|
|
57
57
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
58
58
|
"@typescript-eslint/parser": "^4.33.0",
|
|
59
59
|
"css-to-react-native": "^3.0.0",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
85
85
|
"react-native": "^0.65.0 || ^0.66.0 || ^0.67.0 || ^0.68.0 || ^0.71.0"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "0239f40d9a62d16c2d94830a5f65db54aee48e1f",
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
}
|
package/src/Forms/forms.tsx
CHANGED
|
@@ -967,7 +967,10 @@ export const TellescopeSinglePageForm: React.JSXElementConstructor<TellescopeFor
|
|
|
967
967
|
const list = useListForFormFields(fields, responses, { form: props.form, gender: enduser?.gender })
|
|
968
968
|
|
|
969
969
|
const includedFieldIds = (
|
|
970
|
-
Array.from(new Set([
|
|
970
|
+
Array.from(new Set([
|
|
971
|
+
...list.map(f => f.id),
|
|
972
|
+
...(existingResponses ?? []).filter(e => !e.isPrepopulatedFromEnduserField).map(e => e.fieldId)
|
|
973
|
+
]))
|
|
971
974
|
)
|
|
972
975
|
|
|
973
976
|
const handleSubmit = useCallback(async () => {
|
package/src/Forms/hooks.tsx
CHANGED
|
@@ -348,7 +348,7 @@ interface UseTellescopeFormOptions {
|
|
|
348
348
|
automationStepId?: string,
|
|
349
349
|
form?: Form,
|
|
350
350
|
fields: FormField[],
|
|
351
|
-
existingResponses?:
|
|
351
|
+
existingResponses?: (FormResponseValue & { isPrepopulatedFromEnduserField?: boolean })[],
|
|
352
352
|
formResponseId?: string,
|
|
353
353
|
isInternalNote?: boolean,
|
|
354
354
|
formTitle?: string,
|
|
@@ -1213,7 +1213,12 @@ export const useTellescopeForm = ({ isPublicForm, form, urlLogicValue, customiza
|
|
|
1213
1213
|
responses: [
|
|
1214
1214
|
...responsesToSubmit,
|
|
1215
1215
|
// include existing responses in case previously saved as draft
|
|
1216
|
-
...(existingResponses ?? []).filter(r =>
|
|
1216
|
+
...(existingResponses ?? []).filter(r =>
|
|
1217
|
+
!responsesToSubmit.find(_r => r.fieldId === _r.fieldId)
|
|
1218
|
+
// but don't include responses which were populated from a patient field and not a prior response
|
|
1219
|
+
// if these are edited, they would be included in responsesToSubmit
|
|
1220
|
+
&& !r.isPrepopulatedFromEnduserField
|
|
1221
|
+
),
|
|
1217
1222
|
],
|
|
1218
1223
|
automationStepId,
|
|
1219
1224
|
customerId,
|
|
@@ -1415,6 +1420,26 @@ export const useTellescopeForm = ({ isPublicForm, form, urlLogicValue, customiza
|
|
|
1415
1420
|
})
|
|
1416
1421
|
.catch(console.error)
|
|
1417
1422
|
}
|
|
1423
|
+
|
|
1424
|
+
const cbSaveField = fields.find(f => f.id === fieldId && (f.type === 'Chargebee'))
|
|
1425
|
+
if (cbSaveField && typeof value === 'object' && (formResponseId || accessCode)) {
|
|
1426
|
+
session.api.form_responses.save_field_response({
|
|
1427
|
+
accessCode,
|
|
1428
|
+
formResponseId,
|
|
1429
|
+
response: {
|
|
1430
|
+
answer: {
|
|
1431
|
+
type: cbSaveField.type as "Chargebee",
|
|
1432
|
+
value,
|
|
1433
|
+
} as any,
|
|
1434
|
+
fieldId: cbSaveField.id,
|
|
1435
|
+
fieldTitle: cbSaveField.title,
|
|
1436
|
+
externalId: cbSaveField.externalId,
|
|
1437
|
+
fieldDescription: cbSaveField.description,
|
|
1438
|
+
fieldHtmlDescription: cbSaveField.htmlDescription,
|
|
1439
|
+
},
|
|
1440
|
+
})
|
|
1441
|
+
.catch(console.error)
|
|
1442
|
+
}
|
|
1418
1443
|
}, [fields])
|
|
1419
1444
|
|
|
1420
1445
|
const onAddFile = useCallback((blobs?: FileBlob | FileBlob[], fieldId=activeField.value.id) => {
|
package/src/Forms/inputs.tsx
CHANGED
|
@@ -355,6 +355,23 @@ export const TableInput = ({ field, value=[], onChange, ...props }: FormInputPro
|
|
|
355
355
|
</Select>
|
|
356
356
|
</FormControl>
|
|
357
357
|
)
|
|
358
|
+
: (v.type === 'Database' && v.info.databaseId && v.info.databaseLabel) ? (
|
|
359
|
+
<DatabaseSelectInput responses={[]} size="small"
|
|
360
|
+
field={{
|
|
361
|
+
...field,
|
|
362
|
+
options: { databaseId: v.info.databaseId, databaseLabel: v.info.databaseLabel },
|
|
363
|
+
title: v.label,
|
|
364
|
+
}}
|
|
365
|
+
value={row.find((_, _i) => columnIndex === _i)?.entry ? [{
|
|
366
|
+
text: JSON.parse(row.find((_, _i) => columnIndex === _i)?.entry || '{}').text || '',
|
|
367
|
+
databaseId: JSON.parse(row.find((_, _i) => columnIndex === _i)?.entry || '{}').databaseId || '',
|
|
368
|
+
recordId: JSON.parse(row.find((_, _i) => columnIndex === _i)?.entry || '{}').recordId || '',
|
|
369
|
+
}] : []}
|
|
370
|
+
onChange={
|
|
371
|
+
(records) => handleChange(i, columnIndex, { label: v.label, entry: JSON.stringify(records?.[0] ?? '') })
|
|
372
|
+
}
|
|
373
|
+
/>
|
|
374
|
+
)
|
|
358
375
|
: null
|
|
359
376
|
}
|
|
360
377
|
</Grid>
|
|
@@ -1761,6 +1778,7 @@ const choicesForDatabase: {
|
|
|
1761
1778
|
lastId?: string,
|
|
1762
1779
|
}
|
|
1763
1780
|
} = {}
|
|
1781
|
+
const preventRefetch: Record<string, boolean> = {}
|
|
1764
1782
|
|
|
1765
1783
|
const LOAD_CHOICES_LIMIT = 500
|
|
1766
1784
|
const useDatabaseChoices = ({ databaseId='', field, otherAnswers } : { databaseId?: string, field: FormField, otherAnswers?: DatabaseSelectResponse[] }) => {
|
|
@@ -1774,11 +1792,14 @@ const useDatabaseChoices = ({ databaseId='', field, otherAnswers } : { databaseI
|
|
|
1774
1792
|
const choices = choicesForDatabase[databaseId]?.records ?? []
|
|
1775
1793
|
const lastId = choicesForDatabase[databaseId]?.lastId
|
|
1776
1794
|
|
|
1795
|
+
if (preventRefetch[databaseId + field.id + lastId]) return
|
|
1796
|
+
preventRefetch[databaseId + field.id + lastId] = true
|
|
1797
|
+
|
|
1777
1798
|
session.api.form_fields.load_choices_from_database({
|
|
1778
1799
|
fieldId: field.id,
|
|
1779
1800
|
lastId,
|
|
1780
1801
|
limit: LOAD_CHOICES_LIMIT,
|
|
1781
|
-
databaseId, //
|
|
1802
|
+
databaseId, // overrides fieldId, supports using Database question in Table Input
|
|
1782
1803
|
})
|
|
1783
1804
|
.then(({ choices: newChoices }) => {
|
|
1784
1805
|
choicesForDatabase[databaseId] = {
|
|
@@ -1795,6 +1816,7 @@ const useDatabaseChoices = ({ databaseId='', field, otherAnswers } : { databaseI
|
|
|
1795
1816
|
})
|
|
1796
1817
|
.catch(err => {
|
|
1797
1818
|
console.error(err)
|
|
1819
|
+
preventRefetch[databaseId + field.id + lastId] = false
|
|
1798
1820
|
})
|
|
1799
1821
|
}, [session, field, databaseId, renderCount])
|
|
1800
1822
|
|
|
@@ -1849,7 +1871,7 @@ const get_other_answers = (_value?: DatabaseSelectResponse[], typing?: string) =
|
|
|
1849
1871
|
return []
|
|
1850
1872
|
}
|
|
1851
1873
|
|
|
1852
|
-
export const DatabaseSelectInput = ({ field, value: _value, onChange, onDatabaseSelect, responses }: FormInputProps<'Database Select'> & {
|
|
1874
|
+
export const DatabaseSelectInput = ({ field, value: _value, onChange, onDatabaseSelect, responses, size }: FormInputProps<'Database Select'> & {
|
|
1853
1875
|
responses: FormResponseValue[],
|
|
1854
1876
|
}) => {
|
|
1855
1877
|
const [typing, setTyping] = useState('')
|
|
@@ -1944,7 +1966,7 @@ export const DatabaseSelectInput = ({ field, value: _value, onChange, onDatabase
|
|
|
1944
1966
|
|
|
1945
1967
|
if (!doneLoading) return <LinearProgress />
|
|
1946
1968
|
return (
|
|
1947
|
-
<Autocomplete id={field.id} freeSolo={false}
|
|
1969
|
+
<Autocomplete id={field.id} freeSolo={false} size={size}
|
|
1948
1970
|
componentsProps={{ popper: { sx: { wordBreak: "break-word" } } } }
|
|
1949
1971
|
options={filteredChoices} multiple={true}
|
|
1950
1972
|
getOptionLabel={o => (
|
|
@@ -3342,9 +3364,7 @@ export const ChargeebeeInput = ({ field, value, onChange, setCustomerId }: FormI
|
|
|
3342
3364
|
onChange({ url }, field.id)
|
|
3343
3365
|
}, [loadCount, url])
|
|
3344
3366
|
|
|
3345
|
-
if (
|
|
3346
|
-
if (!url) return <LinearProgress />
|
|
3347
|
-
if (loadCount === 2) {
|
|
3367
|
+
if (value || loadCount === 2) {
|
|
3348
3368
|
return (
|
|
3349
3369
|
<Grid container alignItems="center" wrap="nowrap">
|
|
3350
3370
|
<CheckCircleOutline color="success" />
|
|
@@ -3355,6 +3375,8 @@ export const ChargeebeeInput = ({ field, value, onChange, setCustomerId }: FormI
|
|
|
3355
3375
|
</Grid>
|
|
3356
3376
|
)
|
|
3357
3377
|
}
|
|
3378
|
+
if (error && typeof error === 'string') return <Typography color="error">{error}</Typography>
|
|
3379
|
+
if (!url) return <LinearProgress />
|
|
3358
3380
|
return (
|
|
3359
3381
|
<iframe src={url} title="Checkout" style={{ border: 'none', width: '100%', height: 700 }}
|
|
3360
3382
|
onLoad={() => setLoadCount(l => l + 1)}
|
package/src/table.tsx
CHANGED
|
@@ -132,6 +132,7 @@ export type TableField <T> = {
|
|
|
132
132
|
filterIsActive?: boolean,
|
|
133
133
|
filterComponent?: React.ReactNode,
|
|
134
134
|
allowWidthAdjustment?: boolean,
|
|
135
|
+
columnResizeZIndex?: number,
|
|
135
136
|
}
|
|
136
137
|
export interface TableHeaderProps<T extends Item> extends Styled, HorizontalPadded, SelectionPropsOptional {
|
|
137
138
|
fields: TableField<T>[],
|
|
@@ -147,6 +148,7 @@ export interface TableHeaderProps<T extends Item> extends Styled, HorizontalPadd
|
|
|
147
148
|
setLocalFilters: React.Dispatch<React.SetStateAction<LocalFilter[]>>,
|
|
148
149
|
filterSuggestions: Record<string, string[]>,
|
|
149
150
|
minColumnWidth?: number,
|
|
151
|
+
columnResizeZIndex?: number,
|
|
150
152
|
}
|
|
151
153
|
export const TableHeader = <T extends Item>({
|
|
152
154
|
fields,
|
|
@@ -167,6 +169,7 @@ export const TableHeader = <T extends Item>({
|
|
|
167
169
|
setLocalFilters,
|
|
168
170
|
filterSuggestions,
|
|
169
171
|
minColumnWidth=75,
|
|
172
|
+
columnResizeZIndex=1000,
|
|
170
173
|
} : TableHeaderProps<T>) => {
|
|
171
174
|
const [openFilter, setOpenFilter] = useState(-1)
|
|
172
175
|
const [startX, setStartX] = useState(0)
|
|
@@ -341,7 +344,7 @@ export const TableHeader = <T extends Item>({
|
|
|
341
344
|
height: '30px',
|
|
342
345
|
backgroundColor: '#22222266',
|
|
343
346
|
cursor: 'col-resize',
|
|
344
|
-
zIndex:
|
|
347
|
+
zIndex: columnResizeZIndex,
|
|
345
348
|
position: 'relative', right: '6px',
|
|
346
349
|
}} />
|
|
347
350
|
</Draggable>
|
|
@@ -725,6 +728,7 @@ export interface TableProps<T extends Item> extends WithTitle, WithHeader<T>, Wi
|
|
|
725
728
|
loadMoreOptions?: LoadMoreOptions<T>,
|
|
726
729
|
refreshFilterSuggestionsKey?: number,
|
|
727
730
|
minColumnWidth?: number,
|
|
731
|
+
columnResizeZIndex?: number,
|
|
728
732
|
}
|
|
729
733
|
export const Table = <T extends Item>({
|
|
730
734
|
items,
|
|
@@ -775,10 +779,11 @@ export const Table = <T extends Item>({
|
|
|
775
779
|
onReorder,
|
|
776
780
|
virtualization,
|
|
777
781
|
onExport,
|
|
778
|
-
|
|
782
|
+
|
|
779
783
|
sort,
|
|
780
784
|
refreshFilterSuggestionsKey,
|
|
781
785
|
minColumnWidth,
|
|
786
|
+
columnResizeZIndex,
|
|
782
787
|
}: TableProps<T> & Styled) => {
|
|
783
788
|
const sortingStorageKey = (memoryId ?? '') + 'sorting'
|
|
784
789
|
const cachedSortString = read_local_storage(sortingStorageKey)
|
|
@@ -1045,6 +1050,7 @@ export const Table = <T extends Item>({
|
|
|
1045
1050
|
: undefined
|
|
1046
1051
|
}
|
|
1047
1052
|
minColumnWidth={minColumnWidth}
|
|
1053
|
+
columnResizeZIndex={columnResizeZIndex}
|
|
1048
1054
|
/>
|
|
1049
1055
|
)}
|
|
1050
1056
|
|