x25 17.3.24 → 17.3.26

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.
@@ -0,0 +1,13 @@
1
+ declare type PropTypes = {
2
+ readonly children: any;
3
+ };
4
+ export declare type CreateGenericOptions = {
5
+ url: string;
6
+ normalizeResult: (response: any) => any;
7
+ reducerName: string;
8
+ };
9
+ export declare type LoadGenericDataOptions = CreateGenericOptions & {
10
+ selectors: any;
11
+ };
12
+ declare const createLoadGenericData: ({ reducerName, url, selectors, normalizeResult }: LoadGenericDataOptions) => (props: PropTypes) => any;
13
+ export default createLoadGenericData;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ var react_1 = __importDefault(require("react"));
43
+ var react_redux_1 = require("react-redux");
44
+ var toolkit_1 = require("@reduxjs/toolkit");
45
+ var superagent_1 = __importDefault(require("superagent"));
46
+ var utility_1 = require("../utility");
47
+ var Messages_1 = require("../Messages");
48
+ var createLoadGenericData = function (_a) {
49
+ var reducerName = _a.reducerName, url = _a.url, selectors = _a.selectors, normalizeResult = _a.normalizeResult;
50
+ var createAction = (0, toolkit_1.createAsyncThunk)(reducerName, function () { return __awaiter(void 0, void 0, void 0, function () {
51
+ var response;
52
+ return __generator(this, function (_a) {
53
+ switch (_a.label) {
54
+ case 0: return [4 /*yield*/, superagent_1.default.
55
+ get(url).
56
+ type("json")];
57
+ case 1:
58
+ response = _a.sent();
59
+ return [2 /*return*/, normalizeResult(response)];
60
+ }
61
+ });
62
+ }); }), Worker = function (props) {
63
+ var children = props.children, shouldFetch = (0, react_redux_1.useSelector)(selectors.shouldFetch), isFetching = (0, react_redux_1.useSelector)(selectors.isFetching), hasError = (0, react_redux_1.useSelector)(selectors.hasError), dispatch = (0, react_redux_1.useDispatch)(), performFetch = function () {
64
+ dispatch(createAction());
65
+ };
66
+ react_1.default.useEffect(function () {
67
+ if (shouldFetch) {
68
+ performFetch();
69
+ }
70
+ }, [shouldFetch, hasError, isFetching]);
71
+ if (hasError) {
72
+ return react_1.default.createElement(Messages_1.LargeErrorMessage, { message: utility_1.words.ThereWasAProblem, onRetry: performFetch });
73
+ }
74
+ if (isFetching) {
75
+ return react_1.default.createElement(Messages_1.LoadingMessage, { message: utility_1.words.LoadingData });
76
+ }
77
+ return children;
78
+ };
79
+ return Worker;
80
+ };
81
+ exports.default = createLoadGenericData;
82
+ //# sourceMappingURL=CreateLoad.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CreateLoad.js","sourceRoot":"","sources":["../../src/Loader/CreateLoad.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAM1B,2CAAuD;AACvD,4CAAoD;AACpD,0DAAoC;AACpC,sCAAmC;AACnC,wCAAgE;AAYhE,IACE,qBAAqB,GAAG,UAAC,EAAwE;QAAtE,WAAW,iBAAA,EAAE,GAAG,SAAA,EAAE,SAAS,eAAA,EAAE,eAAe,qBAAA;IACrE,IACE,YAAY,GAAG,IAAA,0BAAgB,EAAC,WAAW,EAAE;;;;wBAE9B,qBAAM,oBAAU;wBACzB,GAAG,CAAC,GAAG,CAAC;wBACR,IAAI,CAAC,MAAM,CAAC,EAAA;;oBAFd,QAAQ,GAAG,SAEG;oBAEhB,sBAAO,eAAe,CAAC,QAAQ,CAAC,EAAC;;;SAClC,CACO,EACR,MAAM,GAAG,UAAC,KAAgB;QAEpB,IAAA,QAAQ,GAAK,KAAK,SAAV,EACV,WAAW,GAAG,IAAA,yBAAW,EAAC,SAAS,CAAC,WAAW,CAAC,EAChD,UAAU,GAAG,IAAA,yBAAW,EAAC,SAAS,CAAC,UAAU,CAAC,EAC9C,QAAQ,GAAG,IAAA,yBAAW,EAAC,SAAS,CAAC,QAAQ,CAAC,EAE1C,QAAQ,GAAG,IAAA,yBAAW,GAAE,EACxB,YAAY,GAAG;YACb,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;QAC3B,CAAC,CAAC;QAEJ,eAAK,CAAC,SAAS,CAAC;YACd,IAAI,WAAW,EAAE;gBACf,YAAY,EAAE,CAAC;aAChB;QACH,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;QAExC,IAAI,QAAQ,EAAE;YACZ,OAAO,8BAAC,4BAAiB,IAAC,OAAO,EAAE,eAAK,CAAC,gBAAgB,EAAE,OAAO,EAAE,YAAY,GAAI,CAAC;SACtF;QAED,IAAI,UAAU,EAAE;YACd,OAAO,8BAAC,yBAAc,IAAC,OAAO,EAAE,eAAK,CAAC,WAAW,GAAI,CAAC;SACvD;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEJ,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEJ,kBAAe,qBAAqB,CAAC"}
@@ -0,0 +1,476 @@
1
+ import Immutable from "immutable";
2
+ import { CreateGenericOptions as LoaderOptions } from "./CreateLoad";
3
+ declare type State = Immutable.Map<string, any>;
4
+ export declare const statusReducer = "status", initialState: Immutable.Map<string, Immutable.Map<string, string | boolean>>, pending: (state: State) => State, rejected: (state: State) => State, fulfilled: (state: State, { payload }: any) => State, createGenericLoader: ({ reducerName, url, normalizeResult }: LoaderOptions) => {
5
+ stateSelectors: {
6
+ shouldFetch: ((state: {
7
+ readonly size: number;
8
+ set: (key: string, value: any) => State;
9
+ delete: (key: string) => State;
10
+ remove: (key: string) => State;
11
+ deleteAll: (keys: Iterable<string>) => State;
12
+ removeAll: (keys: Iterable<string>) => State;
13
+ clear: () => State;
14
+ update: {
15
+ (key: string, notSetValue: any, updater: (value: any) => any): State;
16
+ (key: string, updater: (value: any) => any): State;
17
+ <R>(updater: (value: State) => R): R;
18
+ };
19
+ merge: {
20
+ <KC, VC>(...collections: Iterable<[KC, VC]>[]): Immutable.Map<string | KC, any>;
21
+ <C>(...collections: {
22
+ [key: string]: C;
23
+ }[]): Immutable.Map<string, any>;
24
+ };
25
+ concat: {
26
+ <KC_1, VC_1>(...collections: Iterable<[KC_1, VC_1]>[]): Immutable.Map<string | KC_1, any>;
27
+ <C_1>(...collections: {
28
+ [key: string]: C_1;
29
+ }[]): Immutable.Map<string, any>;
30
+ };
31
+ mergeWith: (merger: (oldVal: any, newVal: any, key: string) => any, ...collections: (Iterable<[string, any]> | {
32
+ [key: string]: any;
33
+ })[]) => State;
34
+ mergeDeep: (...collections: (Iterable<[string, any]> | {
35
+ [key: string]: any;
36
+ })[]) => State;
37
+ mergeDeepWith: (merger: (oldVal: unknown, newVal: unknown, key: unknown) => unknown, ...collections: (Iterable<[string, any]> | {
38
+ [key: string]: any;
39
+ })[]) => State;
40
+ setIn: (keyPath: Iterable<unknown>, value: unknown) => State;
41
+ deleteIn: (keyPath: Iterable<unknown>) => State;
42
+ removeIn: (keyPath: Iterable<unknown>) => State;
43
+ updateIn: {
44
+ (keyPath: Iterable<unknown>, notSetValue: unknown, updater: (value: unknown) => unknown): State;
45
+ (keyPath: Iterable<unknown>, updater: (value: unknown) => unknown): State;
46
+ };
47
+ mergeIn: (keyPath: Iterable<unknown>, ...collections: unknown[]) => State;
48
+ mergeDeepIn: (keyPath: Iterable<unknown>, ...collections: unknown[]) => State;
49
+ withMutations: (mutator: (mutable: State) => unknown) => State;
50
+ asMutable: () => State;
51
+ wasAltered: () => boolean;
52
+ asImmutable: () => State;
53
+ map: <M>(mapper: (value: any, key: string, iter: State) => M, context?: unknown) => Immutable.Map<string, M>;
54
+ mapKeys: <M_1>(mapper: (key: string, value: any, iter: State) => M_1, context?: unknown) => Immutable.Map<M_1, any>;
55
+ mapEntries: <KM, VM>(mapper: (entry: [string, any], index: number, iter: State) => [KM, VM] | undefined, context?: unknown) => Immutable.Map<KM, VM>;
56
+ flatMap: <KM_1, VM_1>(mapper: (value: any, key: string, iter: State) => Iterable<[KM_1, VM_1]>, context?: unknown) => Immutable.Map<KM_1, VM_1>;
57
+ filter: {
58
+ <F extends any>(predicate: (value: any, key: string, iter: State) => value is F, context?: unknown): Immutable.Map<string, F>;
59
+ (predicate: (value: any, key: string, iter: State) => unknown, context?: unknown): State;
60
+ };
61
+ flip: () => Immutable.Map<any, string>;
62
+ toJS: () => {
63
+ [key: string]: unknown;
64
+ };
65
+ toJSON: () => {
66
+ [key: string]: any;
67
+ };
68
+ toArray: () => [string, any][];
69
+ toSeq: () => Immutable.Seq.Keyed<string, any>;
70
+ [Symbol.iterator]: () => IterableIterator<[string, any]>;
71
+ equals: (other: unknown) => boolean;
72
+ hashCode: () => number;
73
+ get: {
74
+ <NSV>(key: string, notSetValue: NSV): any;
75
+ (key: string): any;
76
+ };
77
+ has: (key: string) => boolean;
78
+ includes: (value: any) => boolean;
79
+ contains: (value: any) => boolean;
80
+ first: <NSV_1 = undefined>(notSetValue?: NSV_1 | undefined) => any;
81
+ last: <NSV_2 = undefined>(notSetValue?: NSV_2 | undefined) => any;
82
+ getIn: (searchKeyPath: Iterable<unknown>, notSetValue?: unknown) => unknown;
83
+ hasIn: (searchKeyPath: Iterable<unknown>) => boolean;
84
+ toObject: () => {
85
+ [key: string]: any;
86
+ };
87
+ toMap: () => Immutable.Map<string, any>;
88
+ toOrderedMap: () => Immutable.OrderedMap<string, any>;
89
+ toSet: () => Immutable.Set<any>;
90
+ toOrderedSet: () => Immutable.OrderedSet<any>;
91
+ toList: () => Immutable.List<any>;
92
+ toStack: () => Immutable.Stack<any>;
93
+ toKeyedSeq: () => Immutable.Seq.Keyed<string, any>;
94
+ toIndexedSeq: () => Immutable.Seq.Indexed<any>;
95
+ toSetSeq: () => Immutable.Seq.Set<any>;
96
+ keys: () => IterableIterator<string>;
97
+ values: () => IterableIterator<any>;
98
+ entries: () => IterableIterator<[string, any]>;
99
+ keySeq: () => Immutable.Seq.Indexed<string>;
100
+ valueSeq: () => Immutable.Seq.Indexed<any>;
101
+ entrySeq: () => Immutable.Seq.Indexed<[string, any]>;
102
+ filterNot: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
103
+ reverse: () => State;
104
+ sort: (comparator?: ((valueA: any, valueB: any) => number) | undefined) => State;
105
+ sortBy: <C_2>(comparatorValueMapper: (value: any, key: string, iter: State) => C_2, comparator?: ((valueA: C_2, valueB: C_2) => number) | undefined) => State;
106
+ groupBy: <G>(grouper: (value: any, key: string, iter: State) => G, context?: unknown) => Immutable.Seq.Keyed<G, Immutable.Collection<string, any>>;
107
+ forEach: (sideEffect: (value: any, key: string, iter: State) => unknown, context?: unknown) => number;
108
+ slice: (begin?: number | undefined, end?: number | undefined) => State;
109
+ rest: () => State;
110
+ butLast: () => State;
111
+ skip: (amount: number) => State;
112
+ skipLast: (amount: number) => State;
113
+ skipWhile: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
114
+ skipUntil: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
115
+ take: (amount: number) => State;
116
+ takeLast: (amount: number) => State;
117
+ takeWhile: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
118
+ takeUntil: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
119
+ flatten: {
120
+ (depth?: number | undefined): Immutable.Collection<unknown, unknown>;
121
+ (shallow?: boolean | undefined): Immutable.Collection<unknown, unknown>;
122
+ };
123
+ reduce: {
124
+ <R_1>(reducer: (reduction: R_1, value: any, key: string, iter: State) => R_1, initialReduction: R_1, context?: unknown): R_1;
125
+ <R_2>(reducer: (reduction: any, value: any, key: string, iter: State) => R_2): R_2;
126
+ };
127
+ reduceRight: {
128
+ <R_3>(reducer: (reduction: R_3, value: any, key: string, iter: State) => R_3, initialReduction: R_3, context?: unknown): R_3;
129
+ <R_4>(reducer: (reduction: any, value: any, key: string, iter: State) => R_4): R_4;
130
+ };
131
+ every: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => boolean;
132
+ some: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => boolean;
133
+ join: (separator?: string | undefined) => string;
134
+ isEmpty: () => boolean;
135
+ count: {
136
+ (): number;
137
+ (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown): number;
138
+ };
139
+ countBy: <G_1>(grouper: (value: any, key: string, iter: State) => G_1, context?: unknown) => Immutable.Map<G_1, number>;
140
+ find: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown, notSetValue?: any) => any;
141
+ findLast: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown, notSetValue?: any) => any;
142
+ findEntry: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown, notSetValue?: any) => [string, any] | undefined;
143
+ findLastEntry: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown, notSetValue?: any) => [string, any] | undefined;
144
+ findKey: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => string | undefined;
145
+ findLastKey: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => string | undefined;
146
+ keyOf: (searchValue: any) => string | undefined;
147
+ lastKeyOf: (searchValue: any) => string | undefined;
148
+ max: (comparator?: ((valueA: any, valueB: any) => number) | undefined) => any;
149
+ maxBy: <C_3>(comparatorValueMapper: (value: any, key: string, iter: State) => C_3, comparator?: ((valueA: C_3, valueB: C_3) => number) | undefined) => any;
150
+ min: (comparator?: ((valueA: any, valueB: any) => number) | undefined) => any;
151
+ minBy: <C_4>(comparatorValueMapper: (value: any, key: string, iter: State) => C_4, comparator?: ((valueA: C_4, valueB: C_4) => number) | undefined) => any;
152
+ isSubset: (iter: Iterable<any>) => boolean;
153
+ isSuperset: (iter: Iterable<any>) => boolean;
154
+ }) => boolean) & import("reselect").OutputSelectorFields<(args_0: boolean, args_1: boolean, args_2: string) => boolean & {
155
+ clearCache: () => void;
156
+ }> & {
157
+ clearCache: () => void;
158
+ };
159
+ isFetched: ((state: {
160
+ readonly size: number;
161
+ set: (key: string, value: any) => State;
162
+ delete: (key: string) => State;
163
+ remove: (key: string) => State;
164
+ deleteAll: (keys: Iterable<string>) => State;
165
+ removeAll: (keys: Iterable<string>) => State;
166
+ clear: () => State;
167
+ update: {
168
+ (key: string, notSetValue: any, updater: (value: any) => any): State;
169
+ (key: string, updater: (value: any) => any): State;
170
+ <R>(updater: (value: State) => R): R;
171
+ };
172
+ merge: {
173
+ <KC, VC>(...collections: Iterable<[KC, VC]>[]): Immutable.Map<string | KC, any>;
174
+ <C>(...collections: {
175
+ [key: string]: C;
176
+ }[]): Immutable.Map<string, any>;
177
+ };
178
+ concat: {
179
+ <KC_1, VC_1>(...collections: Iterable<[KC_1, VC_1]>[]): Immutable.Map<string | KC_1, any>;
180
+ <C_1>(...collections: {
181
+ [key: string]: C_1;
182
+ }[]): Immutable.Map<string, any>;
183
+ };
184
+ mergeWith: (merger: (oldVal: any, newVal: any, key: string) => any, ...collections: (Iterable<[string, any]> | {
185
+ [key: string]: any;
186
+ })[]) => State;
187
+ mergeDeep: (...collections: (Iterable<[string, any]> | {
188
+ [key: string]: any;
189
+ })[]) => State;
190
+ mergeDeepWith: (merger: (oldVal: unknown, newVal: unknown, key: unknown) => unknown, ...collections: (Iterable<[string, any]> | {
191
+ [key: string]: any;
192
+ })[]) => State;
193
+ setIn: (keyPath: Iterable<unknown>, value: unknown) => State;
194
+ deleteIn: (keyPath: Iterable<unknown>) => State;
195
+ removeIn: (keyPath: Iterable<unknown>) => State;
196
+ updateIn: {
197
+ (keyPath: Iterable<unknown>, notSetValue: unknown, updater: (value: unknown) => unknown): State;
198
+ (keyPath: Iterable<unknown>, updater: (value: unknown) => unknown): State;
199
+ };
200
+ mergeIn: (keyPath: Iterable<unknown>, ...collections: unknown[]) => State;
201
+ mergeDeepIn: (keyPath: Iterable<unknown>, ...collections: unknown[]) => State;
202
+ withMutations: (mutator: (mutable: State) => unknown) => State;
203
+ asMutable: () => State;
204
+ wasAltered: () => boolean;
205
+ asImmutable: () => State;
206
+ map: <M>(mapper: (value: any, key: string, iter: State) => M, context?: unknown) => Immutable.Map<string, M>;
207
+ mapKeys: <M_1>(mapper: (key: string, value: any, iter: State) => M_1, context?: unknown) => Immutable.Map<M_1, any>;
208
+ mapEntries: <KM, VM>(mapper: (entry: [string, any], index: number, iter: State) => [KM, VM] | undefined, context?: unknown) => Immutable.Map<KM, VM>;
209
+ flatMap: <KM_1, VM_1>(mapper: (value: any, key: string, iter: State) => Iterable<[KM_1, VM_1]>, context?: unknown) => Immutable.Map<KM_1, VM_1>;
210
+ filter: {
211
+ <F extends any>(predicate: (value: any, key: string, iter: State) => value is F, context?: unknown): Immutable.Map<string, F>;
212
+ (predicate: (value: any, key: string, iter: State) => unknown, context?: unknown): State;
213
+ };
214
+ flip: () => Immutable.Map<any, string>;
215
+ toJS: () => {
216
+ [key: string]: unknown;
217
+ };
218
+ toJSON: () => {
219
+ [key: string]: any;
220
+ };
221
+ toArray: () => [string, any][];
222
+ toSeq: () => Immutable.Seq.Keyed<string, any>;
223
+ [Symbol.iterator]: () => IterableIterator<[string, any]>;
224
+ equals: (other: unknown) => boolean;
225
+ hashCode: () => number;
226
+ get: {
227
+ <NSV>(key: string, notSetValue: NSV): any;
228
+ (key: string): any;
229
+ };
230
+ has: (key: string) => boolean;
231
+ includes: (value: any) => boolean;
232
+ contains: (value: any) => boolean;
233
+ first: <NSV_1 = undefined>(notSetValue?: NSV_1 | undefined) => any;
234
+ last: <NSV_2 = undefined>(notSetValue?: NSV_2 | undefined) => any;
235
+ getIn: (searchKeyPath: Iterable<unknown>, notSetValue?: unknown) => unknown;
236
+ hasIn: (searchKeyPath: Iterable<unknown>) => boolean;
237
+ toObject: () => {
238
+ [key: string]: any;
239
+ };
240
+ toMap: () => Immutable.Map<string, any>;
241
+ toOrderedMap: () => Immutable.OrderedMap<string, any>;
242
+ toSet: () => Immutable.Set<any>;
243
+ toOrderedSet: () => Immutable.OrderedSet<any>;
244
+ toList: () => Immutable.List<any>;
245
+ toStack: () => Immutable.Stack<any>;
246
+ toKeyedSeq: () => Immutable.Seq.Keyed<string, any>;
247
+ toIndexedSeq: () => Immutable.Seq.Indexed<any>;
248
+ toSetSeq: () => Immutable.Seq.Set<any>;
249
+ keys: () => IterableIterator<string>;
250
+ values: () => IterableIterator<any>;
251
+ entries: () => IterableIterator<[string, any]>;
252
+ keySeq: () => Immutable.Seq.Indexed<string>;
253
+ valueSeq: () => Immutable.Seq.Indexed<any>;
254
+ entrySeq: () => Immutable.Seq.Indexed<[string, any]>;
255
+ filterNot: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
256
+ reverse: () => State;
257
+ sort: (comparator?: ((valueA: any, valueB: any) => number) | undefined) => State;
258
+ sortBy: <C_2>(comparatorValueMapper: (value: any, key: string, iter: State) => C_2, comparator?: ((valueA: C_2, valueB: C_2) => number) | undefined) => State;
259
+ groupBy: <G>(grouper: (value: any, key: string, iter: State) => G, context?: unknown) => Immutable.Seq.Keyed<G, Immutable.Collection<string, any>>;
260
+ forEach: (sideEffect: (value: any, key: string, iter: State) => unknown, context?: unknown) => number;
261
+ slice: (begin?: number | undefined, end?: number | undefined) => State;
262
+ rest: () => State;
263
+ butLast: () => State;
264
+ skip: (amount: number) => State;
265
+ skipLast: (amount: number) => State;
266
+ skipWhile: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
267
+ skipUntil: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
268
+ take: (amount: number) => State;
269
+ takeLast: (amount: number) => State;
270
+ takeWhile: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
271
+ takeUntil: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
272
+ flatten: {
273
+ (depth?: number | undefined): Immutable.Collection<unknown, unknown>;
274
+ (shallow?: boolean | undefined): Immutable.Collection<unknown, unknown>;
275
+ };
276
+ reduce: {
277
+ <R_1>(reducer: (reduction: R_1, value: any, key: string, iter: State) => R_1, initialReduction: R_1, context?: unknown): R_1;
278
+ <R_2>(reducer: (reduction: any, value: any, key: string, iter: State) => R_2): R_2;
279
+ };
280
+ reduceRight: {
281
+ <R_3>(reducer: (reduction: R_3, value: any, key: string, iter: State) => R_3, initialReduction: R_3, context?: unknown): R_3;
282
+ <R_4>(reducer: (reduction: any, value: any, key: string, iter: State) => R_4): R_4;
283
+ };
284
+ every: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => boolean;
285
+ some: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => boolean;
286
+ join: (separator?: string | undefined) => string;
287
+ isEmpty: () => boolean;
288
+ count: {
289
+ (): number;
290
+ (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown): number;
291
+ };
292
+ countBy: <G_1>(grouper: (value: any, key: string, iter: State) => G_1, context?: unknown) => Immutable.Map<G_1, number>;
293
+ find: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown, notSetValue?: any) => any;
294
+ findLast: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown, notSetValue?: any) => any;
295
+ findEntry: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown, notSetValue?: any) => [string, any] | undefined;
296
+ findLastEntry: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown, notSetValue?: any) => [string, any] | undefined;
297
+ findKey: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => string | undefined;
298
+ findLastKey: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => string | undefined;
299
+ keyOf: (searchValue: any) => string | undefined;
300
+ lastKeyOf: (searchValue: any) => string | undefined;
301
+ max: (comparator?: ((valueA: any, valueB: any) => number) | undefined) => any;
302
+ maxBy: <C_3>(comparatorValueMapper: (value: any, key: string, iter: State) => C_3, comparator?: ((valueA: C_3, valueB: C_3) => number) | undefined) => any;
303
+ min: (comparator?: ((valueA: any, valueB: any) => number) | undefined) => any;
304
+ minBy: <C_4>(comparatorValueMapper: (value: any, key: string, iter: State) => C_4, comparator?: ((valueA: C_4, valueB: C_4) => number) | undefined) => any;
305
+ isSubset: (iter: Iterable<any>) => boolean;
306
+ isSuperset: (iter: Iterable<any>) => boolean;
307
+ }) => boolean) & import("reselect").OutputSelectorFields<(args_0: boolean, args_1: string) => boolean & {
308
+ clearCache: () => void;
309
+ }> & {
310
+ clearCache: () => void;
311
+ };
312
+ hasError: ((state: {
313
+ readonly size: number;
314
+ set: (key: string, value: any) => State;
315
+ delete: (key: string) => State;
316
+ remove: (key: string) => State;
317
+ deleteAll: (keys: Iterable<string>) => State;
318
+ removeAll: (keys: Iterable<string>) => State;
319
+ clear: () => State;
320
+ update: {
321
+ (key: string, notSetValue: any, updater: (value: any) => any): State;
322
+ (key: string, updater: (value: any) => any): State;
323
+ <R>(updater: (value: State) => R): R;
324
+ };
325
+ merge: {
326
+ <KC, VC>(...collections: Iterable<[KC, VC]>[]): Immutable.Map<string | KC, any>;
327
+ <C>(...collections: {
328
+ [key: string]: C;
329
+ }[]): Immutable.Map<string, any>;
330
+ };
331
+ concat: {
332
+ <KC_1, VC_1>(...collections: Iterable<[KC_1, VC_1]>[]): Immutable.Map<string | KC_1, any>;
333
+ <C_1>(...collections: {
334
+ [key: string]: C_1;
335
+ }[]): Immutable.Map<string, any>;
336
+ };
337
+ mergeWith: (merger: (oldVal: any, newVal: any, key: string) => any, ...collections: (Iterable<[string, any]> | {
338
+ [key: string]: any;
339
+ })[]) => State;
340
+ mergeDeep: (...collections: (Iterable<[string, any]> | {
341
+ [key: string]: any;
342
+ })[]) => State;
343
+ mergeDeepWith: (merger: (oldVal: unknown, newVal: unknown, key: unknown) => unknown, ...collections: (Iterable<[string, any]> | {
344
+ [key: string]: any;
345
+ })[]) => State;
346
+ setIn: (keyPath: Iterable<unknown>, value: unknown) => State;
347
+ deleteIn: (keyPath: Iterable<unknown>) => State;
348
+ removeIn: (keyPath: Iterable<unknown>) => State;
349
+ updateIn: {
350
+ (keyPath: Iterable<unknown>, notSetValue: unknown, updater: (value: unknown) => unknown): State;
351
+ (keyPath: Iterable<unknown>, updater: (value: unknown) => unknown): State;
352
+ };
353
+ mergeIn: (keyPath: Iterable<unknown>, ...collections: unknown[]) => State;
354
+ mergeDeepIn: (keyPath: Iterable<unknown>, ...collections: unknown[]) => State;
355
+ withMutations: (mutator: (mutable: State) => unknown) => State;
356
+ asMutable: () => State;
357
+ wasAltered: () => boolean;
358
+ asImmutable: () => State;
359
+ map: <M>(mapper: (value: any, key: string, iter: State) => M, context?: unknown) => Immutable.Map<string, M>;
360
+ mapKeys: <M_1>(mapper: (key: string, value: any, iter: State) => M_1, context?: unknown) => Immutable.Map<M_1, any>;
361
+ mapEntries: <KM, VM>(mapper: (entry: [string, any], index: number, iter: State) => [KM, VM] | undefined, context?: unknown) => Immutable.Map<KM, VM>;
362
+ flatMap: <KM_1, VM_1>(mapper: (value: any, key: string, iter: State) => Iterable<[KM_1, VM_1]>, context?: unknown) => Immutable.Map<KM_1, VM_1>;
363
+ filter: {
364
+ <F extends any>(predicate: (value: any, key: string, iter: State) => value is F, context?: unknown): Immutable.Map<string, F>;
365
+ (predicate: (value: any, key: string, iter: State) => unknown, context?: unknown): State;
366
+ };
367
+ flip: () => Immutable.Map<any, string>;
368
+ toJS: () => {
369
+ [key: string]: unknown;
370
+ };
371
+ toJSON: () => {
372
+ [key: string]: any;
373
+ };
374
+ toArray: () => [string, any][];
375
+ toSeq: () => Immutable.Seq.Keyed<string, any>;
376
+ [Symbol.iterator]: () => IterableIterator<[string, any]>;
377
+ equals: (other: unknown) => boolean;
378
+ hashCode: () => number;
379
+ get: {
380
+ <NSV>(key: string, notSetValue: NSV): any;
381
+ (key: string): any;
382
+ };
383
+ has: (key: string) => boolean;
384
+ includes: (value: any) => boolean;
385
+ contains: (value: any) => boolean;
386
+ first: <NSV_1 = undefined>(notSetValue?: NSV_1 | undefined) => any;
387
+ last: <NSV_2 = undefined>(notSetValue?: NSV_2 | undefined) => any;
388
+ getIn: (searchKeyPath: Iterable<unknown>, notSetValue?: unknown) => unknown;
389
+ hasIn: (searchKeyPath: Iterable<unknown>) => boolean;
390
+ toObject: () => {
391
+ [key: string]: any;
392
+ };
393
+ toMap: () => Immutable.Map<string, any>;
394
+ toOrderedMap: () => Immutable.OrderedMap<string, any>;
395
+ toSet: () => Immutable.Set<any>;
396
+ toOrderedSet: () => Immutable.OrderedSet<any>;
397
+ toList: () => Immutable.List<any>;
398
+ toStack: () => Immutable.Stack<any>;
399
+ toKeyedSeq: () => Immutable.Seq.Keyed<string, any>;
400
+ toIndexedSeq: () => Immutable.Seq.Indexed<any>;
401
+ toSetSeq: () => Immutable.Seq.Set<any>;
402
+ keys: () => IterableIterator<string>;
403
+ values: () => IterableIterator<any>;
404
+ entries: () => IterableIterator<[string, any]>;
405
+ keySeq: () => Immutable.Seq.Indexed<string>;
406
+ valueSeq: () => Immutable.Seq.Indexed<any>;
407
+ entrySeq: () => Immutable.Seq.Indexed<[string, any]>;
408
+ filterNot: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
409
+ reverse: () => State;
410
+ sort: (comparator?: ((valueA: any, valueB: any) => number) | undefined) => State;
411
+ sortBy: <C_2>(comparatorValueMapper: (value: any, key: string, iter: State) => C_2, comparator?: ((valueA: C_2, valueB: C_2) => number) | undefined) => State;
412
+ groupBy: <G>(grouper: (value: any, key: string, iter: State) => G, context?: unknown) => Immutable.Seq.Keyed<G, Immutable.Collection<string, any>>;
413
+ forEach: (sideEffect: (value: any, key: string, iter: State) => unknown, context?: unknown) => number;
414
+ slice: (begin?: number | undefined, end?: number | undefined) => State;
415
+ rest: () => State;
416
+ butLast: () => State;
417
+ skip: (amount: number) => State;
418
+ skipLast: (amount: number) => State;
419
+ skipWhile: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
420
+ skipUntil: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
421
+ take: (amount: number) => State;
422
+ takeLast: (amount: number) => State;
423
+ takeWhile: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
424
+ takeUntil: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => State;
425
+ flatten: {
426
+ (depth?: number | undefined): Immutable.Collection<unknown, unknown>;
427
+ (shallow?: boolean | undefined): Immutable.Collection<unknown, unknown>;
428
+ };
429
+ reduce: {
430
+ <R_1>(reducer: (reduction: R_1, value: any, key: string, iter: State) => R_1, initialReduction: R_1, context?: unknown): R_1;
431
+ <R_2>(reducer: (reduction: any, value: any, key: string, iter: State) => R_2): R_2;
432
+ };
433
+ reduceRight: {
434
+ <R_3>(reducer: (reduction: R_3, value: any, key: string, iter: State) => R_3, initialReduction: R_3, context?: unknown): R_3;
435
+ <R_4>(reducer: (reduction: any, value: any, key: string, iter: State) => R_4): R_4;
436
+ };
437
+ every: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => boolean;
438
+ some: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => boolean;
439
+ join: (separator?: string | undefined) => string;
440
+ isEmpty: () => boolean;
441
+ count: {
442
+ (): number;
443
+ (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown): number;
444
+ };
445
+ countBy: <G_1>(grouper: (value: any, key: string, iter: State) => G_1, context?: unknown) => Immutable.Map<G_1, number>;
446
+ find: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown, notSetValue?: any) => any;
447
+ findLast: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown, notSetValue?: any) => any;
448
+ findEntry: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown, notSetValue?: any) => [string, any] | undefined;
449
+ findLastEntry: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown, notSetValue?: any) => [string, any] | undefined;
450
+ findKey: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => string | undefined;
451
+ findLastKey: (predicate: (value: any, key: string, iter: State) => boolean, context?: unknown) => string | undefined;
452
+ keyOf: (searchValue: any) => string | undefined;
453
+ lastKeyOf: (searchValue: any) => string | undefined;
454
+ max: (comparator?: ((valueA: any, valueB: any) => number) | undefined) => any;
455
+ maxBy: <C_3>(comparatorValueMapper: (value: any, key: string, iter: State) => C_3, comparator?: ((valueA: C_3, valueB: C_3) => number) | undefined) => any;
456
+ min: (comparator?: ((valueA: any, valueB: any) => number) | undefined) => any;
457
+ minBy: <C_4>(comparatorValueMapper: (value: any, key: string, iter: State) => C_4, comparator?: ((valueA: C_4, valueB: C_4) => number) | undefined) => any;
458
+ isSubset: (iter: Iterable<any>) => boolean;
459
+ isSuperset: (iter: Iterable<any>) => boolean;
460
+ }) => boolean) & import("reselect").OutputSelectorFields<(args_0: string) => boolean & {
461
+ clearCache: () => void;
462
+ }> & {
463
+ clearCache: () => void;
464
+ };
465
+ getError: (state: State) => string;
466
+ isFetching: (state: State) => boolean;
467
+ };
468
+ actions: {
469
+ clear: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<`${string}/clear`>;
470
+ };
471
+ Load: (props: {
472
+ readonly children: any;
473
+ }) => any;
474
+ reducer: (state: any, action: any) => any;
475
+ };
476
+ export {};
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ var _a;
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.createGenericLoader = exports.fulfilled = exports.rejected = exports.pending = exports.initialState = exports.statusReducer = void 0;
8
+ /* eslint-disable import/no-named-as-default-member */
9
+ /* eslint-disable max-len */
10
+ var toolkit_1 = require("@reduxjs/toolkit");
11
+ var immutable_1 = __importDefault(require("immutable"));
12
+ var reselect_1 = require("reselect");
13
+ var utility_1 = require("../utility");
14
+ var CreateLoad_1 = __importDefault(require("./CreateLoad"));
15
+ var pending = function (state) { return (state.mergeIn([exports.statusReducer], immutable_1.default.Map({
16
+ errorMessage: utility_1.noError,
17
+ fetched: false,
18
+ fetching: true,
19
+ }))); }, rejected = function (state) { return (state.mergeDeepIn([exports.statusReducer], immutable_1.default.Map({
20
+ errorMessage: "Error",
21
+ fetching: false,
22
+ }))); }, fulfilled = function (state, _a) {
23
+ var _b;
24
+ var payload = _a.payload;
25
+ return (state.mergeDeepIn(immutable_1.default.Map((_b = {
26
+ data: payload
27
+ },
28
+ _b[exports.statusReducer] = immutable_1.default.Map({
29
+ errorMessage: utility_1.noError,
30
+ fetching: false,
31
+ fetched: true,
32
+ }),
33
+ _b))));
34
+ }, createGenericLoader = function (_a) {
35
+ var reducerName = _a.reducerName, url = _a.url, normalizeResult = _a.normalizeResult;
36
+ var reducer = function (state, action) {
37
+ var _a;
38
+ if (state === void 0) { state = exports.initialState; }
39
+ switch (action.type) {
40
+ case "".concat(reducerName, "/pending"):
41
+ return (0, exports.pending)(state);
42
+ case "".concat(reducerName, "/rejected"):
43
+ return (0, exports.rejected)(state);
44
+ case "".concat(reducerName, "/fulfilled"):
45
+ return state.mergeDeep(immutable_1.default.Map((_a = {},
46
+ _a[exports.statusReducer] = immutable_1.default.Map({
47
+ fetched: true,
48
+ fetching: false,
49
+ error: utility_1.noError,
50
+ }),
51
+ _a["data"] = action.payload,
52
+ _a)));
53
+ case "".concat(reducerName, "/clear"):
54
+ return exports.initialState;
55
+ default:
56
+ return state;
57
+ }
58
+ }, isFetching = function (state) { return (state.getIn([reducerName, exports.statusReducer, "fetching"]) || false); }, getFetchedSelector = function (state) { return (state.getIn([reducerName, exports.statusReducer, "fetched"]) || false); }, getError = function (state) { return (state.getIn([reducerName, exports.statusReducer, "errorMessage"]) || utility_1.noError); }, shouldFetch = (0, reselect_1.createSelector)(isFetching, getFetchedSelector, getError, function (isFetchingValue, isFetched, error) { return (!isFetchingValue &&
59
+ !isFetched &&
60
+ error === utility_1.noError); }), isFetched = (0, reselect_1.createSelector)(getFetchedSelector, getError, function (isFetchedState, error) { return isFetchedState && error === utility_1.noError; }), hasError = (0, reselect_1.createSelector)(getError, function (error) { return error !== utility_1.noError; }), clearAction = (0, toolkit_1.createAction)("".concat(reducerName, "/clear")), selectors = {
61
+ shouldFetch: shouldFetch,
62
+ isFetched: isFetched,
63
+ hasError: hasError,
64
+ getError: getError,
65
+ isFetching: isFetching,
66
+ };
67
+ return {
68
+ stateSelectors: selectors,
69
+ actions: {
70
+ clear: clearAction,
71
+ },
72
+ Load: (0, CreateLoad_1.default)({
73
+ url: url,
74
+ normalizeResult: normalizeResult,
75
+ selectors: selectors,
76
+ reducerName: reducerName,
77
+ }),
78
+ reducer: reducer,
79
+ };
80
+ };
81
+ exports.statusReducer = "status", exports.initialState = immutable_1.default.Map((_a = {},
82
+ _a[exports.statusReducer] = immutable_1.default.Map({
83
+ errorMessage: utility_1.noError,
84
+ fetched: false,
85
+ fetching: false,
86
+ }),
87
+ _a)), exports.pending = pending, exports.rejected = rejected, exports.fulfilled = fulfilled, exports.createGenericLoader = createGenericLoader;
88
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Loader/index.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "17.3.24",
2
+ "version": "17.3.26",
3
3
  "name": "x25",
