@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.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @ecan-bi/datav@1.1.3 */
1
+ /*! @ecan-bi/datav@1.1.5 */
2
2
  (function(global, factory) {
3
3
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("echarts/core"), require("resize-detector"), require("ant-design-vue"), require("ant-design-vue/es/spin/style"), require("ant-design-vue/es/skeleton/style"), require("lodash-es"), require("axios"), require("mitt"), require("dayjs"), require("ant-design-vue/es/progress/style"), require("ant-design-vue/es/input/style"), require("ant-design-vue/es/date-picker/style"), require("ant-design-vue/es/date-picker/locale/zh_CN"), require("ant-design-vue/es/select/style"), require("ant-design-vue/es/button/style"), require("ant-design-vue/es/checkbox/style"), require("echarts/renderers"), require("echarts/charts"), require("echarts/components"), require("echarts"), require("ant-design-vue/es/modal/style"), require("ant-design-vue/es/table/style")) : typeof define === "function" && define.amd ? define(["exports", "vue", "echarts/core", "resize-detector", "ant-design-vue", "ant-design-vue/es/spin/style", "ant-design-vue/es/skeleton/style", "lodash-es", "axios", "mitt", "dayjs", "ant-design-vue/es/progress/style", "ant-design-vue/es/input/style", "ant-design-vue/es/date-picker/style", "ant-design-vue/es/date-picker/locale/zh_CN", "ant-design-vue/es/select/style", "ant-design-vue/es/button/style", "ant-design-vue/es/checkbox/style", "echarts/renderers", "echarts/charts", "echarts/components", "echarts", "ant-design-vue/es/modal/style", "ant-design-vue/es/table/style"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@ecan/bi-datav"] = {}, global.vue, global["echarts/core"], global["resize-detector"], global["ant-design-vue"], null, null, global["lodash-es"], global.axios, global.mitt, global.dayjs, null, null, null, global["ant-design-vue/es/date-picker/locale/zh_CN"], null, null, null, global["echarts/renderers"], global["echarts/charts"], global["echarts/components"], global.echarts));
4
4
  })(this, function(exports2, vue, core, resizeDetector, antDesignVue, style$1, style$2, lodashEs, axios, mitt, dayjs, style$3, style$4, style$5, locale, style$6, style$7, style$8, renderers, charts, components$1, echarts) {
@@ -1560,7 +1560,7 @@
1560
1560
  const GLOBAL_TOKEN = "GLOBAL_TOKEN";
1561
1561
  const REFRESH_PAGE = "REFRESH_PAGE";
1562
1562
  const INDICATOR_URL = (_a = window == null ? void 0 : window.config) == null ? void 0 : _a.indicatorURL;
1563
- const UPLOAD_PATH = ((_b = window == null ? void 0 : window.config) == null ? void 0 : _b.uploadPath) || "/api";
1563
+ ((_b = window == null ? void 0 : window.config) == null ? void 0 : _b.uploadPath) || "/api";
1564
1564
  const BASE_URL = ((_c = window == null ? void 0 : window.config) == null ? void 0 : _c.routerBaseURL) || "./";
1565
1565
  const ERD_URL = ((_d = window == null ? void 0 : window.config) == null ? void 0 : _d.erdURL) || "";
1566
1566
  const useOnEvent = (props2, events) => {
@@ -1841,13 +1841,14 @@
1841
1841
  };
1842
1842
  };
1843
1843
  const useImagePath = (path, isFormat = false) => {
1844
+ var _a2;
1844
1845
  if (!path)
1845
1846
  return path;
1846
1847
  let imagePath = "";
1847
1848
  if (path == null ? void 0 : path.includes("://")) {
1848
1849
  imagePath = path;
1849
1850
  } else {
1850
- imagePath = UPLOAD_PATH + path;
1851
+ imagePath = ((_a2 = window == null ? void 0 : window.config) == null ? void 0 : _a2.uploadPath) + path;
1851
1852
  }
1852
1853
  if (isFormat) {
1853
1854
  imagePath = `url(${imagePath})`;
@@ -3165,12 +3166,12 @@
3165
3166
  key: 1,
3166
3167
  class: "ecan-list-content"
3167
3168
  };
3168
- const _hoisted_4$1 = {
3169
+ const _hoisted_4$2 = {
3169
3170
  key: 0,
3170
3171
  class: "ranking"
3171
3172
  };
3172
- const _hoisted_5$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "icon" }, null, -1));
3173
- const _hoisted_6$1 = { class: "sort" };
3173
+ const _hoisted_5$2 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "icon" }, null, -1));
3174
+ const _hoisted_6$2 = { class: "sort" };
3174
3175
  const _hoisted_7$1 = {
3175
3176
  key: 2,
3176
3177
  class: "empty"
@@ -3230,9 +3231,9 @@
3230
3231
  key: item.id || i,
3231
3232
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.click && _ctx.click(...args))
3232
3233
  }, [
3233
- _ctx.useRanking ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, [
3234
- _hoisted_5$1,
3235
- vue.createElementVNode("div", _hoisted_6$1, " Top " + vue.toDisplayString(i + 1), 1)
3234
+ _ctx.useRanking ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$2, [
3235
+ _hoisted_5$2,
3236
+ vue.createElementVNode("div", _hoisted_6$2, " Top " + vue.toDisplayString(i + 1), 1)
3236
3237
  ])) : vue.createCommentVNode("", true),
