hy-dispatch-ui-v3 0.1.2 → 0.1.3

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 (52) hide show
  1. package/dist/tailwind.css +16 -0
  2. package/es/components/appButton/appButton.vue.mjs +4 -4
  3. package/es/components/appButton/style/appButton.scss +4 -4
  4. package/es/components/appForm/appForm.vue.mjs +17 -3
  5. package/es/components/appForm/js/useAppForm.mjs +15 -1
  6. package/es/components/appIcon/style/appIcon.scss +2 -2
  7. package/es/components/appNoPermissions/appNoPermissions.vue.mjs +48 -0
  8. package/es/components/appNoPermissions/index.mjs +6 -0
  9. package/es/components/appNoPermissions/style/appNoPermissions.scss +0 -0
  10. package/es/components/appNoPermissionsMap/appNoPermissionsMap.vue.mjs +50 -0
  11. package/es/components/appNoPermissionsMap/index.mjs +6 -0
  12. package/es/components/appNoPermissionsMap/style/appNoPermissionsMap.scss +0 -0
  13. package/es/components/appOrgCascader/appOrgCascader.vue.mjs +1 -1
  14. package/es/components/appSearch/appSearch.vue.mjs +22 -6
  15. package/es/components/appSearch/js/index.mjs +12 -3
  16. package/es/components/appSearch/js/useAppSearch.mjs +12 -1
  17. package/es/components/appTable/appTable.vue.mjs +23 -6
  18. package/es/components/appTable/js/index.mjs +21 -6
  19. package/es/components/appTable/js/search.mjs +0 -3
  20. package/es/components/appTable/js/useAppTable.mjs +17 -1
  21. package/es/components/index.mjs +2 -0
  22. package/es/index.mjs +2 -0
  23. package/es/locale/en.mjs +9 -0
  24. package/es/locale/zh_CN.mjs +10 -1
  25. package/es/style/index.scss +0 -2
  26. package/es/version.mjs +1 -1
  27. package/lib/components/appButton/appButton.vue.js +4 -4
  28. package/lib/components/appButton/style/appButton.scss +4 -4
  29. package/lib/components/appForm/appForm.vue.js +17 -3
  30. package/lib/components/appForm/js/useAppForm.js +15 -1
  31. package/lib/components/appIcon/style/appIcon.scss +2 -2
  32. package/lib/components/appNoPermissions/appNoPermissions.vue.js +52 -0
  33. package/lib/components/appNoPermissions/index.js +11 -0
  34. package/lib/components/appNoPermissions/style/appNoPermissions.scss +0 -0
  35. package/lib/components/appNoPermissionsMap/appNoPermissionsMap.vue.js +54 -0
  36. package/lib/components/appNoPermissionsMap/index.js +11 -0
  37. package/lib/components/appNoPermissionsMap/style/appNoPermissionsMap.scss +0 -0
  38. package/lib/components/appOrgCascader/appOrgCascader.vue.js +1 -1
  39. package/lib/components/appSearch/appSearch.vue.js +23 -7
  40. package/lib/components/appSearch/js/index.js +12 -2
  41. package/lib/components/appSearch/js/useAppSearch.js +12 -1
  42. package/lib/components/appTable/appTable.vue.js +22 -5
  43. package/lib/components/appTable/js/index.js +21 -6
  44. package/lib/components/appTable/js/search.js +0 -3
  45. package/lib/components/appTable/js/useAppTable.js +17 -1
  46. package/lib/components/index.js +14 -10
  47. package/lib/index.js +14 -10
  48. package/lib/locale/en.js +9 -0
  49. package/lib/locale/zh_CN.js +10 -1
  50. package/lib/style/index.scss +0 -2
  51. package/lib/version.js +1 -1
  52. package/package.json +11 -1
package/dist/tailwind.css CHANGED
@@ -680,6 +680,10 @@ video {
680
680
  margin-top: 10px;
681
681
  }
682
682
 
683
+ .mt-\[12px\] {
684
+ margin-top: 12px;
685
+ }
686
+
683
687
  .box-border {
684
688
  box-sizing: border-box;
685
689
  }
@@ -712,6 +716,10 @@ video {
712
716
  height: 0.75rem !important;
713
717
  }
714
718
 
719
+ .\!h-\[46px\] {
720
+ height: 46px !important;
721
+ }
722
+
715
723
  .h-0 {
716
724
  height: 0px;
717
725
  }
