@wfrog/vc-ui 1.11.15 → 1.11.17

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.
@@ -17,4 +17,5 @@ export interface IButtonProps {
17
17
  msg?: string;
18
18
  };
19
19
  stop?: boolean;
20
+ disabled?: boolean | (() => boolean);
20
21
  }
@@ -21,7 +21,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
21
21
  throttle: { default: 800 },
22
22
  type: { default: "" },
23
23
  confirm: { default: void 0 },
24
- stop: { type: Boolean, default: false }
24
+ stop: { type: Boolean, default: false },
25
+ disabled: { type: [Boolean, Function], default: void 0 }
25
26
  },
26
27
  emits: ["click"],
27
28
  setup(__props, { emit: __emit }) {
@@ -33,6 +34,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
33
34
  const myConfirm = computed(() => buttonConfig?.confirm?.type !== void 0 ? buttonConfig?.confirm?.type : props.confirm?.type !== void 0 ? props.confirm.type : ["danger", "warning"].includes(props.type) ? "messagebox" : void 0);
34
35
  const { name, type: iconType = "el", position = "left" } = props.icon || {};
35
36
  const { msg, title, confirmButtonText, cancelButtonText } = { ...defaultConfirmInfo, ...buttonConfig?.confirm, ...props.confirm };
37
+ const myDisabled = computed(() => {
38
+ if (typeof props.disabled === "function") {
39
+ return props.disabled();
40
+ }
41
+ return formDisabled.value;
42
+ });
36
43
  async function handleComfirm() {
37
44
  try {
38
45
  const result = await ElMessageBox.confirm(msg, title, { confirmButtonText, cancelButtonText, type: "warning", dangerouslyUseHTMLString: true });
@@ -76,7 +83,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
76
83
  __props.stop ? (openBlock(), createBlock(_component_ElButton, mergeProps({ key: 0 }, _ctx.$attrs, {
77
84
  type: __props.type,
78
85
  class: _ctx.$style.button,
79
- disabled: unref(formDisabled),
86
+ disabled: unref(myDisabled),
80
87
  onClick: withModifiers(unref(handleClick), ["stop"])
81
88
  }), {
82
89
  default: withCtx(() => [
@@ -98,7 +105,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
98
105
  }, 16, ["type", "class", "disabled", "onClick"])) : (openBlock(), createBlock(_component_ElButton, mergeProps({ key: 1 }, _ctx.$attrs, {
99
106
  type: __props.type,
100
107
  class: _ctx.$style.button,
101
- disabled: unref(formDisabled),
108
+ disabled: unref(myDisabled),
102
109
  onClick: unref(handleClick)
103
110
  }), {
104
111
  default: withCtx(() => [
@@ -124,7 +131,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
124
131
  key: 1,
125
132
  type: __props.type,
126
133
  class: normalizeClass(_ctx.$style.button),
127
- disabled: unref(formDisabled),
134
+ disabled: unref(myDisabled),
128
135
  onClick: withModifiers(unref(handleClick), ["stop"])
129
136
  }, {
130
137
  default: withCtx(() => [
@@ -147,7 +154,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
147
154
  key: 2,
148
155
  type: __props.type,
149
156
  class: normalizeClass(_ctx.$style.button),
150
- disabled: unref(formDisabled),
157
+ disabled: unref(myDisabled),
151
158
  onClick: unref(handleClick)
152
159
  }, {
153
160
  default: withCtx(() => [
@@ -25,6 +25,7 @@ declare const __VLS_component: import('vue').DefineComponent<IButtonProps, {}, {
25
25
  cancelButtonText?: string;
26
26
  msg?: string;
27
27
  };
28
+ disabled: boolean | (() => boolean);
28
29
  throttle: number;
29
30
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
30
31
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
@@ -18,7 +18,7 @@ export interface IExplorerListProps {
18
18
  highlightCurrent?: boolean;
19
19
  showCheckbox?: boolean;
20
20
  confirmParams?: (item: IExplorerListItem) => IButtonProps['confirm'];
21
- disabled?: boolean;
21
+ disabled?: boolean | ((action: string, item: IExplorerListItem) => boolean);
22
22
  }
23
23
  export interface IExplorerListEmits {
24
24
  (e: 'update:modelValue', value: (string | number)[] | undefined): void;
@@ -20,7 +20,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20
20
  modelValue: {},
21
21
  data: { default: () => [] },
22
22
  actions: { default: () => [] },
23
- filterMethod: {},
23
+ filterMethod: { type: Function, default: (keyword, item) => {
24
+ return item.label.toLowerCase().includes(keyword.toLowerCase());
25
+ } },
24
26
  emptyText: { default: "没有数据" },
25
27
  pending: { type: Boolean },
26
28
  loading: { type: Boolean },
@@ -30,12 +32,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
30
32
  confirmParams: { type: Function, default: (item) => {
31
33
  return { msg: `确定要删除 ${item.label} 吗?` };
32
34
  } },
33
- disabled: { type: Boolean, default: false }
35
+ disabled: { type: [Boolean, Function], default: false }
34
36
  },
35
37
  emits: ["update:modelValue", "valueChange", "itemClick", "create", "modify", "remove", "up", "down"],
36
38
  setup(__props, { expose: __expose, emit: __emit }) {
37
39
  useCssVars((_ctx) => ({
38
- "v42d68eb8": unref(cursorStyle)
40
+ "e1697a4a": unref(cursorStyle)
39
41
  }));
40
42
  const props = __props;
41
43
  const emits = __emit;
@@ -49,11 +51,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
49
51
  up: { title: "上移", type: "success", icon: "Top" },
50
52
  down: { title: "下移", type: "success", icon: "Bottom" }
51
53
  };
52
- const filterMethod = props.filterMethod || ((keyword, item) => {
53
- return item.label.toLowerCase().includes(keyword.toLowerCase());
54
- });
55
54
  const myData = computed(() => {
56
- return filterKeyword.value ? props.data.filter((item) => filterMethod(filterKeyword.value, item)) : props.data;
55
+ return filterKeyword.value ? props.data.filter((item) => props.filterMethod(filterKeyword.value, item)) : props.data;
57
56
  });
58
57
  const isEmpty = computed(() => myData.value.length === 0);
59
58
  const cursorStyle = computed(() => props.highlightCurrent ? "pointer" : "unset");
@@ -64,6 +63,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
64
63
  actived.value = item.value;
65
64
  emits("itemClick", item.value, item, e);
66
65
  }
66
+ const checkboxGroupDisabled = computed(() => {
67
+ if (props.disabled === void 0) {
68
+ return false;
69
+ }
70
+ if (typeof props.disabled === "boolean") {
71
+ return props.disabled;
72
+ }
73
+ return false;
74
+ });
75
+ function myDisabled(action, item) {
76
+ if (typeof props.disabled === "function") {
77
+ return props.disabled(action, item);
78
+ }
79
+ return props.disabled;
80
+ }
67
81
  __expose({
68
82
  setActive: (value) => {
69
83
  actived.value = value;
@@ -82,7 +96,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
82
96
  createVNode(_component_el_checkbox_group, {
83
97
  modelValue: unref(myValue),
84
98
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(myValue) ? myValue.value = $event : null),
85
- disabled: __props.disabled,
99
+ disabled: unref(checkboxGroupDisabled),
86
100
  onChange: _cache[1] || (_cache[1] = (val) => emits("valueChange", val))
87
101
  }, {
88
102
  default: withCtx(() => [
@@ -149,7 +163,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
149
163
  link: "",
150
164
  icon: { type: "el", name: actionsMapping[action].icon },
151
165
  stop: "",
152
- disabled: __props.disabled,
166
+ disabled: myDisabled(action, item),
153
167
  onClick: ($event) => emits(action, item.value, item)
154
168
  }), null, 16, ["confirm", "class", "icon", "disabled", "onClick"]))
155
169
  ], 64);
@@ -49,8 +49,9 @@ declare const __VLS_component: import('vue').DefineComponent<IExplorerListProps,
49
49
  onItemClick?: ((value: string | number, item: IExplorerListItem<any>, event: MouseEvent) => any) | undefined;
50
50
  }>, {
51
51
  data: IExplorerListItem[];
52
- disabled: boolean;
52
+ disabled: boolean | ((action: string, item: IExplorerListItem) => boolean);
53
53
  loadingText: string;
54
+ filterMethod: (keyword: string, item: IExplorerListItem) => boolean;
54
55
  emptyText: string;
55
56
  highlightCurrent: boolean;
56
57
  actions: ("create" | "modify" | "remove" | "up" | "down" | "action")[];
@@ -1,7 +1,7 @@
1
1
  /* source: src/components/explorer-list/explorer-list.vue */
2
2
  ._item_e98ar_1 {
3
3
  padding: 4px 8px;
4
- cursor: var(--v42d68eb8);
4
+ cursor: var(--e1697a4a);
5
5
  display: flex;
6
6
  justify-content: space-between;
7
7
  align-items: center;
@@ -16,6 +16,10 @@ export interface IExplorerTableProps {
16
16
  columnRender?: (column: IColumnConfig, row: Record<string, any>, emits: IExplorerTableEmits, index: number) => VNode;
17
17
  columnConfig?: IColumnConfig[];
18
18
  columnFilter?: (column: IColumnConfig) => boolean;
19
+ rowClassName?: ((data: {
20
+ row: Record<string, any>;
21
+ rowIndex: number;
22
+ }) => string) | string;
19
23
  startIndex?: number;
20
24
  rowKey?: string | ((row: any) => string);
21
25
  }
@@ -29,13 +29,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29
29
  columnRender: { type: Function, default: (column, row) => h("span", row[column.prop]) },
30
30
  columnConfig: {},
31
31
  columnFilter: { type: Function, default: (column) => column.visible !== false },
32
+ rowClassName: {},
32
33
  startIndex: { default: 0 },
33
34
  rowKey: { type: [String, Function], default: "id" }
34
35
  },
35
36
  emits: ["columnEvent", "singleSelectionChange", "multipleSelectionChange", "selectionChange", "selectAll"],
36
37
  setup(__props, { expose: __expose, emit: __emit }) {
37
38
  useCssVars((_ctx) => ({
38
- "v251be0d8": `${_ctx.empty ? "flex" : "none"}`
39
+ "v2bf7e3e4": `${_ctx.empty ? "flex" : "none"}`
39
40
  }));
40
41
  const props = __props;
41
42
  const emits = __emit;
@@ -98,12 +99,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
98
99
  }
99
100
  return "default";
100
101
  }
101
- function rowClassName({ row }) {
102
- const value = getRowValue(row);
102
+ function myRowClassName(data) {
103
+ const value = getRowValue(data.row);
104
+ let clsName = "";
105
+ if (typeof props.rowClassName === "function") {
106
+ clsName = props.rowClassName(data);
107
+ }
108
+ if (typeof props.rowClassName === "string") {
109
+ clsName = props.rowClassName;
110
+ }
103
111
  if (value === selectedValue.value || selectedValues.value.has(value)) {
104
- return $style["selected-row"];
112
+ return `${clsName} ${$style["selected-row"]}`;
105
113
  }
106
- return "";
114
+ return clsName;
107
115
  }
108
116
  watch(() => props.columnConfig, (val) => {
109
117
  if (Array.isArray(state.columnConfig.value) && state.columnConfig.value.length) {
@@ -155,7 +163,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
155
163
  border: "",
156
164
  "allow-drag-last-column": true,
157
165
  "row-key": __props.rowKey,
158
- "row-class-name": rowClassName,
166
+ "row-class-name": myRowClassName,
159
167
  onHeaderDragend
160
168
  }), createSlots({
161
169
  empty: withCtx(() => [
@@ -21,7 +21,7 @@ div._table_p2qu9_7 .el-table__column-resize-proxy {
21
21
  border-color: var(--el-color-primary);
22
22
  }
23
23
  div._table_p2qu9_7 .el-table__empty-block {
24
- display: var(--v251be0d8);
24
+ display: var(--v2bf7e3e4);
25
25
  }
26
26
  ._selection_p2qu9_27 .cell {
27
27
  display: flex;
@@ -14,7 +14,7 @@ export interface IExplorerTreeProps {
14
14
  confirmParams?: (node: Node) => IButtonProps['confirm'];
15
15
  filterMethod?: TreeComponentProps['filterNodeMethod'];
16
16
  highlightCurrent?: boolean;
17
- disabled?: boolean;
17
+ disabled?: boolean | ((action: string, node: Node) => boolean);
18
18
  }
19
19
  export interface IExplorerTreeEmits {
20
20
  (e: 'nodeClick', value: string | number, node: Node, instance: ComponentInternalInstance | null, event: MouseEvent): void;
@@ -128,7 +128,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
128
128
  } },
129
129
  filterMethod: {},
130
130
  highlightCurrent: { type: Boolean, default: true },
131
- disabled: { type: Boolean, default: void 0 }
131
+ disabled: { type: [Boolean, Function], default: void 0 }
132
132
  },
133
133
  emits: ["nodeClick", "create", "modify", "remove", "up", "down"],
134
134
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -178,6 +178,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
178
178
  emits("nodeClick", data.value, node, instance, event);
179
179
  }
180
180
  const filterWatch = watch(filterKeyword, (value) => treeRef.value?.filter(value));
181
+ function myDisabled(action, node) {
182
+ if (typeof props.disabled === "function") {
183
+ return props.disabled(action, node);
184
+ }
185
+ return props.disabled;
186
+ }
181
187
  __expose({
182
188
  treeRef,
183
189
  setActive: (value, shouldAutoExpandParent = true) => {
@@ -245,7 +251,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
245
251
  link: "",
246
252
  icon: { type: "el", name: actionsMapping[action].icon },
247
253
  stop: "",
248
- disabled: __props.disabled,
254
+ disabled: myDisabled(action, node),
249
255
  onClick: ($event) => emits(action, node.data.value, node)
250
256
  }), null, 16, ["confirm", "class", "icon", "disabled", "onClick"]))
251
257
  ], 64);
@@ -2056,7 +2056,7 @@ declare const __VLS_component: import('vue').DefineComponent<IExplorerTreeProps,
2056
2056
  onDown?: ((value: string | number, node: Node) => any) | undefined;
2057
2057
  onNodeClick?: ((value: string | number, node: Node, instance: ComponentInternalInstance | null, event: MouseEvent) => any) | undefined;
2058
2058
  }>, {
2059
- disabled: boolean;
2059
+ disabled: boolean | ((action: string, node: Node) => boolean);
2060
2060
  loadingText: string;
2061
2061
  emptyText: string;
2062
2062
  highlightCurrent: boolean;
package/dist/es/index.mjs CHANGED
@@ -160,7 +160,7 @@ const __vite_glob_0_49 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.definePr
160
160
  default: _sfc_main$8
161
161
  }, Symbol.toStringTag, { value: 'Module' }));
162
162
 
163
- const version = "1.11.15";
163
+ const version = "1.11.17";
164
164
 
165
165
  const modules = /* #__PURE__ */ Object.assign({"./components/awesome-icon/awesome-icon.vue": __vite_glob_0_0,"./components/backbottom/backbottom.vue": __vite_glob_0_1,"./components/button/button.vue": __vite_glob_0_2,"./components/chat-container/chat-container.vue": __vite_glob_0_3,"./components/choice-boolean/choice-boolean.vue": __vite_glob_0_4,"./components/choice/choice.vue": __vite_glob_0_5,"./components/color-switch/color-switch.vue": __vite_glob_0_6,"./components/config-provider/config-provider.vue": __vite_glob_0_7,"./components/cropper/cropper.vue": __vite_glob_0_8,"./components/currency/currency.vue": __vite_glob_0_9,"./components/dark-switch/dark-switch.vue": __vite_glob_0_10,"./components/daterange-picker/daterange-picker.vue": __vite_glob_0_11,"./components/dialog-camera-upload/dialog-camera-upload.vue": __vite_glob_0_12,"./components/dialog-map-point/dialog-map-point.vue": __vite_glob_0_13,"./components/dialog-upload-images/dialog-upload-images.vue": __vite_glob_0_14,"./components/dialog/dialog.vue": __vite_glob_0_15,"./components/drag-verify/drag-verify.vue": __vite_glob_0_16,"./components/drawer/drawer.vue": __vite_glob_0_17,"./components/easy-pagination/easy-pagination.vue": __vite_glob_0_18,"./components/el-icon/el-icon.vue": __vite_glob_0_19,"./components/explorer-column-table/explorer-column-table.vue": __vite_glob_0_20,"./components/explorer-container/explorer-container.vue": __vite_glob_0_21,"./components/explorer-filter/explorer-filter.vue": __vite_glob_0_22,"./components/explorer-footer/explorer-footer.vue": __vite_glob_0_23,"./components/explorer-form/explorer-form.vue": __vite_glob_0_24,"./components/explorer-list/explorer-list.vue": __vite_glob_0_25,"./components/explorer-modal-form/explorer-modal-form.vue": __vite_glob_0_26,"./components/explorer-panel/explorer-panel.vue": __vite_glob_0_27,"./components/explorer-query/explorer-query.vue": __vite_glob_0_28,"./components/explorer-table/explorer-table.vue": __vite_glob_0_29,"./components/explorer-tools/explorer-tools.vue": __vite_glob_0_30,"./components/explorer-tree/explorer-tree.vue": __vite_glob_0_31,"./components/explorer/explorer.vue": __vite_glob_0_32,"./components/flag/flag.vue": __vite_glob_0_33,"./components/form-item/form-item.vue": __vite_glob_0_34,"./components/icon-picker/icon-picker.vue": __vite_glob_0_35,"./components/icon/icon.vue": __vite_glob_0_36,"./components/iconify-icon/iconify-icon.vue": __vite_glob_0_37,"./components/image/image.vue": __vite_glob_0_38,"./components/info-tooltip/info-tooltip.vue": __vite_glob_0_39,"./components/input-number/input-number.vue": __vite_glob_0_40,"./components/input/input.vue": __vite_glob_0_41,"./components/pca-picker/pca-picker.vue": __vite_glob_0_42,"./components/qr-code/qr-code.vue": __vite_glob_0_43,"./components/screenfull/screenfull.vue": __vite_glob_0_44,"./components/scrollbar/scrollbar.vue": __vite_glob_0_45,"./components/select/select.vue": __vite_glob_0_46,"./components/single-player/single-player.vue": __vite_glob_0_47,"./components/splitter-panel/splitter-panel.vue": __vite_glob_0_48,"./components/splitter/splitter.vue": __vite_glob_0_49,"./components/svg-icon/svg-icon.vue": __vite_glob_0_50,"./components/switch/switch.vue": __vite_glob_0_51,"./components/sync-scroll-container/sync-scroll-container.vue": __vite_glob_0_52,"./components/tags/tags.vue": __vite_glob_0_53,"./components/text-ellipsis/text-ellipsis.vue": __vite_glob_0_54,"./components/thousand-input/thousand-input.vue": __vite_glob_0_55,"./components/tinymce/tinymce.vue": __vite_glob_0_56,"./components/transfer-panel/transfer-panel.vue": __vite_glob_0_57,"./components/transfer/transfer.vue": __vite_glob_0_58,"./components/tree-picker/tree-picker.vue": __vite_glob_0_59,"./components/upload-file/upload-file.vue": __vite_glob_0_60});
166
166
  const upper = (_, letter) => letter.toUpperCase();
package/dist/index.css CHANGED
@@ -669,7 +669,7 @@ div._table_oyix4_1 {
669
669
  /* source: src/components/explorer-list/explorer-list.vue */
670
670
  ._item_e98ar_1 {
671
671
  padding: 4px 8px;
672
- cursor: var(--v42d68eb8);
672
+ cursor: var(--e1697a4a);
673
673
  display: flex;
674
674
  justify-content: space-between;
675
675
  align-items: center;
@@ -828,7 +828,7 @@ div._table_p2qu9_7 .el-table__column-resize-proxy {
828
828
  border-color: var(--el-color-primary);
829
829
  }
830
830
  div._table_p2qu9_7 .el-table__empty-block {
831
- display: var(--v251be0d8);
831
+ display: var(--v2bf7e3e4);
832
832
  }
833
833
  ._selection_p2qu9_27 .cell {
834
834
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wfrog/vc-ui",
3
- "version": "1.11.15",
3
+ "version": "1.11.17",
4
4
  "packageManager": "pnpm@10.20.0",
5
5
  "description": "vue3 组件库 vc-ui",
6
6
  "author": "wellfrog",