@ecan-bi/datav 1.1.1 → 1.1.3

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
@@ -1,4 +1,4 @@
1
- /*! @ecan-bi/datav@1.1.1 */
1
+ /*! @ecan-bi/datav@1.1.3 */
2
2
  var _a, _b, _c, _d;
3
3
  import { watch, inject, computed, unref, watchEffect, defineComponent, shallowRef, toRefs, onMounted, onUnmounted, h, nextTick, createVNode, resolveComponent, openBlock, createElementBlock, createBlock, renderSlot, withCtx, ref, normalizeStyle, createCommentVNode, provide, onBeforeUnmount, toDisplayString, Fragment, renderList, createElementVNode, normalizeClass, pushScopeId, popScopeId, createSlots, resolveDynamicComponent, mergeProps, withModifiers, withDirectives, vShow } from "vue";
4
4
  import { throttle, init, use, registerMap } from "echarts/core";
@@ -1560,7 +1560,6 @@ const BASE_URL = ((_c = window == null ? void 0 : window.config) == null ? void
1560
1560
  const ERD_URL = ((_d = window == null ? void 0 : window.config) == null ? void 0 : _d.erdURL) || "";
1561
1561
  const useOnEvent = (props2, events) => {
1562
1562
  watch(() => props2.id, (id, oldId) => {
1563
- console.log(id, oldId);
1564
1563
  const eventBus = inject(EVENT_BUS, {
1565
1564
  onEvent: (i, e) => void 0,
1566
1565
  offEvent: (i) => void 0
@@ -1677,8 +1676,6 @@ const useVariablesInText = (formatter = "", data = {}, { useNewline = false, use
1677
1676
  const usedVariable = data[textVariable];
1678
1677
  if (usedVariable != null) {
1679
1678
  statement = statement.replace(textVariable, usedVariable);
1680
- } else {
1681
- statement = statement.replace(textVariable, "");
1682
1679
  }
1683
1680
  }
1684
1681
  try {
@@ -2825,7 +2822,9 @@ const _sfc_main$n = defineComponent({
2825
2822
  const v = (_a2 = variable == null ? void 0 : variable.slice(1, variable.length - 1)) == null ? void 0 : _a2.trim();
2826
2823
  let usedVariable = data[v];
2827
2824
  if (usedVariable != null) {
2828
- if (props2.format === "percentage") {
2825
+ const format = props2.format;
2826
+ console.log("format", format);
2827
+ if (format === "percentage") {
2829
2828
  usedVariable = +usedVariable;
2830
2829
  if (!isNaN(usedVariable)) {
2831
2830
  usedVariable = (usedVariable * 100).toFixed(2);
@@ -2837,6 +2836,13 @@ const _sfc_main$n = defineComponent({
2837
2836
  } else {
2838
2837
  text = text.replace(variable, `<span style="color:${props2.variableColor};font-size:${props2.variableFontSize}">${0}%</span>`);
2839
2838
  }
2839
+ } else if (format === "percent") {
2840
+ console.log("format", format);
2841
+ usedVariable = +usedVariable;
2842
+ if (!isNaN(usedVariable)) {
2843
+ usedVariable = (usedVariable * 100).toFixed(2);
2844
+ text = text.replace(variable, `<span style="color:${props2.variableColor};font-size:${props2.variableFontSize}">${usedVariable}%</span>`);
2845
+ }
2840
2846
  } else if (props2.format === "money") {
2841
2847
  usedVariable = +usedVariable;
2842
2848
  if (!isNaN(usedVariable)) {
@@ -2919,7 +2925,7 @@ const _sfc_main$n = defineComponent({
2919
2925
  };
2920
2926
  }
2921
2927
  });
2922
- const Text_vue_vue_type_style_index_0_scoped_860fa6ea_lang = "";
2928
+ const Text_vue_vue_type_style_index_0_scoped_0a5690c3_lang = "";
2923
2929
  const _hoisted_1$8 = ["innerHTML"];
2924
2930
  function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
2925
2931
  const _component_skeleton = resolveComponent("skeleton");
@@ -2937,7 +2943,7 @@ function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
2937
2943
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.click && _ctx.click(...args))
2938
2944
  }, null, 12, _hoisted_1$8));
2939
2945
  }
2940
- const Text = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$n], ["__scopeId", "data-v-860fa6ea"]]);
2946
+ const Text = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$n], ["__scopeId", "data-v-0a5690c3"]]);
2941
2947
  const EcanText = withInstall(Text);
2942
2948
  const _sfc_main$m = defineComponent({
2943
2949
  name: "EcanScrollText",
@@ -3150,7 +3156,7 @@ const _hoisted_2$2 = {
3150
3156
  key: 0,
3151
3157
  class: "ranking"
3152
3158
  };
3153
- const _hoisted_3$1 = {
3159
+ const _hoisted_3$2 = {
3154
3160
  key: 1,
3155
3161
  class: "ecan-list-content"
3156
3162
  };
@@ -3198,7 +3204,7 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
3198
3204
  ], 4);
3199
3205
  }), 128))
