knt-shared 1.8.6 → 1.8.8

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
@@ -4244,6 +4244,21 @@ const componentsNeedSelectPlaceholder$1 = /* @__PURE__ */ new Set([
4244
4244
  "ApiCascader",
4245
4245
  "TreeSelect"
4246
4246
  ]);
4247
+ const componentsWithAllowClear = /* @__PURE__ */ new Set([
4248
+ "Input",
4249
+ "InputNumber",
4250
+ "InputPassword",
4251
+ "Textarea",
4252
+ "Select",
4253
+ "TreeSelect",
4254
+ "Cascader",
4255
+ "DatePicker",
4256
+ "TimePicker",
4257
+ "RangePicker",
4258
+ "AutoComplete",
4259
+ "ApiSelect",
4260
+ "ApiCascader"
4261
+ ]);
4247
4262
  const componentsNeedUploadPlaceholder$1 = /* @__PURE__ */ new Set([
4248
4263
  "Upload",
4249
4264
  "BasicUpload"
@@ -5144,11 +5159,14 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
5144
5159
  };
5145
5160
  const getComponentProps = (schema) => {
5146
5161
  const propsData = unref(getProps);
5162
+ const componentType = typeof schema.component === "string" ? schema.component : "";
5163
+ const defaultAllowClear = componentsWithAllowClear.has(componentType) ? { allowClear: true } : {};
5147
5164
  let disabled = propsData.disabled;
5148
5165
  if (schema.disabled !== void 0) {
5149
5166
  disabled = typeof schema.disabled === "boolean" ? schema.disabled : schema.disabled(formModel);
5150
5167
  }
5151
5168
  return {
5169
+ ...defaultAllowClear,
5152
5170
  ...resolveComponentProps(schema),
5153
5171
  disabled
5154
5172
  };
@@ -6980,6 +6998,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
6980
6998
  []
6981
6999
  );
6982
7000
  const checkedColumns = ref(storedColumns.value);
7001
+ const isColumnSettingReady = ref(false);
6983
7002
  watch(checkedColumns, (newValue) => {
6984
7003
  if (getStorageKey()) {
6985
7004
  setStoredColumns(newValue);
@@ -7244,7 +7263,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
7244
7263
  const indexColumn = {
7245
7264
  title: "序号",
7246
7265
  dataIndex: "__index__",
7247
- width: 60,
7266
+ width: 70,
7248
7267
  align: "center",
7249
7268
  fixed: "left",
7250
7269
  slotName: "__index__",
@@ -7263,7 +7282,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
7263
7282
  };
7264
7283
  columns.push(actionColumn);
7265
7284
  }
7266
- if (getToolbarConfig.value.showColumnSetting && checkedColumns.value.length > 0) {
7285
+ if (getToolbarConfig.value.showColumnSetting && isColumnSettingReady.value) {
7267
7286
  columns = columns.filter((col) => {
7268
7287
  if (col.dataIndex === "__index__" || col.dataIndex === "action") {
7269
7288
  return true;
@@ -7297,6 +7316,14 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
7297
7316
  return col.ifShow !== false && col.dataIndex;
7298
7317
  });
7299
7318
  });
7319
+ watch(settingColumns, (newCols) => {
7320
+ if (!isColumnSettingReady.value) return;
7321
+ const currentKeys = new Set(checkedColumns.value);
7322
+ const newKeys = newCols.filter((col) => col.dataIndex && !currentKeys.has(col.dataIndex)).map((col) => col.dataIndex);
7323
+ if (newKeys.length > 0) {
7324
+ checkedColumns.value = [...checkedColumns.value, ...newKeys];
7325
+ }
7326
+ });
7300
7327
  const getBindValues = computed(() => {
7301
7328
  const mergedProps = getMergedProps.value;
7302
7329
  const {
@@ -7720,6 +7747,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
7720
7747
  } else {
7721
7748
  checkedColumns.value = settingColumns.value.filter((col) => !col.defaultHidden).map((col) => col.dataIndex);
7722
7749
  }
7750
+ isColumnSettingReady.value = true;
7723
7751
  };
7724
7752
  const getDataSource = () => dataSource.value;
7725
7753
  const setDataSource = async (data) => {
@@ -8334,7 +8362,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
8334
8362
  };
8335
8363
  }
8336
8364
  });
8337
- const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-84dbe67a"]]);
8365
+ const BasicTable = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-f752ab5b"]]);
8338
8366
  function useTable(options = {}) {
8339
8367
  const tableRef = ref(null);
8340
8368
  const formRef = ref(null);