@ecan-bi/datav 1.0.99 → 1.1.0

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.0.99 */
1
+ /*! @ecan-bi/datav@1.1.0 */
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, 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";
@@ -6759,7 +6759,7 @@ const _sfc_main$1 = defineComponent({
6759
6759
  const pageNum = ref(1);
6760
6760
  const pageSize = computed(() => props2.paginationPageSize);
6761
6761
  const handleChildrenColumns = (_columns) => {
6762
- if (Array.isArray(_columns)) {
6762
+ if (Array.isArray(_columns) && _columns.length > 0) {
6763
6763
  const len = _columns.length;
6764
6764
  const columnsFixedNum = props2.columnsFixedNum;
6765
6765
  for (let i = 0; i < len; i++) {
@@ -6869,8 +6869,8 @@ const _sfc_main$1 = defineComponent({
6869
6869
  tableColumns.value = columns;
6870
6870
  tableDataSource.value = dataSource;
6871
6871
  } else {
6872
- tableColumns.value = unref(myColumns);
6873
- tableDataSource.value = unref(myDataSource);
6872
+ tableColumns.value = cloneDeep(unref(myColumns));
6873
+ tableDataSource.value = cloneDeep(unref(myDataSource));
6874
6874
  }
6875
6875
  }, {
6876
6876
  deep: true,
@@ -6885,7 +6885,7 @@ const _sfc_main$1 = defineComponent({
6885
6885
  if (isUseLoading)
6886
6886
  loading.value = true;
6887
6887
  let params = {};
6888
- if (unref(orderCondition) != null) {
6888
+ if (unref(orderCondition)) {
6889
6889
  params.orderCondition = unref(orderCondition);
6890
6890
  }
6891
6891
  if (props2.paginationShow) {
@@ -6899,7 +6899,9 @@ const _sfc_main$1 = defineComponent({
6899
6899
  const res = await requestData(params);
6900
6900
  const { rows = [], total: tableTotal = 0 } = ((_a2 = res == null ? void 0 : res.data) == null ? void 0 : _a2.data) || {};
6901
6901
  total.value = tableTotal;
6902
- myDataSource.value = rows;
6902
+ if (Array.isArray(rows)) {
6903
+ myDataSource.value = rows;
6904
+ }
6903
6905
  } catch (e) {
6904
6906
  console.error(e);
6905
6907
  } finally {
@@ -7015,8 +7017,12 @@ const _sfc_main$1 = defineComponent({
7015
7017
  refreshData
7016
7018
  });
7017
7019
  const summaryList = computed(() => {
7018
- const columns = props2.columns;
7019
- const summaryList2 = props2.isUseSeq ? [{ total: "\u5C0F\u8BA1" }] : [];
7020
+ const columns = unref(tableColumns);
7021
+ let summaryList2 = [];
7022
+ if (props2.isUseSeq) {
7023
+ columns.shift();
7024
+ summaryList2 = [{ total: "\u5C0F\u8BA1" }];
7025
+ }
7020
7026
  let calcTotalCount = 0;
7021
7027
  for (let i = 0; i < columns.length; i++) {
7022
7028
  const column = columns[i];
@@ -7038,16 +7044,20 @@ const _sfc_main$1 = defineComponent({
7038
7044
  return [];
7039
7045
  const start = (unref(pageNum) - 1) * unref(pageSize);
7040
7046
  const end = start + unref(pageSize);
7041
- const records = unref(myDataSource).slice(start, end);
7042
- for (let i = 0; i < records.length; i++) {
7043
- const record = records[i];
7044
- for (let j = 0; j < summaryList2.length; j++) {
7045
- const summary = summaryList2[j];
7046
- const { dataIndex, total: total2 } = summary;
7047
- const num = +record[dataIndex];
7048
- if (!Number.isNaN(num) && total2 != null) {
7049
- summary.total = num + total2;
7047
+ const records = unref(tableDataSource).slice(start, end);
7048
+ for (let i = 0; i < summaryList2.length; i++) {
7049
+ const summary = summaryList2[i];
7050
+ let total2 = 0;
7051
+ const { isCalcTotal, dataIndex } = summary;
7052
+ if (isCalcTotal === true) {
7053
+ for (let j = 0; j < records.length; j++) {
7054
+ const record = records[j];
7055
+ const num = record[dataIndex];
7056
+ if (!isNaN(num)) {
7057
+ total2 = num + total2;
7058
+ }
7050
7059
  }
7060
+ summary.total = total2;
7051
7061
  }
7052
7062
  }
7053
7063
  return summaryList2;
@@ -7101,7 +7111,7 @@ const _sfc_main$1 = defineComponent({
7101
7111
  };
7102
7112
  }
7103
7113
  });
7104
- const Table_vue_vue_type_style_index_0_scoped_7b4da072_lang = "";
7114
+ const Table_vue_vue_type_style_index_0_scoped_33b428a2_lang = "";
7105
7115
  const Table_vue_vue_type_style_index_1_lang = "";
7106
7116
  const _hoisted_1$1 = {
7107
7117
  key: 1,
@@ -7188,8 +7198,8 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7188
7198
  default: withCtx(() => [
7189
7199
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.summaryList, (summary, index2) => {
7190
7200
  return openBlock(), createBlock(_component_a_table_summary_cell, {
7191
- key: summary.dataIndex + index2,
7192
- index: summary.index,
7201
+ key: index2,
7202
+ index: index2,
7193
7203
  style: normalizeStyle({
7194
7204
  backgroundColor: _ctx.cellBackgroundColor,
7195
7205
  textAlign: summary.cellAlign || "center",
@@ -7199,8 +7209,12 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7199
7209
  }, {
7200
7210
  default: withCtx(() => [
7201
7211
  createElementVNode("div", {
7202
- class: normalizeClass([_ctx.contrastClass(summary.total, summary.format)])
7203
- }, toDisplayString((summary.format != null || summary.format !== "") && _ctx.formatFn(summary.total, summary.format)), 3)
7212
+ class: normalizeClass([_ctx.contrastClass(summary.total, summary.format)]),
7213
+ style: normalizeStyle({
7214
+ fontSize: _ctx.fontSize,
7215
+ fontWeight: _ctx.fontWeight
7216
+ })
7217
+ }, toDisplayString((summary.format != null || summary.format !== "") && _ctx.formatFn(summary.total, summary.format)), 7)
7204
7218
  ]),
7205
7219
  _: 2
7206
7220
  }, 1032, ["index", "style"]);
@@ -7219,7 +7233,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7219
7233
  }, 8, ["loading"])
7220
7234
  ], 4);
7221
7235
  }
7222
- const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-7b4da072"]]);
7236
+ const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-33b428a2"]]);
7223
7237
  const EcanTable = withInstall(Table);
7224
7238
  const mapProps = {
7225
7239
  ...props,