@ecan-bi/datav 1.0.52 → 1.0.55

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
@@ -3216,11 +3216,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
3216
3216
  strokeWidth: 6,
3217
3217
  fontWeight: 400,
3218
3218
  strokeTextWidth: "100%",
3219
- lineHeight: "26px"
3219
+ lineHeight: "26px",
3220
+ decimalFormat: false,
3221
+ variableDefaultValue: ""
3220
3222
  });
3221
3223
  const proportionComponentProps = transformToComponentProps(proportionProps);
3222
3224
  const proportionEvents = ["refreshData", "click"];
3223
- var Proportion_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => ".ecan-proportion[data-v-206755e6] {\n overflow: hidden;\n}\n.progress[data-v-206755e6] {\n width: 100%;\n height: 100%;\n}\n.format[data-v-206755e6] {\n margin: 0 auto;\n}\n")();
3225
+ var Proportion_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => ".ecan-proportion[data-v-4a25add6] {\n overflow: hidden;\n}\n.progress[data-v-4a25add6] {\n width: 100%;\n height: 100%;\n}\n.format[data-v-4a25add6] {\n margin: 0 auto;\n}\n")();
3224
3226
  const _sfc_main$h = vue.defineComponent({
3225
3227
  name: "EcanProportion",
3226
3228
  components: {
@@ -3229,52 +3231,69 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
3229
3231
  },
3230
3232
  props: __spreadValues({}, proportionComponentProps),
3231
3233
  setup(props2) {
3234
+ const { pageMode } = vue.inject(GLOBAL_CONFIG, {
3235
+ pageMode: "normal"
3236
+ });
3232
3237
  const style2 = usePickComponentStyle(props2);
3233
3238
  const myWidth = vue.computed(() => {
3234
3239
  const width = props2.width;
3235
3240
  return parseFloat(width);
3236
3241
  });
3237
- const myData = vue.ref(props2.data);
3242
+ const myData = vue.ref({});
3243
+ vue.watch(() => props2.data, () => {
3244
+ if (props2.dataType === "static" || vue.unref(pageMode) === "design") {
3245
+ myData.value = props2.data;
3246
+ }
3247
+ }, {
3248
+ immediate: true,
3249
+ deep: true
3250
+ });
3238
3251
  const defaultValue = 0;
3239
3252
  const value = vue.computed(() => {
3240
- var _a2;
3241
3253
  const data = vue.unref(myData);
3242
3254
  if (data == null)
3243
3255
  return defaultValue;
3244
3256
  const values = Object.values(data);
3245
- return ((_a2 = values[0]) != null ? _a2 : 0) * 100;
3246
- });
3247
- const useValueKey = vue.computed(() => {
3248
- const data = vue.unref(myData) || {};
3249
- return Object.keys(data)[0];
3257
+ const value2 = values[0] * 100;
3258
+ if (!isNaN(value2)) {
3259
+ return props2.decimalFormat ? value2.toFixed(2) : value2;
3260
+ }
3261
+ return 0;
3250
3262
  });
3251
3263
  const text = vue.computed(() => {
3252
- var _a2;
3253
3264
  let text2 = props2.text;
3254
3265
  const data = vue.unref(myData);
3255
- const variables = text2.match(/\{\w*\}/g) || [];
3266
+ const variables = text2.match(/\{.+\}/g) || [];
3256
3267
  if (text2 === "")
3257
3268
  return vue.unref(value) + "%";
3258
- for (let i = 0; i < variables.length; i++) {
3269
+ for (let i = 0; i < (variables == null ? void 0 : variables.length); i++) {
3259
3270
  const variable = variables[i];
3260
- const v = variable.slice(1, variable.length - 1);
3261
- let usedVariable = "";
3262
- if (vue.unref(useValueKey) === v) {
3263
- usedVariable = vue.unref(value).toFixed(2);
3264
- } else {
3265
- usedVariable = (_a2 = data[v]) != null ? _a2 : defaultValue;
3271
+ let statement = variable.slice(1, variable.length - 1);
3272
+ const textVariables = statement.match(/[a-zA-Z]\w*/g);
3273
+ for (let j = 0; j < (textVariables == null ? void 0 : textVariables.length); j++) {
3274
+ const textVariable = textVariables[i];
3275
+ if (data[textVariable] != null) {
3276
+ statement = statement.replace(textVariable, data[textVariable]);
3277
+ } else {
3278
+ statement = statement.replace(textVariable, props2.variableDefaultValue);
3279
+ }
3266
3280
  }
3267
- if (usedVariable != null) {
3268
- text2 = text2.replace(variable, usedVariable);
3269
- } else {
3270
- text2 = text2.replace(variable, "");
3281
+ let usedVariable = statement;
3282
+ try {
3283
+ if (/[+\-*/%]+/g.test(statement)) {
3284
+ const eval2 = eval;
3285
+ usedVariable = eval2(statement);
3286
+ }
3287
+ } catch (e) {
3288
+ console.error(e);
3271
3289
  }
3290
+ if (props2.decimalFormat) {
3291
+ usedVariable = usedVariable == null ? void 0 : usedVariable.toFixed(2);
3292
+ }
3293
+ text2 = text2.replace(variable, usedVariable + "");
3272
3294
  }
3273
3295
  return text2;
3274
3296
  });
3275
- const { pageMode } = vue.inject(GLOBAL_CONFIG, {
3276
- pageMode: "normal"
3277
- });
3278
3297
  const requestData = useRequestData(props2);
3279
3298
  const loading = vue.ref(false);
3280
3299
  const handleRequestData = async () => {
@@ -3353,7 +3372,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
3353
3372
  }, 8, ["percent", "width", "type", "strokeColor", "strokeLinecap", "trailColor", "strokeWidth", "gapDegree", "onClick"])
3354
3373
  ], 4);
3355
3374
  }
3356
- var Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-206755e6"]]);
3375
+ var Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-4a25add6"]]);
3357
3376
  const EcanProportion = withInstall(Proportion);
3358
3377
  const inputProps = __spreadProps(__spreadValues({}, props), {
3359
3378
  width: "200px",
@@ -3647,7 +3666,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
3647
3666
  danger: false,
3648
3667
  shape: "default",
3649
3668
  href: "",
3650
- target: "_self",
3669
+ target: "self",
3651
3670
  fontSize: "14px",
3652
3671
  fontWeight: 400
3653
3672
  });
@@ -3664,20 +3683,43 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
3664
3683
  const style2 = usePickComponentStyle(props2);
3665
3684
  const events = props2.events;
3666
3685
  const emitEvent = useEmitEvent(events);
3667
- const click = emitEvent("click");
3686
+ const click = emitEvent("click", () => {
3687
+ if (props2.target === "event") {
3688
+ console.log("message");
3689
+ window.parent.postMessage({
3690
+ type: "openPage",
3691
+ url: props2.href
3692
+ }, "*");
3693
+ }
3694
+ });
3668
3695
  const myText = vue.computed(() => useVariablesInText(props2.text));
3669
3696
  const myHref = vue.computed(() => {
3697
+ if (props2.target === "event")
3698
+ return void 0;
3670
3699
  const href = props2.href;
3671
3700
  if (href) {
3672
3701
  return useVariablesInText(href);
3673
3702
  }
3674
3703
  return void 0;
3675
3704
  });
3705
+ const myTarget = vue.computed(() => {
3706
+ const target = props2.target;
3707
+ if (target === "event") {
3708
+ return void 0;
3709
+ } else {
3710
+ const map = {
3711
+ self: "_self",
3712
+ blank: "_blank"
3713
+ };
3714
+ return map[target];
3715
+ }
3716
+ });
3676
3717
  return {
3677
3718
  style: style2,
3678
3719
  click,
3679
3720
  myText,
3680
- myHref
3721
+ myHref,
3722
+ myTarget
3681
3723
  };
3682
3724
  }
3683
3725
  });
