@tarojs/plugin-platform-harmony-ets 4.0.0-alpha.43 → 4.0.0-alpha.45

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 (75) hide show
  1. package/dist/apis/base/weapp/life-cycle.ts +1 -1
  2. package/dist/apis/device/clipboard.ts +9 -2
  3. package/dist/apis/framework/index.ts +1 -1
  4. package/dist/apis/media/image/index.ts +124 -135
  5. package/dist/apis/route/index.ts +1 -2
  6. package/dist/apis/ui/background.ts +1 -1
  7. package/dist/apis/ui/interaction/index.ts +20 -4
  8. package/dist/apis/ui/navigation-bar/index.ts +1 -1
  9. package/dist/apis/ui/scroll/index.ts +1 -1
  10. package/dist/apis/ui/tab-bar.ts +1 -2
  11. package/dist/components-harmony-ets/button.ets +1 -1
  12. package/dist/components-harmony-ets/checkbox.ets +1 -2
  13. package/dist/components-harmony-ets/form.ets +0 -1
  14. package/dist/components-harmony-ets/index.ets +37 -90
  15. package/dist/components-harmony-ets/input.ets +11 -7
  16. package/dist/components-harmony-ets/label.ets +1 -2
  17. package/dist/components-harmony-ets/listView.ets +3 -2
  18. package/dist/components-harmony-ets/movableArea.ets +3 -3
  19. package/dist/components-harmony-ets/navigationBar.ets +1 -1
  20. package/dist/components-harmony-ets/pageMeta.ets +1 -1
  21. package/dist/components-harmony-ets/pseudo.ets +1 -1
  22. package/dist/components-harmony-ets/radio.ets +2 -3
  23. package/dist/components-harmony-ets/scrollList.ets +7 -2
  24. package/dist/components-harmony-ets/scrollView.ets +6 -1
  25. package/dist/components-harmony-ets/slider.ets +1 -1
  26. package/dist/components-harmony-ets/stickySection.ets +2 -2
  27. package/dist/components-harmony-ets/style.ets +7 -6
  28. package/dist/components-harmony-ets/swiper.ets +1 -1
  29. package/dist/components-harmony-ets/switch.ets +1 -1
  30. package/dist/components-harmony-ets/text.ets +2 -2
  31. package/dist/components-harmony-ets/utils/helper.ets +2 -2
  32. package/dist/components-harmony-ets/utils/styles.ets +5 -6
  33. package/dist/components-harmony-ets/video.ets +1 -1
  34. package/dist/components-harmony-ets/view.ets +1 -2
  35. package/dist/components-harmony-ets/webView.ets +1 -1
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.js +4 -1
  38. package/dist/index.js.map +1 -1
  39. package/dist/runtime-ets/bom/URL.ts +2 -0
  40. package/dist/runtime-ets/bom/document.ts +1 -2
  41. package/dist/runtime-ets/bom/getComputedStyle.ts +1 -2
  42. package/dist/runtime-ets/bom/history.ts +1 -0
  43. package/dist/runtime-ets/bom/location.ts +1 -0
  44. package/dist/runtime-ets/bom/navigator.ts +1 -21
  45. package/dist/runtime-ets/bom/raf.ts +1 -37
  46. package/dist/runtime-ets/bom/window.ts +4 -5
  47. package/dist/runtime-ets/constant.ts +17 -10
  48. package/dist/runtime-ets/current.ts +0 -1
  49. package/dist/runtime-ets/dom/document.ts +1 -1
  50. package/dist/runtime-ets/dom/element/canvas.ts +3 -2
  51. package/dist/runtime-ets/dom/element/element.ts +6 -5
  52. package/dist/runtime-ets/dom/element/form.ts +6 -0
  53. package/dist/runtime-ets/dom/element/movableView.ts +12 -8
  54. package/dist/runtime-ets/dom/event-source.ts +1 -0
  55. package/dist/runtime-ets/dom/eventTarget.ts +1 -1
  56. package/dist/runtime-ets/dom/node.ts +3 -4
  57. package/dist/runtime-ets/emitter/emitter.ts +1 -0
  58. package/dist/runtime-ets/env.ts +1 -0
  59. package/dist/runtime-ets/index.ts +22 -7
  60. package/dist/runtime-ets/interface/index.ts +6 -0
  61. package/dist/runtime-ets/utils/index.ts +4 -6
  62. package/dist/runtime-ets/utils/router.ts +9 -0
  63. package/dist/runtime-framework/react/app.ts +1 -2
  64. package/dist/runtime-framework/react/hooks.ts +1 -1
  65. package/dist/runtime-framework/react/native-page.ts +44 -15
  66. package/dist/runtime-framework/react/page.ts +1 -2
  67. package/dist/runtime-framework/solid/app.ts +1 -2
  68. package/dist/runtime-framework/solid/hooks.ts +1 -1
  69. package/dist/runtime-framework/solid/page.ts +1 -2
  70. package/dist/runtime-framework/solid/reconciler/props.ts +9 -10
  71. package/dist/runtime-utils.js +160 -173
  72. package/dist/runtime-utils.js.map +1 -1
  73. package/dist/runtime.js +160 -173
  74. package/dist/runtime.js.map +1 -1
  75. package/package.json +9 -9
