@opentiny/vue-renderless 3.17.6 → 3.18.0

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 (81) hide show
  1. package/README.md +12 -3
  2. package/anchor/index.js +6 -2
  3. package/autocomplete/index.js +12 -11
  4. package/autocomplete/vue.js +35 -7
  5. package/collapse-item/index.js +7 -1
  6. package/collapse-item/vue.js +12 -2
  7. package/color-picker/index.js +20 -32
  8. package/color-picker/vue.js +31 -54
  9. package/color-select-panel/index.js +8 -5
  10. package/color-select-panel/vue.js +1 -2
  11. package/common/deps/clickoutside.js +10 -3
  12. package/common/deps/tree-model/tree-store.js +13 -2
  13. package/common/deps/useRelation.js +24 -7
  14. package/common/form/const.js +10 -0
  15. package/common/index.js +1 -1
  16. package/common/runtime.js +1 -1
  17. package/dialog-box/index.js +1 -1
  18. package/dialog-select/index.js +40 -13
  19. package/dialog-select/vue.js +3 -3
  20. package/dropdown-item/mf.js +1 -1
  21. package/dropdown-menu/index.js +3 -0
  22. package/dropdown-menu/vue.js +5 -3
  23. package/file-upload/index.js +4 -4
  24. package/fluent-editor/index.js +10 -3
  25. package/fluent-editor/options.js +32 -2
  26. package/fluent-editor/vue.js +8 -8
  27. package/form-item/index.js +6 -1
  28. package/form-item/vue.js +3 -1
  29. package/guide/index.js +4 -4
  30. package/input/index.js +15 -0
  31. package/input/vue.js +11 -4
  32. package/option/index.js +0 -15
  33. package/option/vue.js +2 -13
  34. package/package.json +1 -1
  35. package/pager-item/index.js +4 -7
  36. package/picker/index.js +27 -7
  37. package/picker/vue.js +2 -1
  38. package/pop-upload/index.js +13 -4
  39. package/pop-upload/vue.js +4 -0
  40. package/popeditor/index.js +2 -1
  41. package/rich-text-editor/vue.js +9 -3
  42. package/select/index.js +5 -4
  43. package/select/vue.js +12 -4
  44. package/slider-button/index.js +8 -3
  45. package/slider-button/vue.js +6 -2
  46. package/slider-button-group/index.js +46 -9
  47. package/slider-button-group/vue.js +39 -18
  48. package/tab-item-mf/vue.js +6 -1
  49. package/tabs-mf/index.js +58 -3
  50. package/tabs-mf/vue-bar.js +0 -6
  51. package/tabs-mf/vue-swipe.js +20 -0
  52. package/tabs-mf/vue.js +22 -4
  53. package/time/index.js +6 -1
  54. package/time/vue.js +7 -2
  55. package/time-line/index.js +1 -1
  56. package/time-line-new/index.js +53 -0
  57. package/time-line-new/vue.js +41 -0
  58. package/time-spinner/index.js +1 -1
  59. package/time-spinner/vue.js +2 -2
  60. package/tooltip/vue.js +16 -3
  61. package/tree/index.js +1 -0
  62. package/tree/vue.js +4 -1
  63. package/tree-select/index.js +6 -6
  64. package/tree-select/vue.js +1 -1
  65. package/types/autocomplete.type.d.ts +16 -12
  66. package/types/button.type.d.ts +22 -1
  67. package/types/checkbox.type.d.ts +1 -0
  68. package/types/dropdown.type.d.ts +4 -0
  69. package/types/file-upload.type.d.ts +1 -1
  70. package/types/form-item.type.d.ts +1 -1
  71. package/types/{form.type-33aa784a.d.ts → form.type-f6fb4c38.d.ts} +5 -0
  72. package/types/form.type.d.ts +1 -1
  73. package/types/input.type.d.ts +5 -1
  74. package/types/link.type.d.ts +6 -1
  75. package/types/search.type.d.ts +7 -0
  76. package/types/tree-menu.type.d.ts +0 -1
  77. package/types/upload-dragger.type.d.ts +1 -1
  78. package/types/{upload-list.type-02a1effb.d.ts → upload-list.type-4194f534.d.ts} +6 -0
  79. package/types/upload-list.type.d.ts +1 -1
  80. package/types/upload.type.d.ts +1 -1
  81. package/types/user-head.type.d.ts +4 -1
