knt-shared 1.8.6 → 1.8.7

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.esm.js CHANGED
@@ -6980,6 +6980,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
6980
6980
  []
6981
6981
  );
6982
6982
  const checkedColumns = ref(storedColumns.value);
6983
+ const isColumnSettingReady = ref(false);
6983
6984
  watch(checkedColumns, (newValue) => {
6984
6985
  if (getStorageKey()) {
6985
6986
  setStoredColumns(newValue);
@@ -7244,7 +7245,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
7244
7245
  const indexColumn = {
7245
7246
  title: "序号",
7246
7247
  dataIndex: "__index__",
7247
- width: 60,
7248
+ width: 70,
7248
7249
  align: "center",
7249
7250
  fixed: "left",
7250
7251
  slotName: "__index__",
@@ -7263,7 +7264,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
7263
7264
  };
7264
7265
  columns.push(actionColumn);
7265
7266
  }
7266
- if (getToolbarConfig.value.showColumnSetting && checkedColumns.value.length > 0) {
7267
+ if (getToolbarConfig.value.showColumnSetting && isColumnSettingReady.value) {
7267
7268
  columns = columns.filter((col) => {
7268
7269
  if (col.dataIndex === "__index__" || col.dataIndex === "action") {
7269
7270
  return true;
@@ -7297,6 +7298,14 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
7297
7298
  return col.ifShow !== false && col.dataIndex;
7298
7299
  });
7299
7300
  });
7301
+ watch(settingColumns, (newCols) => {
7302
+ if (!isColumnSettingReady.value) return;
7303
+ const currentKeys = new Set(checkedColumns.value);
7304
+ const newKeys = newCols.filter((col) => col.dataIndex && !currentKeys.has(col.dataIndex)).map((col) => col.dataIndex);
7305
+ if (newKeys.length > 0) {
7306
+ checkedColumns.value = [...checkedColumns.value, ...newKeys];
7307
+ }
7308
+ });
7300
7309
  const getBindValues = computed(() => {
7301
7310
  const mergedProps = getMergedProps.value;
7302
7311
  const {
@@ -7720,6 +7729,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
7720
7729
  } else {
7721
7730
  checkedColumns.value = settingColumns.value.filter((col) => !col.defaultHidden).map((col) => col.dataIndex);
7722
7731
  }
7732
+ isColumnSettingReady.value = true;
7723
7733
  };
7724
7734
  const getDataSource = () => dataSource.value;
7725
7735
  const setDataSource = async (data) => {
@@ -8334,7 +8344,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8334
8344
  };
8335
8345
  }
8336
8346
  });
8337
- const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-84dbe67a"]]);
8347
+ const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-f752ab5b"]]);
8338
8348
  function useTable(options = {}) {
8339
8349
  const tableRef = ref(null);
8340
8350
  const formRef = ref(null);