vft 0.0.375 → 0.0.378

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 (34) hide show
  1. package/es/component.js +3 -3
  2. package/es/components/carousel/use-carousel.js +1 -1
  3. package/es/components/index.d.ts +1 -1
  4. package/es/components/index.js +3 -3
  5. package/es/components/input/input.vue2.js +1 -1
  6. package/es/components/input-tag/composables/use-input-tag.js +1 -1
  7. package/es/components/select/select.vue2.js +1 -1
  8. package/es/components/super-form/super-form-item.vue2.js +2 -2
  9. package/es/components/super-form/use/helper.js +1 -1
  10. package/es/hooks/use-delayed-toggle/index.d.ts +7 -11
  11. package/es/hooks/use-delayed-toggle/index.js +2 -29
  12. package/es/index.js +3 -3
  13. package/es/package.json.d.ts +1 -1
  14. package/es/package.json.js +1 -1
  15. package/es/utils/click-out-side.d.ts +3 -0
  16. package/es/utils/click-out-side.js +72 -0
  17. package/es/utils/vue/props/runtime.js +3 -1
  18. package/es/utils/vue/vnode.js +1 -1
  19. package/lib/component.cjs +202 -202
  20. package/lib/components/index.cjs +47 -47
  21. package/lib/components/index.d.ts +1 -1
  22. package/lib/components/input/input.vue2.cjs +1 -1
  23. package/lib/components/select/select.vue2.cjs +2 -2
  24. package/lib/components/super-form/super-form-item.vue2.cjs +1 -1
  25. package/lib/hooks/use-delayed-toggle/index.cjs +1 -28
  26. package/lib/hooks/use-delayed-toggle/index.d.ts +7 -11
  27. package/lib/index.cjs +47 -47
  28. package/lib/package.json.cjs +1 -1
  29. package/lib/package.json.d.ts +1 -1
  30. package/lib/utils/click-out-side.cjs +72 -0
  31. package/lib/utils/click-out-side.d.ts +3 -0
  32. package/lib/utils/vue/props/runtime.cjs +4 -2
  33. package/package.json +4 -4
  34. package/web-types.json +1 -1
package/es/component.js CHANGED
@@ -79,7 +79,6 @@ import { VftSideMenu } from "./components/side-menu/index.js";
79
79
  import { VftSkeleton, VftSkeletonItem } from "./components/skeleton/index.js";
80
80
  import { VftSlider } from "./components/slider/index.js";
81
81
  import { VftSpace } from "./components/space/index.js";
82
- import { VftSuperForm } from "./components/super-form/index.js";
83
82
  import { VftSwitch } from "./components/switch/index.js";
84
83
  import { VftTable } from "./components/table/index.js";
85
84
  import { VftTabs, VftTabPane } from "./components/tabs/index.js";
@@ -89,6 +88,7 @@ import { VftTooltip } from "./components/tooltip/index.js";
89
88
  import { VftTree } from "./components/tree/index.js";
90
89
  import { VftUpload } from "./components/upload/index.js";
91
90
  import { VftVerifyCode } from "./components/verify-code/index.js";
91
+ import { VftSuperForm } from "./components/super-form/index.js";
92
92
  import { VftProgressI } from "./components/progress-i/index.js";
