@ecan-bi/datav 1.0.64 → 1.0.65
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 +41 -20
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +41 -20
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +3 -3
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -3233,47 +3233,68 @@
|
|
|
3233
3233
|
immediate: true,
|
|
3234
3234
|
deep: true
|
|
3235
3235
|
});
|
|
3236
|
-
const
|
|
3237
|
-
const value = vue.computed(() => {
|
|
3236
|
+
const myValue = vue.computed(() => {
|
|
3238
3237
|
const data = vue.unref(myData);
|
|
3239
|
-
|
|
3238
|
+
const defaultValue = +props2.variableDefaultValue;
|
|
3239
|
+
if (data == null && !isNaN(defaultValue))
|
|
3240
3240
|
return defaultValue;
|
|
3241
|
-
const
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3241
|
+
const variables = props2.text.match(/\{.+\}/g) || [];
|
|
3242
|
+
let value;
|
|
3243
|
+
const valueSet = new Set(Object.values(data));
|
|
3244
|
+
for (let i = 0; i < variables.length; i++) {
|
|
3245
|
+
const variable = variables[i];
|
|
3246
|
+
if (valueSet.has(variables[i])) {
|
|
3247
|
+
value = variable;
|
|
3248
|
+
break;
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
if (typeof value === "string" && !isNaN(+value)) {
|
|
3252
|
+
value = +value;
|
|
3253
|
+
} else if (!isNaN(defaultValue)) {
|
|
3254
|
+
value = defaultValue;
|
|
3255
|
+
} else {
|
|
3256
|
+
value = 0;
|
|
3257
|
+
}
|
|
3258
|
+
value = value * 100;
|
|
3259
|
+
if (props2.decimalFormat) {
|
|
3260
|
+
value = +value.toFixed(2);
|
|
3245
3261
|
}
|
|
3246
|
-
return
|
|
3262
|
+
return value;
|
|
3247
3263
|
});
|
|
3248
3264
|
const text = vue.computed(() => {
|
|
3265
|
+
var _a2;
|
|
3249
3266
|
let text2 = props2.text;
|
|
3267
|
+
if (text2 === "")
|
|
3268
|
+
return vue.unref(myValue);
|
|
3269
|
+
const defaultValue = props2.variableDefaultValue;
|
|
3250
3270
|
const data = vue.unref(myData);
|
|
3251
3271
|
const variables = text2.match(/\{.+\}/g) || [];
|
|
3252
|
-
|
|
3253
|
-
return vue.unref(value) + "%";
|
|
3254
|
-
for (let i = 0; i < (variables == null ? void 0 : variables.length); i++) {
|
|
3272
|
+
for (let i = 0; i < variables.length; i++) {
|
|
3255
3273
|
const variable = variables[i];
|
|
3256
3274
|
let statement = variable.slice(1, variable.length - 1);
|
|
3257
|
-
const textVariables = statement.match(
|
|
3275
|
+
const textVariables = statement.match(/.*/g);
|
|
3258
3276
|
for (let j = 0; j < (textVariables == null ? void 0 : textVariables.length); j++) {
|
|
3259
|
-
const textVariable = textVariables[i];
|
|
3277
|
+
const textVariable = (_a2 = textVariables[i]) == null ? void 0 : _a2.trim();
|
|
3260
3278
|
if (data[textVariable] != null) {
|
|
3261
3279
|
statement = statement.replace(textVariable, data[textVariable]);
|
|
3262
3280
|
} else {
|
|
3263
|
-
statement = statement.replace(textVariable,
|
|
3281
|
+
statement = statement.replace(textVariable, defaultValue);
|
|
3264
3282
|
}
|
|
3265
3283
|
}
|
|
3266
3284
|
let usedVariable = statement;
|
|
3267
3285
|
try {
|
|
3268
|
-
if (
|
|
3286
|
+
if (/\w+[+\-*/%]+\w+/g.test(statement)) {
|
|
3269
3287
|
const eval2 = eval;
|
|
3270
3288
|
usedVariable = eval2(statement);
|
|
3271
3289
|
}
|
|
3272
3290
|
} catch (e) {
|
|
3273
3291
|
console.error(e);
|
|
3274
3292
|
}
|
|
3275
|
-
if (
|
|
3276
|
-
usedVariable = usedVariable
|
|
3293
|
+
if (typeof usedVariable === "number" || !isNaN(+usedVariable)) {
|
|
3294
|
+
usedVariable = +usedVariable * 100;
|
|
3295
|
+
if (props2.decimalFormat) {
|
|
3296
|
+
usedVariable = usedVariable.toFixed(2);
|
|
3297
|
+
}
|
|
3277
3298
|
}
|
|
3278
3299
|
text2 = text2.replace(variable, usedVariable + "");
|
|
3279
3300
|
}
|
|
@@ -3312,7 +3333,7 @@
|
|
|
3312
3333
|
style: style2,
|
|
3313
3334
|
myWidth,
|
|
3314
3335
|
text,
|
|
3315
|
-
|
|
3336
|
+
myValue,
|
|
3316
3337
|
loading,
|
|
3317
3338
|
click
|
|
3318
3339
|
};
|
|
@@ -3327,7 +3348,7 @@
|
|
|
3327
3348
|
}, [
|
|
3328
3349
|
vue.createVNode(_component_a_progress, {
|
|
3329
3350
|
class: "progress",
|
|
3330
|
-
percent: _ctx.
|
|
3351
|
+
percent: _ctx.myValue,
|
|
3331
3352
|
width: _ctx.myWidth,
|
|
3332
3353
|
type: _ctx.strokeType,
|
|
3333
3354
|
strokeColor: _ctx.strokeColor,
|
|
@@ -3357,7 +3378,7 @@
|
|
|
3357
3378
|
}, 8, ["percent", "width", "type", "strokeColor", "strokeLinecap", "trailColor", "strokeWidth", "gapDegree", "onClick"])
|
|
3358
3379
|
], 4);
|
|
3359
3380
|
}
|
|
3360
|
-
const Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-
|
|
3381
|
+
const Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-95ca32ca"]]);
|
|
3361
3382
|
const EcanProportion = withInstall(Proportion);
|
|
3362
3383
|
const inputProps = {
|
|
3363
3384
|
...props,
|