hy-dispatch-ui-v3 0.2.45 → 0.2.47

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.
@@ -33,6 +33,10 @@ const _sfc_main = {
33
33
  type: Boolean,
34
34
  default: false
35
35
  },
36
+ disabled: {
37
+ type: Boolean,
38
+ default: false
39
+ },
36
40
  readonly: {
37
41
  type: Boolean,
38
42
  default: false
@@ -248,6 +252,7 @@ const _sfc_main = {
248
252
  "parent-prop": __props.column.field,
249
253
  index,
250
254
  loading: __props.loading,
255
+ disabled: __props.disabled,
251
256
  readonly: __props.readonly,
252
257
  level: 3
253
258
  }, createSlots({
@@ -262,7 +267,7 @@ const _sfc_main = {
262
267
  ])
263
268
  };
264
269
  })
265
- ]), 1032, ["model", "column", "rules", "parent-prop", "index", "loading", "readonly"]);
270
+ ]), 1032, ["model", "column", "rules", "parent-prop", "index", "loading", "disabled", "readonly"]);
266
271
  }),
267
272
  128
268
273
  /* KEYED_FRAGMENT */
@@ -28,6 +28,10 @@ const _sfc_main = {
28
28
  type: Boolean,
29
29
  default: false
30
30
  },
31
+ disabled: {
32
+ type: Boolean,
33
+ default: false
34
+ },
31
35
  readonly: {
32
36
  type: Boolean,
33
37
  default: false
@@ -111,6 +115,7 @@ const _sfc_main = {
111
115
  column: item,
112
116
  rules: __props.rules,
113
117
  loading: __props.loading,
118
+ disabled: __props.disabled,
114
119
  readonly: __props.readonly
115
120
  }, createSlots({
116
121
  _: 2
@@ -124,7 +129,7 @@ const _sfc_main = {
124
129
  ])
125
130
  };
126
131
  })
127
- ]), 1032, ["model", "column", "rules", "loading", "readonly"]);
132
+ ]), 1032, ["model", "column", "rules", "loading", "disabled", "readonly"]);
128
133
  }),
129
134
  128
130
135
  /* KEYED_FRAGMENT */
@@ -36,6 +36,10 @@ const _sfc_main = {
36
36
  type: Boolean,
37
37
  default: false
38
38
  },
39
+ disabled: {
40
+ type: Boolean,
41
+ default: false
42
+ },
39
43
  readonly: {
40
44
  type: Boolean,
41
45
  default: false
@@ -227,20 +231,20 @@ const _sfc_main = {
227
231
  end: bindValue2.value,
228
232
  "onUpdate:end": ($event) => bindValue2.value = $event,
229
233
  "is-range": true,
230
- style: { "width": "100%" }
234
+ style: { "width": "100%" },
235
+ teleported: true
231
236
  }, __props.column.attrs, {
232
237
  disabled: unref(isDisabled)(props, __props.column),
233
- teleported: false,
234
238
  onChange: onChangeHandler
235
239
  }), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled"])) : (openBlock(), createBlock(unref(HyDatePicker), mergeProps({
236
240
  key: 1,
237
241
  modelValue: bindValue.value,
238
242
  "onUpdate:modelValue": ($event) => bindValue.value = $event,
239
243
  "is-range": false,
240
- style: { "width": "100%" }
244
+ style: { "width": "100%" },
245
+ teleported: true
241
246
  }, __props.column.attrs, {
242
247
  disabled: unref(isDisabled)(props, __props.column),
243
- teleported: false,
244
248
  onChange: onChangeHandler
245
249
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"]))
246
250
  ],
@@ -258,20 +262,20 @@ const _sfc_main = {
258
262
  end: bindValue2.value,
259
263
  "onUpdate:end": ($event) => bindValue2.value = $event,
260
264
  "is-range": true,
261
- style: { "width": "100%" }
265
+ style: { "width": "100%" },
266
+ teleported: true
262
267
  }, __props.column.attrs, {
263
268
  disabled: unref(isDisabled)(props, __props.column),
264
- teleported: false,
265
269
  onChange: onChangeHandler
266
270
  }), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled"])) : (openBlock(), createBlock(unref(HyTimePicker), mergeProps({
267
271
  key: 1,
268
272
  modelValue: bindValue.value,
269
273
  "onUpdate:modelValue": ($event) => bindValue.value = $event,
