@weitutech/by-components-v3 1.0.7 → 1.0.81

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/README.md CHANGED
@@ -27,21 +27,29 @@ npm config set registry https://registry.npmjs.org/
27
27
 
28
28
 
29
29
  出现功能修改后,需更新package的版本号
30
+
30
31
  清除缓存
31
32
  npm cache clean --force
33
+
34
+ 发布之前一定要打包npm run build 在进行发布
35
+
32
36
  发布
33
37
  npm publish --access public
34
38
  ```
35
39
 
36
40
  ### 注意事项
37
41
 
38
- 1. 本地开发时可采用 npm link 方式关联依赖,package 入口配置为 src/main.js
42
+ #### 本地开发时可采用
43
+
44
+ 1. 书写在scr/App.vue中、在打包测试使用npm link方式
45
+ 2. npm link 方式关联依赖,package 入口配置为 src/main.js
39
46
 
40
47
  ### npm link
41
48
 
42
49
  ```
43
50
  组件库中运行 npm link
44
51
  项目中运行 npm link @weitutech/by-components-v3
52
+ 然后组件库运行打包命令
45
53
  ```
46
54
 
47
55
  ### 关于新组件开发
@@ -244,6 +252,7 @@ const handleQueryClick = () => {}
244
252
  <template>
245
253
  <by-table
246
254
  ref="BTableRef"
255
+ name="table"
247
256
  :grid-options="gridOptions"
248
257
  @checkbox-change="({records}) => handleCheckboxChange(records)"
249
258
  @checkbox-all="({records}) => handleCheckboxChange(records)"
@@ -350,7 +359,6 @@ const handlePageChange = ({ page, limit }) => {
350
359
  <by-table
351
360
  :grid-options="gridOptions"
352
361
  @setColumn="handleSetColumn"
353
- @setGroupColumn="handleSetColumn"
354
362
  >
355
363
  </by-table>
356
364
  </template>
@@ -383,7 +391,6 @@ const gridOptions = ref({
383
391
  ],
384
392
  })
385
393
  // setColumn 返回只有一级的表头
386
- // setGroupColumn 返回多级表头数据
387
394
  const handleSetColumn = (columns) => {
388
395
  this.gridOptions.columns = [
389
396
  { type: "checkbox", width: 50, fixed: "left" },
@@ -36705,7 +36705,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36705
36705
  }
36706
36706
  });
36707
36707
  const CustomColumn = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__scopeId", "data-v-4a62d7dd"]]);
36708
- const events = ["keydown", "current-change", "radio-change", "checkbox-change", "checkbox-all", "checkbox-range-start", "checkbox-range-change", "checkbox-range-end", "cell-dblclick", "cell-menu", "cell-mouseenter", "cell-mouseleave", "cell-delete-value", "header-cell-click", "header-cell-dblclick", "header-cell-menu", "footer-cell-click", "footer-cell-dblclick", "footer-cell-menu", "clear-merge", "sort-change", "clear-sort", "filter-visible", "filter-change", "clear-filter", "resizable-change", "toggle-row-expand", "toggle-tree-expand", "menu-click", "cell-selected", "edit-closed", "edit-activated", "edit-disabled", "valid-error", "scroll", "custom", "page-change", "form-submit", "form-submit-invalid", "form-reset", "form-collapse", "proxy-query", "proxy-delete", "proxy-save", "toolbar-button-click", "toolbar-tool-click", "zoom", "cell-click"];
36708
+ const events = ["keydown", "current-change", "radio-change", "checkbox-change", "checkbox-all", "checkbox-range-start", "checkbox-range-change", "checkbox-range-end", "cell-dblclick", "cell-menu", "cell-mouseenter", "cell-mouseleave", "cell-delete-value", "header-cell-click", "header-cell-dblclick", "header-cell-menu", "footer-cell-click", "footer-cell-dblclick", "footer-cell-menu", "clear-merge", "sort-change", "clear-sort", "filter-visible", "filter-change", "clear-filter", "toggle-row-expand", "toggle-tree-expand", "menu-click", "cell-selected", "edit-closed", "edit-activated", "edit-disabled", "valid-error", "scroll", "custom", "page-change", "form-submit", "form-submit-invalid", "form-reset", "form-collapse", "proxy-query", "proxy-delete", "proxy-save", "toolbar-button-click", "toolbar-tool-click", "zoom", "cell-click"];
36709
36709
  const capitalizeFirstLetter = (str) => {
36710
36710
  return str.charAt(0).toUpperCase() + str.slice(1);
36711
36711
  };
@@ -36714,6 +36714,10 @@ const ByTable = /* @__PURE__ */ defineComponent({
36714
36714
  gridOptions: {
36715
36715
  type: Object,
36716
36716
  required: true
36717
+ },
36718
+ name: {
36719
+ type: String,
36720
+ default: ""
36717
36721
  }
36718
36722
  },
36719
36723
  emits: ["pageChange", "setColumns", "setGroupColumn", ...events],
@@ -36726,8 +36730,15 @@ const ByTable = /* @__PURE__ */ defineComponent({
36726
36730
  const {
36727
36731
  customColumnConfig,
36728
36732
  pagerConfig,
36733
+ columns,
36729
36734
  ...others
36730
36735
  } = props.gridOptions;
36736
+ const cols = JSON.parse(localStorage.getItem(props.name)) || void 0;
36737
+ if (cols && props.name) {
36738
+ columns.forEach((item) => {
36739
+ item.width = (cols.find((col) => col.field === item.field) || {}).width || void 0;
36740
+ });
36741
+ }
36731
36742
  return {
36732
36743
  border: true,
36733
36744
  showOverflow: true,
@@ -36739,6 +36750,7 @@ const ByTable = /* @__PURE__ */ defineComponent({
36739
36750
  loadingConfig: {
36740
36751
  text: "加载中..."
36741
36752
  },
36753
+ columns,
36742
36754
  ...others,
36743
36755
  columnConfig: {
36744
36756
  resizable: true
@@ -36789,6 +36801,17 @@ const ByTable = /* @__PURE__ */ defineComponent({
36789
36801
  }
36790
36802
  emit("cell-click", context);
36791
36803
  };
36804
+ const handleResizableChange = (context) => {
36805
+ emit("resizable-change", context);
36806
+ if (!props.name) return;
36807
+ const collectColumn = context.$table.getTableColumn().collectColumn;
36808
+ console.log(collectColumn, "collectColumn");
36809
+ const clos = collectColumn.map((col) => ({
36810
+ field: col.field,
36811
+ width: col.renderWidth
36812
+ }));
36813
+ localStorage.setItem(props.name, JSON.stringify(clos));
36814
+ };
36792
36815
  const handleOpenCustomColumn = () => {
36793
36816
  console.log(CustomColumnRef.value.dialogVisible, "CustomColumnRef.value.dialogVisible");
36794
36817
  CustomColumnRef.value.dialogVisible = true;
@@ -36882,7 +36905,8 @@ const ByTable = /* @__PURE__ */ defineComponent({
36882
36905
  return createVNode("div", {
36883
36906
  "class": "VxeGridWrap"
36884
36907
  }, [createVNode(VxeGrid, mergeProps(defaultOptions.value, listeners.value, {
36885
- "onCellClick": handleCellClick
36908
+ "onCellClick": handleCellClick,
36909
+ "onResizableChange": handleResizableChange
36886
36910
  }), {
36887
36911
  ...Slots
36888
36912
  }), props.gridOptions.customColumnConfig && props.gridOptions.customColumnConfig.showCustomColumn ? createVNode(CustomColumn, {