@ecan-bi/datav 1.1.3 → 1.1.5

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,6 +1,6 @@
1
- /*! @ecan-bi/datav@1.1.3 */
1
+ /*! @ecan-bi/datav@1.1.5 */
2
2
  var _a, _b, _c, _d;
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";
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, reactive, createTextVNode, withDirectives, vShow } from "vue";
4
4
  import { throttle, init, use, registerMap } from "echarts/core";
5
5
  import { addListener, removeListener } from "resize-detector";
6
6
  import { Spin as Spin$1, Skeleton as Skeleton$1, message, Progress, Input as Input$1, DatePicker as DatePicker$1, Select as Select$1, RangePicker as RangePicker$1, Button as Button$1, CheckboxGroup, Modal as Modal$1, Table as Table$1, TableSummary, TableSummaryRow, TableSummaryCell } from "ant-design-vue";
@@ -1555,7 +1555,7 @@ const REQUEST_MODEL = "REQUEST_MODEL";
1555
1555
  const GLOBAL_TOKEN = "GLOBAL_TOKEN";
1556
1556
  const REFRESH_PAGE = "REFRESH_PAGE";
1557
1557
  const INDICATOR_URL = (_a = window == null ? void 0 : window.config) == null ? void 0 : _a.indicatorURL;
1558
- const UPLOAD_PATH = ((_b = window == null ? void 0 : window.config) == null ? void 0 : _b.uploadPath) || "/api";
1558
+ ((_b = window == null ? void 0 : window.config) == null ? void 0 : _b.uploadPath) || "/api";
1559
1559
  const BASE_URL = ((_c = window == null ? void 0 : window.config) == null ? void 0 : _c.routerBaseURL) || "./";
1560
1560
  const ERD_URL = ((_d = window == null ? void 0 : window.config) == null ? void 0 : _d.erdURL) || "";
1561
1561
  const useOnEvent = (props2, events) => {
@@ -1836,13 +1836,14 @@ const useTransformChartDataByAttrKey = (data = [], dataFieldNames) => {
1836
1836
  };
1837
1837
  };
1838
1838
  const useImagePath = (path, isFormat = false) => {
1839
+ var _a2;
1839
1840
  if (!path)
1840
1841
  return path;
1841
1842
  let imagePath = "";
1842
1843
  if (path == null ? void 0 : path.includes("://")) {
1843
1844
  imagePath = path;
1844
1845
  } else {
1845
- imagePath = UPLOAD_PATH + path;
1846
+ imagePath = ((_a2 = window == null ? void 0 : window.config) == null ? void 0 : _a2.uploadPath) + path;
1846
1847
  }
1847
1848
  if (isFormat) {
1848
1849
  imagePath = `url(${imagePath})`;
@@ -3160,12 +3161,12 @@ const _hoisted_3$2 = {
3160
3161
  key: 1,
3161
3162
  class: "ecan-list-content"
3162
3163
  };
3163
- const _hoisted_4$1 = {
3164
+ const _hoisted_4$2 = {
3164
3165
  key: 0,
3165
3166
  class: "ranking"
3166
3167
  };
3167
- const _hoisted_5$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("div", { class: "icon" }, null, -1));
3168
- const _hoisted_6$1 = { class: "sort" };
3168
+ const _hoisted_5$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("div", { class: "icon" }, null, -1));
3169
+ const _hoisted_6$2 = { class: "sort" };
3169
3170
  const _hoisted_7$1 = {
3170
3171
  key: 2,
3171
3172
  class: "empty"
@@ -3225,9 +3226,9 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
3225
3226
  key: item.id || i,
3226
3227
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.click && _ctx.click(...args))
3227
3228
  }, [
3228
- _ctx.useRanking ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
3229
- _hoisted_5$1,
3230
- createElementVNode("div", _hoisted_6$1, " Top " + toDisplayString(i + 1), 1)
3229
+ _ctx.useRanking ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
3230
+ _hoisted_5$2,
3231
+ createElementVNode("div", _hoisted_6$2, " Top " + toDisplayString(i + 1), 1)
3231
3232
  ])) : createCommentVNode("", true),
