hy-dispatch-ui-v3 0.2.44 → 0.2.46

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.
Files changed (35) hide show
  1. package/es/components/hyForm/cpns/arrayItem.vue.mjs +6 -1
  2. package/es/components/hyForm/cpns/extraItem.vue.mjs +6 -1
  3. package/es/components/hyForm/cpns/formItem.vue.mjs +12 -8
  4. package/es/components/hyForm/form.vue.mjs +10 -7
  5. package/es/components/hyForm/js/index.mjs +1 -1
  6. package/es/components/hyInput/index.mjs +3 -1
  7. package/es/components/hyInput/inputSearch.vue.mjs +122 -0
  8. package/es/components/hyInput/style/inputSearch.scss +39 -0
  9. package/es/components/hySearch/cpns/searchItem.vue.mjs +8 -0
  10. package/es/components/hySearch/js/index.mjs +1 -1
  11. package/es/components/hySearch/search.vue.mjs +10 -3
  12. package/es/components/hyTable/js/index.mjs +13 -6
  13. package/es/components/hyTable/js/search.mjs +6 -14
  14. package/es/components/hyTable/table.vue.mjs +25 -46
  15. package/es/components/index.mjs +1 -1
  16. package/es/index.mjs +1 -1
  17. package/es/version.mjs +1 -1
  18. package/lib/components/hyForm/cpns/arrayItem.vue.js +6 -1
  19. package/lib/components/hyForm/cpns/extraItem.vue.js +6 -1
  20. package/lib/components/hyForm/cpns/formItem.vue.js +12 -8
  21. package/lib/components/hyForm/form.vue.js +10 -7
  22. package/lib/components/hyForm/js/index.js +1 -1
  23. package/lib/components/hyInput/index.js +3 -0
  24. package/lib/components/hyInput/inputSearch.vue.js +126 -0
  25. package/lib/components/hyInput/style/inputSearch.scss +39 -0
  26. package/lib/components/hySearch/cpns/searchItem.vue.js +8 -0
  27. package/lib/components/hySearch/js/index.js +1 -1
  28. package/lib/components/hySearch/search.vue.js +10 -3
  29. package/lib/components/hyTable/js/index.js +12 -5
  30. package/lib/components/hyTable/js/search.js +6 -14
  31. package/lib/components/hyTable/table.vue.js +48 -69
  32. package/lib/components/index.js +1 -0
  33. package/lib/index.js +1 -0
  34. package/lib/version.js +1 -1
  35. package/package.json +1 -1
@@ -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: false
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: false
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: false
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: false
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
  ],
@@ -35,7 +35,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
35
35
  type: Boolean,
36
36
  default: false
37
37
  },
38
- loading: {
38
+ disabled: {
39
39
  type: Boolean,
40
40
  default: false
41
41
  },
@@ -168,7 +168,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
168
168
  column,
169
169
  rules: __props.rules,
170
170
  columnNum: __props.columnNum,
171
- loading: __props.loading,
171
+ loading: _ctx.loading,
172
+ disabled: __props.disabled,
172
173
  readonly: __props.readonly,
173
174
  style: normalizeStyle(unref(columnItemStyle)(props, column))
174
175
  }, createSlots({
@@ -183,7 +184,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
183
184
  ])
184
185
  };
185
186
  })
186
- ]), 1032, ["model", "column", "rules", "columnNum", "loading", "readonly", "style"])) : createCommentVNode("v-if", true)
187
+ ]), 1032, ["model", "column", "rules", "columnNum", "loading", "disabled", "readonly", "style"])) : createCommentVNode("v-if", true)
187
188
  ],
188
189
  64
189
190
  /* STABLE_FRAGMENT */
@@ -198,7 +199,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
198
199
  column,
199
200
  rules: __props.rules,
200
201
  columnNum: __props.columnNum,
201
- loading: __props.loading,
202
+ loading: _ctx.loading,
203
+ disabled: __props.disabled,
202
204
  readonly: __props.readonly,
203
205
  size: __props.size,
