@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.umd.js CHANGED
@@ -3233,47 +3233,75 @@
3233
3233
  immediate: true,
3234
3234
  deep: true
3235
3235
  });
3236
- const defaultValue = 0;
3237
- const value = vue.computed(() => {
3236
+ const myValue = vue.computed(() => {
3238
3237
  const data = vue.unref(myData);
3239
- if (data == null)
3240
- return defaultValue;
3241
- const values = Object.values(data);
3242
- const value2 = values[0] * 100;
3243
- if (!isNaN(value2)) {
3244
- return props2.decimalFormat ? value2.toFixed(2) : value2;
3238
+ const defaultValue = +props2.variableDefaultValue;
3239
+ if (data == null) {
3240
+ if (!isNaN(defaultValue)) {
3241
+ return defaultValue;
3242
+ } else {
3243
+ return 0;
3244
+ }
3245
+ }
3246
+ const variables = props2.text.match(/\{.+\}/g) || [];
3247
+ let value;
3248
+ const valueSet = new Set(Object.keys(data));
3249
+ for (let i = 0; i < variables.length; i++) {
3250
+ const variable = variables[i];
3251
+ const key = variable.slice(1, variable.length - 1);
3252
+ if (valueSet.has(key)) {
3253
+ value = data[key];
3254
+ break;
3255
+ }
3256
+ }
3257
+ if (typeof value === "number") {
3258
+ value = value * 100;
3259
+ } else if (typeof value === "string" && !isNaN(+value)) {
3260
+ value = +value * 100;
3261
+ } else if (!isNaN(defaultValue)) {
3262
+ value = defaultValue * 100;
3263
+ } else {
3264
+ value = 0;
3265
+ }
3266
+ if (props2.decimalFormat) {
3267
+ value = +value.toFixed(2);
3245
3268
  }
3246
- return 0;
3269
+ return value;
3247
3270
  });
3248
3271
  const text = vue.computed(() => {
3272
+ var _a2;
3249
3273
  let text2 = props2.text;
3274
+ if (text2 === "")
3275
+ return vue.unref(myValue);
3276
+ const defaultValue = props2.variableDefaultValue;
3250
3277
  const data = vue.unref(myData);
3251
3278
  const variables = text2.match(/\{.+\}/g) || [];
3252
- if (text2 === "")
3253
- return vue.unref(value) + "%";
3254
- for (let i = 0; i < (variables == null ? void 0 : variables.length); i++) {
3279
+ for (let i = 0; i < variables.length; i++) {
3255
3280
  const variable = variables[i];
3256
3281
  let statement = variable.slice(1, variable.length - 1);
3257
- const textVariables = statement.match(/[a-zA-Z]\w*/g);
3282
+ const textVariables = statement.match(/.*/g);
3258
3283
  for (let j = 0; j < (textVariables == null ? void 0 : textVariables.length); j++) {
3259
- const textVariable = textVariables[i];
3284
+ const textVariable = (_a2 = textVariables[i]) == null ? void 0 : _a2.trim();
3260
3285
  if (data[textVariable] != null) {
3261
3286
  statement = statement.replace(textVariable, data[textVariable]);
3262
3287
  } else {
3263
- statement = statement.replace(textVariable, props2.variableDefaultValue);
3288
+ statement = statement.replace(textVariable, defaultValue);
3264
3289
  }
3265
3290
  }
3266
3291
  let usedVariable = statement;
3267
3292
  try {
3268
- if (/[+\-*/%]+/g.test(statement)) {
3293
+ if (/\w+[+\-*/%]+\w+/g.test(statement)) {
3269
3294
  const eval2 = eval;
3270
3295
  usedVariable = eval2(statement);
3271
3296
  }
3272
3297
  } catch (e) {
3273
3298
  console.error(e);
3274
3299
  }
3275
- if (props2.decimalFormat) {
3276
- usedVariable = usedVariable == null ? void 0 : usedVariable.toFixed(2);
3300
+ if (typeof usedVariable === "number" || !isNaN(+usedVariable)) {
3301
+ usedVariable = +usedVariable * 100;
3302
+ if (props2.decimalFormat) {
3303
+ usedVariable = usedVariable.toFixed(2);
3304
+ }
3277
3305
  }
3278
3306
  text2 = text2.replace(variable, usedVariable + "");
3279
3307
  }
@@ -3312,7 +3340,7 @@
3312
3340
  style: style2,
3313
3341
  myWidth,
3314
3342
  text,
3315
- value,
3343
+ myValue,
3316
3344
  loading,
3317
3345
  click
3318
3346
  };
@@ -3327,7 +3355,7 @@
3327
3355
  }, [
3328
3356
  vue.createVNode(_component_a_progress, {
3329
3357
  class: "progress",
3330
- percent: _ctx.value,
3358
+ percent: _ctx.myValue,
3331
3359
  width: _ctx.myWidth,
3332
3360
  type: _ctx.strokeType,
3333
3361
  strokeColor: _ctx.strokeColor,
@@ -3357,7 +3385,7 @@
3357
3385
  }, 8, ["percent", "width", "type", "strokeColor", "strokeLinecap", "trailColor", "strokeWidth", "gapDegree", "onClick"])
3358
3386
  ], 4);
3359
3387
  }
3360
- const Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-5758f39c"]]);
3388
+ const Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-4f7958e8"]]);
3361
3389
  const EcanProportion = withInstall(Proportion);
3362
3390
  const inputProps = {
3363
3391
  ...props,
@@ -4926,7 +4954,8 @@
4926
4954
  },
4927
4955
  components: {
4928
4956
  Spin,
4929
- Echarts
4957
+ Echarts,
4958
+ AModal: antDesignVue.Modal
4930
4959
  },
4931
4960
  setup(props2) {
4932
4961
  const style2 = usePickComponentStyle(props2);