4
4
  "description": "x25",
5
5
  "types": "./dist/index.d.ts",
@@ -106,6 +106,7 @@
106
106
  "@docusaurus/react-loadable": "^5.5.2",
107
107
  "@reduxjs/toolkit": "^1.8.6",
108
108
  "classnames": "^2.3.2",
109
+ "final-form": "^4.20.9",
109
110
  "immutable": "^4.1.0",
110
111
  "jest": "^27.5.1",
111
112
  "moment": "^2.29.4",
File without changes
@@ -9,3 +9,6 @@ export * from "./mql";
9
9
  export * from "./validation";
10
10
  export * from "./words";
11
11
  export * from "./hooks";
12
+ export declare const formError: (message: string) => {
13
+ "FINAL_FORM/form-error": string;
14
+ }, toNumeric: (raw: any) => number;
package/utility/index.js CHANGED
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.toNumeric = exports.formError = void 0;
17
18
  __exportStar(require("./calendar"), exports);
18
19
  __exportStar(require("./date"), exports);
19
20
  __exportStar(require("./normalize"), exports);
@@ -25,4 +26,12 @@ __exportStar(require("./mql"), exports);
25
26
  __exportStar(require("./validation"), exports);
26
27
  __exportStar(require("./words"), exports);
27
28
  __exportStar(require("./hooks"), exports);