@@ -3694,7 +3736,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
3694
3736
  danger: _ctx.danger,
3695
3737
  shape: _ctx.shape,
3696
3738
  href: _ctx.myHref,
3697
- target: _ctx.target
3739
+ target: _ctx.myTarget
3698
3740
  }, {
3699
3741
  default: vue.withCtx(() => [
3700
3742
  vue.createElementVNode("span", {
@@ -4476,7 +4518,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
4476
4518
  valueTypeDataFieldNames: { name: "name", value: "value", type: "type" },
4477
4519
  keyTypeDataFieldNames: { name: "name", types: [] },
4478
4520
  dataFieldConfigType: "value",
4479
- barWidth: "0%",
4521
+ barWidth: "40%",
4480
4522
  gridContainLabel: true,
4481
4523
  gridTop: "10%",
4482
4524
  gridBottom: "10%",
@@ -6071,7 +6113,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6071
6113
  target: "",
6072
6114
  color: ""
6073
6115
  }],
6074
- actionColumnWidth: 50,
6116
+ actionColumnWidth: 100,
6075
6117
  columns: [
6076
6118
  {
6077
6119
  title: "\u59D3\u540D",
@@ -6106,16 +6148,16 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6106
6148
  });
6107
6149
  const tableComponentProps = transformToComponentProps(tableProps);
6108
6150
  const tableEvents = ["click", "refreshData"];
6109
- var Table_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => `.table[data-v-a84f3122] {
6151
+ var Table_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => `.table[data-v-e3b6ea7c] {
6110
6152
  width: 100%;
6111
6153
  }
6112
- .goUp[data-v-a84f3122] {
6154
+ .goUp[data-v-e3b6ea7c] {
6113
6155
  color: #FF512E;
6114
6156
  display: flex;
6115
6157
  align-items: center;
6116
6158
  justify-content: center;
6117
6159
  }
6118
- .goUp[data-v-a84f3122]:before {
6160
+ .goUp[data-v-e3b6ea7c]:before {
6119
6161
  content: '';
6120
6162
  display: block;
6121
6163
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAV1BMVEUAAAD/WzT/WjP/WDD/WzT/WzP/WzT/WzT/WzT/WjT/WzT/WDT/YED/WzT/WzT/WjT/YED/WzT/WzT/WzT/XDT/WzT/WjX/WjP/XDT/XDT/WTL/Tif/WzReH8z5AAAAHHRSTlMA8RgS9W9YHbePZyME5sVjCP7bzcCxgndOQC4GFJJgKwAAAIJJREFUKM+Nkd0OgyAMRjvqcLA53fzXvv9zaokmxq8mnsue5ACFDjiy+XyjLZ7yyK35OxN5mSFZKa2QojEIKRhrZKM0QnsMQxirmJ0kBubTIZvAtUyiFAT4JFoUIYmIotZ5xjDPfyoCAV16nMPdFir8xZ16nM//tePtXw2ODOJY0V0WqQwM2rgKrU0AAAAASUVORK5CYII=");
@@ -6125,13 +6167,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6125
6167
  background-size: cover;
6126
6168
  margin-right: 2px;
6127
6169
  }
6128
- .goDown[data-v-a84f3122] {
6170
+ .goDown[data-v-e3b6ea7c] {
6129
6171
  color: #00F7B4;
6130
6172
  display: flex;
6131
6173
  align-items: center;
6132
6174
  justify-content: center;
6133
6175
  }
6134
- .goDown[data-v-a84f3122]:before {
6176
+ .goDown[data-v-e3b6ea7c]:before {
6135
6177
  content: '';
6136
6178
  display: block;
6137
6179
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAaVBMVEUAAAAA+b0A+LwA+L0A/6AA+LwA+L0A+L0A+b0A+LwA/78A+LwA+L0A+LwA+LwA+b0A+LsA970A+LwA+r0A9boA/7YA+LwA+LwA+LwA+L0A97wA+bwA970A970A+bwA+bwA+LsA9rkA+LzcCa+5AAAAInRSTlMAd/uVAvjYxCsiDvPp37F7aWBMNBgK7s/NvKidh4NXUEcdp9A1SAAAAI5JREFUKM+l0UcOwzAMRFGqWZbcW3rl/Q8ZhUGKMN7lLedD4EKUi/3BEIrGsQu432pmPuF+1WnfRNjLipMz7HbHT3cIF9n3BLYSerzAooSgZNcWQiuhIdBI8JQblNISCqXU/BNG/mqzJ+az13MWluIdRspNmgV+Rvc6vkCwPu1uIhQq5o7WDOwtrToG+ssDeh4QPgfT2X0AAAAASUVORK5CYII=");
@@ -6141,11 +6183,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6141
6183
  background-size: cover;
6142
6184
  margin-right: 2px;
6143
6185
  }
6144
- .action-list[data-v-a84f3122] {
6186
+ .action-list[data-v-e3b6ea7c] {
6145
6187
  display: flex;
6146
6188
  width: 100%;
6147
6189
  }
6148
- .action[data-v-a84f3122] {
6190
+ .action[data-v-e3b6ea7c] {
6149
6191
  flex: 1;
6150
6192
  }
6151
6193
  `)();
@@ -6400,6 +6442,32 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6400
6442
  expose({
6401
6443
  refreshData
6402
6444
  });
6445
+ const handleHref = (target, href = "", data) => {
6446
+ if (target === "event") {
6447
+ return void 0;
6448
+ } else {
6449
+ useVariablesInText(href, data);
6450
+ }
6451
+ };
6452
+ const handleHrefTarget = (target) => {
6453
+ if (target === "event") {
6454
+ return void 0;
6455
+ } else {
6456
+ const map = {
6457
+ self: "_self",
6458
+ blank: "_blank"
6459
+ };
6460
+ return map[target];
6461
+ }
6462
+ };
6463
+ const onTouchHrefEvent = (target, href = "") => {
6464
+ if (target === "event") {
6465
+ window.parent.postMessage({
6466
+ type: "openPage",
6467
+ url: href
6468
+ }, "*");
6469
+ }
6470
+ };
6403
6471
  return {
6404
6472
  x,
6405
6473
  y,
@@ -6414,7 +6482,9 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6414
6482
  dataSource,
6415
6483
  summaryList,
6416
6484
  loading,
6417
- useVariablesInText
6485
+ onTouchHrefEvent,
6486
+ handleHref,
6487
+ handleHrefTarget
6418
6488
  };
6419
6489
  }
6420
6490
  });
@@ -6422,7 +6492,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6422
6492
  key: 1,
6423
6493
  class: "action-list"
6424
6494
  };
6425
- const _hoisted_2 = ["href", "target"];
6495
+ const _hoisted_2 = ["href", "target", "onClick"];
6426
6496
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6427
6497
  const _component_a_table_summary_cell = vue.resolveComponent("a-table-summary-cell");
6428
6498
  const _component_a_table_summary_row = vue.resolveComponent("a-table-summary-row");
@@ -6463,13 +6533,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6463
6533
  key: index22
6464
6534
  }, [
6465
6535
  vue.createElementVNode("a", {
6466
- href: _ctx.useVariablesInText(action.href, record),
6467
- target: action.target,
6536
+ href: _ctx.handleHref(action.target, action.href, record),
6537
+ target: _ctx.handleHrefTarget(action.target),
6468
6538
  style: vue.normalizeStyle({
6469
6539
  color: action.color,
6470
6540
  fontSize: _ctx.fontSize,
6471
6541
  fontWeight: _ctx.fontWeight
6472
- })
6542
+ }),
6543
+ onClick: ($event) => _ctx.onTouchHrefEvent(action.target, action.href)
6473
6544
  }, vue.toDisplayString(action.title), 13, _hoisted_2)
6474
6545
  ]);
6475
6546
  }), 128))
@@ -6520,7 +6591,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6520
6591
  }, 8, ["loading"])
6521
6592
  ], 4);
6522
6593
  }
6523
- var Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-a84f3122"]]);
6594
+ var Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-e3b6ea7c"]]);
6524
6595
  const EcanTable = withInstall(Table);
6525
6596
  const mapProps = __spreadProps(__spreadValues({}, props), {
6526
6597
  mapJson: null,