@teselagen/ui 0.7.34 → 0.7.36
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/isBeingCalledExcessively.js +2 -0
- package/package.json +1 -1
- package/style.css +26 -10
- package/DataTable/utils/filterLocalEntitiesToHasura.d.ts +0 -5
- package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +0 -2
- package/DataTable/utils/tableQueryParamsToHasuraClauses.d.ts +0 -26
- package/src/AdvancedOptions.js +0 -33
- package/src/AdvancedOptions.spec.js +0 -26
- package/src/AssignDefaultsModeContext.js +0 -22
- package/src/AsyncValidateFieldSpinner/index.js +0 -12
- package/src/BlueprintError/index.js +0 -14
- package/src/BounceLoader/index.js +0 -16
- package/src/BounceLoader/style.css +0 -45
- package/src/CollapsibleCard/index.js +0 -68
- package/src/CollapsibleCard/style.css +0 -23
- package/src/DNALoader/index.js +0 -20
- package/src/DNALoader/style.css +0 -251
- package/src/DataTable/CellDragHandle.js +0 -132
- package/src/DataTable/ColumnFilterMenu.js +0 -62
- package/src/DataTable/Columns.js +0 -979
- package/src/DataTable/DisabledLoadingComponent.js +0 -15
- package/src/DataTable/DisplayOptions.js +0 -199
- package/src/DataTable/DropdownCell.js +0 -61
- package/src/DataTable/EditableCell.js +0 -44
- package/src/DataTable/FilterAndSortMenu.js +0 -388
- package/src/DataTable/PagingTool.js +0 -225
- package/src/DataTable/RenderCell.js +0 -191
- package/src/DataTable/SearchBar.js +0 -69
- package/src/DataTable/SortableColumns.js +0 -100
- package/src/DataTable/TableFormTrackerContext.js +0 -10
- package/src/DataTable/ThComponent.js +0 -44
- package/src/DataTable/dataTableEnhancer.js +0 -41
- package/src/DataTable/defaultFormatters.js +0 -32
- package/src/DataTable/defaultValidators.js +0 -40
- package/src/DataTable/editCellHelper.js +0 -44
- package/src/DataTable/getCellVal.js +0 -20
- package/src/DataTable/getVals.js +0 -8
- package/src/DataTable/index.js +0 -3209
- package/src/DataTable/isTruthy.js +0 -12
- package/src/DataTable/isValueEmpty.js +0 -3
- package/src/DataTable/style.css +0 -608
- package/src/DataTable/utils/convertSchema.js +0 -69
- package/src/DataTable/utils/filterLocalEntitiesToHasura.js +0 -236
- package/src/DataTable/utils/filterLocalEntitiesToHasura.test.js +0 -587
- package/src/DataTable/utils/formatPasteData.js +0 -16
- package/src/DataTable/utils/getAllRows.js +0 -11
- package/src/DataTable/utils/getCellCopyText.js +0 -7
- package/src/DataTable/utils/getCellInfo.js +0 -36
- package/src/DataTable/utils/getFieldPathToField.js +0 -7
- package/src/DataTable/utils/getIdOrCodeOrIndex.js +0 -9
- package/src/DataTable/utils/getLastSelectedEntity.js +0 -11
- package/src/DataTable/utils/getNewEntToSelect.js +0 -25
- package/src/DataTable/utils/getRowCopyText.js +0 -28
- package/src/DataTable/utils/getTableConfigFromStorage.js +0 -5
- package/src/DataTable/utils/handleCopyColumn.js +0 -21
- package/src/DataTable/utils/handleCopyHelper.js +0 -15
- package/src/DataTable/utils/handleCopyRows.js +0 -23
- package/src/DataTable/utils/handleCopyTable.js +0 -16
- package/src/DataTable/utils/index.js +0 -55
- package/src/DataTable/utils/initializeHasuraWhereAndFilter.js +0 -26
- package/src/DataTable/utils/isBottomRightCornerOfRectangle.js +0 -20
- package/src/DataTable/utils/isEntityClean.js +0 -15
- package/src/DataTable/utils/primarySelectedValue.js +0 -1
- package/src/DataTable/utils/queryParams.js +0 -350
- package/src/DataTable/utils/removeCleanRows.js +0 -22
- package/src/DataTable/utils/rowClick.js +0 -181
- package/src/DataTable/utils/selection.js +0 -8
- package/src/DataTable/utils/tableQueryParamsToHasuraClauses.js +0 -253
- package/src/DataTable/utils/tableQueryParamsToHasuraClauses.test.js +0 -206
- package/src/DataTable/utils/useTableEntities.js +0 -38
- package/src/DataTable/utils/utils.js +0 -37
- package/src/DataTable/utils/withSelectedEntities.js +0 -65
- package/src/DataTable/utils/withTableParams.js +0 -288
- package/src/DataTable/validateTableWideErrors.js +0 -160
- package/src/DataTable/viewColumn.js +0 -97
- package/src/DialogFooter/index.js +0 -86
- package/src/DialogFooter/style.css +0 -9
- package/src/DropdownButton.js +0 -36
- package/src/FillWindow.css +0 -6
- package/src/FillWindow.js +0 -69
- package/src/FormComponents/FormSeparator.js +0 -9
- package/src/FormComponents/LoadingDots.js +0 -14
- package/src/FormComponents/Uploader.js +0 -1278
- package/src/FormComponents/getNewName.js +0 -31
- package/src/FormComponents/index.js +0 -1266
- package/src/FormComponents/itemUpload.js +0 -84
- package/src/FormComponents/sortify.js +0 -73
- package/src/FormComponents/style.css +0 -275
- package/src/FormComponents/tryToMatchSchemas.js +0 -264
- package/src/FormComponents/utils.js +0 -6
- package/src/HotkeysDialog/index.js +0 -79
- package/src/HotkeysDialog/style.css +0 -54
- package/src/InfoHelper/index.js +0 -78
- package/src/InfoHelper/style.css +0 -7
- package/src/IntentText/index.js +0 -18
- package/src/Loading/index.js +0 -70
- package/src/Loading/style.css +0 -4
- package/src/MatchHeaders.js +0 -234
- package/src/MenuBar/index.js +0 -423
- package/src/MenuBar/style.css +0 -45
- package/src/PromptUnsavedChanges/index.js +0 -38
- package/src/ResizableDraggableDialog/index.js +0 -141
- package/src/ResizableDraggableDialog/style.css +0 -42
- package/src/ScrollToTop/index.js +0 -72
- package/src/SimpleStepViz.js +0 -22
- package/src/Tag.js +0 -112
- package/src/TagSelect/index.js +0 -69
- package/src/TagSelect/style.css +0 -13
- package/src/TgHtmlSelect/index.js +0 -20
- package/src/TgSelect/index.js +0 -537
- package/src/TgSelect/style.css +0 -61
- package/src/TgSuggest/index.js +0 -124
- package/src/Timeline/TimelineEvent.js +0 -31
- package/src/Timeline/index.js +0 -15
- package/src/Timeline/style.css +0 -29
- package/src/UploadCsvWizard.css +0 -4
- package/src/UploadCsvWizard.js +0 -719
- package/src/autoTooltip.js +0 -201
- package/src/constants.js +0 -1
- package/src/customIcons.js +0 -361
- package/src/enhancers/withDialog/index.js +0 -196
- package/src/enhancers/withDialog/tg_modalState.js +0 -47
- package/src/enhancers/withField.js +0 -20
- package/src/enhancers/withFields.js +0 -11
- package/src/enhancers/withLocalStorage.js +0 -11
- package/src/index.js +0 -88
- package/src/rerenderOnWindowResize.js +0 -26
- package/src/showAppSpinner.js +0 -12
- package/src/showConfirmationDialog/index.js +0 -148
- package/src/showDialogOnDocBody.js +0 -33
- package/src/style.css +0 -265
- package/src/throwFormError.js +0 -16
- package/src/toastr.js +0 -148
- package/src/typeToCommonType.js +0 -6
- package/src/useDialog.js +0 -63
- package/src/utils/adHoc.js +0 -10
- package/src/utils/basicHandleActionsWithFullState.js +0 -14
- package/src/utils/browserUtils.js +0 -3
- package/src/utils/combineReducersWithFullState.js +0 -14
- package/src/utils/commandControls.js +0 -82
- package/src/utils/commandUtils.js +0 -112
- package/src/utils/determineBlackOrWhiteTextColor.js +0 -4
- package/src/utils/getDayjsFormatter.js +0 -35
- package/src/utils/getTextFromEl.js +0 -28
- package/src/utils/handlerHelpers.js +0 -24
- package/src/utils/hooks/index.js +0 -1
- package/src/utils/hooks/useDeepEqualMemo.js +0 -15
- package/src/utils/hooks/useStableReference.js +0 -9
- package/src/utils/hotkeyUtils.js +0 -131
- package/src/utils/isBeingCalledExcessively.js +0 -24
- package/src/utils/menuUtils.js +0 -433
- package/src/utils/popoverOverflowModifiers.js +0 -11
- package/src/utils/pureNoFunc.js +0 -31
- package/src/utils/renderOnDoc.js +0 -32
- package/src/utils/showProgressToast.js +0 -22
- package/src/utils/tagUtils.js +0 -45
- package/src/utils/tgFormValues.js +0 -35
- package/src/utils/useTraceUpdate.js +0 -19
- package/src/utils/withSelectTableRecords.js +0 -43
- package/src/utils/withStore.js +0 -10
- package/src/wrapDialog.js +0 -116
package/src/style.css
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--base1: #ffffff;
|
|
3
|
-
--base2: #cdcdcd;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
body.bp3-dark {
|
|
7
|
-
--base1: #393a3a;
|
|
8
|
-
--base2: #293742;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.bp3-dark .tg-card {
|
|
12
|
-
background: #394b59 !important;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.preserve-newline {
|
|
16
|
-
white-space: pre-line;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.bp3-dialog {
|
|
20
|
-
max-width: 100vw;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/* adding back in blueprint v2 default styling to all <h/> elements */
|
|
24
|
-
h1 {
|
|
25
|
-
line-height: 40px;
|
|
26
|
-
font-size: 36px;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
h2 {
|
|
30
|
-
line-height: 32px;
|
|
31
|
-
font-size: 28px;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
h3 {
|
|
35
|
-
line-height: 25px;
|
|
36
|
-
font-size: 22px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
h4 {
|
|
40
|
-
line-height: 21px;
|
|
41
|
-
font-size: 18px;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
h5 {
|
|
45
|
-
line-height: 19px;
|
|
46
|
-
font-size: 16px;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
h6 {
|
|
50
|
-
line-height: 16px;
|
|
51
|
-
font-size: 14px;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
h1,
|
|
55
|
-
h2,
|
|
56
|
-
h3,
|
|
57
|
-
h4,
|
|
58
|
-
h5,
|
|
59
|
-
h6,
|
|
60
|
-
h1.bp3-heading,
|
|
61
|
-
h2.bp3-heading,
|
|
62
|
-
h3.bp3-heading,
|
|
63
|
-
h4.bp3-heading,
|
|
64
|
-
h5.bp3-heading,
|
|
65
|
-
h6.bp3-heading {
|
|
66
|
-
color: #182026;
|
|
67
|
-
font-weight: 300;
|
|
68
|
-
margin: 0 0 10px;
|
|
69
|
-
padding: 0;
|
|
70
|
-
line-height: normal;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.bp3-dark h1,
|
|
74
|
-
.bp3-dark h2,
|
|
75
|
-
.bp3-dark h3,
|
|
76
|
-
.bp3-dark h4,
|
|
77
|
-
.bp3-dark h5,
|
|
78
|
-
.bp3-dark h6 {
|
|
79
|
-
color: #f5f8fa;
|
|
80
|
-
}
|
|
81
|
-
.bp3-dark textarea {
|
|
82
|
-
background: #293742;
|
|
83
|
-
color: #f5f8fa;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/* bp3 fix https://github.com/palantir/blueprint/issues/2807 */
|
|
87
|
-
.bp3-popover-wrapper {
|
|
88
|
-
display: inline-block;
|
|
89
|
-
position: relative;
|
|
90
|
-
vertical-align: top;
|
|
91
|
-
}
|
|
92
|
-
/* this line is necessary otherwise the line above setting "position: relative;" caused nested long bp3 submenus to not appear correctly when using the fix below */
|
|
93
|
-
.bp3-submenu .bp3-popover-wrapper {
|
|
94
|
-
position: unset;
|
|
95
|
-
}
|
|
96
|
-
/* this fixes https://github.com/palantir/blueprint/issues/4791 but requires the "position: unset;" fix above */
|
|
97
|
-
.bp3-submenu > * > .bp3-menu {
|
|
98
|
-
max-height: 96vh;
|
|
99
|
-
overflow: auto;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/* bp3 fix https://github.com/palantir/blueprint/issues/2807 */
|
|
103
|
-
span.bp3-popover-target {
|
|
104
|
-
display: block;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.bp3-portal {
|
|
108
|
-
z-index: 100000;
|
|
109
|
-
}
|
|
110
|
-
.bp3-switch {
|
|
111
|
-
width: fit-content;
|
|
112
|
-
display: flex;
|
|
113
|
-
align-items: center;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.Select {
|
|
117
|
-
min-width: 170px;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/* override the default blueprint input focus to instead rely on an inset box shadow. This resolves any issues with overflow:hidden cutting off input box shadows */
|
|
121
|
-
.bp3-dark .bp3-input:focus,
|
|
122
|
-
.bp3-input:focus {
|
|
123
|
-
box-shadow: inset 0 0 3px 1px #137cbd;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.notClickable {
|
|
127
|
-
cursor: default !important;
|
|
128
|
-
}
|
|
129
|
-
.bp3-toast-container {
|
|
130
|
-
z-index: 100001;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.link-button {
|
|
134
|
-
background: none !important;
|
|
135
|
-
border: none;
|
|
136
|
-
padding: 0 !important;
|
|
137
|
-
font-family: arial, sans-serif;
|
|
138
|
-
color: rgb(0, 151, 227);
|
|
139
|
-
/* text-decoration: underline; */
|
|
140
|
-
cursor: pointer;
|
|
141
|
-
}
|
|
142
|
-
.link-button:hover {
|
|
143
|
-
color: rgb(98, 198, 248);
|
|
144
|
-
text-decoration: underline;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.above-dialog {
|
|
148
|
-
z-index: 100001;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
code {
|
|
152
|
-
display: block;
|
|
153
|
-
white-space: pre-wrap;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.bp3-toast.no-close-button [aria-label="Close"] {
|
|
157
|
-
display: none;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.isDataTitle .tippy-box[data-theme~="teselagen"] .tippy-arrow {
|
|
161
|
-
opacity: 0 !important;
|
|
162
|
-
}
|
|
163
|
-
.isDataTitle .tippy-box[data-theme~="teselagen"] {
|
|
164
|
-
background-color: #4f4a50f4 !important;
|
|
165
|
-
border-radius: 0 !important;
|
|
166
|
-
color: #f3f3f3 !important;
|
|
167
|
-
font-size: 11px !important;
|
|
168
|
-
white-space: pre-wrap;
|
|
169
|
-
padding: 0px 0px !important;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
[data-tippy-root]:has(.tippy-box[data-theme~="teselagen"]) {
|
|
173
|
-
z-index: 100000 !important;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
[data-tippy-root] .tippy-box[data-theme~="teselagen"] {
|
|
177
|
-
background-color: #394b59;
|
|
178
|
-
color: #f5f8fa;
|
|
179
|
-
padding: 4px 4px;
|
|
180
|
-
word-break: break-word;
|
|
181
|
-
}
|
|
182
|
-
[data-tippy-root] .tippy-box[data-theme~="teselagen"] .tippy-arrow {
|
|
183
|
-
color: #394b59;
|
|
184
|
-
}
|
|
185
|
-
.bp3-dark [data-tippy-root] .tippy-box[data-theme~="teselagen"] {
|
|
186
|
-
background-color: #e1e8ed;
|
|
187
|
-
color: #394b59;
|
|
188
|
-
}
|
|
189
|
-
.bp3-dark [data-tippy-root] .tippy-box[data-theme~="teselagen"] .tippy-arrow {
|
|
190
|
-
/* background-color: #e1e8ed; */
|
|
191
|
-
color: #e1e8ed;
|
|
192
|
-
}
|
|
193
|
-
.isCellEditable .rt-td {
|
|
194
|
-
position: relative;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.ReactTable .tg-cell-edit-boolean-checkbox {
|
|
198
|
-
margin-bottom: 0;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.cellDragHandle {
|
|
202
|
-
height: 8px;
|
|
203
|
-
width: 8px;
|
|
204
|
-
cursor: crosshair;
|
|
205
|
-
border: 1px solid rgb(255, 255, 255);
|
|
206
|
-
background-color: rgb(76, 107, 171);
|
|
207
|
-
position: absolute;
|
|
208
|
-
bottom: -4px;
|
|
209
|
-
right: -4px;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
/* make AnchorButton match Button */
|
|
213
|
-
.bp3-button {
|
|
214
|
-
font-family: Arial;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
button {
|
|
218
|
-
transition: all 0.2s ease-in-out;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
button:not(:disabled):active {
|
|
222
|
-
transform: translateY(1px);
|
|
223
|
-
}
|
|
224
|
-
.bp3-tabs.bp3-vertical > .bp3-tab-panel {
|
|
225
|
-
min-width: 0px;
|
|
226
|
-
}
|
|
227
|
-
.bp3-toast[class*="bp3-intent-"] .bp3-button.tg-clear-all-toasts {
|
|
228
|
-
border: 1px solid white !important;
|
|
229
|
-
}
|
|
230
|
-
.bp3-toast[class*="bp3-intent-"] .bp3-button.tg-clear-all-toasts:hover {
|
|
231
|
-
/* background: blue !important; */
|
|
232
|
-
/* background: unset !important; */
|
|
233
|
-
background-color: #137cbd !important;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/* .bp3-toast .tg-clear-all-toasts {
|
|
237
|
-
background: unset !important;
|
|
238
|
-
color: unset !important;
|
|
239
|
-
padding: unset !important;
|
|
240
|
-
margin: unset !important;
|
|
241
|
-
font-size: unset !important;
|
|
242
|
-
line-height: unset !important;
|
|
243
|
-
border: unset !important;
|
|
244
|
-
box-shadow: unset !important;
|
|
245
|
-
text-align: unset !important;
|
|
246
|
-
cursor: pointer !important;
|
|
247
|
-
} */
|
|
248
|
-
|
|
249
|
-
.bp3-dialog-header .bp3-heading {
|
|
250
|
-
width: 10px; /* tnw: this is a hack to prevent the dialog title from causing the dialog width to expand larger than the dialog content*/
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/* to fix tooltip styling issue - https://github.com/palantir/blueprint/issues/3430 */
|
|
254
|
-
.bp3-popover[style*="transform-origin"][style*="bottom"] .bp3-popover-arrow {
|
|
255
|
-
transform: translate(0, -0.5px);
|
|
256
|
-
}
|
|
257
|
-
.bp3-popover[style*="transform-origin"][style*="left"] .bp3-popover-arrow {
|
|
258
|
-
transform: translate(0.5px, 0);
|
|
259
|
-
}
|
|
260
|
-
.bp3-popover[style*="transform-origin"][style*="top"] .bp3-popover-arrow {
|
|
261
|
-
transform: translate(0, 0.5px);
|
|
262
|
-
}
|
|
263
|
-
.bp3-popover[style*="transform-origin"][style*="right"] .bp3-popover-arrow {
|
|
264
|
-
transform: translate(-0.5px, 0);
|
|
265
|
-
}
|
package/src/throwFormError.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { SubmissionError } from "redux-form";
|
|
2
|
-
|
|
3
|
-
export const throwFormError = error => {
|
|
4
|
-
if (error.message) {
|
|
5
|
-
console.error("error:", error);
|
|
6
|
-
}
|
|
7
|
-
const errorToUse = error.message
|
|
8
|
-
? { _error: error.message }
|
|
9
|
-
: typeof error === "string"
|
|
10
|
-
? { _error: error }
|
|
11
|
-
: error;
|
|
12
|
-
if (!errorToUse._error) {
|
|
13
|
-
errorToUse._error = "Error Submitting Form";
|
|
14
|
-
}
|
|
15
|
-
throw new SubmissionError(errorToUse);
|
|
16
|
-
};
|
package/src/toastr.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { Position, Toaster, Intent, Classes } from "@blueprintjs/core";
|
|
2
|
-
import classNames from "classnames";
|
|
3
|
-
|
|
4
|
-
const TopToaster = Toaster.create({
|
|
5
|
-
className: "top-toaster",
|
|
6
|
-
position: Position.TOP
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
const BottomToaster = Toaster.create({
|
|
10
|
-
className: "bottom-toaster",
|
|
11
|
-
position: Position.BOTTOM
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
window.__tgClearAllToasts = () => {
|
|
15
|
-
TopToaster.clear();
|
|
16
|
-
BottomToaster.clear();
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
let counter = 5000;
|
|
20
|
-
const generateToast = intent => (message, options) => {
|
|
21
|
-
options = options || {};
|
|
22
|
-
const toastToUse = options.bottom ? BottomToaster : TopToaster;
|
|
23
|
-
let updatedTimeout;
|
|
24
|
-
if (options.updateTimeout) {
|
|
25
|
-
//generate a slightly different than default timeout to make the update stay on the page for a full 5 seconds
|
|
26
|
-
if (counter > 5500) {
|
|
27
|
-
updatedTimeout = --counter;
|
|
28
|
-
} else {
|
|
29
|
-
updatedTimeout = ++counter;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (intent === Intent.DANGER) {
|
|
33
|
-
console.error("Toastr error message: ", message);
|
|
34
|
-
}
|
|
35
|
-
if (intent === Intent.WARNING) {
|
|
36
|
-
console.error("Toastr warning message: ", message);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const maybeAddClearAll = () => {
|
|
40
|
-
// wipe any existing clear all buttons
|
|
41
|
-
const existingClearAllButtons =
|
|
42
|
-
document.querySelectorAll(`.tg-clear-all-toasts`);
|
|
43
|
-
existingClearAllButtons.forEach(button => {
|
|
44
|
-
button.remove();
|
|
45
|
-
});
|
|
46
|
-
const activeToasts = document.querySelectorAll(
|
|
47
|
-
`.bp3-toast:not(.bp3-toast-exit)`
|
|
48
|
-
);
|
|
49
|
-
if (activeToasts.length > 1) {
|
|
50
|
-
// add custom clear all button
|
|
51
|
-
|
|
52
|
-
const topToaster = document.querySelector(`.bp3-toast`);
|
|
53
|
-
if (!topToaster) return;
|
|
54
|
-
const closeButton = document.createElement("div");
|
|
55
|
-
closeButton.classList.add(
|
|
56
|
-
Classes.BUTTON,
|
|
57
|
-
Classes.LARGE,
|
|
58
|
-
Classes.INTENT_PRIMARY,
|
|
59
|
-
"tg-clear-all-toasts"
|
|
60
|
-
);
|
|
61
|
-
closeButton.innerText = "Clear all";
|
|
62
|
-
closeButton.onclick = window.__tgClearAllToasts;
|
|
63
|
-
// position the button to the right of the message
|
|
64
|
-
closeButton.style.position = "absolute";
|
|
65
|
-
closeButton.style.right = "-100px";
|
|
66
|
-
|
|
67
|
-
topToaster.appendChild(closeButton);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
const uniqKey = toastToUse.show(
|
|
71
|
-
{
|
|
72
|
-
intent,
|
|
73
|
-
message,
|
|
74
|
-
onDismiss: () => {
|
|
75
|
-
if (options.onDismiss) {
|
|
76
|
-
options.onDismiss();
|
|
77
|
-
}
|
|
78
|
-
setTimeout(() => {
|
|
79
|
-
maybeAddClearAll();
|
|
80
|
-
}, 0);
|
|
81
|
-
},
|
|
82
|
-
timeout:
|
|
83
|
-
options.timeout ||
|
|
84
|
-
updatedTimeout ||
|
|
85
|
-
(!window.Cypress &&
|
|
86
|
-
(intent === Intent.DANGER || intent === Intent.WARNING)
|
|
87
|
-
? 60000
|
|
88
|
-
: undefined),
|
|
89
|
-
action: options.action,
|
|
90
|
-
icon: options.icon,
|
|
91
|
-
className: classNames("preserve-newline", options.className)
|
|
92
|
-
},
|
|
93
|
-
options.key
|
|
94
|
-
);
|
|
95
|
-
setTimeout(() => {
|
|
96
|
-
maybeAddClearAll();
|
|
97
|
-
}, 0);
|
|
98
|
-
function clear() {
|
|
99
|
-
toastToUse.dismiss(uniqKey);
|
|
100
|
-
setTimeout(() => {
|
|
101
|
-
maybeAddClearAll();
|
|
102
|
-
}, 0);
|
|
103
|
-
}
|
|
104
|
-
clear.key = uniqKey;
|
|
105
|
-
return clear;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
function preventDuplicates(func) {
|
|
109
|
-
const previousToasts = {};
|
|
110
|
-
return (message, options = {}) => {
|
|
111
|
-
const clearToast = func(message, options);
|
|
112
|
-
// no duplicate check for toasts with updates
|
|
113
|
-
|
|
114
|
-
if (!options.key) {
|
|
115
|
-
if (!options.key && previousToasts[message]) {
|
|
116
|
-
previousToasts[message](); //clear it!
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
setTimeout(() => {
|
|
120
|
-
delete previousToasts[message];
|
|
121
|
-
}, options.timeout || 5000);
|
|
122
|
-
|
|
123
|
-
previousToasts[message] = clearToast;
|
|
124
|
-
}
|
|
125
|
-
return clearToast;
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (!window.toastr) window.toastr = {};
|
|
130
|
-
if (!window.toastr.success) {
|
|
131
|
-
window.toastr.success = preventDuplicates(generateToast(Intent.SUCCESS));
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (!window.toastr.error) {
|
|
135
|
-
window.toastr.error = preventDuplicates(generateToast(Intent.DANGER));
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (!window.toastr.warning) {
|
|
139
|
-
window.toastr.warning = preventDuplicates(generateToast(Intent.WARNING));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (!window.toastr.info) {
|
|
143
|
-
window.toastr.info = preventDuplicates(generateToast(Intent.PRIMARY));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (!window.toastr.default) {
|
|
147
|
-
window.toastr.default = preventDuplicates(generateToast(Intent.NONE));
|
|
148
|
-
}
|
package/src/typeToCommonType.js
DELETED
package/src/useDialog.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useState } from "react";
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
|
|
5
|
-
const {toggleDialog, comp} = useDialog({
|
|
6
|
-
ModalComponent: SimpleInsertData,
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
return <div>
|
|
10
|
-
{comp} //stick the returned dialog comp somewhere in the dom! (it should not effect layout)
|
|
11
|
-
{...your code here}
|
|
12
|
-
</div>
|
|
13
|
-
|
|
14
|
-
*/
|
|
15
|
-
export const useDialog = ({ ModalComponent }) => {
|
|
16
|
-
const [isOpen, setOpen] = useState(false);
|
|
17
|
-
const [additionalProps, setAdditionalProps] = useState(false);
|
|
18
|
-
const Comp = useCallback(
|
|
19
|
-
() => (
|
|
20
|
-
<ModalComponent
|
|
21
|
-
hideModal={() => {
|
|
22
|
-
setOpen(false);
|
|
23
|
-
}}
|
|
24
|
-
hideDialog={() => {
|
|
25
|
-
setOpen(false);
|
|
26
|
-
}}
|
|
27
|
-
{...additionalProps}
|
|
28
|
-
dialogProps={{
|
|
29
|
-
isOpen,
|
|
30
|
-
...additionalProps?.dialogProps
|
|
31
|
-
}}
|
|
32
|
-
/>
|
|
33
|
-
),
|
|
34
|
-
[ModalComponent, additionalProps, isOpen]
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
const showDialogPromise = useCallback(async (handlerName, moreProps = {}) => {
|
|
38
|
-
return new Promise(resolve => {
|
|
39
|
-
//return a promise that can be awaited
|
|
40
|
-
setAdditionalProps({
|
|
41
|
-
hideModal: () => {
|
|
42
|
-
//override hideModal to resolve also
|
|
43
|
-
setOpen(false);
|
|
44
|
-
resolve({});
|
|
45
|
-
},
|
|
46
|
-
hideDialog: () => {
|
|
47
|
-
//override hideModal to resolve also
|
|
48
|
-
setOpen(false);
|
|
49
|
-
resolve({});
|
|
50
|
-
},
|
|
51
|
-
[handlerName]: r => {
|
|
52
|
-
setOpen(false);
|
|
53
|
-
resolve(r || {});
|
|
54
|
-
},
|
|
55
|
-
//pass any additional props to the dialog
|
|
56
|
-
...moreProps
|
|
57
|
-
});
|
|
58
|
-
setOpen(true); //open the dialog
|
|
59
|
-
});
|
|
60
|
-
}, []);
|
|
61
|
-
|
|
62
|
-
return { Comp, showDialogPromise };
|
|
63
|
-
};
|
package/src/utils/adHoc.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { compose } from "recompose";
|
|
3
|
-
|
|
4
|
-
//adHoc allows you to add dynamic HOCs to a component
|
|
5
|
-
export default func => WrappedComponent => props => {
|
|
6
|
-
const calledFunc = func(props);
|
|
7
|
-
const composeArgs = Array.isArray(calledFunc) ? calledFunc : [calledFunc];
|
|
8
|
-
const ComposedAndWrapped = compose(...composeArgs)(WrappedComponent);
|
|
9
|
-
return <ComposedAndWrapped {...props} />;
|
|
10
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default function basicHandleActionsWithFullState(
|
|
2
|
-
handlers,
|
|
3
|
-
defaultState
|
|
4
|
-
) {
|
|
5
|
-
return (state = defaultState, action, fullState) => {
|
|
6
|
-
const { type } = action;
|
|
7
|
-
const handler = handlers[type];
|
|
8
|
-
if (handler) {
|
|
9
|
-
return handler(state, action, fullState);
|
|
10
|
-
} else {
|
|
11
|
-
return state;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export default function combineReducers(reducers = {}) {
|
|
2
|
-
const reducerKeys = Object.keys(reducers);
|
|
3
|
-
return function combination(state = {}, action, fullState) {
|
|
4
|
-
let hasChanged = false;
|
|
5
|
-
const nextState = {};
|
|
6
|
-
fullState = fullState || state;
|
|
7
|
-
for (let i = 0; i < reducerKeys.length; i++) {
|
|
8
|
-
const key = reducerKeys[i];
|
|
9
|
-
nextState[key] = reducers[key](state[key], action, fullState);
|
|
10
|
-
hasChanged = hasChanged || nextState[key] !== state[key];
|
|
11
|
-
}
|
|
12
|
-
return hasChanged ? nextState : state;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Tooltip, Checkbox, Button, Switch } from "@blueprintjs/core";
|
|
3
|
-
|
|
4
|
-
export const withCommand =
|
|
5
|
-
mappings =>
|
|
6
|
-
WrappedComponent =>
|
|
7
|
-
({ cmd, cmdOptions = {}, ...props }) => {
|
|
8
|
-
const mappedProps = {};
|
|
9
|
-
Object.keys(mappings).forEach(k => {
|
|
10
|
-
mappedProps[k] =
|
|
11
|
-
mappings[k] === "execute"
|
|
12
|
-
? event => cmd.execute({ event })
|
|
13
|
-
: typeof mappings[k] === "function"
|
|
14
|
-
? mappings[k](cmd, props)
|
|
15
|
-
: cmd[mappings[k]];
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
let out = <WrappedComponent {...mappedProps} {...props} />;
|
|
19
|
-
const tooltip =
|
|
20
|
-
cmd.tooltip || (typeof cmd.isDisabled === "string" && cmd.isDisabled);
|
|
21
|
-
if (tooltip && !cmdOptions.ignoreTooltip) {
|
|
22
|
-
out = <Tooltip content={tooltip}>{out}</Tooltip>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return cmd.isHidden && !cmdOptions.ignoreHidden ? null : out;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const CmdCheckbox = withCommand({
|
|
29
|
-
onChange: "execute",
|
|
30
|
-
label: (cmd, props) =>
|
|
31
|
-
props.name ||
|
|
32
|
-
(props.prefix && (
|
|
33
|
-
<React.Fragment>
|
|
34
|
-
{props.prefix}
|
|
35
|
-
{cmd.name}
|
|
36
|
-
</React.Fragment>
|
|
37
|
-
)) ||
|
|
38
|
-
cmd.name,
|
|
39
|
-
disabled: "isDisabled",
|
|
40
|
-
checked: "isActive"
|
|
41
|
-
})(Checkbox);
|
|
42
|
-
|
|
43
|
-
export const CmdSwitch = withCommand({
|
|
44
|
-
onChange: "execute",
|
|
45
|
-
label: (cmd, props) =>
|
|
46
|
-
props.name ||
|
|
47
|
-
(props.prefix && (
|
|
48
|
-
<React.Fragment>
|
|
49
|
-
{props.prefix}
|
|
50
|
-
{cmd.name}
|
|
51
|
-
</React.Fragment>
|
|
52
|
-
)) ||
|
|
53
|
-
cmd.name,
|
|
54
|
-
disabled: "isDisabled",
|
|
55
|
-
checked: "isActive"
|
|
56
|
-
})(Switch);
|
|
57
|
-
|
|
58
|
-
const Div = ({ onChange, children }) => {
|
|
59
|
-
return <div onClick={onChange}>{children}</div>;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const CmdDiv = withCommand({
|
|
63
|
-
onChange: "execute",
|
|
64
|
-
children: (cmd, props) =>
|
|
65
|
-
props.name ||
|
|
66
|
-
(props.prefix && (
|
|
67
|
-
<React.Fragment>
|
|
68
|
-
{props.prefix}
|
|
69
|
-
{cmd.name}
|
|
70
|
-
</React.Fragment>
|
|
71
|
-
)) ||
|
|
72
|
-
cmd.name,
|
|
73
|
-
disabled: "isDisabled",
|
|
74
|
-
checked: "isActive"
|
|
75
|
-
})(Div);
|
|
76
|
-
|
|
77
|
-
export const CmdButton = withCommand({
|
|
78
|
-
onClick: "execute",
|
|
79
|
-
text: cmd => (cmd.isActive === false && cmd.inactiveName) || cmd.name,
|
|
80
|
-
icon: "icon",
|
|
81
|
-
disabled: "isDisabled"
|
|
82
|
-
})(Button);
|