@ecan-bi/datav 1.0.53 → 1.0.54

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
@@ -3207,11 +3207,12 @@ const proportionProps = __spreadProps(__spreadValues({}, props), {
3207
3207
  fontWeight: 400,
3208
3208
  strokeTextWidth: "100%",
3209
3209
  lineHeight: "26px",
3210
- decimalFormat: false
3210
+ decimalFormat: false,
3211
+ textDefaultValue: ""
3211
3212
  });
3212
3213
  const proportionComponentProps = transformToComponentProps(proportionProps);
3213
3214
  const proportionEvents = ["refreshData", "click"];
3214
- 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")();
3215
+ var Proportion_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => ".ecan-proportion[data-v-f029c988] {\n overflow: hidden;\n}\n.progress[data-v-f029c988] {\n width: 100%;\n height: 100%;\n}\n.format[data-v-f029c988] {\n margin: 0 auto;\n}\n")();
3215
3216
  const _sfc_main$h = defineComponent({
3216
3217
  name: "EcanProportion",
3217
3218
  components: {
@@ -3220,6 +3221,9 @@ const _sfc_main$h = defineComponent({
3220
3221
  },
3221
3222
  props: __spreadValues({}, proportionComponentProps),
3222
3223
  setup(props2) {
3224
+ const { pageMode } = inject(GLOBAL_CONFIG, {
3225
+ pageMode: "normal"
3226
+ });
3223
3227
  const style2 = usePickComponentStyle(props2);
3224
3228
  const myWidth = computed(() => {
3225
3229
  const width = props2.width;
@@ -3249,37 +3253,41 @@ const _sfc_main$h = defineComponent({
3249
3253
  const text = computed(() => {
3250
3254
  let text2 = props2.text;
3251
3255
  const data = unref(myData);
3256
+ console.log(data);
3252
3257
  const variables = text2.match(/\{.*\}/g) || [];
3253
- console.log("variables", variables);
3254
3258
  if (text2 === "")
3255
3259
  return unref(value) + "%";
3256
3260
  for (let i = 0; i < variables.length; i++) {
3257
3261
  const variable = variables[i];
3258
3262
  let statement = variable.slice(1, variable.length - 1);
3259
3263
  const textVariables = statement.match(/[a-zA-Z]\w*/g);
3260
- console.log("textVariables", textVariables);
3261
3264
  for (let j = 0; j < textVariables.length; j++) {
3262
3265
  const textVariable = textVariables[i];
3263
3266
  if (data[textVariable] != null) {
3264
3267
  statement = statement.replace(textVariable, data[textVariable]);
3268
+ } else {
3269
+ statement = statement.replace(textVariable, props2.textDefaultValue);
3265
3270
  }
3266
3271
  }
3267
3272
  console.log("statement", statement);
3268
- let usedVariable;
3269
- if (/[+\-*/%]+/g.test(statement)) {
3270
- const eval2 = eval;
3271
- usedVariable = eval2(statement);
3273
+ let usedVariable = statement;
3274
+ try {
3275
+ if (/[+\-*/%]+/g.test(statement)) {
3276
+ const eval2 = eval;
3277
+ usedVariable = eval2(statement);
3278
+ }
3279
+ } catch (e) {
3280
+ console.error(e);
3272
3281
  }
3273
3282
  if (props2.decimalFormat) {
3274
3283
  usedVariable = usedVariable == null ? void 0 : usedVariable.toFixed(2);
3275
3284
  }
3285
+ console.log("usedVariable", usedVariable);
3276
3286
  text2 = text2.replace(variable, usedVariable + "");
3277
3287
  }
3288
+ console.log("text", text2);
3278
3289
  return text2;
3279
3290
  });
3280
- const { pageMode } = inject(GLOBAL_CONFIG, {
3281
- pageMode: "normal"
3282
- });
3283
3291
  const requestData = useRequestData(props2);
3284
3292
  const loading = ref(false);
3285
3293
  const handleRequestData = async () => {
@@ -3358,7 +3366,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
3358
3366
  }, 8, ["percent", "width", "type", "strokeColor", "strokeLinecap", "trailColor", "strokeWidth", "gapDegree", "onClick"])
3359
3367
  ], 4);
3360
3368
  }
3361
- var Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-f55c66cc"]]);
3369
+ var Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-f029c988"]]);
3362
3370
  const EcanProportion = withInstall(Proportion);
3363
3371
  const inputProps = __spreadProps(__spreadValues({}, props), {
3364
3372
  width: "200px",