authscape 1.0.192 → 1.0.194
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/index.js +108 -0
- package/package.json +2 -1
- package/src/components/AuthScapeApp.js +9 -1
- package/src/components/ColorPicker.js +82 -0
package/index.js
CHANGED
|
@@ -56,6 +56,13 @@ function AuthScapeApp(_ref) {
|
|
|
56
56
|
if (router.query.r != null) {
|
|
57
57
|
localStorage.setItem("ref", router.query.r);
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
// ORM module
|
|
61
|
+
// if (process.env.enableOEMClient)
|
|
62
|
+
// {
|
|
63
|
+
// var baseURL = window.location.protocol + "//" + window.location.host;
|
|
64
|
+
// apiService().get("/oem/")
|
|
65
|
+
// }
|
|
59
66
|
}
|
|
60
67
|
}, [loadedUser]);
|
|
61
68
|
(0, _react.useEffect)(function () {
|
|
@@ -101,6 +108,107 @@ function AuthScapeApp(_ref) {
|
|
|
101
108
|
}
|
|
102
109
|
"use strict";
|
|
103
110
|
|
|
111
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
112
|
+
Object.defineProperty(exports, "__esModule", {
|
|
113
|
+
value: true
|
|
114
|
+
});
|
|
115
|
+
exports.ColorPicker = ColorPicker;
|
|
116
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
117
|
+
var _reactColor = require("react-color");
|
|
118
|
+
var _reactcss = _interopRequireDefault(require("reactcss"));
|
|
119
|
+
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
120
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
121
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
122
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
123
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
124
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
125
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
126
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
127
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
128
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
129
|
+
function ColorPicker(_ref) {
|
|
130
|
+
var name = _ref.name,
|
|
131
|
+
defaultColor = _ref.defaultColor,
|
|
132
|
+
onColorChanged = _ref.onColorChanged;
|
|
133
|
+
var _useState = (0, _react.useState)(defaultColor != null ? defaultColor : "#ffffff"),
|
|
134
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
135
|
+
rgbColor = _useState2[0],
|
|
136
|
+
setColor = _useState2[1];
|
|
137
|
+
var _useState3 = (0, _react.useState)(false),
|
|
138
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
139
|
+
displayColorPicker = _useState4[0],
|
|
140
|
+
setDisplayColorPicker = _useState4[1];
|
|
141
|
+
var _useState5 = (0, _react.useState)(null),
|
|
142
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
143
|
+
selectedColor = _useState6[0],
|
|
144
|
+
setSelectedColor = _useState6[1];
|
|
145
|
+
var _useState7 = (0, _react.useState)(null),
|
|
146
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
147
|
+
timeoutToken = _useState8[0],
|
|
148
|
+
setTimeoutToken = _useState8[1];
|
|
149
|
+
var styles = (0, _reactcss["default"])({
|
|
150
|
+
'default': {
|
|
151
|
+
color: {
|
|
152
|
+
width: '36px',
|
|
153
|
+
height: '14px',
|
|
154
|
+
borderRadius: '2px',
|
|
155
|
+
background: rgbColor
|
|
156
|
+
},
|
|
157
|
+
swatch: {
|
|
158
|
+
padding: '5px',
|
|
159
|
+
background: '#fff',
|
|
160
|
+
borderRadius: '1px',
|
|
161
|
+
boxShadow: '0 0 0 1px rgba(0,0,0,.1)',
|
|
162
|
+
display: 'inline-block',
|
|
163
|
+
cursor: 'pointer'
|
|
164
|
+
},
|
|
165
|
+
popover: {
|
|
166
|
+
position: 'absolute',
|
|
167
|
+
zIndex: '2'
|
|
168
|
+
},
|
|
169
|
+
cover: {
|
|
170
|
+
position: 'fixed',
|
|
171
|
+
top: '0px',
|
|
172
|
+
right: '0px',
|
|
173
|
+
bottom: '0px',
|
|
174
|
+
left: '0px'
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
(0, _react.useEffect)(function () {
|
|
179
|
+
if (!displayColorPicker && selectedColor != null) {
|
|
180
|
+
clearTimeout(timeoutToken);
|
|
181
|
+
setTimeoutToken(setTimeout(function () {
|
|
182
|
+
onColorChanged(name, selectedColor);
|
|
183
|
+
}, 500));
|
|
184
|
+
}
|
|
185
|
+
}, [displayColorPicker, selectedColor]);
|
|
186
|
+
return /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
187
|
+
style: styles.swatch,
|
|
188
|
+
onClick: function onClick() {
|
|
189
|
+
setDisplayColorPicker(!displayColorPicker);
|
|
190
|
+
}
|
|
191
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
192
|
+
style: styles.color
|
|
193
|
+
})), displayColorPicker ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
194
|
+
style: styles.popover
|
|
195
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
196
|
+
style: styles.cover,
|
|
197
|
+
onClick: function onClick() {
|
|
198
|
+
setDisplayColorPicker(false);
|
|
199
|
+
}
|
|
200
|
+
}), /*#__PURE__*/_react["default"].createElement(_reactColor.SketchPicker, {
|
|
201
|
+
color: rgbColor,
|
|
202
|
+
onChange: function onChange(color) {
|
|
203
|
+
setColor(color.hex);
|
|
204
|
+
},
|
|
205
|
+
onChangeComplete: function onChangeComplete(color) {
|
|
206
|
+
setSelectedColor(color.hex);
|
|
207
|
+
}
|
|
208
|
+
})) : null);
|
|
209
|
+
}
|
|
210
|
+
"use strict";
|
|
211
|
+
|
|
104
212
|
Object.defineProperty(exports, "__esModule", {
|
|
105
213
|
value: true
|
|
106
214
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authscape",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.194",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"next": "^13.3.2",
|
|
40
40
|
"nookies": "^2.5.2",
|
|
41
41
|
"query-string": "^7.1.1",
|
|
42
|
+
"react-color": "^2.19.3",
|
|
42
43
|
"react-cool-onclickoutside": "^1.7.0",
|
|
43
44
|
"react-data-table-component": "^7.5.2",
|
|
44
45
|
"react-hook-form": "^7.44.2",
|
|
@@ -26,7 +26,15 @@ export function AuthScapeApp({Component, pageProps, muiTheme = {}, onAuthenticat
|
|
|
26
26
|
if (router.query.r != null)
|
|
27
27
|
{
|
|
28
28
|
localStorage.setItem("ref", router.query.r);
|
|
29
|
-
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// ORM module
|
|
32
|
+
// if (process.env.enableOEMClient)
|
|
33
|
+
// {
|
|
34
|
+
// var baseURL = window.location.protocol + "//" + window.location.host;
|
|
35
|
+
// apiService().get("/oem/")
|
|
36
|
+
// }
|
|
37
|
+
|
|
30
38
|
}
|
|
31
39
|
}, [loadedUser]);
|
|
32
40
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { SketchPicker } from 'react-color';
|
|
3
|
+
import reactCSS from 'reactcss';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
|
|
6
|
+
export function ColorPicker({name, defaultColor, onColorChanged}) {
|
|
7
|
+
|
|
8
|
+
const [rgbColor, setColor] = useState(defaultColor != null ? defaultColor : "#ffffff");
|
|
9
|
+
|
|
10
|
+
const [displayColorPicker, setDisplayColorPicker] = useState(false);
|
|
11
|
+
const [selectedColor, setSelectedColor] = useState(null);
|
|
12
|
+
const [timeoutToken, setTimeoutToken] = useState(null);
|
|
13
|
+
|
|
14
|
+
const styles = reactCSS({
|
|
15
|
+
'default': {
|
|
16
|
+
color: {
|
|
17
|
+
width: '36px',
|
|
18
|
+
height: '14px',
|
|
19
|
+
borderRadius: '2px',
|
|
20
|
+
background: rgbColor,
|
|
21
|
+
},
|
|
22
|
+
swatch: {
|
|
23
|
+
padding: '5px',
|
|
24
|
+
background: '#fff',
|
|
25
|
+
borderRadius: '1px',
|
|
26
|
+
boxShadow: '0 0 0 1px rgba(0,0,0,.1)',
|
|
27
|
+
display: 'inline-block',
|
|
28
|
+
cursor: 'pointer',
|
|
29
|
+
},
|
|
30
|
+
popover: {
|
|
31
|
+
position: 'absolute',
|
|
32
|
+
zIndex: '2',
|
|
33
|
+
},
|
|
34
|
+
cover: {
|
|
35
|
+
position: 'fixed',
|
|
36
|
+
top: '0px',
|
|
37
|
+
right: '0px',
|
|
38
|
+
bottom: '0px',
|
|
39
|
+
left: '0px',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
|
|
46
|
+
if (!displayColorPicker && selectedColor != null)
|
|
47
|
+
{
|
|
48
|
+
clearTimeout(timeoutToken);
|
|
49
|
+
setTimeoutToken(setTimeout(() => {
|
|
50
|
+
|
|
51
|
+
onColorChanged(name, selectedColor);
|
|
52
|
+
|
|
53
|
+
}, 500));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
}, [displayColorPicker, selectedColor]);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Box>
|
|
60
|
+
<div style={ styles.swatch } onClick={() => {
|
|
61
|
+
setDisplayColorPicker(!displayColorPicker);
|
|
62
|
+
}}>
|
|
63
|
+
<div style={ styles.color } />
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
{ displayColorPicker ? <div style={ styles.popover }>
|
|
67
|
+
<div style={ styles.cover } onClick={() => {
|
|
68
|
+
setDisplayColorPicker(false);
|
|
69
|
+
}}/>
|
|
70
|
+
<SketchPicker color={ rgbColor } onChange={(color) => {
|
|
71
|
+
|
|
72
|
+
setColor(color.hex);
|
|
73
|
+
|
|
74
|
+
}} onChangeComplete={(color) => {
|
|
75
|
+
|
|
76
|
+
setSelectedColor(color.hex);
|
|
77
|
+
|
|
78
|
+
}} />
|
|
79
|
+
</div> : null }
|
|
80
|
+
</Box>
|
|
81
|
+
);
|
|
82
|
+
}
|