diff --git a/function/arkui/inspector_test/entry/src/main/ets/pages/ActionSheet/actionSheet01.ets b/function/arkui/inspector_test/entry/src/main/ets/pages/ActionSheet/actionSheet01.ets new file mode 100644 index 0000000000000000000000000000000000000000..c2d644b45792afef2865b3bc3455d9f50a52734d --- /dev/null +++ b/function/arkui/inspector_test/entry/src/main/ets/pages/ActionSheet/actionSheet01.ets @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionSheet01 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet') + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + message: 'message', + autoCancel: false, + cancel: () => { + console.log('actionSheet canceled') + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + }, + { + title: 'pears', + action: () => { + console.log('pears') + } + } + ] + }) + }) + }.width('100%') + .height('100%') + } +} diff --git a/function/arkui/inspector_test/entry/src/main/ets/pages/ActionSheet/actionSheet02.ets b/function/arkui/inspector_test/entry/src/main/ets/pages/ActionSheet/actionSheet02.ets new file mode 100644 index 0000000000000000000000000000000000000000..bba23e8e4b887e530c832db7c0795fdfcd73c7d6 --- /dev/null +++ b/function/arkui/inspector_test/entry/src/main/ets/pages/ActionSheet/actionSheet02.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionSheet02 { + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text("ActionSheet with [subtitle,confirm]") + .fontSize(18) + .margin({ top: 24,bottom:24 }) + Button('Click to Show ActionSheet') + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: false, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + cancel: () => { + console.log('actionSheet canceled') + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + icon:$r("app.media.icon") , + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + }, + { + title: 'pears', + action: () => { + console.log('pears') + } + } + ] + }) + }) + }.width('100%') + .height('100%') + } +} diff --git a/function/arkui/inspector_test/entry/src/main/ets/pages/AlertDialog/alertDialog01.ets b/function/arkui/inspector_test/entry/src/main/ets/pages/AlertDialog/alertDialog01.ets new file mode 100644 index 0000000000000000000000000000000000000000..4fd36f5b357a75dc582cc6e72f068cf2b25daaa5 --- /dev/null +++ b/function/arkui/inspector_test/entry/src/main/ets/pages/AlertDialog/alertDialog01.ets @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct AlertDialog01 { + + build() { + Column({ space: 5 }) { + Button('one button dialog') + .onClick(() => { + AlertDialog.show( + { + message: 'text', + autoCancel: true, + alignment: DialogAlignment.Center, + gridCount: 4, + showInSubWindow: true, + isModal: true, + offset: { dx: 0, dy: -20 }, + cancel: () => { + console.info('Closed callbacks') + }, + onWillDismiss: (dismissDialogAction: DismissDialogAction) => { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + } + }) + }) + }.width('100%').margin({ top: 5 }).backgroundColor(0x317aff) + } +} diff --git a/function/arkui/inspector_test/entry/src/main/ets/pages/AlertDialog/alertDialog02.ets b/function/arkui/inspector_test/entry/src/main/ets/pages/AlertDialog/alertDialog02.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f854beef3deb2604b60500bc6fe2a2d3694ece6 --- /dev/null +++ b/function/arkui/inspector_test/entry/src/main/ets/pages/AlertDialog/alertDialog02.ets @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct AlertDialog02 { + + build() { + Column({ space: 5 }) { + Text("AlertDialog with [title,subtitle,confirm]") + .fontSize(18) + .margin({ top: 24,bottom:24 }) + Button('one button dialog') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + subtitle: 'subtitle', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.Center, + gridCount: 4, + showInSubWindow: true, + isModal: true, + offset: { dx: 0, dy: -20 }, + confirm: { + value: 'button', + action: () => { + console.info('Button-clicking callback') + } + }, + cancel: () => { + console.info('Closed callbacks') + }, + onWillDismiss: (dismissDialogAction: DismissDialogAction) => { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + } + }) + }) + }.width('100%').margin({ top: 5 }).backgroundColor(0x317aff) + } +} diff --git a/function/arkui/inspector_test/entry/src/main/ets/pages/AlertDialog/alertDialog03.ets b/function/arkui/inspector_test/entry/src/main/ets/pages/AlertDialog/alertDialog03.ets new file mode 100644 index 0000000000000000000000000000000000000000..a25f7ed473df7f7261ac26bd5aeeaaa1ad2d57d3 --- /dev/null +++ b/function/arkui/inspector_test/entry/src/main/ets/pages/AlertDialog/alertDialog03.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct AlertDialog03 { + + build() { + Column({ space: 5 }) { + Text("AlertDialog with [title,subtitle,primaryButton,secondaryButton]") + .fontSize(18) + .margin({ top: 24,bottom:24 }) + Button('one button dialog') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + subtitle: 'subtitle', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.Center, + gridCount: 4, + showInSubWindow: true, + isModal: true, + offset: { dx: 0, dy: -20 }, + primaryButton: { + value: 'cancel', + action: () => { + console.info('Callback when the first button is clicked') + } + }, + secondaryButton: { + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + value: 'ok', + action: () => { + console.info('Callback when the second button is clicked') + } + }, + cancel: () => { + console.info('Closed callbacks') + }, + onWillDismiss: (dismissDialogAction: DismissDialogAction) => { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + } + }) + }) + }.width('100%').margin({ top: 5 }).backgroundColor(0x317aff) + } +} diff --git a/function/arkui/inspector_test/entry/src/main/ets/pages/AlertDialog/alertDialog04.ets b/function/arkui/inspector_test/entry/src/main/ets/pages/AlertDialog/alertDialog04.ets new file mode 100644 index 0000000000000000000000000000000000000000..da1627105235f82e5c95c63ed5eea48776ffb5a9 --- /dev/null +++ b/function/arkui/inspector_test/entry/src/main/ets/pages/AlertDialog/alertDialog04.ets @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct AlertDialog04 { + + build() { + Column({ space: 5 }) { + Text("AlertDialog with [title,subtitle,buttons]") + .fontSize(18) + .margin({ top: 24,bottom:24 }) + Button('one button dialog') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + subtitle: 'subtitle', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.Center, + gridCount: 4, + showInSubWindow: true, + isModal: true, + offset: { dx: 0, dy: -20 }, + buttonDirection: DialogButtonDirection.HORIZONTAL, + buttons: [ + { + value: '按钮', + action: () => { + console.info('Callback when button1 is clicked') + } + }, + { + value: '按钮', + action: () => { + console.info('Callback when button2 is clicked') + } + }, + { + value: '按钮', + enabled: true, + defaultFocus: true, + style: DialogButtonStyle.HIGHLIGHT, + action: () => { + console.info('Callback when button3 is clicked') + } + }, + ], + cancel: () => { + console.info('Closed callbacks') + }, + onWillDismiss: (dismissDialogAction: DismissDialogAction) => { + console.info("reason=" + JSON.stringify(dismissDialogAction.reason)) + console.log("dialog onWillDismiss") + if (dismissDialogAction.reason == DismissReason.PRESS_BACK) { + dismissDialogAction.dismiss() + } + if (dismissDialogAction.reason == DismissReason.TOUCH_OUTSIDE) { + dismissDialogAction.dismiss() + } + } + }) + }) + }.width('100%').margin({ top: 5 }).backgroundColor(0x317aff) + } +} diff --git a/function/arkui/inspector_test/entry/src/main/ets/pages/CalendarPickerDialog/calendarPickerDialog.ets b/function/arkui/inspector_test/entry/src/main/ets/pages/CalendarPickerDialog/calendarPickerDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..e5c11354415f4624295d966ebb782da2acb1a851 --- /dev/null +++ b/function/arkui/inspector_test/entry/src/main/ets/pages/CalendarPickerDialog/calendarPickerDialog.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct CalendarPickerDialog01 { + private selectedDate: Date = new Date() + + build() { + Column() { + Text("CalendarPickerDialog") + .fontSize(18) + .margin({ top: 24,bottom:24 }) + Button("Show CalendarPicker Dialog") + .margin(20) + .onClick(() => { + console.info("CalendarDialog.show") + CalendarPickerDialog.show({ + selected: this.selectedDate, + onAccept: (value) => { + console.info("calendar onAccept:" + JSON.stringify(value)) + }, + id: "111", + onCancel: () => { + console.info("calendar onCancel") + }, + onChange: (value) => { + console.info("calendar onChange:" + JSON.stringify(value)) + } + }) + }) + + }.width('100%') + } +} \ No newline at end of file diff --git a/function/arkui/inspector_test/entry/src/main/resources/base/profile/main_pages.json b/function/arkui/inspector_test/entry/src/main/resources/base/profile/main_pages.json index 23887caec7bc40e6b096b03315b1ca0a130f78bd..164b8d65576d2256dba908c4e182e81aa5dfb397 100644 --- a/function/arkui/inspector_test/entry/src/main/resources/base/profile/main_pages.json +++ b/function/arkui/inspector_test/entry/src/main/resources/base/profile/main_pages.json @@ -27,6 +27,13 @@ "pages/Stepper/stepper03", "pages/Stepper/stepper04", "pages/Video/video01", - "pages/RichEditor/RichEditor01" + "pages/RichEditor/RichEditor01", + "pages/ActionSheet/actionSheet01", + "pages/ActionSheet/actionSheet02", + "pages/AlertDialog/alertDialog01", + "pages/AlertDialog/alertDialog02", + "pages/AlertDialog/alertDialog03", + "pages/AlertDialog/alertDialog04", + "pages/CalendarPickerDialog/calendarPickerDialog" ] }