270
274
  "is-range": false,
271
- style: { "width": "100%" }
275
+ style: { "width": "100%" },
276
+ teleported: true
272
277
  }, __props.column.attrs, {
273
278
  disabled: unref(isDisabled)(props, __props.column),
274
- teleported: false,
275
279
  onChange: onChangeHandler
276
280
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"]))
277
281
  ],
@@ -39,6 +39,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
39
39
  type: Boolean,
40
40
  default: false
41
41
  },
42
+ disabled: {
43
+ type: Boolean,
44
+ default: false
45
+ },
42
46
  size: {
43
47
  type: String,
44
48
  default: "default"
@@ -169,6 +173,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
169
173
  rules: __props.rules,
170
174
  columnNum: __props.columnNum,
171
175
  loading: __props.loading,
176
+ disabled: __props.disabled,
172
177
  readonly: __props.readonly,
173
178
  style: normalizeStyle(unref(columnItemStyle)(props, column))
174
179
  }, createSlots({
@@ -183,7 +188,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
183
188
  ])
184
189
  };
185
190
  })
186
- ]), 1032, ["model", "column", "rules", "columnNum", "loading", "readonly", "style"])) : createCommentVNode("v-if", true)
191
+ ]), 1032, ["model", "column", "rules", "columnNum", "loading", "disabled", "readonly", "style"])) : createCommentVNode("v-if", true)
187
192
  ],
188
193
  64
189
194
  /* STABLE_FRAGMENT */
@@ -199,6 +204,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
199
204
  rules: __props.rules,
200
205
  columnNum: __props.columnNum,
201
206
  loading: __props.loading,
207
+ disabled: __props.disabled,
202
208
  readonly: __props.readonly,
203
209
  size: __props.size,
204
210
  style: normalizeStyle(unref(columnItemStyle)(props, column))
@@ -214,7 +220,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
214
220
  ])
215
221
  };
216
222
  })
217
- ]), 1032, ["model", "column", "rules", "columnNum", "loading", "readonly", "size", "style"])) : createCommentVNode("v-if", true)
223
+ ]), 1032, ["model", "column", "rules", "columnNum", "loading", "disabled", "readonly", "size", "style"])) : createCommentVNode("v-if", true)
218
224
  ],
219
225
  64
220
226
  /* STABLE_FRAGMENT */
@@ -228,6 +234,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
228
234
  column,
229
235
  rules: __props.rules,
230
236
  loading: __props.loading,
237
+ disabled: __props.disabled,
231
238
  readonly: __props.readonly
232
239
  }, createSlots({
233
240
  _: 2
@@ -241,7 +248,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
241
248
  ])
242
249
  };
243
250
  })
244
- ]), 1032, ["model", "column", "rules", "loading", "readonly"])
251
+ ]), 1032, ["model", "column", "rules", "loading", "disabled", "readonly"])
245
252
  ],
246
253
  64
247
254
  /* STABLE_FRAGMENT */
@@ -44,7 +44,7 @@ function isRequired(props, column) {
44
44
  return false;
45
45
  }
46
46
  function isDisabled(props, column) {
47
- if (props.loading) return true;
47
+ if (props.disabled || props.loading) return true;
48
48
  const disabled = unref(column.attrs?.disabled);
49
49
  if (isBoolean(disabled)) return disabled;
50
50
  if (isFunction(disabled)) return disabled(column, props.model);
@@ -18,6 +18,14 @@ const _sfc_main = {
18
18
  column: {
19
19
  type: Object,
20
20
  default: () => ({})
21
+ },
22
+ loading: {
23
+ type: Boolean,
24
+ default: false
25
+ },
26
+ disabled: {
27
+ type: Boolean,
28
+ default: false
21
29
  }
22
30
  },
23
31
  emits: ["search"],
@@ -35,7 +35,7 @@ function columnShowHandler(props, column) {
35
35
  return true;
36
36
  }
37
37
  function isDisabled(props, column) {
38
- if (props.loading) return true;
38
+ if (props.disabled || props.loading) return true;
39
39
  const disabled = unref(column.attrs?.disabled);
40
40
  if (isBoolean(disabled)) return disabled;
41
41
  if (isFunction(disabled)) return disabled(column, props.model);
@@ -26,6 +26,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
26
26
  type: Boolean,
27
27
  default: false
28
28
  },
29
+ disabled: {
30
+ type: Boolean,
31
+ default: false
32
+ },
29
33
  size: {
30
34
  type: String,
31
35
  default: "default"
@@ -203,7 +207,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
203
207
  model: __props.model,
204
208
  "label-position": "top",
205
209
  size: __props.size,
206
- class: "hy-search-form"
210
+ class: "hy-search-form",
211
+ disabled: __props.disabled
207
212
  }, _ctx.$attrs, { style: containerStyle.value }), {
208
213
  default: withCtx(() => [
209
214
  createElementVNode(
@@ -223,6 +228,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
223
228
  key: column.key,
224
229
  model: __props.model,
225
230
  column,
231
+ loading: __props.loading,
232
+ disabled: __props.disabled,
226
233
  onSearch: onSearchHandler
227
234
  }, createSlots({
228
235
  _: 2
@@ -236,7 +243,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
236
243
  ])
237
244
  };
238
245
  })
