@supersoniks/concorde 3.1.4 → 3.1.5

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.
Files changed (69) hide show
  1. package/build-infos.json +1 -3
  2. package/concorde-core.bundle.js +68 -53
  3. package/concorde-core.es.js +279 -239
  4. package/dist/concorde-core.bundle.js +68 -53
  5. package/dist/concorde-core.es.js +279 -239
  6. package/docs/assets/index--bDsd7qW.css +1 -0
  7. package/docs/assets/index-Ce3mr_lI.js +4040 -0
  8. package/docs/css/docs.css +0 -0
  9. package/docs/img/concorde-logo.svg +1 -0
  10. package/docs/img/concorde.png +0 -0
  11. package/docs/img/concorde_def.png +0 -0
  12. package/docs/index.html +132 -0
  13. package/docs/src/core/components/functional/date/date.md +290 -0
  14. package/docs/src/core/components/functional/fetch/fetch.md +117 -0
  15. package/docs/src/core/components/functional/if/if.md +16 -0
  16. package/docs/src/core/components/functional/list/list.md +194 -0
  17. package/docs/src/core/components/functional/mix/mix.md +41 -0
  18. package/docs/src/core/components/functional/queue/queue.md +87 -0
  19. package/docs/src/core/components/functional/router/router.md +112 -0
  20. package/docs/src/core/components/functional/sdui/default-library.json +108 -0
  21. package/docs/src/core/components/functional/sdui/example.json +99 -0
  22. package/docs/src/core/components/functional/sdui/sdui.md +356 -0
  23. package/docs/src/core/components/functional/states/states.md +87 -0
  24. package/docs/src/core/components/functional/submit/submit.md +48 -0
  25. package/docs/src/core/components/functional/subscriber/subscriber.md +91 -0
  26. package/docs/src/core/components/functional/value/value.md +35 -0
  27. package/docs/src/core/components/ui/alert/alert.md +121 -0
  28. package/docs/src/core/components/ui/badge/badge.md +102 -0
  29. package/docs/src/core/components/ui/button/button.md +184 -0
  30. package/docs/src/core/components/ui/captcha/captcha.md +12 -0
  31. package/docs/src/core/components/ui/card/card.md +96 -0
  32. package/docs/src/core/components/ui/divider/divider.md +35 -0
  33. package/docs/src/core/components/ui/form/checkbox/checkbox.md +96 -0
  34. package/docs/src/core/components/ui/form/fieldset/fieldset.md +129 -0
  35. package/docs/src/core/components/ui/form/form-actions/form-actions.md +77 -0
  36. package/docs/src/core/components/ui/form/form-layout/form-layout.md +43 -0
  37. package/docs/src/core/components/ui/form/input/input.md +168 -0
  38. package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +130 -0
  39. package/docs/src/core/components/ui/form/radio/radio.md +86 -0
  40. package/docs/src/core/components/ui/form/select/select.md +99 -0
  41. package/docs/src/core/components/ui/form/textarea/textarea.md +66 -0
  42. package/docs/src/core/components/ui/group/group.md +75 -0
  43. package/docs/src/core/components/ui/icon/icon.md +125 -0
  44. package/docs/src/core/components/ui/icon/icons.json +1 -0
  45. package/docs/src/core/components/ui/image/image.md +107 -0
  46. package/docs/src/core/components/ui/link/link.md +43 -0
  47. package/docs/src/core/components/ui/loader/loader.md +37 -0
  48. package/docs/src/core/components/ui/menu/menu.md +288 -0
  49. package/docs/src/core/components/ui/modal/modal.md +123 -0
  50. package/docs/src/core/components/ui/pop/pop.md +79 -0
  51. package/docs/src/core/components/ui/progress/progress.md +65 -0
  52. package/docs/src/core/components/ui/table/table.md +467 -0
  53. package/docs/src/core/components/ui/tooltip/tooltip.md +37 -0
  54. package/docs/src/docs/_core-concept/overview.md +57 -0
  55. package/docs/src/docs/_core-concept/subscriber.md +76 -0
  56. package/docs/src/docs/_getting-started/concorde-outside.md +141 -0
  57. package/docs/src/docs/_getting-started/create-a-component.md +137 -0
  58. package/docs/src/docs/_getting-started/pubsub.md +150 -0
  59. package/docs/src/docs/_getting-started/start.md +37 -0
  60. package/docs/src/docs/_getting-started/theming.md +91 -0
  61. package/docs/src/docs/search/docs-search.json +3737 -0
  62. package/docs/src/tag-list.json +1 -0
  63. package/docs/src/tsconfig.json +113 -0
  64. package/docs/svg/regular/plane.svg +1 -0
  65. package/docs/svg/solid/plane.svg +1 -0
  66. package/package.json +1 -1
  67. package/postcss.config.cjs +0 -0
  68. package/src/core/utils/api.ts +97 -32
  69. package/src/docs/tailwind/index.ts +0 -0
