@vunk/plus 1.1.0 → 1.1.2

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.
@@ -1,6 +1,7 @@
1
1
  import { computed, ref, watch, inject, isVNode, Comment, Fragment, shallowRef, watchEffect, provide, onBeforeUnmount, onBeforeMount, toRef, defineComponent, h, createVNode, resolveComponent, openBlock, createBlock, withCtx, mergeProps, toHandlers } from 'vue';
2
2
  import { _VkTabelsV1Ctx, VkTablesV1 } from '@vunk/plus/components/tables-v1';
3
3
  import { VkCheckRecordLogicProvider, VkCheckRecordLogic } from '@vunk/core';
4
+ import { noop } from '@vunk/shared/function';
4
5
  import { ElCheckbox } from 'element-plus';
5
6
  import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
6
7
 
@@ -3942,6 +3943,27 @@ const props = {
3942
3943
  selectionHidden: {
3943
3944
  type: Boolean,
3944
3945
  default: false
3946
+ },
3947
+ /**
3948
+ * check触发方式
3949
+ */
3950
+ checkTrigger: {
3951
+ type: String,
3952
+ default: "check"
3953
+ },
3954
+ /**
3955
+ * 同 TableV1 disabled, 用于控制分页组件是否禁用
3956
+ */
3957
+ paginationDisabled: {
3958
+ type: Boolean,
3959
+ default: false
3960
+ },
3961
+ /**
3962
+ * 是否只读
3963
+ */
3964
+ readonly: {
3965
+ type: Boolean,
3966
+ default: false
3945
3967
  }
3946
3968
  };
3947
3969
  const emits = {
@@ -3967,8 +3989,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
3967
3989
  setup(props2, {
3968
3990
  emit
3969
3991
  }) {
3970
- const coreProps = _VkTabelsV1Ctx.createBindProps(props2, ["columns"]);
3971
- const coreEmits = _VkTabelsV1Ctx.createOnEmits(emit);
3992
+ const coreProps = _VkTabelsV1Ctx.createBindProps(props2, ["columns", "disabled"]);
3993
+ const coreEmits = _VkTabelsV1Ctx.createOnEmits(emit, ["row-click"]);
3994
+ const theDisabled = computed(() => props2.disabled || props2.readonly);
3972
3995
  const getCurrentPageCheckInfo = () => {
3973
3996
  const oidField = props2.oidField;
3974
3997
  const allCheckedId = props2.modelValue.map(d => d[oidField]);
@@ -4004,6 +4027,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
4004
4027
  }));
4005
4028
  }
4006
4029
  }
4030
+ const changeEvents = {};
4007
4031
  const checkboxCol = {
4008
4032
  prop: void 0,
4009
4033
  label: "",
@@ -4019,15 +4043,21 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
4019
4043
  toggle,
4020
4044
  isActive
4021
4045
  }) => {
4022
- const onChange = props2.multiple ? toggle : () => singleChange(e.row);
4046
+ const onChange = theDisabled.value ? noop : props2.multiple ? toggle : () => singleChange(e.row);
4047
+ changeEvents[e.row[props2.oidField]] = onChange;
4048
+ const checkHandler = () => {
4049
+ if (props2.checkTrigger === "check") {
4050
+ onChange();
4051
+ }
4052
+ };
4023
4053
  return props2.multiple ? createVNode(ElCheckbox, {
4024
- "disabled": props2.disabled,
4054
+ "disabled": theDisabled.value,
4025
4055
  "modelValue": isActive,
4026
- "onChange": onChange
4056
+ "onChange": checkHandler
4027
4057
  }, null) : createVNode(NRadio, {
4028
- "disabled": props2.disabled,
4058
+ "disabled": theDisabled.value,
4029
4059
  "checked": isActive,
4030
- "onUpdate:checked": onChange,
4060
+ "onUpdate:checked": checkHandler,
4031
4061
  "theme-overrides": radioThemeOverrides
4032
4062
  }, null);
4033
4063
  }
@@ -4047,10 +4077,19 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
4047
4077
  }
4048
4078
  }
4049
4079
  };
4080
+ function handleRowClick(...e) {
4081
+ const [row] = e;
4082
+ if (props2.checkTrigger === "rowClick") {
4083
+ const id = row[props2.oidField];
4084
+ changeEvents[id]?.();
4085
+ }
4086
+ emit("row-click", ...e);
4087
+ }
4050
4088
  return {
4051
4089
  coreProps,
4052
4090
  coreEmits,
4053
- checkboxCol
4091
+ checkboxCol,
4092
+ handleRowClick
4054
4093
  };
4055
4094
  }
4056
4095
  });