239
- ]), 1032, ["model", "column"]);
246
+ ]), 1032, ["model", "column", "loading", "disabled"]);
240
247
  }),
241
248
  128
242
249
  /* KEYED_FRAGMENT */
@@ -248,7 +255,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
248
255
  ]),
249
256
  _: 3
250
257
  /* FORWARDED */
251
- }, 16, ["model", "size", "style"])
258
+ }, 16, ["model", "size", "disabled", "style"])
252
259
  ],
253
260
  2
254
261
  /* CLASS */
@@ -1,4 +1,4 @@
1
- import { ref, computed, watchEffect, unref, nextTick } from 'vue';
1
+ import { ref, computed, watch, watchEffect, unref, nextTick } from 'vue';
2
2
  import { ElLoading } from 'element-plus';
3
3
  import { isString, isBoolean, isFunction, isPermission, isNumber, isArray } from '../../../utils/is.mjs';
4
4
  import { useLocale } from '../../../hooks/useLocale.mjs';
@@ -152,7 +152,6 @@ const useAppTableWrapper = (hy) => {
152
152
  const { permissionMap } = usePermissionMap();
153
153
  const { t } = useLocale();
154
154
  const CACHE_COLUMNS_KEY = props.controller || props.url || "CACHE_COLUMNS_KEY";
155
- const loading = ref(true);
156
155
  const tableDataSource = ref([]);
157
156
  const tableColumns = ref([]);
158
157
  const tableColumnsEditablele = ref({});
@@ -209,13 +208,24 @@ const useAppTableWrapper = (hy) => {
209
208
  });
210
209
  loadingTimer = setTimeout(() => {
211
210
  closeAppTableLoading();
212
- }, 60 * 1e3);
211
+ }, props.loadingTimeout);
213
212
  }
214
213
  function closeAppTableLoading() {
215
214
  loadingTimer && clearTimeout(loadingTimer);
216
215
  loadingInstance?.close();
217
216
  loadingInstance = null;
218
217
  }
