@ecan-bi/datav 1.0.52 → 1.0.53
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/dist/index.es.js +37 -22
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +37 -22
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +3 -3
- package/package.json +1 -1
- package/types/text/proportion/Proportion.vue.d.ts +23 -1
- package/types/text/proportion/index.d.ts +24 -2
- package/types/text/proportion/props.d.ts +12 -0
package/dist/index.es.js
CHANGED
|
@@ -3206,11 +3206,12 @@ const proportionProps = __spreadProps(__spreadValues({}, props), {
|
|
|
3206
3206
|
strokeWidth: 6,
|
|
3207
3207
|
fontWeight: 400,
|
|
3208
3208
|
strokeTextWidth: "100%",
|
|
3209
|
-
lineHeight: "26px"
|
|
3209
|
+
lineHeight: "26px",
|
|
3210
|
+
decimalFormat: false
|
|
3210
3211
|
});
|
|
3211
3212
|
const proportionComponentProps = transformToComponentProps(proportionProps);
|
|
3212
3213
|
const proportionEvents = ["refreshData", "click"];
|
|
3213
|
-
var Proportion_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => ".ecan-proportion[data-v-
|
|
3214
|
+
var Proportion_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => ".ecan-proportion[data-v-f55c66cc] {\n overflow: hidden;\n}\n.progress[data-v-f55c66cc] {\n width: 100%;\n height: 100%;\n}\n.format[data-v-f55c66cc] {\n margin: 0 auto;\n}\n")();
|
|
3214
3215
|
const _sfc_main$h = defineComponent({
|
|
3215
3216
|
name: "EcanProportion",
|
|
3216
3217
|
components: {
|
|
@@ -3224,41 +3225,55 @@ const _sfc_main$h = defineComponent({
|
|
|
3224
3225
|
const width = props2.width;
|
|
3225
3226
|
return parseFloat(width);
|
|
3226
3227
|
});
|
|
3227
|
-
const myData = ref(
|
|
3228
|
+
const myData = ref({});
|
|
3229
|
+
watch(() => props2.data, () => {
|
|
3230
|
+
if (props2.dataType === "static" || unref(pageMode) === "design") {
|
|
3231
|
+
myData.value = props2.data;
|
|
3232
|
+
}
|
|
3233
|
+
}, {
|
|
3234
|
+
immediate: true,
|
|
3235
|
+
deep: true
|
|
3236
|
+
});
|
|
3228
3237
|
const defaultValue = 0;
|
|
3229
3238
|
const value = computed(() => {
|
|
3230
|
-
var _a2;
|
|
3231
3239
|
const data = unref(myData);
|
|
3232
3240
|
if (data == null)
|
|
3233
3241
|
return defaultValue;
|
|
3234
3242
|
const values = Object.values(data);
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
return
|
|
3243
|
+
const value2 = values[0] * 100;
|
|
3244
|
+
if (!isNaN(value2)) {
|
|
3245
|
+
return props2.decimalFormat ? value2.toFixed(2) : value2;
|
|
3246
|
+
}
|
|
3247
|
+
return 0;
|
|
3240
3248
|
});
|
|
3241
3249
|
const text = computed(() => {
|
|
3242
|
-
var _a2;
|
|
3243
3250
|
let text2 = props2.text;
|
|
3244
3251
|
const data = unref(myData);
|
|
3245
|
-
const variables = text2.match(/\{
|
|
3252
|
+
const variables = text2.match(/\{.*\}/g) || [];
|
|
3253
|
+
console.log("variables", variables);
|
|
3246
3254
|
if (text2 === "")
|
|
3247
3255
|
return unref(value) + "%";
|
|
3248
3256
|
for (let i = 0; i < variables.length; i++) {
|
|
3249
3257
|
const variable = variables[i];
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3258
|
+
let statement = variable.slice(1, variable.length - 1);
|
|
3259
|
+
const textVariables = statement.match(/[a-zA-Z]\w*/g);
|
|
3260
|
+
console.log("textVariables", textVariables);
|
|
3261
|
+
for (let j = 0; j < textVariables.length; j++) {
|
|
3262
|
+
const textVariable = textVariables[i];
|
|
3263
|
+
if (data[textVariable] != null) {
|
|
3264
|
+
statement = statement.replace(textVariable, data[textVariable]);
|
|
3265
|
+
}
|
|
3256
3266
|
}
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3267
|
+
console.log("statement", statement);
|
|
3268
|
+
let usedVariable;
|
|
3269
|
+
if (/[+\-*/%]+/g.test(statement)) {
|
|
3270
|
+
const eval2 = eval;
|
|
3271
|
+
usedVariable = eval2(statement);
|
|
3272
|
+
}
|
|
3273
|
+
if (props2.decimalFormat) {
|
|
3274
|
+
usedVariable = usedVariable == null ? void 0 : usedVariable.toFixed(2);
|
|
3261
3275
|
}
|
|
3276
|
+
text2 = text2.replace(variable, usedVariable + "");
|
|
3262
3277
|
}
|
|
3263
3278
|
return text2;
|
|
3264
3279
|
});
|
|
@@ -3343,7 +3358,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3343
3358
|
}, 8, ["percent", "width", "type", "strokeColor", "strokeLinecap", "trailColor", "strokeWidth", "gapDegree", "onClick"])
|
|
3344
3359
|
], 4);
|
|
3345
3360
|
}
|
|
3346
|
-
var Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-
|
|
3361
|
+
var Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-f55c66cc"]]);
|
|
3347
3362
|
const EcanProportion = withInstall(Proportion);
|
|
3348
3363
|
const inputProps = __spreadProps(__spreadValues({}, props), {
|
|
3349
3364
|
width: "200px",
|