amis 1.5.3 → 1.5.4

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 (119) hide show
  1. package/README.md +5 -0
  2. package/lib/components/Card.d.ts +96 -0
  3. package/lib/components/Card.js +85 -0
  4. package/lib/components/Card.js.map +13 -0
  5. package/lib/components/DatePicker.d.ts +85 -84
  6. package/lib/components/DatePicker.js.map +2 -2
  7. package/lib/components/DateRangePicker.d.ts +84 -84
  8. package/lib/components/MonthRangePicker.d.ts +84 -84
  9. package/lib/components/Picker.d.ts +503 -0
  10. package/lib/components/Picker.js +65 -0
  11. package/lib/components/Picker.js.map +13 -0
  12. package/lib/components/PickerColumn.d.ts +29 -459
  13. package/lib/components/PickerColumn.js +35 -44
  14. package/lib/components/PickerColumn.js.map +2 -2
  15. package/lib/components/Select.d.ts +238 -238
  16. package/lib/components/Select.js +9 -2
  17. package/lib/components/Select.js.map +2 -2
  18. package/lib/components/Selection.js +1 -4
  19. package/lib/components/Selection.js.map +2 -2
  20. package/lib/components/Switch.d.ts +6 -6
  21. package/lib/components/Switch.js.map +2 -2
  22. package/lib/components/calendar/Calendar.js +15 -0
  23. package/lib/components/calendar/Calendar.js.map +2 -2
  24. package/lib/components/calendar/DaysView.js +4 -4
  25. package/lib/components/calendar/DaysView.js.map +2 -2
  26. package/lib/components/calendar/TimeView.d.ts +10 -0
  27. package/lib/components/calendar/TimeView.js +55 -2
  28. package/lib/components/calendar/TimeView.js.map +2 -2
  29. package/lib/components/calendar/YearsView.d.ts +9 -0
  30. package/lib/components/calendar/YearsView.js +19 -0
  31. package/lib/components/calendar/YearsView.js.map +2 -2
  32. package/lib/index.js +1 -1
  33. package/lib/renderers/Card.d.ts +81 -13
  34. package/lib/renderers/Card.js +178 -81
  35. package/lib/renderers/Card.js.map +2 -2
  36. package/lib/renderers/Form/DiffEditor.d.ts +145 -37
  37. package/lib/renderers/Form/Editor.d.ts +144 -36
  38. package/lib/renderers/Form/Formula.js +5 -5
  39. package/lib/renderers/Form/Formula.js.map +2 -2
  40. package/lib/renderers/Form/InputCity.d.ts +84 -84
  41. package/lib/renderers/Form/InputFile.js +2 -2
  42. package/lib/renderers/Form/InputFile.js.map +2 -2
  43. package/lib/renderers/Form/index.js +10 -0
  44. package/lib/renderers/Form/index.js.map +2 -2
  45. package/lib/renderers/Form/wrapControl.js +3 -2
  46. package/lib/renderers/Form/wrapControl.js.map +2 -2
  47. package/lib/store/combo.d.ts +160 -40
  48. package/lib/store/form.d.ts +64 -16
  49. package/lib/store/formItem.d.ts +4 -2
  50. package/lib/store/formItem.js +11 -6
  51. package/lib/store/formItem.js.map +2 -2
  52. package/lib/store/table.d.ts +128 -32
  53. package/lib/themes/ang-ie11.css +177 -30
  54. package/lib/themes/ang.css +177 -30
  55. package/lib/themes/ang.css.map +1 -1
  56. package/lib/themes/antd-ie11.css +177 -30
  57. package/lib/themes/antd.css +177 -30
  58. package/lib/themes/antd.css.map +1 -1
  59. package/lib/themes/cxd-ie11.css +177 -30
  60. package/lib/themes/cxd.css +177 -30
  61. package/lib/themes/cxd.css.map +1 -1
  62. package/lib/themes/dark-ie11.css +177 -30
  63. package/lib/themes/dark.css +177 -30
  64. package/lib/themes/dark.css.map +1 -1
  65. package/lib/themes/default.css +177 -30
  66. package/lib/themes/default.css.map +1 -1
  67. package/lib/utils/helper.d.ts +7 -0
  68. package/lib/utils/helper.js +33 -1
  69. package/lib/utils/helper.js.map +2 -2
  70. package/package.json +2 -2
  71. package/schema.json +157 -13
  72. package/scss/_properties.scss +13 -2
  73. package/scss/components/_card.scss +155 -15
  74. package/scss/components/_nav.scss +1 -1
  75. package/scss/components/_picker-columns.scss +20 -14
  76. package/scss/components/form/_file.scss +2 -2
  77. package/scss/components/form/_selection.scss +4 -0
  78. package/scss/components/form/_switch.scss +6 -0
  79. package/sdk/ang-ie11.css +214 -40
  80. package/sdk/ang.css +216 -32
  81. package/sdk/antd-ie11.css +214 -40
  82. package/sdk/antd.css +216 -32
  83. package/sdk/charts.js +14 -14
  84. package/sdk/color-picker.js +65 -65
  85. package/sdk/cropperjs.js +2 -2
  86. package/sdk/cxd-ie11.css +206 -32
  87. package/sdk/cxd.css +216 -32
  88. package/sdk/dark-ie11.css +214 -40
  89. package/sdk/dark.css +216 -32
  90. package/sdk/exceljs.js +1 -1
  91. package/sdk/markdown.js +69 -69
  92. package/sdk/papaparse.js +1 -1
  93. package/sdk/renderers/Form/CityDB.js +1 -1
  94. package/sdk/rest.js +18 -18
  95. package/sdk/rich-text.js +62 -62
  96. package/sdk/sdk-ie11.css +206 -32
  97. package/sdk/sdk.css +216 -32
  98. package/sdk/sdk.js +1190 -1186
  99. package/sdk/thirds/hls.js/hls.js +1 -1
  100. package/sdk/thirds/mpegts.js/mpegts.js +1 -1
  101. package/sdk/tinymce.js +57 -57
  102. package/src/components/Card.tsx +203 -0
  103. package/src/components/DatePicker.tsx +3 -0
  104. package/src/components/Picker.tsx +145 -0
  105. package/src/components/PickerColumn.tsx +58 -95
  106. package/src/components/Select.tsx +17 -12
  107. package/src/components/Selection.tsx +1 -4
  108. package/src/components/Switch.tsx +7 -7
  109. package/src/components/calendar/Calendar.tsx +18 -0
  110. package/src/components/calendar/DaysView.tsx +6 -4
  111. package/src/components/calendar/TimeView.tsx +80 -5
  112. package/src/components/calendar/YearsView.tsx +44 -1
  113. package/src/renderers/Card.tsx +299 -191
  114. package/src/renderers/Form/Formula.tsx +7 -5
  115. package/src/renderers/Form/InputFile.tsx +6 -2
  116. package/src/renderers/Form/index.tsx +12 -0
  117. package/src/renderers/Form/wrapControl.tsx +5 -2
  118. package/src/store/formItem.ts +12 -6
  119. package/src/utils/helper.ts +34 -0