3237
3238
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.columns, (column) => {
3238
3239
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -6225,9 +6226,9 @@
6225
6226
  const _hoisted_1$5 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "top-left border-item" }, null, -1));
6226
6227
  const _hoisted_2$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "top-right border-item" }, null, -1));
6227
6228
  const _hoisted_3$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "bottom-left border-item" }, null, -1));
6228
- const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "bottom-right border-item" }, null, -1));
6229
- const _hoisted_5 = { class: "title-item-wrapper" };
6230
- const _hoisted_6 = { class: "title-item" };
6229
+ const _hoisted_4$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("div", { class: "bottom-right border-item" }, null, -1));
6230
+ const _hoisted_5$1 = { class: "title-item-wrapper" };
6231
+ const _hoisted_6$1 = { class: "title-item" };
6231
6232
  const _hoisted_7 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("img", {
6232
6233
  class: "title-decoration-left",
6233
6234
  src: _imports_0
@@ -6261,7 +6262,7 @@
6261
6262
  _hoisted_1$5,
6262
6263
  _hoisted_2$1,
6263
6264
  _hoisted_3$1,
6264
- _hoisted_4
6265
+ _hoisted_4$1
6265
6266
  ], 64)) : vue.createCommentVNode("", true)
6266
6267
  ], 4)) : vue.createCommentVNode("", true),