@@ -748,6 +756,10 @@ video {
748
756
  width: 0.75rem !important;
749
757
  }
750
758
 
759
+ .\!w-\[46px\] {
760
+ width: 46px !important;
761
+ }
762
+
751
763
  .w-0 {
752
764
  width: 0px;
753
765
  }
@@ -949,6 +961,10 @@ video {
949
961
  background-color: rgb(var(--hy-background), var(--tw-bg-opacity, 1)) !important;
950
962
  }
951
963
 
964
+ .bg-\[rgba\(var\(--hy-theme\)\2c 0\.2\)\] {
965
+ background-color: rgba(var(--hy-theme),0.2);
966
+ }
967
+
952
968
  .bg-background-2 {
953
969
  --tw-bg-opacity: 1;
954
970
  background-color: rgb(var(--hy-background-2), var(--tw-bg-opacity, 1));
@@ -38,10 +38,10 @@ const _sfc_main = {
38
38
  setup(__props, { emit: __emit }) {
39
39
  const props = __props;
40
40
  const typeObj = {
41
- default: "button_default",
42
- primary: "button_function",
43
- success: "button_addTo",
44
- danger: "button_delete"
41
+ default: "hy-button_default",
42
+ primary: "hy-button_function",
43
+ success: "hy-button_addTo",
44
+ danger: "hy-button_delete"
45
45
  };
46
46
  const emit = __emit;
47
47
  const handleClick = (event) => {
@@ -32,7 +32,7 @@
32
32
  }
33
33
  }
34
34
 
35
- .button_default {
35
+ .hy-button_default {
36
36
  background: rgba(94, 157, 180, 0.32);
37
37
 
38
38
  .hy-button__border {
@@ -96,7 +96,7 @@
96
96
  }
97
97
  }
98
98
 
99
- .button_function {
99
+ .hy-button_function {
100
100
  background: rgba(45, 242, 255, 0.32);
101
101
 
102
102
  .hy-button__border {
@@ -160,7 +160,7 @@
160
160
  }
161
161
  }
162
162
 
163
- .button_addTo {
163
+ .hy-button_addTo {
164
164
  background: rgba(44, 232, 152, 0.32);
165
165
 
166
166
  .hy-button__border {
@@ -224,7 +224,7 @@
224
224
  }
225
225
  }
226
226
 
227
- .button_delete {
227
+ .hy-button_delete {
228
228
  background: rgba(255, 77, 77, 0.32);
229
229
 
230
230
  .hy-button__border {
@@ -1,7 +1,8 @@
1
1
  import { defineComponent, useTemplateRef, computed, nextTick, unref, openBlock, createBlock, mergeProps, withCtx, createElementVNode, normalizeStyle, createCommentVNode, createElementBlock, Fragment, renderList, renderSlot, toDisplayString, createVNode, createTextVNode } from 'vue';
2
2
  import { ElForm, ElFormItem, ElPopover, ElInput, ElSelect, ElRadioGroup, ElCheckboxGroup } from 'element-plus';
3
3
  import { AppIcon } from '../appIcon/index.mjs';
4
- import _sfc_main$1 from '../appDatePicker/appDatePicker.vue.mjs';
4
+ import { AppDatePicker } from '../appDatePicker/index.mjs';
5
+ import { AppOrgCascader } from '../appOrgCascader/index.mjs';
5
6
  import { columnShowHandler, columnItemStyle, isRequired, renderText, isDisabled } from './js/index.mjs';
6
7
  import { resetAppFormValue } from './js/useAppForm.mjs';
7
8
  import { useLocale } from '../../hooks/useLocale.mjs';
@@ -247,7 +248,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
247
248
  "daterange",
248
249
  "monthrange",
249
250
  "yearrange"
250
- ].includes((_a = column.attrs) == null ? void 0 : _a.type) && unref(isArray)(column.field) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({
251
+ ].includes((_a = column.attrs) == null ? void 0 : _a.type) && unref(isArray)(column.field) ? (openBlock(), createBlock(unref(AppDatePicker), mergeProps({
251
252
  key: 0,
252
253
  start: __props.model[column.field[0]],
253
254
  "onUpdate:start": ($event) => __props.model[column.field[0]] = $event,
@@ -257,7 +258,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
257
258
  style: { "width": "100%" }
258
259
  }, { ref_for: true }, column.attrs, {
259
260
  disabled: unref(isDisabled)(props, column)
260
- }), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled"])) : (openBlock(), createBlock(_sfc_main$1, mergeProps({
261
+ }), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled"])) : (openBlock(), createBlock(unref(AppDatePicker), mergeProps({
261
262
  key: 1,
262
263
  modelValue: __props.model[column.field],
263
264
  "onUpdate:modelValue": ($event) => __props.model[column.field] = $event,
@@ -295,6 +296,19 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
295
296
  ],
296
297
  2112
297
298
  /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
299
+ )) : column.type === "org-cascader" ? (openBlock(), createElementBlock(
300
+ Fragment,
301
+ { key: 6 },
302
+ [
303
+ createCommentVNode(" \u90E8\u95E8\u7EA7\u8054\u9009\u62E9\u6846 "),
304
+ createVNode(unref(AppOrgCascader), mergeProps({
305
+ modelValue: __props.model[column.field],
306
+ "onUpdate:modelValue": ($event) => __props.model[column.field] = $event,
307
+ disabled: unref(isDisabled)(props, column)
308
+ }, { ref_for: true }, column.attrs), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])
309
+ ],
310
+ 2112
311
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
298
312
  )) : createCommentVNode("v-if", true)
299
313
  ],
300
314
  64
@@ -4,6 +4,15 @@ import { getDefaultValueFormatByType } from '../../../utils/date.mjs';
4
4
  import { useLocale } from '../../../hooks/useLocale.mjs';
5
5
  import { isArray } from '../../../utils/is.mjs';
6
6
 
7
+ const genDefaultLabel = (config) => {
8
+ if (config.label) return config.label;
9
+ const { t } = useLocale();
10
+ switch (config.type) {
11
+ // 部门级联选择框
12
+ case "org-cascader":
13
+ return t("form.department");
14
+ }
15
+ };
7
16
  const genPlaceholderHandler = (config) => {
8
17
  const { t } = useLocale();
9
18
  const { type, label, attrs = {} } = config || {};
@@ -11,8 +20,10 @@ const genPlaceholderHandler = (config) => {
11
20
  switch (type) {
12
21
  case "input":
13
22
  placeholder = placeholder || t("hy.pleaseEnterPlaceholder", [label]);
23
+ break;
14
24
  case "select":
15
25
  placeholder = placeholder || t("hy.pleaseSelectPlaceholder", [label]);
26
+ break;
16
27
  case "date-picker":
17
28
  if (["datetimerange", "daterange", "monthrange", "yearrange"].includes(
18
29
  attrs == null ? void 0 : attrs.type
@@ -38,6 +49,7 @@ const genPlaceholderHandler = (config) => {
38
49
  } else {
39
50
  placeholder = placeholder || t("hy.pleaseSelectPlaceholder", [label]);
40
51
  }
52
+ break;
41
53
  default:
42
54
  placeholder = placeholder || label;
43
55
  }
@@ -72,13 +84,15 @@ const rulesHandler = (config) => {
72
84
  return rules;
73
85
  };
74
86
  function appFormItemHandler(column = {}) {
75
- const { placeholder, startPlaceholder, endPlaceholder } = genPlaceholderHandler(column);
87
+ const label = genDefaultLabel(column);
88
+ const { placeholder, startPlaceholder, endPlaceholder } = genPlaceholderHandler({ ...column, label });
76
89
  const attrs = { ...column.attrs || {}, placeholder };
77
90
  column = mergeDeep(
78
91
  { ...column },
79
92
  {
80
93
  key: /* @__PURE__ */ Symbol("appFormItemKey"),
81
94
  field: column.prop,
95
+ label,
82
96
  readonly: column.readonly || false,
83
97
  rules: rulesHandler(column)
84
98
  }
@@ -1,8 +1,8 @@
1
1
  .app-icon {
2
2
  width: 16px;
3
3
  height: 16px;
4
- vertical-align: -0.15em;
5
- stroke: currentColor;
4
+ vertical-align: -0.1em;
5
+ display: inline-block;
6
6
  overflow: hidden;
7
7
  fill: currentColor;
8
8
  outline: none;
@@ -0,0 +1,48 @@
1
+ import { defineComponent, openBlock, createElementBlock, createVNode, unref, createElementVNode, toDisplayString } from 'vue';
2
+ import { AppIcon } from '../appIcon/index.mjs';
3
+ import { useLocale } from '../../hooks/useLocale.mjs';
4
+
5
+ import "./style/appNoPermissions.scss";
6
+
7
+ const __default__ = defineComponent({
8
+ name: "AppNoPermissions"
9
+ });
10
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
11
+ props: {
12
+ svgName: {
13
+ type: String,
14
+ default: "2-v3-base-no-data-noData"
15
+ }
16
+ },
17
+ emits: [],
18
+ setup(__props, { expose: __expose, emit: __emit }) {
19
+ const { t } = useLocale();
20
+ __expose({});
21
+ return (_ctx, _cache) => {
22
+ return openBlock(), createElementBlock("div", { class: "w-full h-full bg-background-2 text-auxiliary text-base flex flex-col items-center justify-center" }, [
23
+ createVNode(unref(AppIcon), {
24
+ "svg-name": __props.svgName,
25
+ "class-name": "!w-[46px] !h-[46px]"
26
+ }, null, 8, ["svg-name"]),
27
+ createElementVNode("div", { class: "text-center mt-[12px]" }, [
28
+ createElementVNode(
29
+ "p",
30
+ null,
31
+ toDisplayString(unref(t)("permissino.youDoNotHaveSubordinatePermissionsForThisModule")),
32
+ 1
33
+ /* TEXT */
34
+ ),
35
+ createElementVNode(
36
+ "p",
37
+ null,
38
+ toDisplayString(unref(t)("permissino.pleaseContactTheAdministrator")),
39
+ 1
40
+ /* TEXT */
41
+ )
42
+ ])
43
+ ]);
44
+ };
45
+ }
46
+ });
47
+
48
+ export { _sfc_main as default };
@@ -0,0 +1,6 @@
1
+ import _sfc_main from './appNoPermissions.vue.mjs';
2
+ import { withInstall } from '../../utils/handler.mjs';
3
+
4
+ const AppNoPermissions = withInstall(_sfc_main);
5
+
6
+ export { AppNoPermissions, AppNoPermissions as default };
@@ -0,0 +1,50 @@
1
+ import { defineComponent, openBlock, createElementBlock, createVNode, unref, createElementVNode, toDisplayString } from 'vue';
2
+ import { AppIcon } from '../appIcon/index.mjs';
3
+ import { useLocale } from '../../hooks/useLocale.mjs';
4
+
5
+ import "./style/appNoPermissionsMap.scss";
6
+
7
+ const __default__ = defineComponent({
8
+ name: "AppNoPermissionsMap"
9
+ });
10
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
11
+ props: {
12
+ svgName: {
13
+ type: String,
14
+ default: "2-v3-base-no-data-noData"
15
+ }
16
+ },
17
+ emits: [],
18
+ setup(__props, { expose: __expose, emit: __emit }) {
19
+ const { t } = useLocale();
20
+ __expose({});
21
+ return (_ctx, _cache) => {
22
+ return openBlock(), createElementBlock("div", { class: "w-full h-full bg-background-2 text-auxiliary text-base flex flex-col items-center justify-center" }, [
23
+ createVNode(unref(AppIcon), {
24
+ "svg-name": __props.svgName,
25
+ "class-name": "!w-[46px] !h-[46px]"
26
+ }, null, 8, ["svg-name"]),
27
+ createElementVNode("div", { class: "text-center mt-[12px]" }, [
28
+ createElementVNode(
29
+ "p",
30
+ null,
31
+ toDisplayString(unref(t)("permissino.youDoNotHaveAMapConfigurationForThisModule")),
32
+ 1
33
+ /* TEXT */
34
+ ),
35
+ createElementVNode(
36
+ "p",
37
+ null,
38
+ toDisplayString(unref(t)(
39
+ "permissino.pleaseContactTheAdministratorToGoToTheSettingsCenterForConfiguration"
40
+ )),
41
+ 1
42
+ /* TEXT */
43
+ )
44
+ ])
45
+ ]);
46
+ };
47
+ }
48
+ });
49
+
50
+ export { _sfc_main as default };
@@ -0,0 +1,6 @@
1
+ import _sfc_main from './appNoPermissionsMap.vue.mjs';
2
+ import { withInstall } from '../../utils/handler.mjs';
3
+
4
+ const AppNoPermissionsMap = withInstall(_sfc_main);
5
+
6
+ export { AppNoPermissionsMap, AppNoPermissionsMap as default };
@@ -66,7 +66,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
66
66
  changeLastLayer: {
67
67
  type: Boolean,
68
68
  default: () => {
69
- return false;
69
+ return true;
70
70
  }
71
71
  }
72
72
  }, {
@@ -1,8 +1,9 @@
1
1
  import { defineComponent, useTemplateRef, computed, unref, onUnmounted, openBlock, createElementBlock, normalizeClass, createElementVNode, createVNode, withCtx, toDisplayString, Fragment, createCommentVNode, normalizeStyle, mergeProps, renderList, createBlock, renderSlot, withKeys } from 'vue';
2
2
  import { ElIcon, ElForm, ElFormItem, ElInput, ElSelect } from 'element-plus';
3
3
  import { Filter, ArrowDown } from '@element-plus/icons-vue';
4
- import _sfc_main$1 from '../appDatePicker/appDatePicker.vue.mjs';
5
- import { useShrink, isEmptyValue, columnShowHandler, columnItemStyle, columnItemInputStyle, isDisabled, timeRangeHandler } from './js/index.mjs';
4
+ import { AppDatePicker } from '../appDatePicker/index.mjs';
5
+ import { AppOrgCascader } from '../appOrgCascader/index.mjs';
6
+ import { useShrink, isEmptyValue, columnShowHandler, columnItemStyle, columnItemInputStyle, isDisabled, isSelectedTimeRange, timeRangeHandler } from './js/index.mjs';
6
7
  import { resetAppSearchValue } from './js/useAppSearch.mjs';
7
8
  import { useLocale } from '../../hooks/useLocale.mjs';
8
9
  import { isArray } from '../../utils/is.mjs';
@@ -310,7 +311,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
310
311
  "daterange",
311
312
  "monthrange",
312
313
  "yearrange"
313
- ].includes((_a = column.attrs) == null ? void 0 : _a.type) && unref(isArray)(column.field) ? (openBlock(), createBlock(_sfc_main$1, mergeProps({
314
+ ].includes((_a = column.attrs) == null ? void 0 : _a.type) && unref(isArray)(column.field) ? (openBlock(), createBlock(unref(AppDatePicker), mergeProps({
314
315
  key: 0,
315
316
  start: __props.model[column.field[0]],
316
317
  "onUpdate:start": ($event) => __props.model[column.field[0]] = $event,
@@ -322,7 +323,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
322
323
  disabled: unref(isDisabled)(props, column),
323
324
  timeRangeFill: column.timeRangeFill,
324
325
  onChange: ($event) => onChangeHandler($event, column)
325
- }), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled", "timeRangeFill", "onChange"])) : (openBlock(), createBlock(_sfc_main$1, mergeProps({
326
+ }), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled", "timeRangeFill", "onChange"])) : (openBlock(), createBlock(unref(AppDatePicker), mergeProps({
326
327
  key: 1,
327
328
  modelValue: __props.model[column.field],
328
329
  "onUpdate:modelValue": ($event) => __props.model[column.field] = $event,
@@ -336,6 +337,19 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
336
337
  ],
337
338
  64
338
339
  /* STABLE_FRAGMENT */
340
+ )) : column.type === "org-cascader" ? (openBlock(), createElementBlock(
341
+ Fragment,
342
+ { key: 4 },
343
+ [
344
+ createCommentVNode(" \u90E8\u95E8\u7EA7\u8054\u9009\u62E9\u6846 "),
345
+ createVNode(unref(AppOrgCascader), mergeProps({
346
+ modelValue: __props.model[column.field],
347
+ "onUpdate:modelValue": ($event) => __props.model[column.field] = $event,
348
+ disabled: unref(isDisabled)(props, column)
349
+ }, { ref_for: true }, column.attrs), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])
350
+ ],
351
+ 2112
352
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
339
353
  )) : createCommentVNode("v-if", true)
340
354
  ],
341
355
  4
@@ -355,7 +369,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
355
369
  renderList(column.timeRangeOptions, (item, index) => {
356
370
  return openBlock(), createElementBlock("div", {
357
371
  key: index,
358
- class: "border-l border-border px-[10px] cursor-pointer",
372
+ class: normalizeClass(["border-l border-border px-[10px] cursor-pointer", {
373
+ "bg-[rgba(var(--hy-theme),0.2)] text-theme font-bold": unref(isSelectedTimeRange)(column, item, __props.model)
374
+ }]),
359
375
  onClick: ($event) => onTimeRangeClickHandler(column, item)
360
376
  }, [
361
377
  createElementVNode(
@@ -365,7 +381,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
365
381
  1
366
382
  /* TEXT */
367
383
  )
368
- ], 8, ["onClick"]);
384
+ ], 10, ["onClick"]);
369
385
  }),
370
386
  128
371
387
  /* KEYED_FRAGMENT */
@@ -88,9 +88,10 @@ function useShrink(props, templateRef) {
88
88
  }
89
89
  function timeRangeHandler(column, options) {
90
90
  const { value, unit } = options;
91
- const { timeRangeFill, attrs } = column;
92
- const format = attrs.valueFormat || "YYYY-MM-DD";
91
+ let { timeRangeFill, attrs } = column;
92
+ const format = "YYYY-MM-DD";
93
93
  const date = dayjs(Date.now());
94
+ timeRangeFill = timeRangeFill || attrs.type === "datetimerange";
94
95
  switch (unit) {
95
96
  case "year":
96
97
  case "month":
@@ -109,5 +110,13 @@ function timeRangeHandler(column, options) {
109
110
  ];
110
111
  }
111
112
  }
113
+ function isSelectedTimeRange(column, options, model = {}) {
114
+ const [start, end] = timeRangeHandler(column, options);
115
+ const { field } = column;
116
+ if (Array.isArray(field)) {
117
+ return start === model[field[0]] && end === model[field[1]];
118
+ }
119
+ return start === model[field][0] && end === model[field][1];
120
+ }
112
121
 
113
- export { columnItemInputStyle, columnItemStyle, columnShowHandler, isDisabled, isEmptyValue, timeRangeHandler, useShrink };
122
+ export { columnItemInputStyle, columnItemStyle, columnShowHandler, isDisabled, isEmptyValue, isSelectedTimeRange, timeRangeHandler, useShrink };
@@ -4,6 +4,15 @@ import { getDefaultValueFormatByType } from '../../../utils/date.mjs';
4
4
  import { useLocale } from '../../../hooks/useLocale.mjs';
5
5
  import { isNumber } from '../../../utils/is.mjs';
6
6
 
7
+ const genDefaultLabel = (config) => {
8
+ if (config.label) return config.label;
9
+ const { t } = useLocale();
10
+ switch (config.type) {
11
+ // 部门级联选择框
12
+ case "org-cascader":
13
+ return t("form.department");
14
+ }
15
+ };
7
16
  const genPlaceholderHandler = (config) => {
8
17
  const { t } = useLocale();
9
18
  const { type, label, attrs = {} } = config || {};
@@ -94,7 +103,8 @@ const timeRangeOptionsHandler = (config) => {
94
103
  }, []);
95
104
  };