218
+ watch(
219
+ () => hy.loading.value,
220
+ (value) => {
221
+ if (value) {
222
+ showAppTableLoading();
223
+ } else {
224
+ closeAppTableLoading();
225
+ }
226
+ },
227
+ { immediate: true }
228
+ );
219
229
  const tableTriggerPosition = ref({
220
230
  top: 0,
221
231
  left: 0,
@@ -361,15 +371,12 @@ const useAppTableWrapper = (hy) => {
361
371
  });
362
372
  return {
363
373
  // 表格配置项
364
- loading,
365
374
  tableDataSource,
366
375
  tableColumns,
367
376
  tableColumnsEditablele,
368
377
  tableColumnsList,
369
378
  searchPlaceholder,
370
379
  doLayout,
371
- showAppTableLoading,
372
- closeAppTableLoading,
373
380
  // 表格行操作配置
374
381
  getRowKey,
375
382
  selectedList,
@@ -3,15 +3,7 @@ import { useApi } from '../../../hooks/useApi.mjs';
3
3
  import { isEmpty, isNumber, isString } from '../../../utils/is.mjs';
4
4
 
5
5
  function useAppTableSearch(hy) {
6
- const {
7
- props,
8
- emits,
9
- appSearchRef,
10
- tableDataSource,
11
- showAppTableLoading,
12
- closeAppTableLoading,
13
- clearSelection
14
- } = hy;
6
+ const { props, emits, appSearchRef, tableDataSource, clearSelection } = hy;
15
7
  const { api } = useApi();
16
8
  const totalElements = ref(0);
17
9
  const showFilter = ref(true);
@@ -20,7 +12,7 @@ function useAppTableSearch(hy) {
20
12
  }
21
13
  async function getData(page = null) {
22
14
  await nextTick();
23
- showAppTableLoading();
15
+ hy.loading.value = true;
24
16
  return new Promise((resolve, reject) => {
25
17
  if (!isEmpty(page)) {
26
18
  if (isNumber(page) || isString(page)) {
@@ -31,17 +23,17 @@ function useAppTableSearch(hy) {
31
23
  const options = { baseURL: props.baseURL, isJSON: props.isJsonData };
32
24
  if (props.controller) {
33
25
  unref(api).post(`${props.controller}/page`, params, options).then(successFun).finally(() => {
26
+ hy.loading.value = false;
34
27
  resolve();
35
- closeAppTableLoading();
36
28
  });
37
29
  } else if (props.url) {
38
30
  unref(api).post(props.url, params, options).then(successFun).finally(() => {
31
+ hy.loading.value = false;
39
32
  resolve();
40
- closeAppTableLoading();
41
33
  });
42
34
  } else {
35
+ hy.loading.value = false;
43
36
  emits("search-data");
44
- closeAppTableLoading();
45
37
  reject();
46
38
  }
47
39
  });
@@ -88,7 +80,7 @@ function useAppTableSearch(hy) {
88
80
  }
89
81
  function setData(dataSource) {
90
82
  tableDataSource.value = dataSource || [];
91
- closeAppTableLoading();
83
+ hy.loading.value = false;
92
84
  }
93
85
  function onSizeChangeHandler(val) {
94
86
  props.filterModel.page = 1;
@@ -1,4 +1,4 @@
1
- import { defineComponent, useTemplateRef, openBlock, createElementBlock, createCommentVNode, createElementVNode, createBlock, unref, createVNode, withCtx, toDisplayString, renderSlot, normalizeClass, createSlots, renderList, normalizeProps, guardReactiveProps, mergeProps, Fragment, withModifiers } from 'vue';
1
+ import { defineComponent, useModel, useTemplateRef, openBlock, createElementBlock, createCommentVNode, createElementVNode, createBlock, unref, createVNode, withCtx, toDisplayString, renderSlot, normalizeClass, createSlots, renderList, normalizeProps, guardReactiveProps, mergeProps, Fragment, withModifiers, mergeModels } from 'vue';
2
2
  import { ElIcon, ElTable, ElTableColumn, ElDropdown, ElDropdownMenu, ElDropdownItem, ElAutoResizer, ElPagination } from 'element-plus';
3
3
  import { Filter, MoreFilled } from '@element-plus/icons-vue';
4
4
  import { operatorFilterHandler, operatorClickHandler, operatorDisabledHandler, operatorDisableTextdHandler, renderContentHandler, renderHeaderHandler, useAppTableWrapper } from './js/index.mjs';
@@ -22,7 +22,7 @@ const __default__ = defineComponent({
22
22
  name: "HyTable"
23
23
  });
24
24
  const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
25
- props: {
25
+ props: /* @__PURE__ */ mergeModels({
26
26
  // 表格配置项
27
27
  type: {
28
28
  type: String,
@@ -82,6 +82,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
82
82
  type: Boolean,
83
83
  default: true
84
84
  },
85
+ loadingTimeout: {
86
+ // 加载超时
87
+ type: Number,
88
+ default: 60 * 1e3
89
+ },
85
90
  showEditable: {
86
91
  type: Boolean,
87
92
  default: true
@@ -185,17 +190,21 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
185
190
  // 展开回调
186
191
  type: Function
187
192
  }
188
- },
189
- emits: [
193
+ }, {
194
+ "loading": { type: Boolean, default: false },
195
+ "loadingModifiers": {}
196
+ }),
197
+ emits: /* @__PURE__ */ mergeModels([
190
198
  "row-click",
191
199
  "select-all",
192
200
  "on-select-checkbox",
193
201
  "reqSuccess",
194
202
  "search-data"
195
- ],
203
+ ], ["update:loading"]),
196
204
  setup(__props, { expose: __expose, emit: __emit }) {
197
205
  const props = __props;
198
206
  const emits = __emit;
207
+ const loading = useModel(__props, "loading");
199
208
  const { t } = useLocale();
200
209
  const containerRef = useTemplateRef("containerRef");
201
210
  const tableRef = useTemplateRef("tableRef");
@@ -244,6 +253,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
244
253
  {
245
254
  props,
246
255
  emits,
256
+ loading,
247
257
  containerRef,
248
258
  tableRef,
249
259
  tableDropdownRef,
package/es/version.mjs CHANGED
@@ -1,3 +1,3 @@
1
- const version = "0.2.44";
1
+ const version = "0.2.46";
2
2
 
3
3
  export { version };
@@ -37,6 +37,10 @@ const _sfc_main = {
37
37
  type: Boolean,
38
38
  default: false
39
39
  },
40
+ disabled: {
41
+ type: Boolean,
42
+ default: false
43
+ },
40
44
  readonly: {
41
45
  type: Boolean,
42
46
  default: false
@@ -252,6 +256,7 @@ const _sfc_main = {
252
256
  "parent-prop": __props.column.field,
253
257
  index: index$1,
254
258
  loading: __props.loading,
259
+ disabled: __props.disabled,
255
260
  readonly: __props.readonly,
256
261
  level: 3
257
262
  }, vue.createSlots({
@@ -266,7 +271,7 @@ const _sfc_main = {
266
271
  ])
267
272
  };
268
273
  })
269
- ]), 1032, ["model", "column", "rules", "parent-prop", "index", "loading", "readonly"]);
274
+ ]), 1032, ["model", "column", "rules", "parent-prop", "index", "loading", "disabled", "readonly"]);
270
275
  }),
271
276
  128
272
277
  /* KEYED_FRAGMENT */
@@ -32,6 +32,10 @@ const _sfc_main = {
32
32
  type: Boolean,
33
33
  default: false
34
34
  },
35
+ disabled: {
36
+ type: Boolean,
37
+ default: false
38
+ },
35
39
  readonly: {
36
40
  type: Boolean,
37
41
  default: false
@@ -115,6 +119,7 @@ const _sfc_main = {
115
119
  column: item,
116
120
  rules: __props.rules,
117
121
  loading: __props.loading,
122
+ disabled: __props.disabled,
118
123
  readonly: __props.readonly
119
124
  }, vue.createSlots({
120
125
  _: 2
@@ -128,7 +133,7 @@ const _sfc_main = {
128
133
  ])
129
134
  };
130
135
  })
