@dt-frames/ui 1.0.43 → 1.0.45

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.
@@ -28,8 +28,8 @@
28
28
  "MULTIFY": "Batch",
29
29
  "DELETE_SUCCESS": "Successfully Deleted!",
30
30
  "COLUMN_CONTROL": "Column Control",
31
- "COLUMN_SHOW": "Column Display",
32
- "INDEX": "Serial Number",
31
+ "COLUMN_SHOW": "All",
32
+ "INDEX": "Index",
33
33
  "CHECKBOX": "Checkbox",
34
34
  "FIXED_TO_LEFT": "Fixed to the Left",
35
35
  "FIXED_TO_RIGHT": "Fixed to the Right",
@@ -473,7 +473,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
473
473
  instance: import("vue").ComponentInternalInstance;
474
474
  handleHeightChange: (height: string) => void;
475
475
  handleExtHeight: (height: number) => void;
476
- getWidth: (width: any) => string;
477
476
  setModalProps: (props: Partial<import("@dt-frames/core").ModalProps>) => void;
478
477
  handleSave: () => void;
479
478
  handleCancel: (e?: Event) => Promise<void>;
@@ -6,7 +6,7 @@ export declare function useCurd(curdOpt: CrudOptType): {
6
6
  }>;
7
7
  add: () => void;
8
8
  del: ({ row }: Recordable) => void;
9
- dels: (ids: string[], cb: Function) => void;
9
+ dels: (ids?: string[]) => void;
10
10
  update: ({ row }: Recordable) => void;
11
11
  closeModal: () => void;
