@bexis2/bexis2-core-ui 0.4.103 → 0.4.104

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,10 @@
1
1
  # bexis-core-ui
2
+ ## 0.4.104
3
+ - Description
4
+ - always return description from input container
5
+ - Big table
6
+ - add DB put, delete and replace
7
+
2
8
  ## 0.4.103
3
9
  - Big Table
4
10
  - fix DB communication
@@ -8,27 +14,32 @@
8
14
  - add integerOnly flag to prevent add numbers instead of integers
9
15
 
10
16
  ## 0.4.101
17
+
18
+ - NumericInput
19
+ - add integerOnly flag to prevent add numbers instead of integers
11
20
  - Checkbox
12
21
  - fix layout
13
22
 
14
23
  ## 0.4.100
24
+
15
25
  - Big Table
16
26
  - support DB changes
17
27
 
18
28
  ## 0.4.99
29
+
19
30
  - Support label and titel in each form component
20
31
 
21
32
  ## 0.4.98
22
- - Table:
23
- - fix column read detection
24
33
 
34
+ - Table:
35
+ - fix column read detection
25
36
 
26
37
  ## 0.4.97
38
+
27
39
  - Table:
28
40
  - handle 20 000+ rows client side
29
41
  - fix item count server side table not shown
30
42
 
31
-
32
43
  ## 0.4.96
33
44
 
34
45
  - 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();
@@ -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.104",
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();
@@ -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