131
- ]), 1032, ["model", "column", "rules", "loading", "readonly"]);
136
+ ]), 1032, ["model", "column", "rules", "loading", "disabled", "readonly"]);
132
137
  }),
133
138
  128
134
139
  /* KEYED_FRAGMENT */
@@ -40,6 +40,10 @@ const _sfc_main = {
40
40
  type: Boolean,
41
41
  default: false
42
42
  },
43
+ disabled: {
44
+ type: Boolean,
45
+ default: false
46
+ },
43
47
  readonly: {
44
48
  type: Boolean,
45
49
  default: false
@@ -231,20 +235,20 @@ const _sfc_main = {
231
235
  end: bindValue2.value,
232
236
  "onUpdate:end": ($event) => bindValue2.value = $event,
233
237
  "is-range": true,
234
- style: { "width": "100%" }
238
+ style: { "width": "100%" },
239
+ teleported: true
235
240
  }, __props.column.attrs, {
236
241
  disabled: vue.unref(index.isDisabled)(props, __props.column),
237
- teleported: false,
238
242
  onChange: onChangeHandler
239
243
  }), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled"])) : (vue.openBlock(), vue.createBlock(vue.unref(index$3.HyDatePicker), vue.mergeProps({
240
244
  key: 1,
241
245
  modelValue: bindValue.value,
242
246
  "onUpdate:modelValue": ($event) => bindValue.value = $event,
243
247
  "is-range": false,
244
- style: { "width": "100%" }
248
+ style: { "width": "100%" },
249
+ teleported: true
245
250
  }, __props.column.attrs, {
246
251
  disabled: vue.unref(index.isDisabled)(props, __props.column),
247
- teleported: false,
248
252
  onChange: onChangeHandler
249
253
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"]))
250
254
  ],
