chem-generic-ui 0.1.45 → 0.1.46
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/.babelrc +11 -0
- package/.eslintrc +23 -0
- package/.tool-versions +3 -0
- package/chem-generic-ui-v0.1.41.tgz +0 -0
- package/dist/bundle.js +1 -1
- package/dist/bundle.js.LICENSE.txt +70 -0
- package/dist/ds_details.json +57 -0
- package/dist/ds_klass.json +102 -0
- package/dist/ds_props.json +54 -0
- package/dist/index.html +14 -0
- package/dist/sg_details.json +2036 -0
- package/dist/sg_klass.json +850 -0
- package/dist/units_system.json +430 -0
- package/package.json +3 -6
- package/public/ds_details.json +57 -0
- package/public/ds_klass.json +102 -0
- package/public/ds_props.json +54 -0
- package/public/favicon.ico +0 -0
- package/public/images/not_available.svg +1 -0
- package/public/index.html +47 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/public/sg_details.json +2036 -0
- package/public/sg_klass.json +850 -0
- package/public/test/ds_props.json +54 -0
- package/public/units_system.json +430 -0
- package/src/asserts/bootstrap-theme.min.css +6 -0
- package/src/asserts/bootstrap.min.css +6 -0
- package/src/asserts/main.css +458 -0
- package/src/asserts/main.scss +490 -0
- package/src/components/admin/ElementManager.js +28 -0
- package/src/components/details/GenDSDetails.js +164 -0
- package/src/components/details/GenSgDetails.js +396 -0
- package/src/components/dnd/DragDropItemTypes.js +13 -0
- package/src/components/dnd/GenericElDropTarget.js +160 -0
- package/src/components/dnd/GridDnD.js +42 -0
- package/src/components/dnd/PanelDnD.js +85 -0
- package/src/components/fields/ButtonConfirm.js +45 -0
- package/src/components/fields/ButtonTooltip.js +46 -0
- package/src/components/fields/FieldLabel.js +18 -0
- package/src/components/fields/GenDSMisType.js +20 -0
- package/src/components/fields/GenFormGroupCb.js +17 -0
- package/src/components/fields/GenProperties.js +56 -0
- package/src/components/fields/GenPropertiesFields.js +440 -0
- package/src/components/layers/GenPropertiesLayer.js +178 -0
- package/src/components/layers/LayerModal.js +52 -0
- package/src/components/layers/LayersLayout.js +68 -0
- package/src/components/models/Attachment.js +37 -0
- package/src/components/models/GenericSubField.js +10 -0
- package/src/components/table/DropLinkRenderer.js +35 -0
- package/src/components/table/DropRenderer.js +31 -0
- package/src/components/table/DropTextRenderer.js +25 -0
- package/src/components/table/GenericElTableDropTarget.js +131 -0
- package/src/components/table/GridBtn.js +41 -0
- package/src/components/table/GridEntry.js +75 -0
- package/src/components/table/SamOption.js +53 -0
- package/src/components/table/SelectRenderer.js +34 -0
- package/src/components/table/TableRecord.js +254 -0
- package/src/components/table/UConverterRenderer.js +24 -0
- package/src/components/tools/collate.js +65 -0
- package/src/components/tools/orten.js +171 -0
- package/src/components/tools/utils.js +414 -0
- package/src/data/SystemUnits.js +434 -0
- package/src/data/systemUnits.json +430 -0
- package/src/index.css +13 -0
- package/src/index.html +1 -0
- package/src/index.js +45 -0
- package/src/logo.svg +1 -0
- package/src/simulations/SimuDS.js +52 -0
- package/src/simulations/SimuSG.js +54 -0
- package/webpack.config.js +46 -0
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
|
|
2
|
+
$color-editable: #fff;
|
|
3
|
+
$color-readonly: #ddd;
|
|
4
|
+
$color-required: lightyellow;
|
|
5
|
+
$color-invalid: lightcoral;
|
|
6
|
+
$color-can-drop: lightgray;
|
|
7
|
+
$color-is-over: #31708f;
|
|
8
|
+
$colo-bs-primary: #337ab7;
|
|
9
|
+
$color-bs-warning: #f0ad4e;
|
|
10
|
+
$colo-selected-border: #0dcaf0;
|
|
11
|
+
$color-default: #777;
|
|
12
|
+
$color-bs-info: #5bc0de;
|
|
13
|
+
|
|
14
|
+
.bg-bs-primary {
|
|
15
|
+
background-color: $colo-bs-primary !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.bg-bs-warning {
|
|
19
|
+
background-color: $color-bs-warning !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.icon_generic_nav {
|
|
23
|
+
font-family: FontAwesome, Helvetica, Arial, sans-serif !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.field_required {
|
|
27
|
+
background-color: $color-required;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.template_panel_heading {
|
|
31
|
+
display: flex;
|
|
32
|
+
justify-content: space-between;
|
|
33
|
+
align-items: center;
|
|
34
|
+
padding: 5px 10px 5px 10px !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.panel_generic_properties {
|
|
38
|
+
border-left: unset !important;
|
|
39
|
+
border-right: unset !important;
|
|
40
|
+
border-bottom: unset !important;
|
|
41
|
+
line-height: 26px !important;
|
|
42
|
+
box-shadow: unset !important;
|
|
43
|
+
margin-bottom: unset !important;
|
|
44
|
+
.panel-title {
|
|
45
|
+
font-weight: bold;
|
|
46
|
+
}
|
|
47
|
+
.default_style {
|
|
48
|
+
font-size: 14px;
|
|
49
|
+
line-height: normal;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.panel_generic_properties_body {
|
|
54
|
+
padding-left: unset !important;
|
|
55
|
+
padding-right: unset !important;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@mixin generic_panel_header {
|
|
59
|
+
font-weight: bold;
|
|
60
|
+
padding: 10px 0px !important;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.panel_generic_heading_slim {
|
|
64
|
+
padding: 5px 0px !important;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.panel_generic_heading {
|
|
68
|
+
@include generic_panel_header;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.panel_generic_heading_bu {
|
|
72
|
+
@include generic_panel_header;
|
|
73
|
+
text-decoration: underline;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.panel_generic_heading_bui {
|
|
77
|
+
@include generic_panel_header;
|
|
78
|
+
text-decoration: underline;
|
|
79
|
+
font-style: italic;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.text_generic_properties {
|
|
83
|
+
.dummy {
|
|
84
|
+
background-color: unset !important;
|
|
85
|
+
border: unset !important;
|
|
86
|
+
box-shadow: unset !important;
|
|
87
|
+
}
|
|
88
|
+
.editable {
|
|
89
|
+
background-color: $color-editable;
|
|
90
|
+
}
|
|
91
|
+
.readonly {
|
|
92
|
+
background-color: $color-readonly;
|
|
93
|
+
}
|
|
94
|
+
.required {
|
|
95
|
+
background-color: $color-required;
|
|
96
|
+
}
|
|
97
|
+
input:invalid {
|
|
98
|
+
border: 1px solid $color-invalid;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.select_generic_properties_editable {
|
|
103
|
+
.Select-control {
|
|
104
|
+
background-color: $color-editable;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.select_generic_properties_readonly {
|
|
109
|
+
.Select-control {
|
|
110
|
+
background-color: $color-readonly;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.select_generic_properties_required {
|
|
115
|
+
.Select-control {
|
|
116
|
+
background-color: $color-required;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.drop_generic_properties {
|
|
121
|
+
display: flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
.target {
|
|
124
|
+
height: 100%;
|
|
125
|
+
width: 100%;
|
|
126
|
+
margin: 0px 10px 0px 10px;
|
|
127
|
+
display: inline-block;
|
|
128
|
+
.indicator {
|
|
129
|
+
font-size: x-large;
|
|
130
|
+
}
|
|
131
|
+
.s-img {
|
|
132
|
+
display: flex;
|
|
133
|
+
img {
|
|
134
|
+
height: 4vh;
|
|
135
|
+
width: 4vw;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
.data {
|
|
139
|
+
font-size: medium;
|
|
140
|
+
line-height: normal !important;
|
|
141
|
+
text-overflow: ellipsis;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
white-space: nowrap;
|
|
144
|
+
align-self: center;
|
|
145
|
+
width: 100%;
|
|
146
|
+
}
|
|
147
|
+
&.can-drop {
|
|
148
|
+
.indicator {
|
|
149
|
+
border: 2px dashed $color-can-drop;
|
|
150
|
+
color: $color-can-drop;
|
|
151
|
+
}
|
|
152
|
+
.data {
|
|
153
|
+
border: 2px dashed $color-can-drop;
|
|
154
|
+
color: $color-can-drop;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
&.is-over {
|
|
158
|
+
.indicator {
|
|
159
|
+
border: 2px dashed $color-is-over;
|
|
160
|
+
color: $color-is-over;
|
|
161
|
+
}
|
|
162
|
+
.data {
|
|
163
|
+
border: 2px dashed $color-is-over;
|
|
164
|
+
color: $color-is-over;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
.btn_del {
|
|
169
|
+
float: right;
|
|
170
|
+
align-self: center;
|
|
171
|
+
}
|
|
172
|
+
.sample_radios {
|
|
173
|
+
font-size: xx-small;
|
|
174
|
+
line-height: 2;
|
|
175
|
+
display: inline-flex;
|
|
176
|
+
padding-right: 5px;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.generic_criteria_modal {
|
|
181
|
+
display: block;
|
|
182
|
+
padding-left: 0px;
|
|
183
|
+
top: 45% !important;
|
|
184
|
+
width: 75vw !important;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.search_criteria_mof {
|
|
188
|
+
.modal_body {
|
|
189
|
+
max-height: 70vh;
|
|
190
|
+
height: 70vh;
|
|
191
|
+
overflow: auto;
|
|
192
|
+
}
|
|
193
|
+
.btn_footer {
|
|
194
|
+
margin-top: 10px;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.input-form {
|
|
199
|
+
.input-group-addon {
|
|
200
|
+
font-weight: bold;
|
|
201
|
+
}
|
|
202
|
+
.help {
|
|
203
|
+
font-size: 80%;
|
|
204
|
+
margin: 6px;
|
|
205
|
+
font-style: italic;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.g-ds-note {
|
|
210
|
+
color: black !important;
|
|
211
|
+
float: left !important;
|
|
212
|
+
text-align: left !important;
|
|
213
|
+
font-weight: lighter !important;
|
|
214
|
+
.g-ds-title { text-decoration: underline; font-weight: 700; line-height: 1.5; }
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.g_input_group {
|
|
218
|
+
padding: 6px 6px !important;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.g_input_group_label {
|
|
222
|
+
background-color: lightgray !important;
|
|
223
|
+
width: unset !important;
|
|
224
|
+
white-space: nowrap !important;
|
|
225
|
+
padding: 6px 6px !important;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.g_col_w {
|
|
229
|
+
width: 20% !important;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.generic_grid {
|
|
233
|
+
display: block;
|
|
234
|
+
> div {
|
|
235
|
+
display: flex;
|
|
236
|
+
flex-wrap: nowrap;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
@mixin generic_grid_cell {
|
|
241
|
+
width: 100%;
|
|
242
|
+
margin: 6px 0px 6px 6px;
|
|
243
|
+
text-align: center;
|
|
244
|
+
line-height: 15px;
|
|
245
|
+
align-self: center;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.generic_grid_header {
|
|
249
|
+
@include generic_grid_cell;
|
|
250
|
+
font-weight: bolder;
|
|
251
|
+
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.generic_grid_row {
|
|
255
|
+
@include generic_grid_cell;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
@mixin generic_version_badge {
|
|
259
|
+
background-color: #777;
|
|
260
|
+
display: inline-block;
|
|
261
|
+
padding: 0.35em 0.65em;
|
|
262
|
+
font-size: 0.75em;
|
|
263
|
+
text-align: center;
|
|
264
|
+
vertical-align: baseline;
|
|
265
|
+
white-space: nowrap;
|
|
266
|
+
border-radius: 0.5rem;
|
|
267
|
+
color: white;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.generic_version {
|
|
271
|
+
@include generic_version_badge;
|
|
272
|
+
background-color: unset;
|
|
273
|
+
color: blue;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.generic_version_draft {
|
|
277
|
+
@include generic_version_badge;
|
|
278
|
+
background-color: unset;
|
|
279
|
+
color: black;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.generic_version_block {
|
|
283
|
+
display: block;
|
|
284
|
+
padding: 6px 10px;
|
|
285
|
+
margin: 10px;
|
|
286
|
+
border-radius: 10px;
|
|
287
|
+
border: thin solid lightgray;
|
|
288
|
+
font-size: 1.2em;
|
|
289
|
+
> div {
|
|
290
|
+
display: flex;
|
|
291
|
+
flex-wrap: nowrap;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.generic_block_select {
|
|
296
|
+
// border-color: $colo-selected-border;
|
|
297
|
+
border-width: medium;
|
|
298
|
+
border-style: groove;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.generic_panel_none {
|
|
302
|
+
border-color: #ddd !important;
|
|
303
|
+
> .panel-heading {
|
|
304
|
+
background-color: white !important;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.generic_tbl_chks {
|
|
309
|
+
line-height: 1em;
|
|
310
|
+
margin: 0px -10px !important;
|
|
311
|
+
> label {
|
|
312
|
+
display: inline-flex;
|
|
313
|
+
align-content: center;
|
|
314
|
+
align-items: center;
|
|
315
|
+
> input {
|
|
316
|
+
margin-top: 0px;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.generic_btn_default {
|
|
322
|
+
background-color: $color-default !important;
|
|
323
|
+
color: $color-editable !important;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.drop_generic_table_wrap {
|
|
327
|
+
.target {
|
|
328
|
+
.s-img {
|
|
329
|
+
position: relative;
|
|
330
|
+
border: 1px solid transparent;
|
|
331
|
+
img {
|
|
332
|
+
height: 4vw;
|
|
333
|
+
width: 4vw;
|
|
334
|
+
}
|
|
335
|
+
.del_btn {
|
|
336
|
+
position: absolute;
|
|
337
|
+
top: 0%;
|
|
338
|
+
left: 0%;
|
|
339
|
+
}
|
|
340
|
+
.link_btn {
|
|
341
|
+
position: absolute;
|
|
342
|
+
bottom: 0%;
|
|
343
|
+
left: 0%;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
.s-img:hover {
|
|
347
|
+
border: 1px solid $colo-selected-border;
|
|
348
|
+
}
|
|
349
|
+
.data {
|
|
350
|
+
font-size: unset;
|
|
351
|
+
white-space: unset;
|
|
352
|
+
text-align: left;
|
|
353
|
+
}
|
|
354
|
+
&.can-drop {
|
|
355
|
+
.s-img {
|
|
356
|
+
border: 2px dashed $color-can-drop;
|
|
357
|
+
color: $color-can-drop;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
&.is-over {
|
|
361
|
+
.s-img {
|
|
362
|
+
border: 2px dashed $color-is-over;
|
|
363
|
+
color: $color-is-over;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.generic_grid_img {
|
|
370
|
+
border: $color-readonly solid thin;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.generic_sam_options {
|
|
374
|
+
display: flex;
|
|
375
|
+
flex-direction: column;
|
|
376
|
+
text-align: left;
|
|
377
|
+
font-size: x-small;
|
|
378
|
+
.radio {
|
|
379
|
+
margin-top: unset;
|
|
380
|
+
margin-bottom: unset;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.generic_files {
|
|
385
|
+
padding: 0px 5px !important;
|
|
386
|
+
> div > div > div {
|
|
387
|
+
text-align: left;
|
|
388
|
+
align-self: center;
|
|
389
|
+
.form-group {
|
|
390
|
+
margin-bottom: 0px;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.grid-btn-none {
|
|
396
|
+
font-size: large;
|
|
397
|
+
color: white;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.generic_grid_dnd {
|
|
401
|
+
.dnd {
|
|
402
|
+
cursor: move;
|
|
403
|
+
}
|
|
404
|
+
.dnd-btn {
|
|
405
|
+
font-size: large;
|
|
406
|
+
span {
|
|
407
|
+
cursor: move;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
&.can-drop {
|
|
411
|
+
border: 2px dashed $color-can-drop;
|
|
412
|
+
color: $color-can-drop;
|
|
413
|
+
}
|
|
414
|
+
&.is-over {
|
|
415
|
+
border: 2px dashed $color-is-over;
|
|
416
|
+
color: $color-is-over;
|
|
417
|
+
}
|
|
418
|
+
&.is-dragging {
|
|
419
|
+
opacity: 0.2;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.generic_layer_modal {
|
|
424
|
+
> .layer_header {
|
|
425
|
+
background-color: white;
|
|
426
|
+
color: $colo-bs-primary;
|
|
427
|
+
font-size: 20px;
|
|
428
|
+
}
|
|
429
|
+
> .panel-body {
|
|
430
|
+
background-color: #d9edf7;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.generic_layer_column {
|
|
435
|
+
@include generic_grid_cell;
|
|
436
|
+
border: 1px solid $colo-bs-primary;
|
|
437
|
+
background-color: white;
|
|
438
|
+
margin: 5px;
|
|
439
|
+
padding: 10px;
|
|
440
|
+
color: $colo-bs-primary;
|
|
441
|
+
border-radius: 4px;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
.generic_layer_column > div:first-child {
|
|
445
|
+
display: flex;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.generic_layer_column > div:first-child > button {
|
|
449
|
+
float: right;
|
|
450
|
+
border-radius: 50%;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.generic_layer_column > div:first-child > div {
|
|
454
|
+
width: 100%;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.generic_wf_modal {
|
|
458
|
+
max-height: 100%;
|
|
459
|
+
overflow: auto;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.generic_wf_modal > div:first-child {
|
|
463
|
+
height: 85vh;
|
|
464
|
+
width: 100%;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.flow_view_draggable {
|
|
468
|
+
z-index: 100;
|
|
469
|
+
position: absolute;
|
|
470
|
+
top: 12%;
|
|
471
|
+
left: 10%;
|
|
472
|
+
.panel-body {
|
|
473
|
+
padding: 5px;
|
|
474
|
+
> .body_bg {
|
|
475
|
+
max-height: 100%;
|
|
476
|
+
overflow: auto;
|
|
477
|
+
background-color: #d9edf7;
|
|
478
|
+
> .body_canvas {
|
|
479
|
+
resize: both;
|
|
480
|
+
overflow: auto;
|
|
481
|
+
height: 70vh;
|
|
482
|
+
width: 40vw;
|
|
483
|
+
min-height: 250px;
|
|
484
|
+
min-width: 300px;
|
|
485
|
+
max-width: 1600px;
|
|
486
|
+
max-height: 840px;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* eslint-disable react/forbid-prop-types */
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { Button } from 'react-bootstrap';
|
|
4
|
+
|
|
5
|
+
const ElementManager = () => {
|
|
6
|
+
const [count, setCount] = useState(0);
|
|
7
|
+
|
|
8
|
+
// return (
|
|
9
|
+
// <Panel bsStyle="primary">
|
|
10
|
+
// <Panel.Heading>
|
|
11
|
+
// <Panel.Title componentClass="h3">Panel heading</Panel.Title>
|
|
12
|
+
// </Panel.Heading>
|
|
13
|
+
// <Panel.Body>Panel content</Panel.Body>
|
|
14
|
+
// </Panel>
|
|
15
|
+
// );
|
|
16
|
+
return (
|
|
17
|
+
<div>
|
|
18
|
+
<p>You clicked {count} times</p>
|
|
19
|
+
<Button bsStyle="primary" onClick={() => setCount(count + 1)}>
|
|
20
|
+
Click me
|
|
21
|
+
</Button>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
// export { GenPropertiesText, ElementManager };
|
|
28
|
+
export default ElementManager;
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/* eslint-disable react/forbid-prop-types */
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { findIndex, cloneDeep } from 'lodash';
|
|
5
|
+
import { Panel, Button, ButtonToolbar, OverlayTrigger, Tooltip } from 'react-bootstrap';
|
|
6
|
+
// import { DragDropContext } from 'react-dnd';
|
|
7
|
+
// import HTML5Backend from 'react-dnd-html5-backend';
|
|
8
|
+
import LayersLayout from '../layers/LayersLayout';
|
|
9
|
+
import { genUnits, toBool, toNum, unitConversion, absOlsTermLabel } from '../tools/utils';
|
|
10
|
+
|
|
11
|
+
class GenericDSDetails extends Component {
|
|
12
|
+
constructor(props) {
|
|
13
|
+
super(props);
|
|
14
|
+
this.handleInputChange = this.handleInputChange.bind(this);
|
|
15
|
+
this.handleUnitClick = this.handleUnitClick.bind(this);
|
|
16
|
+
this.handleReload = this.handleReload.bind(this);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
handleInputChange(event, field, layer, type = 'text') {
|
|
20
|
+
const { genericDS } = this.props;
|
|
21
|
+
const { properties } = genericDS;
|
|
22
|
+
let value = '';
|
|
23
|
+
switch (type) {
|
|
24
|
+
case 'checkbox':
|
|
25
|
+
value = event.target.checked;
|
|
26
|
+
break;
|
|
27
|
+
case 'select':
|
|
28
|
+
value = event ? event.value : null;
|
|
29
|
+
break;
|
|
30
|
+
case 'formula-field':
|
|
31
|
+
if (event.target) {
|
|
32
|
+
({ value } = event.target);
|
|
33
|
+
} else {
|
|
34
|
+
value = event;
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
case 'integer':
|
|
38
|
+
({ value } = event.target);
|
|
39
|
+
value = Math.trunc(value);
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
({ value } = event.target);
|
|
43
|
+
}
|
|
44
|
+
properties.layers[`${layer}`].fields.find(e => e.field === field).value = value;
|
|
45
|
+
if (type === 'system-defined' && (!properties.layers[`${layer}`].fields.find(e => e.field === field).value_system || properties.layers[`${layer}`].fields.find(e => e.field === field).value_system === '')) {
|
|
46
|
+
const opt = properties.layers[`${layer}`].fields.find(e => e.field === field).option_layers;
|
|
47
|
+
properties.layers[`${layer}`].fields.find(e => e.field === field).value_system = genUnits(opt)[0].key;
|
|
48
|
+
}
|
|
49
|
+
genericDS.properties = properties;
|
|
50
|
+
genericDS.changed = true;
|
|
51
|
+
// this.props.onChange('dataset', { target: { value: genericDS } });
|
|
52
|
+
this.props.onChange(genericDS);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
handleUnitClick(layer, obj) {
|
|
56
|
+
const { genericDS } = this.props;
|
|
57
|
+
const { properties } = genericDS;
|
|
58
|
+
const newVal = unitConversion(obj.option_layers, obj.value_system, obj.value);
|
|
59
|
+
properties.layers[`${layer}`].fields.find(e => e.field === obj.field).value_system = obj.value_system;
|
|
60
|
+
properties.layers[`${layer}`].fields.find(e => e.field === obj.field).value = newVal;
|
|
61
|
+
genericDS.properties = properties;
|
|
62
|
+
genericDS.changed = true;
|
|
63
|
+
// this.props.onChange('dataset', { target: { value: genericDS } });
|
|
64
|
+
this.props.onChange(genericDS);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
handleReload() {
|
|
68
|
+
const { klass, genericDS } = this.props;
|
|
69
|
+
if (klass.properties_release) {
|
|
70
|
+
const newProps = cloneDeep(klass.properties_release);
|
|
71
|
+
newProps.klass_uuid = klass.uuid;
|
|
72
|
+
Object.keys(newProps.layers).forEach((key) => {
|
|
73
|
+
const newLayer = newProps.layers[key] || {};
|
|
74
|
+
const curFields =
|
|
75
|
+
(genericDS.properties.layers[key] && genericDS.properties.layers[key].fields) || [];
|
|
76
|
+
(newLayer.fields || []).forEach((f, idx) => {
|
|
77
|
+
const curIdx = findIndex(curFields, o => o.field === f.field);
|
|
78
|
+
if (curIdx >= 0) {
|
|
79
|
+
const curVal = genericDS.properties.layers[key].fields[curIdx].value;
|
|
80
|
+
const curType = typeof curVal;
|
|
81
|
+
if (['select', 'text', 'textarea', 'formula-field'].includes(newProps.layers[key].fields[idx].type)) {
|
|
82
|
+
newProps.layers[key].fields[idx].value = curType !== 'undefined' ? curVal.toString() : '';
|
|
83
|
+
}
|
|
84
|
+
if (newProps.layers[key].fields[idx].type === 'integer') {
|
|
85
|
+
newProps.layers[key].fields[idx].value =
|
|
86
|
+
// eslint-disable-next-line no-restricted-globals
|
|
87
|
+
(curType === 'undefined' || curType === 'boolean' || isNaN(curVal)) ? 0 : parseInt(curVal, 10);
|
|
88
|
+
}
|
|
89
|
+
if (newProps.layers[key].fields[idx].type === 'checkbox') {
|
|
90
|
+
newProps.layers[key].fields[idx].value = curType !== 'undefined' ? toBool(curVal) : false;
|
|
91
|
+
}
|
|
92
|
+
if (newProps.layers[key].fields[idx].type === 'system-defined') {
|
|
93
|
+
const units = genUnits(newProps.layers[key].fields[idx].option_layers);
|
|
94
|
+
const vs = units.find(u =>
|
|
95
|
+
u.key === genericDS.properties.layers[key].fields[curIdx].value_system);
|
|
96
|
+
newProps.layers[key].fields[idx].value_system = (vs && vs.key) || units[0].key;
|
|
97
|
+
newProps.layers[key].fields[idx].value = toNum(curVal);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
genericDS.properties = newProps;
|
|
103
|
+
genericDS.dataset_klass_id = klass.id;
|
|
104
|
+
genericDS.klass_ols = klass.ols_term_id;
|
|
105
|
+
genericDS.klass_label = klass.label;
|
|
106
|
+
genericDS.changed = true;
|
|
107
|
+
// this.props.onChange('dataset', { target: { value: genericDS } });
|
|
108
|
+
this.props.onChange(genericDS);
|
|
109
|
+
} else {
|
|
110
|
+
// this.props.onChange('dataset', { target: { value: undefined } });
|
|
111
|
+
this.props.onChange(undefined);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
elementalPropertiesItem(genericDS, klass) {
|
|
116
|
+
const layersLayout = LayersLayout(
|
|
117
|
+
genericDS.properties.layers,
|
|
118
|
+
(klass.properties_release && klass.properties_release.select_options) || {},
|
|
119
|
+
this.handleInputChange,
|
|
120
|
+
() => {},
|
|
121
|
+
this.handleUnitClick
|
|
122
|
+
);
|
|
123
|
+
return (<div style={{ margin: '5px' }}>{layersLayout}</div>);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
render() {
|
|
127
|
+
const {
|
|
128
|
+
// eslint-disable-next-line no-unused-vars
|
|
129
|
+
uiCtrl, genericDS, klass, kind
|
|
130
|
+
} = this.props;
|
|
131
|
+
if (uiCtrl && Object.keys(genericDS).length !== 0 && kind && kind !== '') {
|
|
132
|
+
return (
|
|
133
|
+
<Panel className="panel-detail">
|
|
134
|
+
<Panel.Body style={{ position: 'relative', minHeight: 260, overflowY: 'unset' }}>
|
|
135
|
+
{this.elementalPropertiesItem(genericDS, klass)}
|
|
136
|
+
<span className="g-ds-note label">
|
|
137
|
+
<span className="g-ds-title">Note</span><br />
|
|
138
|
+
Selected analysis type: {absOlsTermLabel(kind)}<br />
|
|
139
|
+
Content is designed for: {genericDS.klass_label}
|
|
140
|
+
</span>
|
|
141
|
+
<ButtonToolbar className="pull-right">
|
|
142
|
+
<OverlayTrigger placement="top" overlay={<Tooltip id="_tooltip_reload">click to reload the content template</Tooltip>}>
|
|
143
|
+
<Button bsSize="xsmall" bsStyle="danger" onClick={() => this.handleReload()}>Reload</Button>
|
|
144
|
+
</OverlayTrigger>
|
|
145
|
+
</ButtonToolbar>
|
|
146
|
+
</Panel.Body>
|
|
147
|
+
</Panel>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
GenericDSDetails.propTypes = {
|
|
155
|
+
uiCtrl: PropTypes.bool.isRequired, // MatrixCheck(currentUser.matrix, 'genericDataset')
|
|
156
|
+
kind: PropTypes.string, // selected analysis type
|
|
157
|
+
genericDS: PropTypes.object,
|
|
158
|
+
klass: PropTypes.object, // dataset_klass
|
|
159
|
+
onChange: PropTypes.func.isRequired // change callback
|
|
160
|
+
};
|
|
161
|
+
GenericDSDetails.defaultProps = { kind: '', genericDS: {}, klass: {} };
|
|
162
|
+
|
|
163
|
+
// export default DragDropContext(HTML5Backend)(GenericDSDetails);
|
|
164
|
+
export default GenericDSDetails;
|