@dobot-plus/template 1.0.7 → 1.1.0

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.
@@ -1,237 +0,0 @@
1
- export interface IStoreState {
2
- toolReducer: ToolState
3
- userMagamentReducer: userMagamentState
4
- }
5
-
6
- export interface ICapacityData {
7
- totalPallet: number
8
- totalBox: number
9
- timeHour: number
10
- timeMin: number
11
- timeSec: number
12
- }
13
-
14
- export interface IPalletRunningData {
15
- status: number
16
- layer: number
17
- box: number
18
- }
19
-
20
- export interface ParamsStyle {
21
- x: number
22
- y: number
23
- // 0:默认;1:旋转90
24
- rotate: number
25
- connection: number // 0:单吸 1:双吸(长边对齐) 2:双吸(短边对齐)
26
- }
27
-
28
- export interface ItemPreviewParams {
29
- boxCount: number
30
- pallet: {
31
- length: number
32
- width: number
33
- height: number
34
- }
35
- box: {
36
- length: number
37
- width: number
38
- height: number
39
- weight: number
40
- }
41
- style:
42
- | {
43
- typeA: ParamsStyle[]
44
- typeB: ParamsStyle[]
45
- }
46
- | {
47
- typeC: ParamsStyle[]
48
- typeD: ParamsStyle[]
49
- }
50
- layer: {
51
- count: number
52
- order: number[]
53
- partition: number
54
- partitionHeight: number
55
- }
56
- coordinate: {
57
- user: Array<number>
58
- tool: number
59
- }
60
- }
61
-
62
- export interface PreviewParamsData {
63
- conveyer?: number
64
- suction?: number
65
- lift?: number
66
- left?: ItemPreviewParams
67
- right?: ItemPreviewParams
68
- }
69
- export interface PointType {
70
- x: number
71
- y: number
72
- z: number
73
- rx: number
74
- ry: number
75
- rz: number
76
- }
77
- export interface caliPointType {
78
- imageX: number
79
- imageY: number
80
- physicalX: number
81
- physicalY: number
82
- angle: number
83
- }
84
- export interface ToolState {
85
- portData: {
86
- ip: string
87
- port: string
88
- isSync: boolean
89
- }
90
- tcpStatus: boolean
91
- tcpInfo: any
92
- extendIoData: any[]
93
- onRobotTool: string[]
94
- deviceStateData: DeviceState
95
- ioData: any
96
- pluginPort: string
97
- dobotplusHost: string
98
- ioList: {
99
- input: {
100
- address: number
101
- diValue: number
102
- editName: string
103
- init: string
104
- isShow: boolean
105
- name: string
106
- value: number
107
- }[]
108
- output: {
109
- address: number
110
- editName: string
111
- init: string
112
- isShow: boolean
113
- name: string
114
- value: number
115
- }[]
116
- }
117
- pointData: any[]
118
- jogInPaused: boolean
119
- }
120
-
121
- export type DeviceState = {
122
- isTimeout?: boolean
123
- stateL?: boolean
124
- pose: {
125
- joints: number[]
126
- axes: number[]
127
- auxJoint: number[]
128
- l: number
129
- rdnCoordinate?: number[]
130
- }
131
- alarm: number[]
132
- alarmGo: number[]
133
- hht: {
134
- isEnabled: boolean
135
- }
136
- safeGuardMode?: 0 | 1 | 2
137
- batteryVoltage?: number
138
- batteryStatus?: 0 | 1
139
- moveSpeed?: {
140
- x: number
141
- y: number
142
- r: number
143
- }
144
- position?: {
145
- x: number
146
- y: number
147
- yaw: number
148
- }
149
- joyState?: boolean
150
- controlMode: number
151
- isCollision?: boolean
152
- skinCollison?: boolean
153
-
154
- remoteControl?: remoteControlType
155
- cameraModel?: {
156
- arm: number
157
- car: number
158
- }
159
- inputs?: number[]
160
- outputs?: number[]
161
- endDI?: number[]
162
- endDO?: number[]
163
- gpioAO?: number[]
164
- extendDO?: number[][]
165
- extendDI?: number[][]
166
- ioAI?: number[]
167
- endAI?: number[]
168
- prjState?: PrjStateType
169
- powerState?: boolean
170
- detailsInfo?: {
171
- controlParams: number[]
172
- jointCurrent: number[]
173
- jointVoltage: number[]
174
- jointTemp: number[]
175
- }
176
- dragMode?: boolean // 拖拽状态
177
- isSafeRun?: number
178
- isSafeSuspend?: number
179
- safeDO?: number[]
180
- safeDI?: number[]
181
- selectedControlBarCoordinate: {
182
- user: number
183
- tool: number
184
- }
185
- jogMode: JogMode
186
- dragPlayback?: boolean // 复现状态
187
- dragTrack?: boolean // 录制状态
188
- autoManual?: 'auto' | 'manual'
189
- emergencyStop?: boolean
190
- warning?: number
191
- speedRatio?: number
192
- remoteRun?: boolean
193
- jointBrake?: number[]
194
- coordinate?: CoordinateType
195
- pointSignal?: number
196
- ledStatus?: number
197
- skinValue?: number[]
198
- }
199
-
200
- export enum RemoteModeType {
201
- Online = 'tp',
202
- TCP = 'tcp'
203
- }
204
- export type remoteControlType = {
205
- mode: RemoteModeType
206
- name: string
207
- }
208
- export enum PrjStateType {
209
- stopped = 'stopped',
210
- suspended = 'suspended',
211
- running = 'running'
212
- }
213
- export enum JogMode {
214
- Jog = 'jog',
215
- Step = 'step'
216
- }
217
- export enum CoordinateType {
218
- Cartesian = 'cartesian',
219
- Joint = 'joint',
220
- Tool = 'tool'
221
- }
222
- export interface userMagamentState {
223
- userModalData: {
224
- show: boolean
225
- edit?: boolean
226
- user?: any
227
- index?: number
228
- }
229
- permissionList: any[]
230
- currentLevel: number
231
- currentUserInfo: string
232
- }
233
-
234
- export enum ModuleType {
235
- Module = 'Module',
236
- Template = 'Template'
237
- }
@@ -1,31 +0,0 @@
1
- import zh from '../../Resources/i18n/plugin/zh.json'
2
- import de from '../../Resources/i18n/plugin/de.json'
3
- import ja from '../../Resources/i18n/plugin/ja.json'
4
- import ko from '../../Resources/i18n/plugin/ko.json'
5
- import en from '../../Resources/i18n/plugin/en.json'
6
- import ru from '../../Resources/i18n/plugin/ru.json'
7
- import es from '../../Resources/i18n/plugin/es.json'
8
- import hk from '../../Resources/i18n/plugin/hk.json'
9
-
10
- import i18n from 'i18next'
11
- import { initReactI18next } from 'react-i18next'
12
-
13
- i18n.use(initReactI18next).init({
14
- resources: {
15
- en: { translation: en },
16
- zh: { translation: zh },
17
- de: { translation: de },
18
- ja: { translation: ja },
19
- ko: { translation: ko },
20
- ru: { translation: ru },
21
- es: { translation: es },
22
- hk: { translation: hk }
23
- },
24
- lng: 'zh',
25
- interpolation: {
26
- escapeValue: false
27
- },
28
- fallbackLng: 'en'
29
- })
30
-
31
- export default i18n
@@ -1,61 +0,0 @@
1
- import { connect, MqttClient, IClientOptions } from 'mqtt'
2
- export class MqttWebSocketClient {
3
- private client!: MqttClient
4
- private receiveMessageHandle!: (topic: string, msg: Buffer) => void
5
- private serverUrl: string
6
- private clientId: string
7
- private options: IClientOptions
8
- public constructor(serverUrl: string, clientId: string, options?: IClientOptions) {
9
- this.serverUrl = serverUrl
10
- this.clientId = clientId
11
- this.options = options || {}
12
- }
13
-
14
- //连接
15
- public connect(): void {
16
- this.client = connect(this.serverUrl, {
17
- clientId: this.clientId,
18
- ...this.options
19
- })
20
- this.client.on('connect', this.onConnect)
21
- this.client.on('message', this.onMessage) //接收消息
22
- this.client.on('error', this.onError)
23
- }
24
- //断开连接
25
- public disconnect(): void {
26
- if (this.client) {
27
- this.client.end()
28
- }
29
- }
30
-
31
- // 订阅
32
- public subscribe(topic: string, receiveMessageHandle?: (topic: string, msg: Buffer) => void): void {
33
- if (this.client) {
34
- this.client.subscribe(topic)
35
- if (receiveMessageHandle) {
36
- this.receiveMessageHandle = receiveMessageHandle
37
- }
38
- }
39
- }
40
- //取消订阅
41
- public unsubscribe(topic: string): void {
42
- if (this.client) {
43
- this.client.unsubscribe(topic)
44
- }
45
- }
46
- // 发布消息
47
- public publish(topic: string, message: string | Buffer): void {
48
- if (this.client) {
49
- this.client.publish(topic, message)
50
- }
51
- }
52
- private onConnect = (): void => {}
53
- private onMessage = (topic: string, message: Buffer): void => {
54
- if (this.receiveMessageHandle) {
55
- this.receiveMessageHandle(topic, message)
56
- }
57
- }
58
- private onError = (error: Error): void => {
59
- console.log('连接错误:', error)
60
- }
61
- }
@@ -1,21 +0,0 @@
1
- ; (function (doc, win) {
2
- var docEl = doc.documentElement,
3
- resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
4
- recalc = function () {
5
- var clientWidth = docEl.clientWidth
6
- var clientHeight = docEl.clientHeight
7
- if (!clientWidth) return
8
- if (clientWidth >= 596 && clientHeight >= 624) {
9
- docEl.style.fontSize = '100px'
10
- } else if (clientWidth < 596 && clientHeight >= 624) {
11
- docEl.style.fontSize = 100 * (clientWidth / 596) + 'px'
12
- } else if (clientWidth >= 596 && clientHeight < 624) {
13
- docEl.style.fontSize = 100 * (clientHeight / 624) + 'px'
14
- } else {
15
- docEl.style.fontSize = 100 * (clientWidth / 624) + 'px'
16
- }
17
- }
18
- if (!doc.addEventListener) return
19
- win.addEventListener(resizeEvt, recalc, false)
20
- doc.addEventListener('DOMContentLoaded', recalc, false)
21
- })(document, window)
@@ -1,15 +0,0 @@
1
- export const isInIframe = window.self !== window.top
2
-
3
- export const jsonSafeParse = (data: string | object) => {
4
- if (typeof data === 'string') {
5
- try {
6
- const obj = JSON.parse(data)
7
- if (typeof obj === 'object' && obj) {
8
- return obj
9
- }
10
- } catch (e) {
11
- return data
12
- }
13
- }
14
- return data
15
- }
@@ -1,76 +0,0 @@
1
- const path = require('path')
2
- const HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin')
3
- const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
4
- const { entries, htmlPlugins } = require('./entry')
5
- const { DefinePlugin, ProvidePlugin } = require('webpack')
6
-
7
- module.exports = (opts) => {
8
- return {
9
- mode: 'production',
10
- entry: entries,
11
- output: {
12
- publicPath: './',
13
- filename: '[name].js',
14
- path: path.resolve(opts.output || 'dist')
15
- },
16
- module: {
17
- rules: [
18
- {
19
- test: /\.(sa|sc|c)ss$/,
20
- use: [
21
- 'style-loader',
22
- 'css-loader',
23
- 'postcss-loader',
24
- {
25
- loader: 'sass-loader',
26
- options: {
27
- // implementation: sass
28
- }
29
- }
30
- ]
31
- },
32
- {
33
- test: /\.tsx?$/,
34
- use: {
35
- loader: 'esbuild-loader',
36
- options: {
37
- loader: 'tsx',
38
- target: 'es2015'
39
- }
40
- }
41
- },
42
- {
43
- test: /\.(jpe?g|png|gif|webp|svg)$/,
44
- use: [
45
- {
46
- loader: 'url-loader',
47
- options: {
48
- // limit: 10 * 1024,
49
- esModule: false
50
- }
51
- }
52
- ]
53
- }
54
- ]
55
- },
56
- optimization: {
57
- minimizer: [new CssMinimizerPlugin({})]
58
- },
59
- plugins: [
60
- ...htmlPlugins,
61
- new HtmlInlineScriptPlugin({
62
- htmlMatchPattern: [/.html$/]
63
- }),
64
- new ProvidePlugin({
65
- process: 'process/browser.js',
66
- Buffer: ['buffer', 'Buffer']
67
- })
68
- ],
69
- resolve: {
70
- extensions: ['.js', '.jsx', '.json', '.tsx', '.ts'],
71
- alias: {
72
- '@dobot': path.resolve(process.cwd(), './.dobot')
73
- }
74
- }
75
- }
76
- }
@@ -1,91 +0,0 @@
1
- const { DefinePlugin, ProvidePlugin } = require('webpack')
2
- const { entries, htmlPlugins } = require('./entry')
3
- const { resolve } = require('path')
4
- const HtmlWebpackPlugin = require('html-webpack-plugin')
5
-
6
- module.exports = {
7
- mode: 'development',
8
- devtool: 'eval-source-map',
9
- target: 'web',
10
- entry: {
11
- index: resolve(process.cwd(), `./.dobot/template/entry.tsx`),
12
- ...entries
13
- },
14
- module: {
15
- rules: [
16
- {
17
- test: /\.(sa|sc|c)ss$/,
18
- use: [
19
- 'style-loader',
20
- 'css-loader',
21
- 'postcss-loader',
22
- {
23
- loader: 'sass-loader',
24
- options: {
25
- // implementation: sass
26
- }
27
- }
28
- ]
29
- },
30
- {
31
- test: /\.tsx?$/,
32
- use: {
33
- loader: 'esbuild-loader',
34
- options: {
35
- loader: 'tsx',
36
- target: 'es2015'
37
- }
38
- }
39
- },
40
- {
41
- test: /\.(jpe?g|png|gif|webp|svg)$/,
42
- use: [
43
- {
44
- loader: 'url-loader',
45
- options: {
46
- limit: 10 * 1024,
47
- esModule: false
48
- }
49
- }
50
- ]
51
- }
52
- ]
53
- },
54
- plugins: [
55
- new HtmlWebpackPlugin({
56
- filename: `index.html`,
57
- chunks: ['index'],
58
- template: resolve(process.cwd(), `./.dobot/template/index.html`),
59
- inject: 'body',
60
- minify: {
61
- // 压缩html
62
- collapseWhitespace: true, // 折叠空白区域
63
- keepClosingSlash: true, // 保持闭合间隙
64
- removeComments: true, // 移除注释
65
- removeRedundantAttributes: true, // 删除冗余属性
66
- removeScriptTypeAttributes: true, // 删除Script脚本类型属性
67
- removeStyleLinkTypeAttributes: true, // 删除样式链接类型属性
68
- useShortDoctype: true, // 使用短文档类型
69
- preserveLineBreaks: true, // 保留换行符
70
- minifyCSS: true, // 压缩文内css
71
- minifyJS: true // 压缩文内js
72
- }
73
- }),
74
- ...htmlPlugins,
75
- new ProvidePlugin({
76
- process: 'process/browser.js',
77
- Buffer: ['buffer', 'Buffer']
78
- }),
79
- new DefinePlugin({
80
- 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
81
- })
82
- ],
83
- resolve: {
84
- extensions: ['.js', '.jsx', '.json', '.tsx', '.ts'],
85
- alias: {
86
- snapsvg: 'snapsvg/dist/snap.svg.js',
87
- reactMarkdown: 'react-markdown/index.js',
88
- '@dobot': resolve(process.cwd(), './.dobot')
89
- }
90
- }
91
- }
@@ -1,56 +0,0 @@
1
- const { resolve } = require('path')
2
- const fs = require('fs')
3
- const HtmlWebpackPlugin = require('html-webpack-plugin')
4
-
5
- const cmdPath = process.cwd()
6
-
7
- const entries = {}
8
-
9
- const pageFiles = fs.readdirSync(resolve(cmdPath, './ui'))
10
- const pages = []
11
- pageFiles.forEach((page) => {
12
- const status = fs.statSync(resolve(cmdPath, `./ui/${page}`))
13
- if (!status.isDirectory()) {
14
- pages.push(page.split('.')[0])
15
- }
16
- })
17
-
18
- pages.forEach((page) => {
19
-
20
- if (!fs.existsSync(resolve(cmdPath, `./.dobot/template/${page}.tsx`))) {
21
- const tplStr = fs.readFileSync(resolve(cmdPath, `./.dobot/template/default.tsx.mustache`), 'utf-8')
22
- fs.writeFileSync(resolve(cmdPath, `./.dobot/template/${page}.tsx`), tplStr.replace('$APP_PATH$', `../../ui/${page}`))
23
- }
24
- entries[page] = resolve(cmdPath, `./.dobot/template/${page}.tsx`)
25
- })
26
-
27
- const htmlPlugins = pages.map(
28
- (file) =>
29
- new HtmlWebpackPlugin({
30
- filename: `${file}/${/toolbar/i.test(file) ? 'toolbar' : 'index'}.html`,
31
- chunks: [file],
32
- template: fs.existsSync(resolve(cmdPath, `./.dobot/template/${file}.html`))
33
- ? `./.dobot/template/${file}.html`
34
- : `./.dobot/template/index.html`,
35
- inject: 'body',
36
- minify: {
37
- // 压缩html
38
- collapseWhitespace: true, // 折叠空白区域
39
- keepClosingSlash: true, // 保持闭合间隙
40
- removeComments: true, // 移除注释
41
- removeRedundantAttributes: true, // 删除冗余属性
42
- removeScriptTypeAttributes: true, // 删除Script脚本类型属性
43
- removeStyleLinkTypeAttributes: true, // 删除样式链接类型属性
44
- useShortDoctype: true, // 使用短文档类型
45
- preserveLineBreaks: true, // 保留换行符
46
- minifyCSS: true, // 压缩文内css
47
- minifyJS: true // 压缩文内js
48
- }
49
- })
50
- )
51
-
52
-
53
- module.exports = {
54
- entries,
55
- htmlPlugins
56
- }