@@ -262,20 +266,20 @@ const _sfc_main = {
262
266
  end: bindValue2.value,
263
267
  "onUpdate:end": ($event) => bindValue2.value = $event,
264
268
  "is-range": true,
265
- style: { "width": "100%" }
269
+ style: { "width": "100%" },
270
+ teleported: true
266
271
  }, __props.column.attrs, {
267
272
  disabled: vue.unref(index.isDisabled)(props, __props.column),
268
- teleported: false,
269
273
  onChange: onChangeHandler
270
274
  }), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled"])) : (vue.openBlock(), vue.createBlock(vue.unref(index$4.HyTimePicker), vue.mergeProps({
271
275
  key: 1,
272
276
  modelValue: bindValue.value,
273
277
  "onUpdate:modelValue": ($event) => bindValue.value = $event,
274
278
  "is-range": false,
275
- style: { "width": "100%" }
279
+ style: { "width": "100%" },
280
+ teleported: true
276
281
  }, __props.column.attrs, {
277
282
  disabled: vue.unref(index.isDisabled)(props, __props.column),
278
- teleported: false,
279
283
  onChange: onChangeHandler
280
284
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"]))
281
285
  ],
@@ -43,6 +43,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
43
43
  type: Boolean,
44
44
  default: false
45
45
  },
46
+ disabled: {
47
+ type: Boolean,
48
+ default: false
49
+ },
46
50
  size: {
47
51
  type: String,
48
52
  default: "default"
@@ -173,6 +177,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
173
177
  rules: __props.rules,
174
178
  columnNum: __props.columnNum,
175
179
  loading: __props.loading,
180
+ disabled: __props.disabled,
176
181
  readonly: __props.readonly,
177
182
  style: vue.normalizeStyle(vue.unref(index.columnItemStyle)(props, column))
178
183
  }, vue.createSlots({
@@ -187,7 +192,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
187
192
  ])
188
193
  };
189
194
  })
190
- ]), 1032, ["model", "column", "rules", "columnNum", "loading", "readonly", "style"])) : vue.createCommentVNode("v-if", true)
195
+ ]), 1032, ["model", "column", "rules", "columnNum", "loading", "disabled", "readonly", "style"])) : vue.createCommentVNode("v-if", true)
191
196
  ],
192
197
  64
193
198
  /* STABLE_FRAGMENT */
@@ -203,6 +208,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
203
208
  rules: __props.rules,
204
209
  columnNum: __props.columnNum,
205
210
  loading: __props.loading,
211
+ disabled: __props.disabled,
206
212
  readonly: __props.readonly,
207
213
  size: __props.size,
208
214
  style: vue.normalizeStyle(vue.unref(index.columnItemStyle)(props, column))
@@ -218,7 +224,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
218
224
  ])
219
225
  };
220
226
  })
221
- ]), 1032, ["model", "column", "rules", "columnNum", "loading", "readonly", "size", "style"])) : vue.createCommentVNode("v-if", true)
227
+ ]), 1032, ["model", "column", "rules", "columnNum", "loading", "disabled", "readonly", "size", "style"])) : vue.createCommentVNode("v-if", true)
222
228
  ],
223
229
  64
224
230
  /* STABLE_FRAGMENT */
@@ -232,6 +238,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
232
238
  column,
233
239
  rules: __props.rules,
234
240
  loading: __props.loading,
241
+ disabled: __props.disabled,
235
242
  readonly: __props.readonly
236
243
  }, vue.createSlots({
237
244
  _: 2
@@ -245,7 +252,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
245
252
  ])
246
253
  };
247
254
  })
248
- ]), 1032, ["model", "column", "rules", "loading", "readonly"])
255
+ ]), 1032, ["model", "column", "rules", "loading", "disabled", "readonly"])
249
256
  ],
250
257
  64
251
258
  /* STABLE_FRAGMENT */
@@ -46,7 +46,7 @@ function isRequired(props, column) {
46
46
  return false;
47
47
  }