@@ -0,0 +1 @@
1
+ ["sonic-date","sonic-example","sonic-fetch","sonic-if","sonic-list","sonic-mix","sonic-queue","sonic-redirect","sonic-router","sonic-sdui","sonic-scope","sonic-states","sonic-submit","sonic-subscriber","sonic-value","sonic-alert","sonic-badge","sonic-button","sonic-captcha","sonic-card-footer","sonic-card-header-description","sonic-card-header","sonic-card-main","sonic-card","sonic-divider","sonic-checkbox","sonic-fieldset","sonic-legend-description","sonic-legend","sonic-form-actions","sonic-form-layout","sonic-input","sonic-password-helper","sonic-same-value-helper","sonic-input-autocomplete","sonic-radio","sonic-select","sonic-textarea","sonic-group","sonic-icon","sonic-image","sonic-link","sonic-loader","sonic-menu-item","sonic-menu","sonic-modal-actions","sonic-modal-close","sonic-modal-content","sonic-modal-subtitle","sonic-modal-title","sonic-modal","sonic-pop","sonic-progress","sonic-caption","sonic-tbody","sonic-td","sonic-tfoot","sonic-th","sonic-thead","sonic-tr","sonic-table","sonic-theme","sonic-toast-message-subscriber","sonic-toast-item","sonic-toast","sonic-tooltip"]
@@ -0,0 +1,113 @@
1
+ {
2
+ // "include": ["src/**/*"],
3
+ "exclude": ["node_modules/**/*", "dist/**/*", "vite.config.mts", "docs.ts", "docs/*"],
4
+ "compilerOptions": {
5
+ /* Visit https://aka.ms/tsconfig to read more about this file */
6
+
7
+ /* Projects */
8
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
9
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
10
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
11
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
12
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
13
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
14
+
15
+ /* Language and Environment */
16
+ "target": "es2021", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
17
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
18
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
19
+ "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
20
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
21
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
22
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
23
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
24
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
25
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
26
+ "useDefineForClassFields": false, /* Emit ECMAScript-standard-compliant class fields. */
27
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
28
+
29
+ /* Modules */
30
+ "module": "esnext", /* Specify what module code is generated. */
31
+ // "rootDir": "./src", /* Specify the root folder within your source files. */
32
+ "moduleResolution": "bundler", /* Specify how TypeScript looks up a file from a given module specifier. */
33
+ // "baseUrl": "./src", /* Specify the base directory to resolve non-relative module names. */
34
+ "paths": {
35
+ "@supersoniks/concorde/*":["./*"]
36
+ }, /* Specify a set of entries that re-map imports to additional lookup locations. */
37
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
38
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
39
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
40
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
41
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
42
+ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
43
+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
44
+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
45
+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
46
+ "resolveJsonModule": true, /* Enable importing .json files. */
47
+ // "allowArbitraryExtensions": true, clear /* Enable importing files with any extension, provided a declaration file is present. */
48
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
49
+
50
+ /* JavaScript Support */
51
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
52
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
53
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
54
+
55
+ /* Emit */
56
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
57
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
58
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
59
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
60
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
61
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
62
+ // "outDir": "./development", /* Specify an output folder for all emitted files. */
63
+ // "removeComments": true, /* Disable emitting comments. */
64
+ "noEmit": true, /* Disable emitting files from a compilation. */
65
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
66
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
67
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
68
+ // "sourceRoot": "./src", /* Specify the root path for debuggers to find the reference source code. */
69
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
70
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
71
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
72
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
73
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
74
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
75
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
76
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
77
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
78
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
79
+
80
+ /* Interop Constraints */
81
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
82
+ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
83
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
84
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
85
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
86
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
87
+
88
+ /* Type Checking */
89
+ "strict": true, /* Enable all strict type-checking options. */
90
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
91
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
92
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
93
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
94
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
95
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
96
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
97
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
98
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
99
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
100
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
101
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
102
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
103
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
104
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
105
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
106
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
107
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
108
+
109
+ /* Completeness */
110
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
111
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
112
+ }
113
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M576 256C576 305 502.1 336 464.2 336H382.2L282.4 496C276.4 506 266.4 512 254.4 512H189.5C179.5 512 169.5 508 163.5 500C157.6 492 155.6 480.1 158.6 471L201.5 336H152.5L113.6 388C107.6 396 98.61 400 88.62 400H31.7C22.72 400 12.73 396 6.74 388C.7485 380-1.248 370 1.747 360L31.7 256L.7488 152C-1.248 143 .7488 133 6.74 125C12.73 117 22.72 112 31.7 112H88.62C98.61 112 107.6 117 113.6 125L152.5 176H201.5L158.6 41C155.6 32 157.6 21 163.5 13C169.5 5 179.5 0 189.5 0H254.4C265.4 0 277.4 7 281.4 16L381.2 176H463.2C502.1 176 576 208 576 256H576zM527.1 256C525.1 246 489.1 224 463.2 224H355.3L245.4 48H211.5L266.4 224H128.6L80.63 160H53.67L81.63 256L53.67 352H80.63L128.6 288H266.4L211.5 464H245.4L355.3 288H463.2C490.1 288 526.1 267 527.1 256V256z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.2.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M482.3 192c34.2 0 93.7 29 93.7 64c0 36-59.5 64-93.7 64l-116.6 0L265.2 495.9c-5.7 10-16.3 16.1-27.8 16.1l-56.2 0c-10.6 0-18.3-10.2-15.4-20.4l49-171.6L112 320 68.8 377.6c-3 4-7.8 6.4-12.8 6.4l-42 0c-7.8 0-14-6.3-14-14c0-1.3 .2-2.6 .5-3.9L32 256 .5 145.9c-.4-1.3-.5-2.6-.5-3.9c0-7.8 6.3-14 14-14l42 0c5 0 9.8 2.4 12.8 6.4L112 192l102.9 0-49-171.6C162.9 10.2 170.6 0 181.2 0l56.2 0c11.5 0 22.1 6.2 27.8 16.1L365.7 192l116.6 0z"/></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supersoniks/concorde",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "",
File without changes
@@ -2,8 +2,8 @@
2
2
  /* eslint no-async-promise-executor: 0 */ // --> OFF
3
3
  import HTML from "@supersoniks/concorde/core/utils/HTML";
4
4
  import Objects from "@supersoniks/concorde/core/utils/Objects";
5
- import {CoreJSType} from "@supersoniks/concorde/core/_types/types";
6
- import {PublisherManager} from "./PublisherProxy";
5
+ import { CoreJSType } from "@supersoniks/concorde/core/_types/types";
6
+ import { PublisherManager } from "./PublisherProxy";
7
7
 
8
8
  export type APIConfiguration = {
9
9
  serviceURL: string | null;
@@ -19,7 +19,10 @@ export type APIConfiguration = {
19
19
  cache?: RequestCache;
20
20
  };
21
21
  export type CallState = "loading" | "done" | "error" | undefined;
22
- export type ResultTypeInterface = CoreJSType & {_sonic_http_response_?: Response; text?: string};
22
+ export type ResultTypeInterface = CoreJSType & {
23
+ _sonic_http_response_?: Response;
24
+ text?: string;
25
+ };
23
26
  export type APICall = {
24
27
  apiMethod: "get" | "send" | "submitFormData";
25
28
  path: string;
@@ -66,7 +69,9 @@ class API {
66
69
  }
67
70
  get token() {
68
71
  // si le token est marqué invalide, on utilise utilise la dernière version valide connue du token pour ce serviceURL
69
- return API.invalidTokens.includes(this._token) ? API.tokens.get(this.serviceURL) : this._token;
72
+ return API.invalidTokens.includes(this._token)
73
+ ? API.tokens.get(this.serviceURL)
74
+ : this._token;
70
75
  }
71
76
  /**
72
77
  * Le endPoint pour obtenir le bearer token qui sera concaténé à l'url du service
@@ -135,7 +140,10 @@ class API {
135
140
  this.credentials = config.credentials;
136
141
  this.cache = config.cache || "default";
137
142
  }
138
- async handleResult(fetchResult: Response, lastCall: APICall): Promise<ResultTypeInterface> {
143
+ async handleResult(
144
+ fetchResult: Response,
145
+ lastCall: APICall
146
+ ): Promise<ResultTypeInterface> {
139
147
  API.firstCallDoneFlags.set(this.serviceURL, "done");
140
148
  this.lastResult = fetchResult;
141
149
  const contentType = fetchResult.headers.get("content-type")?.toLowerCase();
@@ -144,7 +152,7 @@ class API {
144
152
  let result: ResultTypeInterface = {};
145
153
  if (!contentType || contentType.indexOf("text/") == 0) {
146
154
  const str = await fetchResult.text();
147
- result = {text: str} as typeof result;
155
+ result = { text: str } as typeof result;
148
156
  } else {
149
157
  try {
150
158
  result = await fetchResult.json();
@@ -159,9 +167,17 @@ class API {
159
167
  if (httpCode === 498 && !API.failledTokenUpdates.has(this.serviceURL)) {
160
168
  this.handleInvalidToken(this.token);
161
169
  if (lastCall.apiMethod === "get") {
162
- result = await this[lastCall.apiMethod](lastCall.path, lastCall.additionalHeaders);
170
+ result = await this[lastCall.apiMethod](
171
+ lastCall.path,
172
+ lastCall.additionalHeaders
173
+ );
163
174
  } else {
164
- result = await this[lastCall.apiMethod](lastCall.path, lastCall.data, lastCall.method, lastCall.additionalHeaders);
175
+ result = await this[lastCall.apiMethod](
176
+ lastCall.path,
177
+ lastCall.data,
178
+ lastCall.method,
179
+ lastCall.additionalHeaders
180
+ );
165
181
  }
166
182
  }
167
183
 
@@ -182,7 +198,11 @@ class API {
182
198
  let headers = {};
183
199
  if (this.userName && this.password) {
184
200
  headers = {
185
- Authorization: "Basic " + window.btoa(unescape(encodeURIComponent(this.userName + ":" + this.password))),
201
+ Authorization:
202
+ "Basic " +
203
+ window.btoa(
204
+ unescape(encodeURIComponent(this.userName + ":" + this.password))
205
+ ),
186
206
  };
187
207
  } else if (this.authToken) {
188
208
  headers = {
@@ -192,10 +212,15 @@ class API {
192
212
 
193
213
  const serviceURL = new URL(this.serviceURL as string);
194
214
  const serviceHost = serviceURL.protocol + "//" + serviceURL.host;
195
- const result = await fetch(this.computeURL(this.tokenProvider as string, {serviceHost: serviceHost}), {
196
- headers: headers,
197
- credentials: this.credentials,
198
- });
215
+ const result = await fetch(
216
+ this.computeURL(this.tokenProvider as string, {
217
+ serviceHost: serviceHost,
218
+ }),
219
+ {
220
+ headers: headers,
221
+ credentials: this.credentials,
222
+ }
223
+ );
199
224
 
200
225
  try {
201
226
  const json = await result.json();
@@ -221,7 +246,6 @@ class API {
221
246
  async localGet<T>(dataProvider: string, searchString: string) {
222
247
  const publisher = PublisherManager.get(dataProvider);
223
248
 
224
- console.log(publisher);
225
249
  const searchParams = new URLSearchParams(searchString.split("?")[1] || "");
226
250
  const dataObject = publisher.get();
227
251
  let data = [];
@@ -248,18 +272,21 @@ class API {
248
272
  searchParams.delete("limit");
249
273
  searchParams.delete("offset");
250
274
  }
251
- if (searchParams.size === 0) return data.slice(offset, offset + limit) as T & ResultTypeInterface;
275
+ if (searchParams.size === 0)
276
+ return data.slice(offset, offset + limit) as T & ResultTypeInterface;
252
277
  for (const [key, value] of searchParams.entries()) {
253
278
  const values = value.split(",").map((s) => s.trim());
254
279
  for (const v of values) {
255
280
  for (const item of data) {
256
281
  //si l'item est une valeur primitive on regarde si vaue correspond à item simplement
257
282
  if (typeof item !== "object") {
258
- if (!isNaN(+value)) {
259
- if (item == value) {
283
+ if (!isNaN(+item)) {
284
+ if (item === value) {
260
285
  result.push(item);
261
286
  }
262
- } else if (item.toString().includes(value)) {
287
+ } else if (
288
+ item.toString().toLowerCase().includes(value.toLowerCase())
289
+ ) {
263
290
  result.push(item);
264
291
  }
265
292
  } else {
@@ -269,12 +296,14 @@ class API {
269
296
  if (!record[key]) continue;
270
297
 
271
298
  //si la valeur est un nombre, on compare les valeurs directement
272
- if (!isNaN(+v)) {
273
- if (record[key] == v) {
299
+ if (!isNaN(+(record[key] as string))) {
300
+ if (record[key] === v) {
274
301
  result.push(item);
275
302
  }
276
303
  } else {
277
- if (record[key]?.toString().toLowerCase().includes(v.toLowerCase())) {
304
+ if (
305
+ record[key]?.toString().toLowerCase().includes(v.toLowerCase())
306
+ ) {
278
307
  result.push(item);
279
308
  }
280
309
  }
@@ -295,7 +324,11 @@ class API {
295
324
  resolve(true);
296
325
  } else {
297
326
  const loop = () => {
298
- if (![undefined, "loading"].includes(API.firstCallDoneFlags.get(this.serviceURL))) {
327
+ if (
328
+ ![undefined, "loading"].includes(
329
+ API.firstCallDoneFlags.get(this.serviceURL)
330
+ )
331
+ ) {
299
332
  resolve(true);
300
333
  } else {
301
334
  window.requestAnimationFrame(loop);
@@ -331,7 +364,11 @@ class API {
331
364
  if (!API.loadingGetPromises.has(mapKey)) {
332
365
  const promise = new Promise(async (resolve) => {
333
366
  try {
334
- const result = await fetch(url, {headers: headers, credentials: this.credentials, cache: this.cache});
367
+ const result = await fetch(url, {
368
+ headers: headers,
369
+ credentials: this.credentials,
370
+ cache: this.cache,
371
+ });
335
372
  const handledResult = await this.handleResult(result, lastCall);
336
373
  resolve(handledResult);
337
374
  } catch (e) {
@@ -380,7 +417,12 @@ class API {
380
417
  /*
381
418
  * Envoie des données au endPoint passé en paramètre. par défaut en POST
382
419
  */
383
- async send<T, SendType = CoreJSType>(path: string, data: SendType, method = "POST", additionalHeaders?: HeadersInit) {
420
+ async send<T, SendType = CoreJSType>(
421
+ path: string,
422
+ data: SendType,
423
+ method = "POST",
424
+ additionalHeaders?: HeadersInit
425
+ ) {
384
426
  const lastCall: APICall = {
385
427
  apiMethod: "send",
386
428
  path: path,
@@ -398,13 +440,19 @@ class API {
398
440
  method: method,
399
441
  body: JSON.stringify(data),
400
442
  });
401
- return (await this.handleResult(result, lastCall)) as T & ResultTypeInterface;
443
+ return (await this.handleResult(result, lastCall)) as T &
444
+ ResultTypeInterface;
402
445
  }
403
446
 
404
447
  /**
405
448
  * Agit comme une soumission de formulaire, mais attends un json en réponse
406
449
  */
407
- async submitFormData<T, SendType = CoreJSType>(path: string, data: SendType, method = "POST", additionalHeaders?: HeadersInit) {
450
+ async submitFormData<T, SendType = CoreJSType>(
451
+ path: string,
452
+ data: SendType,
453
+ method = "POST",
454
+ additionalHeaders?: HeadersInit
455
+ ) {
408
456
  const lastCall: APICall = {
409
457
  apiMethod: "submitFormData",
410
458
  path: path,
@@ -415,7 +463,7 @@ class API {
415
463
  const headers = await this.createHeaders(additionalHeaders);
416
464
  headers["Accept"] = "application/json";
417
465
  const formData = new FormData();
418
- const dynamicData = data as unknown as {[property: string]: string};
466
+ const dynamicData = data as unknown as { [property: string]: string };
419
467
  for (const z in dynamicData) formData.set(z, dynamicData[z]);
420
468
  const result = await fetch(this.computeURL(path), {
421
469
  headers: headers,
@@ -423,33 +471,50 @@ class API {
423
471
  method: method,
424
472
  body: formData,
425
473
  });
426
- return (await this.handleResult(result, lastCall)) as T & ResultTypeInterface;
474
+ return (await this.handleResult(result, lastCall)) as T &
475
+ ResultTypeInterface;
427
476
  }
428
477
 
429
478
  /**
430
479
  * Appel send en utilisant le méthode PUT
431
480
  */
432
- async put<T, SendType = CoreJSType>(path: string, data: SendType, additionalHeaders?: HeadersInit) {
481
+ async put<T, SendType = CoreJSType>(
482
+ path: string,
483
+ data: SendType,
484
+ additionalHeaders?: HeadersInit
485
+ ) {
433
486
  return this.send<T, SendType>(path, data, "PUT", additionalHeaders);
434
487
  }
435
488
 
436
489
  /**
437
490
  * Appel send en utilisant le méthode POST
438
491
  */
439
- async post<T, SendType = CoreJSType>(path: string, data: SendType, additionalHeaders?: HeadersInit) {
492
+ async post<T, SendType = CoreJSType>(
493
+ path: string,
494
+ data: SendType,
495
+ additionalHeaders?: HeadersInit
496
+ ) {
440
497
  return this.send<T, SendType>(path, data, "POST", additionalHeaders);
441
498
  }
442
499
  /**
443
500
  * Appel send en utilisant le méthode PATCH
444
501
  */
445
- async patch<T, SendType = CoreJSType>(path: string, data: SendType, additionalHeaders?: HeadersInit) {
502
+ async patch<T, SendType = CoreJSType>(
503
+ path: string,
504
+ data: SendType,
505
+ additionalHeaders?: HeadersInit
506
+ ) {
446
507
  return this.send<T, SendType>(path, data, "PATCH", additionalHeaders);
447
508
  }
448
509
 
449
510
  /**
450
511
  * Appel send en utilisant le méthode delete
451
512
  */
452
- async delete<T, SendType = CoreJSType>(path: string, data: SendType, additionalHeaders?: HeadersInit) {
513
+ async delete<T, SendType = CoreJSType>(
514
+ path: string,
515
+ data: SendType,
516
+ additionalHeaders?: HeadersInit
517
+ ) {
453
518
  return this.send<T, SendType>(path, data, "delete", additionalHeaders);
454
519
  }
455
520
  }
File without changes