12
12
  openModal: (data?: {
@@ -1877,7 +1877,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
1877
1877
  instance: import("vue").ComponentInternalInstance;
1878
1878
  handleHeightChange: (height: string) => void;
1879
1879
  handleExtHeight: (height: number) => void;
1880
- getWidth: (width: any) => string;
1881
1880
  setModalProps: (props: Partial<import("@dt-frames/core").ModalProps>) => void;
1882
1881
  handleSave: () => void;
1883
1882
  handleCancel: (e?: Event) => Promise<void>;
@@ -205,7 +205,6 @@ declare const _sfc_main: import("vue").DefineComponent<{
205
205
  instance: import("vue").ComponentInternalInstance;
206
206
  handleHeightChange: (height: string) => void;
207
207
  handleExtHeight: (height: number) => void;
208
- getWidth: (width: any) => string;
209
208
  setModalProps: (props: Partial<ModalProps>) => void;
210
209
  handleSave: () => void;
211
210
  handleCancel: (e?: Event) => Promise<void>;
@@ -21,6 +21,7 @@ export declare type ApiObjType = {
21
21
  export declare type SourceType = {
22
22
  baseUrl?: string;
23
23
  exportName?: string | ComputedRef;
24
+ clearKeys?: Function;
24
25
  api: ApiObjType;
25
26
  };
26
27
  export declare type BaseDataType = {
@@ -2101,7 +2101,6 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
2101
2101
  instance: import("vue").ComponentInternalInstance;
2102
2102
  handleHeightChange: (height: string) => void;
2103
2103
  handleExtHeight: (height: number) => void;
2104
- getWidth: (width: any) => string;
2105
2104
  setModalProps: (props: Partial<import("@dt-frames/core").ModalProps>) => void;
2106
2105
  handleSave: () => void;
2107
2106
  handleCancel: (e?: Event) => Promise<void>;
@@ -944,7 +944,6 @@ declare const _sfc_main: import("vue").DefineComponent<{}, {
944
944
  instance: import("vue").ComponentInternalInstance;
945
945
  handleHeightChange: (height: string) => void;
946
946
  handleExtHeight: (height: number) => void;
947
- getWidth: (width: any) => string;
948
947
  setModalProps: (props: Partial<import("@dt-frames/core").ModalProps>) => void;
949
948
  handleSave: () => void;
950
949
  handleCancel: (e?: Event) => Promise<void>;
package/es/index.js CHANGED
@@ -4426,28 +4426,8 @@ const _sfc_main$K = /* @__PURE__ */ defineComponent({
4426
4426
  function handleExtHeight(height) {
4427
4427
  extHeightRef.value = height;
4428
4428
  }
4429
- function getWidth(width) {
4430
- let w = document.body.offsetWidth;
4431
- let _ow = parseInt(width);
4432
- if (w > 1800) {
4433
- _ow = _ow * 0.8;
4434
- } else if (w > 1600) {
4435
- _ow = _ow * 0.9;
4436
- } else if (w < 1300) {
4437
- _ow = _ow * 1.2;
4438
- } else if (w < 1400) {
4439
- _ow = _ow * 1.1;
4440
- }
4441
- return `${_ow}%`;
4442
- }
4443
4429
  function setModalProps(props2) {
4444
- let _props = {
4445
- ...props2,
4446
- ...{
4447
- width: getWidth(props2.width)
4448
- }
4449
- };
4450
- propsRef.value = deepMerge(unref(propsRef) || {}, _props);
4430
+ propsRef.value = deepMerge(unref(propsRef) || {}, props2);
4451
4431
  if (Reflect.has(props2, "visible")) {
4452
4432
  visibleRef.value = !!props2.visible;
4453
4433
  }
@@ -5156,7 +5136,6 @@ function useDataSource(propsRef, {
5156
5136
  }, false);
5157
5137
  function updateTableDataRecord(rowKey, record) {
5158
5138
  const row = findTableDataRecord(rowKey);
5159
- console.log(row, record);
5160
5139
  if (row) {
5161
5140
  for (const field in record) {
5162
5141
  row[field] = record[field];
@@ -5290,7 +5269,7 @@ var _sfc_main$I = defineComponent({
5290
5269
  },
5291
5270
  setup(props) {
5292
5271
  let renderText = ref();
5293
- watch(() => props.record, (v) => {
5272
+ watch(() => [props.record, props.column], (v) => {
5294
5273
  if (v)
5295
5274
  renderCell();
5296
5275
  }, {
@@ -5565,7 +5544,7 @@ function handleIndexColumn(propsRef, getPaginationRef, columns) {
5565
5544
  const isFixedLeft = columns.some((item) => item.fixed === "left");
5566
5545
  columns.unshift({
5567
5546
  flag: INDEX_FLAG,
5568
- width: unref(getIsZH) ? 50 : 60,
5547
+ width: unref(getIsZH) ? 50 : 70,
5569
5548
  title: t("NUMBER"),
5570
5549
  align: "center",
5571
5550
  customRender: ({ index: index2 }) => {
@@ -5703,7 +5682,6 @@ function useColumns(propsRef, getPaginationRef, tableElRef) {
5703
5682
  return columns;
5704
5683
  }
5705
5684
  function setColumns(columnList = []) {
5706
- console.log(columnList);
5707
5685
  const columns = cloneDeep(columnList);
5708
5686
  if (!isArray$1(columns))
5709
5687
  return;
@@ -5907,7 +5885,6 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5907
5885
  setColumns(columns);
5908
5886
  }
5909
5887
  function setColumns(columns) {
5910
- console.log(columns, "===");
5911
5888
  table.setColumns(columns);
5912
5889
  const data = unref(plainSortOptions).map((col) => {
5913
5890
  const visable = columns.findIndex((c) => c === col.value || typeof c !== "string" && c.dataIndex === col.value) !== -1;
@@ -6957,7 +6934,8 @@ function useSource(opt) {
6957
6934
  onSearch: ref(false),
6958
6935
  onReset: ref(false)
6959
6936
  };
6960
- const { baseUrl = "", api = {}, exportName = "" } = opt;
6937
+ const { baseUrl = "", api = {}, exportName = "", clearKeys = () => {
6938
+ } } = opt;
6961
6939
  const { add, deletes, update, queryById, queryPage } = api;
6962
6940
  const { message } = useMessage();
6963
6941
  const apiFul = {};
@@ -6993,12 +6971,14 @@ function useSource(opt) {
6993
6971
  baseData.entityDTO = { ...model };
6994
6972
  baseData.pageDTO.pageNo = 0;
6995
6973
  loading.onSearch.value = true;
6974
+ clearKeys();
6996
6975
  search();
6997
6976
  }
6998
6977
  function onReset(model) {
6999
6978
  baseData.entityDTO = { ...model };
7000
6979
  baseData.pageDTO.pageNo = 0;
7001
6980
  loading.onReset.value = true;
6981
+ clearKeys();
7002
6982
  search();
7003
6983
  }
7004
6984
  function onTableChange(params, needSearch = true) {
@@ -7043,15 +7023,17 @@ function useSource(opt) {
7043
7023
  });
7044
7024
  }
7045
7025
  function onAdd(model) {
7046
- if (!add)
7026
+ if (!add || loading.onAdd.value)
7047
7027
  return;
7048
7028
  const { fetch } = useFetch(add, baseUrl);
7029
+ loading.onAdd.value = true;
7049
7030
  let httpFetch = fetch(model, false);
7050
7031
  httpFetch.then((rsp) => {
7051
7032
  if ((rsp == null ? void 0 : rsp.code) === 0) {
7052
7033
  message.success(t("ADD_SUCCESS"));
7053
7034
  search();
7054
7035
  }
7036
+ loading.onAdd.value = false;
7055
7037
  });
7056
7038
  return httpFetch;
7057
7039
  }
@@ -7062,8 +7044,9 @@ function useSource(opt) {
7062
7044
  return await fetch({ id });
7063
7045
  }
7064
7046
  function onUpdate(model) {
7065
- if (!update)
7047
+ if (!update || loading.onUpdate.value)
7066
7048
  return;
7049
+ loading.onUpdate.value = true;
7067
7050
  const { fetch } = useFetch(update, baseUrl);
7068
7051
  let httpFetch = fetch(model, false);
7069
7052
  httpFetch.then((rsp) => {
@@ -7071,18 +7054,23 @@ function useSource(opt) {
7071
7054
  message.success(t("UPDATE_SUCCESS"));
7072
7055
  search();
7073
7056
  }
7057
+ loading.onUpdate.value = false;
7074
7058
  });
7075
7059
  return httpFetch;
7076
7060
  }
7077
7061
  function onDeletes(ids) {
7078
- if (!deletes)
7062
+ if (!deletes || loading.onDeletes.value)
7079
7063
  return;
7064
+ loading.onDeletes.value = true;
7080
7065
  const { fetch } = useFetch(deletes, baseUrl);
7081
7066
  fetch(toRaw(ids), false).then((rsp) => {
7082
7067
  if ((rsp == null ? void 0 : rsp.code) === 0) {
7083
7068
  message.success(`${ids.length > 1 ? t("MULTIFY") : ""} ${t("DELETE_SUCCESS")}`);
7069
+ if (ids.length > 1)
7070
+ clearKeys();
7084
7071
  search();
7085
7072
  }
7073
+ loading.onDeletes.value = false;
7086
7074
  });
7087
7075
  }
7088
7076
  const { download } = useDownload(apiFul.export, exportName);
@@ -7287,7 +7275,7 @@ function useCurd(curdOpt) {
7287
7275
  nextTick(() => dispatchResize());
7288
7276
  });
7289
7277
  }
7290
- function dels(ids = [], cb) {
7278
+ function dels(ids = []) {
7291
7279
  if (!ids.length) {
7292
7280
  message.error(t("EMPTY"));
7293
7281
  return;
@@ -7302,7 +7290,6 @@ function useCurd(curdOpt) {
7302
7290
  iconType: "warning",
7303
7291
  onOk() {
7304
7292
  curd.onDeletes(ids);
7305
- cb();
7306
7293
  }
7307
7294
  });
7308
7295
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dt-frames/ui",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "keywords": [
5
5
  "ui",
6
6
  "dt-ui"