29
+ var final_form_1 = require("final-form");
30
+ var formError = function (message) {
31
+ var _a;
32
+ return (_a = {},
33
+ _a[final_form_1.FORM_ERROR] = message,
34
+ _a);
35
+ }, toNumeric = function (raw) { return Number(String(raw)); };
36
+ exports.formError = formError, exports.toNumeric = toNumeric;
28
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utility/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,4CAA0B;AAC1B,wCAAsB;AACtB,+CAA6B;AAC7B,0CAAwB;AACxB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utility/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,4CAA0B;AAC1B,wCAAsB;AACtB,+CAA6B;AAC7B,0CAAwB;AACxB,0CAAwB;AAExB,yCAAwC;AAEjC,IACL,SAAS,GAAG,UAAC,OAAgB;;IAAK,OAAA;QAChC,GAAC,uBAAU,IAAG,OAAO;WACrB;AAFgC,CAEhC,EACF,SAAS,GAAG,UAAC,GAAS,IAAK,OAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAnB,CAAmB,CAAC;AAH/C,QAAA,SAAS,cAGT,QAAA,SAAS,aAAsC"}
@@ -1 +0,0 @@
1
- .delay-input{position:relative}.delay-input input{padding-right:27px}.delay-input .loading-spinner{position:absolute;right:4px;top:5px;transition:all .2s ease-in-out}.delay-input .clear-value{position:absolute;right:6px;top:11px;transition:all .2s ease-in-out}.digits-3{width:52px !important}.text-fancy,.fancy-text,.fancy-text-sm{-webkit-user-select:none;box-sizing:border-box;color:#b1b2b3;cursor:default;font-family:"Lucida Grande","Segoe UI",Ubuntu,Cantarell,sans-serif;font-weight:bold;list-style-image:none;list-style-position:outside;list-style-type:none;opacity:1;text-align:center}.text-fancy{margin-top:5px;color:gray;font-size:20px;font-weight:500}.fancy-text{font-size:31px;line-height:34px}.fancy-text-sm{font-size:16px;line-height:23.5px}.navbar .nav-toggler{background:#292b2c}.main{padding:20px}.main .page-header{margin-top:0}@media (min-width: 768px){.main{padding-right:40px;padding-left:40px}}.sidework-logo .first-char{color:#ff007b;font-size:32px;font-weight:500}.sidework-logo .color{color:#ff007b}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.no-hover{text-decoration:none !important}.cursor-pointer{cursor:pointer}.no-wrap{white-space:nowrap}.content{margin-bottom:3rem;margin-top:10px;margin-left:10px}.hr-sm{margin-top:.5rem;margin-bottom:.5rem}.text-fancy,.fancy-text,.fancy-text-sm{-webkit-user-select:none;box-sizing:border-box;color:#b1b2b3;cursor:default;font-family:"Lucida Grande","Segoe UI",Ubuntu,Cantarell,sans-serif;font-weight:bold;list-style-image:none;list-style-position:outside;list-style-type:none;opacity:1;text-align:center}.fancy-text{font-size:31px;line-height:34px}.fancy-text-sm{font-size:16px;line-height:23.5px}.invalid-feedback{display:block !important}.truncate{display:inline-block;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media screen and (min-width: 1201px){.brand-wrapper{width:500px}}@media screen and (min-width: 980px) and (max-width: 1200px){.brand-wrapper{width:350px}}@media screen and (min-width: 850px) and (max-width: 979px){.brand-wrapper{width:200px}}@media screen and (min-width: 798px) and (max-width: 849px){.brand-wrapper{width:100px}}@media screen and (min-width: 765px) and (max-width: 797px){.brand-wrapper{width:200px}}@media screen and (min-width: 580px) and (max-width: 764px){.brand-wrapper{width:400px}}@media screen and (min-width: 401px) and (max-width: 579px){.brand-wrapper{width:240px}}@media screen and (min-width: 350px) and (max-width: 400px){.brand-wrapper{width:230px}}@media screen and (max-width: 349px){.brand-wrapper{width:100px}}@media only screen and (min-device-width: 770px){.search-bar{width:220px !important}}::-webkit-input-placeholder{color:#e0e0e0 !important}::-moz-placeholder{color:#e0e0e0 !important}:-ms-input-placeholder{color:#e0e0e0 !important}:-moz-placeholder{color:#e0e0e0 !important}.collapsible-content-edonec{transition:height 0.2s ease-in-out}.collapsible-card-edonec{transition:0.3s}
@@ -1 +0,0 @@
1
- .page-wrapper .sidebar-wrapper .sidebar-content .sidebar-brand .sidework,.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu ul li a i,.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .sidebar-dropdown>a::after,.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .sidebar-dropdown .sidebar-submenu li a::before{-webkit-transition:all 0.3s ease;-moz-transition:all 0.3s ease;-ms-transition:all 0.3s ease;-o-transition:all 0.3s ease;transition:all 0.3s ease}@keyframes swing{0%{transform:rotate(0deg)}10%{transform:rotate(10deg)}30%{transform:rotate(0deg)}40%{transform:rotate(-10deg)}50%{transform:rotate(0deg)}60%{transform:rotate(5deg)}70%{transform:rotate(0deg)}80%{transform:rotate(-5deg)}100%{transform:rotate(0deg)}}@keyframes sonar{0%{transform:scale(0.9);opacity:1}100%{transform:scale(2);opacity:0}}.page-wrapper{height:100vh}.page-wrapper .theme{width:40px;height:40px;display:inline-block;border-radius:4px;margin:2px}.page-wrapper .theme.dark-theme{background:#1e2229}.page-wrapper .sidebar-wrapper{width:240px;height:100%;max-height:100%;position:fixed;top:0;z-index:999}.page-wrapper .sidebar-wrapper .sidebar-footer{position:absolute;width:100%;bottom:0;display:flex}.page-wrapper .sidebar-wrapper .sidebar-footer>a{flex-grow:1;text-align:center;height:30px;line-height:30px;position:relative}.page-wrapper .sidebar-wrapper .sidebar-footer>a .notification{position:absolute;top:0}.page-wrapper .sidebar-wrapper .sidebar-content{max-height:calc(100% - 30px);height:calc(100% - 30px);overflow-y:auto;position:relative;-webkit-transition:all 0.3s ease;-moz-transition:all 0.3s ease;-ms-transition:all 0.3s ease;-o-transition:all 0.3s ease;transition:all 0.3s ease}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-brand{padding:10px 20px;display:flex;align-items:center}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-brand .sidework{text-transform:uppercase;font-weight:bold;flex-grow:1}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-brand #close-sidebar{cursor:pointer;font-size:20px}.page-wrapper .sidebar-wrapper .sidebar-content ul{list-style-type:none;padding:0;margin:0}.page-wrapper .sidebar-wrapper .sidebar-content a{text-decoration:none}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu{padding-bottom:10px}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu ul li a{font-size:15px;font-weight:500;-webkit-transition:all 0.3s ease;-moz-transition:all 0.3s ease;-ms-transition:all 0.3s ease;-o-transition:all 0.3s ease;transition:all 0.3s ease;display:inline-block;width:100%;text-decoration:none;position:relative;padding:8px 30px 8px 20px}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu ul li a span.label,.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu ul li a span.badge{float:right;margin-top:8px;margin-left:5px}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu ul li a i{margin-right:10px;font-size:12px;width:30px;height:30px;line-height:30px;text-align:center;border-radius:4px}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu ul li a:hover>i::before{display:inline-block;animation:swing ease-in-out 0.5s 1 alternate}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu ul li a .badge-sonar{display:inline-block;background:#980303;border-radius:50%;height:8px;width:8px;position:absolute;top:0}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu ul li a .badge-sonar::after{content:"";position:absolute;top:0;left:0;border:2px solid #980303;opacity:0;border-radius:50%;width:100%;height:100%;animation:sonar 1.5s infinite}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .header-menu span{font-weight:bold;font-size:14px;padding:15px 20px 5px 20px;display:inline-block}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .sidebar-dropdown{font-weight:500;font-size:15px}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .sidebar-dropdown>a::after{font-family:"FontAwesome", sans-serif;font-weight:900;content:"\f105";font-style:normal;display:inline-block;font-variant:normal;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;background:0 0;position:absolute;right:15px;top:14px}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .sidebar-dropdown .sidebar-submenu{display:none}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .sidebar-dropdown .sidebar-submenu li a .badge,.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .sidebar-dropdown .sidebar-submenu li a .label{float:right;margin-top:0}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .sidebar-dropdown .sidebar-submenu ul{padding:5px 0}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .sidebar-dropdown .sidebar-submenu li{padding-left:25px;font-size:12px}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .sidebar-dropdown .sidebar-submenu li a::before{content:"\f1db";font-family:"FontAwesome", sans-serif;font-weight:400;font-style:normal;display:inline-block;text-align:center;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin-right:10px;font-size:10px}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .sidebar-dropdown .sidebar-submenu li a.active::before{content:"\f111";font-family:"FontAwesome", sans-serif;font-weight:400;font-style:normal;display:inline-block;text-align:center;text-decoration:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin-right:10px;font-size:10px}.page-wrapper .sidebar-wrapper .sidebar-content .sidebar-menu .sidebar-dropdown.active>a::after{transform:rotate(90deg);right:17px}.sidebar-item-enter{opacity:0.01;height:10px}.sidebar-item-enter.sidebar-item-enter-active{opacity:1;height:100%;transition:all 350ms ease}.sidebar-item-leave{opacity:0;height:0}.sidebar-item-leave.sidebar-item-leave-active{opacity:0.01;height:0;transition:all 200ms ease}::-webkit-scrollbar{width:5px;height:7px}::-webkit-scrollbar-corner{background:transparent}::-webkit-scrollbar-button{width:0;height:0}::-webkit-scrollbar-thumb{background:#c7c7c7;border:0 none #fff;border-radius:10px}::-webkit-scrollbar-thumb:hover,::-webkit-scrollbar-thumb:active{background:#525965}::-webkit-scrollbar-track{background:transparent;border:0 none #fff;border-radius:50px;border-radius:10px}::-webkit-scrollbar-track:hover,::-webkit-scrollbar-track:active{background:transparent}.dark-theme .sidebar-wrapper{background:#31353d}.dark-theme .sidebar-wrapper .sidebar-brand i{color:#b8bfce}.dark-theme .sidebar-wrapper .sidebar-footer{background:#3a3f48;box-shadow:0 -1px 5px #282c33;border-top:1px solid #464a52}.dark-theme .sidebar-wrapper .sidebar-footer a{color:#818896}.dark-theme .sidebar-wrapper .sidebar-footer a i{color:#b8bfce}.dark-theme .sidebar-wrapper .sidebar-menu{border-top:1px solid #3a3f48}.dark-theme .sidebar-wrapper .sidebar-menu ul li a{color:#818896}.dark-theme .sidebar-wrapper .sidebar-menu ul li a i{background:#3a3f48}.dark-theme .sidebar-wrapper .sidebar-menu ul li:hover>a{color:#b8bfce}.dark-theme .sidebar-wrapper .sidebar-menu ul li:hover>a i{color:#16c7ff;text-shadow:0 0 10px rgba(22,199,255,0.5)}.dark-theme .sidebar-wrapper .sidebar-menu .one-page a.active i,.dark-theme .sidebar-wrapper .sidebar-menu .sidebar-dropdown.active a i{color:#16c7ff;text-shadow:0 0 10px rgba(22,199,255,0.5)}.dark-theme .sidebar-wrapper .sidebar-menu .sidebar-dropdown div{background:#3a3f48}.dark-theme .sidebar-wrapper .sidebar-menu .header-menu span{color:#6c7b88}.dark-theme .sidebar-wrapper .sidebar-menu .sidebar-dropdown.active>a{color:#b8bfce}.dark-theme .sidebar-wrapper .sidebar-dropdown .sidebar-submenu li a:hover::before{color:#16c7ff;text-shadow:0 0 10px rgba(22,199,255,0.5)}.dark-theme .sidebar-wrapper .one-page a.active,.dark-theme .sidebar-wrapper .sidebar-dropdown .sidebar-submenu li a.active{color:#bdbdbd}