@ray-js/t-agent-ui-ray 0.2.2-beta-1 → 0.2.2-beta-2

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.
@@ -35,6 +35,7 @@ interface Props {
35
35
  children: React.ReactNode;
36
36
  style?: React.CSSProperties;
37
37
  onScroll?: (event: any) => void;
38
+ hideScrollbar?: boolean;
38
39
  }
39
40
  interface Ref {
40
41
  scrollToBottom: (options?: {
@@ -193,6 +193,9 @@ const ScrollBottomView = /*#__PURE__*/forwardRef((props, ref) => {
193
193
  return /*#__PURE__*/React.createElement(ScrollView, _extends({
194
194
  className: "".concat(props.className || '', " ").concat(scrollViewLoading ? 't-agent-message-list-hide' : ''),
195
195
  style: props.style
196
+ // @ts-ignore
197
+ ,
198
+ hideScrollbar: props.hideScrollbar
196
199
  }, scrollViewProps), /*#__PURE__*/React.createElement(View, _extends({}, contentViewProps, {
197
200
  className: "".concat(props.contentClassName || '')
198
201
  }), props.children, /*#__PURE__*/React.createElement(View, {
@@ -8,6 +8,7 @@ interface Props {
8
8
  renderTop?: React.ReactNode;
9
9
  renderBottom?: React.ReactNode;
10
10
  onScroll?: (event: any) => void;
11
+ hideScrollbar?: boolean;
11
12
  roleSide?: {
12
13
  user?: 'start' | 'end' | string;
13
14
  assistant?: 'start' | 'end' | string;
@@ -15,7 +15,8 @@ const MessageList = props => {
15
15
  style,
16
16
  wrapperClassName,
17
17
  wrapperStyle,
18
- historyLimit
18
+ historyLimit,
19
+ hideScrollbar
19
20
  } = props;
20
21
  const messages = useAgentMessage();
21
22
  const onScroll = useStableCallback(props.onScroll);
@@ -29,7 +30,8 @@ const MessageList = props => {
29
30
  className: "".concat(className || '', " t-agent-message-list-scroll"),
30
31
  contentClassName: "t-agent-message-list-scroll-content",
31
32
  style: style,
32
- onScroll: onScroll
33
+ onScroll: onScroll,
34
+ hideScrollbar: hideScrollbar
33
35
  }, historyLimit && historyLimit.count < messages.length && /*#__PURE__*/React.createElement(View, {
34
36
  className: "t-agent-message-list-history-tip"
35
37
  }, historyLimit.tipText), /*#__PURE__*/React.createElement(View, {
@@ -14,6 +14,7 @@
14
14
  display: flex;
15
15
  flex-direction: column;
16
16
  flex: 1 0 auto;
17
+ width: 100%;
17
18
  }
18
19
 
19
20
  .t-agent-message-list-row-start {
@@ -1,17 +1,10 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
3
  import { TileProps } from '../../types';
4
- export declare enum SceneType {
5
- EXECUTE = 1,
6
- AUTO = 2
7
- }
8
- type DeviceInfoItem = any;
9
- type SceneInfoItem = any;
10
- type ChangeInfoItem = any;
4
+ import { ChangeInfoItem, DeviceInfoItem, SceneInfoItem } from '../types';
11
5
  export interface ExecuteCardTileData {
12
6
  deviceInfo: DeviceInfoItem[];
13
7
  sceneInfo: SceneInfoItem[];
14
8
  deviceShareInfo: ChangeInfoItem[];
15
9
  }
16
10
  export default function ExecuteCardTile(props: TileProps<ExecuteCardTileData>): React.JSX.Element | null;
17
- export {};
@@ -4,23 +4,13 @@ import "core-js/modules/esnext.iterator.for-each.js";
4
4
  import "core-js/modules/esnext.iterator.map.js";
5
5
  import { Image, Switch, Text, View } from '@ray-js/components';
6
6
  import React, { useMemo } from 'react';
7
- // import {
8
- // ChangeInfoItem,
9
- // DeviceInfoItem,
10
- // SceneInfoItem,
11
- // SceneType,
12
- // } from '@ray-js/t-agent-plugin-assistant';
13
7
  import './index.less';
14
8
  import { triggerRule } from '@ray-js/ray';
15
9
  import { routeScene } from '../../utils';
16
10
  import lockPng from '../OperateCardTile/lock.png';
17
11
  import bookmark from './bookmark.png';
18
12
  import { useTranslate } from '../../hooks';
19
- export let SceneType = /*#__PURE__*/function (SceneType) {
20
- SceneType[SceneType["EXECUTE"] = 1] = "EXECUTE";
21
- SceneType[SceneType["AUTO"] = 2] = "AUTO";
22
- return SceneType;
23
- }({});
13
+ import { SceneType } from '../types';
24
14
  export default function ExecuteCardTile(props) {
25
15
  const {
26
16
  tile
@@ -101,7 +91,7 @@ export default function ExecuteCardTile(props) {
101
91
  } = card;
102
92
  if (intent === 'shareDevice') {
103
93
  ty.router({
104
- url: "tuyaSmart://thing_single_device_share?devId=".concat(deviceId),
94
+ url: "thingSmart://thing_single_device_share?devId=".concat(deviceId),
105
95
  fail(err) {
106
96
  console.error('router thing_single_device_share fail', err);
107
97
  }
@@ -130,7 +120,7 @@ export default function ExecuteCardTile(props) {
130
120
  sceneId
131
121
  } = card;
132
122
  ty.router({
133
- url: "tuyaSmart://editScene?sceneId=".concat(sceneId, "&biz_type=ai_smart&action=delete"),
123
+ url: "thingSmart://editScene?sceneId=".concat(sceneId, "&biz_type=ai_smart&action=delete"),
134
124
  fail: console.error
135
125
  });
136
126
  };
@@ -173,7 +163,7 @@ export default function ExecuteCardTile(props) {
173
163
  }, cards.map(card => {
174
164
  return /*#__PURE__*/React.createElement(View, {
175
165
  className: "t-agent-execute-card-tile-card",
176
- key: card.id
166
+ key: card.deviceId || card.sceneId
177
167
  }, card.displayType === 'device' && /*#__PURE__*/React.createElement(View, {
178
168
  className: "t-agent-execute-card-tile-device",
179
169
  onClick: () => handleTap(card)
@@ -181,7 +171,9 @@ export default function ExecuteCardTile(props) {
181
171
  src: card.icon,
182
172
  mode: "widthFix",
183
173
  className: "t-agent-execute-card-tile-device-icon"
184
- }), /*#__PURE__*/React.createElement(View, null, card.name)), card.displayType === 'energy' && /*#__PURE__*/React.createElement(View, {
174
+ }), /*#__PURE__*/React.createElement(View, {
175
+ className: "t-agent-execute-card-tile-device-title"
176
+ }, card.name)), card.displayType === 'energy' && /*#__PURE__*/React.createElement(View, {
185
177
  className: "t-agent-execute-card-tile-energy",
186
178
  onClick: () => handleTap(card)
187
179
  }, /*#__PURE__*/React.createElement(Image, {
@@ -1,154 +1,180 @@
1
1
  .t-agent-execute-card-tile {
2
- .t-agent-execute-card-tile-card {
3
- .t-agent-execute-card-tile-device {
4
- display: flex;
5
- align-items: center;
6
- min-height: 44px;
7
- background-color: var(--app-B1);
8
- padding: 12px;
9
- border-radius: var(--app-C1_1);
10
- margin-top: 8px;
11
-
12
- .t-agent-execute-card-tile-device-icon {
13
- width: 40px;
14
- height: 40px;
15
- margin-right: 10px;
16
- }
17
- }
18
-
19
- .t-agent-execute-card-tile-energy {
20
- display: flex;
21
- align-items: center;
22
- min-height: 44px;
23
- background-color: var(--app-B1);
24
- padding: 12px;
25
- border-radius: var(--app-C1_1);
26
- margin-top: 8px;
27
-
28
- .t-agent-execute-card-tile-energy-icon {
29
- width: 32px;
30
- height: 32px;
31
- border-radius: 4px;
32
- }
33
-
34
- .t-agent-execute-card-tile-energy-content {
35
- margin-left: 8px;
36
- flex: 1;
37
- .t-agent-execute-card-tile-energy-content-title {
38
- font-size: 16px;
39
- color: var(--app-C1);
40
- line-height: 22px;
41
- overflow: hidden;
42
- text-overflow: ellipsis;
43
- display: -webkit-box;
44
- -webkit-line-clamp: 2;
45
- -webkit-box-orient: vertical;
46
- }
47
-
48
- .t-agent-execute-card-tile-energy-content-desc {
49
- font-size: 13px;
50
- color: var(--app-B1-N3);
51
- line-height: 18px;
52
- overflow: hidden;
53
- text-overflow: ellipsis;
54
- display: -webkit-box;
55
- -webkit-line-clamp: 2;
56
- -webkit-box-orient: vertical;
57
- }
58
- }
59
- }
60
-
61
- .t-agent-execute-card-tile-scene {
62
- min-height: 44px;
63
- background-color: var(--app-B1);
64
- display: flex;
65
- align-items: center;
66
- padding: 12px;
67
- border-radius: var(--app-C1_1);
68
- margin-top: 8px;
69
-
70
- .t-agent-execute-card-tile-scene-icon-wrapper {
71
- display: flex;
72
- justify-content: center;
73
- align-items: center;
74
- width: 32px;
75
- height: 32px;
76
- border-radius: 10px;
77
- margin-right: 8px;
78
- .t-agent-execute-card-tile-scene-icon {
79
- width: 20px;
80
- height: 20px;
81
- filter: brightness(100);
82
- }
83
- }
84
-
85
- .t-agent-execute-card-tile-scene-name {
86
- flex: 1;
87
- font-size: 16px;
88
- line-height: 22px;
89
- color: var(--app-C1);
90
- }
91
-
92
- .t-agent-execute-card-tile-scene-switch {
93
- margin-left: auto;
94
- }
95
-
96
- .t-agent-execute-card-tile-scene-delete {
97
- display: flex;
98
- align-items: center;
99
- height: 24px;
100
- padding-right: 12px;
101
- padding-left: 12px;
102
- color: var(--app-M2);
103
- background: #fff;
104
- border-radius: var(--app-C1_1);
105
- font-size: 12px;
106
- }
107
- }
108
-
109
- .t-agent-execute-card-tile-execute {
110
- display: flex;
111
- align-items: center;
112
- min-height: 44px;
113
- background-color: #e36468;
114
- padding: 12px;
115
- border-radius: var(--app-C1_1);
116
- margin-top: 8px;
117
-
118
- &.t-agent-execute-card-tile-execute-disabled {
119
- opacity: 0.3;
120
- }
121
-
122
- .t-agent-execute-card-tile-execute-icon {
123
- width: 40px;
124
- height: 40px;
125
- margin-right: 10px;
126
- }
127
-
128
- .t-agent-execute-card-tile-execute-name {
129
- font-size: 16px;
130
- line-height: 22px;
131
- color: #ffffff;
132
- overflow: hidden;
133
- text-overflow: ellipsis;
134
- display: -webkit-box;
135
- -webkit-line-clamp: 2;
136
- -webkit-box-orient: vertical;
137
- }
138
-
139
- .t-agent-execute-card-tile-execute-button {
140
- margin-left: auto;
141
- line-height: 18px;
142
- padding: 3px 12px;
143
- font-size: 12px;
144
- font-weight: 600;
145
- color: #e36468;
146
- background-color: #ffffff;
147
- display: flex;
148
- justify-content: center;
149
- align-items: center;
150
- border-radius: 18px;
151
- }
152
- }
2
+
3
+ }
4
+
5
+ .t-agent-execute-card-tile-card {
6
+
7
+ }
8
+
9
+ .t-agent-execute-card-tile-device {
10
+ display: flex;
11
+ align-items: center;
12
+ min-height: 44px;
13
+ background-color: var(--app-B1);
14
+ padding: 12px;
15
+ border-radius: var(--app-C1_1);
16
+ margin-top: 8px;
17
+ }
18
+
19
+ .t-agent-execute-card-tile-device-icon {
20
+ width: 40px;
21
+ height: 40px;
22
+ margin-right: 10px;
23
+ flex-shrink: 0;
24
+ }
25
+
26
+ .t-agent-execute-card-tile-device-title {
27
+ font-size: 16px;
28
+ line-height: 22px;
29
+ color: var(--app-C1);
30
+ overflow: hidden;
31
+ text-overflow: ellipsis;
32
+ display: -webkit-box;
33
+ -webkit-line-clamp: 2;
34
+ -webkit-box-orient: vertical;
35
+ word-break: normal;
36
+ min-width: 200rpx;
37
+ overflow-wrap: break-word;
38
+ }
39
+
40
+ .t-agent-execute-card-tile-energy {
41
+ display: flex;
42
+ align-items: center;
43
+ min-height: 44px;
44
+ background-color: var(--app-B1);
45
+ padding: 12px;
46
+ border-radius: var(--app-C1_1);
47
+ margin-top: 8px;
48
+ }
49
+
50
+ .t-agent-execute-card-tile-energy-icon {
51
+ width: 32px;
52
+ height: 32px;
53
+ border-radius: 4px;
54
+ }
55
+
56
+ .t-agent-execute-card-tile-energy-content {
57
+ margin-left: 8px;
58
+ flex: 1;
59
+ }
60
+
61
+ .t-agent-execute-card-tile-energy-content-title {
62
+ font-size: 16px;
63
+ color: var(--app-C1);
64
+ line-height: 22px;
65
+ overflow: hidden;
66
+ text-overflow: ellipsis;
67
+ display: -webkit-box;
68
+ -webkit-line-clamp: 2;
69
+ -webkit-box-orient: vertical;
70
+ }
71
+
72
+ .t-agent-execute-card-tile-energy-content-desc {
73
+ font-size: 13px;
74
+ color: var(--app-B1-N3);
75
+ line-height: 18px;
76
+ overflow: hidden;
77
+ text-overflow: ellipsis;
78
+ display: -webkit-box;
79
+ -webkit-line-clamp: 2;
80
+ -webkit-box-orient: vertical;
81
+ }
82
+
83
+ .t-agent-execute-card-tile-scene {
84
+ min-height: 44px;
85
+ background-color: var(--app-B1);
86
+ display: flex;
87
+ align-items: center;
88
+ padding: 12px;
89
+ border-radius: var(--app-C1_1);
90
+ margin-top: 8px;
91
+ }
92
+
93
+ .t-agent-execute-card-tile-scene-icon-wrapper {
94
+ display: flex;
95
+ justify-content: center;
96
+ align-items: center;
97
+ width: 32px;
98
+ height: 32px;
99
+ border-radius: 10px;
100
+ margin-right: 8px;
101
+ }
102
+
103
+ .t-agent-execute-card-tile-scene-icon {
104
+ width: 20px;
105
+ height: 20px;
106
+ filter: brightness(100);
107
+ }
108
+
109
+ .t-agent-execute-card-tile-scene-name {
110
+ flex: 1;
111
+ font-size: 16px;
112
+ line-height: 22px;
113
+ color: var(--app-C1);
114
+ }
115
+
116
+ .t-agent-execute-card-tile-scene-switch {
117
+ margin-left: auto;
118
+ }
119
+
120
+ .t-agent-execute-card-tile-scene-delete {
121
+ display: flex;
122
+ align-items: center;
123
+ height: 24px;
124
+ padding-right: 12px;
125
+ padding-left: 12px;
126
+ color: var(--app-M2);
127
+ background: #fff;
128
+ border-radius: var(--app-C1_1);
129
+ font-size: 12px;
130
+ }
131
+
132
+ .t-agent-execute-card-tile-execute {
133
+ display: flex;
134
+ align-items: center;
135
+ min-height: 44px;
136
+ background-color: #e36468;
137
+ padding: 12px;
138
+ border-radius: var(--app-C1_1);
139
+ margin-top: 8px;
140
+
141
+ &.t-agent-execute-card-tile-execute-disabled {
142
+ opacity: 0.3;
153
143
  }
154
144
  }
145
+
146
+ .t-agent-execute-card-tile-execute-icon {
147
+ width: 40px;
148
+ height: 40px;
149
+ margin-right: 10px;
150
+ flex-shrink: 0;
151
+ }
152
+
153
+ .t-agent-execute-card-tile-execute-name {
154
+ font-size: 16px;
155
+ line-height: 22px;
156
+ color: #ffffff;
157
+ overflow: hidden;
158
+ text-overflow: ellipsis;
159
+ display: -webkit-box;
160
+ -webkit-line-clamp: 2;
161
+ -webkit-box-orient: vertical;
162
+ min-width: 200rpx;
163
+ word-break: normal;
164
+ overflow-wrap: break-word;
165
+ }
166
+
167
+ .t-agent-execute-card-tile-execute-button {
168
+ margin-left: auto;
169
+ line-height: 18px;
170
+ padding: 3px 12px;
171
+ font-size: 12px;
172
+ font-weight: 600;
173
+ color: #e36468;
174
+ background-color: #ffffff;
175
+ display: flex;
176
+ justify-content: center;
177
+ align-items: center;
178
+ border-radius: 18px;
179
+ flex-shrink: 0;
180
+ }
@@ -2,16 +2,13 @@ import React from 'react';
2
2
  import './index.less';
3
3
  import { TileProps } from '../../types';
4
4
  import { IOperations } from './Expand';
5
- type DeviceInfoItem = any;
6
- type SceneInfoItem = any;
7
- type ChangeInfoItem = any;
5
+ import { ChangeInfoItem, DeviceInfoItem, SceneInfoItem } from '../types';
8
6
  export interface OperateCardTileData {
9
7
  deviceInfo: DeviceInfoItem[];
10
8
  sceneInfo: SceneInfoItem[];
11
9
  changeInfo: ChangeInfoItem[];
12
10
  }
13
- export interface OperateCardTileProps extends TileProps {
14
- data: OperateCardTileData;
11
+ export interface OperateCardTileProps extends TileProps<OperateCardTileData> {
15
12
  /** 自定义详情内容渲染函数 */
16
13
  renderDetail?: (props: {
17
14
  operations: IOperations;
@@ -21,4 +18,3 @@ export interface OperateCardTileProps extends TileProps {
21
18
  }) => React.ReactNode;
22
19
  }
23
20
  export default function OperateCardTile(props: OperateCardTileProps): React.JSX.Element | null;
24
- export {};
@@ -5,8 +5,6 @@ import "core-js/modules/web.dom-collections.iterator.js";
5
5
  import { Text, View } from '@ray-js/components';
6
6
  import React, { useMemo, useState } from 'react';
7
7
  import './index.less';
8
- // import { ChangeInfoItem, DeviceInfoItem, SceneInfoItem } from '@ray-js/t-agent-plugin-assistant';
9
-
10
8
  import { useTileProps, useTranslate } from '../../hooks';
11
9
  import Expand from './Expand';
12
10
  import { formatMessage } from '../../utils';
@@ -100,7 +98,7 @@ export default function OperateCardTile(props) {
100
98
  const tapScene = e => {
101
99
  const sceneId = e.currentTarget.dataset.id;
102
100
  ty.router({
103
- url: "tuyaSmart://editScene?sceneId=".concat(sceneId, "&biz_type=ai_smart&action=edit"),
101
+ url: "thingSmart://editScene?sceneId=".concat(sceneId, "&biz_type=ai_smart&action=edit"),
104
102
  fail: () => {
105
103
  ty.showToast({
106
104
  title: t('t-agent.operate-card-tile.open.scene.failed'),
@@ -0,0 +1,31 @@
1
+ export declare enum SceneType {
2
+ EXECUTE = 1,
3
+ AUTO = 2
4
+ }
5
+ export interface SceneInfoItem {
6
+ success: boolean;
7
+ icon: string;
8
+ name: string;
9
+ sceneId: string;
10
+ displayColor: string;
11
+ type: SceneType;
12
+ intent: 'queryScene' | 'controlScene' | 'createScene' | 'deleteScene' | 'updateScene';
13
+ enabled: boolean;
14
+ valid: boolean;
15
+ }
16
+ export interface DeviceInfoItem {
17
+ success: boolean;
18
+ icon: string;
19
+ name: string;
20
+ deviceId: string;
21
+ intent: 'queryDevice' | 'controlDevice' | 'shareDevice';
22
+ room?: string;
23
+ }
24
+ export interface ChangeInfoItem {
25
+ id: string;
26
+ type: 'room' | 'device' | 'scene' | 'group' | 'home' | 'deviceRoom';
27
+ fromData: string;
28
+ toData: string;
29
+ success: boolean;
30
+ desc: string;
31
+ }
@@ -0,0 +1,5 @@
1
+ export let SceneType = /*#__PURE__*/function (SceneType) {
2
+ SceneType[SceneType["EXECUTE"] = 1] = "EXECUTE";
3
+ SceneType[SceneType["AUTO"] = 2] = "AUTO";
4
+ return SceneType;
5
+ }({});
@@ -1,6 +1,6 @@
1
1
  export function routeScene(sceneId) {
2
2
  ty.router({
3
- url: "tuyaSmart://editScene?sceneId=".concat(sceneId, "&biz_type=ai_smart&action=edit"),
3
+ url: "thingSmart://editScene?sceneId=".concat(sceneId, "&biz_type=ai_smart&action=edit"),
4
4
  fail: err => {
5
5
  console.error('router fail', sceneId, err);
6
6
  ty.showToast({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/t-agent-ui-ray",
3
- "version": "0.2.2-beta-1",
3
+ "version": "0.2.2-beta-2",
4
4
  "author": "Tuya.inc",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -40,5 +40,5 @@
40
40
  "@types/echarts": "^4.9.22",
41
41
  "@types/markdown-it": "^14.1.1"
42
42
  },
43
- "gitHead": "0dd513ad93a351ad5c00a1ee8993c7b62f03640f"
43
+ "gitHead": "33a1985d3a14487fe5f354411b0c46c8a8af19c7"
44
44
  }