6267
6268
  _ctx.mode === "top-title" ? (vue.openBlock(), vue.createElementBlock("div", {
@@ -6269,8 +6270,8 @@
6269
6270
  class: "top-title",
6270
6271
  style: vue.normalizeStyle(_ctx.borderStyle)
6271
6272
  }, [
6272
- vue.createElementVNode("div", _hoisted_5, [
6273
- vue.createElementVNode("div", _hoisted_6, [
6273
+ vue.createElementVNode("div", _hoisted_5$1, [
6274
+ vue.createElementVNode("div", _hoisted_6$1, [
6274
6275
  _hoisted_7,
6275
6276
  vue.createElementVNode("div", _hoisted_8, vue.toDisplayString(_ctx.title), 1),
6276
6277
  _hoisted_9
@@ -6785,6 +6786,8 @@
6785
6786
  name: "EcanTable",
6786
6787
  components: {
6787
6788
  Skeleton,
6789
+ AInput: antDesignVue.Input,
6790
+ ACheckboxGroup: antDesignVue.CheckboxGroup,
6788
6791
  ATable: antDesignVue.Table,
6789
6792
  ATableSummary: antDesignVue.TableSummary,
6790
6793
  ATableSummaryRow: antDesignVue.TableSummaryRow,
@@ -6825,6 +6828,7 @@
6825
6828
  const total = vue.ref(0);
6826
6829
  const pageNum = vue.ref(1);
6827
6830
  const pageSize = vue.computed(() => props2.paginationPageSize);
6831
+ const filterDataIndexList = vue.reactive([]);
6828
6832
  const handleChildrenColumns = (_columns = []) => {
6829
6833
  if (Array.isArray(_columns) && _columns.length > 0) {
6830
6834
  const len = _columns.length;
@@ -6840,8 +6844,16 @@
6840
6844
  cellAlign = "center",
6841
6845
  cellColor,
6842
6846
  dataIndex,
6843
- title
6847
+ title,
6848
+ tableFilter
6844
6849
  } = column;
6850
+ if (tableFilter) {
6851
+ filterDataIndexList.push(dataIndex);
6852
+ column.filterOptionsInputValue = "";
6853
+ column.filterCheckboxGroupValue = [];
6854
+ column.customFilterDropdown = true;
6855
+ column.onFilter = (value, record) => record[dataIndex].toString().toLowerCase().includes(value.toLowerCase());
6856
+ }
6845
6857
  column.customCell = (record, rowIndex) => ({
6846
6858
  style: {
6847
6859
  textAlign: cellAlign,
@@ -6908,14 +6920,48 @@
6908
6920
  }, {
6909
6921
  immediate: true
6910
6922
  });
6923
+ const allFilterOptions = vue.ref({});
6924
+ const handleFilterCheckboxOptions = (dataSource) => {
6925
+ if (Array.isArray(dataSource)) {
6926
+ const dataLen = dataSource.length;
6927
+ const keys = filterDataIndexList;
6928
+ const keysLen = keys.length;
6929
+ const filterOptionsMap = {};
6930
+ for (let i = 0; i < dataLen; i++) {
6931
+ const record = dataSource[i];
6932
+ for (let j = 0; j < keysLen; j++) {
6933
+ const key = keys[j];
6934
+ if (filterOptionsMap[key]) {
6935
+ filterOptionsMap[key].add(record[key]);
6936
+ } else {
6937
+ const set = /* @__PURE__ */ new Set();
6938
+ set.add(record[key]);
6939
+ filterOptionsMap[key] = set;
6940
+ }
6941
+ }
6942
+ }
6943
+ const _allFilterOptions = {};
6944
+ for (const key in filterOptionsMap) {
6945
+ if (Object.prototype.hasOwnProperty.call(filterOptionsMap, key)) {
6946
+ const optionsSet = filterOptionsMap[key];
6947
+ const options = Array.from(optionsSet);
6948
+ _allFilterOptions[key] = options.map((option) => ({ label: option, value: option }));
6949
+ }
6950
+ }
6951
+ allFilterOptions.value = _allFilterOptions;
6952
+ }
6953
+ };
6911
6954
  vue.watch(() => [props2.isReverse, myColumns.value, myDataSource.value], () => {
6955
+ const _columns = vue.unref(myColumns);
6956
+ const _dataSource = vue.unref(myDataSource);
6957
+ handleFilterCheckboxOptions(_dataSource);
6912
6958
  if (props2.isReverse) {
6913
- const { columns, dataSource } = handleReverseTable(lodashEs.cloneDeep(vue.unref(myColumns)), lodashEs.cloneDeep(vue.unref(myDataSource)));
6959
+ const { columns, dataSource } = handleReverseTable(lodashEs.cloneDeep(_columns), lodashEs.cloneDeep(_dataSource));
6914
6960
  tableColumns.value = columns;
6915
6961
  tableDataSource.value = dataSource;
6916
6962
  } else {
6917
- tableColumns.value = vue.unref(myColumns);
6918
- tableDataSource.value = vue.unref(myDataSource);
6963
+ tableColumns.value = _columns;
6964
+ tableDataSource.value = _dataSource;
6919
6965
  }
6920
6966
  }, {
6921
6967
  immediate: true,
@@ -7054,8 +7100,7 @@
7054
7100
  });
7055
7101
  const handleIndicatorDataset = (dataColumns = [], dataRows = []) => {
7056
7102
  const _columns = dataColumns.map((column) => ({ title: column, dataIndex: column, key: column }));
7057
- const columns = handleColumns(_columns);
7058
- myColumns.value = columns;
7103
+ myColumns.value = handleColumns(_columns);
7059
7104
  myDataSource.value = dataRows;
7060
7105
  };
7061
7106
  const indicatorData = useIndicatorData(props2);
@@ -7175,6 +7220,34 @@
7175
7220
  }, "*");
7176
7221
  }
7177
7222
  };
7223
+ const useSetSelectedKeys = (setSelectedKeys, column) => {
7224
+ setSelectedKeys(column.filterCheckboxGroupValue);
7225
+ };
7226
+ const onResetFilter = (clearFilters, column) => {
7227
+ clearFilters({ confirm: true });
7228
+ column.filterOptionsInputValue = "";
7229
+ column.filterCheckboxGroupValue = [];
7230
+ };
7231
+ const onSearchFilterOptions = () => {
7232
+ };
7233
+ const useFilterOptions = (column) => {
7234
+ const key = column.dataIndex;
7235
+ if (typeof key === "string") {
7236
+ let filterOptions = vue.unref(allFilterOptions)[key];
7237
+ const _inputValue = vue.unref(column.filterOptionsInputValue).trim();
7238
+ if (Array.isArray(filterOptions)) {
7239
+ filterOptions = filterOptions.filter((filterOption) => {
7240
+ if (filterOption.label) {
7241
+ return filterOption.label.toLowerCase().includes(_inputValue.toLowerCase());
7242
+ }
7243
+ return true;
7244
+ });
7245
+ return filterOptions;
7246
+ }
7247
+ return [];
7248
+ }
7249
+ return [];
7250
+ };
7178
7251
  return {
7179
7252
  x,
7180
7253
  y,
@@ -7184,8 +7257,6 @@
7184
7257
  formatFn,
7185
7258
  contrastClass,
7186
7259
  tableChange,
7187
- myColumns,
7188
- myDataSource,
7189
7260
  summaryList,
7190
7261
  loading,
7191
7262
  onTouchHrefEvent,
@@ -7193,19 +7264,32 @@
7193
7264
  handleHrefTarget,
7194
7265
  useRowIndex,
7195
7266
  tableColumns,
7196
- tableDataSource
7267
+ tableDataSource,
7268
+ useFilterOptions,
7269
+ useSetSelectedKeys,
7270
+ onResetFilter,
7271
+ onSearchFilterOptions
7197
7272
  };
7198
7273
  }
7199
7274
  });
7200
- const Table_vue_vue_type_style_index_0_scoped_292c12ab_lang = "";
7275
+ const Table_vue_vue_type_style_index_0_scoped_43db63c3_lang = "";
7201
7276
  const Table_vue_vue_type_style_index_1_lang = "";
7202
- const _hoisted_1$1 = { key: 0 };
7203
- const _hoisted_2 = {
7277
+ const _hoisted_1$1 = {
7278
+ class: "ecan-table-filter",
7279
+ style: { "padding": "8px" }
7280
+ };
7281
+ const _hoisted_2 = /* @__PURE__ */ vue.createTextVNode(" \u641C\u7D22 ");
7282
+ const _hoisted_3 = /* @__PURE__ */ vue.createTextVNode(" \u91CD\u7F6E ");
7283
+ const _hoisted_4 = { key: 0 };
7284
+ const _hoisted_5 = {
7204
7285
  key: 1,
7205
7286
  class: "action-list"
7206
7287
  };
7207
- const _hoisted_3 = ["href", "target", "onClick"];
7288
+ const _hoisted_6 = ["href", "target", "onClick"];
7208
7289
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
7290
+ const _component_a_input = vue.resolveComponent("a-input");
7291
+ const _component_a_checkbox_group = vue.resolveComponent("a-checkbox-group");
7292
+ const _component_a_button = vue.resolveComponent("a-button");
7209
7293
  const _component_a_table_summary_cell = vue.resolveComponent("a-table-summary-cell");
7210
7294
  const _component_a_table_summary_row = vue.resolveComponent("a-table-summary-row");
7211
7295
  const _component_a_table_summary = vue.resolveComponent("a-table-summary");
@@ -7244,9 +7328,48 @@
7244
7328
  })
7245
7329
  }, vue.toDisplayString(column.title), 5)
7246
7330
  ]),
7331
+ customFilterDropdown: vue.withCtx(({ column, selectedKeys, setSelectedKeys, confirm, clearFilters }) => [
7332
+ vue.createElementVNode("div", _hoisted_1$1, [
7333
+ vue.createVNode(_component_a_input, {
7334
+ value: column.filterOptionsInputValue,
7335
+ "onUpdate:value": ($event) => column.filterOptionsInputValue = $event,
7336
+ placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57",
7337
+ class: "filter-input",
7338
+ onChange: _ctx.onSearchFilterOptions
7339
+ }, null, 8, ["value", "onUpdate:value", "onChange"]),
7340
+ vue.createVNode(_component_a_checkbox_group, {
7341
+ value: column.filterCheckboxGroupValue,
7342
+ "onUpdate:value": ($event) => column.filterCheckboxGroupValue = $event,
7343
+ class: "filter-checkbox",
7344
+ options: _ctx.useFilterOptions(column),
7345
+ onChange: ($event) => _ctx.useSetSelectedKeys(setSelectedKeys, column)
7346
+ }, null, 8, ["value", "onUpdate:value", "options", "onChange"]),
7347
+ vue.createVNode(_component_a_button, {
7348
+ type: "primary",
7349
+ size: "small",
7350
+ style: { "width": "90px", "margin-right": "8px" },
7351
+ onClick: () => confirm()
7352
+ }, {
7353
+ default: vue.withCtx(() => [
7354
+ _hoisted_2
7355
+ ]),
7356
+ _: 2
7357
+ }, 1032, ["onClick"]),
7358
+ vue.createVNode(_component_a_button, {
7359
+ size: "small",
7360
+ style: { "width": "90px" },
7361
+ onClick: ($event) => _ctx.onResetFilter(clearFilters)
7362
+ }, {
7363
+ default: vue.withCtx(() => [
7364
+ _hoisted_3
7365
+ ]),
7366
+ _: 2
7367
+ }, 1032, ["onClick"])
7368
+ ])
7369
+ ]),
7247
7370
  bodyCell: vue.withCtx(({ column, index: index2, text, record }) => [
7248
- column.dataIndex === "SEQ" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$1, vue.toDisplayString(index2 + 1), 1)) : vue.createCommentVNode("", true),
7249
- column.dataIndex === "ACTION" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
7371
+ column.dataIndex === "SEQ" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4, vue.toDisplayString(index2 + 1), 1)) : vue.createCommentVNode("", true),
7372
+ column.dataIndex === "ACTION" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
7250
7373
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.actionList, (action, index22) => {
7251
7374
  return vue.openBlock(), vue.createElementBlock("div", {
7252
7375
  class: "action",
@@ -7261,7 +7384,7 @@
7261
7384
  fontWeight: _ctx.fontWeight
7262
7385
  }),
7263
7386
  onClick: ($event) => _ctx.onTouchHrefEvent(action.target, _ctx.handleHref(action.href, record))
7264
- }, vue.toDisplayString(action.title), 13, _hoisted_3)
7387
+ }, vue.toDisplayString(action.title), 13, _hoisted_6)
7265
7388
  ]);