3232
3233
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (column) => {
3233
3234
  return openBlock(), createElementBlock("div", {
@@ -6220,9 +6221,9 @@ const _withScopeId = (n) => (pushScopeId("data-v-f3fc1305"), n = n(), popScopeId
6220
6221
  const _hoisted_1$5 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "top-left border-item" }, null, -1));
6221
6222
  const _hoisted_2$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "top-right border-item" }, null, -1));
6222
6223
  const _hoisted_3$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "bottom-left border-item" }, null, -1));
6223
- const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "bottom-right border-item" }, null, -1));
6224
- const _hoisted_5 = { class: "title-item-wrapper" };
6225
- const _hoisted_6 = { class: "title-item" };
6224
+ const _hoisted_4$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "bottom-right border-item" }, null, -1));
6225
+ const _hoisted_5$1 = { class: "title-item-wrapper" };
6226
+ const _hoisted_6$1 = { class: "title-item" };
6226
6227
  const _hoisted_7 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("img", {
6227
6228
  class: "title-decoration-left",
6228
6229
  src: _imports_0
@@ -6256,7 +6257,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
6256
6257
  _hoisted_1$5,
6257
6258
  _hoisted_2$1,
6258
6259
  _hoisted_3$1,
6259
- _hoisted_4
6260
+ _hoisted_4$1
6260
6261
  ], 64)) : createCommentVNode("", true)
6261
6262
  ], 4)) : createCommentVNode("", true),