package/README.md CHANGED
@@ -1,7 +1,16 @@
1
1
  # @opentiny/vue-renderless
2
2
 
3
- This is for TINY's own internal use only, currently as a dependency for @opentiny/vue.
3
+ Provides a rendering-free logic layer for the `TinyVue` component.
4
4
 
5
- It can also be used as a renderless functions for implementing a custom UI component.
5
+ ## You can customize the global configuration of some components
6
6
 
7
- For all instructions, please check out the home page: [https://open.codehub.huawei.com/innersource/originjs/tiny/opentiny-vue/home](https://open.codehub.huawei.com/innersource/originjs/tiny/opentiny-vue/home)
7
+ ### Modify the popup window starting level (z-index)
8
+
9
+ Add the following code to the entry file `main.js`:
10
+
11
+ ```js
12
+ import PopupManager from '@opentiny/vue-renderless/common/deps/popup-manager'
13
+
14
+ // Set the starting level to 3000
15
+ PopupManager.zIndex = 3000
16
+ ```
package/anchor/index.js CHANGED
@@ -87,7 +87,7 @@ const handleScroll = (state) => () => {
87
87
  state.scrollTimer = window.setTimeout(() => {
88
88
  state.isScroll = false;
89
89
  clearTimeout(state.scrollTimer);
90
- }, 2e3);
90
+ }, 200);
91
91
  };
92
92
  const setChildOffsetTop = ({ state, props }) => {
93
93
  var _a;
@@ -131,6 +131,10 @@ const onItersectionObserver = ({ state, props, api, vm, emit }) => () => {
131
131
  updateSkidPosition({ vm, state, emit });
132
132
  return;
133
133
  }
134
+ if (state.isScroll) {
135
+ api.handleScroll();
136
+ return;
137
+ }
134
138
  for (let key in state.observerLinks) {
135
139
  if (Object.prototype.hasOwnProperty.call(state.observerLinks, key)) {
136
140
  const item = state.observerLinks[key];
@@ -146,7 +150,7 @@ const onItersectionObserver = ({ state, props, api, vm, emit }) => () => {
146
150
  }
147
151
  }
148
152
  },
149
- { root: scrollContainer, threshold: [0] }
153
+ { root: scrollContainer, threshold: [0, 0.25, 0.5, 1] }
150
154
  );
151
155
  addObserver({ props, state });
152
156
  };
