cnhis-design-vue 3.1.16-beta.3 → 3.1.16-beta.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.
Files changed (36) hide show
  1. package/es/packages/big-table/index.d.ts +1 -429
  2. package/es/packages/big-table/src/BigTable.vue.d.ts +24 -449
  3. package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +70 -101
  4. package/es/packages/big-table/style/index.css +1 -2
  5. package/es/packages/fabric-chart/src/FabricChart.js +2 -1
  6. package/es/packages/fabric-chart/src/hooks/useLeft.js +8 -4
  7. package/es/packages/form-config/index.d.ts +2 -6
  8. package/es/packages/form-config/src/FormConfig.vue.d.ts +2 -6
  9. package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +1 -3
  10. package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +1 -3
  11. package/es/packages/form-render/index.d.ts +1 -3
  12. package/es/packages/form-render/src/FormRender.js +6 -3
  13. package/es/packages/form-render/src/FormRender.vue.d.ts +1 -3
  14. package/es/packages/form-render/src/components/renderer/cascader.js +2 -2
  15. package/es/packages/form-render/src/components/renderer/date.d.ts +20 -4
  16. package/es/packages/form-render/src/components/renderer/date.js +36 -20
  17. package/es/packages/form-render/src/components/renderer/linebar.js +1 -4
  18. package/es/packages/form-render/src/components/renderer/select.js +19 -13
  19. package/es/packages/form-render/src/components/renderer/slider.d.ts +8 -344
  20. package/es/packages/form-render/src/components/renderer/slider.js +23 -1
  21. package/es/packages/form-render/src/hooks/useAnchor.js +7 -4
  22. package/es/packages/form-render/src/hooks/useChangeContext.d.ts +4 -2
  23. package/es/packages/form-render/src/hooks/useChangeContext.js +4 -7
  24. package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +4 -4
  25. package/es/packages/form-render/src/hooks/useFormValidator.js +13 -3
  26. package/es/packages/form-render/src/hooks/useInitialData.d.ts +1 -1
  27. package/es/packages/form-render/src/hooks/useInitialData.js +9 -4
  28. package/es/packages/form-render/src/utils/business.js +15 -2
  29. package/es/packages/form-render/src/utils/index.d.ts +1 -1
  30. package/es/packages/form-render/src/utils/index.js +5 -2
  31. package/es/packages/form-render/src/utils/schema.d.ts +1 -0
  32. package/es/packages/form-render/src/utils/schema.js +12 -1
  33. package/es/packages/index.css +1 -2
  34. package/es/packages/shortcut-setter/index.d.ts +1 -3
  35. package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -3
  36. package/package.json +1 -1
@@ -1,7 +1,9 @@
1
1
  import { PropType } from 'vue';