96
105
  function appSearchItemHandler(column = {}) {
97
- const { placeholder, startPlaceholder, endPlaceholder } = genPlaceholderHandler(column);
106
+ const label = genDefaultLabel(column);
107
+ const { placeholder, startPlaceholder, endPlaceholder } = genPlaceholderHandler({ ...column, label });
98
108
  const attrs = {
99
109
  clearable: true,
100
110
  ...column.attrs || {},
@@ -106,6 +116,7 @@ function appSearchItemHandler(column = {}) {
106
116
  {
107
117
  key: /* @__PURE__ */ Symbol("appFormItemKey"),
108
118
  field: column.prop,
119
+ label,
109
120
  readonly: column.readonly || false,
110
121
  width,
111
122
  inputWidth,
@@ -1,4 +1,4 @@
1
- import { defineComponent, useTemplateRef, openBlock, createElementBlock, createCommentVNode, createElementVNode, createBlock, unref, createVNode, withCtx, toDisplayString, withKeys, renderSlot, normalizeClass, mergeProps, Fragment, renderList, withModifiers } from 'vue';
1
+ import { defineComponent, useTemplateRef, openBlock, createElementBlock, createCommentVNode, createElementVNode, createBlock, unref, createVNode, withCtx, toDisplayString, withKeys, renderSlot, normalizeClass, createSlots, renderList, normalizeProps, guardReactiveProps, mergeProps, Fragment, withModifiers } from 'vue';
2
2
  import { ElIcon, ElInput, ElButton, ElTable, ElTableColumn, ElDropdown, ElDropdownMenu, ElDropdownItem, ElPagination } from 'element-plus';
3
3
  import { Filter, Search } from '@element-plus/icons-vue';
4
4
  import { AppTooltip } from '../appTooltip/index.mjs';
@@ -170,9 +170,11 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
170
170
  tableTriggerRef,
171
171
  getSelectedList,
172
172
  setTableRowClassName,
173
+ clearSelection,
174
+ clearSelectedList,
173
175
  onTableRowClickHandler,
174
176
  onTableRowContextmenuHandler,
175
- onTableSelectAllHandler,
177
+ onTableSelectHandler,
176
178
  // useAppTableSearch
177
179
  // 表单查询
178
180
  formModel,
@@ -209,7 +211,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
209
211
  resetFn,
210
212
  getSelectedList,
211
213
  getTotalElements,
212
- getTableDataSource
214
+ getTableDataSource,
215
+ clearSelection,
216
+ clearSelectedList
213
217
  });
214
218
  return (_ctx, _cache) => {
215
219
  return openBlock(), createElementBlock(
@@ -285,7 +289,19 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
285
289
  hidden: !unref(showFilter),
286
290
  class: normalizeClass({ "mb-4": unref(showFilter) }),
287
291
  onSearch: ($event) => unref(getData)(1)
288
- }, null, 8, ["model", "columns", "hidden", "class", "onSearch"])) : createCommentVNode("v-if", true),
292
+ }, createSlots({
293
+ _: 2
294
+ /* DYNAMIC */
295
+ }, [
296
+ renderList(_ctx.$slots, (_, slotName) => {
297
+ return {
298
+ name: slotName,
299
+ fn: withCtx((scope) => [
300
+ renderSlot(_ctx.$slots, slotName, normalizeProps(guardReactiveProps(scope)))
301
+ ])
302
+ };
303
+ })
304
+ ]), 1032, ["model", "columns", "hidden", "class", "onSearch"])) : createCommentVNode("v-if", true),
289
305
  createCommentVNode(" \u4E3B\u5185\u5BB9 "),
