@ray-js/t-agent-ui-ray 0.1.0-beta-2 → 0.1.0-beta-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.
- package/dist/ChatContainer/index.d.ts +1 -0
- package/dist/ChatContainer/index.js +4 -2
- package/dist/contexts.d.ts +1 -1
- package/dist/hooks/context.d.ts +1 -1
- package/dist/hooks/context.js +6 -1
- package/dist/hooks/useLongPress.js +13 -11
- package/dist/tiles/BubbleTile/index.js +2 -3
- package/dist/tiles/ExecuteCardTile/bookmark.png +0 -0
- package/dist/tiles/ExecuteCardTile/index.d.ts +10 -0
- package/dist/tiles/ExecuteCardTile/index.js +233 -0
- package/dist/tiles/ExecuteCardTile/index.less +154 -0
- package/dist/tiles/OperateCardTile/Expand.d.ts +17 -0
- package/dist/tiles/OperateCardTile/Expand.js +169 -0
- package/dist/tiles/OperateCardTile/Expand.less +135 -0
- package/dist/tiles/OperateCardTile/Tabs.d.ts +16 -0
- package/dist/tiles/OperateCardTile/Tabs.js +39 -0
- package/dist/tiles/OperateCardTile/Tabs.less +72 -0
- package/dist/tiles/OperateCardTile/index.d.ts +21 -0
- package/dist/tiles/OperateCardTile/index.js +228 -0
- package/dist/tiles/OperateCardTile/index.less +18 -0
- package/dist/tiles/OperateCardTile/lock.png +0 -0
- package/dist/tiles/map.js +5 -1
- package/dist/utils/formatMessage.d.ts +11 -0
- package/dist/utils/formatMessage.js +28 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +13 -0
- package/package.json +2 -2
|
@@ -29,6 +29,9 @@ export default function ChatContainer(props) {
|
|
|
29
29
|
}
|
|
30
30
|
return agent;
|
|
31
31
|
});
|
|
32
|
+
if (props.agentRef) {
|
|
33
|
+
props.agentRef.current = agent;
|
|
34
|
+
}
|
|
32
35
|
const uiAgent = useMemo(() => {
|
|
33
36
|
const session = {
|
|
34
37
|
get: agent.session.get,
|
|
@@ -46,8 +49,7 @@ export default function ChatContainer(props) {
|
|
|
46
49
|
plugins: agent.plugins,
|
|
47
50
|
pushInputBlocks: agent.pushInputBlocks,
|
|
48
51
|
emitTileEvent: agent.emitTileEvent,
|
|
49
|
-
removeMessage: agent.removeMessage
|
|
50
|
-
removeMessageByChannel: agent.removeMessageByChannel
|
|
52
|
+
removeMessage: agent.removeMessage
|
|
51
53
|
};
|
|
52
54
|
}, [agent]);
|
|
53
55
|
useEffect(() => {
|
package/dist/contexts.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const MessageContext: import("react").Context<{
|
|
|
9
9
|
}>;
|
|
10
10
|
export declare const RenderContext: import("react").Context<RenderOptions>;
|
|
11
11
|
export type UIChatSession = Pick<ChatSession, 'get' | 'getData' | 'set' | 'sessionId'>;
|
|
12
|
-
export type UIChatAgent = Pick<ChatAgent<UIPlugin & AssistantPlugin>, 'pushInputBlocks' | 'plugins' | 'emitTileEvent' | 'removeMessage'
|
|
12
|
+
export type UIChatAgent = Pick<ChatAgent<UIPlugin & AssistantPlugin>, 'pushInputBlocks' | 'plugins' | 'emitTileEvent' | 'removeMessage'> & {
|
|
13
13
|
session: UIChatSession;
|
|
14
14
|
};
|
|
15
15
|
export declare const ChatAgentContext: import("react").Context<UIChatAgent>;
|
package/dist/hooks/context.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export declare const useRenderOptions: () => import("..").RenderOptions;
|
|
|
8
8
|
export declare const useOnEvent: (eventName: string, callback: (details: any) => void) => void;
|
|
9
9
|
export declare const useEmitEvent: () => <T extends keyof import("@ray-js/t-agent").UIEventMap>(eventName: T, detail: import("@ray-js/t-agent").UIEventMap[T]) => void;
|
|
10
10
|
export declare const useTileProps: () => import("..").TileProps<any, any>;
|
|
11
|
-
export declare const useSendAction: () => (
|
|
11
|
+
export declare const useSendAction: () => (action: TTTAction) => void;
|
package/dist/hooks/context.js
CHANGED
|
@@ -32,9 +32,14 @@ export const useSendAction = () => {
|
|
|
32
32
|
const {
|
|
33
33
|
emitTileEvent
|
|
34
34
|
} = useTileProps();
|
|
35
|
-
|
|
35
|
+
const agent = useChatAgent();
|
|
36
|
+
const tileSendAction = useCallback(tttAction => {
|
|
36
37
|
emitTileEvent({
|
|
37
38
|
tttAction
|
|
38
39
|
});
|
|
39
40
|
}, [emitTileEvent]);
|
|
41
|
+
const uiSendAction = useCallback(action => {
|
|
42
|
+
agent.plugins.ui.emitEvent('runTTTAction', action);
|
|
43
|
+
}, [agent]);
|
|
44
|
+
return emitTileEvent ? tileSendAction : uiSendAction;
|
|
40
45
|
};
|
|
@@ -4,7 +4,6 @@ import "core-js/modules/esnext.iterator.for-each.js";
|
|
|
4
4
|
import "core-js/modules/esnext.iterator.map.js";
|
|
5
5
|
import "core-js/modules/web.dom-collections.iterator.js";
|
|
6
6
|
import { useState, useEffect, useCallback } from 'react';
|
|
7
|
-
import { getSystemInfoSync, setClipboardData, showModal, showToast, vibrateShort } from '@ray-js/ray';
|
|
8
7
|
import logger from '../logger';
|
|
9
8
|
import { useRenderOptions } from './context';
|
|
10
9
|
import { useChatAgent } from '.';
|
|
@@ -44,7 +43,7 @@ export function useLongPress() {
|
|
|
44
43
|
});
|
|
45
44
|
useEffect(() => {
|
|
46
45
|
try {
|
|
47
|
-
const systemInfo = getSystemInfoSync();
|
|
46
|
+
const systemInfo = ty.getSystemInfoSync();
|
|
48
47
|
setScreenSize({
|
|
49
48
|
width: systemInfo.windowWidth,
|
|
50
49
|
height: systemInfo.windowHeight
|
|
@@ -67,10 +66,10 @@ export function useLongPress() {
|
|
|
67
66
|
action: () => {
|
|
68
67
|
const content = getMessageContent();
|
|
69
68
|
if (content) {
|
|
70
|
-
setClipboardData({
|
|
69
|
+
ty.setClipboardData({
|
|
71
70
|
data: content,
|
|
72
71
|
success: () => {
|
|
73
|
-
showToast({
|
|
72
|
+
ty.showToast({
|
|
74
73
|
title: t('t-agent.message.copy.success'),
|
|
75
74
|
icon: 'none'
|
|
76
75
|
});
|
|
@@ -88,13 +87,13 @@ export function useLongPress() {
|
|
|
88
87
|
label: t('t-agent.message.action.delete'),
|
|
89
88
|
action: () => {
|
|
90
89
|
if (typeof agent.removeMessage === 'function') {
|
|
91
|
-
showModal({
|
|
90
|
+
ty.showModal({
|
|
92
91
|
title: t('t-agent.message.delete.title'),
|
|
93
92
|
content: t('t-agent.message.delete.content'),
|
|
94
93
|
success: res => {
|
|
95
94
|
if (res.confirm) {
|
|
96
95
|
agent.removeMessage(message.id);
|
|
97
|
-
showToast({
|
|
96
|
+
ty.showToast({
|
|
98
97
|
title: t('t-agent.message.delete.success'),
|
|
99
98
|
icon: 'none'
|
|
100
99
|
});
|
|
@@ -112,8 +111,11 @@ export function useLongPress() {
|
|
|
112
111
|
label: t('t-agent.message.action.deleteByChannel'),
|
|
113
112
|
action: () => {
|
|
114
113
|
const channel = agent.session.get('AIAssistant.channel');
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
const {
|
|
115
|
+
removeMessageByChannel
|
|
116
|
+
} = agent.plugins.assistant;
|
|
117
|
+
if (typeof removeMessageByChannel === 'function') {
|
|
118
|
+
removeMessageByChannel(channel);
|
|
117
119
|
}
|
|
118
120
|
}
|
|
119
121
|
});
|
|
@@ -123,7 +125,7 @@ export function useLongPress() {
|
|
|
123
125
|
key: 'like',
|
|
124
126
|
label: t('t-agent.message.action.like'),
|
|
125
127
|
action: () => {
|
|
126
|
-
showToast({
|
|
128
|
+
ty.showToast({
|
|
127
129
|
title: t('t-agent.message.like.success'),
|
|
128
130
|
icon: 'none'
|
|
129
131
|
});
|
|
@@ -135,7 +137,7 @@ export function useLongPress() {
|
|
|
135
137
|
key: 'unlike',
|
|
136
138
|
label: t('t-agent.message.action.unlike'),
|
|
137
139
|
action: () => {
|
|
138
|
-
showToast({
|
|
140
|
+
ty.showToast({
|
|
139
141
|
title: t('t-agent.message.unlike.success'),
|
|
140
142
|
icon: 'none'
|
|
141
143
|
});
|
|
@@ -195,7 +197,7 @@ export function useLongPress() {
|
|
|
195
197
|
isClosing: false,
|
|
196
198
|
menuPosition: adjustedPosition
|
|
197
199
|
});
|
|
198
|
-
vibrateShort({
|
|
200
|
+
ty.vibrateShort({
|
|
199
201
|
type: 'light'
|
|
200
202
|
});
|
|
201
203
|
if (e.origin && e.origin.stopPropagation) {
|
|
@@ -10,7 +10,6 @@ import React, { useEffect, useState, useCallback, memo } from 'react';
|
|
|
10
10
|
import { Image } from '@ray-js/ray';
|
|
11
11
|
import { BubbleTileStatus, ChatMessageStatus, safeParseJSON } from '@ray-js/t-agent';
|
|
12
12
|
import { getCurrentHomeInfo, submitEvaluation } from '@ray-js/t-agent-plugin-assistant';
|
|
13
|
-
import { setStorage, getStorage, showToast } from '@ray-js/api';
|
|
14
13
|
import TileRender from '../../TileRender';
|
|
15
14
|
import noticeSvg from './notice.svg';
|
|
16
15
|
import noticeWarnSvg from './notice-warn.svg';
|
|
@@ -43,7 +42,7 @@ const BubbleTile = props => {
|
|
|
43
42
|
const [feedbackLoaded, setFeedbackLoaded] = useState(false);
|
|
44
43
|
const [feedbackValue, setFeedbackValue] = useState(null);
|
|
45
44
|
useEffect(() => {
|
|
46
|
-
getStorage({
|
|
45
|
+
ty.getStorage({
|
|
47
46
|
key: 'latestMessageFeedbackValue',
|
|
48
47
|
success: res => {
|
|
49
48
|
if (res.data) {
|
|
@@ -65,7 +64,7 @@ const BubbleTile = props => {
|
|
|
65
64
|
}, []);
|
|
66
65
|
const showInfo = () => {
|
|
67
66
|
if (data.info) {
|
|
68
|
-
showToast({
|
|
67
|
+
ty.showToast({
|
|
69
68
|
title: data.info,
|
|
70
69
|
icon: 'none'
|
|
71
70
|
});
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ChangeInfoItem, DeviceInfoItem, SceneInfoItem } from '@ray-js/t-agent-plugin-assistant';
|
|
3
|
+
import './index.less';
|
|
4
|
+
import { TileProps } from '../../types';
|
|
5
|
+
export interface ExecuteCardTileData {
|
|
6
|
+
deviceInfo: DeviceInfoItem[];
|
|
7
|
+
sceneInfo: SceneInfoItem[];
|
|
8
|
+
deviceShareInfo: ChangeInfoItem[];
|
|
9
|
+
}
|
|
10
|
+
export default function ExecuteCardTile(props: TileProps<ExecuteCardTileData>): React.JSX.Element | null;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import "core-js/modules/esnext.iterator.constructor.js";
|
|
3
|
+
import "core-js/modules/esnext.iterator.for-each.js";
|
|
4
|
+
import "core-js/modules/esnext.iterator.map.js";
|
|
5
|
+
import { Image, Switch, Text, View } from '@ray-js/components';
|
|
6
|
+
import React, { useMemo } from 'react';
|
|
7
|
+
import { SceneType } from '@ray-js/t-agent-plugin-assistant';
|
|
8
|
+
import './index.less';
|
|
9
|
+
import { triggerRule } from '@ray-js/ray';
|
|
10
|
+
import { routeScene } from '../../utils';
|
|
11
|
+
import lockPng from '../OperateCardTile/lock.png';
|
|
12
|
+
import bookmark from './bookmark.png';
|
|
13
|
+
import { useRenderOptions } from '../../hooks';
|
|
14
|
+
export default function ExecuteCardTile(props) {
|
|
15
|
+
const {
|
|
16
|
+
tile
|
|
17
|
+
} = props;
|
|
18
|
+
const {
|
|
19
|
+
deviceInfo,
|
|
20
|
+
sceneInfo,
|
|
21
|
+
deviceShareInfo
|
|
22
|
+
} = tile.data || {};
|
|
23
|
+
const {
|
|
24
|
+
i18nTranslate: t
|
|
25
|
+
} = useRenderOptions();
|
|
26
|
+
const {
|
|
27
|
+
cards
|
|
28
|
+
} = useMemo(() => {
|
|
29
|
+
const cards = [];
|
|
30
|
+
if (deviceInfo !== null && deviceInfo !== void 0 && deviceInfo.length) {
|
|
31
|
+
deviceInfo.forEach(i => {
|
|
32
|
+
const {
|
|
33
|
+
intent
|
|
34
|
+
} = i;
|
|
35
|
+
switch (intent) {
|
|
36
|
+
case 'controlDevice':
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
cards.push(_objectSpread(_objectSpread({}, i), {}, {
|
|
40
|
+
displayType: 'device'
|
|
41
|
+
}));
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (sceneInfo !== null && sceneInfo !== void 0 && sceneInfo.length) {
|
|
47
|
+
sceneInfo.forEach(i => {
|
|
48
|
+
if (i.valid == null) {
|
|
49
|
+
i.valid = true;
|
|
50
|
+
}
|
|
51
|
+
const {
|
|
52
|
+
intent,
|
|
53
|
+
type
|
|
54
|
+
} = i;
|
|
55
|
+
const displayType = type === SceneType.EXECUTE ? 'execute' : 'scene';
|
|
56
|
+
switch (intent) {
|
|
57
|
+
case 'queryScene':
|
|
58
|
+
case 'updateScene':
|
|
59
|
+
cards.push(_objectSpread(_objectSpread({}, i), {}, {
|
|
60
|
+
displayType
|
|
61
|
+
}));
|
|
62
|
+
break;
|
|
63
|
+
case 'deleteScene':
|
|
64
|
+
if (!i.success) {
|
|
65
|
+
cards.push(_objectSpread(_objectSpread({}, i), {}, {
|
|
66
|
+
displayType
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
default:
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (deviceShareInfo !== null && deviceShareInfo !== void 0 && deviceShareInfo.length) {
|
|
76
|
+
deviceShareInfo.forEach(i => {
|
|
77
|
+
cards.push(_objectSpread(_objectSpread({}, i), {}, {
|
|
78
|
+
displayType: 'device'
|
|
79
|
+
}));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
cards
|
|
84
|
+
};
|
|
85
|
+
}, [deviceInfo, sceneInfo]);
|
|
86
|
+
if (!cards.length) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
const handleTap = card => {
|
|
90
|
+
const {
|
|
91
|
+
deviceId,
|
|
92
|
+
intent
|
|
93
|
+
} = card;
|
|
94
|
+
if (intent === 'shareDevice') {
|
|
95
|
+
ty.router({
|
|
96
|
+
url: "tuyaSmart://thing_single_device_share?devId=".concat(deviceId),
|
|
97
|
+
fail(err) {
|
|
98
|
+
console.error('router thing_single_device_share fail', err);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
ty.openPanel({
|
|
104
|
+
deviceId,
|
|
105
|
+
fail() {
|
|
106
|
+
ty.showToast({
|
|
107
|
+
title: t('t-agent.execute-card-tile.execution.failed'),
|
|
108
|
+
icon: 'error'
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const changeScene = (e, card) => {
|
|
114
|
+
const {
|
|
115
|
+
sceneId
|
|
116
|
+
} = card;
|
|
117
|
+
};
|
|
118
|
+
const deleteScene = (e, card) => {
|
|
119
|
+
var _e$origin;
|
|
120
|
+
e === null || e === void 0 || (_e$origin = e.origin) === null || _e$origin === void 0 || _e$origin.stopPropagation();
|
|
121
|
+
const {
|
|
122
|
+
sceneId
|
|
123
|
+
} = card;
|
|
124
|
+
ty.router({
|
|
125
|
+
url: "tuyaSmart://editScene?sceneId=".concat(sceneId, "&biz_type=ai_smart&action=delete"),
|
|
126
|
+
fail: console.error
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
const enterScene = card => {
|
|
130
|
+
const {
|
|
131
|
+
sceneId,
|
|
132
|
+
valid
|
|
133
|
+
} = card;
|
|
134
|
+
if (!valid) {
|
|
135
|
+
ty.showToast({
|
|
136
|
+
title: t('t-agent.execute-card-tile.scene.invalid'),
|
|
137
|
+
image: '/assets/images/notice.png'
|
|
138
|
+
});
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
routeScene(sceneId);
|
|
142
|
+
};
|
|
143
|
+
const execute = (e, card) => {
|
|
144
|
+
var _e$origin2;
|
|
145
|
+
e === null || e === void 0 || (_e$origin2 = e.origin) === null || _e$origin2 === void 0 || _e$origin2.stopPropagation();
|
|
146
|
+
const {
|
|
147
|
+
sceneId
|
|
148
|
+
} = card;
|
|
149
|
+
triggerRule({
|
|
150
|
+
ruleId: sceneId
|
|
151
|
+
}).then(() => {
|
|
152
|
+
ty.showToast({
|
|
153
|
+
title: t('t-agent.execute-card-tile.execution.success'),
|
|
154
|
+
icon: 'success'
|
|
155
|
+
});
|
|
156
|
+
}).catch(() => {
|
|
157
|
+
ty.showToast({
|
|
158
|
+
title: t('t-agent.execute-card-tile.execution.failed'),
|
|
159
|
+
icon: 'error'
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
164
|
+
className: "t-agent-execute-card-tile"
|
|
165
|
+
}, cards.map(card => {
|
|
166
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
167
|
+
className: "t-agent-execute-card-tile-card"
|
|
168
|
+
}, card.displayType === 'device' && /*#__PURE__*/React.createElement(View, {
|
|
169
|
+
className: "t-agent-execute-card-tile-device",
|
|
170
|
+
onClick: () => handleTap(card)
|
|
171
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
172
|
+
src: card.icon,
|
|
173
|
+
mode: "widthFix",
|
|
174
|
+
className: "t-agent-execute-card-tile-device-icon"
|
|
175
|
+
}), /*#__PURE__*/React.createElement(View, null, card.name)), card.displayType === 'energy' && /*#__PURE__*/React.createElement(View, {
|
|
176
|
+
className: "t-agent-execute-card-tile-energy",
|
|
177
|
+
onClick: () => handleTap(card)
|
|
178
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
179
|
+
src: card.icon,
|
|
180
|
+
mode: "widthFix",
|
|
181
|
+
className: "t-agent-execute-card-tile-energy-icon"
|
|
182
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
183
|
+
className: "t-agent-execute-card-tile-energy-content"
|
|
184
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
185
|
+
className: "t-agent-execute-card-tile-energy-content-title"
|
|
186
|
+
}, card.name), /*#__PURE__*/React.createElement(View, {
|
|
187
|
+
className: "t-agent-execute-card-tile-energy-content-desc"
|
|
188
|
+
}, card.desc))), card.displayType === 'scene' && /*#__PURE__*/React.createElement(View, {
|
|
189
|
+
className: "t-agent-execute-card-tile-scene",
|
|
190
|
+
onClick: () => enterScene(card)
|
|
191
|
+
}, /*#__PURE__*/React.createElement(View, {
|
|
192
|
+
className: "t-agent-execute-card-tile-scene-icon-wrapper",
|
|
193
|
+
style: {
|
|
194
|
+
backgroundColor: "#".concat(card.displayColor)
|
|
195
|
+
}
|
|
196
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
197
|
+
src: card.icon || bookmark,
|
|
198
|
+
mode: "widthFix",
|
|
199
|
+
className: "t-agent-execute-card-tile-scene-icon"
|
|
200
|
+
})), /*#__PURE__*/React.createElement(View, {
|
|
201
|
+
className: "t-agent-execute-card-tile-scene-name"
|
|
202
|
+
}, card.name, card.room && /*#__PURE__*/React.createElement(Text, null, "-", card.room)), card.valid && card.intent !== 'deleteScene' ? /*#__PURE__*/React.createElement(View, {
|
|
203
|
+
onClick: e => {
|
|
204
|
+
var _e$origin3;
|
|
205
|
+
return e === null || e === void 0 || (_e$origin3 = e.origin) === null || _e$origin3 === void 0 ? void 0 : _e$origin3.stopPropagation();
|
|
206
|
+
}
|
|
207
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
|
208
|
+
checked: card.enabled,
|
|
209
|
+
onChange: e => changeScene(e, card)
|
|
210
|
+
})) : /*#__PURE__*/React.createElement(View, {
|
|
211
|
+
className: "t-agent-execute-card-tile-scene-delete",
|
|
212
|
+
onClick: e => deleteScene(e, card)
|
|
213
|
+
}, t('t-agent.execute-card-tile.delete'))), card.displayType === 'execute' && /*#__PURE__*/React.createElement(View, {
|
|
214
|
+
className: "t-agent-execute-card-tile-execute ".concat(!card.valid ? 't-agent-execute-card-tile-execute-disabled' : ''),
|
|
215
|
+
style: {
|
|
216
|
+
backgroundColor: "#".concat(card.displayColor)
|
|
217
|
+
},
|
|
218
|
+
onClick: () => enterScene(card)
|
|
219
|
+
}, /*#__PURE__*/React.createElement(Image, {
|
|
220
|
+
src: card.icon || lockPng,
|
|
221
|
+
mode: "widthFix",
|
|
222
|
+
className: "t-agent-execute-card-tile-execute-icon"
|
|
223
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
224
|
+
className: "t-agent-execute-card-tile-execute-name"
|
|
225
|
+
}, card.name, card.room && /*#__PURE__*/React.createElement(Text, null, "-", card.room)), /*#__PURE__*/React.createElement(View, {
|
|
226
|
+
className: "t-agent-execute-card-tile-execute-button",
|
|
227
|
+
onClick: e => execute(e, card),
|
|
228
|
+
style: {
|
|
229
|
+
color: "#".concat(card.displayColor)
|
|
230
|
+
}
|
|
231
|
+
}, t('t-agent.execute-card-tile.execute'))));
|
|
232
|
+
}));
|
|
233
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
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
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DeviceInfoItem, SceneInfoItem, ChangeInfoItem } from '@ray-js/t-agent-plugin-assistant';
|
|
3
|
+
import './Expand.less';
|
|
4
|
+
export interface IOperations {
|
|
5
|
+
device: DeviceInfoItem[];
|
|
6
|
+
scene: SceneInfoItem[];
|
|
7
|
+
moreDevice: ChangeInfoItem[];
|
|
8
|
+
moreScene: ChangeInfoItem[];
|
|
9
|
+
more: ChangeInfoItem[];
|
|
10
|
+
}
|
|
11
|
+
interface ExpandProps {
|
|
12
|
+
operations?: IOperations;
|
|
13
|
+
tapDevice?: (e: any) => void;
|
|
14
|
+
tapScene?: (e: any) => void;
|
|
15
|
+
}
|
|
16
|
+
export default function Expand({ operations, tapDevice, tapScene, }: ExpandProps): React.JSX.Element;
|
|
17
|
+
export {};
|