@@ -1,4 +1,5 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
+ import { FORM_ITEM, FORM_EVENT } from "../common/form/const";
2
3
  const getData = ({
3
4
  props,
4
5
  state,
@@ -28,11 +29,15 @@ const handleChange = ({
28
29
  api,
29
30
  emit,
30
31
  state,
31
- props
32
+ props,
33
+ dispatch
32
34
  }) => (value) => {
33
35
  state.activated = true;
34
36
  emit("update:modelValue", value);
35
37
  state.suggestionDisabled = false;
38
+ if (state.validateEvent) {
39
+ dispatch(FORM_ITEM, FORM_EVENT.change, [value]);
40
+ }
36
41
  if (!props.triggerOnFocus && !value) {
37
42
  state.suggestionDisabled = true;
38
43
  state.suggestions = [];
@@ -55,9 +60,12 @@ const handleFocus = ({
55
60
  api.debouncedGetData(props.modelValue);
56
61
  }
57
62
  };
58
- const handleBlur = ({ emit, state }) => (event) => {
63
+ const handleBlur = ({ emit, state, dispatch, props }) => (event) => {
59
64
  state.suggestionDisabled = true;
60
65
  emit("blur", event);
66
+ if (state.validateEvent) {
67
+ dispatch(FORM_ITEM, FORM_EVENT.blur, [props.modelValue]);
68
+ }
61
69
  };
62
70
  const handleClear = ({ emit, state }) => () => {
63
71
  state.activated = false;
@@ -101,11 +109,7 @@ const select = ({
101
109
  state.highlightedIndex = -1;
102
110
  });
103
111
  };
104
- const highlight = ({
105
- constants,
106
- vm,
107
- state
108
- }) => (index) => {
112
+ const highlight = ({ constants, vm, state }) => (index) => {
109
113
  if (!state.suggestionVisible || state.loading) {
110
114
  return;
111
115
  }
@@ -136,10 +140,7 @@ const computedVisible = (state) => {
136
140
  let isValidData = Array.isArray(suggestions) && suggestions.length > 0;
137
141
  return (isValidData || state.loading) && state.activated;
138
142
  };
139
- const watchVisible = ({
140
- suggestionState,
141
- vm
142
- }) => (val) => {
143
+ const watchVisible = ({ suggestionState, vm }) => (val) => {
143
144
  let $input = vm.$refs.input.getInput();
144
145
  if ($input) {
145
146
  suggestionState.dropdownWidth = $input.offsetWidth + "px";
@@ -37,8 +37,10 @@ const initState = ({
37
37
  reactive,
38
38
  $prefix,
39
39
  computed,
40
+ props,
40
41
  inject
41
42
  }) => {
43
+ var _a;
42
44
  const state = reactive({
43
45
  showAutoWidth: inject("showAutoWidth", null),
44
46
  popperElm: null,
@@ -48,7 +50,9 @@ const initState = ({
48
50
  highlightedIndex: -1,
49
51
  suggestionDisabled: false,
50
52
  id: $prefix + "-" + guid(),
51
- suggestionVisible: computed(() => computedVisible(state))
53
+ suggestionVisible: computed(() => computedVisible(state)),
54
+ // props.validateEvent优先级大于inject,都没有配置默认为true
55
+ validateEvent: (_a = props.validateEvent) != null ? _a : inject("validateEvent", true)
52
56
  });
53
57
  return state;
54
58
  };
@@ -67,7 +71,19 @@ const initSuggestionState = ({
67
71
  referenceElm
68
72
  });
69
73
  };
70
- const initApi = ({ api: api2, state, doDestroy, suggestionState, emit, vm, props, updatePopper, nextTick, constants }) => {
74
+ const initApi = ({
75
+ api: api2,
76
+ state,
77
+ doDestroy,
78
+ suggestionState,
79
+ emit,
80
+ vm,
81
+ props,
82
+ updatePopper,
83
+ nextTick,
84
+ constants,
85
+ dispatch
86
+ }) => {
71
87
  api2.getData = getData({ props, state, updatePopper, nextTick });
72
88
  Object.assign(api2, {
73
89
  state,
@@ -75,13 +91,13 @@ const initApi = ({ api: api2, state, doDestroy, suggestionState, emit, vm, props
75
91
  suggestionState,
76
92
  close: close(state),
77
93
  open: open(api2),
78
- handleBlur: handleBlur({ emit, state }),
94
+ handleBlur: handleBlur({ emit, state, dispatch, props }),
79
95
  mounted: mounted({ vm, state, suggestionState }),
80
96
  highlight: highlight({ constants, vm, state }),
81
97
  handleClear: handleClear({ emit, state }),
82
98
  select: select({ emit, nextTick, props, state }),
83
99
  watchVisible: watchVisible({ suggestionState, vm }),
84
- handleChange: handleChange({ api: api2, emit, state, props }),
100
+ handleChange: handleChange({ api: api2, emit, state, props, dispatch }),
85
101
  handleFocus: handleFocus({ api: api2, emit, props, state }),
86
102
  handleKeyEnter: handleKeyEnter({ api: api2, emit, nextTick, props, state }),
87
103
  debouncedGetData: debounce(props.debounce, api2.getData)
@@ -96,9 +112,9 @@ const renderless = (props, {
96
112
  toRefs,
97
113
  onDeactivated,
98
114
  inject
99
- }, { $prefix, vm, parent, emit, constants, nextTick, slots }) => {
115
+ }, { $prefix, vm, parent, emit, constants, nextTick, slots, dispatch }) => {
100
116
  const api2 = {};
101
- const state = initState({ reactive, $prefix, computed, inject });
117
+ const state = initState({ reactive, $prefix, computed, props, inject });
102
118
  const { showPopper, popperElm, referenceElm, doDestroy, updatePopper } = userPopper({
103
119
  reactive,
104
120
  watch,
@@ -112,7 +128,19 @@ const renderless = (props, {
112
128
  onDeactivated
113
129
  });
114
130
  const suggestionState = initSuggestionState({ reactive, parent, showPopper, popperElm, referenceElm });
115
- initApi({ api: api2, state, doDestroy, suggestionState, emit, vm, props, updatePopper, nextTick, constants });
131
+ initApi({
132
+ api: api2,
133
+ state,
134
+ doDestroy,
135
+ suggestionState,
136
+ emit,
137
+ vm,
138
+ props,
139
+ updatePopper,
140
+ nextTick,
141
+ constants,
142
+ dispatch
143
+ });
116
144
  watch(() => state.suggestionVisible, api2.watchVisible);
117
145
  onMounted(api2.mounted);
118
146
  return api2;
@@ -23,6 +23,11 @@ const handleHeaderClick = ({
23
23
  state.focusing = false;
24
24
  state.isClick = true;
25
25
  };
26
+ const handleHeaderContainerClick = ({ api }) => (e) => {
27
+ if (e.target === e.currentTarget) {
28
+ api.handleHeaderClick();
29
+ }
30
+ };
26
31
  const handleEnterClick = ({
27
32
  componentName,
28
33
  dispatch,
@@ -32,5 +37,6 @@ const handleEnterClick = ({
32
37
  export {
33
38
  handleEnterClick,
34
39
  handleFocus,
35
- handleHeaderClick
40
+ handleHeaderClick,
41
+ handleHeaderContainerClick
36
42
  };
@@ -1,7 +1,14 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { handleFocus, handleEnterClick, handleHeaderClick } from "./index";
2
+ import { handleFocus, handleEnterClick, handleHeaderClick, handleHeaderContainerClick } from "./index";
3
3
  import { guid } from "../common/string";
4
- const api = ["state", "isActive", "handleFocus", "handleEnterClick", "handleHeaderClick"];
4
+ const api = [
5
+ "state",
6
+ "isActive",
7
+ "handleFocus",
8
+ "handleEnterClick",
9
+ "handleHeaderClick",
10
+ "handleHeaderContainerClick"
11
+ ];
5
12
  const renderless = (props, { computed, reactive }, { parent, constants, dispatch, designConfig }) => {
6
13
  var _a;
7
14
  const _constants = parent.collapse._constants;
@@ -22,6 +29,9 @@ const renderless = (props, { computed, reactive }, { parent, constants, dispatch
22
29
  handleEnterClick: handleEnterClick({ componentName, dispatch, eventName, parent }),
23
30
  handleHeaderClick: handleHeaderClick({ componentName, dispatch, eventName, props, parent, state })
24
31
  };
32
+ Object.assign(api2, {
33
+ handleHeaderContainerClick: handleHeaderContainerClick({ api: api2 })
34
+ });
25
35
  return api2;
26
36
  };
27
37
  export {
@@ -1,42 +1,30 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- const onCancel = (tmpColor, triggerBg, isShow, pre, emit) => {
3
- return (color) => {
4
- tmpColor.reset(color.value.getHex());
5
- triggerBg.value = pre.value;
6
- isShow.value = false;
7
- emit("cancel");
8
- };
2
+ const updateModelValue = (val, emit) => {
3
+ emit("update:modelValue", val);
9
4
  };
10
- const onConfirm = (triggerBg, pre, hex, isShow, emit) => {
11
- return (color) => {
12
- pre.value = triggerBg.value;
13
- triggerBg.value = color;
14
- hex.value = color;
15
- isShow.value = false;
16
- emit("confirm", color);
5
+ const toggleVisible = (isShow) => {
6
+ return (val) => {
7
+ isShow.value = val;
17
8
  };
18
9
  };
19
- const onHueUpdate = (tmpColor, triggerBg) => {
20
- return (h) => {
21
- triggerBg.value = tmpColor.getHex();
22
- tmpColor.set({ h });
10
+ const useEvent = (hex, emit, changeVisible) => {
11
+ const onConfirm = (val) => {
12
+ hex.value = val;
13
+ updateModelValue(val, emit);
14
+ emit("confirm", val);
15
+ changeVisible(false);
23
16
  };
24
- };
25
- const onSVUpdate = (tmpColor, triggerBg) => {
26
- return ({ s, v }) => {
27
- triggerBg.value = tmpColor.getHex();
28
- tmpColor.set({ s, v });
17
+ const onCancel = (color) => {
18
+ hex.value = color.value.hex;
19
+ changeVisible(false);
20
+ emit("cancel");
29
21
  };
30
- };
31
- const onColorUpdate = (triggerBg) => {
32
- return (color) => {
33
- triggerBg.value = color.value.getHex();
22
+ return {
23
+ onConfirm,
24
+ onCancel
34
25
  };
35
26
  };
36
27
  export {
37
- onCancel,
38
- onColorUpdate,
39
- onConfirm,
40
- onHueUpdate,
41
- onSVUpdate
28
+ toggleVisible,
29
+ useEvent
42
30
  };
@@ -1,72 +1,49 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import Color from "./utils/color";
3
- import { onConfirm, onCancel, onHueUpdate, onSVUpdate, onColorUpdate } from "./index";
4
- const api = [
5
- "state",
6
- "changeVisible",
7
- "cursor",
8
- "onColorUpdate",
9
- "onHueUpdate",
10
- "onSVUpdate",
11
- "onConfirm",
12
- "onCancel",
13
- "onAlphaUpdate",
14
- "alpha"
15
- ];
16
- const renderless = (props, context, { emit }) => {
17
- var _a, _b, _c, _d, _e, _f, _g;
18
- const { modelValue, visible, predefine, size, history } = context.toRefs(props);
19
- const pre = context.ref((_a = modelValue.value) != null ? _a : "transparent");
20
- const triggerBg = context.ref((_b = pre.value) != null ? _b : "transparent");
21
- const tmpColor = new Color((_c = triggerBg.value) != null ? _c : "transparent");
22
- const hex = context.ref((_d = modelValue.value) != null ? _d : "transparent");
23
- const isShow = context.ref((_e = visible == null ? void 0 : visible.value) != null ? _e : false);
24
- const changeVisible = (state2) => {
25
- isShow.value = state2;
26
- };
27
- const stack = context.ref([...(_f = history == null ? void 0 : history.value) != null ? _f : []]);
28
- const predefineStack = context.ref([...(_g = predefine == null ? void 0 : predefine.value) != null ? _g : []]);
29
- const state = context.reactive({
30
- isShow,
31
- hex,
32
- triggerBg,
33
- defaultValue: modelValue,
34
- stack,
35
- predefineStack,
36
- size: size != null ? size : ""
37
- });
38
- const api2 = {
39
- state,
40
- changeVisible,
41
- onCancel: onCancel(tmpColor, triggerBg, isShow, pre, emit),
42
- onConfirm: onConfirm(triggerBg, pre, hex, isShow, emit),
43
- onHueUpdate: onHueUpdate(tmpColor, triggerBg),
44
- onSVUpdate: onSVUpdate(tmpColor, triggerBg),
45
- onColorUpdate: onColorUpdate(triggerBg)
46
- };
47
- context.watch(
2
+ import { toggleVisible, useEvent } from "./index";
3
+ const api = ["state", "changeVisible", "onConfirm", "onCancel", "onHueUpdate", "onSVUpdate", "onColorUpdate"];
4
+ const renderless = (props, ctx, { emit }) => {
5
+ var _a, _b, _c;
6
+ const { modelValue, visible, predefine, size, history } = ctx.toRefs(props);
7
+ const isShow = ctx.ref(visible.value);
8
+ const hex = ctx.ref((_a = modelValue.value) != null ? _a : "transparent");
9
+ const stack = ctx.ref([...(_b = history == null ? void 0 : history.value) != null ? _b : []]);
10
+ const predefineStack = ctx.ref([...(_c = predefine == null ? void 0 : predefine.value) != null ? _c : []]);
11
+ ctx.watch(
48
12
  predefine,
49
13
  (newPredefine) => {
50
14
  predefineStack.value = [...newPredefine];
51
15
  },
52
16
  { deep: true }
53
17
  );
54
- context.watch(
18
+ ctx.watch(
55
19
  history,
56
20
  (newHistory) => {
57
21
  stack.value = [...newHistory];
58
22
  },
59
23
  { deep: true }
60
24
  );
61
- context.watch(modelValue, (newValue) => {
62
- pre.value = newValue;
63
- hex.value = newValue;
64
- state.hex = newValue;
65
- state.triggerBg = newValue;
25
+ const state = ctx.reactive({
26
+ isShow,
27
+ hex,
28
+ triggerBg: ctx.ref(modelValue.value),
29
+ size,
30
+ stack,
31
+ predefineStack
32
+ });
33
+ ctx.watch(props, () => {
34
+ hex.value = props.modelValue;
66
35
  });
67
- context.watch(visible, (visible2) => {
68
- isShow.value = visible2;
36
+ ctx.watch(hex, () => {
37
+ emit("update:modelValue", hex.value);
69
38
  });
39
+ const changeVisible = toggleVisible(isShow);
40
+ const { onConfirm, onCancel } = useEvent(hex, emit, changeVisible);
41
+ const api2 = {
42
+ state,
43
+ changeVisible,
44
+ onConfirm,
45
+ onCancel
46
+ };
70
47
  return api2;
71
48
  };
72
49
  export {
@@ -20,6 +20,7 @@ const onConfirm = (hex, pre, res, emit, stack, enableHistory, color) => {
20
20
  }
21
21
  color.value.setPrevH(color.value.get("h"));
22
22
  emit("confirm", res.value);
23
+ emit("update:modelValue", res.value);
23
24
  };
24
25
  };
25
26
  const onCancel = (res, pre, emit, isShow, hex, color) => {
@@ -33,31 +34,33 @@ const onCancel = (res, pre, emit, isShow, hex, color) => {
33
34
  }));
34
35
  emit("cancel", color);
35
36
  }
37
+ emit("update:modelValue", hex.value);
36
38
  };
37
39
  };
38
- const onColorUpdate = (color, res) => {
40
+ const onColorUpdate = (color, res, emit) => {
39
41
  res.value = color.value.getHex();
42
+ emit("update:modelValue", res.value);
40
43
  };
41
44
  const onHSVUpdate = (color, res, hex, emit) => {
42
45
  return {
43
46
  onHueUpdate: (hue) => {
44
47
  color.value.set({ h: hue });
45
- onColorUpdate(color, res);
48
+ onColorUpdate(color, res, emit);
46
49
  hex.value = color.value.getHex();
47
50
  emit("hue-update", hue);
48
51
  },
49
52
  onSVUpdate: ({ s, v }) => {
50
53
  hex.value = color.value.getHex();
51
- onColorUpdate(color, res);
54
+ onColorUpdate(color, res, emit);
52
55
  emit("sv-update", { s, v });
53
56
  }
54
57
  };
55
58
  };
56
- const onAlphaUpdate = (color, res) => {
59
+ const onAlphaUpdate = (color, res, emit) => {
57
60
  return {
58
61
  update: (alpha) => {
59
62
  color.value.set({ a: alpha });
60
- onColorUpdate(color, res);
63
+ onColorUpdate(color, res, emit);
61
64
  }
62
65
  };
63
66
  };
@@ -58,7 +58,6 @@ const renderless = (props, context, { emit }) => {
58
58
  { deep: true }
59
59
  );
60
60
  context.watch(modelValue, (newValue) => {
61
- pre.value = res.value;
62
61
  hex.value = newValue;
63
62
  res.value = newValue;
64
63
  color.value.reset(newValue);
@@ -68,7 +67,7 @@ const renderless = (props, context, { emit }) => {
68
67
  isShow.value = visible2;
69
68
  });
70
69
  const { onHueUpdate, onSVUpdate } = onHSVUpdate(color, res, hex, emit);
71
- const { update } = onAlphaUpdate(color, res);
70
+ const { update } = onAlphaUpdate(color, res, emit);
72
71
  const api2 = {
73
72
  state,
74
73
  changeVisible,
@@ -11,7 +11,10 @@ if (!isServer) {
11
11
  nodeList.filter((node) => node[nameSpace].mousedownTrigger).forEach((node) => node[nameSpace].documentHandler(event, startClick));
12
12
  });
13
13
  on(document, "mouseup", (event) => {
14
- nodeList.filter((node) => !node[nameSpace].mousedownTrigger).forEach((node) => node[nameSpace].documentHandler(event, startClick));
14
+ nodeList.filter((node) => !node[nameSpace].mousedownTrigger).forEach((node) => {
15
+ var _a;
16
+ return node[nameSpace].documentHandler(event, ((_a = node[nameSpace]) == null ? void 0 : _a.mouseupTrigger) ? event : startClick);
17
+ });
15
18
  startClick = null;
16
19
  });
17
20
  }
@@ -31,20 +34,24 @@ var clickoutside_default = {
31
34
  nodeList.push(el);
32
35
  const id = seed++;
33
36
  const { modifiers, expression, value } = binding;
37
+ const { mousedown = false, mouseup = false } = modifiers || {};
34
38
  el[nameSpace] = {
35
39
  id,
36
40
  documentHandler: createDocumentHandler(el, binding, vnode),
37
41
  methodName: expression,
38
42
  bindingFn: value,
39
- mousedownTrigger: modifiers.mousedown
43
+ mousedownTrigger: mousedown,
44
+ mouseupTrigger: mouseup
40
45
  };
41
46
  },
42
47
  update: (el, binding, vnode) => {
43
48
  const { modifiers, expression, value } = binding;
49
+ const { mousedown = false, mouseup = false } = modifiers || {};
44
50
  el[nameSpace].documentHandler = createDocumentHandler(el, binding, vnode);
45
51
  el[nameSpace].methodName = expression;
46
52
  el[nameSpace].bindingFn = value;
47
- el[nameSpace].mousedownTrigger = modifiers.mousedown;
53
+ el[nameSpace].mousedownTrigger = mousedown;
54
+ el[nameSpace].mouseupTrigger = mouseup;
48
55
  },
49
56
  unbind: (el) => {
50
57
  if (el.nodeType !== Node.ELEMENT_NODE) {
@@ -26,12 +26,23 @@ class TreeStore {
26
26
  this._initDefaultCheckedNodes();
27
27
  }
28
28
  }
29
+ getMappingData(data) {
30
+ const props = this.props || {};
31
+ const mapping = {};
32
+ for (let key in props) {
33
+ if (hasOwn.call(props, key)) {
34
+ mapping[key] = data[props[key]];
35
+ }
36
+ }
37
+ return __spreadValues(__spreadValues({}, data), mapping);
38
+ }
29
39
  filter(value) {
30
- const { lazy, filterNodeMethod } = this;
40
+ const { lazy, filterNodeMethod, getMappingData } = this;
31
41
  const walkTree = (node) => {
32
42
  const childNodes = node.root ? node.root.childNodes : node.childNodes;
33
43
  childNodes.forEach((child) => {
34
- child.visible = filterNodeMethod.call(child, value, child.data, child);
44
+ const mappingData = getMappingData.call(this, child.data);
45
+ child.visible = filterNodeMethod.call(child, value, mappingData, child);
35
46
  walkTree(child);
36
47
  });
37
48
  if (!node.visible && childNodes.length) {
@@ -1,19 +1,32 @@
1
1
  import "../../chunk-G2ADBYYC.js";
2
2
  import { noop } from "../function";
3
3
  import { onMountedOrActivated as createHook } from "./useEventListener";
4
- const useRelation = ({ getCurrentInstance, inject, markRaw, nextTick, onMounted, onActivated, onUnmounted, provide, reactive, toRef }) => ({ relationKey, relationContainer, onChange, childrenKey } = {}) => {
4
+ const useRelation = ({
5
+ computed,
6
+ getCurrentInstance,
7
+ inject,
8
+ markRaw,
9
+ nextTick,
10
+ onMounted,
11
+ onActivated,
12
+ onUnmounted,
13
+ provide,
14
+ reactive,
15
+ toRef
16
+ }) => ({ relationKey, relationContainer, onChange, childrenKey, delivery } = {}) => {
5
17
  if (!relationKey) {
6
18
  throw new Error("[TINY Error]<relationKey> must exist.");
7
19
  }
8
20
  const instance = getCurrentInstance();
9
- const state = reactive({ children: [] });
21
+ const state = reactive({ children: [], indexInParent: -1 });
10
22
  const injectValue = inject(relationKey, null);
11
23
  let callbacks = [];
12
24
  if (injectValue) {
13
- const { link: link2, unlink: unlink2, callbacks: injectCbs, childrenKey: injectKey } = injectValue;
25
+ const { link: link2, unlink: unlink2, callbacks: injectCbs, childrenKey: injectKey, delivery: injectDelivery } = injectValue;
14
26
  callbacks = injectCbs;
15
27
  childrenKey = childrenKey || injectKey || "instanceChildren";
16
- link2(instance);
28
+ delivery = injectDelivery;
29
+ state.indexInParent = link2(instance);
17
30
  onUnmounted(() => unlink2(instance));
18
31
  } else {
19
32
  childrenKey = childrenKey || "instanceChildren";
@@ -41,7 +54,11 @@ const useRelation = ({ getCurrentInstance, inject, markRaw, nextTick, onMounted,
41
54
  callbacks = null;
42
55
  });
43
56
  }
44
- const link = (child) => state.children.push(markRaw(child.proxy));
57
+ const link = (child) => {
58
+ const childPublic = child.proxy;
59
+ state.children.push(markRaw(childPublic));
60
+ return computed(() => state.children.indexOf(childPublic));
61
+ };
45
62
  const unlink = (child) => {
46
63
  const index = state.children.indexOf(child.proxy);
47
64
  if (index > -1) {
@@ -49,10 +66,10 @@ const useRelation = ({ getCurrentInstance, inject, markRaw, nextTick, onMounted,
49
66
  }
50
67
  };
51
68
  callbacks.push((flattenNodes) => sortPublicInstances(state.children, flattenNodes));
52
- provide(relationKey, { link, unlink, callbacks, childrenKey });
69
+ provide(relationKey, { link, unlink, callbacks, childrenKey, delivery });
53
70
  Object.defineProperty(instance.proxy, childrenKey, { configurable: true, get: () => state.children });
54
71
  onUnmounted(() => delete instance.proxy[childrenKey]);
55
- return { children: toRef(state, "children") };
72
+ return { children: toRef(state, "children"), index: toRef(state, "indexInParent"), delivery };
56
73
  };
57
74
  const flattenChildNodes = (childNodes, result) => {
58
75
  if (childNodes.length) {
@@ -0,0 +1,10 @@
1
+ import "../../chunk-G2ADBYYC.js";
2
+ const FORM_ITEM = "FormItem";
3
+ const FORM_EVENT = {
4
+ change: "form.change",
5
+ blur: "form.blur"
6
+ };
7
+ export {
8
+ FORM_EVENT,
9
+ FORM_ITEM
10
+ };
package/common/index.js CHANGED
@@ -237,7 +237,7 @@ const CASCADER = {
237
237
  PropsHover: "hoverThreshold",
238
238
  MenuConnector: "cascader-menu-"
239
239
  };
240
- const version = "3.17.6";
240
+ const version = "3.18.0";
241
241
  const log = (data, type = "log") => {
242
242
  uLog.logger[type](data);
243
243
  };
package/common/runtime.js CHANGED
@@ -22,7 +22,7 @@ import vuePopup from "./deps/vue-popup";
22
22
  import validate from "./validate";
23
23
  import memorize from "./deps/memorize";
24
24
  import * as common from ".";
25
- const version = "3.17.6";
25
+ const version = "3.18.0";
26
26
  const Renderless = {
27
27
  browser,
28
28
  array,
@@ -240,8 +240,8 @@ const handleDrag = ({
240
240
  document.onmouseup = () => {
241
241
  document.onmousemove = demMousemove;
242
242
  document.onmouseup = demMouseup;
243
+ props.draggable && state.move && emit("drag-end", event);
243
244
  state.move = false;
244
- props.draggable && emit("drag-end", event);
245
245
  };
246
246
  };
247
247
  const showScrollbar = (lockScrollClass) => () => {