@@ -4072,8 +4111,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
4072
4111
  columns: [
4073
4112
  _ctx.selectionHidden ? { hidden: true } : _ctx.checkboxCol,
4074
4113
  ..._ctx.columns
4075
- ]
4076
- }, toHandlers(_ctx.coreEmits)), null, 16, ["columns"])
4114
+ ],
4115
+ disabled: _ctx.paginationDisabled,
4116
+ onRowClick: _ctx.handleRowClick
4117
+ }, toHandlers(_ctx.coreEmits)), null, 16, ["columns", "disabled", "onRowClick"])
4077
4118
  ]),
4078
4119
  _: 1
4079
4120
  /* STABLE */
@@ -38,10 +38,33 @@ export declare const props: {
38
38
  type: BooleanConstructor;
39
39
  default: boolean;
40
40
  };
41
- border: {
41
+ /**
42
+ * check触发方式
43
+ */
44
+ checkTrigger: {
45
+ type: PropType<"check" | "rowClick">;
46
+ default: string;
47
+ };
48
+ /**
49
+ * 同 TableV1 disabled, 用于控制分页组件是否禁用
50
+ */
51
+ paginationDisabled: {
52
+ type: BooleanConstructor;
53
+ default: boolean;
54
+ };
55
+ /**
56
+ * 是否只读
57
+ */
58
+ readonly: {
42
59
  type: BooleanConstructor;
43
60
  default: boolean;
44
61
  };
62
+ border: {
63
+ type: BooleanConstructor;
64
+ default: boolean;
65
+ }; /**
66
+ * 是否只读
67
+ */
45
68
  tableClass: {
46
69
  type: StringConstructor;
47
70
  default: string;
@@ -20,6 +20,18 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
20
20
  type: BooleanConstructor;
21
21
  default: boolean;
22
22
  };
23
+ checkTrigger: {
24
+ type: import("vue").PropType<"check" | "rowClick">;
25
+ default: string;
26
+ };
27
+ paginationDisabled: {
28
+ type: BooleanConstructor;
29
+ default: boolean;
30
+ };
31
+ readonly: {
32
+ type: BooleanConstructor;
33
+ default: boolean;
34
+ };
23
35
  border: {
24
36
  type: BooleanConstructor;
25
37
  default: boolean;
@@ -229,7 +241,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
229
241
  size: import("element-plus").ButtonType<StringConstructor, "" | "small" | "default" | "large", never>;
230
242
  index: number | ((index: number) => number);
231
243
  popperClass: string;
232
- disabled: boolean;
233
244
  teleported: import("element-plus").ButtonType<BooleanConstructor, unknown, unknown>;
234
245
  renderHeader: (data: {
235
246
  column: import("element-plus").TableColumnCtx<any>;
@@ -331,8 +342,35 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
331
342
  modules: "pagination"[];
332
343
  elRef: import("@vunk/core").AnyFunc;
333
344
  }>;
334
- coreEmits: {};
345
+ coreEmits: {
346
+ change: (val: number) => void;
347
+ scroll: (val: number) => void;
348
+ select: (val: number) => void;
349
+ "select-all": (val: number) => void;
350
+ "expand-change": (val: number) => void;
351
+ "current-change": (val: number) => void;
352
+ "selection-change": (val: number) => void;
353
+ "cell-mouse-enter": (val: number) => void;
354
+ "cell-mouse-leave": (val: number) => void;
355
+ "cell-contextmenu": (val: number) => void;
356
+ "cell-click": (val: number) => void;
357
+ "cell-dblclick": (val: number) => void;
358
+ "row-contextmenu": (val: number) => void;
359
+ "row-dblclick": (val: number) => void;
360
+ "header-click": (val: number) => void;
361
+ "header-contextmenu": (val: number) => void;
362
+ "sort-change": (val: number) => void;
363
+ "filter-change": (val: number) => void;
364
+ "header-dragend": (val: number) => void;
365
+ "update:start": (val: number) => void;
366
+ "update:current-page": (val: number) => void;
367
+ "update:page-size": (val: number) => void;
368
+ "size-change": (val: number) => void;
369
+ "prev-click": (val: number) => void;
370
+ "next-click": (val: number) => void;
371
+ };
335
372
  checkboxCol: __VkTablesV1.Column<any>;
373
+ handleRowClick: (...e: any[]) => void;
336
374
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
337
375
  'update:modelValue': (val: any[]) => boolean;
338
376
  'update:start': (val: number) => boolean;
@@ -382,6 +420,18 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
382
420
  type: BooleanConstructor;
383
421
  default: boolean;
384
422
  };
423
+ checkTrigger: {
424
+ type: import("vue").PropType<"check" | "rowClick">;
425
+ default: string;
426
+ };
427
+ paginationDisabled: {
428
+ type: BooleanConstructor;
429
+ default: boolean;
430
+ };
431
+ readonly: {
432
+ type: BooleanConstructor;
433
+ default: boolean;
434
+ };
385
435
  border: {
386
436
  type: BooleanConstructor;
387
437
  default: boolean;
@@ -663,6 +713,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
663
713
  oidField: string;
664
714
  multiple: boolean;
665
715
  selectionHidden: boolean;
716
+ checkTrigger: "check" | "rowClick";
717
+ paginationDisabled: boolean;
718
+ readonly: boolean;
666
719
  }, {}, {
667
720
  VkCheckRecordLogicProvider: import("vue").DefineComponent<{
668
721
  modelValue: {
@@ -0,0 +1,18 @@
1
+ export declare const useElBreakpoints: () => {
2
+ breakpoints: Record<"sm" | "md" | "lg" | "xl", import("vue").Ref<boolean, boolean>> & {
3
+ greaterOrEqual: (k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">) => import("vue").Ref<boolean, boolean>;
4
+ smallerOrEqual: (k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">) => import("vue").Ref<boolean, boolean>;
5
+ greater(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): import("vue").Ref<boolean, boolean>;
6
+ smaller(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): import("vue").Ref<boolean, boolean>;
7
+ between(a: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">, b: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): import("vue").Ref<boolean, boolean>;
8
+ isGreater(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): boolean;
9
+ isGreaterOrEqual(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): boolean;
10
+ isSmaller(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): boolean;
11
+ isSmallerOrEqual(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): boolean;
12
+ isInBetween(a: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">, b: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): boolean;
13
+ current: () => import("vue").ComputedRef<string[]>;
14
+ active(): import("vue").ComputedRef<string>;
15
+ };
16
+ isMobile: import("vue").Ref<boolean, boolean>;
17
+ isDesktop: import("vue").Ref<boolean, boolean>;
18
+ };
@@ -0,0 +1,19 @@
1
+ import { useBreakpoints } from '@vueuse/core';
2
+
3
+ const useElBreakpoints = () => {
4
+ const breakpoints = useBreakpoints({
5
+ sm: 768,
6
+ md: 992,
7
+ lg: 1200,
8
+ xl: 1920
9
+ });
10
+ const isMobile = breakpoints.smaller("lg");
11
+ const isDesktop = breakpoints.greaterOrEqual("lg");
12
+ return {
13
+ breakpoints,
14
+ isMobile,
15
+ isDesktop
16
+ };
17
+ };
18
+
19
+ export { useElBreakpoints };
@@ -1,18 +0,0 @@
1
- export declare const useElBreakpoints: () => {
2
- breakpoints: Record<"sm" | "md" | "lg" | "xl", import("vue").Ref<boolean, boolean>> & {
3
- greaterOrEqual: (k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">) => import("vue").Ref<boolean, boolean>;
4
- smallerOrEqual: (k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">) => import("vue").Ref<boolean, boolean>;
5
- greater(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): import("vue").Ref<boolean, boolean>;
6
- smaller(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): import("vue").Ref<boolean, boolean>;
7
- between(a: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">, b: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): import("vue").Ref<boolean, boolean>;
8
- isGreater(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): boolean;
9
- isGreaterOrEqual(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): boolean;
10
- isSmaller(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): boolean;
11
- isSmallerOrEqual(k: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): boolean;
12
- isInBetween(a: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">, b: import("@vueuse/shared").MaybeRefOrGetter<"sm" | "md" | "lg" | "xl">): boolean;
13
- current: () => import("vue").ComputedRef<string[]>;
14
- active(): import("vue").ComputedRef<string>;
15
- };
16
- isMobile: import("vue").Ref<boolean, boolean>;
17
- isDesktop: import("vue").Ref<boolean, boolean>;
18
- };
@@ -1,19 +1 @@
1
- import { useBreakpoints } from '@vueuse/core';
2
1
 
3
- const useElBreakpoints = () => {
4
- const breakpoints = useBreakpoints({
5
- sm: 768,
6
- md: 992,
7
- lg: 1200,
8
- xl: 1920
9
- });
10
- const isMobile = breakpoints.smaller("lg");
11
- const isDesktop = breakpoints.greaterOrEqual("lg");
12
- return {
13
- breakpoints,
14
- isMobile,
15
- isDesktop
16
- };
17
- };
18
-
19
- export { useElBreakpoints };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vunk/plus",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -31,6 +31,10 @@
31
31
  "import": "./composables/index.mjs",
32
32
  "types": "./composables/index.d.ts"
33
33
  },
34
+ "./composables/el-breakpoints": {
35
+ "import": "./composables/el-breakpoints/index.mjs",
36
+ "types": "./composables/el-breakpoints/index.d.ts"
37
+ },
34
38
  "./components/vditor": {
35
39
  "import": "./components/vditor/index.mjs",
36
40
  "types": "./components/vditor/index.d.ts"