3200
3206
  ])) : createCommentVNode("", true),
3201
- _ctx.dataSource.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$1, [
3207
+ _ctx.dataSource.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
3202
3208
  _ctx.useTitle ? (openBlock(), createElementBlock("div", {
3203
3209
  key: 0,
3204
3210
  class: "title-placeholder",
@@ -6213,7 +6219,7 @@ const Border_vue_vue_type_style_index_0_scoped_f3fc1305_lang = "";
6213
6219
  const _withScopeId = (n) => (pushScopeId("data-v-f3fc1305"), n = n(), popScopeId(), n);
6214
6220
  const _hoisted_1$5 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "top-left border-item" }, null, -1));
6215
6221
  const _hoisted_2$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "top-right border-item" }, null, -1));
6216
- const _hoisted_3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "bottom-left border-item" }, null, -1));
6222
+ const _hoisted_3$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "bottom-left border-item" }, null, -1));
6217
6223
  const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "bottom-right border-item" }, null, -1));
6218
6224
  const _hoisted_5 = { class: "title-item-wrapper" };
6219
6225
  const _hoisted_6 = { class: "title-item" };
@@ -6249,7 +6255,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
6249
6255
  _ctx.useBorderModify ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
6250
6256
  _hoisted_1$5,
6251
6257
  _hoisted_2$1,
6252
- _hoisted_3,
6258
+ _hoisted_3$1,
6253
6259
  _hoisted_4
6254
6260
  ], 64)) : createCommentVNode("", true)
6255
6261
  ], 4)) : createCommentVNode("", true),