@@ -0,0 +1,503 @@
1
+ /// <reference types="hoist-non-react-statics" />
2
+ /**
3
+ * @file Picker
4
+ * @description 移动端列滚动选择器
5
+ */
6
+ import React, { ReactNode } from 'react';
7
+ import { ThemeProps } from '../theme';
8
+ import { LocaleProps } from '../locale';
9
+ import { PickerColumnItem } from './PickerColumn';
10
+ export declare type PickerValue = string | number;
11
+ export interface PickerProps extends ThemeProps, LocaleProps {
12
+ title?: String | ReactNode;
13
+ labelField?: string;
14
+ className?: string;
15
+ showToolbar?: boolean;
16
+ defaultValue?: PickerValue[];
17
+ value?: PickerValue[];
18
+ swipeDuration?: number;
19
+ visibleItemCount?: number;
20
+ itemHeight?: number;
21
+ columns: PickerColumnItem[] | PickerColumnItem;
22
+ onChange?: (value?: PickerValue[], index?: number, confirm?: boolean) => void;
23
+ onClose?: (value?: PickerValue[]) => void;
24
+ onConfirm?: (value?: PickerValue[]) => void;
25
+ }
26
+ declare const _default: {
27
+ new (props: (Omit<Omit<PickerProps, keyof LocaleProps> & {
28
+ locale?: string | undefined;
29
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
30
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps) | Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
31
+ locale?: string | undefined;
32
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
33
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>): {
34
+ render(): JSX.Element;
35
+ context: any;
36
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
37
+ locale?: string | undefined;
38
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
39
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
40
+ forceUpdate(callback?: (() => void) | undefined): void;
41
+ readonly props: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
42
+ locale?: string | undefined;
43
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
44
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps> & Readonly<{
45
+ children?: React.ReactNode;
46
+ }>;
47
+ state: Readonly<{}>;
48
+ refs: {
49
+ [key: string]: React.ReactInstance;
50
+ };
51
+ componentDidMount?(): void;
52
+ shouldComponentUpdate?(nextProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
53
+ locale?: string | undefined;
54
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
55
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
56
+ componentWillUnmount?(): void;
57
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
58
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
59
+ locale?: string | undefined;
60
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
61
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
62
+ componentDidUpdate?(prevProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
63
+ locale?: string | undefined;
64
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
65
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
66
+ componentWillMount?(): void;
67
+ UNSAFE_componentWillMount?(): void;
68
+ componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
69
+ locale?: string | undefined;
70
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
71
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, nextContext: any): void;
72
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
73
+ locale?: string | undefined;
74
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
75
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, nextContext: any): void;
76
+ componentWillUpdate?(nextProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
77
+ locale?: string | undefined;
78
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
79
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
80
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
81
+ locale?: string | undefined;
82
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
83
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
84
+ };
85
+ new (props: Omit<Omit<PickerProps, keyof LocaleProps> & {
86
+ locale?: string | undefined;
87
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
88
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps, context: any): {
89
+ render(): JSX.Element;
90
+ context: any;
91
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
92
+ locale?: string | undefined;
93
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
94
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
95
+ forceUpdate(callback?: (() => void) | undefined): void;
96
+ readonly props: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
97
+ locale?: string | undefined;
98
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
99
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps> & Readonly<{
100
+ children?: React.ReactNode;
101
+ }>;
102
+ state: Readonly<{}>;
103
+ refs: {
104
+ [key: string]: React.ReactInstance;
105
+ };
106
+ componentDidMount?(): void;
107
+ shouldComponentUpdate?(nextProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
108
+ locale?: string | undefined;
109
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
110
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
111
+ componentWillUnmount?(): void;
112
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
113
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
114
+ locale?: string | undefined;
115
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
116
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>): any;
117
+ componentDidUpdate?(prevProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
118
+ locale?: string | undefined;
119
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
120
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, prevState: Readonly<{}>, snapshot?: any): void;
121
+ componentWillMount?(): void;
122
+ UNSAFE_componentWillMount?(): void;
123
+ componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
124
+ locale?: string | undefined;
125
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
126
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, nextContext: any): void;
127
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
128
+ locale?: string | undefined;
129
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
130
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, nextContext: any): void;
131
+ componentWillUpdate?(nextProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
132
+ locale?: string | undefined;
133
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
134
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
135
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<Omit<PickerProps, keyof LocaleProps> & {
136
+ locale?: string | undefined;
137
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
138
+ }, keyof ThemeProps> & import("../theme").ThemeOutterProps>, nextState: Readonly<{}>, nextContext: any): void;
139
+ };
140
+ displayName: string;
141
+ contextType: React.Context<string>;
142
+ ComposedComponent: React.ComponentType<{
143
+ new (props: (Omit<PickerProps, keyof LocaleProps> & {
144
+ locale?: string | undefined;
145
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
146
+ }) | Readonly<Omit<PickerProps, keyof LocaleProps> & {
147
+ locale?: string | undefined;
148
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
149
+ }>): {
150
+ render(): JSX.Element;
151
+ context: any;
152
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<PickerProps, keyof LocaleProps> & {
153
+ locale?: string | undefined;
154
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
155
+ }>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
156
+ forceUpdate(callback?: (() => void) | undefined): void;
157
+ readonly props: Readonly<Omit<PickerProps, keyof LocaleProps> & {
158
+ locale?: string | undefined;
159
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
160
+ }> & Readonly<{
161
+ children?: React.ReactNode;
162
+ }>;
163
+ state: Readonly<{}>;
164
+ refs: {
165
+ [key: string]: React.ReactInstance;
166
+ };
167
+ componentDidMount?(): void;
168
+ shouldComponentUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
169
+ locale?: string | undefined;
170
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
171
+ }>, nextState: Readonly<{}>, nextContext: any): boolean;
172
+ componentWillUnmount?(): void;
173
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
174
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
175
+ locale?: string | undefined;
176
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
177
+ }>, prevState: Readonly<{}>): any;
178
+ componentDidUpdate?(prevProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
179
+ locale?: string | undefined;
180
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
181
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
182
+ componentWillMount?(): void;
183
+ UNSAFE_componentWillMount?(): void;
184
+ componentWillReceiveProps?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
185
+ locale?: string | undefined;
186
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
187
+ }>, nextContext: any): void;
188
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
189
+ locale?: string | undefined;
190
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
191
+ }>, nextContext: any): void;
192
+ componentWillUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
193
+ locale?: string | undefined;
194
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
195
+ }>, nextState: Readonly<{}>, nextContext: any): void;
196
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
197
+ locale?: string | undefined;
198
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
199
+ }>, nextState: Readonly<{}>, nextContext: any): void;
200
+ };
201
+ new (props: Omit<PickerProps, keyof LocaleProps> & {
202
+ locale?: string | undefined;
203
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
204
+ }, context: any): {
205
+ render(): JSX.Element;
206
+ context: any;
207
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<PickerProps, keyof LocaleProps> & {
208
+ locale?: string | undefined;
209
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
210
+ }>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
211
+ forceUpdate(callback?: (() => void) | undefined): void;
212
+ readonly props: Readonly<Omit<PickerProps, keyof LocaleProps> & {
213
+ locale?: string | undefined;
214
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
215
+ }> & Readonly<{
216
+ children?: React.ReactNode;
217
+ }>;
218
+ state: Readonly<{}>;
219
+ refs: {
220
+ [key: string]: React.ReactInstance;
221
+ };
222
+ componentDidMount?(): void;
223
+ shouldComponentUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
224
+ locale?: string | undefined;
225
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
226
+ }>, nextState: Readonly<{}>, nextContext: any): boolean;
227
+ componentWillUnmount?(): void;
228
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
229
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
230
+ locale?: string | undefined;
231
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
232
+ }>, prevState: Readonly<{}>): any;
233
+ componentDidUpdate?(prevProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
234
+ locale?: string | undefined;
235
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
236
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
237
+ componentWillMount?(): void;
238
+ UNSAFE_componentWillMount?(): void;
239
+ componentWillReceiveProps?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
240
+ locale?: string | undefined;
241
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
242
+ }>, nextContext: any): void;
243
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
244
+ locale?: string | undefined;
245
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
246
+ }>, nextContext: any): void;
247
+ componentWillUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
248
+ locale?: string | undefined;
249
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
250
+ }>, nextState: Readonly<{}>, nextContext: any): void;
251
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
252
+ locale?: string | undefined;
253
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
254
+ }>, nextState: Readonly<{}>, nextContext: any): void;
255
+ };
256
+ displayName: string;
257
+ contextType: React.Context<string>;
258
+ ComposedComponent: React.ComponentType<React.NamedExoticComponent<PickerProps>>;
259
+ } & import("hoist-non-react-statics").NonReactStatics<React.NamedExoticComponent<PickerProps>, {}> & {
260
+ ComposedComponent: React.NamedExoticComponent<PickerProps>;
261
+ }>;
262
+ } & import("hoist-non-react-statics").NonReactStatics<{
263
+ new (props: (Omit<PickerProps, keyof LocaleProps> & {
264
+ locale?: string | undefined;
265
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
266
+ }) | Readonly<Omit<PickerProps, keyof LocaleProps> & {
267
+ locale?: string | undefined;
268
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
269
+ }>): {
270
+ render(): JSX.Element;
271
+ context: any;
272
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<PickerProps, keyof LocaleProps> & {
273
+ locale?: string | undefined;
274
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
275
+ }>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
276
+ forceUpdate(callback?: (() => void) | undefined): void;
277
+ readonly props: Readonly<Omit<PickerProps, keyof LocaleProps> & {
278
+ locale?: string | undefined;
279
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
280
+ }> & Readonly<{
281
+ children?: React.ReactNode;
282
+ }>;
283
+ state: Readonly<{}>;
284
+ refs: {
285
+ [key: string]: React.ReactInstance;
286
+ };
287
+ componentDidMount?(): void;
288
+ shouldComponentUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
289
+ locale?: string | undefined;
290
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
291
+ }>, nextState: Readonly<{}>, nextContext: any): boolean;
292
+ componentWillUnmount?(): void;
293
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
294
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
295
+ locale?: string | undefined;
296
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
297
+ }>, prevState: Readonly<{}>): any;
298
+ componentDidUpdate?(prevProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
299
+ locale?: string | undefined;
300
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
301
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
302
+ componentWillMount?(): void;
303
+ UNSAFE_componentWillMount?(): void;
304
+ componentWillReceiveProps?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
305
+ locale?: string | undefined;
306
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
307
+ }>, nextContext: any): void;
308
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
309
+ locale?: string | undefined;
310
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
311
+ }>, nextContext: any): void;
312
+ componentWillUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
313
+ locale?: string | undefined;
314
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
315
+ }>, nextState: Readonly<{}>, nextContext: any): void;
316
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
317
+ locale?: string | undefined;
318
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
319
+ }>, nextState: Readonly<{}>, nextContext: any): void;
320
+ };
321
+ new (props: Omit<PickerProps, keyof LocaleProps> & {
322
+ locale?: string | undefined;
323
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
324
+ }, context: any): {
325
+ render(): JSX.Element;
326
+ context: any;
327
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<PickerProps, keyof LocaleProps> & {
328
+ locale?: string | undefined;
329
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
330
+ }>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
331
+ forceUpdate(callback?: (() => void) | undefined): void;
332
+ readonly props: Readonly<Omit<PickerProps, keyof LocaleProps> & {
333
+ locale?: string | undefined;
334
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
335
+ }> & Readonly<{
336
+ children?: React.ReactNode;
337
+ }>;
338
+ state: Readonly<{}>;
339
+ refs: {
340
+ [key: string]: React.ReactInstance;
341
+ };
342
+ componentDidMount?(): void;
343
+ shouldComponentUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
344
+ locale?: string | undefined;
345
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
346
+ }>, nextState: Readonly<{}>, nextContext: any): boolean;
347
+ componentWillUnmount?(): void;
348
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
349
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
350
+ locale?: string | undefined;
351
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
352
+ }>, prevState: Readonly<{}>): any;
353
+ componentDidUpdate?(prevProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
354
+ locale?: string | undefined;
355
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
356
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
357
+ componentWillMount?(): void;
358
+ UNSAFE_componentWillMount?(): void;
359
+ componentWillReceiveProps?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
360
+ locale?: string | undefined;
361
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
362
+ }>, nextContext: any): void;
363
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
364
+ locale?: string | undefined;
365
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
366
+ }>, nextContext: any): void;
367
+ componentWillUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
368
+ locale?: string | undefined;
369
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
370
+ }>, nextState: Readonly<{}>, nextContext: any): void;
371
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
372
+ locale?: string | undefined;
373
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
374
+ }>, nextState: Readonly<{}>, nextContext: any): void;
375
+ };
376
+ displayName: string;
377
+ contextType: React.Context<string>;
378
+ ComposedComponent: React.ComponentType<React.NamedExoticComponent<PickerProps>>;
379
+ } & import("hoist-non-react-statics").NonReactStatics<React.NamedExoticComponent<PickerProps>, {}> & {
380
+ ComposedComponent: React.NamedExoticComponent<PickerProps>;
381
+ }, {}> & {
382
+ ComposedComponent: {
383
+ new (props: (Omit<PickerProps, keyof LocaleProps> & {
384
+ locale?: string | undefined;
385
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
386
+ }) | Readonly<Omit<PickerProps, keyof LocaleProps> & {
387
+ locale?: string | undefined;
388
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
389
+ }>): {
390
+ render(): JSX.Element;
391
+ context: any;
392
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<PickerProps, keyof LocaleProps> & {
393
+ locale?: string | undefined;
394
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
395
+ }>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
396
+ forceUpdate(callback?: (() => void) | undefined): void;
397
+ readonly props: Readonly<Omit<PickerProps, keyof LocaleProps> & {
398
+ locale?: string | undefined;
399
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
400
+ }> & Readonly<{
401
+ children?: React.ReactNode;
402
+ }>;
403
+ state: Readonly<{}>;
404
+ refs: {
405
+ [key: string]: React.ReactInstance;
406
+ };
407
+ componentDidMount?(): void;
408
+ shouldComponentUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
409
+ locale?: string | undefined;
410
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
411
+ }>, nextState: Readonly<{}>, nextContext: any): boolean;
412
+ componentWillUnmount?(): void;
413
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
414
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
415
+ locale?: string | undefined;
416
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
417
+ }>, prevState: Readonly<{}>): any;
418
+ componentDidUpdate?(prevProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
419
+ locale?: string | undefined;
420
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
421
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
422
+ componentWillMount?(): void;
423
+ UNSAFE_componentWillMount?(): void;
424
+ componentWillReceiveProps?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
425
+ locale?: string | undefined;
426
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
427
+ }>, nextContext: any): void;
428
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
429
+ locale?: string | undefined;
430
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
431
+ }>, nextContext: any): void;
432
+ componentWillUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
433
+ locale?: string | undefined;
434
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
435
+ }>, nextState: Readonly<{}>, nextContext: any): void;
436
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
437
+ locale?: string | undefined;
438
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
439
+ }>, nextState: Readonly<{}>, nextContext: any): void;
440
+ };
441
+ new (props: Omit<PickerProps, keyof LocaleProps> & {
442
+ locale?: string | undefined;
443
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
444
+ }, context: any): {
445
+ render(): JSX.Element;
446
+ context: any;
447
+ setState<K_1 extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<PickerProps, keyof LocaleProps> & {
448
+ locale?: string | undefined;
449
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
450
+ }>) => {} | Pick<{}, K_1> | null) | Pick<{}, K_1> | null, callback?: (() => void) | undefined): void;
451
+ forceUpdate(callback?: (() => void) | undefined): void;
452
+ readonly props: Readonly<Omit<PickerProps, keyof LocaleProps> & {
453
+ locale?: string | undefined;
454
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
455
+ }> & Readonly<{
456
+ children?: React.ReactNode;
457
+ }>;
458
+ state: Readonly<{}>;
459
+ refs: {
460
+ [key: string]: React.ReactInstance;
461
+ };
462
+ componentDidMount?(): void;
463
+ shouldComponentUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
464
+ locale?: string | undefined;
465
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
466
+ }>, nextState: Readonly<{}>, nextContext: any): boolean;
467
+ componentWillUnmount?(): void;
468
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
469
+ getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
470
+ locale?: string | undefined;
471
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
472
+ }>, prevState: Readonly<{}>): any;
473
+ componentDidUpdate?(prevProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
474
+ locale?: string | undefined;
475
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
476
+ }>, prevState: Readonly<{}>, snapshot?: any): void;
477
+ componentWillMount?(): void;
478
+ UNSAFE_componentWillMount?(): void;
479
+ componentWillReceiveProps?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
480
+ locale?: string | undefined;
481
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
482
+ }>, nextContext: any): void;
483
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
484
+ locale?: string | undefined;
485
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
486
+ }>, nextContext: any): void;
487
+ componentWillUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
488
+ locale?: string | undefined;
489
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
490
+ }>, nextState: Readonly<{}>, nextContext: any): void;
491
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<PickerProps, keyof LocaleProps> & {
492
+ locale?: string | undefined;
493
+ translate?: ((str: string, ...args: any[]) => string) | undefined;
494
+ }>, nextState: Readonly<{}>, nextContext: any): void;
495
+ };
496
+ displayName: string;
497
+ contextType: React.Context<string>;
498
+ ComposedComponent: React.ComponentType<React.NamedExoticComponent<PickerProps>>;
499
+ } & import("hoist-non-react-statics").NonReactStatics<React.NamedExoticComponent<PickerProps>, {}> & {
500
+ ComposedComponent: React.NamedExoticComponent<PickerProps>;
501
+ };
502
+ };
503
+ export default _default;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ /**
5
+ * @file Picker
6
+ * @description 移动端列滚动选择器
7
+ */
8
+ var react_1 = tslib_1.__importStar(require("react"));
9
+ var uncontrollable_1 = require("uncontrollable");
10
+ var theme_1 = require("../theme");
11
+ var locale_1 = require("../locale");
12
+ var Button_1 = (0, tslib_1.__importDefault)(require("./Button"));
13
+ var PickerColumn_1 = (0, tslib_1.__importDefault)(require("./PickerColumn"));
14
+ function fixToArray(data) {
15
+ if (!Array.isArray(data)) {
16
+ return [data];
17
+ }
18
+ return data;
19
+ }
20
+ var Picker = (0, react_1.memo)(function (props) {
21
+ var labelField = props.labelField, _a = props.visibleItemCount, visibleItemCount = _a === void 0 ? 5 : _a, _b = props.value, value = _b === void 0 ? [] : _b, _c = props.swipeDuration, swipeDuration = _c === void 0 ? 1000 : _c, _d = props.columns, columns = _d === void 0 ? [] : _d, _e = props.itemHeight, itemHeight = _e === void 0 ? 30 : _e, _f = props.showToolbar, showToolbar = _f === void 0 ? true : _f, _g = props.className, className = _g === void 0 ? '' : _g, cx = props.classnames, ns = props.classPrefix, __ = props.translate;
22
+ var _columns = fixToArray(columns);
23
+ var _h = (0, react_1.useState)(fixToArray(props.value === undefined ? props.defaultValue || [] : value)), innerValue = _h[0], setInnerValue = _h[1];
24
+ var close = function () {
25
+ if (props.onClose) {
26
+ props.onClose(innerValue);
27
+ }
28
+ };
29
+ var confirm = function () {
30
+ if (props.onConfirm) {
31
+ props.onConfirm(innerValue);
32
+ }
33
+ };
34
+ var onChange = function (itemValue, columnIndex, confirm) {
35
+ var nextInnerValue = (0, tslib_1.__spreadArray)([], innerValue, true);
36
+ nextInnerValue[columnIndex] = itemValue;
37
+ setInnerValue(nextInnerValue);
38
+ if (props.onChange) {
39
+ props.onChange(nextInnerValue, columnIndex, confirm);
40
+ }
41
+ };
42
+ var renderColumnItem = function (item, index) {
43
+ return (react_1.default.createElement(PickerColumn_1.default, (0, tslib_1.__assign)({}, item, { classnames: cx, classPrefix: ns, labelField: labelField, itemHeight: itemHeight, swipeDuration: swipeDuration, visibleItemCount: visibleItemCount, value: innerValue[index], onChange: function (val, i, confirm) {
44
+ onChange(val, index, confirm);
45
+ } })));
46
+ };
47
+ var wrapHeight = itemHeight * +visibleItemCount;
48
+ var frameStyle = { height: itemHeight + "px" };
49
+ var columnsStyle = { height: wrapHeight + "px" };
50
+ var maskStyle = {
51
+ backgroundSize: "100% " + (wrapHeight - itemHeight) / 2 + "px"
52
+ };
53
+ return (react_1.default.createElement("div", { className: cx(className, 'PickerColumns', 'PickerColumns-popOver') },
54
+ showToolbar && react_1.default.createElement("div", { className: cx('PickerColumns-toolbar') },
55
+ react_1.default.createElement(Button_1.default, { className: "PickerColumns-cancel", level: "default", onClick: close }, __('cancel')),
56
+ react_1.default.createElement(Button_1.default, { className: "PickerColumns-confirm", level: "primary", onClick: confirm }, __('confirm'))),
57
+ react_1.default.createElement("div", { className: cx('PickerColumns-columns'), style: columnsStyle },
58
+ _columns.map(function (column, index) { return renderColumnItem(column, index); }),
59
+ react_1.default.createElement("div", { className: cx('PickerColumns-mask'), style: maskStyle }),
60
+ react_1.default.createElement("div", { className: cx('PickerColumns-frame'), style: frameStyle }))));
61
+ });
62
+ exports.default = (0, theme_1.themeable)((0, locale_1.localeable)((0, uncontrollable_1.uncontrollable)(Picker, {
63
+ value: 'onChange'
64
+ })));
65
+ //# sourceMappingURL=./components/Picker.js.map
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 3,
3
+ "file": "Picker.js",
4
+ "sourceRoot": "",
5
+ "sources": [
6
+ "/src/components/Picker.tsx"
7
+ ],
8
+ "names": [],
9
+ "mappings": "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",
10
+ "sourcesContent": [
11
+ "/**\n * @file Picker\n * @description 移动端列滚动选择器\n */\nimport React, {\n memo,\n ReactNode,\n useState\n} from 'react';\nimport {uncontrollable} from 'uncontrollable';\n\nimport {themeable, ThemeProps} from '../theme';\nimport {localeable, LocaleProps} from '../locale';\n\nimport Button from './Button';\nimport {PickerColumnItem, default as Column} from './PickerColumn';\n\nexport type PickerValue = string | number;\n\nexport interface PickerProps extends ThemeProps, LocaleProps {\n title?: String | ReactNode,\n labelField?: string;\n className?: string;\n showToolbar?: boolean;\n defaultValue?: PickerValue[];\n value?: PickerValue[];\n swipeDuration?: number;\n visibleItemCount?: number;\n itemHeight?: number;\n columns: PickerColumnItem[] | PickerColumnItem;\n onChange?: (\n value?: PickerValue[],\n index?: number,\n confirm?: boolean\n ) => void;\n onClose?: (\n value?: PickerValue[]\n ) => void;\n onConfirm?: (\n value?: PickerValue[]\n ) => void;\n}\n\nfunction fixToArray(data: any) {\n if (!Array.isArray(data)) {\n return [data];\n }\n return data;\n}\n\nconst Picker = memo<PickerProps>((props) => {\n const {\n labelField,\n visibleItemCount = 5,\n value = [],\n swipeDuration = 1000,\n columns = [],\n itemHeight = 30,\n showToolbar = true,\n className='',\n classnames: cx,\n classPrefix: ns,\n translate: __\n } = props;\n\n const _columns = fixToArray(columns);\n const [innerValue, setInnerValue] = useState<PickerValue[]>(\n fixToArray(props.value === undefined ? props.defaultValue || [] : value )\n );\n\n const close = () => {\n if (props.onClose) {\n props.onClose(innerValue);\n }\n };\n\n const confirm = () => {\n if (props.onConfirm) {\n props.onConfirm(innerValue);\n }\n };\n\n const onChange = (itemValue: PickerValue, columnIndex: number, confirm?: boolean) => {\n const nextInnerValue = [...innerValue];\n nextInnerValue[columnIndex] = itemValue;\n setInnerValue(nextInnerValue);\n if (props.onChange) {\n props.onChange(nextInnerValue, columnIndex, confirm);\n }\n };\n\n const renderColumnItem = (item: PickerColumnItem, index: number) => {\n return (\n <Column\n {...item}\n classnames={cx}\n classPrefix={ns}\n labelField={labelField}\n itemHeight={itemHeight}\n swipeDuration={swipeDuration}\n visibleItemCount={visibleItemCount}\n value={innerValue[index]}\n onChange={(val: string | number, i, confirm) => {\n onChange(val, index, confirm);\n }}\n />)\n };\n\n const wrapHeight = itemHeight * +visibleItemCount;\n const frameStyle = {height: `${itemHeight}px`};\n const columnsStyle = {height: `${wrapHeight}px`};\n const maskStyle = {\n backgroundSize: `100% ${(wrapHeight - itemHeight) / 2}px`\n };\n\n return (\n <div\n className={cx(className, 'PickerColumns', 'PickerColumns-popOver')}\n >\n {showToolbar && <div className={cx('PickerColumns-toolbar')}>\n <Button className=\"PickerColumns-cancel\" level=\"default\" onClick={close}>\n {__('cancel')}\n </Button>\n <Button className=\"PickerColumns-confirm\" level=\"primary\" onClick={confirm}>\n {__('confirm')}\n </Button>\n </div>}\n <div className={cx('PickerColumns-columns')} style={columnsStyle}>\n {\n _columns.map((column: PickerColumnItem, index: number) => renderColumnItem(column, index))\n }\n <div className={cx('PickerColumns-mask')} style={maskStyle}></div>\n <div className={cx('PickerColumns-frame')} style={frameStyle}></div>\n </div>\n </div>\n );\n});\n\nexport default themeable(\n localeable(\n uncontrollable(Picker, {\n value: 'onChange'\n })\n )\n);\n"
12
+ ]
13
+ }