@bexis2/bexis2-core-ui 0.4.103 → 0.4.105

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/README.md CHANGED
@@ -1,4 +1,14 @@
1
1
  # bexis-core-ui
2
+ ## 0.4.105
3
+ - Server Table
4
+ - fix missing values for floats are detected as integer (and converted to bigint)
5
+
6
+ ## 0.4.104
7
+ - Description
8
+ - always return description from input container
9
+ - Big table
10
+ - add DB put, delete and replace
11
+
2
12
  ## 0.4.103
3
13
  - Big Table
4
14
  - fix DB communication
@@ -8,27 +18,32 @@
8
18
  - add integerOnly flag to prevent add numbers instead of integers
9
19
 
10
20
  ## 0.4.101
21
+
22
+ - NumericInput
23
+ - add integerOnly flag to prevent add numbers instead of integers
11
24
  - Checkbox
12
25
  - fix layout
13
26
 
14
27
  ## 0.4.100
28
+
15
29
  - Big Table
16
30
  - support DB changes
17
31
 
18
32
  ## 0.4.99
33
+
19
34
  - Support label and titel in each form component
20
35
 
21
36
  ## 0.4.98
22
- - Table:
23
- - fix column read detection
24
37
 
38
+ - Table:
39
+ - fix column read detection
25
40
 
26
41
  ## 0.4.97
42
+
27
43
  - Table:
28
44
  - handle 20 000+ rows client side
29
45
  - fix item count server side table not shown
30
46
 
31
-
32
47
  ## 0.4.96
33
48
 
34
49
  - ServerSideTable
@@ -22,6 +22,13 @@ export default class ClientDB {
22
22
  clear(): Promise<void>;
23
23
  ensureIndex(columnName: any): Promise<void>;
24
24
  getByIndex(columnName: any, value: any): Promise<any>;
25
+ replace(records: any): Promise<{
26
+ tableId: any;
27
+ count: any;
28
+ }>;
25
29
  put(record: any): Promise<any>;
30
+ bulkPut(records: any): Promise<any[]>;
31
+ delete(key: any): Promise<any>;
32
+ bulkDelete(keys: any): Promise<void>;
26
33
  destroy(): void;
27
34
  }
@@ -326,6 +326,21 @@ export default class ClientDB {
326
326
  });
327
327
  }
328
328
 