@@ -6808,13 +6814,13 @@ const _sfc_main$1 = defineComponent({
6808
6814
  const x = computed(() => props2.scrollX);
6809
6815
  const y = computed(() => parseFloat(props2.height) - unref(splitY));
6810
6816
  const myColumns = ref([]);
6811
- const myDataSource = ref(props2.data);
6817
+ const myDataSource = ref([]);
6812
6818
  const tableColumns = ref([]);
6813
6819
  const tableDataSource = ref([]);
6814
6820
  const total = ref(0);
6815
6821
  const pageNum = ref(1);
6816
6822
  const pageSize = computed(() => props2.paginationPageSize);
6817
- const handleChildrenColumns = (_columns) => {
6823
+ const handleChildrenColumns = (_columns = []) => {
6818
6824
  if (Array.isArray(_columns) && _columns.length > 0) {
6819
6825
  const len = _columns.length;
6820
6826
  const columnsFixedNum = props2.columnsFixedNum;
@@ -6859,25 +6865,22 @@ const _sfc_main$1 = defineComponent({
6859
6865
  }
6860
6866
  };
6861
6867
  const handleColumns = (columns = []) => {
6862
- let _columns = [];
6863
- const isUseSeq = props2.isUseSeq;
6864
- if (isUseSeq) {
6865
- _columns.push({
6868
+ if (props2.isUseSeq) {
6869
+ columns.unshift({
6866
6870
  title: "\u5E8F\u53F7",
6867
6871
  dataIndex: "SEQ",
6868
6872
  align: "center"
6869
6873
  });
6870
6874
  }
6871
- _columns = _columns.concat(cloneDeep(columns));
6872
6875
  if (props2.isUseAction) {
6873
- _columns.push({
6876
+ columns.push({
6874
6877
  title: "\u64CD\u4F5C",
6875
6878
  dataIndex: "ACTION",
6876
6879
  width: props2.actionColumnWidth
6877
6880
  });
6878
6881
  }
6879
- handleChildrenColumns(_columns);
6880
- myColumns.value = _columns;
6882
+ handleChildrenColumns(columns);
6883
+ return columns;
6881
6884
  };
6882
6885
  watch(() => [
6883
6886
  props2.columns,
@@ -6888,7 +6891,7 @@ const _sfc_main$1 = defineComponent({
6888
6891
  props2.cellBackgroundColor,
6889
6892
  props2.borderColor
6890
6893
  ], () => {
6891
- handleColumns(props2.columns);
6894
+ myColumns.value = handleColumns(cloneDeep(props2.columns));
6892
6895
  }, {
6893
6896
  immediate: true,
6894
6897
  deep: true
@@ -6897,6 +6900,21 @@ const _sfc_main$1 = defineComponent({
6897
6900
  if (dataType !== "static")
6898
6901
  return;
6899
6902
  myDataSource.value = data;
6903
+ }, {
6904
+ immediate: true
6905
+ });
6906
+ watch(() => [props2.isReverse, myColumns.value, myDataSource.value], () => {
6907
+ if (props2.isReverse) {
6908
+ const { columns, dataSource } = handleReverseTable(cloneDeep(unref(myColumns)), cloneDeep(unref(myDataSource)));
6909
+ tableColumns.value = columns;
6910
+ tableDataSource.value = dataSource;
6911
+ } else {
6912
+ tableColumns.value = unref(myColumns);
6913
+ tableDataSource.value = unref(myDataSource);
6914
+ }
6915
+ }, {
6916
+ immediate: true,
6917
+ flush: "post"
6900
6918
  });
6901
6919
  const handleReverseTable = (columns, dataSource) => {
6902
6920
  const firstColumns = columns[0];
@@ -6931,19 +6949,6 @@ const _sfc_main$1 = defineComponent({
6931
6949
  dataSource: _dataSource
6932
6950
  };
6933
6951
  };
6934
- watch(() => [props2.isReverse, myColumns.value, myDataSource.value], () => {
6935
- if (props2.isReverse) {
6936
- const { columns, dataSource } = handleReverseTable(unref(myColumns), unref(myDataSource));
6937
- tableColumns.value = columns;
6938
- tableDataSource.value = dataSource;
6939
- } else {
6940
- tableColumns.value = cloneDeep(unref(myColumns));
6941
- tableDataSource.value = cloneDeep(unref(myDataSource));
6942
- }
6943
- }, {
6944
- deep: true,
6945
- immediate: true
6946
- });
6947
6952
  const orderCondition = ref("");
6948
6953
  const requestData = useRequestData(props2);
6949
6954
  const loading = ref(false);
@@ -7044,7 +7049,8 @@ const _sfc_main$1 = defineComponent({
7044
7049
  });
7045
7050
  const handleIndicatorDataset = (dataColumns = [], dataRows = []) => {
7046
7051
  const _columns = dataColumns.map((column) => ({ title: column, dataIndex: column, key: column }));
7047
- handleColumns(_columns);
7052
+ const columns = handleColumns(_columns);
7053
+ myColumns.value = columns;
7048
7054
  myDataSource.value = dataRows;
7049
7055
  };
7050
7056
  const indicatorData = useIndicatorData(props2);
@@ -7086,16 +7092,17 @@ const _sfc_main$1 = defineComponent({
7086
7092
  });
7087
7093
  const summaryList = computed(() => {
7088
7094
  const columns = unref(tableColumns);
7089
- let summaryList2 = [];
7090
- if (props2.isUseSeq) {
7091
- columns.shift();
7092
- summaryList2 = [{ total: "\u5C0F\u8BA1" }];
7093
- }
7095
+ const summaryList2 = [];
7094
7096
  let calcTotalCount = 0;
7095
7097
  for (let i = 0; i < columns.length; i++) {
7096
7098
  const column = columns[i];
7097
7099
  const { isCalcTotal } = column;
7098
- if (isCalcTotal) {
7100
+ if (props2.isUseSeq && i === 0) {
7101
+ summaryList2.push({
7102
+ ...column,
7103
+ total: "\u5C0F\u8BA1"
7104
+ });
7105
+ } else if (isCalcTotal) {
7099
7106
  summaryList2.push({
7100
7107
  ...column,
7101
7108
  index: i,
@@ -7172,24 +7179,27 @@ const _sfc_main$1 = defineComponent({
7172
7179
  formatFn,
7173
7180
  contrastClass,
7174
7181
  tableChange,
7175
- tableDataSource,
7176
- tableColumns,
7182
+ myColumns,
7183
+ myDataSource,
7177
7184
  summaryList,
7178
7185
  loading,
7179
7186
  onTouchHrefEvent,
7180
7187
  handleHref,
7181
7188
  handleHrefTarget,
7182
- useRowIndex
7189
+ useRowIndex,
7190
+ tableColumns,
7191
+ tableDataSource
7183
7192
  };
7184
7193
  }
7185
7194
  });
7186
- const Table_vue_vue_type_style_index_0_scoped_3e5c9238_lang = "";
7195
+ const Table_vue_vue_type_style_index_0_scoped_292c12ab_lang = "";
7187
7196
  const Table_vue_vue_type_style_index_1_lang = "";
7188
- const _hoisted_1$1 = {
7197
+ const _hoisted_1$1 = { key: 0 };
7198
+ const _hoisted_2 = {
7189
7199
  key: 1,
7190
7200
  class: "action-list"
7191
7201
  };
7192
- const _hoisted_2 = ["href", "target", "onClick"];
7202
+ const _hoisted_3 = ["href", "target", "onClick"];
7193
7203
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7194
7204
  const _component_a_table_summary_cell = resolveComponent("a-table-summary-cell");
7195
7205
  const _component_a_table_summary_row = resolveComponent("a-table-summary-row");
@@ -7230,13 +7240,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7230
7240
  }, toDisplayString(column.title), 5)
7231
7241
  ]),
7232
7242
  bodyCell: withCtx(({ column, index: index2, text, record }) => [
7233
- column.dataIndex === "SEQ" ? (openBlock(), createElementBlock("span", {
7234
- key: 0,
7235
- style: normalizeStyle({
7236
- fontSize: _ctx.fontSize,
7237
- fontWeight: _ctx.fontWeight
7238
- })
7239
- }, toDisplayString(index2 + 1), 5)) : column.dataIndex === "ACTION" ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
7243
+ column.dataIndex === "SEQ" ? (openBlock(), createElementBlock("span", _hoisted_1$1, toDisplayString(index2 + 1), 1)) : createCommentVNode("", true),
7244
+ column.dataIndex === "ACTION" ? (openBlock(), createElementBlock("div", _hoisted_2, [
7240
7245
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.actionList, (action, index22) => {
7241
7246
  return openBlock(), createElementBlock("div", {
7242
7247
  class: "action",
@@ -7251,7 +7256,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7251
7256
  fontWeight: _ctx.fontWeight
7252
7257
  }),
7253
7258
  onClick: ($event) => _ctx.onTouchHrefEvent(action.target, _ctx.handleHref(action.href, record))
7254
- }, toDisplayString(action.title), 13, _hoisted_2)
7259
+ }, toDisplayString(action.title), 13, _hoisted_3)
7255
7260
  ]);
7256
7261
  }), 128))
7257
7262
  ])) : (openBlock(), createElementBlock("div", {
@@ -7261,7 +7266,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7261
7266
  fontSize: _ctx.fontSize,
7262
7267
  fontWeight: _ctx.fontWeight
7263
7268
  })
7264
- }, toDisplayString((column.format != null || column.format !== "") && _ctx.formatFn(text, column.format)), 7))
7269
+ }, toDisplayString(column.format != null ? _ctx.formatFn(text, column.format) : text), 7))
7265
7270
  ]),
7266
7271
  summary: withCtx(() => [
7267
7272
  _ctx.summaryList.length > 0 ? (openBlock(), createBlock(_component_a_table_summary, { key: 0 }, {
@@ -7305,7 +7310,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7305
7310
  }, 8, ["loading"])
7306
7311
  ], 4);
7307
7312
  }
7308
- const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-3e5c9238"]]);
7313
+ const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-292c12ab"]]);
7309
7314
  const EcanTable = withInstall(Table);
7310
7315
  const mapProps = {
7311
7316
  ...props,