93
93
  const Components = [
94
94
  // phone
@@ -96,7 +96,6 @@ const Components = [
96
96
  //
97
97
  VftCarousel,
98
98
  VftCarouselItem,
99
- VftSuperForm,
100
99
  VftUpload,
101
100
  VftProgress,
102
101
  VftInputNumber,
@@ -208,7 +207,8 @@ const Components = [
208
207
  VftCascaderPanel,
209
208
  VftWatermark,
210
209
  VftTransfer,
211
- VftSegmented
210
+ VftSegmented,
211
+ VftSuperForm
212
212
  ];
213
213
  export {
214
214
  Components as default
@@ -10,7 +10,7 @@ import "../../hooks/use-model-toggle/index.js";
10
10
  import { useOrderedChildren } from "../../hooks/use-ordered-children/index.js";
11
11
  import "@popperjs/core";
12
12
  import "../../hooks/use-z-index/index.js";
13
- import { carouselContextKey, CAROUSEL_ITEM_NAME } from "./constants.js";
13
+ import { CAROUSEL_ITEM_NAME, carouselContextKey } from "./constants.js";
14
14
  const THROTTLE_TIME = 300;
15
15
  const useCarousel = (props, emit, componentName) => {
16
16
  const {
@@ -81,7 +81,6 @@ export * from './modal';
81
81
  export * from './progress';
82
82
  export * from './segmented';
83
83
  export * from './statistic';
84
- export * from './super-form';
85
84
  export * from './timeline';
86
85
  export * from './transfer';
87
86
  export * from './upload';
@@ -96,3 +95,4 @@ export * from './infinite-scroll';
96
95
  export * from './loading';
97
96
  export * from './message';
98
97
  export * from './progress-i';
98
+ export * from './super-form';
@@ -87,7 +87,6 @@ import { VftModal } from "./modal/index.js";
87
87
  import { VftProgress } from "./progress/index.js";
88
88
  import { VftSegmented } from "./segmented/index.js";
89
89
  import { VftStatistic } from "./statistic/index.js";
90
- import { VftSuperForm } from "./super-form/index.js";
91
90
  import { VftTimeline, VftTimelineItem } from "./timeline/index.js";
92
91
  import { VftTransfer } from "./transfer/index.js";
93
92
  import { VftUpload } from "./upload/index.js";
@@ -102,6 +101,7 @@ import { VftInfiniteScroll } from "./infinite-scroll/index.js";
102
101
  import { VftLoading } from "./loading/index.js";
103
102
  import { VftMessage, VftMessage as VftMessage2 } from "./message/index.js";
104
103
  import { VftProgressI } from "./progress-i/index.js";
104
+ import { VftSuperForm } from "./super-form/index.js";
105
105
  import { default as default6 } from "./popper/arrow.vue2.js";
106
106
  import { default as default7 } from "./popper/content.vue2.js";
107
107
  import { default as default8 } from "./popper/trigger.vue2.js";
@@ -156,14 +156,14 @@ import { countdownEmits, countdownProps } from "./countdown/countdown.js";
156
156
  import { inputTagEmits, inputTagProps } from "./input-tag/input-tag.js";
157
157
  import { useModal, useModalInner } from "./modal/use/use-modal.js";
158
158
  import { defaultProps, segmentedEmits, segmentedProps } from "./segmented/segmented.js";
159
- import { FormCompEnum, clearComponents, getComponent, getRegisteredComponents, hasComponent, isDatePicker, isInput, isRangePicker, registerComponent, registerComponents, removeComponent } from "./super-form/component-map.js";
160
- import { getDynamicProps, useForm } from "./super-form/use/use-form.js";
161
159
  import { LEFT_CHECK_CHANGE_EVENT, RIGHT_CHECK_CHANGE_EVENT, transferCheckedChangeFn, transferEmits, transferProps } from "./transfer/transfer.js";
162
160
  import { genFileId, uploadContextKey } from "./upload/constants.js";
163
161
  import { watermarkProps } from "./watermark/watermark.js";
164
162
  import { vLoading, createLoadingDirective, vLoading as vLoading2 } from "./loading/directive.js";
165
163
  import { Loading } from "./loading/service.js";
166
164
  import { messageDefaults, messageTypes } from "./message/types.js";
165
+ import { FormCompEnum, clearComponents, getComponent, getRegisteredComponents, hasComponent, isDatePicker, isInput, isRangePicker, registerComponent, registerComponents, removeComponent } from "./super-form/component-map.js";
166
+ import { getDynamicProps, useForm } from "./super-form/use/use-form.js";
167
167
  export {
168
168
  ACTION_FIELD,
169
169
  BAR_MAP,
@@ -13,8 +13,8 @@ import "../../hooks/use-z-index/index.js";
13
13
  import { UPDATE_MODEL_EVENT } from "@vft/constants";
14
14
  import { useAttrs as useAttrs$1, useCursor } from "@vft/use";
15
15
  import { calcTextareaHeight } from "./utils.js";
16
- import { useFormItem, useFormItemInputId } from "../form/hooks/use-form-item.js";
17
16
  import { useFormSize, useFormDisabled } from "../form/hooks/use-form-common-props.js";
17
+ import { useFormItem, useFormItemInputId } from "../form/hooks/use-form-item.js";
18
18
  const _hoisted_1 = ["role"];
19
19
  const _hoisted_2 = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"];
20
20
  const _hoisted_3 = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"];
@@ -1,6 +1,6 @@
1
1
  import { shallowRef, ref, computed, watch } from "vue";
2
2
  import { EVENT_CODE } from "../../../constants/aria.js";
3
- import { CHANGE_EVENT, UPDATE_MODEL_EVENT, INPUT_EVENT } from "../../../constants/event.js";
3
+ import { CHANGE_EVENT, INPUT_EVENT, UPDATE_MODEL_EVENT } from "../../../constants/event.js";
4
4
  import "@vueuse/core";
5
5
  import { isUndefined } from "@vft/utils";
6
6
  import { debugWarn } from "../../../utils/error.js";
@@ -10,7 +10,7 @@ import "../../hooks/use-model-toggle/index.js";
10
10
  import "@popperjs/core";
11
11
  import "../../hooks/use-z-index/index.js";
12
12
  import { useCalcInputWidth } from "../../hooks/use-calc-input-width/index.js";
13
- import { ClickOutside } from "@vft/directives";
13
+ import ClickOutside from "../../utils/click-out-side.js";
14
14
  import { selectV2Emits, selectV2Props } from "./defaults.js";
15
15
  import SelectMenu from "./select-dropdown.js";
16
16
  import { selectV2InjectionKey } from "./token.js";
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, ref, unref, useSlots, createVNode, mergeProps, withDirectives, vShow, createTextVNode, isVNode, resolveComponent } from "vue";
1
+ import { defineComponent, computed, ref, unref, useSlots, createVNode, mergeProps, withDirectives, vShow, isVNode, createTextVNode, resolveComponent } from "vue";
2
2
  import "../alert/index.js";
3
3
  import "../avatar/index.js";
4
4
  import "../avatar-stack/index.js";
@@ -87,7 +87,6 @@ import "../modal/index.js";
87
87
  import "../progress/index.js";
88
88
  import "../segmented/index.js";
89
89
  import "../statistic/index.js";
90
- import "./index.js";
91
90
  import "../timeline/index.js";
92
91
  import "../transfer/index.js";
93
92
  import "../upload/index.js";
@@ -108,6 +107,7 @@ import "@popperjs/core";
108
107
  import "../../hooks/use-z-index/index.js";
109
108
  import "../message/index.js";
110
109
  import "../progress-i/index.js";
110
+ import "./index.js";
111
111
  import { FormCompEnum, getComponent, isInput, isDatePicker, isRangePicker } from "./component-map.js";
112
112
  import { createPlaceholderMessage } from "./use/helper.js";
113
113
  function _isSlot(s) {
@@ -1,5 +1,5 @@
1
1
  import { isNumber } from "@vft/utils";
2
- import { isInput, FormCompEnum } from "../component-map.js";
2
+ import { FormCompEnum, isInput } from "../component-map.js";
3
3
  function createPlaceholderMessage(type, label = "") {
4
4
  label = (label || "").replace(":", "") || "";
5
5
  if ([
@@ -1,14 +1,10 @@
1
- import type { ExtractPropTypes, ToRefs } from 'vue';
2
- export declare const useDelayedToggleProps: {
3
- readonly showAfter: import("vft/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
4
- readonly hideAfter: import("vft/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 200, boolean>;
5
- readonly autoClose: import("vft/es/utils").EpPropFinalized<NumberConstructor, unknown, unknown, 0, boolean>;
6
- };
7
- export type UseDelayedToggleProps = {
8
- open: (event?: Event) => void;
9
- close: (event?: Event) => void;
10
- } & ToRefs<ExtractPropTypes<typeof useDelayedToggleProps>>;
11
- export declare const useDelayedToggle: ({ showAfter, hideAfter, autoClose, open, close, }: UseDelayedToggleProps) => {
1
+ export declare const useDelayedToggle: ({ showAfter, hideAfter, autoClose, open, close, }: {
2
+ showAfter: any;
3
+ hideAfter: any;
4
+ autoClose: any;
5
+ open: any;
6
+ close: any;
7
+ }) => {
12
8
  onOpen: (event?: Event) => void;
13
9
  onClose: (event?: Event) => void;
14
10
  };
@@ -1,32 +1,6 @@
1
- import { unref } from "vue";
2
- import "@vueuse/core";
3
1
  import { isNumber } from "@vft/utils";
4
- import "../../components/config-provider/hooks/use-global-config.js";
5
- import { buildProps } from "../../utils/vue/props/runtime.js";
2
+ import { unref } from "vue";
6
3
  import { useTimeout } from "../use-timeout/index.js";
7
- const useDelayedToggleProps = buildProps({
8
- /**
9
- * @description delay of appearance, in millisecond
10
- */
11
- showAfter: {
12
- type: Number,
13
- default: 0
14
- },
15
- /**
16
- * @description delay of disappear, in millisecond
17
- */
18
- hideAfter: {
19
- type: Number,
20
- default: 200
21
- },
22
- /**
23
- * @description disappear automatically, in millisecond
24
- */
25
- autoClose: {
26
- type: Number,
27
- default: 0
28
- }
29
- });
30
4
  const useDelayedToggle = ({
31
5
  showAfter,
32
6
  hideAfter,
@@ -62,6 +36,5 @@ const useDelayedToggle = ({
62
36
  };
63
37
  };
64
38
  export {
65
- useDelayedToggle,
66
- useDelayedToggleProps
39
+ useDelayedToggle
67
40
  };
package/es/index.js CHANGED
@@ -87,7 +87,6 @@ export { VftModal } from "./components/modal/index.js";
87
87
  export { VftProgress } from "./components/progress/index.js";
88
88
  export { VftSegmented } from "./components/segmented/index.js";
89
89
  export { VftStatistic } from "./components/statistic/index.js";
90
- export { VftSuperForm } from "./components/super-form/index.js";
91
90
  export { VftTimeline, VftTimelineItem } from "./components/timeline/index.js";
92
91
  export { VftTransfer } from "./components/transfer/index.js";
93
92
  export { VftUpload } from "./components/upload/index.js";
@@ -102,6 +101,7 @@ export { VftInfiniteScroll } from "./components/infinite-scroll/index.js";
102
101
  export { VftLoading } from "./components/loading/index.js";
103
102
  export { VftMessage, Message } from "./components/message/index.js";
104
103
  export { VftProgressI } from "./components/progress-i/index.js";
104
+ export { VftSuperForm } from "./components/super-form/index.js";
105
105
  export { EVENT_CODE } from "./constants/aria.js";
106
106
  export { WEEK_DAYS, datePickTypes } from "./constants/date.js";
107
107
  export { CHANGE_EVENT, INPUT_EVENT, UPDATE_MODEL_EVENT } from "./constants/event.js";
@@ -196,13 +196,13 @@ export { countdownEmits, countdownProps } from "./components/countdown/countdown
196
196
  export { inputTagEmits, inputTagProps } from "./components/input-tag/input-tag.js";
197
197
  export { useModal, useModalInner } from "./components/modal/use/use-modal.js";
198
198
  export { defaultProps, segmentedEmits, segmentedProps } from "./components/segmented/segmented.js";
199
- export { FormCompEnum, clearComponents, getComponent, getRegisteredComponents, hasComponent, isDatePicker, isInput, isRangePicker, registerComponent, registerComponents, removeComponent } from "./components/super-form/component-map.js";
200
- export { getDynamicProps, useForm } from "./components/super-form/use/use-form.js";
201
199
  export { LEFT_CHECK_CHANGE_EVENT, RIGHT_CHECK_CHANGE_EVENT, transferCheckedChangeFn, transferEmits, transferProps } from "./components/transfer/transfer.js";
202
200
  export { genFileId, uploadContextKey } from "./components/upload/constants.js";
203
201
  export { watermarkProps } from "./components/watermark/watermark.js";
204
202
  export { vLoading, createLoadingDirective } from "./components/loading/directive.js";
205
203
  export { Loading } from "./components/loading/service.js";
206
204
  export { messageDefaults, messageTypes } from "./components/message/types.js";
205
+ export { FormCompEnum, clearComponents, getComponent, getRegisteredComponents, hasComponent, isDatePicker, isInput, isRangePicker, registerComponent, registerComponents, removeComponent } from "./components/super-form/component-map.js";
206
+ export { getDynamicProps, useForm } from "./components/super-form/use/use-form.js";
207
207
  const install = installer.install;
208
208
  const version = installer.version;
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  "name": "vft",
3
- "version": "0.0.375",
3
+ "version": "0.0.378",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.js",
@@ -1,4 +1,4 @@
1
- const version = "0.0.375";
1
+ const version = "0.0.378";
2
2
  export {
3
3
  version
4
4
  };
@@ -0,0 +1,3 @@
1
+ import type { ObjectDirective } from 'vue';
2
+ declare const ClickOutside: ObjectDirective;
3
+ export default ClickOutside;
@@ -0,0 +1,72 @@
1
+ import { isArray, isElement } from "@vft/utils";
2
+ const nodeList = /* @__PURE__ */ new Map();
3
+ let startClick;
4
+ document.addEventListener("mousedown", (e) => startClick = e);
5
+ document.addEventListener("mouseup", (e) => {
6
+ if (startClick) {
7
+ for (const handlers of nodeList.values()) {
8
+ for (const { documentHandler } of handlers) {
9
+ documentHandler(e, startClick);
10
+ }
11
+ }
12
+ startClick = void 0;
13
+ }
14
+ });
15
+ function createDocumentHandler(el, binding) {
16
+ let excludes = [];
17
+ if (isArray(binding.arg)) {
18
+ excludes = binding.arg;
19
+ } else if (isElement(binding.arg)) {
20
+ excludes.push(binding.arg);
21
+ }
22
+ return function(mouseup, mousedown) {
23
+ const popperRef = binding.instance.popperRef;
24
+ const mouseUpTarget = mouseup.target;
25
+ const mouseDownTarget = mousedown?.target;
26
+ const isBound = !binding || !binding.instance;
27
+ const isTargetExists = !mouseUpTarget || !mouseDownTarget;
28
+ const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
29
+ const isSelf = el === mouseUpTarget;
30
+ const isTargetExcluded = excludes.length && excludes.some((item) => item?.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
31
+ const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
32
+ if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
33
+ return;
34
+ }
35
+ binding.value(mouseup, mousedown);
36
+ };
37
+ }
38
+ const ClickOutside = {
39
+ beforeMount(el, binding) {
40
+ if (!nodeList.has(el)) {
41
+ nodeList.set(el, []);
42
+ }
43
+ nodeList.get(el).push({
44
+ documentHandler: createDocumentHandler(el, binding),
45
+ bindingFn: binding.value
46
+ });
47
+ },
48
+ updated(el, binding) {
49
+ if (!nodeList.has(el)) {
50
+ nodeList.set(el, []);
51
+ }
52
+ const handlers = nodeList.get(el);
53
+ const oldHandlerIndex = handlers.findIndex(
54
+ (item) => item.bindingFn === binding.oldValue
55
+ );
56
+ const newHandler = {
57
+ documentHandler: createDocumentHandler(el, binding),
58
+ bindingFn: binding.value
59
+ };
60
+ if (oldHandlerIndex >= 0) {
61
+ handlers.splice(oldHandlerIndex, 1, newHandler);
62
+ } else {
63
+ handlers.push(newHandler);
64
+ }
65
+ },
66
+ unmounted(el) {
67
+ nodeList.delete(el);
68
+ }
69
+ };
70
+ export {
71
+ ClickOutside as default
72
+ };
@@ -1,5 +1,7 @@
1
- import { isObject, hasOwn } from "@vft/utils";
1
+ import { isObject } from "@vft/utils";
2
2
  import { fromPairs } from "lodash-es";
3
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
4
+ const hasOwn = (val, key) => hasOwnProperty.call(val, key);
3
5
  const epPropKey = "__epPropKey";
4
6
  const definePropType = (val) => val;
5
7
  const isEpProp = (val) => isObject(val) && !!val[epPropKey];
@@ -1,4 +1,4 @@
1
- import { hasOwn, camelize, isArray } from "@vft/utils";
1
+ import { isArray, hasOwn, camelize } from "@vft/utils";
2
2
  import { isVNode, Fragment, Comment, Text, createCommentVNode, createBlock, openBlock } from "vue";
3
3
  import { debugWarn } from "../error.js";
4
4
  const SCOPE = "utils/vue/vnode";