329
+ async replace(records) {
330
+ await this._ensureDB();
331
+ await new Promise((resolve, reject) => {
332
+ const tx = this.db.transaction('rows', 'readwrite');
333
+ const store = tx.objectStore('rows');
334
+ store.clear();
335
+ for (let i = 0; i < records.length; i++) {
336
+ store.add({ __r: records[i] });
337
+ }
338
+ tx.oncomplete = () => resolve(undefined);
339
+ tx.onerror = () => reject(tx.error);
340
+ });
341
+ return { tableId: this.tableId, count: records.length };
342
+ }
343
+
329
344
  async put(record) {
330
345
  await this._ensureDB();
331
346
  return new Promise((resolve, reject) => {
@@ -337,6 +352,46 @@ export default class ClientDB {
337
352
  });
338
353
  }
339
354
 
355
+ async bulkPut(records) {
356
+ await this._ensureDB();
357
+ const keys = [];
358
+ await new Promise((resolve, reject) => {
359
+ const tx = this.db.transaction('rows', 'readwrite');
360
+ const store = tx.objectStore('rows');
361
+ for (let i = 0; i < records.length; i++) {
362
+ const req = store.put(records[i]);
363
+ req.onsuccess = () => keys.push(req.result);
364
+ }
365
+ tx.oncomplete = () => resolve(keys);
366
+ tx.onerror = () => reject(tx.error);
367
+ });
368
+ return keys;
369
+ }
370
+
371
+ async delete(key) {
372
+ await this._ensureDB();
373
+ return new Promise((resolve, reject) => {
374
+ const tx = this.db.transaction('rows', 'readwrite');
375
+ const store = tx.objectStore('rows');
376
+ const req = store.delete(key);
377
+ req.onsuccess = () => resolve(req.result);
378
+ req.onerror = () => reject(req.error);
379
+ });
380
+ }
381
+
382
+ async bulkDelete(keys) {
383
+ await this._ensureDB();
384
+ await new Promise((resolve, reject) => {
385
+ const tx = this.db.transaction('rows', 'readwrite');
386
+ const store = tx.objectStore('rows');
387
+ for (let i = 0; i < keys.length; i++) {
388
+ store.delete(keys[i]);
389
+ }
390
+ tx.oncomplete = () => resolve(undefined);
391
+ tx.onerror = () => reject(tx.error);
392
+ });
393
+ }
394
+
340
395
  destroy() {
341
396
  if (this.db) {
342
397
  this.db.close();
@@ -181,7 +181,9 @@ export const updateTable = async (pageSize, pageIndex, server, filters, data, se
181
181
  // If the parser thinks it's a number, but we have the raw source text
182
182
  if (context && context.source && typeof value === 'number') {
183
183
  // Check if the number exceeds JavaScript's safe integer limit
184
- if (!Number.isSafeInteger(value)) {
184
+ // and that the source is actually an integer (not a float or
185
+ // scientific-notation value like 1.79769313486232E+307)
186
+ if (/^-?\d+$/.test(context.source) && !Number.isSafeInteger(value)) {
185
187
  // Return it natively as a JavaScript BigInt (e.g., 9223372036854775806n)
186
188
  return BigInt(context.source);
187
189
  }
@@ -15,17 +15,13 @@ export function onMouseOver() {
15
15
  if (help) {
16
16
  helpStore.show(id);
17
17
  }
18
- if (description.length > 0) {
19
- dispatch("showDescription", { id, description });
20
- }
18
+ dispatch("showDescription", { id, description });
21
19
  }
22
20
  export function onMouseOut() {
23
21
  if (help) {
24
22
  helpStore.hide(id);
25
23
  }
26
- if (description.length > 0) {
27
- dispatch("hideDescription", { id });
28
- }
24
+ dispatch("hideDescription", { id });
29
25
  }
30
26
  </script>
31
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bexis2/bexis2-core-ui",
3
- "version": "0.4.103",
3
+ "version": "0.4.105",
4
4
  "private": false,
5
5
  "description": "Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).",
6
6
  "keywords": [
@@ -326,6 +326,21 @@ export default class ClientDB {
326
326
  });
327
327
  }
328
328
 
329
+ async replace(records) {
330
+ await this._ensureDB();
331
+ await new Promise((resolve, reject) => {
332
+ const tx = this.db.transaction('rows', 'readwrite');
333
+ const store = tx.objectStore('rows');
334
+ store.clear();
335
+ for (let i = 0; i < records.length; i++) {
336
+ store.add({ __r: records[i] });
337
+ }
338
+ tx.oncomplete = () => resolve(undefined);
339
+ tx.onerror = () => reject(tx.error);
340
+ });
341
+ return { tableId: this.tableId, count: records.length };
342
+ }
343
+
329
344
  async put(record) {
330
345
  await this._ensureDB();
331
346
  return new Promise((resolve, reject) => {
@@ -337,6 +352,46 @@ export default class ClientDB {
337
352
  });
338
353
  }
339
354
 
355
+ async bulkPut(records) {
356
+ await this._ensureDB();
357
+ const keys = [];
358
+ await new Promise((resolve, reject) => {
359
+ const tx = this.db.transaction('rows', 'readwrite');
360
+ const store = tx.objectStore('rows');
361
+ for (let i = 0; i < records.length; i++) {
362
+ const req = store.put(records[i]);
363
+ req.onsuccess = () => keys.push(req.result);
364
+ }
365
+ tx.oncomplete = () => resolve(keys);
366
+ tx.onerror = () => reject(tx.error);
367
+ });
368
+ return keys;
369
+ }
370
+
371
+ async delete(key) {
372
+ await this._ensureDB();
373
+ return new Promise((resolve, reject) => {
374
+ const tx = this.db.transaction('rows', 'readwrite');
375
+ const store = tx.objectStore('rows');
376
+ const req = store.delete(key);
377
+ req.onsuccess = () => resolve(req.result);
378
+ req.onerror = () => reject(req.error);
379
+ });
380
+ }
381
+
382
+ async bulkDelete(keys) {
383
+ await this._ensureDB();
384
+ await new Promise((resolve, reject) => {
385
+ const tx = this.db.transaction('rows', 'readwrite');
386
+ const store = tx.objectStore('rows');
387
+ for (let i = 0; i < keys.length; i++) {
388
+ store.delete(keys[i]);
389
+ }
390
+ tx.oncomplete = () => resolve(undefined);
391
+ tx.onerror = () => reject(tx.error);
392
+ });
393
+ }
394
+
340
395
  destroy() {
341
396
  if (this.db) {
342
397
  this.db.close();
@@ -230,7 +230,9 @@ export const updateTable = async (
230
230
  // If the parser thinks it's a number, but we have the raw source text
231
231
  if (context && context.source && typeof value === 'number') {
232
232
  // Check if the number exceeds JavaScript's safe integer limit
233
- if (!Number.isSafeInteger(value)) {
233
+ // and that the source is actually an integer (not a float or
234
+ // scientific-notation value like 1.79769313486232E+307)
235
+ if (/^-?\d+$/.test(context.source) && !Number.isSafeInteger(value)) {
234
236
  // Return it natively as a JavaScript BigInt (e.g., 9223372036854775806n)
235
237
  return BigInt(context.source);
236
238
  }
@@ -19,20 +19,14 @@
19
19
  if (help) {
20
20
  helpStore.show(id);
21
21
  }
22
- if (description.length > 0) {
23
- // dispatch an event to show the description
24
- dispatch('showDescription', { id, description });
25
- }
22
+ dispatch('showDescription', { id, description });
26
23
  }
27
24
 
28
25
  export function onMouseOut() {
29
26
  if (help) {
30
27
  helpStore.hide(id);
31
28
  }
32
- if (description.length > 0) {
33
- // dispatch an event to hide the description
34
- dispatch('hideDescription', { id });
35
- }
29
+ dispatch('hideDescription', { id });
36
30
  }
37
31
  </script>
38
32