48
48
  function isDisabled(props, column) {
49
- if (props.loading) return true;
49
+ if (props.disabled || props.loading) return true;
50
50
  const disabled = vue.unref(column.attrs?.disabled);
51
51
  if (is.isBoolean(disabled)) return disabled;
52
52
  if (is.isFunction(disabled)) return disabled(column, props.model);
@@ -22,6 +22,14 @@ const _sfc_main = {
22
22
  column: {
23
23
  type: Object,
24
24
  default: () => ({})
25
+ },
26
+ loading: {
27
+ type: Boolean,
28
+ default: false
29
+ },
30
+ disabled: {
31
+ type: Boolean,
32
+ default: false
25
33
  }
26
34
  },
27
35
  emits: ["search"],
@@ -37,7 +37,7 @@ function columnShowHandler(props, column) {
37
37
  return true;
38
38
  }
39
39
  function isDisabled(props, column) {
40
- if (props.loading) return true;
40
+ if (props.disabled || props.loading) return true;
41
41
  const disabled = vue.unref(column.attrs?.disabled);
42
42
  if (is.isBoolean(disabled)) return disabled;
43
43
  if (is.isFunction(disabled)) return disabled(column, props.model);
@@ -30,6 +30,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
30
30
  type: Boolean,
31
31
  default: false
32
32
  },
33
+ disabled: {
34
+ type: Boolean,
35
+ default: false
36
+ },
33
37
  size: {
34
38
  type: String,
35
39
  default: "default"
@@ -207,7 +211,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
207
211
  model: __props.model,
208
212
  "label-position": "top",
209
213
  size: __props.size,
210
- class: "hy-search-form"
214
+ class: "hy-search-form",
215
+ disabled: __props.disabled
211
216
  }, _ctx.$attrs, { style: containerStyle.value }), {
212
217
  default: vue.withCtx(() => [
213
218
  vue.createElementVNode(
@@ -227,6 +232,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
227
232
  key: column.key,
228
233
  model: __props.model,
229
234
  column,
235
+ loading: __props.loading,
236
+ disabled: __props.disabled,
230
237
  onSearch: onSearchHandler
231
238
  }, vue.createSlots({
232
239
  _: 2
@@ -240,7 +247,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
240
247
  ])
241
248
  };
242
249
  })
243
- ]), 1032, ["model", "column"]);
250
+ ]), 1032, ["model", "column", "loading", "disabled"]);
244
251
  }),
245
252
  128
246
253
  /* KEYED_FRAGMENT */
@@ -252,7 +259,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
252
259
  ]),
253
260
  _: 3
254
261
  /* FORWARDED */
255
- }, 16, ["model", "size", "style"])
262
+ }, 16, ["model", "size", "disabled", "style"])
256
263
  ],
257
264
  2
258
265
  /* CLASS */
@@ -154,7 +154,6 @@ const useAppTableWrapper = (hy) => {
154
154
  const { permissionMap } = usePermissionMap.usePermissionMap();
155
155
  const { t } = useLocale.useLocale();
156
156
  const CACHE_COLUMNS_KEY = props.controller || props.url || "CACHE_COLUMNS_KEY";
157
- const loading = vue.ref(true);
158
157
  const tableDataSource = vue.ref([]);
159
158
  const tableColumns = vue.ref([]);
160
159
  const tableColumnsEditablele = vue.ref({});
@@ -211,13 +210,24 @@ const useAppTableWrapper = (hy) => {
211
210
  });
212
211
  loadingTimer = setTimeout(() => {
213
212
  closeAppTableLoading();
214
- }, 60 * 1e3);
213
+ }, props.loadingTimeout);
215
214
  }
216
215
  function closeAppTableLoading() {
217
216
  loadingTimer && clearTimeout(loadingTimer);
218
217
  loadingInstance?.close();
219
218
  loadingInstance = null;
220
219
  }