204
206
  style: normalizeStyle(unref(columnItemStyle)(props, column))
@@ -214,7 +216,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
214
216
  ])
215
217
  };
216
218
  })
217
- ]), 1032, ["model", "column", "rules", "columnNum", "loading", "readonly", "size", "style"])) : createCommentVNode("v-if", true)
219
+ ]), 1032, ["model", "column", "rules", "columnNum", "loading", "disabled", "readonly", "size", "style"])) : createCommentVNode("v-if", true)
218
220
  ],
219
221
  64
220
222
  /* STABLE_FRAGMENT */
@@ -227,7 +229,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
227
229
  model: __props.model,
228
230
  column,
229
231
  rules: __props.rules,
230
- loading: __props.loading,
232
+ loading: _ctx.loading,
233
+ disabled: __props.disabled,
231
234
  readonly: __props.readonly
232
235
  }, createSlots({
233
236
  _: 2
@@ -241,7 +244,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
241
244
  ])
242
245
  };
243
246
  })
244
- ]), 1032, ["model", "column", "rules", "loading", "readonly"])
247
+ ]), 1032, ["model", "column", "rules", "loading", "disabled", "readonly"])
245
248
  ],
246
249
  64
247
250
  /* 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);
@@ -1,7 +1,9 @@
1
1
  import _sfc_main from './input.vue.mjs';
2
+ import _sfc_main$1 from './inputSearch.vue.mjs';
2
3
  import { withInstall } from '../../utils/handler.mjs';
3
4
 
4
5
  const HyInput = withInstall(_sfc_main);
6
+ const HyInputSearch = withInstall(_sfc_main$1);
5
7
  const ElInput = withInstall(_sfc_main, "ElInput");
6
8
 
7
- export { ElInput, HyInput, HyInput as default };
9
+ export { ElInput, HyInput, HyInputSearch, HyInput as default };
@@ -0,0 +1,122 @@
1
+ import { useModel, useTemplateRef, ref, computed, openBlock, createElementBlock, normalizeClass, renderSlot, createVNode, mergeProps, withKeys, createSlots, renderList, withCtx, normalizeProps, guardReactiveProps, createElementVNode, unref, mergeModels, defineComponent } from 'vue';
2
+ import { ElIcon } from 'element-plus';
3
+ import { Search } from '@element-plus/icons-vue';
4
+ import _sfc_main$1 from './input.vue.mjs';
5
+
6
+ import "./style/inputSearch.scss";
7
+
8
+ const __default__ = defineComponent({
9
+ name: "HyInputSearch"
10
+ });
11
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
12
+ props: /* @__PURE__ */ mergeModels({}, {
13
+ "modelValue": {
14
+ type: [String, Number],
15
+ default: ""
16
+ },
17
+ "modelModifiers": {}
18
+ }),
19
+ emits: /* @__PURE__ */ mergeModels(["search"], ["update:modelValue"]),
20
+ setup(__props, { expose: __expose, emit: __emit }) {
21
+ const emits = __emit;
22
+ const modelValue = useModel(__props, "modelValue");
23
+ const inputRef = useTemplateRef("inputRef");
24
+ const isSearchFocus = ref(false);
25
+ function onSearchInputHandler() {
26
+ isSearchFocus.value = true;
27
+ }
28
+ function onSearchBlurHandler() {
29
+ isSearchFocus.value = false;
30
+ }
31
+ function onSearchQueryHandler() {
32
+ emits("search", modelValue.value);
33
+ }
34
+ __expose({
35
+ blur() {
36
+ inputRef.value.blur();
37
+ },
38
+ clear() {
39
+ inputRef.value.clear();
40
+ },
41
+ focus() {
42
+ inputRef.value.focus();
43
+ },
44
+ input: computed(() => {
45
+ return inputRef.value.input;
46
+ }),
47
+ ref: computed(() => {
48
+ return inputRef.value.ref;
49
+ }),
50
+ resizeTextarea() {
51
+ inputRef.value.resizeTextarea();
52
+ },
53
+ select() {
54
+ inputRef.value.select();
55
+ },
56
+ textarea: computed(() => {
57
+ return inputRef.value.textarea;
58
+ }),
59
+ textareaStyle: computed(() => {
60
+ return inputRef.value.textareaStyle;
61
+ }),
62
+ isComposing: computed(() => {
63
+ return inputRef.value.isComposing;
64
+ }),
65
+ passwordVisible: computed(() => {
66
+ return inputRef.value.passwordVisible;
67
+ })
68
+ });
69
+ return (_ctx, _cache) => {
70
+ return openBlock(), createElementBlock(
71
+ "div",
72
+ {
73
+ class: normalizeClass(["hy-input-search", { focus: isSearchFocus.value }])
74
+ },
75
+ [
76
+ renderSlot(_ctx.$slots, "before"),
77
+ createVNode(_sfc_main$1, mergeProps({
78
+ ref_key: "inputRef",
79
+ ref: inputRef,
80
+ modelValue: modelValue.value,
81
+ "onUpdate:modelValue": ($event) => modelValue.value = $event,
82
+ clearable: "",
83
+ class: "hy-input-search-item"
84
+ }, _ctx.$attrs, {
85
+ onFocus: onSearchInputHandler,
86
+ onBlur: onSearchBlurHandler,
87
+ onClear: onSearchQueryHandler,
88
+ onKeydown: withKeys(onSearchQueryHandler, ["enter"])
89
+ }), createSlots({
90
+ _: 2
91
+ /* DYNAMIC */
92
+ }, [
93
+ renderList(_ctx.$slots, (_, slotName) => {
94
+ return {
95
+ name: slotName,
96
+ fn: withCtx((scope) => [
97
+ renderSlot(_ctx.$slots, slotName, normalizeProps(guardReactiveProps(scope)))
98
+ ])
99
+ };
100
+ })
101
+ ]), 1040, ["modelValue", "onUpdate:modelValue"]),
102
+ createElementVNode("div", {
103
+ class: "w-[32px] h-[32px] flex-shrink-0 flex items-center justify-center bg-background-3 rounded-[2px] cursor-pointer",
104
+ onClick: onSearchQueryHandler
105
+ }, [
106
+ createVNode(unref(ElIcon), { size: "18" }, {
107
+ default: withCtx(() => [
108
+ createVNode(unref(Search))
109
+ ]),
110
+ _: 1
111
+ /* STABLE */
112
+ })
113
+ ])
114
+ ],
115
+ 2
116
+ /* CLASS */
117
+ );
118
+ };
119
+ }
120
+ });
121
+
122
+ export { _sfc_main as default };
@@ -0,0 +1,39 @@
1
+ .hy-input-search {
2
+ width: 100%;
3
+ min-width: 160px;
4
+ display: flex;
5
+ align-items: center;
6
+ gap: 4px;
7
+ border: 1px solid rgba(var(--hy-border));
8
+ border-radius: 4px;
9
+ box-sizing: border-box;
10
+ padding: 2px 4px;
11
+ overflow: hidden;
12
+ background: rgba(var(--hy-background-2));
13
+ &:hover,
14
+ &.focus {
15
+ border: 1px solid rgba(var(--hy-theme));
16
+ }
17
+
18
+ .hy-input-search-item {
19
+ width: 0;
20
+ flex: 1;
21
+ & > .hy-el-input__wrapper {
22
+ padding-left: 8px;
23
+ padding-right: 4px;
24
+ }
25
+ .hy-el-input__inner::placeholder {
26
+ font-size: 12px;
27
+ }
28
+ .hy-el-input__wrapper {
29
+ box-shadow: none;
30
+ }
31
+ .hy-el-input-group__append {
32
+ color: rgb(var(--hy-main));
33
+ background-color: rgba(var(--hy-background-2));
34
+ box-shadow: none;
35
+ padding: 4px;
36
+ min-height: 100%;
37
+ }
38
+ }
39
+ }
@@ -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;