@@ -1,4 +1,4 @@
1
- import { eventCenter } from '@tarojs/runtime/dist/runtime.esm'
1
+ import { eventCenter } from '@tarojs/runtime'
2
2
 
3
3
  import type Taro from '@tarojs/taro/types'
4
4
 
@@ -1,8 +1,10 @@
1
1
  // 从 API Version 6 开始支持
2
2
  import pasteboard from '@ohos.pasteboard'
3
- import promptAction from '@ohos.promptAction'
3
+ // @ts-ignore
4
+ import { Current } from '@tarojs/runtime'
4
5
  import { isString } from '@tarojs/shared'
5
6
 
7
+ import {} from '../'
6
8
  import { callAsyncFail, getParameterError, object2String } from '../utils'
7
9
  import { MethodHandler } from '../utils/handler'
8
10
 
@@ -32,7 +34,12 @@ export const setClipboardData: typeof Taro.setClipboardData = function (options)
32
34
 
33
35
  try {
34
36
  systemPasteboard.setDataSync(pasteData)
35
- promptAction.showToast({
37
+ // @ts-ignore
38
+ const uiContext = Current?.page?.getUIContext?.()
39
+
40
+ if (!uiContext) return
41
+
42
+ uiContext.getPromptAction().showToast({
36
43
  message: '内容已复制',
37
44
  duration: 1500,
38
45
  bottom: '50%',
@@ -24,4 +24,4 @@ export { Current, getCurrentInstance } from '@tarojs/runtime'
24
24
 
25
25
  export const requirePlugin = temporarilyNotSupport('requirePlugin')
26
26
 
27
- export { eventCenter, Events, History } from '@tarojs/runtime/dist/runtime.esm'
27
+ export { eventCenter, Events, History } from '@tarojs/runtime'
@@ -16,8 +16,7 @@ import { Current } from '@tarojs/runtime'
16
16
  import { isNull } from '@tarojs/shared'
17
17
 
18
18
  import { getSystemInfoSync } from '../../base'
19
- import { callAsyncFail, callAsyncSuccess, requestPermissions, temporarilyNotSupport, validateParams } from '../../utils'
20
- import { IMAGE_PERMISSION } from '../../utils/permissions'
19
+ import { callAsyncFail, callAsyncSuccess, temporarilyNotSupport, validateParams } from '../../utils'
21
20
 
22
21
  import type Taro from '@tarojs/taro/types'
23
22
 
@@ -113,117 +112,143 @@ async function saveImage(compressedImageData, compressedImageUri) {
113
112
 
114
113
  export const compressImage: typeof Taro.compressImage = function (options) {
115
114
  return new Promise((resolve, reject) => {
116
- requestPermissions(IMAGE_PERMISSION).then(() => {
117
- try {
118
- validateParams('compressImage', options, compressImageSchema)
119
- } catch (error) {
120
- const res = { errMsg: error.message }
121
- return callAsyncFail(reject, res, options)
122
- }
123
- const { src, quality = 80, compressedWidth, compressedHeight } = options
124
- const srcAfterCompress = src.includes('_after_compress') ? src : src.split('.').join('_after_compress.')
125
- const file = fs.openSync(src, fs.OpenMode.READ_ONLY)
126
-
127
- // const stat = fs.statSync(file.fd)
128
- // console.log('[Taro] 压缩前图片的大小为:', stat.size)
129
-
130
- const source = image.createImageSource(file.fd)
131
- if (isNull(source)) {
132
- const createImageSourceError = { errMsg: 'compressImage fail: createImageSource has failed.' }
133
- callAsyncFail(reject, createImageSourceError, options)
134
- return
135
- }
115
+ try {
116
+ validateParams('compressImage', options, compressImageSchema)
117
+ } catch (error) {
118
+ const res = { errMsg: error.message }
119
+ return callAsyncFail(reject, res, options)
120
+ }
121
+ const { src, quality = 80, compressedWidth, compressedHeight } = options
122
+ const srcAfterCompress = src.includes('_after_compress') ? src : src.split('.').join('_after_compress.')
123
+ const file = fs.openSync(src, fs.OpenMode.READ_ONLY)
136
124
 
137
- const width = source.getImageInfoSync().size.width
138
- const height = source.getImageInfoSync().size.height
139
- let wantWidth = compressedWidth || compressedHeight || 0
140
- let wantHeight = compressedHeight || compressedWidth || 0
125
+ // const stat = fs.statSync(file.fd)
126
+ // console.log('[Taro] 压缩前图片的大小为:', stat.size)
141
127
 
142
- if (width > wantWidth || height > wantHeight) {
143
- const heightRatio = height / wantHeight
144
- const widthRatio = width / wantWidth
145
- const finalRatio = heightRatio < widthRatio ? heightRatio : widthRatio
128
+ const source = image.createImageSource(file.fd)
129
+ if (isNull(source)) {
130
+ const createImageSourceError = { errMsg: 'compressImage fail: createImageSource has failed.' }
131
+ callAsyncFail(reject, createImageSourceError, options)
132
+ return
133
+ }
146
134
 
147
- wantWidth = Math.round(width / finalRatio)
148
- wantHeight = Math.round(height / finalRatio)
149
- }
135
+ const width = source.getImageInfoSync().size.width
136
+ const height = source.getImageInfoSync().size.height
137
+ let wantWidth = compressedWidth || compressedHeight || 0
138
+ let wantHeight = compressedHeight || compressedWidth || 0
150
139
 
151
- const decodingOptions = {
152
- editable: true,
153
- desiredPixelFormat: image.PixelMapFormat.RGBA_8888,
154
- desiredSize: { width: wantWidth, height: wantHeight }
155
- }
156
- source.createPixelMap(decodingOptions, (error, pixelMap) => {
157
- if (error !== undefined) {
140
+ if (width > wantWidth || height > wantHeight) {
141
+ const heightRatio = height / wantHeight
142
+ const widthRatio = width / wantWidth
143
+ const finalRatio = heightRatio < widthRatio ? heightRatio : widthRatio
144
+
145
+ wantWidth = Math.round(width / finalRatio)
146
+ wantHeight = Math.round(height / finalRatio)
147
+ }
148
+
149
+ const decodingOptions = {
150
+ editable: true,
151
+ desiredPixelFormat: image.PixelMapFormat.RGBA_8888,
152
+ desiredSize: { width: wantWidth, height: wantHeight }
153
+ }
154
+ source.createPixelMap(decodingOptions, (error, pixelMap) => {
155
+ if (error !== undefined) {
156
+ fs.closeSync(file)
157
+ const res = { errMsg: error }
158
+ callAsyncFail(reject, res, options)
159
+ } else {
160
+ const packer = image.createImagePacker(file.fd)
161
+ if (isNull(packer)) {
158
162
  fs.closeSync(file)
159
- const res = { errMsg: error }
160
- callAsyncFail(reject, res, options)
161
- } else {
162
- const packer = image.createImagePacker(file.fd)
163
- if (isNull(packer)) {
164
- fs.closeSync(file)
165
- const createImagePackerError = { errMsg: 'compressImage fail: createImagePacker has failed.' }
166
- callAsyncFail(reject, createImagePackerError, options)
167
- return
168
- }
163
+ const createImagePackerError = { errMsg: 'compressImage fail: createImagePacker has failed.' }
164
+ callAsyncFail(reject, createImagePackerError, options)
165
+ return
166
+ }
169
167
 
170
- const isPNG = src.endsWith('.png')
171
- const packingOptionsOHOS: IPackingOptionOHOS = {
172
- format: isPNG ? 'image/png' : 'image/jpeg',
173
- quality: quality
174
- }
175
- packer.packing(pixelMap, packingOptionsOHOS).then((value) => {
176
- fs.closeSync(file)
177
- saveImage(value, srcAfterCompress).then(result => {
178
- callAsyncSuccess(resolve, { tempFilePath: result.imageUri }, options)
179
- })
180
- }).catch((error) => {
181
- fs.closeSync(file)
182
- callAsyncFail(reject, error, options)
183
- })
168
+ const isPNG = src.endsWith('.png')
169
+ const packingOptionsOHOS: IPackingOptionOHOS = {
170
+ format: isPNG ? 'image/png' : 'image/jpeg',
171
+ quality: quality
184
172
  }
185
- })
186
- }, (error: string) => {
187
- const res = { errMsg: error }
188
- return callAsyncFail(reject, res, options)
173
+ packer.packing(pixelMap, packingOptionsOHOS).then((value) => {
174
+ fs.closeSync(file)
175
+ saveImage(value, srcAfterCompress).then(result => {
176
+ callAsyncSuccess(resolve, { tempFilePath: result.imageUri }, options)
177
+ })
178
+ }).catch((error) => {
179
+ fs.closeSync(file)
180
+ callAsyncFail(reject, error, options)
181
+ })
182
+ }
189
183
  })
190
184
  })
191
185
  }
192
186
 
193
187
  export const chooseImage: typeof Taro.chooseImage = function (options) {
194
188
  return new Promise((resolve, reject) => {
195
- requestPermissions(IMAGE_PERMISSION).then(() => {
196
- try {
197
- validateParams('chooseImage', options, chooseImageSchema)
198
- } catch (error) {
199
- const res = { errMsg: error.message }
200
- return callAsyncFail(reject, res, options)
201
- }
189
+ try {
190
+ validateParams('chooseImage', options, chooseImageSchema)
191
+ } catch (error) {
192
+ const res = { errMsg: error.message }
193
+ return callAsyncFail(reject, res, options)
194
+ }
202
195
 
203
- const { count = 9 } = options
204
- const photoViewPicker = new picker.PhotoViewPicker()
205
- let sizeType = options.sizeType
196
+ const { count = 9 } = options
197
+ const photoViewPicker = new picker.PhotoViewPicker()
198
+ let sizeType = options.sizeType
206
199
 
207
- if (!sizeType || !sizeType.length) {
208
- sizeType = ['compressed', 'original']
209
- }
200
+ if (!sizeType || !sizeType.length) {
201
+ sizeType = ['compressed', 'original']
202
+ }
203
+
204
+ photoSelectOptions.maxSelectNumber = count // 选择媒体文件的最大数目
205
+ photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE // 过滤选择媒体文件类型为IMAGE
206
+
207
+ photoViewPicker.select(photoSelectOptions).then((photoSelectResult) => {
208
+ const result: IChooseImageData = {}
209
+ const isOrigin = photoSelectResult.isOriginalPhoto
210
210
 
211
- photoSelectOptions.maxSelectNumber = count // 选择媒体文件的最大数目
212
- photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE // 过滤选择媒体文件类型为IMAGE
211
+ if (isOrigin) {
212
+ const tempFilePaths: string[] = []
213
+ const tempFiles = photoSelectResult.photoUris.map(uri => {
214
+ const file = fs.openSync(uri, fs.OpenMode.READ_ONLY)
215
+ const stat = fs.statSync(file.fd)
216
+ const size = stat.size
213
217
 
214
- photoViewPicker.select(photoSelectOptions).then((photoSelectResult) => {
215
- const result: IChooseImageData = {}
216
- const isOrigin = photoSelectResult.isOriginalPhoto
218
+ fs.closeSync(file)
219
+ tempFilePaths.push(uri)
220
+
221
+ return {
222
+ size,
223
+ path: uri,
224
+ }
225
+ })
226
+
227
+ result.tempFiles = tempFiles
228
+ result.tempFilePaths = tempFilePaths
229
+
230
+ callAsyncSuccess(resolve, result, options)
231
+ } else {
232
+ const actions: Promise<string>[] = photoSelectResult.photoUris.map(uri => {
233
+ return new Promise<string>(resolve => {
234
+ compressImage({
235
+ src: uri,
236
+ compressedWidth: getSystemInfoSync().screenWidth / 2,
237
+ compressedHeight: getSystemInfoSync().screenHeight / 2,
238
+ success: (compressResult) => {
239
+ resolve(compressResult.tempFilePath)
240
+ }
241
+ })
242
+ })
243
+ })
217
244
 
218
- if (isOrigin) {
219
- const tempFilePaths: string[] = []
220
- const tempFiles = photoSelectResult.photoUris.map(uri => {
245
+ Promise.all(actions).then(tempFilePaths => {
246
+ const tempFiles = tempFilePaths.map(uri => {
221
247
  const file = fs.openSync(uri, fs.OpenMode.READ_ONLY)
222
248
  const stat = fs.statSync(file.fd)
223
- const size = stat.size
249
+ const size: number = stat.size
224
250
 
225
251
  fs.closeSync(file)
226
- tempFilePaths.push(uri)
227
252
 
228
253
  return {
229
254
  size,
@@ -231,53 +256,17 @@ export const chooseImage: typeof Taro.chooseImage = function (options) {
231
256
  }
232
257
  })
233
258
 
234
- result.tempFiles = tempFiles
235
259
  result.tempFilePaths = tempFilePaths
260
+ result.tempFiles = tempFiles
236
261
 
237
262
  callAsyncSuccess(resolve, result, options)
238
- } else {
239
- const actions: Promise<string>[] = photoSelectResult.photoUris.map(uri => {
240
- return new Promise<string>(resolve => {
241
- compressImage({
242
- src: uri,
243
- compressedWidth: getSystemInfoSync().screenWidth / 2,
244
- compressedHeight: getSystemInfoSync().screenHeight / 2,
245
- success: (compressResult) => {
246
- resolve(compressResult.tempFilePath)
247
- }
248
- })
249
- })
250
- })
251
-
252
- Promise.all(actions).then(tempFilePaths => {
253
- const tempFiles = tempFilePaths.map(uri => {
254
- const file = fs.openSync(uri, fs.OpenMode.READ_ONLY)
255
- const stat = fs.statSync(file.fd)
256
- const size: number = stat.size
257
-
258
- fs.closeSync(file)
259
-
260
- return {
261
- size,
262
- path: uri,
263
- }
264
- })
265
-
266
- result.tempFilePaths = tempFilePaths
267
- result.tempFiles = tempFiles
268
-
269
- callAsyncSuccess(resolve, result, options)
270
- }).catch(error => {
271
- const res = { errMsg: error }
272
- return callAsyncFail(reject, res, options)
273
- })
274
- }
275
- }).catch((error) => {
276
- callAsyncFail(reject, error, options)
277
- })
278
- }, (error: string) => {
279
- const res = { errMsg: error }
280
- return callAsyncFail(reject, res, options)
263
+ }).catch(error => {
264
+ const res = { errMsg: error }
265
+ return callAsyncFail(reject, res, options)
266
+ })
267
+ }
268
+ }).catch((error) => {
269
+ callAsyncFail(reject, error, options)
281
270
  })
282
271
  })
283
272
  }
@@ -1,6 +1,5 @@
1
1
  import router from '@ohos.router'
2
- import { window } from '@tarojs/runtime' // eslint-disable-line import/no-duplicates
3
- import { eventCenter } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
2
+ import { eventCenter, window } from '@tarojs/runtime'
4
3
  import { queryToJson } from '@tarojs/shared'
5
4
 
6
5
  import { callAsyncFail, callAsyncSuccess } from '../utils'
@@ -1,4 +1,4 @@
1
- import { eventCenter } from '@tarojs/runtime/dist/runtime.esm'
1
+ import { eventCenter } from '@tarojs/runtime'
2
2
 
3
3
  import { temporarilyNotSupport } from '../utils'
4
4
  import { MethodHandler } from '../utils/handler'
@@ -1,4 +1,5 @@
1
- import promptAction from '@ohos.promptAction'
1
+ // @ts-ignore
2
+ import { Current } from '@tarojs/runtime'
2
3
 
3
4
  import { callAsyncFail, callAsyncSuccess, temporarilyNotSupport, validateParams } from '../../utils'
4
5
 
@@ -29,7 +30,12 @@ export function showToast (options) {
29
30
  return callAsyncFail(reject, res, options)
30
31
  }
31
32
 
32
- promptAction.showToast({
33
+ // @ts-ignore
34
+ const uiContext = Current?.page?.getUIContext?.()
35
+
36
+ if (!uiContext) return
37
+
38
+ uiContext.getPromptAction().showToast({
33
39
  message: options.title,
34
40
  duration: options.duration,
35
41
  bottom: options.bottom,
@@ -80,7 +86,12 @@ export function showModal (options) {
80
86
  buttons: buttons,
81
87
  }
82
88
 
83
- promptAction.showDialog(modalOptions, (error, data) => {
89
+ // @ts-ignore
90
+ const uiContext = Current?.page?.getUIContext?.()
91
+
92
+ if (!uiContext) return
93
+
94
+ uiContext.getPromptAction().showDialog(modalOptions, (error, data) => {
84
95
  if (error) {
85
96
  const res = { errMsg: error }
86
97
  callAsyncFail(reject, res, options)
@@ -148,7 +159,12 @@ export function showActionSheet (options) {
148
159
  buttons
149
160
  }
150
161
 
151
- promptAction.showActionMenu(actionSheetOptions, (error, data) => {
162
+ // @ts-ignore
163
+ const uiContext = Current?.page?.getUIContext?.()
164
+
165
+ if (!uiContext) return
166
+
167
+ uiContext.getPromptAction().showActionMenu(actionSheetOptions, (error, data) => {
152
168
  if (error) {
153
169
  callAsyncFail(
154
170
  reject,
@@ -1,4 +1,4 @@
1
- import { eventCenter } from '@tarojs/runtime/dist/runtime.esm'
1
+ import { eventCenter } from '@tarojs/runtime'
2
2
 
3
3
  import { MethodHandler } from '../../utils/handler'
4
4
 
@@ -6,8 +6,8 @@
6
6
  * 文档地址 https://developer.harmonyos.com/cn/docs/documentation/doc-references/js-framework-syntax-js-0000000000611432
7
7
  */
8
8
  import { AREA_CHANGE_EVENT_NAME, Current, findChildNodeWithDFS, getPageScrollerOrNode, setNodeEventCallbackAndTriggerComponentUpdate } from '@tarojs/runtime'
9
- import { pxTransformHelper } from '@tarojs/taro'
10
9
 
10
+ import { pxTransformHelper } from '../../index'
11
11
  import { MethodHandler } from '../../utils/handler'
12
12
 
13
13
  import type Taro from '@tarojs/taro/types'
@@ -1,5 +1,4 @@
1
- import { Current } from '@tarojs/runtime' // eslint-disable-line import/no-duplicates
2
- import { eventCenter } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
1
+ import { Current, eventCenter } from '@tarojs/runtime'
3
2
 
4
3
  import { callAsyncFail, callAsyncSuccess } from '../utils'
5
4
 
@@ -4,7 +4,7 @@ import { BUTTON_THEME_COLOR } from './utils/constant/style'
4
4
  import { TOUCH_EVENT_MAP } from './utils/constant/event'
5
5
  import { shouldBindEvent, getNodeThresholds } from './utils/helper'
6
6
 
7
- import type { TaroAny, TaroEvent, TaroButtonElement, TaroStyleType } from '@tarojs/runtime'
7
+ import type { TaroAny, TaroButtonElement, TaroEvent, TaroStyleType } from '@tarojs/runtime'
8
8
 
9
9
  interface ButtonAttrs {
10
10
  disabled?: boolean
@@ -4,8 +4,7 @@ import commonStyleModify, { rowModify, columnModify } from './style'
4
4
  import { FlexManager } from './utils/flexManager'
5
5
  import { shouldBindEvent, getNodeThresholds } from './utils/helper'
6
6
 
7
- import type { TaroAny, TaroEvent, TaroCheckboxElement, TaroCheckboxGroupElement } from '@tarojs/runtime'
8
- import { isUndefined } from '@tarojs/shared'
7
+ import type { TaroAny, TaroCheckboxElement, TaroCheckboxGroupElement, TaroEvent } from '@tarojs/runtime'
9
8
 
10
9
  interface CheckboxOptions {
11
10
  name?: string
@@ -7,7 +7,6 @@ import { FlexManager } from './utils/flexManager'
7
7
  import { shouldBindEvent, getNodeThresholds } from './utils/helper'
8
8
 
9
9
  import type { TaroAny, TaroFormElement } from '@tarojs/runtime'
10
- import { isUndefined } from '@tarojs/shared'
11
10
 
12
11
  @Component
13
12
  export default struct TaroForm {
@@ -1,92 +1,39 @@
1
- import TaroImage, { getImageMode } from './image'
2
- import TaroText from './text'
3
- import TaroView from './view'
4
- import TaroIcon from './icon'
5
- import TaroForm from './form'
6
- import TaroLabel from './label'
7
- import TaroInput from './input'
8
- import TaroVideo from './video'
9
- import TaroCanvas from './canvas'
10
- import TaroButton from './button'
11
- import TaroPicker from './picker'
12
- import TaroSlider from './slider'
13
- import TaroSwitch from './switch'
14
- import TaroSwiper from './swiper'
15
- import TaroWebView from './webView'
16
- import TaroTextArea from './textArea'
17
- import TaroRichText from './richText'
18
- import TaroProgress from './progress'
19
- import TaroInnerHtml from './innerHtml'
20
- import TaroScrollView from './scrollView'
21
- import TaroMovableArea from './movableArea'
22
- import TaroMovableView from './movableView'
23
- import { TaroRadio, TaroRadioGroup } from './radio'
24
- import { TaroCheckboxGroup, TaroCheckbox } from './checkbox'
25
- import TaroPageMeta from './pageMeta'
26
- import TaroNavigationBar from './navigationBar'
1
+ export { default as TaroImage, getImageMode } from './image'
2
+ export { default as TaroText } from './text'
3
+ export { default as TaroView } from './view'
4
+ export { default as TaroIcon } from './icon'
5
+ export { default as TaroForm } from './form'
6
+ export { default as TaroLabel } from './label'
7
+ export { default as TaroInput } from './input'
8
+ export { default as TaroVideo } from './video'
9
+ export { default as TaroCanvas } from './canvas'
10
+ export { default as TaroButton, getButtonColor } from './button'
11
+ export { default as TaroPicker } from './picker'
12
+ export { default as TaroSlider } from './slider'
13
+ export { default as TaroSwitch } from './switch'
14
+ export { default as TaroSwiper } from './swiper'
15
+ export { default as TaroWebView } from './webView'
16
+ export { default as TaroTextArea } from './textArea'
17
+ export { default as TaroRichText } from './richText'
18
+ export { default as TaroProgress } from './progress'
19
+ export { default as TaroInnerHtml } from './innerHtml'
20
+ export { default as TaroScrollView } from './scrollView'
21
+ export { default as TaroMovableArea } from './movableArea'
22
+ export { default as TaroMovableView } from './movableView'
23
+ export { TaroRadio, TaroRadioGroup } from './radio'
24
+ export { TaroCheckboxGroup, TaroCheckbox } from './checkbox'
25
+ export { default as TaroPageMeta, IComponentAttributeUpdateEvents } from './pageMeta'
26
+ export { default as TaroNavigationBar } from './navigationBar'
27
27
 
28
- import TaroListView from './listView'
29
- import TaroStickySection from './stickySection'
30
- import TaroScrollList from './scrollList'
28
+ export { default as TaroListView } from './listView'
29
+ export { default as TaroStickySection } from './stickySection'
30
+ export { default as TaroScrollList } from './scrollList'
31
31
 
32
- import commonStyleModify, { rowModify, columnModify, textModify, setNormalTextAttributeIntoInstance } from './style'
33
- import { getButtonColor } from './button'
34
- import { FlexManager } from './utils/flexManager'
35
- import { DynamicCenter } from './utils/DynamicCenter'
36
- import { TOUCH_EVENT_MAP } from './utils/constant/event'
37
- import { BUTTON_THEME_COLOR } from './utils/constant/style'
38
- import { getStyleAttr } from './utils/styles'
39
- import { shouldBindEvent, getNodeThresholds, getNormalAttributes, getFontAttributes } from './utils/helper'
40
-
41
- export {
42
- textModify,
43
- getStyleAttr,
44
- FlexManager,
45
- DynamicCenter,
46
- getButtonColor,
47
- TOUCH_EVENT_MAP,
48
- shouldBindEvent,
49
- getFontAttributes,
50
- commonStyleModify,
51
- rowModify,
52
- columnModify,
53
- getNodeThresholds,
54
- BUTTON_THEME_COLOR,
55
- getNormalAttributes,
56
- setNormalTextAttributeIntoInstance,
57
- getImageMode,
58
- }
59
-
60
- export {
61
- TaroImage,
62
- TaroCanvas,
63
- TaroText,
64
- TaroView,
65
- TaroIcon,
66
- TaroForm,
67
- TaroLabel,
68
- TaroInput,
69
- TaroVideo,
70
- TaroButton,
71
- TaroPicker,
72
- TaroSlider,
73
- TaroSwitch,
74
- TaroSwiper,
75
- TaroWebView,
76
- TaroTextArea,
77
- TaroRichText,
78
- TaroProgress,
79
- TaroInnerHtml,
80
- TaroScrollView,
81
- TaroMovableArea,
82
- TaroMovableView,
83
- TaroRadio,
84
- TaroRadioGroup,
85
- TaroCheckboxGroup,
86
- TaroCheckbox,
87
- TaroPageMeta,
88
- TaroNavigationBar,
89
- TaroListView,
90
- TaroStickySection,
91
- TaroScrollList
92
- }
32
+ export { default as commonStyleModify, rowModify, columnModify, textModify, setNormalTextAttributeIntoInstance } from './style'
33
+ export { TOUCH_EVENT_MAP } from './utils/constant/event'
34
+ export { BUTTON_THEME_COLOR } from './utils/constant/style'
35
+ export { DynamicCenter } from './utils/DynamicCenter'
36
+ export { FlexManager } from './utils/flexManager'
37
+ export { isTagFirstChild } from './utils/helper'
38
+ export { getStyleAttr } from './utils/styles'
39
+ export { shouldBindEvent, getNodeThresholds, getNormalAttributes, getFontAttributes } from './utils/helper'
@@ -4,7 +4,7 @@ import commonStyleModify from './style'
4
4
  import { parseStyles, shouldBindEvent, getNodeThresholds, getStyleAttr } from './utils/helper'
5
5
  import { INPUT_TYPE_MAP, INPUT_CONFIRM_MAP } from './utils/constant/style'
6
6
 
7
- import type { TaroStyleType, TaroAny, TaroInputElement, TaroEvent } from '@tarojs/runtime'
7
+ import type { TaroAny, TaroEvent, TaroInputElement, TaroStyleType } from '@tarojs/runtime'
8
8
 
9
9
  interface InputAttrs {
10
10
  textAlign?: TextAlign
@@ -91,16 +91,20 @@ export default struct TaroInput {
91
91
  .placeholderFont(getPlaceholderFont(this.node))
92
92
  .enterKeyType(INPUT_CONFIRM_MAP.get(this.node._attrs?.confirmType) || EnterKeyType.Done)
93
93
  .padding(0) // Note: 移出 Input 默认 padding 设置
94
- .backgroundColor(getStyleAttr(this.node, "backgroundColor"))//
94
+ .backgroundColor(getStyleAttr(this.node, "backgroundColor"))
95
95
  .attributeModifier(commonStyleModify.setNode(this.node).setAnimationStyle(this.overwriteStyle))
96
96
  .styles(this.node?.hmStyle)
97
97
  .attrs(getAttributes(this.node))
98
98
  .onChange((value: string) => {
99
- const event: TaroEvent = createTaroEvent('input', { detail: { value } }, this.node)
100
-
101
- this.value = value
102
- this.node?.updateFormWidgetValue(value)
103
- eventHandler(event, 'input', this.node)
99
+ const event: TaroEvent = createTaroEvent('change', { detail: { value } }, this.node)
100
+ eventHandler(event, 'change', this.node)
101
+
102
+ if (this.value !== value) {
103
+ const event: TaroEvent = createTaroEvent('input', { detail: { value } }, this.node)
104
+ this.value = value
105
+ this.node?.updateFormWidgetValue(value)
106
+ eventHandler(event, 'input', this.node)
107
+ }
104
108
  })
105
109
  .onSubmit(() => {
106
110
  const event: TaroEvent = createTaroEvent('confirm', { detail: { value: this.value } }, this.node)
@@ -6,8 +6,7 @@ import { TOUCH_EVENT_MAP } from './utils/constant/event'
6
6
  import { FlexManager } from './utils/flexManager'
7
7
  import { shouldBindEvent, getNodeThresholds } from './utils/helper'
8
8
 
9
- import type { TaroLabelElement, TaroElement, TaroAny, TaroRadioElement, TaroCheckboxElement } from '@tarojs/runtime'
10
- import { isUndefined } from '@tarojs/shared'
9
+ import type { TaroAny, TaroElement, TaroCheckboxElement, TaroLabelElement, TaroRadioElement } from '@tarojs/runtime'
11
10
 
12
11
  function handleTargetChange (id: string) {
13
12
  const taro: TaroAny = Current.taro