@ecan-bi/datav 1.0.66 → 1.0.67

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 CHANGED
@@ -3230,26 +3230,33 @@ const _sfc_main$h = defineComponent({
3230
3230
  const myValue = computed(() => {
3231
3231
  const data = unref(myData);
3232
3232
  const defaultValue = +props2.variableDefaultValue;
3233
- if (data == null && !isNaN(defaultValue))
3234
- return defaultValue;
3233
+ if (data == null) {
3234
+ if (!isNaN(defaultValue)) {
3235
+ return defaultValue;
3236
+ } else {
3237
+ return 0;
3238
+ }
3239
+ }
3235
3240
  const variables = props2.text.match(/\{.+\}/g) || [];
3236
3241
  let value;
3237
- const valueSet = new Set(Object.values(data));
3242
+ const valueSet = new Set(Object.keys(data));
3238
3243
  for (let i = 0; i < variables.length; i++) {
3239
3244
  const variable = variables[i];
3240
- if (valueSet.has(variables[i])) {
3241
- value = variable;
3245
+ const key = variable.slice(1, variable.length - 1);
3246
+ if (valueSet.has(key)) {
3247
+ value = data[key];
3242
3248
  break;
3243
3249
  }
3244
3250
  }
3245
- if (typeof value === "string" && !isNaN(+value)) {
3246
- value = +value;
3251
+ if (typeof value === "number") {
3252
+ value = value * 100;
3253
+ } else if (typeof value === "string" && !isNaN(+value)) {
3254
+ value = +value * 100;
3247
3255
  } else if (!isNaN(defaultValue)) {
3248
- value = defaultValue;
3256
+ value = defaultValue * 100;
3249
3257
  } else {
3250
3258
  value = 0;
3251
3259
  }
3252
- value = value * 100;
3253
3260
  if (props2.decimalFormat) {
3254
3261
  value = +value.toFixed(2);
3255
3262
  }
@@ -3372,7 +3379,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
3372
3379
  }, 8, ["percent", "width", "type", "strokeColor", "strokeLinecap", "trailColor", "strokeWidth", "gapDegree", "onClick"])
3373
3380
  ], 4);
3374
3381
  }
3375
- const Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-95ca32ca"]]);
3382
+ const Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-4f7958e8"]]);
3376
3383
  const EcanProportion = withInstall(Proportion);
3377
3384
  const inputProps = {
3378
3385
  ...props,