@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.es.js CHANGED
@@ -3206,11 +3206,13 @@ const proportionProps = __spreadProps(__spreadValues({}, props), {
3206
3206
  strokeWidth: 6,
3207
3207
  fontWeight: 400,
3208
3208
  strokeTextWidth: "100%",
3209
- lineHeight: "26px"
3209
+ lineHeight: "26px",
3210
+ decimalFormat: false,
3211
+ variableDefaultValue: ""
3210
3212
  });
3211
3213
  const proportionComponentProps = transformToComponentProps(proportionProps);
3212
3214
  const proportionEvents = ["refreshData", "click"];
3213
- 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")();
3215
+ 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")();
3214
3216
  const _sfc_main$h = defineComponent({
3215
3217
  name: "EcanProportion",
3216
3218
  components: {
@@ -3219,52 +3221,69 @@ const _sfc_main$h = defineComponent({
3219
3221
  },
3220
3222
  props: __spreadValues({}, proportionComponentProps),
3221
3223
  setup(props2) {
3224
+ const { pageMode } = inject(GLOBAL_CONFIG, {
3225
+ pageMode: "normal"
3226
+ });
3222
3227
  const style2 = usePickComponentStyle(props2);
3223
3228
  const myWidth = computed(() => {
3224
3229
  const width = props2.width;
3225
3230
  return parseFloat(width);
3226
3231
  });
3227
- const myData = ref(props2.data);
3232
+ const myData = ref({});
3233
+ watch(() => props2.data, () => {
3234
+ if (props2.dataType === "static" || unref(pageMode) === "design") {
3235
+ myData.value = props2.data;
3236
+ }
3237
+ }, {
3238
+ immediate: true,
3239
+ deep: true
3240
+ });
3228
3241
  const defaultValue = 0;
3229
3242
  const value = computed(() => {
3230
- var _a2;
3231
3243
  const data = unref(myData);
3232
3244
  if (data == null)
3233
3245
  return defaultValue;
3234
3246
  const values = Object.values(data);
3235
- return ((_a2 = values[0]) != null ? _a2 : 0) * 100;
3236
- });
3237
- const useValueKey = computed(() => {
3238
- const data = unref(myData) || {};
3239
- return Object.keys(data)[0];
3247
+ const value2 = values[0] * 100;
3248
+ if (!isNaN(value2)) {
3249
+ return props2.decimalFormat ? value2.toFixed(2) : value2;
3250
+ }
3251
+ return 0;
3240
3252
  });
3241
3253
  const text = computed(() => {
3242
- var _a2;
3243
3254
  let text2 = props2.text;
3244
3255
  const data = unref(myData);
3245
- const variables = text2.match(/\{\w*\}/g) || [];
3256
+ const variables = text2.match(/\{.+\}/g) || [];
3246
3257
  if (text2 === "")
3247
3258
  return unref(value) + "%";
3248
- for (let i = 0; i < variables.length; i++) {
3259
+ for (let i = 0; i < (variables == null ? void 0 : variables.length); i++) {
3249
3260
  const variable = variables[i];
3250
- const v = variable.slice(1, variable.length - 1);
3251
- let usedVariable = "";
3252
- if (unref(useValueKey) === v) {
3253
- usedVariable = unref(value).toFixed(2);
3254
- } else {
3255
- usedVariable = (_a2 = data[v]) != null ? _a2 : defaultValue;
3261
+ let statement = variable.slice(1, variable.length - 1);
3262
+ const textVariables = statement.match(/[a-zA-Z]\w*/g);
3263
+ for (let j = 0; j < (textVariables == null ? void 0 : textVariables.length); j++) {
3264
+ const textVariable = textVariables[i];
3265
+ if (data[textVariable] != null) {
3266
+ statement = statement.replace(textVariable, data[textVariable]);
3267
+ } else {
3268
+ statement = statement.replace(textVariable, props2.variableDefaultValue);
3269
+ }
3256
3270
  }
3257
- if (usedVariable != null) {
3258
- text2 = text2.replace(variable, usedVariable);
3259
- } else {
3260
- text2 = text2.replace(variable, "");
3271
+ let usedVariable = statement;
3272
+ try {
3273
+ if (/[+\-*/%]+/g.test(statement)) {
3274
+ const eval2 = eval;
3275
+ usedVariable = eval2(statement);
3276
+ }
3277
+ } catch (e) {
3278
+ console.error(e);
3261
3279
  }
3280
+ if (props2.decimalFormat) {
3281
+ usedVariable = usedVariable == null ? void 0 : usedVariable.toFixed(2);
3282
+ }
3283
+ text2 = text2.replace(variable, usedVariable + "");
3262
3284
  }
3263
3285
  return text2;
3264
3286
  });
3265
- const { pageMode } = inject(GLOBAL_CONFIG, {
3266
- pageMode: "normal"
3267
- });
3268
3287
  const requestData = useRequestData(props2);
3269
3288
  const loading = ref(false);
3270
3289
  const handleRequestData = async () => {
@@ -3343,7 +3362,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
3343
3362
  }, 8, ["percent", "width", "type", "strokeColor", "strokeLinecap", "trailColor", "strokeWidth", "gapDegree", "onClick"])
3344
3363
  ], 4);
3345
3364
  }
3346
- var Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-206755e6"]]);
3365
+ var Proportion = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$h], ["__scopeId", "data-v-4a25add6"]]);
3347
3366
  const EcanProportion = withInstall(Proportion);
3348
3367
  const inputProps = __spreadProps(__spreadValues({}, props), {
3349
3368
  width: "200px",
@@ -3637,7 +3656,7 @@ const buttonProps = __spreadProps(__spreadValues({}, props), {
3637
3656
  danger: false,
3638
3657
  shape: "default",
3639
3658
  href: "",
3640
- target: "_self",
3659
+ target: "self",
3641
3660
  fontSize: "14px",
3642
3661
  fontWeight: 400
3643
3662
  });
@@ -3654,20 +3673,43 @@ const _sfc_main$c = defineComponent({
3654
3673
  const style2 = usePickComponentStyle(props2);
3655
3674
  const events = props2.events;
3656
3675
  const emitEvent = useEmitEvent(events);
3657
- const click = emitEvent("click");
3676
+ const click = emitEvent("click", () => {
3677
+ if (props2.target === "event") {
3678
+ console.log("message");
3679
+ window.parent.postMessage({
3680
+ type: "openPage",
3681
+ url: props2.href
3682
+ }, "*");
3683
+ }
3684
+ });
3658
3685
  const myText = computed(() => useVariablesInText(props2.text));
3659
3686
  const myHref = computed(() => {
3687
+ if (props2.target === "event")
3688
+ return void 0;
3660
3689
  const href = props2.href;
3661
3690
  if (href) {
3662
3691
  return useVariablesInText(href);
3663
3692
  }
3664
3693
  return void 0;
3665
3694
  });
3695
+ const myTarget = computed(() => {
3696
+ const target = props2.target;
3697
+ if (target === "event") {
3698
+ return void 0;
3699
+ } else {
3700
+ const map = {
3701
+ self: "_self",
3702
+ blank: "_blank"
3703
+ };
3704
+ return map[target];
3705
+ }
3706
+ });
3666
3707
  return {
3667
3708
  style: style2,
3668
3709
  click,
3669
3710
  myText,
3670
- myHref
3711
+ myHref,
3712
+ myTarget
3671
3713
  };
3672
3714
  }
3673
3715
  });
@@ -3684,7 +3726,7 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
3684
3726
  danger: _ctx.danger,
3685
3727
  shape: _ctx.shape,
3686
3728
  href: _ctx.myHref,
3687
- target: _ctx.target
3729
+ target: _ctx.myTarget
3688
3730
  }, {
3689
3731
  default: withCtx(() => [
3690
3732
  createElementVNode("span", {
@@ -4466,7 +4508,7 @@ const barProps = __spreadProps(__spreadValues({}, props), {
4466
4508
  valueTypeDataFieldNames: { name: "name", value: "value", type: "type" },
4467
4509
  keyTypeDataFieldNames: { name: "name", types: [] },
4468
4510
  dataFieldConfigType: "value",
4469
- barWidth: "0%",
4511
+ barWidth: "40%",
4470
4512
  gridContainLabel: true,
4471
4513
  gridTop: "10%",
4472
4514
  gridBottom: "10%",
@@ -6061,7 +6103,7 @@ const tableProps = __spreadProps(__spreadValues({}, props), {
6061
6103
  target: "",
6062
6104
  color: ""
6063
6105
  }],
6064
- actionColumnWidth: 50,
6106
+ actionColumnWidth: 100,
6065
6107
  columns: [
6066
6108
  {
6067
6109
  title: "\u59D3\u540D",
@@ -6096,16 +6138,16 @@ const tableProps = __spreadProps(__spreadValues({}, props), {
6096
6138
  });
6097
6139
  const tableComponentProps = transformToComponentProps(tableProps);
6098
6140
  const tableEvents = ["click", "refreshData"];
6099
- var Table_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => `.table[data-v-a84f3122] {
6141
+ var Table_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => `.table[data-v-e3b6ea7c] {
6100
6142
  width: 100%;
6101
6143
  }
6102
- .goUp[data-v-a84f3122] {
6144
+ .goUp[data-v-e3b6ea7c] {
6103
6145
  color: #FF512E;
6104
6146
  display: flex;
6105
6147
  align-items: center;
6106
6148
  justify-content: center;
6107
6149
  }
6108
- .goUp[data-v-a84f3122]:before {
6150
+ .goUp[data-v-e3b6ea7c]:before {
6109
6151
  content: '';
6110
6152
  display: block;
6111
6153
  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=");
@@ -6115,13 +6157,13 @@ var Table_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => `
6115
6157
  background-size: cover;
6116
6158
  margin-right: 2px;
6117
6159
  }
6118
- .goDown[data-v-a84f3122] {
6160
+ .goDown[data-v-e3b6ea7c] {
6119
6161
  color: #00F7B4;
6120
6162
  display: flex;
6121
6163
  align-items: center;
6122
6164
  justify-content: center;
6123
6165
  }
6124
- .goDown[data-v-a84f3122]:before {
6166
+ .goDown[data-v-e3b6ea7c]:before {
6125
6167
  content: '';
6126
6168
  display: block;
6127
6169
  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=");
@@ -6131,11 +6173,11 @@ var Table_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => `
6131
6173
  background-size: cover;
6132
6174
  margin-right: 2px;
6133
6175
  }
6134
- .action-list[data-v-a84f3122] {
6176
+ .action-list[data-v-e3b6ea7c] {
6135
6177
  display: flex;
6136
6178
  width: 100%;
6137
6179
  }
6138
- .action[data-v-a84f3122] {
6180
+ .action[data-v-e3b6ea7c] {
6139
6181
  flex: 1;
6140
6182
  }
6141
6183
  `)();
@@ -6390,6 +6432,32 @@ const _sfc_main$1 = defineComponent({
6390
6432
  expose({
6391
6433
  refreshData
6392
6434
  });
6435
+ const handleHref = (target, href = "", data) => {
6436
+ if (target === "event") {
6437
+ return void 0;
6438
+ } else {
6439
+ useVariablesInText(href, data);
6440
+ }
6441
+ };
6442
+ const handleHrefTarget = (target) => {
6443
+ if (target === "event") {
6444
+ return void 0;
6445
+ } else {
6446
+ const map = {
6447
+ self: "_self",
6448
+ blank: "_blank"
6449
+ };
6450
+ return map[target];
6451
+ }
6452
+ };
6453
+ const onTouchHrefEvent = (target, href = "") => {
6454
+ if (target === "event") {
6455
+ window.parent.postMessage({
6456
+ type: "openPage",
6457
+ url: href
6458
+ }, "*");
6459
+ }
6460
+ };
6393
6461
  return {
6394
6462
  x,
6395
6463
  y,
@@ -6404,7 +6472,9 @@ const _sfc_main$1 = defineComponent({
6404
6472
  dataSource,
6405
6473
  summaryList,
6406
6474
  loading,
6407
- useVariablesInText
6475
+ onTouchHrefEvent,
6476
+ handleHref,
6477
+ handleHrefTarget
6408
6478
  };
6409
6479
  }
6410
6480
  });
@@ -6412,7 +6482,7 @@ const _hoisted_1$1 = {
6412
6482
  key: 1,
6413
6483
  class: "action-list"
6414
6484
  };
6415
- const _hoisted_2 = ["href", "target"];
6485
+ const _hoisted_2 = ["href", "target", "onClick"];
6416
6486
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6417
6487
  const _component_a_table_summary_cell = resolveComponent("a-table-summary-cell");
6418
6488
  const _component_a_table_summary_row = resolveComponent("a-table-summary-row");
@@ -6453,13 +6523,14 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6453
6523
  key: index22
6454
6524
  }, [
6455
6525
  createElementVNode("a", {
6456
- href: _ctx.useVariablesInText(action.href, record),
6457
- target: action.target,
6526
+ href: _ctx.handleHref(action.target, action.href, record),
6527
+ target: _ctx.handleHrefTarget(action.target),
6458
6528
  style: normalizeStyle({
6459
6529
  color: action.color,
6460
6530
  fontSize: _ctx.fontSize,
6461
6531
  fontWeight: _ctx.fontWeight
6462
- })
6532
+ }),
6533
+ onClick: ($event) => _ctx.onTouchHrefEvent(action.target, action.href)
6463
6534
  }, toDisplayString(action.title), 13, _hoisted_2)
6464
6535
  ]);
6465
6536
  }), 128))
@@ -6510,7 +6581,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6510
6581
  }, 8, ["loading"])
6511
6582
  ], 4);
6512
6583
  }
6513
- var Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-a84f3122"]]);
6584
+ var Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-e3b6ea7c"]]);
6514
6585
  const EcanTable = withInstall(Table);
6515
6586
  const mapProps = __spreadProps(__spreadValues({}, props), {
6516
6587
  mapJson: null,