2
2
  export declare const DATE: import("vue").DefineComponent<{
3
3
  onChange: {};
4
- value: {};
4
+ value: {
5
+ type: StringConstructor;
6
+ };
5
7
  validate: {
6
8
  type: PropType<Partial<{
7
9
  [key: string]: any;
@@ -16,9 +18,15 @@ export declare const DATE: import("vue").DefineComponent<{
16
18
  regular_error_tip: string;
17
19
  }>>;
18
20
  };
19
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
21
+ valueFormat: {
22
+ type: StringConstructor;
23
+ default: string;
24
+ };
25
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
20
26
  onChange: {};
21
- value: {};
27
+ value: {
28
+ type: StringConstructor;
29
+ };
22
30
  validate: {
23
31
  type: PropType<Partial<{
24
32
  [key: string]: any;
@@ -33,4 +41,12 @@ export declare const DATE: import("vue").DefineComponent<{
33
41
  regular_error_tip: string;
34
42
  }>>;
35
43
  };
36
- }>>, {}>;
44
+ valueFormat: {
45
+ type: StringConstructor;
46
+ default: string;
47
+ };
48
+ }>> & {
49
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
50
+ }, {
51
+ valueFormat: string;
52
+ }>;
@@ -1,19 +1,29 @@
1
- import { defineComponent, computed, createVNode } from 'vue';
2
- import { isField } from '@formily/core';
1
+ import { defineComponent, computed, watch, createVNode, mergeProps } from 'vue';
3
2
  import { connect, mapProps } from '@formily/vue';
4
3
  import { isObject } from '@vueuse/core';
4
+ import { format } from 'date-fns';
5
5
  import { NDatePicker } from 'naive-ui';
6
6
  import { useCommonInjection } from '../../../../../packages/form-render/src/hooks/useCommonInjection';
7
+ import { assignUpdateValue } from '../../../../../packages/form-render/src/utils';
7
8
 
8
9
  const script = defineComponent({
9
10
  props: {
10
11
  onChange: {},
11
- value: {},
12
+ value: {
13
+ type: String
14
+ },
12
15
  validate: {
13
16
  type: Object
17
+ },
18
+ valueFormat: {
19
+ type: String,
20
+ default: "yyyy-MM-dd"
14
21
  }
15
22
  },
16
- setup(props) {
23
+ emits: ["update:value"],
24
+ setup(props, {
25
+ emit
26
+ }) {
17
27
  useCommonInjection().injectValueValidate(() => props.value);
18
28
  function minCurrentDate() {
19
29
  var _a;
@@ -56,7 +66,9 @@ const script = defineComponent({
56
66
  }
57
67
  }
58
68
  const validateConfig = computed(() => {
59
- const result = {};
69
+ const result = {
70
+ valueFormat: props.valueFormat
71
+ };
60
72
  if (isObject(props.validate)) {
61
73
  const {
62
74
  min_date,
@@ -69,22 +81,26 @@ const script = defineComponent({
69
81
  }
70
82
  return result;
71
83
  });
72
- return () => createVNode(NDatePicker, validateConfig.value, null);
73
- }
74
- });
75
- const DATE = connect(script, mapProps((props, field) => {
76
- const _props = {
77
- ...props
78
- };
79
- if (isField(field)) {
80
- Object.assign(_props, {
81
- "formatted-value": field.value,
82
- "onUpdate:formatted-value"(v) {
83
- field.setValue(v);
84
- }
84
+ function formatDate(value) {
85
+ if (!value)
86
+ return value;
87
+ return format(new Date(value), props.valueFormat);
88
+ }
89
+ watch(() => props.value, (value) => {
90
+ if (!value || formatDate(value) === value)
91
+ return;
92
+ emit("update:value", formatDate(value));
93
+ });
94
+ const valueRef = computed({
95
+ get: () => formatDate(props.value),
96
+ set: (value) => emit("update:value", value)
85
97
  });
98
+ return () => createVNode(NDatePicker, mergeProps(validateConfig.value, {
99
+ "formatted-value": valueRef.value,
100
+ "onUpdate:formatted-value": ($event) => valueRef.value = $event
101
+ }), null);
86
102
  }
87
- return _props;
88
- }));
103
+ });
104
+ const DATE = connect(script, mapProps(assignUpdateValue));
89
105
 
90
106
  export { DATE };
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, onMounted, inject, createVNode } from 'vue';
1
+ import { defineComponent, ref, inject, createVNode } from 'vue';
2
2
  import { connect, mapProps } from '@formily/vue';
3
3
  import { NDivider, NCollapseTransition } from 'naive-ui';
4
4
  import { useFormField } from '../../../../../packages/form-render';
@@ -28,9 +28,6 @@ const script = defineComponent({
28
28
  slots
29
29
  }) {
30
30
  const _show = ref(props.show);
31
- onMounted(() => {
32
- _show.value = props.show;
33
- });
34
31
  function toggleShow() {
35
32
  if (props.disabled)
36
33
  return;
@@ -1,8 +1,8 @@
1
- import { defineComponent, ref, computed, inject, watch, createVNode } from 'vue';
1
+ import { defineComponent, computed, ref, inject, nextTick, watch, createVNode } from 'vue';
2
2
  import { isField } from '@formily/core';
3
- import { isEqual, cloneDeep } from 'lodash-es';
3
+ import { cloneDeep, isEqual } from 'lodash-es';
4
4
  import { useCommonInjection } from '../../../../../packages/form-render/src/hooks/useCommonInjection';
5
- import { InjectionChangeContextCollector, InjectAsyncQueue, InjectionFormItemDepsCollector } from '../../constants/index.js';
5
+ import { InjectAsyncQueue, InjectionChangeContextCollector, InjectionFormItemDepsCollector } from '../../constants/index.js';
6
6
  import { connect, mapProps } from '@formily/vue';
7
7
  import { NSelect } from 'naive-ui';
8
8
  import { useFormField } from '../../hooks/useFormField.js';
@@ -35,6 +35,10 @@ const script = defineComponent({
35
35
  slots,
36
36
  emit
37
37
  }) {
38
+ const valueRef = computed({
39
+ get: () => props.value,
40
+ set: (v) => emit("update:value", v)
41
+ });
38
42
  const remoteOptions = ref(null);
39
43
  const lastSearch = ref("");
40
44
  const labelKey = computed(() => {
@@ -45,11 +49,6 @@ const script = defineComponent({
45
49
  var _a, _b;
46
50
  return (_b = (_a = props.urlConfig) == null ? void 0 : _a.valueKey) != null ? _b : "value";
47
51
  });
48
- const changeContextCollector = inject(InjectionChangeContextCollector);
49
- function update(v, option) {
50
- changeContextCollector == null ? void 0 : changeContextCollector.setContext(fieldKey.value, "currentOption", cloneDeep(option));
51
- emit("update:value", v);
52
- }
53
52
  const {
54
53
  field,
55
54
  fieldKey
@@ -102,6 +101,13 @@ const script = defineComponent({
102
101
  });
103
102
  }
104
103
  });
104
+ const changeContextCollector = inject(InjectionChangeContextCollector);
105
+ changeContextCollector == null ? void 0 : changeContextCollector.setContext(fieldKey.value, async () => {
106
+ await nextTick();
107
+ return {
108
+ currentOption: cloneDeep(parsedOptions.value.find((option) => option[valueKey.value] === valueRef.value))
109
+ };
110
+ });
105
111
  const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
106
112
  watch(() => props.urlConfig, (config, oldConfig) => {
107
113
  if (isEqual(config, oldConfig))
@@ -114,7 +120,7 @@ const script = defineComponent({
114
120
  emit("update:value", null);
115
121
  !props.lazyRequest && await fetchData();
116
122
  });
117
- (props.value || !props.lazyRequest) && fetchData();
123
+ (valueRef.value || !props.lazyRequest) && fetchData();
118
124
  }, {
119
125
  immediate: true
120
126
  });
@@ -122,8 +128,8 @@ const script = defineComponent({
122
128
  injectValueValidate,
123
129
  injectValueWatchFromEmpty
124
130
  } = useCommonInjection();
125
- injectValueWatchFromEmpty(() => props.value, fetchData);
126
- injectValueValidate(() => props.value);
131
+ injectValueWatchFromEmpty(valueRef, fetchData);
132
+ injectValueValidate(valueRef);
127
133
  function focusDecorator(onFocus) {
128
134
  return (...args) => {
129
135
  if (isField(field.value)) {
@@ -135,8 +141,8 @@ const script = defineComponent({
135
141
  return () => createVNode(NSelect, {
136
142
  "remote": true,
137
143
  "filterable": true,
138
- "value": props.value,
139
- "onUpdate:value": update,
144
+ "value": valueRef.value,
145
+ "onUpdate:value": ($event) => valueRef.value = $event,
140
146
  "labelField": labelKey.value,
141
147
  "valueField": valueKey.value,
142
148
  "options": parsedOptions.value,
@@ -1,347 +1,11 @@
1
1
  export declare const SLIDER: import("vue").DefineComponent<{
2
- readonly to: {
3
- type: import("vue").PropType<string | boolean | HTMLElement>;
4
- default: undefined;
2
+ value: {
3
+ type: (NumberConstructor | StringConstructor)[];
5
4
  };
6
- readonly defaultValue: {
7
- readonly type: import("vue").PropType<number | number[]>;
8
- readonly default: 0;
5
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
6
+ value: {
7
+ type: (NumberConstructor | StringConstructor)[];
9
8
  };
10
- readonly marks: import("vue").PropType<Record<string, string>>;
11
- readonly disabled: {
12
- readonly type: import("vue").PropType<boolean | undefined>;
13
- readonly default: undefined;
14
- };
15
- readonly formatTooltip: import("vue").PropType<(value: number) => string | number>;
16
- readonly min: {
17
- readonly type: NumberConstructor;
18
- readonly default: 0;
19
- };
20
- readonly max: {
21
- readonly type: NumberConstructor;
22
- readonly default: 100;
23
- };
24
- readonly step: {
25
- readonly type: import("vue").PropType<number | "mark">;
26
- readonly default: 1;
27
- };
28
- readonly range: BooleanConstructor;
29
- readonly value: import("vue").PropType<number | number[]>;
30
- readonly placement: import("vue").PropType<import("naive-ui").PopoverPlacement>;
31
- readonly showTooltip: {
32
- readonly type: import("vue").PropType<boolean | undefined>;
33
- readonly default: undefined;
34
- };
35
- readonly tooltip: {
36
- readonly type: BooleanConstructor;
37
- readonly default: true;
38
- };
39
- readonly vertical: BooleanConstructor;
40
- readonly reverse: BooleanConstructor;
41
- readonly 'onUpdate:value': import("vue").PropType<import("naive-ui/es/_utils").MaybeArray<(value: number & number[]) => void>>;
42
- readonly onUpdateValue: import("vue").PropType<import("naive-ui/es/_utils").MaybeArray<(value: number & number[]) => void>>;
43
- readonly theme: import("vue").PropType<import("naive-ui/es/_mixins").Theme<"Slider", {
44
- fontSize: string;
45
- railColor: string;
46
- railColorHover: string;
47
- fillColor: string;
48
- fillColorHover: string;
49
- opacityDisabled: string;
50
- handleColor: string;
51
- dotColor: string;
52
- dotColorModal: string;
53
- dotColorPopover: string;
54
- handleBoxShadow: string;
55
- handleBoxShadowHover: string;
56
- handleBoxShadowActive: string;
57
- handleBoxShadowFocus: string;
58
- indicatorColor: string;
59
- indicatorBoxShadow: string;
60
- indicatorTextColor: string;
61
- indicatorBorderRadius: string;
62
- dotBorder: string;
63
- dotBorderActive: string;
64
- dotBoxShadow: string;
65
- railHeight: string;
66
- railWidthVertical: string;
67
- handleSize: string;
68
- dotHeight: string;
69
- dotWidth: string;
70
- dotBorderRadius: string;
71
- }, any>>;
72
- readonly themeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Slider", {
73
- fontSize: string;
74
- railColor: string;
75
- railColorHover: string;
76
- fillColor: string;
77
- fillColorHover: string;
78
- opacityDisabled: string;
79
- handleColor: string;
80
- dotColor: string;
81
- dotColorModal: string;
82
- dotColorPopover: string;
83
- handleBoxShadow: string;
84
- handleBoxShadowHover: string;
85
- handleBoxShadowActive: string;
86
- handleBoxShadowFocus: string;
87
- indicatorColor: string;
88
- indicatorBoxShadow: string;
89
- indicatorTextColor: string;
90
- indicatorBorderRadius: string;
91
- dotBorder: string;
92
- dotBorderActive: string;
93
- dotBoxShadow: string;
94
- railHeight: string;
95
- railWidthVertical: string;
96
- handleSize: string;
97
- dotHeight: string;
98
- dotWidth: string;
99
- dotBorderRadius: string;
100
- }, any>>>;
101
- readonly builtinThemeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Slider", {
102
- fontSize: string;
103
- railColor: string;
104
- railColorHover: string;
105
- fillColor: string;
106
- fillColorHover: string;
107
- opacityDisabled: string;
108
- handleColor: string;
109
- dotColor: string;
110
- dotColorModal: string;
111
- dotColorPopover: string;
112
- handleBoxShadow: string;
113
- handleBoxShadowHover: string;
114
- handleBoxShadowActive: string;
115
- handleBoxShadowFocus: string;
116
- indicatorColor: string;
117
- indicatorBoxShadow: string;
118
- indicatorTextColor: string;
119
- indicatorBorderRadius: string;
120
- dotBorder: string;
121
- dotBorderActive: string;
122
- dotBoxShadow: string;
123
- railHeight: string;
124
- railWidthVertical: string;
125
- handleSize: string;
126
- dotHeight: string;
127
- dotWidth: string;
128
- dotBorderRadius: string;
129
- }, any>>>;
130
- }, {
131
- mergedClsPrefix: import("vue").ComputedRef<string>;
132
- namespace: import("vue").ComputedRef<string | undefined>;
133
- uncontrolledValue: import("vue").Ref<number | number[]>;
134
- mergedValue: import("vue").ComputedRef<number | number[]>;
135
- mergedDisabled: import("vue").ComputedRef<boolean>;
136
- mergedPlacement: import("vue").ComputedRef<import("naive-ui").PopoverPlacement>;
137
- isMounted: Readonly<import("vue").Ref<boolean>>;
138
- adjustedTo: import("vue").ComputedRef<string | HTMLElement>;
139
- dotTransitionDisabled: import("vue").Ref<boolean>;
140
- markInfos: import("vue").ComputedRef<{
141
- active: boolean;
142
- label: string;
143
- style: import("vue").CSSProperties;
144
- }[]>;
145
- isShowTooltip: (index: number) => boolean;
146
- shouldKeepTooltipTransition: (index: number) => boolean;
147
- handleRailRef: import("vue").Ref<HTMLElement | null>;
148
- setHandleRefs: (key: number) => (el: any) => void;
149
- setFollowerRefs: (key: number) => (el: any) => void;
150
- fillStyle: import("vue").ComputedRef<{
151
- [x: string]: string;
152
- height: string;
153
- width?: undefined;
154
- } | {
155
- [x: string]: string;
156
- width: string;
157
- height?: undefined;
158
- } | undefined>;
159
- getHandleStyle: (value: number, index: number) => Record<string, any>;
160
- activeIndex: import("vue").Ref<number>;
161
- arrifiedValues: import("vue").ComputedRef<number[]>;
162
- followerEnabledIndexSet: import("vue").Ref<Set<number>>;
163
- handleRailMouseDown: (event: MouseEvent | TouchEvent) => void;
164
- handleHandleFocus: (index: number) => void;
165
- handleHandleBlur: (index: number) => void;
166
- handleHandleMouseEnter: (index: number) => void;
167
- handleHandleMouseLeave: (index: number) => void;
168
- handleRailKeyDown: (e: KeyboardEvent) => void;
169
- indicatorCssVars: import("vue").ComputedRef<{
170
- '--n-font-size': string;
171
- '--n-indicator-border-radius': string;
172
- '--n-indicator-box-shadow': string;
173
- '--n-indicator-color': string;
174
- '--n-indicator-text-color': string;
175
- }> | undefined;
176
- indicatorThemeClass: import("vue").Ref<string> | undefined;
177
- indicatorOnRender: (() => void) | undefined;
178
- cssVars: import("vue").ComputedRef<{
179
- '--n-bezier': string;
180
- '--n-dot-border': string;
181
- '--n-dot-border-active': string;
182
- '--n-dot-border-radius': string;
183
- '--n-dot-box-shadow': string;
184
- '--n-dot-color': string;
185
- '--n-dot-color-modal': string;
186
- '--n-dot-color-popover': string;
187
- '--n-dot-height': string;
188
- '--n-dot-width': string;
189
- '--n-fill-color': string;
190
- '--n-fill-color-hover': string;
191
- '--n-font-size': string;
192
- '--n-handle-box-shadow': string;
193
- '--n-handle-box-shadow-active': string;
194
- '--n-handle-box-shadow-focus': string;
195
- '--n-handle-box-shadow-hover': string;
196
- '--n-handle-color': string;
197
- '--n-handle-size': string;
198
- '--n-opacity-disabled': string;
199
- '--n-rail-color': string;
200
- '--n-rail-color-hover': string;
201
- '--n-rail-height': string;
202
- '--n-rail-width-vertical': string;
203
- }> | undefined;
204
- themeClass: import("vue").Ref<string> | undefined;
205
- onRender: (() => void) | undefined;
206
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
207
- readonly to: {
208
- type: import("vue").PropType<string | boolean | HTMLElement>;
209
- default: undefined;
210
- };
211
- readonly defaultValue: {
212
- readonly type: import("vue").PropType<number | number[]>;
213
- readonly default: 0;
214
- };
215
- readonly marks: import("vue").PropType<Record<string, string>>;
216
- readonly disabled: {
217
- readonly type: import("vue").PropType<boolean | undefined>;
218
- readonly default: undefined;
219
- };
220
- readonly formatTooltip: import("vue").PropType<(value: number) => string | number>;
221
- readonly min: {
222
- readonly type: NumberConstructor;
223
- readonly default: 0;
224
- };
225
- readonly max: {
226
- readonly type: NumberConstructor;
227
- readonly default: 100;
228
- };
229
- readonly step: {
230
- readonly type: import("vue").PropType<number | "mark">;
231
- readonly default: 1;
232
- };
233
- readonly range: BooleanConstructor;
234
- readonly value: import("vue").PropType<number | number[]>;
235
- readonly placement: import("vue").PropType<import("naive-ui").PopoverPlacement>;
236
- readonly showTooltip: {
237
- readonly type: import("vue").PropType<boolean | undefined>;
238
- readonly default: undefined;
239
- };
240
- readonly tooltip: {
241
- readonly type: BooleanConstructor;
242
- readonly default: true;
243
- };
244
- readonly vertical: BooleanConstructor;
245
- readonly reverse: BooleanConstructor;
246
- readonly 'onUpdate:value': import("vue").PropType<import("naive-ui/es/_utils").MaybeArray<(value: number & number[]) => void>>;
247
- readonly onUpdateValue: import("vue").PropType<import("naive-ui/es/_utils").MaybeArray<(value: number & number[]) => void>>;
248
- readonly theme: import("vue").PropType<import("naive-ui/es/_mixins").Theme<"Slider", {
249
- fontSize: string;
250
- railColor: string;
251
- railColorHover: string;
252
- fillColor: string;
253
- fillColorHover: string;
254
- opacityDisabled: string;
255
- handleColor: string;
256
- dotColor: string;
257
- dotColorModal: string;
258
- dotColorPopover: string;
259
- handleBoxShadow: string;
260
- handleBoxShadowHover: string;
261
- handleBoxShadowActive: string;
262
- handleBoxShadowFocus: string;
263
- indicatorColor: string;
264
- indicatorBoxShadow: string;
265
- indicatorTextColor: string;
266
- indicatorBorderRadius: string;
267
- dotBorder: string;
268
- dotBorderActive: string;
269
- dotBoxShadow: string;
270
- railHeight: string;
271
- railWidthVertical: string;
272
- handleSize: string;
273
- dotHeight: string;
274
- dotWidth: string;
275
- dotBorderRadius: string;
276
- }, any>>;
277
- readonly themeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Slider", {
278
- fontSize: string;
279
- railColor: string;
280
- railColorHover: string;
281
- fillColor: string;
282
- fillColorHover: string;
283
- opacityDisabled: string;
284
- handleColor: string;
285
- dotColor: string;
286
- dotColorModal: string;
287
- dotColorPopover: string;
288
- handleBoxShadow: string;
289
- handleBoxShadowHover: string;
290
- handleBoxShadowActive: string;
291
- handleBoxShadowFocus: string;
292
- indicatorColor: string;
293
- indicatorBoxShadow: string;
294
- indicatorTextColor: string;
295
- indicatorBorderRadius: string;
296
- dotBorder: string;
297
- dotBorderActive: string;
298
- dotBoxShadow: string;
299
- railHeight: string;
300
- railWidthVertical: string;
301
- handleSize: string;
302
- dotHeight: string;
303
- dotWidth: string;
304
- dotBorderRadius: string;
305
- }, any>>>;
306
- readonly builtinThemeOverrides: import("vue").PropType<import("naive-ui/es/_mixins/use-theme").ExtractThemeOverrides<import("naive-ui/es/_mixins").Theme<"Slider", {
307
- fontSize: string;
308
- railColor: string;
309
- railColorHover: string;
310
- fillColor: string;
311
- fillColorHover: string;
312
- opacityDisabled: string;
313
- handleColor: string;
314
- dotColor: string;
315
- dotColorModal: string;
316
- dotColorPopover: string;
317
- handleBoxShadow: string;
318
- handleBoxShadowHover: string;
319
- handleBoxShadowActive: string;
320
- handleBoxShadowFocus: string;
321
- indicatorColor: string;
322
- indicatorBoxShadow: string;
323
- indicatorTextColor: string;
324
- indicatorBorderRadius: string;
325
- dotBorder: string;
326
- dotBorderActive: string;
327
- dotBoxShadow: string;
328
- railHeight: string;
329
- railWidthVertical: string;
330
- handleSize: string;
331
- dotHeight: string;
332
- dotWidth: string;
333
- dotBorderRadius: string;
334
- }, any>>>;
335
- }>>, {
336
- readonly range: boolean;
337
- readonly reverse: boolean;
338
- readonly vertical: boolean;
339
- readonly tooltip: boolean;
340
- readonly disabled: boolean | undefined;
341
- readonly step: number | "mark";
342
- readonly max: number;
343
- readonly min: number;
344
- readonly to: string | boolean | HTMLElement;
345
- readonly defaultValue: number | number[];
346
- readonly showTooltip: boolean | undefined;
347
- }>;
9
+ }>> & {
10
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
11
+ }, {}>;
@@ -1,8 +1,30 @@
1
+ import { defineComponent, computed, createVNode } from 'vue';
1
2
  import { connect, mapProps } from '@formily/vue';
2
3
  import { NSlider } from 'naive-ui';
4
+ import { parseNumberFromMaybeString } from '../../utils/index.js';
3
5
  import { assignUpdateValue } from '../../utils/schema.js';
4
6
 
5
- const SLIDER = connect(NSlider, mapProps((props, field) => {
7
+ const script = defineComponent({
8
+ props: {
9
+ value: {
10
+ type: [Number, String]
11
+ }
12
+ },
13
+ emits: ["update:value"],
14
+ setup(props, {
15
+ emit
16
+ }) {
17
+ const valueRef = computed({
18
+ get: () => parseNumberFromMaybeString(props.value),
19
+ set: (v) => emit("update:value", v)
20
+ });
21
+ return () => createVNode(NSlider, {
22
+ "value": valueRef.value,
23
+ "onUpdate:value": ($event) => valueRef.value = $event
24
+ }, null);
25
+ }
26
+ });
27
+ const SLIDER = connect(script, mapProps((props, field) => {
6
28
  const _props = assignUpdateValue(props, field);
7
29
  if (Array.isArray(_props.option)) {
8
30
  _props.marks = _props.option.reduce((fin, option) => {
@@ -37,7 +37,7 @@ function useAnchor(props, scrollbarRef, collector) {
37
37
  doAnimation(scrollbarRef.value.scrollTop, targetAnchor.offsetTop, 300, (top) => {
38
38
  var _a;
39
39
  (_a = scrollbarRef.value) == null ? void 0 : _a.scrollTo({ top });
40
- }, "easeInSine", resolve);
40
+ }, "easeInSine", () => setTimeout(resolve, 300));
41
41
  });
42
42
  } finally {
43
43
  scrollLock = false;
@@ -48,11 +48,14 @@ function useAnchor(props, scrollbarRef, collector) {
48
48
  if (scrollLock || !scrollbarRef.value)
49
49
  return;
50
50
  const { scrollTop, clientHeight } = scrollbarRef.value;
51
- const result = anchorIdList.value.find((anchor) => {
52
- const node = scrollbarRef.value.querySelector(`#${createLinebarId(anchor.name)}`);
51
+ const result = anchorIdList.value.find((anchor, idx, arr) => {
52
+ const nextAnchor = arr[idx + 1];
53
+ if (!nextAnchor)
54
+ return true;
55
+ const node = scrollbarRef.value.querySelector(`#${createLinebarId(nextAnchor.name)}`);
53
56
  if (!node)
54
57
  return;
55
- return node.offsetTop >= scrollTop || node.offsetTop < scrollTop && node.clientHeight + node.offsetTop > scrollTop + clientHeight;
58
+ return node.offsetTop > scrollTop + clientHeight / 2;
56
59
  }) || anchorIdList.value[anchorIdList.value.length - 1];
57
60
  __currentAnchor.value = (_a = result == null ? void 0 : result.name) != null ? _a : "";
58
61
  }, 300);
@@ -1,10 +1,12 @@
1
1
  import { FormChangeContext } from '../types';
2
2
  export declare class ContextCollector {
3
3
  private readonly contextMap;
4
- setContext<T extends keyof FormChangeContext>(key: string, prop: T, value: FormChangeContext[T]): void;
4
+ setContext(key: string, value: () => Promise<FormChangeContext> | FormChangeContext): void;
5
5
  getContext(key: string): Partial<{
6
6
  currentOption: import("../../../../src/types").AnyObject;
7
- }>;
7
+ }> | Promise<Partial<{
8
+ currentOption: import("../../../../src/types").AnyObject;
9
+ }>> | undefined;
8
10
  }
9
11
  export declare function useChangeContext(): {
10
12
  create: () => ContextCollector;
@@ -2,15 +2,12 @@ class ContextCollector {
2
2
  constructor() {
3
3
  this.contextMap = /* @__PURE__ */ new Map();
4
4
  }
5
- setContext(key, prop, value) {
6
- const context = this.contextMap.get(key) || {};
7
- context[prop] = value;
8
- this.contextMap.set(key, context);
5
+ setContext(key, value) {
6
+ this.contextMap.set(key, value);
9
7
  }
10
8
  getContext(key) {
11
- const result = this.contextMap.get(key) || {};
12
- this.contextMap.delete(key);
13
- return result;
9
+ var _a;
10
+ return (_a = this.contextMap.get(key)) == null ? void 0 : _a();
14
11
  }
15
12
  }
16
13
  function useChangeContext() {