@things-factory/shell 7.0.1-alpha.1 β 7.0.1-alpha.13
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/client/elements/index.js +0 -1
- package/client/index.js +0 -6
- package/dist-server/server-dev.js +1 -5
- package/dist-server/server-dev.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/dist-server/typeorm/round-transform.js +1 -1
- package/dist-server/typeorm/round-transform.js.map +1 -1
- package/package.json +5 -6
- package/server/server-dev.ts +1 -8
- package/server/typeorm/round-transform.ts +1 -1
- package/client/elements/custom-alert.js +0 -120
- package/helps/components/oops-progress.md +0 -73
@@ -10,7 +10,7 @@ exports.roundTransformer = {
|
|
10
10
|
* @param {number | null} value - Floating point value to round or null
|
11
11
|
* @returns {number | null} - Rounded number or null
|
12
12
|
*/
|
13
|
-
to: (value) => (value !== null && !isNaN(value) ? Math.round(value *
|
13
|
+
to: (value) => (value !== null && !isNaN(value) ? Math.round(value * 10000) / 10000 : undefined),
|
14
14
|
/**
|
15
15
|
* Returns the entity field value as it is without any transformation when reading from the database.
|
16
16
|
* @param {number} value - Number value read from the database
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"round-transform.js","sourceRoot":"","sources":["../../server/typeorm/round-transform.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,gBAAgB,GAAqB;IAChD;;;;OAIG;IACH,EAAE,EAAE,CAAC,KAAoB,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,
|
1
|
+
{"version":3,"file":"round-transform.js","sourceRoot":"","sources":["../../server/typeorm/round-transform.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACU,QAAA,gBAAgB,GAAqB;IAChD;;;;OAIG;IACH,EAAE,EAAE,CAAC,KAAoB,EAAE,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAE/G;;;;OAIG;IACH,IAAI,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK;CAC/B,CAAA","sourcesContent":["import { ValueTransformer } from 'typeorm'\n\n/**\n * ValueTransformer object for rounding floating point values.\n */\nexport const roundTransformer: ValueTransformer = {\n /**\n * Rounds the entity field value before storing it in the database.\n * @param {number | null} value - Floating point value to round or null\n * @returns {number | null} - Rounded number or null\n */\n to: (value: number | null) => (value !== null && !isNaN(value) ? Math.round(value * 10000) / 10000 : undefined),\n\n /**\n * Returns the entity field value as it is without any transformation when reading from the database.\n * @param {number} value - Number value read from the database\n * @returns {number} - The number value as is\n */\n from: (value: number) => value\n}\n"]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@things-factory/shell",
|
3
|
-
"version": "7.0.1-alpha.
|
3
|
+
"version": "7.0.1-alpha.13",
|
4
4
|
"description": "Core module for framework",
|
5
5
|
"bin": {
|
6
6
|
"things-factory": "bin/things-factory",
|
@@ -63,8 +63,8 @@
|
|
63
63
|
"@things-factory/ejs-remote": "^7.0.1-alpha.0",
|
64
64
|
"@things-factory/env": "^7.0.1-alpha.0",
|
65
65
|
"@things-factory/operato-license-checker": "^4.0.4",
|
66
|
-
"@things-factory/styles": "^7.0.1-alpha.
|
67
|
-
"@things-factory/utils": "^7.0.1-alpha.
|
66
|
+
"@things-factory/styles": "^7.0.1-alpha.4",
|
67
|
+
"@things-factory/utils": "^7.0.1-alpha.4",
|
68
68
|
"@webcomponents/webcomponentsjs": "^2.6.0",
|
69
69
|
"args": "^5.0.0",
|
70
70
|
"broadcastchannel-polyfill": "^1.0.1",
|
@@ -97,7 +97,7 @@
|
|
97
97
|
"koa-send": "^5.0.0",
|
98
98
|
"koa-static": "^5.0.0",
|
99
99
|
"koa2-connect-history-api-fallback": "^0.1.2",
|
100
|
-
"lit": "^
|
100
|
+
"lit": "^3.1.2",
|
101
101
|
"loader-utils": "^2.0.0",
|
102
102
|
"lodash": "^4.17.21",
|
103
103
|
"lodash-es": "^4.17.21",
|
@@ -118,7 +118,6 @@
|
|
118
118
|
"reselect": "^4.0.0",
|
119
119
|
"sass": "^1.50.1",
|
120
120
|
"scrollbooster": "^3.0.2",
|
121
|
-
"sweetalert2": "^11.7.3",
|
122
121
|
"type-graphql": "^2.0.0-beta.6",
|
123
122
|
"typeorm": "^0.3.19",
|
124
123
|
"uuid": "^3.4.0",
|
@@ -134,5 +133,5 @@
|
|
134
133
|
"pg": "^8.7.3",
|
135
134
|
"sqlite3": "^5.0.8"
|
136
135
|
},
|
137
|
-
"gitHead": "
|
136
|
+
"gitHead": "58eaf3ce7403c0722fe948041bad0185e57fdc81"
|
138
137
|
}
|
package/server/server-dev.ts
CHANGED
@@ -20,7 +20,6 @@ import { useServer } from 'graphql-ws/lib/use/ws'
|
|
20
20
|
import { createServer } from 'http'
|
21
21
|
import Koa from 'koa'
|
22
22
|
import koaBodyParser from 'koa-bodyparser'
|
23
|
-
import koaStatic from 'koa-static'
|
24
23
|
import compose from 'koa-compose'
|
25
24
|
import { historyApiFallback } from 'koa2-connect-history-api-fallback'
|
26
25
|
import { WebSocketServer } from 'ws'
|
@@ -269,17 +268,11 @@ const bootstrap = async () => {
|
|
269
268
|
app.use(graphqlRouter.routes())
|
270
269
|
app.use(graphqlRouter.allowedMethods())
|
271
270
|
|
272
|
-
/* should follow this order : history-fallback => webpack-middleware
|
271
|
+
/* should follow this order : history-fallback => webpack-middleware */
|
273
272
|
app.use(historyApiFallback({ whiteList: [] }))
|
274
273
|
|
275
274
|
app.use(middleware)
|
276
275
|
|
277
|
-
app.use(
|
278
|
-
koaStatic(compiler.outputPath, {
|
279
|
-
index: false
|
280
|
-
})
|
281
|
-
)
|
282
|
-
|
283
276
|
httpServer.listen({ port: PORT }, () => {
|
284
277
|
logger.info(`π Server ready at http://0.0.0.0:${PORT}/graphql`)
|
285
278
|
logger.info(`π Subscriptions ready at ws://0.0.0.0:${PORT}/graphql`)
|
@@ -9,7 +9,7 @@ export const roundTransformer: ValueTransformer = {
|
|
9
9
|
* @param {number | null} value - Floating point value to round or null
|
10
10
|
* @returns {number | null} - Rounded number or null
|
11
11
|
*/
|
12
|
-
to: (value: number | null) => (value !== null && !isNaN(value) ? Math.round(value *
|
12
|
+
to: (value: number | null) => (value !== null && !isNaN(value) ? Math.round(value * 10000) / 10000 : undefined),
|
13
13
|
|
14
14
|
/**
|
15
15
|
* Returns the entity field value as it is without any transformation when reading from the database.
|
@@ -1,120 +0,0 @@
|
|
1
|
-
import Swal from 'sweetalert2'
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Custom Alert utilized sweetalert2 to produce a simple pop-up message box.
|
5
|
-
* *Side note: Did not fully utilize sweet alert capability, just added some common usage.
|
6
|
-
* @param {string} type - ['success', 'error', 'warning', 'info', 'question']
|
7
|
-
* @param {string} icon - ['success', 'error', 'warning', 'info', 'question']
|
8
|
-
* @param {string} title - Title for the message box.
|
9
|
-
* @param {string} text - Description for the message box. Input can be in html format.
|
10
|
-
* @param {string} footer - Footer message. Input can be in html format
|
11
|
-
* @param {string} [position = 'center'] - Position of the message box. ['top', 'top-start', 'top-end', 'center', 'center-start', 'center-end', 'bottom', 'bottom-start', 'bottom-end']
|
12
|
-
* @param {boolean} toast - Set to 'True' to display as toast.
|
13
|
-
* @param {object} confirmButton - Confirm button is an object type. The text and color of the button can be changed by adding 'text' or 'color' property into the object.
|
14
|
-
* text is the required field of the object. When the object is populated, the confirm button will automatically shown.
|
15
|
-
* @param {object} cancelButton - Cancel button is an object type. The text and color of the button can be changed by adding 'text' or 'color' property into the object.
|
16
|
-
* text is the required field of the object. When the object is populated, the cancel button will automatically shown.
|
17
|
-
* @param {boolean} [invertButton = false] - Invert button to swap the position of the buttons.
|
18
|
-
* eg. Confirm button on the right, Cancel button on the left.
|
19
|
-
* @param {function} callback - Accepts a function with an input parameter. Will invoked after swal.fire. It is a promise chaining function.
|
20
|
-
* @param {function} onBeforeOpen - Accepts a function with no parameter. Function to run when modal built, but not shown yet. Provides modal DOM element as the first argument.
|
21
|
-
* @param {function} onOpen - Accepts a function with no parameter. Function to run when modal opens, provides modal DOM element as the first argument.
|
22
|
-
* @param {function} onRender - Accepts a function with no parameter. Function to run after modal DOM has been updated. eg. After Swal.fire() or Swal.update()
|
23
|
-
* @param {function} onClose - Accepts a function with no parameter. Function to run when modal closes, provides modal DOM element as the first argument.
|
24
|
-
* @param {function} onAfterClose - Accepts a function with no parameter. Function to run after modal has been disposed.
|
25
|
-
* @param {boolean} [debug = false] - Check all parameters are set properly. When set to 'true', simple checking will be done on the input parameters to verify the type.
|
26
|
-
*/
|
27
|
-
|
28
|
-
export async function CustomAlert({
|
29
|
-
type = 'info',
|
30
|
-
icon,
|
31
|
-
title,
|
32
|
-
text,
|
33
|
-
allowOutsideClick = true,
|
34
|
-
allowEscapeKey = true,
|
35
|
-
footer,
|
36
|
-
position = 'center',
|
37
|
-
toast,
|
38
|
-
timer,
|
39
|
-
confirmButton = {},
|
40
|
-
cancelButton = {},
|
41
|
-
invertButton = false,
|
42
|
-
callback,
|
43
|
-
onBeforeOpen,
|
44
|
-
onOpen,
|
45
|
-
onRender,
|
46
|
-
onClose,
|
47
|
-
onAfterClose,
|
48
|
-
debug = false
|
49
|
-
}) {
|
50
|
-
try {
|
51
|
-
if (debug) {
|
52
|
-
let arrTypes = ['success', 'error', 'warning', 'info', 'question']
|
53
|
-
let err = ''
|
54
|
-
if (!arrTypes.includes(type)) {
|
55
|
-
err = err + 'Invalid Alert Type.\n'
|
56
|
-
}
|
57
|
-
|
58
|
-
if (title && typeof title !== 'string') err = err + 'Invalid Title.\n'
|
59
|
-
if (text && typeof text !== 'string') err = err + 'Invalid Text.\n'
|
60
|
-
if (footer && typeof text !== 'string') err = err + 'Invalid Footer.\n'
|
61
|
-
if (typeof position !== 'string') err = err + 'Invalid Position.\n'
|
62
|
-
if (toast && typeof toast !== 'boolean') err = err + 'Invalid Footer.\n'
|
63
|
-
if (
|
64
|
-
Object.keys(confirmButton).length > 0 &&
|
65
|
-
(typeof confirmButton !== 'object' || !confirmButton.hasOwnProperty('text'))
|
66
|
-
)
|
67
|
-
err = err + 'Invalid Confirm Button.\n'
|
68
|
-
if (
|
69
|
-
Object.keys(cancelButton).length > 0 &&
|
70
|
-
(typeof cancelButton !== 'object' || !cancelButton.hasOwnProperty('text'))
|
71
|
-
)
|
72
|
-
err = err + 'Invalid Cancel Button.\n'
|
73
|
-
|
74
|
-
if (err !== '') throw new Error(err)
|
75
|
-
}
|
76
|
-
|
77
|
-
const result = await Swal.fire({
|
78
|
-
icon: icon || type,
|
79
|
-
title: title,
|
80
|
-
text: text,
|
81
|
-
timer: timer ? timer:0,
|
82
|
-
timerProgressBar: timer ? true : 0,
|
83
|
-
allowOutsideClick: allowOutsideClick,
|
84
|
-
allowEscapeKey: allowEscapeKey,
|
85
|
-
footer: footer,
|
86
|
-
position: position,
|
87
|
-
showConfirmButton: Object.keys(confirmButton).length > 0 ? true : false,
|
88
|
-
showCancelButton: Object.keys(cancelButton).length > 0 ? true : false,
|
89
|
-
confirmButtonText: confirmButton.hasOwnProperty('text') ? confirmButton.text : 'confirm',
|
90
|
-
cancelButtonText: cancelButton.hasOwnProperty('text') ? cancelButton.text : 'cancel',
|
91
|
-
confirmButtonColor: confirmButton.hasOwnProperty('color') ? confirmButton.color : '#22a6a7',
|
92
|
-
cancelButtonColor: cancelButton.hasOwnProperty('color') ? cancelButton.color : '#cfcfcf',
|
93
|
-
toast: toast,
|
94
|
-
reverseButtons: invertButton,
|
95
|
-
willOpen: () => {
|
96
|
-
onBeforeOpen ? onBeforeOpen() : undefined
|
97
|
-
},
|
98
|
-
didOpen: () => {
|
99
|
-
onOpen ? onOpen() : undefined
|
100
|
-
},
|
101
|
-
didRender: () => {
|
102
|
-
onRender ? onRender() : undefined
|
103
|
-
},
|
104
|
-
willClose: () => {
|
105
|
-
onClose ? onClose() : undefined
|
106
|
-
},
|
107
|
-
didClose: () => {
|
108
|
-
onAfterClose ? onAfterClose() : undefined
|
109
|
-
}
|
110
|
-
})
|
111
|
-
|
112
|
-
if (callback && typeof callback === 'function') {
|
113
|
-
callback(result)
|
114
|
-
} else {
|
115
|
-
return Promise.resolve(result)
|
116
|
-
}
|
117
|
-
} catch (error) {
|
118
|
-
console.log('%c(Custom-Alert)\n' + error, 'color:Red')
|
119
|
-
}
|
120
|
-
}
|
@@ -1,73 +0,0 @@
|
|
1
|
-
# OOPS Progress μ»΄ν¬λνΈ
|
2
|
-
|
3
|
-
κΈ΄ μκ° μ§νλλ μμ
μ μ§ν μν©μ ννν΄μ£ΌκΈ° μν΄ μλ²μ μ§νμ¨μ Subscribeνλ ν΄λΌμ΄μΈνΈ μ»΄ν¬λνΈμ΄λ€.
|
4
|
-
μ΄ μ»΄ν¬λνΈλ μ체μ μΌλ‘ μκ°μ μμλ₯Ό ν¬ν¨νμ§ μμ§λ§, μκ°μ ννμ μν΄μ μμ λ
Έλ(Light DOM)λ₯Ό ν¬ν¨ν μλ μλ€.
|
5
|
-
|
6
|
-
## properties
|
7
|
-
|
8
|
-
- tag: String μλΈμ€ν¬λ¦½μ
νκ·Έμ΄λ©°, μλ²μ 'publishProgress'μ tagμ μΌμΉμν€λλ‘ νλ€.
|
9
|
-
- subscription: String (readonly) μ΄ μμ±μ΄ κ°μ κ°μ§κ³ μμΌλ©΄, μλΈμ€ν¬λ¦½μ
μ€μμ μλ―Ένλ€.
|
10
|
-
|
11
|
-
## methods
|
12
|
-
|
13
|
-
- startSubscribe() μ§νμ¨ κ΅¬λ
μ μμνλ€.
|
14
|
-
- stopSubscribe() μ§νμ¨ κ΅¬λ
μ μ’
λ£νλ€.(μλ²μͺ½ μμ
μ μ’
λ£λ₯Ό μλ―Ένμ§ μμΌλ©°, ν΄λΌμ΄μΈνΈμμ ꡬλ
μ μ’
λ£νλ€λ μλ―Έμ.)
|
15
|
-
|
16
|
-
## event
|
17
|
-
|
18
|
-
- progress(event) μλ²λ‘λΆν° μ§νμ¨μ΄ Subscribe λμμ λ λ°μνλ€.
|
19
|
-
- event.detail : progress κ°μ κ°λλ€.
|
20
|
-
- finish(event) μ§νμ¨μ΄ 100% λλ¬νλ©΄ λ°μνλ€.
|
21
|
-
|
22
|
-
## μμ
|
23
|
-
|
24
|
-
### ν΄λΌμ΄μΈνΈ μ¬μ΄λ
|
25
|
-
|
26
|
-
```
|
27
|
-
<oops-progress
|
28
|
-
.tag='progress-pending-job'
|
29
|
-
@progress=${e => {
|
30
|
-
this.progress = e.detail
|
31
|
-
}}
|
32
|
-
@finish=${() => {
|
33
|
-
console.log('complete')
|
34
|
-
}}
|
35
|
-
?hidden=${progress < 0 || progress > 100}
|
36
|
-
>
|
37
|
-
<div>
|
38
|
-
<mwc-linear-progress .progress=${progress / 100}></mwc-linear-progress>
|
39
|
-
<span>Progress : ${progress} % (${message})</span>
|
40
|
-
</div>
|
41
|
-
</oops-progress>
|
42
|
-
|
43
|
-
```
|
44
|
-
|
45
|
-
### μλ²μ¬μ΄λ
|
46
|
-
|
47
|
-
```
|
48
|
-
import { sleep } from '@things-factory/utils'
|
49
|
-
|
50
|
-
...
|
51
|
-
|
52
|
-
@Mutation(returns => String, { description: 'To reference of pending job progress' })
|
53
|
-
async referencePendingJob(
|
54
|
-
@Root() _,
|
55
|
-
@Ctx() context: any
|
56
|
-
) : Promise<string> {
|
57
|
-
|
58
|
-
const { domain } = context.state
|
59
|
-
|
60
|
-
for(var i = 0;i <= 100;i++) {
|
61
|
-
await sleep(100)
|
62
|
-
|
63
|
-
publishProgress({
|
64
|
-
domain,
|
65
|
-
tag: 'progress-pending-job',
|
66
|
-
progress: i,
|
67
|
-
message: `${i * 10} / 1000`
|
68
|
-
})
|
69
|
-
}
|
70
|
-
|
71
|
-
return 'success'
|
72
|
-
}
|
73
|
-
```
|