@mpxjs/webpack-plugin 2.10.16 → 2.10.17-beta.10
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/lib/config.js +60 -0
- package/lib/dependencies/AppEntryDependency.js +2 -2
- package/lib/dependencies/RecordModuleIdMapDependency.js +49 -0
- package/lib/dependencies/ResolveDependency.js +1 -1
- package/lib/file-loader.js +4 -1
- package/lib/global.d.ts +245 -0
- package/lib/helpers.js +2 -0
- package/lib/index.js +80 -19
- package/lib/json-compiler/helper.js +72 -2
- package/lib/json-compiler/index.js +45 -59
- package/lib/json-compiler/plugin.js +2 -2
- package/lib/loader.js +14 -4
- package/lib/native-loader.js +6 -3
- package/lib/platform/json/wx/index.js +30 -29
- package/lib/platform/style/wx/index.js +51 -36
- package/lib/platform/template/wx/component-config/ad.js +5 -0
- package/lib/platform/template/wx/component-config/button.js +22 -6
- package/lib/platform/template/wx/component-config/camera.js +25 -3
- package/lib/platform/template/wx/component-config/canvas.js +8 -1
- package/lib/platform/template/wx/component-config/component.js +31 -33
- package/lib/platform/template/wx/component-config/cover-image.js +7 -2
- package/lib/platform/template/wx/component-config/cover-view.js +3 -1
- package/lib/platform/template/wx/component-config/fix-component-name.js +2 -2
- package/lib/platform/template/wx/component-config/form.js +27 -2
- package/lib/platform/template/wx/component-config/image.js +5 -0
- package/lib/platform/template/wx/component-config/input.js +11 -1
- package/lib/platform/template/wx/component-config/label.js +10 -2
- package/lib/platform/template/wx/component-config/map.js +11 -0
- package/lib/platform/template/wx/component-config/movable-area.js +4 -1
- package/lib/platform/template/wx/component-config/movable-view.js +17 -2
- package/lib/platform/template/wx/component-config/navigator.js +26 -0
- package/lib/platform/template/wx/component-config/picker-view.js +12 -0
- package/lib/platform/template/wx/component-config/picker.js +3 -1
- package/lib/platform/template/wx/component-config/progress.js +11 -1
- package/lib/platform/template/wx/component-config/rich-text.js +5 -0
- package/lib/platform/template/wx/component-config/scroll-view.js +12 -1
- package/lib/platform/template/wx/component-config/slider.js +8 -0
- package/lib/platform/template/wx/component-config/swiper-item.js +5 -2
- package/lib/platform/template/wx/component-config/swiper.js +10 -0
- package/lib/platform/template/wx/component-config/text.js +5 -0
- package/lib/platform/template/wx/component-config/textarea.js +20 -3
- package/lib/platform/template/wx/component-config/unsupported.js +10 -1
- package/lib/platform/template/wx/component-config/video.js +10 -0
- package/lib/platform/template/wx/index.js +21 -1
- package/lib/react/LoadAsyncChunkModule.js +1 -1
- package/lib/react/index.js +2 -0
- package/lib/react/processJSON.js +59 -72
- package/lib/react/processScript.js +1 -0
- package/lib/react/processStyles.js +24 -11
- package/lib/react/processTemplate.js +8 -6
- package/lib/react/script-helper.js +6 -17
- package/lib/react/style-helper.js +84 -13
- package/lib/resolver/AddModePlugin.js +23 -8
- package/lib/runtime/components/ali/mpx-recycle-view.mpx +518 -0
- package/lib/runtime/components/ali/mpx-sticky-header.mpx +212 -0
- package/lib/runtime/components/ali/mpx-sticky-section.mpx +17 -0
- package/lib/runtime/components/react/animationHooks/index.ts +75 -0
- package/lib/runtime/components/react/animationHooks/useAnimationAPIHooks.ts +198 -0
- package/lib/runtime/components/react/animationHooks/useTransitionHooks.ts +301 -0
- package/lib/runtime/components/react/animationHooks/utils.ts +197 -0
- package/lib/runtime/components/react/context.ts +19 -7
- package/lib/runtime/components/react/dist/animationHooks/index.d.ts +15 -0
- package/lib/runtime/components/react/dist/animationHooks/index.js +67 -0
- package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.d.ts +3 -0
- package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.js +182 -0
- package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.d.ts +3 -0
- package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.js +279 -0
- package/lib/runtime/components/react/dist/animationHooks/utils.d.ts +109 -0
- package/lib/runtime/components/react/dist/animationHooks/utils.js +151 -0
- package/lib/runtime/components/react/dist/context.d.ts +79 -0
- package/lib/runtime/components/react/dist/context.js +1 -0
- package/lib/runtime/components/react/dist/event.config.d.ts +7 -0
- package/lib/runtime/components/react/dist/getInnerListeners.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts +12 -0
- package/lib/runtime/components/react/dist/mpx-button.d.ts +68 -0
- package/lib/runtime/components/react/dist/mpx-camera.d.ts +31 -0
- package/lib/runtime/components/react/dist/mpx-camera.jsx +236 -0
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts +23 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts +8 -0
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts +10 -0
- package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts +2 -0
- package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +32 -0
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +52 -0
- package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +32 -0
- package/lib/runtime/components/react/dist/mpx-form.d.ts +27 -0
- package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +18 -0
- package/lib/runtime/components/react/dist/mpx-image.d.ts +21 -0
- package/lib/runtime/components/react/dist/mpx-image.jsx +109 -59
- package/lib/runtime/components/react/dist/mpx-inline-text.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-input.d.ts +51 -0
- package/lib/runtime/components/react/dist/mpx-input.jsx +52 -17
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts +12 -0
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +62 -49
- package/lib/runtime/components/react/dist/mpx-label.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +65 -0
- package/lib/runtime/components/react/dist/mpx-nav.d.ts +8 -0
- package/lib/runtime/components/react/dist/mpx-nav.jsx +132 -0
- package/lib/runtime/components/react/dist/mpx-navigator.d.ts +9 -0
- package/lib/runtime/components/react/dist/mpx-picker/date.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-picker/index.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/region.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts +2 -0
- package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/time.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/type.d.ts +106 -0
- package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts +32 -0
- package/lib/runtime/components/react/dist/mpx-picker-view/index.jsx +4 -3
- package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts +8 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +23 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.jsx +12 -18
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts +14 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.jsx +8 -11
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts +13 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.jsx +20 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts +16 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts +12 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts +11 -0
- package/lib/runtime/components/react/dist/mpx-popup/index.d.ts +22 -0
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts +16 -0
- package/lib/runtime/components/react/dist/mpx-portal/index.d.ts +15 -0
- package/lib/runtime/components/react/dist/mpx-portal/index.jsx +5 -1
- package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts +29 -0
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts +9 -0
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-progress.d.ts +23 -0
- package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-radio.d.ts +26 -0
- package/lib/runtime/components/react/dist/mpx-recycle-view.d.ts +45 -0
- package/lib/runtime/components/react/dist/mpx-recycle-view.jsx +307 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +24 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-root-portal.d.ts +14 -0
- package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +54 -0
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +6 -14
- package/lib/runtime/components/react/dist/mpx-simple-text.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-slider.d.ts +30 -0
- package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +17 -0
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +15 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +18 -0
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts +63 -0
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +77 -44
- package/lib/runtime/components/react/dist/mpx-switch.d.ts +26 -0
- package/lib/runtime/components/react/dist/mpx-text.d.ts +22 -0
- package/lib/runtime/components/react/dist/mpx-text.jsx +33 -5
- package/lib/runtime/components/react/dist/mpx-textarea.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-video.d.ts +101 -0
- package/lib/runtime/components/react/dist/mpx-view.d.ts +35 -0
- package/lib/runtime/components/react/dist/mpx-view.jsx +23 -9
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts +22 -0
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +11 -3
- package/lib/runtime/components/react/dist/parser.d.ts +39 -0
- package/lib/runtime/components/react/dist/useNodesRef.d.ts +11 -0
- package/lib/runtime/components/react/dist/utils.d.ts +124 -0
- package/lib/runtime/components/react/dist/utils.jsx +42 -17
- package/lib/runtime/components/react/mpx-camera.tsx +327 -0
- package/lib/runtime/components/react/mpx-canvas/index.tsx +1 -1
- package/lib/runtime/components/react/mpx-image.tsx +132 -79
- package/lib/runtime/components/react/mpx-input.tsx +63 -24
- package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +70 -48
- package/lib/runtime/components/react/mpx-nav.tsx +155 -0
- package/lib/runtime/components/react/mpx-picker-view/index.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker-view-column/index.tsx +26 -21
- package/lib/runtime/components/react/mpx-picker-view-column/pickerViewColumnItem.tsx +8 -12
- package/lib/runtime/components/react/mpx-picker-view-column/pickerViewColumnItemLite.tsx +55 -0
- package/lib/runtime/components/react/mpx-portal/index.tsx +8 -2
- package/lib/runtime/components/react/mpx-portal/portal-manager.tsx +2 -2
- package/lib/runtime/components/react/mpx-recycle-view.tsx +437 -0
- package/lib/runtime/components/react/mpx-rich-text/index.tsx +1 -1
- package/lib/runtime/components/react/mpx-scroll-view.tsx +7 -17
- package/lib/runtime/components/react/mpx-sticky-section.tsx +1 -1
- package/lib/runtime/components/react/mpx-swiper.tsx +92 -42
- package/lib/runtime/components/react/mpx-text.tsx +38 -5
- package/lib/runtime/components/react/mpx-view.tsx +28 -13
- package/lib/runtime/components/react/mpx-web-view.tsx +14 -5
- package/lib/runtime/components/react/tsconfig.json +26 -0
- package/lib/runtime/components/react/types/common.d.ts +19 -0
- package/lib/runtime/components/react/types/global.d.ts +1 -0
- package/lib/runtime/components/react/utils.tsx +43 -21
- package/lib/runtime/components/web/mpx-recycle-view.vue +508 -0
- package/lib/runtime/components/wx/mpx-list-header-default.mpx +21 -0
- package/lib/runtime/components/wx/mpx-recycle-item-default.mpx +21 -0
- package/lib/runtime/components/wx/mpx-recycle-view.mpx +193 -0
- package/lib/runtime/components/wx/mpx-section-header-default.mpx +21 -0
- package/lib/runtime/optionProcessor.js +5 -0
- package/lib/runtime/optionProcessorReact.js +7 -0
- package/lib/runtime/stringify.wxs +2 -2
- package/lib/script-setup-compiler/index.js +2 -2
- package/lib/style-compiler/index.js +3 -2
- package/lib/style-compiler/load-postcss-config.js +1 -1
- package/lib/style-compiler/plugins/trans-special.js +10 -2
- package/lib/style-compiler/strip-conditional-loader/rebaseUrl.js +225 -0
- package/lib/style-compiler/strip-conditional-loader.js +124 -18
- package/lib/template-compiler/compiler.js +272 -72
- package/lib/template-compiler/gen-node-react.js +18 -6
- package/lib/template-compiler/index.js +6 -4
- package/lib/template-compiler/parse-exps.js +1 -1
- package/lib/utils/const.js +19 -1
- package/lib/utils/dom-tag-config.js +6 -6
- package/lib/utils/env.js +6 -1
- package/lib/utils/get-build-tag-component.js +35 -0
- package/lib/utils/merge-visitors.js +55 -0
- package/lib/utils/pre-process-json.js +5 -0
- package/lib/utils/process-extend-components.js +43 -0
- package/lib/utils/string.js +25 -1
- package/lib/web/index.js +2 -0
- package/lib/web/processJSON.js +64 -18
- package/lib/web/processScript.js +1 -1
- package/lib/web/processTemplate.js +6 -4
- package/lib/web/script-helper.js +19 -9
- package/lib/wxs/pre-loader.js +9 -6
- package/lib/wxss/loader.js +1 -9
- package/package.json +11 -7
- package/LICENSE +0 -433
- package/lib/runtime/components/react/dist/useAnimationHooks.js +0 -289
- package/lib/runtime/components/react/useAnimationHooks.ts +0 -320
- package/lib/utils/chain-assign.js +0 -47
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const enum PickerMode {
|
|
3
|
+
SELECTOR = "selector",
|
|
4
|
+
MULTI_SELECTOR = "multiSelector",
|
|
5
|
+
TIME = "time",
|
|
6
|
+
DATE = "date",
|
|
7
|
+
REGION = "region"
|
|
8
|
+
}
|
|
9
|
+
export type PickerValue = number;
|
|
10
|
+
export type Obj = Record<string, any>;
|
|
11
|
+
export type RangeItem = Obj | number | string;
|
|
12
|
+
export type TimeValue = `${number}-${number}-${number}` | '';
|
|
13
|
+
/** 通用属性 */
|
|
14
|
+
export interface BasePickerProps {
|
|
15
|
+
/** --- 小程序属性 --- */
|
|
16
|
+
/** 选择器类型, 默认值 selector */
|
|
17
|
+
mode?: PickerMode;
|
|
18
|
+
/** 是否禁用, 默认值 false */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** 点击取消按钮时触发 */
|
|
21
|
+
bindcancel?: Function;
|
|
22
|
+
/** 头部标题 */
|
|
23
|
+
'header-text'?: string;
|
|
24
|
+
/** --- 内部组件属性 --- */
|
|
25
|
+
/** 作为表单组件时的名称 */
|
|
26
|
+
name?: string;
|
|
27
|
+
style?: Record<string, any>;
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
range?: RangeItem[];
|
|
30
|
+
ref?: any;
|
|
31
|
+
}
|
|
32
|
+
export interface SelectorProps extends BasePickerProps {
|
|
33
|
+
mode: PickerMode.SELECTOR;
|
|
34
|
+
/** 默认值 0 */
|
|
35
|
+
value?: number;
|
|
36
|
+
/** 默认值 [] */
|
|
37
|
+
range?: RangeItem[];
|
|
38
|
+
'range-key'?: string;
|
|
39
|
+
/** 点击确认按钮后触发 change 事件, event.detail = {value} */
|
|
40
|
+
bindchange?: Function;
|
|
41
|
+
}
|
|
42
|
+
export interface MultiSelectorProps extends BasePickerProps {
|
|
43
|
+
mode: PickerMode.MULTI_SELECTOR;
|
|
44
|
+
/** 默认值 [] */
|
|
45
|
+
value?: number[];
|
|
46
|
+
range?: RangeItem[];
|
|
47
|
+
'range-key'?: string;
|
|
48
|
+
bindchange?: Function;
|
|
49
|
+
bindcolumnchange?: Function;
|
|
50
|
+
}
|
|
51
|
+
export interface TimeProps extends BasePickerProps {
|
|
52
|
+
mode: PickerMode.TIME;
|
|
53
|
+
/** 表示选中的时间,格式为"hh:mm" */
|
|
54
|
+
value?: string;
|
|
55
|
+
start?: string;
|
|
56
|
+
end?: string;
|
|
57
|
+
bindchange?: Function;
|
|
58
|
+
}
|
|
59
|
+
export interface DateProps extends BasePickerProps {
|
|
60
|
+
mode: PickerMode.DATE;
|
|
61
|
+
/** 默认值 '' */
|
|
62
|
+
value?: TimeValue;
|
|
63
|
+
start?: TimeValue;
|
|
64
|
+
end?: TimeValue;
|
|
65
|
+
/** 有效值 year,month,day,表示选择器的粒度 */
|
|
66
|
+
fields?: 'day' | 'month' | 'year';
|
|
67
|
+
bindchange?: Function;
|
|
68
|
+
}
|
|
69
|
+
export interface RegionProps extends BasePickerProps {
|
|
70
|
+
mode: PickerMode.REGION;
|
|
71
|
+
/** 表示选中的省市区,默认选中每一列的第一个值, 默认值 [] */
|
|
72
|
+
value?: string[];
|
|
73
|
+
/** 默认值 region */
|
|
74
|
+
level?: 'province' | 'city' | 'region' | 'sub-district';
|
|
75
|
+
/** 可为每一列的顶部添加一个自定义的项 */
|
|
76
|
+
'custom-item'?: string;
|
|
77
|
+
/** value 改变时触发 change 事件, event.detail = {value, code, postcode},
|
|
78
|
+
* 其中字段 code 是统计用区划代码, postcode 是邮政编码 */
|
|
79
|
+
bindchange?: Function;
|
|
80
|
+
}
|
|
81
|
+
export interface RegionObj {
|
|
82
|
+
value: string;
|
|
83
|
+
code: string;
|
|
84
|
+
postcode?: string;
|
|
85
|
+
children?: RegionObj[];
|
|
86
|
+
}
|
|
87
|
+
export interface PickerData {
|
|
88
|
+
value: string;
|
|
89
|
+
label: string;
|
|
90
|
+
children?: Object[];
|
|
91
|
+
}
|
|
92
|
+
export interface EventType {
|
|
93
|
+
detail: {
|
|
94
|
+
value: PickerValue[];
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
export interface LayoutType {
|
|
98
|
+
nativeEvent: {
|
|
99
|
+
layout: Obj;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export interface FormType {
|
|
103
|
+
name: string;
|
|
104
|
+
}
|
|
105
|
+
export type PickerProps = SelectorProps | MultiSelectorProps | TimeProps | DateProps | RegionProps;
|
|
106
|
+
export type LanguageCode = 'zh-CN' | 'en-US';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { HandlerRef } from '../useNodesRef';
|
|
4
|
+
import type { AnyFunc } from '../types/common';
|
|
5
|
+
/**
|
|
6
|
+
* ✔ value
|
|
7
|
+
* ✔ bindchange
|
|
8
|
+
* ✘ bindpickstart
|
|
9
|
+
* ✘ bindpickend
|
|
10
|
+
* ✔ mask-class
|
|
11
|
+
* ✔ indicator-style: 优先级indicator-style.height > pick-view-column中的子元素设置的height
|
|
12
|
+
* WebView Only:
|
|
13
|
+
* ✔ indicator-class
|
|
14
|
+
* ✔ mask-style
|
|
15
|
+
* ✘ immediate-change
|
|
16
|
+
*/
|
|
17
|
+
interface PickerViewProps {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
value?: Array<number>;
|
|
20
|
+
bindchange?: AnyFunc;
|
|
21
|
+
style?: {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
'enable-wheel-animation'?: boolean;
|
|
25
|
+
'indicator-style'?: Record<string, any>;
|
|
26
|
+
'mask-style'?: Record<string, any>;
|
|
27
|
+
'enable-var'?: boolean;
|
|
28
|
+
'external-var-context'?: Record<string, any>;
|
|
29
|
+
'enable-offset'?: boolean;
|
|
30
|
+
}
|
|
31
|
+
declare const _PickerView: React.ForwardRefExoticComponent<PickerViewProps & React.RefAttributes<HandlerRef<View, PickerViewProps>>>;
|
|
32
|
+
export default _PickerView;
|
|
@@ -17,7 +17,7 @@ const styles = {
|
|
|
17
17
|
};
|
|
18
18
|
const DefaultPickerItemH = 36;
|
|
19
19
|
const _PickerView = forwardRef((props, ref) => {
|
|
20
|
-
const { children, value = [], bindchange, style, 'indicator-style': indicatorStyle = {}, 'mask-style': pickerMaskStyle = {}, 'enable-var': enableVar, 'external-var-context': externalVarContext } = props;
|
|
20
|
+
const { children, value = [], bindchange, style, 'enable-wheel-animation': enableWheelAnimation = true, 'indicator-style': indicatorStyle = {}, 'mask-style': pickerMaskStyle = {}, 'enable-var': enableVar, 'external-var-context': externalVarContext } = props;
|
|
21
21
|
const { height: indicatorH, ...pickerIndicatorStyle } = indicatorStyle;
|
|
22
22
|
const nodeRef = useRef(null);
|
|
23
23
|
const cloneRef = useRef(null);
|
|
@@ -67,7 +67,7 @@ const _PickerView = forwardRef((props, ref) => {
|
|
|
67
67
|
columnData,
|
|
68
68
|
ref: cloneRef,
|
|
69
69
|
columnIndex: index,
|
|
70
|
-
key: `pick-view-${index}`,
|
|
70
|
+
key: `pick-view-${index}-${columnData.length}`,
|
|
71
71
|
wrapperStyle: {
|
|
72
72
|
height: normalStyle?.height || DefaultPickerItemH,
|
|
73
73
|
itemHeight: indicatorH || DefaultPickerItemH
|
|
@@ -75,7 +75,8 @@ const _PickerView = forwardRef((props, ref) => {
|
|
|
75
75
|
onSelectChange: onSelectChange.bind(null, index),
|
|
76
76
|
initialIndex,
|
|
77
77
|
pickerIndicatorStyle,
|
|
78
|
-
pickerMaskStyle
|
|
78
|
+
pickerMaskStyle,
|
|
79
|
+
enableWheelAnimation
|
|
79
80
|
});
|
|
80
81
|
const realElement = React.cloneElement(child, wrappedProps);
|
|
81
82
|
return wrapChildren({
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SharedValue } from 'react-native-reanimated';
|
|
3
|
+
type ContextValue = SharedValue<number>;
|
|
4
|
+
export declare const PickerViewColumnAnimationContext: import("react").Context<ContextValue | undefined>;
|
|
5
|
+
export declare const usePickerViewColumnAnimationContext: () => ContextValue;
|
|
6
|
+
export declare const PickerViewStyleContext: import("react").Context<Record<string, any> | undefined>;
|
|
7
|
+
export declare const usePickerViewStyleContext: () => Record<string, any> | undefined;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ScrollView, View } from 'react-native';
|
|
3
|
+
import { HandlerRef } from '../useNodesRef';
|
|
4
|
+
interface ColumnProps {
|
|
5
|
+
columnIndex: number;
|
|
6
|
+
columnData: React.ReactNode[];
|
|
7
|
+
initialIndex: number;
|
|
8
|
+
onSelectChange: Function;
|
|
9
|
+
style: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
'enable-var'?: boolean;
|
|
13
|
+
'external-var-context'?: Record<string, any>;
|
|
14
|
+
wrapperStyle: {
|
|
15
|
+
height: number;
|
|
16
|
+
itemHeight: number;
|
|
17
|
+
};
|
|
18
|
+
pickerMaskStyle: Record<string, any>;
|
|
19
|
+
pickerIndicatorStyle: Record<string, any>;
|
|
20
|
+
enableWheelAnimation?: boolean;
|
|
21
|
+
}
|
|
22
|
+
declare const _PickerViewColumn: React.ForwardRefExoticComponent<ColumnProps & React.RefAttributes<HandlerRef<ScrollView & View, ColumnProps>>>;
|
|
23
|
+
export default _PickerViewColumn;
|
|
@@ -5,12 +5,13 @@ import { useTransformStyle, splitStyle, splitProps, useLayout, usePrevious, isAn
|
|
|
5
5
|
import useNodesRef from '../useNodesRef';
|
|
6
6
|
import PickerIndicator from './pickerViewIndicator';
|
|
7
7
|
import PickerMask from './pickerViewMask';
|
|
8
|
-
import
|
|
8
|
+
import MpxPickerViewColumnItem from './pickerViewColumnItem';
|
|
9
|
+
import MpxPickerViewColumnItemLite from './pickerViewColumnItemLite';
|
|
9
10
|
import { PickerViewColumnAnimationContext } from '../mpx-picker-view/pickerVIewContext';
|
|
10
11
|
import { calcHeightOffsets } from './pickerViewFaces';
|
|
11
12
|
const visibleCount = 5;
|
|
12
13
|
const _PickerViewColumn = forwardRef((props, ref) => {
|
|
13
|
-
const { columnData, columnIndex, initialIndex, onSelectChange, style, wrapperStyle, pickerMaskStyle, pickerIndicatorStyle, 'enable-var': enableVar, 'external-var-context': externalVarContext } = props;
|
|
14
|
+
const { columnData, columnIndex, initialIndex, onSelectChange, style, wrapperStyle, pickerMaskStyle, pickerIndicatorStyle, enableWheelAnimation = true, 'enable-var': enableVar, 'external-var-context': externalVarContext } = props;
|
|
14
15
|
const { normalStyle, hasSelfPercent, setWidth, setHeight } = useTransformStyle(style, { enableVar, externalVarContext });
|
|
15
16
|
const { textStyle = {} } = splitStyle(normalStyle);
|
|
16
17
|
const { textProps = {} } = splitProps(props);
|
|
@@ -43,6 +44,7 @@ const _PickerViewColumn = forwardRef((props, ref) => {
|
|
|
43
44
|
const contentContainerStyle = useMemo(() => {
|
|
44
45
|
return [{ paddingVertical: paddingHeight }];
|
|
45
46
|
}, [paddingHeight]);
|
|
47
|
+
const initialContentOffsetY = useMemo(() => initialIndex * itemRawH, [initialIndex, itemRawH]);
|
|
46
48
|
const getIndex = useCallback((y) => {
|
|
47
49
|
const calc = Math.round(y / itemRawH);
|
|
48
50
|
return Math.max(0, Math.min(calc, maxIndex));
|
|
@@ -92,16 +94,6 @@ const _PickerViewColumn = forwardRef((props, ref) => {
|
|
|
92
94
|
activeIndex.current = initialIndex;
|
|
93
95
|
}, isIOS ? 0 : 200);
|
|
94
96
|
}, [itemRawH, maxIndex, initialIndex]);
|
|
95
|
-
const onContentSizeChange = useCallback((_w, h) => {
|
|
96
|
-
const y = initialIndex * itemRawH;
|
|
97
|
-
if (y <= h) {
|
|
98
|
-
clearTimerScrollTo();
|
|
99
|
-
timerScrollTo.current = setTimeout(() => {
|
|
100
|
-
scrollViewRef.current?.scrollTo({ x: 0, y, animated: false });
|
|
101
|
-
activeIndex.current = initialIndex;
|
|
102
|
-
}, 0);
|
|
103
|
-
}
|
|
104
|
-
}, [itemRawH, initialIndex]);
|
|
105
97
|
const onItemLayout = useCallback((e) => {
|
|
106
98
|
const { height: rawH } = e.nativeEvent.layout;
|
|
107
99
|
const roundedH = Math.round(rawH);
|
|
@@ -217,7 +209,9 @@ const _PickerViewColumn = forwardRef((props, ref) => {
|
|
|
217
209
|
}
|
|
218
210
|
}, [itemRawH, maxIndex, calcOffset, onMomentumScrollEnd]);
|
|
219
211
|
const renderInnerchild = () => columnData.map((item, index) => {
|
|
220
|
-
return
|
|
212
|
+
return enableWheelAnimation
|
|
213
|
+
? (<MpxPickerViewColumnItem key={index} item={item} index={index} itemHeight={itemHeight} textStyle={textStyle} textProps={textProps} visibleCount={visibleCount} onItemLayout={onItemLayout}/>)
|
|
214
|
+
: (<MpxPickerViewColumnItemLite key={index} item={item} index={index} itemHeight={itemHeight} textStyle={textStyle} textProps={textProps} onItemLayout={onItemLayout}/>);
|
|
221
215
|
});
|
|
222
216
|
const renderScollView = () => {
|
|
223
217
|
const innerProps = extendObject({}, layoutProps, {
|
|
@@ -238,17 +232,17 @@ const _PickerViewColumn = forwardRef((props, ref) => {
|
|
|
238
232
|
onScrollEndDrag,
|
|
239
233
|
onMomentumScrollBegin,
|
|
240
234
|
onMomentumScrollEnd,
|
|
241
|
-
|
|
242
|
-
|
|
235
|
+
contentContainerStyle,
|
|
236
|
+
contentOffset: { x: 0, y: initialContentOffsetY }
|
|
243
237
|
});
|
|
244
238
|
return createElement(PickerViewColumnAnimationContext.Provider, { value: offsetYShared }, createElement(Reanimated.ScrollView, innerProps, renderInnerchild()));
|
|
245
239
|
};
|
|
246
240
|
const renderIndicator = () => (<PickerIndicator itemHeight={itemHeight} indicatorItemStyle={pickerIndicatorStyle}/>);
|
|
247
241
|
const renderMask = () => (<PickerMask itemHeight={itemHeight} maskContainerStyle={pickerMaskStyle}/>);
|
|
248
242
|
return (<View style={[styles.wrapper, normalStyle]}>
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
243
|
+
{renderScollView()}
|
|
244
|
+
{renderMask()}
|
|
245
|
+
{renderIndicator()}
|
|
252
246
|
</View>);
|
|
253
247
|
});
|
|
254
248
|
const styles = StyleSheet.create({
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LayoutChangeEvent } from 'react-native';
|
|
3
|
+
interface PickerColumnItemProps {
|
|
4
|
+
item: React.ReactElement;
|
|
5
|
+
index: number;
|
|
6
|
+
itemHeight: number;
|
|
7
|
+
itemWidth?: number | '100%';
|
|
8
|
+
textStyle: Record<string, any>;
|
|
9
|
+
visibleCount: number;
|
|
10
|
+
textProps?: any;
|
|
11
|
+
onItemLayout?: (e: LayoutChangeEvent) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const PickerViewColumnItem: React.FC<PickerColumnItemProps>;
|
|
14
|
+
export default PickerViewColumnItem;
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import Reanimated, { Extrapolation, interpolate, useAnimatedStyle
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import Reanimated, { Extrapolation, interpolate, useAnimatedStyle } from 'react-native-reanimated';
|
|
3
3
|
import { extendObject } from '../utils';
|
|
4
4
|
import { createFaces } from './pickerViewFaces';
|
|
5
5
|
import { usePickerViewColumnAnimationContext, usePickerViewStyleContext } from '../mpx-picker-view/pickerVIewContext';
|
|
6
6
|
const PickerViewColumnItem = ({ item, index, itemHeight, itemWidth = '100%', textStyle, textProps, visibleCount, onItemLayout }) => {
|
|
7
7
|
const textStyleFromAncestor = usePickerViewStyleContext();
|
|
8
8
|
const offsetYShared = usePickerViewColumnAnimationContext();
|
|
9
|
-
const facesShared =
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
facesShared.value = createFaces(itemHeight, visibleCount);
|
|
12
|
-
}, [itemHeight]);
|
|
9
|
+
const facesShared = useMemo(() => createFaces(itemHeight, visibleCount), [itemHeight, visibleCount]);
|
|
13
10
|
const animatedStyles = useAnimatedStyle(() => {
|
|
14
|
-
const inputRange = facesShared.
|
|
11
|
+
const inputRange = facesShared.map((f) => itemHeight * (index + f.index));
|
|
15
12
|
return {
|
|
16
|
-
opacity: interpolate(offsetYShared.value, inputRange, facesShared.
|
|
13
|
+
opacity: interpolate(offsetYShared.value, inputRange, facesShared.map((x) => x.opacity), Extrapolation.CLAMP),
|
|
17
14
|
transform: [
|
|
18
|
-
{ translateY: interpolate(offsetYShared.value, inputRange, facesShared.
|
|
19
|
-
{ rotateX: interpolate(offsetYShared.value, inputRange, facesShared.
|
|
20
|
-
{ scale: interpolate(offsetYShared.value, inputRange, facesShared.
|
|
15
|
+
{ translateY: interpolate(offsetYShared.value, inputRange, facesShared.map((x) => x.offsetY), Extrapolation.EXTEND) },
|
|
16
|
+
{ rotateX: interpolate(offsetYShared.value, inputRange, facesShared.map((x) => x.deg), Extrapolation.CLAMP) + 'deg' },
|
|
17
|
+
{ scale: interpolate(offsetYShared.value, inputRange, facesShared.map((x) => x.scale), Extrapolation.EXTEND) }
|
|
21
18
|
]
|
|
22
19
|
};
|
|
23
20
|
});
|
package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LayoutChangeEvent } from 'react-native';
|
|
3
|
+
interface PickerColumnItemProps {
|
|
4
|
+
item: React.ReactElement;
|
|
5
|
+
index: number;
|
|
6
|
+
itemHeight: number;
|
|
7
|
+
itemWidth?: number | '100%';
|
|
8
|
+
textStyle: Record<string, any>;
|
|
9
|
+
textProps?: any;
|
|
10
|
+
onItemLayout?: (e: LayoutChangeEvent) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const PickerViewColumnItem: React.FC<PickerColumnItemProps>;
|
|
13
|
+
export default PickerViewColumnItem;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { extendObject } from '../utils';
|
|
4
|
+
import { usePickerViewStyleContext } from '../mpx-picker-view/pickerVIewContext';
|
|
5
|
+
const PickerViewColumnItem = ({ item, index, itemHeight, itemWidth = '100%', textStyle, textProps, onItemLayout }) => {
|
|
6
|
+
const textStyleFromAncestor = usePickerViewStyleContext();
|
|
7
|
+
const strKey = `picker-column-item-${index}`;
|
|
8
|
+
const restProps = index === 0 ? { onLayout: onItemLayout } : {};
|
|
9
|
+
const itemProps = extendObject({
|
|
10
|
+
style: extendObject({ height: itemHeight, width: '100%' }, textStyleFromAncestor, textStyle, item.props.style)
|
|
11
|
+
}, textProps, restProps);
|
|
12
|
+
const realItem = React.cloneElement(item, itemProps);
|
|
13
|
+
return (<View key={strKey} style={[
|
|
14
|
+
{ height: itemHeight, width: itemWidth, pointerEvents: 'none' }
|
|
15
|
+
]}>
|
|
16
|
+
{realItem}
|
|
17
|
+
</View>);
|
|
18
|
+
};
|
|
19
|
+
PickerViewColumnItem.displayName = 'MpxPickerViewColumnItem';
|
|
20
|
+
export default PickerViewColumnItem;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Borrowed from open-source code: https://github.com/quidone/react-native-wheel-picker
|
|
3
|
+
* Special thanks to the authors for their contribution to the open-source community.
|
|
4
|
+
*/
|
|
5
|
+
export type Faces = {
|
|
6
|
+
index: number;
|
|
7
|
+
deg: number;
|
|
8
|
+
offsetY: number;
|
|
9
|
+
opacity: number;
|
|
10
|
+
scale: number;
|
|
11
|
+
screenHeight: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const degToRad: (deg: number) => number;
|
|
14
|
+
export declare const calcPickerHeight: (faces: Faces[], itemHeight: number) => number;
|
|
15
|
+
export declare const calcHeightOffsets: (itemHeight: number) => number[];
|
|
16
|
+
export declare const createFaces: (itemHeight: number, visibleCount: number) => Faces[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
type IndicatorProps = {
|
|
4
|
+
itemHeight: number;
|
|
5
|
+
indicatorItemStyle?: StyleProp<ViewStyle>;
|
|
6
|
+
indicatorContainerStyle?: StyleProp<ViewStyle>;
|
|
7
|
+
};
|
|
8
|
+
declare const _PickerViewIndicator: {
|
|
9
|
+
({ itemHeight, indicatorItemStyle, indicatorContainerStyle }: IndicatorProps): React.JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default _PickerViewIndicator;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
type MaskProps = {
|
|
4
|
+
itemHeight: number;
|
|
5
|
+
maskContainerStyle?: StyleProp<ViewStyle>;
|
|
6
|
+
};
|
|
7
|
+
declare const _PickerViewMask: {
|
|
8
|
+
({ itemHeight, maskContainerStyle }: MaskProps): React.JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export default _PickerViewMask;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { PopupBaseProps } from './popupBase';
|
|
3
|
+
export declare const enum PopupType {
|
|
4
|
+
PICKER = "picker"
|
|
5
|
+
}
|
|
6
|
+
export interface IUsePopupOptions {
|
|
7
|
+
modal?: React.ComponentType<PopupBaseProps>;
|
|
8
|
+
type?: PopupType;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 基于 Portal 封装的 Popup 弹窗组件管理 Hooks
|
|
12
|
+
*/
|
|
13
|
+
declare const createPopupManager: (options?: IUsePopupOptions) => {
|
|
14
|
+
open: (childComponent: React.ReactNode, pageId: number | undefined, options?: {
|
|
15
|
+
contentHeight?: number;
|
|
16
|
+
}) => void;
|
|
17
|
+
show: () => void;
|
|
18
|
+
hide: () => void;
|
|
19
|
+
update: (updatedChild: ReactElement | null) => void;
|
|
20
|
+
remove: () => void;
|
|
21
|
+
};
|
|
22
|
+
export { createPopupManager };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface PopupBaseProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
hide?: () => void;
|
|
5
|
+
contentHeight?: number;
|
|
6
|
+
visible?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 类似微信 picker 弹窗的动画效果都可以复用此类容器
|
|
10
|
+
* 其他特定类型的弹窗容器组件可以在此基础上封装,或者扩展实现
|
|
11
|
+
*/
|
|
12
|
+
declare const PopupBase: {
|
|
13
|
+
(props?: PopupBaseProps): import("react").JSX.Element;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
export default PopupBase;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type PortalProps = {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const Portal: {
|
|
6
|
+
({ children }: PortalProps): null;
|
|
7
|
+
Host: ({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
pageId: number;
|
|
10
|
+
}) => JSX.Element;
|
|
11
|
+
add: (e: ReactNode, id: number | null) => number;
|
|
12
|
+
remove: (key: number) => void;
|
|
13
|
+
update: (key: number, e: ReactNode) => void;
|
|
14
|
+
};
|
|
15
|
+
export default Portal;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { useContext, useEffect, useRef } from 'react';
|
|
2
|
-
import { PortalContext, RouteContext, VarContext } from '../context';
|
|
2
|
+
import { PortalContext, ProviderContext, RouteContext, VarContext } from '../context';
|
|
3
3
|
import PortalHost, { portal } from './portal-host';
|
|
4
4
|
const Portal = ({ children }) => {
|
|
5
5
|
const manager = useContext(PortalContext);
|
|
6
6
|
const keyRef = useRef(null);
|
|
7
7
|
const { pageId } = useContext(RouteContext) || {};
|
|
8
8
|
const varContext = useContext(VarContext);
|
|
9
|
+
const parentProvides = useContext(ProviderContext);
|
|
9
10
|
if (varContext) {
|
|
10
11
|
children = (<VarContext.Provider value={varContext} key='varContextWrap'>{children}</VarContext.Provider>);
|
|
11
12
|
}
|
|
13
|
+
if (parentProvides) {
|
|
14
|
+
children = (<ProviderContext.Provider value={parentProvides} key='providerContextWrap'>{children}</ProviderContext.Provider>);
|
|
15
|
+
}
|
|
12
16
|
useEffect(() => {
|
|
13
17
|
manager.update(keyRef.current, children);
|
|
14
18
|
}, [children]);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type PortalHostProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
pageId: number;
|
|
5
|
+
};
|
|
6
|
+
export type Operation = {
|
|
7
|
+
type: 'mount';
|
|
8
|
+
key: number;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
} | {
|
|
11
|
+
type: 'update';
|
|
12
|
+
key: number;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
} | {
|
|
15
|
+
type: 'unmount';
|
|
16
|
+
key: number;
|
|
17
|
+
};
|
|
18
|
+
declare class PortalGuard {
|
|
19
|
+
private nextKey;
|
|
20
|
+
add: (e: ReactNode, id: number | null) => number;
|
|
21
|
+
remove: (key: number) => void;
|
|
22
|
+
update: (key: number, e: ReactNode) => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* portal
|
|
26
|
+
*/
|
|
27
|
+
export declare const portal: PortalGuard;
|
|
28
|
+
declare const PortalHost: ({ children }: PortalHostProps) => JSX.Element;
|
|
29
|
+
export default PortalHost;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type State = {
|
|
3
|
+
portals: Array<{
|
|
4
|
+
key: number;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
};
|
|
8
|
+
declare const _PortalManager: import("react").ForwardRefExoticComponent<import("react").RefAttributes<unknown>>;
|
|
9
|
+
export default _PortalManager;
|
|
@@ -7,7 +7,7 @@ const _PortalManager = forwardRef((props, ref) => {
|
|
|
7
7
|
setState((prevState) => ({
|
|
8
8
|
portals: [...prevState.portals, { key, children }]
|
|
9
9
|
}));
|
|
10
|
-
}, [
|
|
10
|
+
}, []);
|
|
11
11
|
const update = useCallback((key, children) => {
|
|
12
12
|
setState((prevState) => ({
|
|
13
13
|
portals: prevState.portals.map((item) => {
|
|
@@ -17,7 +17,7 @@ const _PortalManager = forwardRef((props, ref) => {
|
|
|
17
17
|
return item;
|
|
18
18
|
})
|
|
19
19
|
}));
|
|
20
|
-
}, [
|
|
20
|
+
}, []);
|
|
21
21
|
const unmount = useCallback((key) => {
|
|
22
22
|
setState((prevState) => ({
|
|
23
23
|
portals: prevState.portals.filter((item) => item.key !== key)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { View, ViewStyle } from 'react-native';
|
|
3
|
+
import { HandlerRef } from './useNodesRef';
|
|
4
|
+
export interface ProgressProps {
|
|
5
|
+
percent?: number;
|
|
6
|
+
'stroke-width'?: number | string;
|
|
7
|
+
color?: string;
|
|
8
|
+
activeColor?: string;
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
active?: boolean;
|
|
11
|
+
'active-mode'?: 'backwards' | 'forwards';
|
|
12
|
+
duration?: number;
|
|
13
|
+
bindactiveend?: (event: any) => void;
|
|
14
|
+
style?: ViewStyle & Record<string, any>;
|
|
15
|
+
'enable-offset'?: boolean;
|
|
16
|
+
'enable-var'?: boolean;
|
|
17
|
+
'external-var-context'?: Record<string, any>;
|
|
18
|
+
'parent-font-size'?: number;
|
|
19
|
+
'parent-width'?: number;
|
|
20
|
+
'parent-height'?: number;
|
|
21
|
+
}
|
|
22
|
+
declare const Progress: import("react").ForwardRefExoticComponent<ProgressProps & import("react").RefAttributes<HandlerRef<View, ProgressProps>>>;
|
|
23
|
+
export default Progress;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✔ bindchange
|
|
3
|
+
*/
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
import { View, NativeSyntheticEvent, ViewStyle } from 'react-native';
|
|
6
|
+
import { HandlerRef } from './useNodesRef';
|
|
7
|
+
export interface RadioGroupProps {
|
|
8
|
+
name: string;
|
|
9
|
+
style?: ViewStyle & Record<string, any>;
|
|
10
|
+
'enable-offset'?: boolean;
|
|
11
|
+
'enable-var'?: boolean;
|
|
12
|
+
'external-var-context'?: Record<string, any>;
|
|
13
|
+
'parent-font-size'?: number;
|
|
14
|
+
'parent-width'?: number;
|
|
15
|
+
'parent-height'?: number;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
bindchange?: (evt: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
18
|
+
}
|
|
19
|
+
declare const radioGroup: import("react").ForwardRefExoticComponent<RadioGroupProps & import("react").RefAttributes<HandlerRef<View, RadioGroupProps>>>;
|
|
20
|
+
export default radioGroup;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✔ value
|
|
3
|
+
* ✔ disabled
|
|
4
|
+
* ✔ checked
|
|
5
|
+
* ✔ color
|
|
6
|
+
*/
|
|
7
|
+
import { ReactNode } from 'react';
|
|
8
|
+
import { View, ViewStyle, NativeSyntheticEvent } from 'react-native';
|
|
9
|
+
import { HandlerRef } from './useNodesRef';
|
|
10
|
+
export interface RadioProps {
|
|
11
|
+
value?: string;
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
color?: string;
|
|
15
|
+
style?: ViewStyle & Record<string, any>;
|
|
16
|
+
'enable-offset'?: boolean;
|
|
17
|
+
'enable-var'?: boolean;
|
|
18
|
+
'external-var-context'?: Record<string, any>;
|
|
19
|
+
'parent-font-size'?: number;
|
|
20
|
+
'parent-width'?: number;
|
|
21
|
+
'parent-height'?: number;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
bindtap?: (evt: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
24
|
+
}
|
|
25
|
+
declare const Radio: import("react").ForwardRefExoticComponent<RadioProps & import("react").RefAttributes<HandlerRef<View, RadioProps>>>;
|
|
26
|
+
export default Radio;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ListItem {
|
|
3
|
+
isSectionHeader?: boolean;
|
|
4
|
+
_originalItemIndex?: number;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
interface ItemHeightType {
|
|
8
|
+
value?: number;
|
|
9
|
+
getter?: (item: any, index: number) => number;
|
|
10
|
+
}
|
|
11
|
+
interface RecycleViewProps {
|
|
12
|
+
enhanced?: boolean;
|
|
13
|
+
bounces?: boolean;
|
|
14
|
+
scrollEventThrottle?: number;
|
|
15
|
+
height?: number | string;
|
|
16
|
+
width?: number | string;
|
|
17
|
+
listData?: ListItem[];
|
|
18
|
+
generichash?: string;
|
|
19
|
+
style?: Record<string, any>;
|
|
20
|
+
itemHeight?: ItemHeightType;
|
|
21
|
+
sectionHeaderHeight?: ItemHeightType;
|
|
22
|
+
listHeaderData?: any;
|
|
23
|
+
listHeaderHeight?: ItemHeightType;
|
|
24
|
+
useListHeader?: boolean;
|
|
25
|
+
'genericrecycle-item'?: string;
|
|
26
|
+
'genericsection-header'?: string;
|
|
27
|
+
'genericlist-header'?: string;
|
|
28
|
+
'enable-var'?: boolean;
|
|
29
|
+
'external-var-context'?: any;
|
|
30
|
+
'parent-font-size'?: number;
|
|
31
|
+
'parent-width'?: number;
|
|
32
|
+
'parent-height'?: number;
|
|
33
|
+
'enable-sticky'?: boolean;
|
|
34
|
+
'enable-back-to-top'?: boolean;
|
|
35
|
+
'end-reached-threshold'?: number;
|
|
36
|
+
'refresher-enabled'?: boolean;
|
|
37
|
+
'show-scrollbar'?: boolean;
|
|
38
|
+
'refresher-triggered'?: boolean;
|
|
39
|
+
bindrefresherrefresh?: (event: any) => void;
|
|
40
|
+
bindscrolltolower?: (event: any) => void;
|
|
41
|
+
bindscroll?: (event: any) => void;
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
}
|
|
44
|
+
declare const RecycleView: React.ForwardRefExoticComponent<Omit<RecycleViewProps, "ref"> & React.RefAttributes<any>>;
|
|
45
|
+
export default RecycleView;
|