220
+ vue.watch(
221
+ () => hy.loading.value,
222
+ (value) => {
223
+ if (value) {
224
+ showAppTableLoading();
225
+ } else {
226
+ closeAppTableLoading();
227
+ }
228
+ },
229
+ { immediate: true }
230
+ );
221
231
  const tableTriggerPosition = vue.ref({
222
232
  top: 0,
223
233
  left: 0,
@@ -363,15 +373,12 @@ const useAppTableWrapper = (hy) => {
363
373
  });
364
374
  return {
365
375
  // 表格配置项
366
- loading,
367
376
  tableDataSource,
368
377
  tableColumns,
369
378
  tableColumnsEditablele,
370
379
  tableColumnsList,
371
380
  searchPlaceholder,
372
381
  doLayout,
373
- showAppTableLoading,
374
- closeAppTableLoading,
375
382
  // 表格行操作配置
376
383
  getRowKey,
377
384
  selectedList,
@@ -5,15 +5,7 @@ var useApi = require('../../../hooks/useApi.js');
5
5
  var is = require('../../../utils/is.js');
6
6
 
7
7
  function useAppTableSearch(hy) {
8
- const {
9
- props,
10
- emits,
11
- appSearchRef,
12
- tableDataSource,
13
- showAppTableLoading,
14
- closeAppTableLoading,
15
- clearSelection
16
- } = hy;
8
+ const { props, emits, appSearchRef, tableDataSource, clearSelection } = hy;
17
9
  const { api } = useApi.useApi();
18
10
  const totalElements = vue.ref(0);
19
11
  const showFilter = vue.ref(true);
@@ -22,7 +14,7 @@ function useAppTableSearch(hy) {
22
14
  }
23
15
  async function getData(page = null) {
24
16
  await vue.nextTick();
25
- showAppTableLoading();
17
+ hy.loading.value = true;
26
18
  return new Promise((resolve, reject) => {
27
19
  if (!is.isEmpty(page)) {
28
20
  if (is.isNumber(page) || is.isString(page)) {
@@ -33,17 +25,17 @@ function useAppTableSearch(hy) {
33
25
  const options = { baseURL: props.baseURL, isJSON: props.isJsonData };
34
26
  if (props.controller) {
35
27
  vue.unref(api).post(`${props.controller}/page`, params, options).then(successFun).finally(() => {
28
+ hy.loading.value = false;
36
29
  resolve();
37
- closeAppTableLoading();
38
30
  });
39
31
  } else if (props.url) {
40
32
  vue.unref(api).post(props.url, params, options).then(successFun).finally(() => {
33
+ hy.loading.value = false;
41
34
  resolve();
42
- closeAppTableLoading();
43
35
  });
44
36
  } else {
37
+ hy.loading.value = false;
45
38
  emits("search-data");
46
- closeAppTableLoading();
47
39
  reject();
48
40
  }
49
41
  });
@@ -90,7 +82,7 @@ function useAppTableSearch(hy) {
90
82
  }
91
83
  function setData(dataSource) {
92
84
  tableDataSource.value = dataSource || [];
93
- closeAppTableLoading();
85
+ hy.loading.value = false;
94
86
  }
95
87
  function onSizeChangeHandler(val) {
96
88
  props.filterModel.page = 1;
@@ -26,7 +26,7 @@ const __default__ = vue.defineComponent({
26
26
  name: "HyTable"
27
27
  });
28
28
  const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
29
- props: {
29
+ props: /* @__PURE__ */ vue.mergeModels({
30
30
  // 表格配置项
31
31
  type: {
32
32
  type: String,
@@ -86,6 +86,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
86
86
  type: Boolean,
87
87
  default: true
88
88
  },
89
+ loadingTimeout: {
90
+ // 加载超时
91
+ type: Number,
92
+ default: 60 * 1e3
93
+ },
89
94
  showEditable: {
90
95
  type: Boolean,
91
96
  default: true
@@ -189,17 +194,21 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
189
194
  // 展开回调
190
195
  type: Function
191
196
  }
192
- },
193
- emits: [
197
+ }, {
198
+ "loading": { type: Boolean, default: false },
199
+ "loadingModifiers": {}
200
+ }),
201
+ emits: /* @__PURE__ */ vue.mergeModels([
194
202
  "row-click",
195
203
  "select-all",
196
204
  "on-select-checkbox",
197
205
  "reqSuccess",
198
206
  "search-data"
199
- ],
207
+ ], ["update:loading"]),
200
208
  setup(__props, { expose: __expose, emit: __emit }) {
201
209
  const props = __props;
202
210
  const emits = __emit;
211
+ const loading = vue.useModel(__props, "loading");
203
212
  const { t } = useLocale.useLocale();
204
213
  const containerRef = vue.useTemplateRef("containerRef");
205
214
  const tableRef = vue.useTemplateRef("tableRef");
@@ -248,6 +257,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
248
257
  {
249
258
  props,
250
259
  emits,
260
+ loading,
251
261
  containerRef,
252
262
  tableRef,
253
263
  tableDropdownRef,
package/lib/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const version = "0.2.44";
3
+ const version = "0.2.46";
4
4
 
5
5
  exports.version = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-dispatch-ui-v3",
3
- "version": "0.2.45",
3
+ "version": "0.2.47",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "scripts": {