290
306
  createElementVNode("div", { class: "h-0 flex-1 flex flex-col border border-border rounded pb-5 overflow-hidden" }, [
291
307
  renderSlot(_ctx.$slots, "table", { data: unref(tableDataSource) }, () => [
@@ -301,7 +317,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
301
317
  style: {
302
318
  "font-size": `${unref(parseRem)(__props.fontSize)}rem`
303
319
  },
304
- onSelectAll: unref(onTableSelectAllHandler),
320
+ onSelect: unref(onTableSelectHandler),
321
+ onSelectAll: unref(onTableSelectHandler),
305
322
  onRowClick: unref(onTableRowClickHandler),
306
323
  onRowContextmenu: unref(onTableRowContextmenuHandler)
307
324
  }, _ctx.$attrs), {
@@ -491,7 +508,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
491
508
  ]),
492
509
  _: 3
493
510
  /* FORWARDED */
494
- }, 16, ["row-key", "data", "show-header", "row-class-name", "class", "style", "onSelectAll", "onRowClick", "onRowContextmenu"])
511
+ }, 16, ["row-key", "data", "show-header", "row-class-name", "class", "style", "onSelect", "onSelectAll", "onRowClick", "onRowContextmenu"])
495
512
  ]),
496
513
  createCommentVNode(" \u5206\u9875 "),
