@abi-software/simulationvuer 0.7.0-vue-3-alpha.4 → 1.0.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/LICENSE +201 -201
- package/README.md +93 -74
- package/dist/index.html +17 -17
- package/dist/simulationvuer.js +3648 -3634
- package/dist/simulationvuer.umd.cjs +13 -13
- package/dist/style.css +1 -1
- package/package.json +92 -81
- package/public/index.html +17 -17
- package/src/App.vue +101 -101
- package/src/assets/_variables.scss +43 -43
- package/src/assets/styles.scss +6 -7
- package/src/components/SimulationVuer.vue +622 -534
- package/src/components/SimulationVuerInput.vue +146 -140
- package/src/components/common.js +31 -31
- package/src/components/index.js +7 -7
- package/src/components/json.js +522 -522
- package/src/components/ui.js +85 -75
- package/src/main.js +19 -20
- package/vite.config.js +60 -73
- package/vuese-generator.js +66 -0
- package/package-lock.json +0 -6692
|
@@ -1,140 +1,146 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div v-show="visible">
|
|
3
|
-
<p :class="labelClasses">{{ name }}</p>
|
|
4
|
-
<el-select class="discrete" popper-class="discrete-popper" size="small" v-if="isDiscrete" v-model="vModel" :
|
|
5
|
-
<el-option v-for="possibleValue in possibleValues" :key="possibleValue.value" :label="possibleValue.name" :value="possibleValue.value" />
|
|
6
|
-
</el-select>
|
|
7
|
-
<div class="sliders-and-fields" v-if="!isDiscrete">
|
|
8
|
-
<el-slider v-model="vModel" :max="maximumValue" :min="minimumValue" :show-input="false" :show-tooltip="false" :step="stepValue" @change="updateUi()" />
|
|
9
|
-
<el-input-number class="scalar" size="small" v-model="vModel" :controls="false" :max="maximumValue" :min="minimumValue" :step="stepValue" :step-strictly="true" @input="updateUi()" />
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script>
|
|
15
|
-
import { ElInputNumber, ElOption, ElSelect, ElSlider } from "element-plus";
|
|
16
|
-
import { updateUi } from "./ui.js";
|
|
17
|
-
|
|
18
|
-
export default {
|
|
19
|
-
name: "SimulationVuerInput",
|
|
20
|
-
components: {
|
|
21
|
-
ElInputNumber,
|
|
22
|
-
ElOption,
|
|
23
|
-
ElSelect,
|
|
24
|
-
ElSlider,
|
|
25
|
-
},
|
|
26
|
-
props: {
|
|
27
|
-
defaultValue: {
|
|
28
|
-
required: true,
|
|
29
|
-
type: Number,
|
|
30
|
-
},
|
|
31
|
-
maximumValue: {
|
|
32
|
-
type: Number,
|
|
33
|
-
},
|
|
34
|
-
minimumValue: {
|
|
35
|
-
type: Number,
|
|
36
|
-
},
|
|
37
|
-
name: {
|
|
38
|
-
required: true,
|
|
39
|
-
type: String,
|
|
40
|
-
},
|
|
41
|
-
possibleValues: {
|
|
42
|
-
type: Array,
|
|
43
|
-
},
|
|
44
|
-
stepValue: {
|
|
45
|
-
type: Number,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
data: function() {
|
|
49
|
-
return {
|
|
50
|
-
isDiscrete: this.possibleValues !== undefined,
|
|
51
|
-
labelClasses: "default " + ((this.possibleValues !== undefined)?"discrete":"scalar"),
|
|
52
|
-
visible: true,
|
|
53
|
-
vModel: this.defaultValue,
|
|
54
|
-
};
|
|
55
|
-
},
|
|
56
|
-
methods: {
|
|
57
|
-
updateUi: function() {
|
|
58
|
-
updateUi(this.$parent);
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
</script>
|
|
63
|
-
|
|
64
|
-
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
65
|
-
<style scoped lang="scss">
|
|
66
|
-
|
|
67
|
-
:deep( .el-input-number.scalar ){
|
|
68
|
-
margin-top: -8px;
|
|
69
|
-
width:
|
|
70
|
-
}
|
|
71
|
-
:deep( .el-input-number.scalar .el-input ){
|
|
72
|
-
width: 60px;
|
|
73
|
-
}
|
|
74
|
-
:deep( .el-input-number.scalar .el-input__inner:focus ){
|
|
75
|
-
border-color: #8300bf;
|
|
76
|
-
}
|
|
77
|
-
:deep( .el-select.discrete ){
|
|
78
|
-
margin-bottom: 16px;
|
|
79
|
-
}
|
|
80
|
-
:deep( .el-slider ){
|
|
81
|
-
width: 108px;
|
|
82
|
-
margin-top: -12px;
|
|
83
|
-
margin-left: 8px;
|
|
84
|
-
}
|
|
85
|
-
:deep( .el-slider__bar ){
|
|
86
|
-
background-color: #8300bf;
|
|
87
|
-
}
|
|
88
|
-
:deep( .el-slider__button ){
|
|
89
|
-
border-color: #8300bf;
|
|
90
|
-
}
|
|
91
|
-
.discrete {
|
|
92
|
-
margin-left: 8px;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
font-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.discrete :deep( .el-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
height:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
p.
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
margin-
|
|
138
|
-
margin-
|
|
139
|
-
}
|
|
140
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div v-show="visible">
|
|
3
|
+
<p :class="labelClasses">{{ name }}</p>
|
|
4
|
+
<el-select class="discrete" popper-class="discrete-popper" size="small" v-if="isDiscrete" v-model="vModel" :teleported=false @change="updateUi()">
|
|
5
|
+
<el-option v-for="possibleValue in possibleValues" :key="possibleValue.value" :label="possibleValue.name" :value="possibleValue.value" />
|
|
6
|
+
</el-select>
|
|
7
|
+
<div class="sliders-and-fields" v-if="!isDiscrete">
|
|
8
|
+
<el-slider v-model="vModel" :max="maximumValue" :min="minimumValue" :show-input="false" :show-tooltip="false" :step="stepValue" @change="updateUi()" />
|
|
9
|
+
<el-input-number class="scalar" size="small" v-model="vModel" :controls="false" :max="maximumValue" :min="minimumValue" :step="stepValue" :step-strictly="true" @input="updateUi()" />
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import { ElInputNumber, ElOption, ElSelect, ElSlider } from "element-plus";
|
|
16
|
+
import { updateUi } from "./ui.js";
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
name: "SimulationVuerInput",
|
|
20
|
+
components: {
|
|
21
|
+
ElInputNumber,
|
|
22
|
+
ElOption,
|
|
23
|
+
ElSelect,
|
|
24
|
+
ElSlider,
|
|
25
|
+
},
|
|
26
|
+
props: {
|
|
27
|
+
defaultValue: {
|
|
28
|
+
required: true,
|
|
29
|
+
type: Number,
|
|
30
|
+
},
|
|
31
|
+
maximumValue: {
|
|
32
|
+
type: Number,
|
|
33
|
+
},
|
|
34
|
+
minimumValue: {
|
|
35
|
+
type: Number,
|
|
36
|
+
},
|
|
37
|
+
name: {
|
|
38
|
+
required: true,
|
|
39
|
+
type: String,
|
|
40
|
+
},
|
|
41
|
+
possibleValues: {
|
|
42
|
+
type: Array,
|
|
43
|
+
},
|
|
44
|
+
stepValue: {
|
|
45
|
+
type: Number,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
data: function() {
|
|
49
|
+
return {
|
|
50
|
+
isDiscrete: this.possibleValues !== undefined,
|
|
51
|
+
labelClasses: "default " + ((this.possibleValues !== undefined)?"discrete":"scalar"),
|
|
52
|
+
visible: true,
|
|
53
|
+
vModel: this.defaultValue,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
methods: {
|
|
57
|
+
updateUi: function() {
|
|
58
|
+
updateUi(this.$parent);
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
65
|
+
<style scoped lang="scss">
|
|
66
|
+
|
|
67
|
+
:deep( .el-input-number.scalar ){
|
|
68
|
+
margin-top: -8px;
|
|
69
|
+
width: 45px;
|
|
70
|
+
}
|
|
71
|
+
:deep( .el-input-number.scalar .el-input ){
|
|
72
|
+
width: 60px;
|
|
73
|
+
}
|
|
74
|
+
:deep( .el-input-number.scalar .el-input__inner:focus ){
|
|
75
|
+
border-color: #8300bf;
|
|
76
|
+
}
|
|
77
|
+
:deep( .el-select.discrete ){
|
|
78
|
+
margin-bottom: 16px;
|
|
79
|
+
}
|
|
80
|
+
:deep( .el-slider ){
|
|
81
|
+
width: 108px;
|
|
82
|
+
margin-top: -12px;
|
|
83
|
+
margin-left: 8px;
|
|
84
|
+
}
|
|
85
|
+
:deep( .el-slider__bar ){
|
|
86
|
+
background-color: #8300bf;
|
|
87
|
+
}
|
|
88
|
+
:deep( .el-slider__button ){
|
|
89
|
+
border-color: #8300bf;
|
|
90
|
+
}
|
|
91
|
+
.discrete {
|
|
92
|
+
margin-left: 8px;
|
|
93
|
+
width: 160px;
|
|
94
|
+
}
|
|
95
|
+
.discrete {
|
|
96
|
+
:deep( .el-input__inner ){
|
|
97
|
+
font-family: Asap, sans-serif;
|
|
98
|
+
font-size: 16px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
.discrete :deep( .el-input__inner:focus),
|
|
102
|
+
.discrete :deep( .el-input.is-focus .el-input__inner) {
|
|
103
|
+
border-color: #8300bf;
|
|
104
|
+
}
|
|
105
|
+
.discrete-popper .el-select-dropdown__item {
|
|
106
|
+
font-family: Asap, sans-serif;
|
|
107
|
+
}
|
|
108
|
+
.discrete-popper .el-select-dropdown__item.is-selected {
|
|
109
|
+
font-weight: normal;
|
|
110
|
+
color: #8300bf;
|
|
111
|
+
}
|
|
112
|
+
.scalar :deep( .el-input__inner ){
|
|
113
|
+
text-align: center;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.scalar :deep(.el-input__wrapper){
|
|
117
|
+
padding-left: 4px;
|
|
118
|
+
padding-right: 4px;
|
|
119
|
+
}
|
|
120
|
+
div.simulation-vuer {
|
|
121
|
+
height: 100%;
|
|
122
|
+
}
|
|
123
|
+
div.sliders-and-fields {
|
|
124
|
+
display: grid;
|
|
125
|
+
grid-template-columns: 132px auto;
|
|
126
|
+
width: 191px;
|
|
127
|
+
height: 26px;
|
|
128
|
+
margin-bottom: 4px;
|
|
129
|
+
}
|
|
130
|
+
p.default {
|
|
131
|
+
font-family: Asap, sans-serif;
|
|
132
|
+
letter-spacing: 0;
|
|
133
|
+
margin: 16px 0;
|
|
134
|
+
text-align: start;
|
|
135
|
+
}
|
|
136
|
+
p.discrete {
|
|
137
|
+
margin-top: 0;
|
|
138
|
+
margin-bottom: 4px;
|
|
139
|
+
}
|
|
140
|
+
p.scalar {
|
|
141
|
+
grid-column-start: 1;
|
|
142
|
+
grid-column-end: 3;
|
|
143
|
+
margin-bottom: 8px;
|
|
144
|
+
margin-top: 0;
|
|
145
|
+
}
|
|
146
|
+
</style>
|
package/src/components/common.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
export const OPENCOR_SOLVER_NAME = "simcore/services/comp/opencor";
|
|
2
|
-
|
|
3
|
-
function doEvaluateValue(value, from, to) {
|
|
4
|
-
if (from !== undefined) {
|
|
5
|
-
let re = new RegExp(`\\b${ from }\\b`, 'g');
|
|
6
|
-
|
|
7
|
-
value = value.replace(re, to);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return value;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function evaluateValue(parent, value) {
|
|
14
|
-
let index = -1;
|
|
15
|
-
|
|
16
|
-
parent.simulationUiInfo.input.forEach((input) => {
|
|
17
|
-
++index;
|
|
18
|
-
|
|
19
|
-
value = doEvaluateValue(value, input.id, parent.$refs.simInput[index].vModel);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return Function("return " + value + ";")();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function evaluateSimulationValue(parent, results, value, i) {
|
|
26
|
-
parent.simulationUiInfo.output.data.forEach((data) => {
|
|
27
|
-
value = doEvaluateValue(value, data.id, results[parent.simulationDataId[data.id]][i]);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
return Function("return " + value + ";")();
|
|
31
|
-
}
|
|
1
|
+
export const OPENCOR_SOLVER_NAME = "simcore/services/comp/opencor";
|
|
2
|
+
|
|
3
|
+
function doEvaluateValue(value, from, to) {
|
|
4
|
+
if (from !== undefined) {
|
|
5
|
+
let re = new RegExp(`\\b${ from }\\b`, 'g');
|
|
6
|
+
|
|
7
|
+
value = value.replace(re, to);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function evaluateValue(parent, value) {
|
|
14
|
+
let index = -1;
|
|
15
|
+
|
|
16
|
+
parent.simulationUiInfo.input.forEach((input) => {
|
|
17
|
+
++index;
|
|
18
|
+
|
|
19
|
+
value = doEvaluateValue(value, input.id, parent.$refs.simInput[index].vModel);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return Function("return " + value + ";")();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function evaluateSimulationValue(parent, results, value, i) {
|
|
26
|
+
parent.simulationUiInfo.output.data.forEach((data) => {
|
|
27
|
+
value = doEvaluateValue(value, data.id, results[parent.simulationDataId[data.id]][i]);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return Function("return " + value + ";")();
|
|
31
|
+
}
|
package/src/components/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// The Vue build version to load with the `import` command
|
|
2
|
-
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
|
3
|
-
import SimulationVuer from './SimulationVuer.vue';
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
SimulationVuer
|
|
7
|
-
};
|
|
1
|
+
// The Vue build version to load with the `import` command
|
|
2
|
+
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
|
3
|
+
import SimulationVuer from './SimulationVuer.vue';
|
|
4
|
+
|
|
5
|
+
export {
|
|
6
|
+
SimulationVuer
|
|
7
|
+
};
|