@opentiny/vue-renderless 3.10.5 → 3.10.6

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.
package/dropdown/index.js CHANGED
@@ -135,12 +135,14 @@ const initEvent = ({ api, props, state, vm, mode }) => () => {
135
135
  }
136
136
  }
137
137
  };
138
- const handleMenuItemClick = ({ props, state, emit }) => (itemData, instance, isDisabled) => {
139
- state.isDisabled = isDisabled;
140
- if (props.hideOnClick) {
141
- !state.isDisabled && (state.visible = false);
138
+ const handleMenuItemClick = ({ props, state, emit }) => ({ itemData, vm, disabled }) => {
139
+ if (props.hideOnClick && !disabled) {
140
+ state.visible = false;
141
+ }
142
+ if (!disabled) {
143
+ const data = { itemData, vm, disabled };
144
+ emit("item-click", data);
142
145
  }
143
- emit("item-click", itemData, instance);
144
146
  };
145
147
  const triggerElmFocus = ({ state }) => () => {
146
148
  state.triggerElm.focus && state.triggerElm.focus();
@@ -185,9 +187,9 @@ const beforeDistory = ({ api, state }) => () => {
185
187
  state.dropdownElm = null;
186
188
  }
187
189
  };
188
- const clickOutside = ({ props, api, state }) => (value) => {
190
+ const clickOutside = ({ props, api }) => (disabled) => {
189
191
  if (props.hideOnClick) {
190
- state.isDisabled ? value ? api.show() : api.hide() : api.hide();
192
+ disabled ? api.show() : api.hide();
191
193
  }
192
194
  };
193
195
  export {
package/dropdown/vue.js CHANGED
@@ -34,7 +34,6 @@ const renderless = (props, { reactive, watch, provide, onMounted }, { emit, pare
34
34
  listId: `dropdown-menu-${guid()}`,
35
35
  showIcon: props.showIcon,
36
36
  showSelfIcon: props.showSelfIcon,
37
- isDisabled: false,
38
37
  designConfig
39
38
  });
40
39
  provide("dropdownVm", vm);
@@ -57,7 +56,7 @@ const renderless = (props, { reactive, watch, provide, onMounted }, { emit, pare
57
56
  triggerElmFocus: triggerElmFocus({ state }),
58
57
  initDomOperation: initDomOperation({ api: api2, state, vm }),
59
58
  beforeDistory: beforeDistory({ api: api2, state }),
60
- clickOutside: clickOutside({ state, props, api: api2 })
59
+ clickOutside: clickOutside({ props, api: api2 })
61
60
  });
62
61
  watch(() => state.visible, api2.watchVisible);
63
62
  watch(() => state.focusing, api2.watchFocusing);
@@ -92,7 +92,9 @@ const clickOutside = (parent) => () => {
92
92
  const handleClick = ({ props, dispatch, vm, emit }) => (event) => {
93
93
  event.stopPropagation();
94
94
  const data = { itemData: props.itemData, vm, disabled: props.disabled };
95
- emit("item-click", data);
95
+ if (!props.disabled) {
96
+ emit("item-click", data);
97
+ }
96
98
  dispatch("TinyDropdown", "menu-item-click", data);
97
99
  dispatch("TinyDropdown", "is-disabled", [props.disabled]);
98
100
  };
@@ -32,13 +32,14 @@ const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
32
32
  dataStore2.currentIndex = `${props2.currentIndex}`;
33
33
  }
34
34
  dispatch("TinyDropdown", "selectedIndex", [dataStore2.currentIndex]);
35
- dispatch("TinyDropdownMenu", "menu-item-click", [
36
- dataStore2.itemData,
37
- vm2,
38
- dataStore2.itemLabel,
39
- dataStore2.showContent,
40
- props2.disabled
41
- ]);
35
+ const data = {
36
+ itemData: dataStore2.itemData,
37
+ vm: vm2,
38
+ label: dataStore2.itemLabel,
39
+ showContent: dataStore2.showContent,
40
+ disabled: props2.disabled
41
+ };
42
+ dispatch("TinyDropdownMenu", "menu-item-click", data);
42
43
  dispatch("TinyDropdown", "is-disabled", [props2.disabled]);
43
44
  };
44
45
  const mouseLeave = ({ dataStore: dataStore2 }) => () => {
@@ -129,10 +129,11 @@ const mounted = ({ api, parent, state }) => () => {
129
129
  state.showContent = showContent;
130
130
  });
131
131
  };
132
- const handleMenuItemClick = ({ state, dispatch }) => (itemData, instance, label, showContent, isDisabled) => {
132
+ const handleMenuItemClick = ({ state, dispatch }) => ({ itemData, vm, label, showContent, disabled }) => {
133
133
  state.label = label;
134
134
  state.showContent = showContent;
135
- dispatch("TinyDropdown", "current-item-click", [itemData, instance, isDisabled]);
135
+ const data = { itemData, vm, disabled };
136
+ dispatch("TinyDropdown", "current-item-click", data);
136
137
  };
137
138
  const handleMouseenter = ({ emit }) => ($event) => {
138
139
  emit("mouseenter", $event);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-renderless",
3
- "version": "3.10.5",
3
+ "version": "3.10.6",
4
4
  "description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
5
5
  "homepage": "https://opentiny.design/tiny-vue",
6
6
  "keywords": [