497
514
  __props.showPagination ? (openBlock(), createElementBlock("div", {
@@ -250,13 +250,27 @@ const useAppTableWrapper = (hy) => {
250
250
  emits("on-select-checkbox", selectedList.value, row);
251
251
  }
252
252
  }
253
- function onTableSelectAllHandler(selectList = [], row) {
253
+ function onTableSelectHandler(selectList = [], row) {
254
254
  if (selectList.length === 0 && tableDataSource.value.length === 0) {
255
- tableRef.value.clearSelection();
255
+ clearSelection();
256
256
  }
257
257
  selectedList.value = [...selectList];
258
258
  emits("on-select-checkbox", [...selectList], row);
259
259
  }
260
+ function clearSelectedList(list = []) {
261
+ selectedList.value = list || [];
262
+ clearSelection();
263
+ list.forEach((row) => {
264
+ const item = tableDataSource.value.find(
265
+ (v) => getRowKey(row) === getRowKey(v)
266
+ );
267
+ if (item) {
268
+ tableRef.value.toggleRowSelection(item, true);
269
+ } else {
270
+ tableRef.value.toggleRowSelection(row, true);
271
+ }
272
+ });
273
+ }
260
274
  function setTableRowClassName(obj) {
261
275
  const row = obj.row;
262
276
  let className = [];
@@ -293,12 +307,13 @@ const useAppTableWrapper = (hy) => {
293
307
  selectedList,
294
308
  tableTriggerRef,
295
309
  setTableRowClassName,
296
- onTableSelectAllHandler,
310
+ getSelectedList,
311
+ clearSelection,
312
+ clearSelectedList,
313
+ onTableSelectHandler,
297
314
  onTableRowContextmenuHandler,
298
315
  onTableRowClickHandler,
299
- onTableColumnsSelectHandler,
300
- getSelectedList,
301
- clearSelection
316
+ onTableColumnsSelectHandler
302
317
  };
303
318
  };
304
319
 
@@ -40,13 +40,11 @@ function useAppTableSearch(hy) {
40
40
  unref(api).post(`${props.controller}/page`, params, options).then(successFun).finally(() => {
41
41
  resolve();
42
42
  closeAppTableLoading();
43
- clearSelection();
44
43
  });
45
44
  } else if (props.url) {
46
45
  unref(api).post(props.url, params, options).then(successFun).finally(() => {
47
46
  resolve();
48
47
  closeAppTableLoading();
49
- clearSelection();
50
48
  });
51
49
  } else {
52
50
  closeAppTableLoading();
@@ -59,7 +57,6 @@ function useAppTableSearch(hy) {
59
57
  getData(1);
60
58
  return;
61
59
  }
62
- console.log("res", res);
63
60
  const data = res.data.content ? res.data.content : res.data || [];
64
61
  if (props.beforeDataHandler) {
65
62
  tableDataSource.value = props.beforeDataHandler(data);
@@ -2,6 +2,22 @@ import { toRef } from 'vue';
2
2
  import { isEmpty, isBoolean } from '../../../utils/is.mjs';
3
3
  import { useLocale } from '../../../hooks/useLocale.mjs';
4
4
 
5
+ function getColumnDefaultConfig(column) {
6
+ switch (column.type) {
7
+ case "selection":
8
+ return {
9
+ prop: `${column.type}_prop`,
10
+ reserveSelection: true
11
+ };
12
+ case "index":
13
+ case "expand":
14
+ return {
15
+ prop: `${column.type}_prop`
16
+ };
17
+ default:
18
+ return {};
19
+ }
20
+ }
5
21
  function getColumnDefaultWidth(column) {
6
22
  if (column.width) return column.width;
7
23
  if (column.type === "index") return 80;
@@ -46,7 +62,7 @@ const useAppTable = (config = {}) => {
46
62
  throw Error("\u3010column.prop\u3011\u4E0D\u80FD\u4E3A\u7A7A");
47
63
  }
48
64
  tableColumns.push({
49
- prop: column.prop || column.type !== "default" ? `${column.type}_prop` : column.prop,
65
+ ...getColumnDefaultConfig(column),
50
66
  ...column,
51
67
  type: column.type || "default",
52
68
  width: getColumnDefaultWidth(column),
@@ -10,6 +10,8 @@ export { AppTooltip } from './appTooltip/index.mjs';
10
10
  export { AppConfigProvider } from './appConfigProvider/index.mjs';
11
11
  export { AppButton } from './appButton/index.mjs';
12
12
  export { AppUserAvatar } from './appUserAvatar/index.mjs';
13
+ export { AppNoPermissions } from './appNoPermissions/index.mjs';
14
+ export { AppNoPermissionsMap } from './appNoPermissionsMap/index.mjs';
13
15
  export { useAppForm } from './appForm/js/useAppForm.mjs';
14
16
  export { useAppSearch } from './appSearch/js/useAppSearch.mjs';
15
17
  export { useAppTable } from './appTable/js/useAppTable.mjs';