@ecan-bi/datav 1.0.64 → 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
@@ -3227,47 +3227,75 @@ const _sfc_main$h = defineComponent({
3227
3227
  immediate: true,
3228
3228
  deep: true
3229
3229
  });
3230
- const defaultValue = 0;
3231
- const value = computed(() => {
3230
+ const myValue = computed(() => {
3232
3231
  const data = unref(myData);
3233
- if (data == null)
3234
- return defaultValue;
3235
- const values = Object.values(data);
3236
- const value2 = values[0] * 100;
3237
- if (!isNaN(value2)) {
3238
- return props2.decimalFormat ? value2.toFixed(2) : value2;
3232
+ const defaultValue = +props2.variableDefaultValue;
3233
+ if (data == null) {
3234
+ if (!isNaN(defaultValue)) {
3235
+ return defaultValue;
3236
+ } else {
3237
+ return 0;
3238
+ }
3239
+ }
3240
+ const variables = props2.text.match(/\{.+\}/g) || [];
3241
+ let value;
3242
+ const valueSet = new Set(Object.keys(data));
3243
+ for (let i = 0; i < variables.length; i++) {
3244
+ const variable = variables[i];
3245
+ const key = variable.slice(1, variable.length - 1);
3246
+ if (valueSet.has(key)) {
3247
+ value = data[key];
3248
+ break;
3249
+ }
3250
+ }
3251
+ if (typeof value === "number") {
3252
+ value = value * 100;
3253
+ } else if (typeof value === "string" && !isNaN(+value)) {
3254
+ value = +value * 100;
3255
+ } else if (!isNaN(defaultValue)) {
3256
+ value = defaultValue * 100;
3257
+ } else {
3258
+ value = 0;
3259
+ }
3260
+ if (props2.decimalFormat) {
3261
+ value = +value.toFixed(2);
3239
3262
  }
3240
- return 0;
3263
+ return value;
3241
3264
  });
3242
3265
  const text = computed(() => {
3266
+ var _a2;
3243
3267
  let text2 = props2.text;
3268
+ if (text2 === "")
3269
+ return unref(myValue);
3270
+ const defaultValue = props2.variableDefaultValue;
3244
3271
  const data = unref(myData);
3245
3272
  const variables = text2.match(/\{.+\}/g) || [];
3246
- if (text2 === "")
3247
- return unref(value) + "%";
3248
- for (let i = 0; i < (variables == null ? void 0 : variables.length); i++) {
3273
+ for (let i = 0; i < variables.length; i++) {
3249
3274
  const variable = variables[i];
3250
3275
  let statement = variable.slice(1, variable.length - 1);
3251
- const textVariables = statement.match(/[a-zA-Z]\w*/g);
3276
+ const textVariables = statement.match(/.*/g);
3252
3277
  for (let j = 0; j < (textVariables == null ? void 0 : textVariables.length); j++) {
3253
- const textVariable = textVariables[i];
3278
+ const textVariable = (_a2 = textVariables[i]) == null ? void 0 : _a2.trim();
3254
3279
  if (data[textVariable] != null) {
3255
3280
  statement = statement.replace(textVariable, data[textVariable]);
3256
3281
  } else {
3257
- statement = statement.replace(textVariable, props2.variableDefaultValue);
3282
+ statement = statement.replace(textVariable, defaultValue);
3258
3283
  }
3259
3284
  }
3260
3285
  let usedVariable = statement;
3261
3286
  try {
3262
- if (/[+\-*/%]+/g.test(statement)) {
3287
+ if (/\w+[+\-*/%]+\w+/g.test(statement)) {
3263
3288
  const eval2 = eval;
3264
3289
  usedVariable = eval2(statement);
3265
3290
  }
3266
3291
  } catch (e) {
3267
3292
  console.error(e);
3268
3293
  }
3269
- if (props2.decimalFormat) {
3270
- usedVariable = usedVariable == null ? void 0 : usedVariable.toFixed(2);
3294
+ if (typeof usedVariable === "number" || !isNaN(+usedVariable)) {
3295
+ usedVariable = +usedVariable * 100;
3296
+ if (props2.decimalFormat) {
3297
+ usedVariable = usedVariable.toFixed(2);
3298
+ }
3271
3299
  }
3272
3300
  text2 = text2.replace(variable, usedVariable + "");
3273
3301
  }
@@ -3306,7 +3334,7 @@ const _sfc_main$h = defineComponent({
3306
3334
  style: style2,
3307
3335
  myWidth,
3308
3336
  text,
3309
- value,
3337
+ myValue,
3310
3338
  loading,
3311
3339
  click
3312
3340
  };
@@ -3321,7 +3349,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
3321
3349
  }, [
3322
3350
  createVNode(_component_a_progress, {
3323
3351
  class: "progress",
3324
- percent: _ctx.value,
3352
+ percent: _ctx.myValue,
3325
3353
  width: _ctx.myWidth,
3326
3354
  type: _ctx.strokeType,
3327
3355
  strokeColor: _ctx.strokeColor,
@@ -3351,7 +3379,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
3351
3379
  }, 8, ["percent", "width", "type", "strokeColor", "strokeLinecap", "trailColor", "strokeWidth", "gapDegree", "onClick"])
3352
3380
  ], 4);
3353
3381
  }
3354
- const Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-5758f39c"]]);
3382
+ const Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-4f7958e8"]]);
3355
3383
  const EcanProportion = withInstall(Proportion);
3356
3384
  const inputProps = {
3357
3385
  ...props,
@@ -4920,7 +4948,8 @@ const _sfc_main$8 = defineComponent({
4920
4948
  },
4921
4949
  components: {
4922
4950
  Spin,
4923
- Echarts
4951
+ Echarts,
4952
+ AModal: Modal$1
4924
4953
  },
4925
4954
  setup(props2) {
4926
4955
  const style2 = usePickComponentStyle(props2);