@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.umd.js
CHANGED
|
@@ -3216,11 +3216,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
3216
3216
|
strokeWidth: 6,
|
|
3217
3217
|
fontWeight: 400,
|
|
3218
3218
|
strokeTextWidth: "100%",
|
|
3219
|
-
lineHeight: "26px"
|
|
3219
|
+
lineHeight: "26px",
|
|
3220
|
+
decimalFormat: false
|
|
3220
3221
|
});
|
|
3221
3222
|
const proportionComponentProps = transformToComponentProps(proportionProps);
|
|
3222
3223
|
const proportionEvents = ["refreshData", "click"];
|
|
3223
|
-
var Proportion_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => ".ecan-proportion[data-v-
|
|
3224
|
+
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")();
|
|
3224
3225
|
const _sfc_main$h = vue.defineComponent({
|
|
3225
3226
|
name: "EcanProportion",
|
|
3226
3227
|
components: {
|
|
@@ -3234,41 +3235,55 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
3234
3235
|
const width = props2.width;
|
|
3235
3236
|
return parseFloat(width);
|
|
3236
3237
|
});
|
|
3237
|
-
const myData = vue.ref(
|
|
3238
|
+
const myData = vue.ref({});
|
|
3239
|
+
vue.watch(() => props2.data, () => {
|
|
3240
|
+
if (props2.dataType === "static" || vue.unref(pageMode) === "design") {
|
|
3241
|
+
myData.value = props2.data;
|
|
3242
|
+
}
|
|
3243
|
+
}, {
|
|
3244
|
+
immediate: true,
|
|
3245
|
+
deep: true
|
|
3246
|
+
});
|
|
3238
3247
|
const defaultValue = 0;
|
|
3239
3248
|
const value = vue.computed(() => {
|
|
3240
|
-
var _a2;
|
|
3241
3249
|
const data = vue.unref(myData);
|
|
3242
3250
|
if (data == null)
|
|
3243
3251
|
return defaultValue;
|
|
3244
3252
|
const values = Object.values(data);
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
return
|
|
3253
|
+
const value2 = values[0] * 100;
|
|
3254
|
+
if (!isNaN(value2)) {
|
|
3255
|
+
return props2.decimalFormat ? value2.toFixed(2) : value2;
|
|
3256
|
+
}
|
|
3257
|
+
return 0;
|
|
3250
3258
|
});
|
|
3251
3259
|
const text = vue.computed(() => {
|
|
3252
|
-
var _a2;
|
|
3253
3260
|
let text2 = props2.text;
|
|
3254
3261
|
const data = vue.unref(myData);
|
|
3255
|
-
const variables = text2.match(/\{
|
|
3262
|
+
const variables = text2.match(/\{.*\}/g) || [];
|
|
3263
|
+
console.log("variables", variables);
|
|
3256
3264
|
if (text2 === "")
|
|
3257
3265
|
return vue.unref(value) + "%";
|
|
3258
3266
|
for (let i = 0; i < variables.length; i++) {
|
|
3259
3267
|
const variable = variables[i];
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3268
|
+
let statement = variable.slice(1, variable.length - 1);
|
|
3269
|
+
const textVariables = statement.match(/[a-zA-Z]\w*/g);
|
|
3270
|
+
console.log("textVariables", textVariables);
|
|
3271
|
+
for (let j = 0; j < textVariables.length; j++) {
|
|
3272
|
+
const textVariable = textVariables[i];
|
|
3273
|
+
if (data[textVariable] != null) {
|
|
3274
|
+
statement = statement.replace(textVariable, data[textVariable]);
|
|
3275
|
+
}
|
|
3266
3276
|
}
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3277
|
+
console.log("statement", statement);
|
|
3278
|
+
let usedVariable;
|
|
3279
|
+
if (/[+\-*/%]+/g.test(statement)) {
|
|
3280
|
+
const eval2 = eval;
|
|
3281
|
+
usedVariable = eval2(statement);
|
|
3282
|
+
}
|
|
3283
|
+
if (props2.decimalFormat) {
|
|
3284
|
+
usedVariable = usedVariable == null ? void 0 : usedVariable.toFixed(2);
|
|
3271
3285
|
}
|
|
3286
|
+
text2 = text2.replace(variable, usedVariable + "");
|
|
3272
3287
|
}
|
|
3273
3288
|
return text2;
|
|
3274
3289
|
});
|
|
@@ -3353,7 +3368,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
3353
3368
|
}, 8, ["percent", "width", "type", "strokeColor", "strokeLinecap", "trailColor", "strokeWidth", "gapDegree", "onClick"])
|
|
3354
3369
|
], 4);
|
|
3355
3370
|
}
|
|
3356
|
-
var Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-
|
|
3371
|
+
var Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-f55c66cc"]]);
|
|
3357
3372
|
const EcanProportion = withInstall(Proportion);
|
|
3358
3373
|
const inputProps = __spreadProps(__spreadValues({}, props), {
|
|
3359
3374
|
width: "200px",
|