6262
6263
  _ctx.mode === "top-title" ? (openBlock(), createElementBlock("div", {
@@ -6264,8 +6265,8 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
6264
6265
  class: "top-title",
6265
6266
  style: normalizeStyle(_ctx.borderStyle)
6266
6267
  }, [
6267
- createElementVNode("div", _hoisted_5, [
6268
- createElementVNode("div", _hoisted_6, [
6268
+ createElementVNode("div", _hoisted_5$1, [
6269
+ createElementVNode("div", _hoisted_6$1, [
6269
6270
  _hoisted_7,
6270
6271
  createElementVNode("div", _hoisted_8, toDisplayString(_ctx.title), 1),
6271
6272
  _hoisted_9
@@ -6780,6 +6781,8 @@ const _sfc_main$1 = defineComponent({
6780
6781
  name: "EcanTable",
6781
6782
  components: {
6782
6783
  Skeleton,
6784
+ AInput: Input$1,
6785
+ ACheckboxGroup: CheckboxGroup,
6783
6786
  ATable: Table$1,
6784
6787
  ATableSummary: TableSummary,
6785
6788
  ATableSummaryRow: TableSummaryRow,
@@ -6820,6 +6823,7 @@ const _sfc_main$1 = defineComponent({
6820
6823
  const total = ref(0);
6821
6824
  const pageNum = ref(1);
6822
6825
  const pageSize = computed(() => props2.paginationPageSize);
6826
+ const filterDataIndexList = reactive([]);
6823
6827
  const handleChildrenColumns = (_columns = []) => {
6824
6828
  if (Array.isArray(_columns) && _columns.length > 0) {
6825
6829
  const len = _columns.length;
@@ -6835,8 +6839,16 @@ const _sfc_main$1 = defineComponent({
6835
6839
  cellAlign = "center",
6836
6840
  cellColor,
6837
6841
  dataIndex,
6838
- title
6842
+ title,
6843
+ tableFilter
6839
6844
  } = column;
6845
+ if (tableFilter) {
6846
+ filterDataIndexList.push(dataIndex);
6847
+ column.filterOptionsInputValue = "";
6848
+ column.filterCheckboxGroupValue = [];
6849
+ column.customFilterDropdown = true;
6850
+ column.onFilter = (value, record) => record[dataIndex].toString().toLowerCase().includes(value.toLowerCase());
6851
+ }
6840
6852
  column.customCell = (record, rowIndex) => ({
6841
6853
  style: {
6842
6854
  textAlign: cellAlign,
@@ -6903,14 +6915,48 @@ const _sfc_main$1 = defineComponent({
6903
6915
  }, {
6904
6916
  immediate: true
6905
6917
  });
6918
+ const allFilterOptions = ref({});
6919
+ const handleFilterCheckboxOptions = (dataSource) => {
6920
+ if (Array.isArray(dataSource)) {
6921
+ const dataLen = dataSource.length;
6922
+ const keys = filterDataIndexList;
6923
+ const keysLen = keys.length;
6924
+ const filterOptionsMap = {};
6925
+ for (let i = 0; i < dataLen; i++) {
6926
+ const record = dataSource[i];
6927
+ for (let j = 0; j < keysLen; j++) {
6928
+ const key = keys[j];
6929
+ if (filterOptionsMap[key]) {
6930
+ filterOptionsMap[key].add(record[key]);
6931
+ } else {
6932
+ const set = /* @__PURE__ */ new Set();
6933
+ set.add(record[key]);
6934
+ filterOptionsMap[key] = set;
6935
+ }
6936
+ }
6937
+ }
6938
+ const _allFilterOptions = {};
6939
+ for (const key in filterOptionsMap) {
6940
+ if (Object.prototype.hasOwnProperty.call(filterOptionsMap, key)) {
6941
+ const optionsSet = filterOptionsMap[key];
6942
+ const options = Array.from(optionsSet);
6943
+ _allFilterOptions[key] = options.map((option) => ({ label: option, value: option }));
6944
+ }
6945
+ }
6946
+ allFilterOptions.value = _allFilterOptions;
6947
+ }
6948
+ };
6906
6949
  watch(() => [props2.isReverse, myColumns.value, myDataSource.value], () => {
6950
+ const _columns = unref(myColumns);
6951
+ const _dataSource = unref(myDataSource);
6952
+ handleFilterCheckboxOptions(_dataSource);
6907
6953
  if (props2.isReverse) {
6908
- const { columns, dataSource } = handleReverseTable(cloneDeep(unref(myColumns)), cloneDeep(unref(myDataSource)));
6954
+ const { columns, dataSource } = handleReverseTable(cloneDeep(_columns), cloneDeep(_dataSource));
6909
6955
  tableColumns.value = columns;
6910
6956
  tableDataSource.value = dataSource;
6911
6957
  } else {
6912
- tableColumns.value = unref(myColumns);
6913
- tableDataSource.value = unref(myDataSource);
6958
+ tableColumns.value = _columns;
6959
+ tableDataSource.value = _dataSource;
6914
6960
  }
6915
6961
  }, {
6916
6962
  immediate: true,
@@ -7049,8 +7095,7 @@ const _sfc_main$1 = defineComponent({
7049
7095
  });
7050
7096
  const handleIndicatorDataset = (dataColumns = [], dataRows = []) => {
7051
7097
  const _columns = dataColumns.map((column) => ({ title: column, dataIndex: column, key: column }));
7052
- const columns = handleColumns(_columns);
7053
- myColumns.value = columns;
7098
+ myColumns.value = handleColumns(_columns);
7054
7099
  myDataSource.value = dataRows;
7055
7100
  };
7056
7101
  const indicatorData = useIndicatorData(props2);
@@ -7170,6 +7215,34 @@ const _sfc_main$1 = defineComponent({
7170
7215
  }, "*");
7171
7216
  }
7172
7217
  };
7218
+ const useSetSelectedKeys = (setSelectedKeys, column) => {
7219
+ setSelectedKeys(column.filterCheckboxGroupValue);
7220
+ };
7221
+ const onResetFilter = (clearFilters, column) => {
7222
+ clearFilters({ confirm: true });
7223
+ column.filterOptionsInputValue = "";
7224
+ column.filterCheckboxGroupValue = [];
7225
+ };
7226
+ const onSearchFilterOptions = () => {
7227
+ };
7228
+ const useFilterOptions = (column) => {
7229
+ const key = column.dataIndex;
7230
+ if (typeof key === "string") {
7231
+ let filterOptions = unref(allFilterOptions)[key];
7232
+ const _inputValue = unref(column.filterOptionsInputValue).trim();
7233
+ if (Array.isArray(filterOptions)) {
7234
+ filterOptions = filterOptions.filter((filterOption) => {
7235
+ if (filterOption.label) {
7236
+ return filterOption.label.toLowerCase().includes(_inputValue.toLowerCase());
7237
+ }
7238
+ return true;
7239
+ });
7240
+ return filterOptions;
7241
+ }
7242
+ return [];
7243
+ }
7244
+ return [];
7245
+ };
7173
7246
  return {
7174
7247
  x,
7175
7248
  y,
@@ -7179,8 +7252,6 @@ const _sfc_main$1 = defineComponent({
7179
7252
  formatFn,
7180
7253
  contrastClass,
7181
7254
  tableChange,
7182
- myColumns,
7183
- myDataSource,
7184
7255
  summaryList,
7185
7256
  loading,
7186
7257
  onTouchHrefEvent,
@@ -7188,19 +7259,32 @@ const _sfc_main$1 = defineComponent({
7188
7259
  handleHrefTarget,
7189
7260
  useRowIndex,
7190
7261
  tableColumns,
7191
- tableDataSource
7262
+ tableDataSource,
7263
+ useFilterOptions,
7264
+ useSetSelectedKeys,
7265
+ onResetFilter,
7266
+ onSearchFilterOptions
7192
7267
  };
7193
7268
  }
7194
7269
  });
7195
- const Table_vue_vue_type_style_index_0_scoped_292c12ab_lang = "";
7270
+ const Table_vue_vue_type_style_index_0_scoped_43db63c3_lang = "";
7196
7271
  const Table_vue_vue_type_style_index_1_lang = "";
7197
- const _hoisted_1$1 = { key: 0 };
7198
- const _hoisted_2 = {
7272
+ const _hoisted_1$1 = {
7273
+ class: "ecan-table-filter",
7274
+ style: { "padding": "8px" }
7275
+ };
7276
+ const _hoisted_2 = /* @__PURE__ */ createTextVNode(" \u641C\u7D22 ");
7277
+ const _hoisted_3 = /* @__PURE__ */ createTextVNode(" \u91CD\u7F6E ");
7278
+ const _hoisted_4 = { key: 0 };
7279
+ const _hoisted_5 = {
7199
7280
  key: 1,
7200
7281
  class: "action-list"
7201
7282
  };
7202
- const _hoisted_3 = ["href", "target", "onClick"];
7283
+ const _hoisted_6 = ["href", "target", "onClick"];
7203
7284
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7285
+ const _component_a_input = resolveComponent("a-input");
7286
+ const _component_a_checkbox_group = resolveComponent("a-checkbox-group");
7287
+ const _component_a_button = resolveComponent("a-button");
7204
7288
  const _component_a_table_summary_cell = resolveComponent("a-table-summary-cell");
7205
7289
  const _component_a_table_summary_row = resolveComponent("a-table-summary-row");
7206
7290
  const _component_a_table_summary = resolveComponent("a-table-summary");
@@ -7239,9 +7323,48 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7239
7323
  })
7240
7324
  }, toDisplayString(column.title), 5)
7241
7325
  ]),
7326
+ customFilterDropdown: withCtx(({ column, selectedKeys, setSelectedKeys, confirm, clearFilters }) => [
7327
+ createElementVNode("div", _hoisted_1$1, [
7328
+ createVNode(_component_a_input, {
7329
+ value: column.filterOptionsInputValue,
7330
+ "onUpdate:value": ($event) => column.filterOptionsInputValue = $event,
7331
+ placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57",
7332
+ class: "filter-input",
7333
+ onChange: _ctx.onSearchFilterOptions
7334
+ }, null, 8, ["value", "onUpdate:value", "onChange"]),
7335
+ createVNode(_component_a_checkbox_group, {
7336
+ value: column.filterCheckboxGroupValue,
7337
+ "onUpdate:value": ($event) => column.filterCheckboxGroupValue = $event,
7338
+ class: "filter-checkbox",
7339
+ options: _ctx.useFilterOptions(column),
7340
+ onChange: ($event) => _ctx.useSetSelectedKeys(setSelectedKeys, column)
7341
+ }, null, 8, ["value", "onUpdate:value", "options", "onChange"]),
7342
+ createVNode(_component_a_button, {
7343
+ type: "primary",
7344
+ size: "small",
7345
+ style: { "width": "90px", "margin-right": "8px" },
7346
+ onClick: () => confirm()
7347
+ }, {
7348
+ default: withCtx(() => [
7349
+ _hoisted_2
7350
+ ]),
7351
+ _: 2
7352
+ }, 1032, ["onClick"]),
7353
+ createVNode(_component_a_button, {
7354
+ size: "small",
7355
+ style: { "width": "90px" },
7356
+ onClick: ($event) => _ctx.onResetFilter(clearFilters)
7357
+ }, {
7358
+ default: withCtx(() => [
7359
+ _hoisted_3
7360
+ ]),
7361
+ _: 2
7362
+ }, 1032, ["onClick"])
7363
+ ])
7364
+ ]),
7242
7365
  bodyCell: withCtx(({ column, index: index2, text, record }) => [
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, [
7366
+ column.dataIndex === "SEQ" ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(index2 + 1), 1)) : createCommentVNode("", true),
7367
+ column.dataIndex === "ACTION" ? (openBlock(), createElementBlock("div", _hoisted_5, [
7245
7368
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.actionList, (action, index22) => {
7246
7369
  return openBlock(), createElementBlock("div", {
7247
7370
  class: "action",
@@ -7256,7 +7379,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7256
7379
  fontWeight: _ctx.fontWeight
7257
7380
  }),
7258
7381
  onClick: ($event) => _ctx.onTouchHrefEvent(action.target, _ctx.handleHref(action.href, record))
7259
- }, toDisplayString(action.title), 13, _hoisted_3)
7382
+ }, toDisplayString(action.title), 13, _hoisted_6)
7260
7383
  ]);
7261
7384
  }), 128))
7262
7385
  ])) : (openBlock(), createElementBlock("div", {
@@ -7310,7 +7433,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7310
7433
  }, 8, ["loading"])
7311
7434
  ], 4);
7312
7435
  }
7313
- const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-292c12ab"]]);
7436
+ const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-43db63c3"]]);
7314
7437
  const EcanTable = withInstall(Table);
7315
7438
  const mapProps = {
7316
7439
  ...props,
@@ -7476,17 +7599,19 @@ const _sfc_main = defineComponent({
7476
7599
  });
7477
7600
  const isLoadedData = ref(false);
7478
7601
  const handleRegisterMap = async () => {
7602
+ var _a2;
7479
7603
  const mapJson = props2.mapJson;
7480
- if (mapJson == null || mapJson.path == null)
7481
- return;
7482
- const res = await request(UPLOAD_PATH + mapJson.path);
7483
- registerMap("map", (res == null ? void 0 : res.data) || {});
7604
+ if (mapJson != null && mapJson.path) {
7605
+ const res = await request(((_a2 = window == null ? void 0 : window.config) == null ? void 0 : _a2.uploadPath) + mapJson.path);
7606
+ registerMap("map", (res == null ? void 0 : res.data) || {});
7607
+ }
7484
7608
  isLoadedData.value = true;
7485
7609
  };
7486
7610
  watch(() => props2.mapJson, () => {
7487
7611
  handleRegisterMap();
7488
7612
  }, {
7489
- immediate: true
7613
+ immediate: true,
7614
+ deep: true
7490
7615
  });
7491
7616
  return {
7492
7617
  option,
@@ -7497,7 +7622,7 @@ const _sfc_main = defineComponent({
7497
7622
  };
7498
7623
  }
7499
7624
  });
7500
- const Map_vue_vue_type_style_index_0_scoped_38065aba_lang = "";
7625
+ const Map_vue_vue_type_style_index_0_scoped_1eea2b3c_lang = "";
7501
7626
  const _hoisted_1 = ["src"];
7502
7627
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
7503
7628
  const _component_echarts = resolveComponent("echarts");
@@ -7519,7 +7644,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
7519
7644
  ])
7520
7645
  ], 4);
7521
7646
  }
7522
- const Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-38065aba"]]);
7647
+ const Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-1eea2b3c"]]);
7523
7648
  const EcanMap = withInstall(Map$1);
7524
7649
  const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7525
7650
  __proto__: null,