authscape 1.0.77 → 1.0.82
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 +226 -27
- package/package.json +40 -48
- package/src/components/dataTable.js +118 -0
- package/src/components/pageEditorComponent.js +0 -25
package/index.js
CHANGED
|
@@ -5,52 +5,251 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports["default"] =
|
|
8
|
+
exports["default"] = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _reactDataTableComponent = _interopRequireWildcard(require("react-data-table-component"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
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); }
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
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; }
|
|
17
17
|
|
|
18
|
-
var _pluginsSpacer = _interopRequireDefault(require("@react-page/plugins-spacer"));
|
|
18
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
21
21
|
|
|
22
|
-
function
|
|
22
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
23
23
|
|
|
24
|
-
function
|
|
24
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
25
|
|
|
26
|
-
function
|
|
26
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
27
27
|
|
|
28
|
-
function
|
|
28
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
29
29
|
|
|
30
|
-
function
|
|
30
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
31
31
|
|
|
32
|
-
function
|
|
32
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
33
|
|
|
34
|
-
function
|
|
34
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
35
35
|
|
|
36
|
-
function
|
|
36
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
37
37
|
|
|
38
|
-
function
|
|
38
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
|
+
|
|
40
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
41
|
|
|
40
|
-
function
|
|
41
|
-
var cellPlugins = [(0, _pluginsSlate["default"])(), _pluginsSpacer["default"], _pluginsDivider["default"]];
|
|
42
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
45
|
-
value = _useState2[0],
|
|
46
|
-
setValue = _useState2[1];
|
|
44
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
var Datatable = /*#__PURE__*/function (_Component) {
|
|
47
|
+
_inherits(Datatable, _Component);
|
|
48
|
+
|
|
49
|
+
var _super = _createSuper(Datatable);
|
|
50
|
+
|
|
51
|
+
function Datatable(props) {
|
|
52
|
+
var _this;
|
|
53
|
+
|
|
54
|
+
_classCallCheck(this, Datatable);
|
|
55
|
+
|
|
56
|
+
_this = _super.call(this, props);
|
|
57
|
+
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "componentDidMount", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
59
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
60
|
+
while (1) {
|
|
61
|
+
switch (_context.prev = _context.next) {
|
|
62
|
+
case 0:
|
|
63
|
+
_context.next = 2;
|
|
64
|
+
return _this.GetDataFromUrl(_this.state.pageNumber, _this.state.pageLength, _this.props.params);
|
|
65
|
+
|
|
66
|
+
case 2:
|
|
67
|
+
(0, _reactDataTableComponent.createTheme)('dataTable', {
|
|
68
|
+
text: {}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
case 3:
|
|
72
|
+
case "end":
|
|
73
|
+
return _context.stop();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, _callee);
|
|
77
|
+
})));
|
|
78
|
+
|
|
79
|
+
_defineProperty(_assertThisInitialized(_this), "reload", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
80
|
+
var reset,
|
|
81
|
+
_args3 = arguments;
|
|
82
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
83
|
+
while (1) {
|
|
84
|
+
switch (_context3.prev = _context3.next) {
|
|
85
|
+
case 0:
|
|
86
|
+
reset = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
|
|
87
|
+
|
|
88
|
+
if (!(reset === true)) {
|
|
89
|
+
_context3.next = 5;
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
_this.setState({
|
|
94
|
+
pageNumber: 1
|
|
95
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
96
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
97
|
+
while (1) {
|
|
98
|
+
switch (_context2.prev = _context2.next) {
|
|
99
|
+
case 0:
|
|
100
|
+
_context2.next = 2;
|
|
101
|
+
return _this.GetDataFromUrl(_this.state.pageNumber, _this.state.pageLength, _this.props.params);
|
|
102
|
+
|
|
103
|
+
case 2:
|
|
104
|
+
case "end":
|
|
105
|
+
return _context2.stop();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, _callee2);
|
|
109
|
+
})));
|
|
110
|
+
|
|
111
|
+
_context3.next = 7;
|
|
112
|
+
break;
|
|
113
|
+
|
|
114
|
+
case 5:
|
|
115
|
+
_context3.next = 7;
|
|
116
|
+
return _this.GetDataFromUrl(_this.state.pageNumber, _this.state.pageLength, _this.props.params);
|
|
117
|
+
|
|
118
|
+
case 7:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context3.stop();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}, _callee3);
|
|
124
|
+
})));
|
|
125
|
+
|
|
126
|
+
_defineProperty(_assertThisInitialized(_this), "GetDataFromUrl", function (page, length) {
|
|
127
|
+
var postData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
128
|
+
|
|
129
|
+
_this.setState({
|
|
130
|
+
loading: true
|
|
131
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
132
|
+
var data, response;
|
|
133
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
134
|
+
while (1) {
|
|
135
|
+
switch (_context4.prev = _context4.next) {
|
|
136
|
+
case 0:
|
|
137
|
+
data = postData;
|
|
138
|
+
data.offset = page;
|
|
139
|
+
data.length = length;
|
|
140
|
+
response = null;
|
|
141
|
+
|
|
142
|
+
if (!(this.props.methodType == "get")) {
|
|
143
|
+
_context4.next = 10;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
_context4.next = 7;
|
|
148
|
+
return apiService().get(this.props.url);
|
|
149
|
+
|
|
150
|
+
case 7:
|
|
151
|
+
response = _context4.sent;
|
|
152
|
+
_context4.next = 13;
|
|
153
|
+
break;
|
|
154
|
+
|
|
155
|
+
case 10:
|
|
156
|
+
_context4.next = 12;
|
|
157
|
+
return apiService().post(this.props.url, postData);
|
|
158
|
+
|
|
159
|
+
case 12:
|
|
160
|
+
response = _context4.sent;
|
|
161
|
+
|
|
162
|
+
case 13:
|
|
163
|
+
if (response != null && response.status === 200) {
|
|
164
|
+
if (this.props.returnResult != null) {
|
|
165
|
+
this.props.returnResult(response.data.data);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
this.setState({
|
|
169
|
+
totalRows: response.data.recordsTotal,
|
|
170
|
+
data: response.data.data,
|
|
171
|
+
loading: false
|
|
172
|
+
});
|
|
173
|
+
} else {//console.error(response.status + " - " + response.data);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
case 14:
|
|
177
|
+
case "end":
|
|
178
|
+
return _context4.stop();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}, _callee4, this);
|
|
182
|
+
})));
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
_defineProperty(_assertThisInitialized(_this), "handlePageChange", /*#__PURE__*/function () {
|
|
186
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(page) {
|
|
187
|
+
var pageLength;
|
|
188
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
189
|
+
while (1) {
|
|
190
|
+
switch (_context5.prev = _context5.next) {
|
|
191
|
+
case 0:
|
|
192
|
+
pageLength = _this.state.pageLength;
|
|
193
|
+
|
|
194
|
+
_this.setState({
|
|
195
|
+
pageNumber: page
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
_context5.next = 4;
|
|
199
|
+
return _this.GetDataFromUrl(page, pageLength, _this.props.params);
|
|
200
|
+
|
|
201
|
+
case 4:
|
|
202
|
+
case "end":
|
|
203
|
+
return _context5.stop();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}, _callee5);
|
|
207
|
+
}));
|
|
208
|
+
|
|
209
|
+
return function (_x) {
|
|
210
|
+
return _ref5.apply(this, arguments);
|
|
211
|
+
};
|
|
212
|
+
}());
|
|
213
|
+
|
|
214
|
+
_this.state = {
|
|
215
|
+
pageNumber: 1,
|
|
216
|
+
pageLength: props.pageLength ? props.pageLength : 10,
|
|
217
|
+
data: [],
|
|
218
|
+
loading: false,
|
|
219
|
+
totalRows: 0
|
|
220
|
+
};
|
|
221
|
+
return _this;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
_createClass(Datatable, [{
|
|
225
|
+
key: "render",
|
|
226
|
+
value: function render() {
|
|
227
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_reactDataTableComponent["default"], {
|
|
228
|
+
title: this.props.title,
|
|
229
|
+
columns: this.props.columns,
|
|
230
|
+
data: this.state.data,
|
|
231
|
+
paginationRowsPerPageOptions: this.props.pageLength ? [this.props.pageLength] : [10],
|
|
232
|
+
progressPending: this.state.loading,
|
|
233
|
+
customStyles: this.props.customStyles,
|
|
234
|
+
paginationPerPage: this.props.pageLength ? this.props.pageLength : 10,
|
|
235
|
+
paginationServer: true,
|
|
236
|
+
pagination: true,
|
|
237
|
+
paginationTotalRows: this.state.totalRows // onChangeRowsPerPage={this.handlePerRowsChange}
|
|
238
|
+
,
|
|
239
|
+
onChangePage: this.handlePageChange,
|
|
240
|
+
noDataComponent: this.props.noDataComponent
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
}]);
|
|
244
|
+
|
|
245
|
+
return Datatable;
|
|
246
|
+
}(_react.Component);
|
|
247
|
+
|
|
248
|
+
exports["default"] = Datatable;
|
|
249
|
+
|
|
250
|
+
_defineProperty(Datatable, "defaultProps", {
|
|
251
|
+
options: {}
|
|
252
|
+
});
|
|
54
253
|
"use strict";
|
|
55
254
|
|
|
56
255
|
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); }
|
package/package.json
CHANGED
|
@@ -1,48 +1,40 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "authscape",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
-
"build": "./node_modules/.bin/babel src --out-file index.js"
|
|
9
|
-
},
|
|
10
|
-
"author": "zuechb",
|
|
11
|
-
"license": "ISC",
|
|
12
|
-
"peerDependencies": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"js-file-download": "^0.4.12",
|
|
42
|
-
"next": "^12.2.0",
|
|
43
|
-
"next-cookies": "^2.0.3",
|
|
44
|
-
"nookies": "^2.5.2",
|
|
45
|
-
"preact": "^10.9.0",
|
|
46
|
-
"querystring": "^0.2.1"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "authscape",
|
|
3
|
+
"version": "1.0.82",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
+
"build": "./node_modules/.bin/babel src --out-file index.js"
|
|
9
|
+
},
|
|
10
|
+
"author": "zuechb",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"axios": "^0.27.2",
|
|
14
|
+
"js-file-download": "^0.4.12",
|
|
15
|
+
"next": "^12.2.0",
|
|
16
|
+
"next-cookies": "^2.0.3",
|
|
17
|
+
"nookies": "^2.5.2",
|
|
18
|
+
"querystring": "^0.2.1",
|
|
19
|
+
"react": "^18.2.0",
|
|
20
|
+
"react-dom": "^18.2.0",
|
|
21
|
+
"react-data-table-component": "^7.5.2"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@babel/cli": "^7.1.5",
|
|
25
|
+
"@babel/core": "^7.1.6",
|
|
26
|
+
"@babel/preset-env": "^7.1.6",
|
|
27
|
+
"@babel/preset-react": "^7.0.0",
|
|
28
|
+
"react": "^18.2.0",
|
|
29
|
+
"react-dom": "^18.2.0"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"axios": "^0.27.2",
|
|
33
|
+
"js-file-download": "^0.4.12",
|
|
34
|
+
"next": "^12.2.0",
|
|
35
|
+
"next-cookies": "^2.0.3",
|
|
36
|
+
"nookies": "^2.5.2",
|
|
37
|
+
"querystring": "^0.2.1",
|
|
38
|
+
"react-data-table-component": "^7.5.2"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
//import {apiService} from 'authscape';
|
|
3
|
+
import DataTable, {createTheme} from "react-data-table-component";
|
|
4
|
+
|
|
5
|
+
export default class Datatable extends Component {
|
|
6
|
+
|
|
7
|
+
static defaultProps = {
|
|
8
|
+
options: {}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
|
|
14
|
+
this.state = {
|
|
15
|
+
pageNumber : 1,
|
|
16
|
+
pageLength : props.pageLength ? props.pageLength : 10,
|
|
17
|
+
data: [],
|
|
18
|
+
loading: false,
|
|
19
|
+
totalRows: 0
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
componentDidMount = async () => {
|
|
24
|
+
await this.GetDataFromUrl(this.state.pageNumber, this.state.pageLength, this.props.params);
|
|
25
|
+
createTheme('dataTable', {
|
|
26
|
+
text:{
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
reload = async (reset = false) => {
|
|
33
|
+
|
|
34
|
+
if (reset === true)
|
|
35
|
+
{
|
|
36
|
+
this.setState({pageNumber: 1}, async () => {
|
|
37
|
+
await this.GetDataFromUrl(this.state.pageNumber, this.state.pageLength, this.props.params);
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
else
|
|
41
|
+
{
|
|
42
|
+
await this.GetDataFromUrl(this.state.pageNumber, this.state.pageLength, this.props.params);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
GetDataFromUrl = (page, length, postData = {}) => {
|
|
49
|
+
|
|
50
|
+
this.setState({
|
|
51
|
+
loading: true
|
|
52
|
+
}, async function () {
|
|
53
|
+
|
|
54
|
+
let data = postData;
|
|
55
|
+
|
|
56
|
+
data.offset = page;
|
|
57
|
+
data.length = length;
|
|
58
|
+
|
|
59
|
+
let response = null;
|
|
60
|
+
if (this.props.methodType == "get")
|
|
61
|
+
{
|
|
62
|
+
response = await apiService().get(this.props.url);
|
|
63
|
+
}
|
|
64
|
+
else
|
|
65
|
+
{
|
|
66
|
+
response = await apiService().post(this.props.url, postData);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (response != null && response.status === 200)
|
|
70
|
+
{
|
|
71
|
+
if (this.props.returnResult != null)
|
|
72
|
+
{
|
|
73
|
+
this.props.returnResult(response.data.data);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
this.setState({
|
|
77
|
+
totalRows: response.data.recordsTotal,
|
|
78
|
+
data: response.data.data,
|
|
79
|
+
loading: false
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else
|
|
83
|
+
{
|
|
84
|
+
//console.error(response.status + " - " + response.data);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
handlePageChange = async page => {
|
|
92
|
+
const { pageLength } = this.state;
|
|
93
|
+
this.setState({pageNumber: page});
|
|
94
|
+
await this.GetDataFromUrl(page, pageLength, this.props.params);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
render() {
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div>
|
|
101
|
+
<DataTable
|
|
102
|
+
title={this.props.title}
|
|
103
|
+
columns={this.props.columns}
|
|
104
|
+
data={this.state.data}
|
|
105
|
+
paginationRowsPerPageOptions={this.props.pageLength ? [this.props.pageLength] : [10]}
|
|
106
|
+
progressPending={this.state.loading}
|
|
107
|
+
customStyles={this.props.customStyles}
|
|
108
|
+
paginationPerPage={this.props.pageLength ? this.props.pageLength : 10}
|
|
109
|
+
paginationServer
|
|
110
|
+
pagination
|
|
111
|
+
paginationTotalRows={this.state.totalRows}
|
|
112
|
+
// onChangeRowsPerPage={this.handlePerRowsChange}
|
|
113
|
+
onChangePage={this.handlePageChange}
|
|
114
|
+
noDataComponent={this.props.noDataComponent}
|
|
115
|
+
/>
|
|
116
|
+
</div>);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import Container from '@mui/material/Container'
|
|
3
|
-
|
|
4
|
-
// The editor core
|
|
5
|
-
//import { EditorVal } from '@react-page/editor';
|
|
6
|
-
import Editor from '@react-page/editor';
|
|
7
|
-
|
|
8
|
-
// The rich text area plugin
|
|
9
|
-
import slate from '@react-page/plugins-slate';
|
|
10
|
-
import spacer from '@react-page/plugins-spacer';
|
|
11
|
-
import divider from '@react-page/plugins-divider';
|
|
12
|
-
|
|
13
|
-
export default function pageEditorComponent() {
|
|
14
|
-
|
|
15
|
-
const cellPlugins = [slate(), spacer, divider];
|
|
16
|
-
|
|
17
|
-
const [value, setValue] = useState(null);
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<Container>
|
|
21
|
-
<Editor cellPlugins={cellPlugins} value={value} onChange={setValue} />
|
|
22
|
-
</Container>
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
}
|