7266
7389
  }), 128))
7267
7390
  ])) : (vue.openBlock(), vue.createElementBlock("div", {
@@ -7315,7 +7438,7 @@
7315
7438
  }, 8, ["loading"])
7316
7439
  ], 4);
7317
7440
  }
7318
- const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-292c12ab"]]);
7441
+ const Table = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-43db63c3"]]);
7319
7442
  const EcanTable = withInstall(Table);
7320
7443
  const mapProps = {
7321
7444
  ...props,
@@ -7481,17 +7604,19 @@
7481
7604
  });
7482
7605
  const isLoadedData = vue.ref(false);
7483
7606
  const handleRegisterMap = async () => {
7607
+ var _a2;
7484
7608
  const mapJson = props2.mapJson;
7485
- if (mapJson == null || mapJson.path == null)
7486
- return;
7487
- const res = await request(UPLOAD_PATH + mapJson.path);
7488
- core.registerMap("map", (res == null ? void 0 : res.data) || {});
7609
+ if (mapJson != null && mapJson.path) {
7610
+ const res = await request(((_a2 = window == null ? void 0 : window.config) == null ? void 0 : _a2.uploadPath) + mapJson.path);
7611
+ core.registerMap("map", (res == null ? void 0 : res.data) || {});
7612
+ }
7489
7613
  isLoadedData.value = true;
7490
7614
  };
7491
7615
  vue.watch(() => props2.mapJson, () => {
7492
7616
  handleRegisterMap();
7493
7617
  }, {
7494
- immediate: true
7618
+ immediate: true,
7619
+ deep: true
7495
7620
  });
7496
7621
  return {
7497
7622
  option,
@@ -7502,7 +7627,7 @@
7502
7627
  };
7503
7628
  }
7504
7629
  });
7505
- const Map_vue_vue_type_style_index_0_scoped_38065aba_lang = "";
7630
+ const Map_vue_vue_type_style_index_0_scoped_1eea2b3c_lang = "";
7506
7631
  const _hoisted_1 = ["src"];
7507
7632
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
7508
7633
  const _component_echarts = vue.resolveComponent("echarts");
@@ -7524,7 +7649,7 @@
7524
7649
  ])
7525
7650
  ], 4);
7526
7651
  }
7527
- const Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-38065aba"]]);
7652
+ const Map$1 = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-1eea2b3c"]]);
7528
7653
  const EcanMap = withInstall(Map$1);
7529
7654
  const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
7530
7655
  __proto__: null,