@base-framework/organisms 1.0.28 → 1.0.30
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 +44 -79
- package/dist/organisms.js +1 -1
- package/dist/organisms.js.map +4 -4
- package/dist/types/organisms.d.ts +2 -1
- package/dist/types/time/dynamic-time.d.ts +30 -0
- package/dist/types/utils/timer.d.ts +55 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Base
|
|
1
|
+
# Base Organisms
|
|
2
2
|
|
|
3
3
|
**Version**: 1.0.0
|
|
4
4
|
|
|
@@ -7,40 +7,60 @@ This documentation aims to guide the enhancement of component scalability and re
|
|
|
7
7
|
|
|
8
8
|
This module will add default organisms to your project.
|
|
9
9
|
|
|
10
|
-
##
|
|
11
|
-
|
|
10
|
+
## Atomic Design
|
|
11
|
+
If you need to learn about atomic design, please refer to the [Atomic Design](https://bradfrost.com/blog/post/atomic-web-design/) documentation.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
Organisms can be composed of various atoms and reused across different components. This promotes a modular approach to building user interfaces.
|
|
13
|
+
To learn more about Base framework or how to build atoms, refer to the [Base](https://github.com/chrisdurfee/base/wiki) documentation.
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
Organisms can be
|
|
18
|
-
|
|
19
|
-
### Function Oragnisms
|
|
20
|
-
These atoms are instantiated with either standard functions or arrow functions, equipped with a props object to transfer properties to the atoms.
|
|
15
|
+
### Oragnism Structure
|
|
16
|
+
Organisms can be created using atoms, other organisms, and components. Atoms are the smallest building blocks of a component, while components are composed of atoms and other components. Organisms are a collection of atoms and components that form a larger structure.
|
|
21
17
|
|
|
22
18
|
```typescript
|
|
19
|
+
// Atom
|
|
20
|
+
const Link = Atom((props, children) => ({
|
|
21
|
+
...props,
|
|
22
|
+
children,
|
|
23
|
+
tag: 'a',
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
// Organism Atom
|
|
23
27
|
const Link = Atom((props, children) => (
|
|
24
|
-
|
|
28
|
+
Link({...props }, [
|
|
25
29
|
Icon({ class: 'icon' }),
|
|
26
30
|
children
|
|
27
31
|
])
|
|
28
32
|
));
|
|
29
|
-
```
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
// Organism Atom with Component
|
|
35
|
+
const Link = Atom((props, children) => (
|
|
36
|
+
Nav([
|
|
37
|
+
Ul([
|
|
38
|
+
Li([
|
|
39
|
+
Link([
|
|
40
|
+
Icon({ class: 'icon' }),
|
|
41
|
+
Span('Text')
|
|
42
|
+
])
|
|
43
|
+
])
|
|
44
|
+
])
|
|
45
|
+
]),
|
|
46
|
+
new List({...props }, [
|
|
47
|
+
children
|
|
48
|
+
])
|
|
49
|
+
));
|
|
33
50
|
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
51
|
+
// Organism Function with Component
|
|
52
|
+
const List = (props, children) => Div([
|
|
53
|
+
Header([
|
|
54
|
+
H1('Title')
|
|
55
|
+
]),
|
|
56
|
+
new List({...props }, [
|
|
57
|
+
children
|
|
58
|
+
])
|
|
59
|
+
]);
|
|
40
60
|
```
|
|
41
61
|
|
|
42
|
-
####
|
|
43
|
-
|
|
62
|
+
#### Organisms Nesting
|
|
63
|
+
Organisms should use composition to nest other atoms, organisms, or components.
|
|
44
64
|
|
|
45
65
|
```typescript
|
|
46
66
|
const SecondaryButton = Atom((props, children) => (Button({
|
|
@@ -50,36 +70,8 @@ const SecondaryButton = Atom((props, children) => (Button({
|
|
|
50
70
|
}));
|
|
51
71
|
```
|
|
52
72
|
|
|
53
|
-
##
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
### Accessing the Parent Component in an Atom
|
|
57
|
-
```typescript
|
|
58
|
-
class Page extends Component
|
|
59
|
-
{
|
|
60
|
-
render()
|
|
61
|
-
{
|
|
62
|
-
return Div([
|
|
63
|
-
SecondaryButton({
|
|
64
|
-
/**
|
|
65
|
-
* This will add a click event listener to the button.
|
|
66
|
-
*
|
|
67
|
-
* @param {Event} event The event object
|
|
68
|
-
* @param {Component} parent The parent component object
|
|
69
|
-
* @returns {void}
|
|
70
|
-
*/
|
|
71
|
-
click(event, parent) =>
|
|
72
|
-
{
|
|
73
|
-
// Code to access the parent component
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
]);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Utilization of Atoms
|
|
82
|
-
To leverage an atom, invoke its function and pass the requisite values via a props and children. The Atoms created with the Atom callback functions support passing optional props or children to the atom. The props object should always be first but if the atom does not require props, the children array or string can be passed as the first argument.
|
|
73
|
+
## Utilization of Organisms
|
|
74
|
+
To leverage an organism, invoke its function and pass the requisite values via a props and children. The organisms created with the Atom callback functions support passing optional props or children to the atom. The props object should always be first but if the atom does not require props, the children array or string can be passed as the first argument.
|
|
83
75
|
|
|
84
76
|
```javascript
|
|
85
77
|
// props only
|
|
@@ -112,30 +104,3 @@ SecondaryButton({
|
|
|
112
104
|
}
|
|
113
105
|
})
|
|
114
106
|
```
|
|
115
|
-
|
|
116
|
-
The implementation of atoms is aimed at enhancing the readability and modularity of extensive layouts.
|
|
117
|
-
|
|
118
|
-
### Illustrative Example of a Complex Layout
|
|
119
|
-
```typescript
|
|
120
|
-
Section([
|
|
121
|
-
Article({ class: 'post' }, [
|
|
122
|
-
Header([
|
|
123
|
-
H1('Title')
|
|
124
|
-
])
|
|
125
|
-
])
|
|
126
|
-
])
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
## Contributing
|
|
130
|
-
|
|
131
|
-
Contributions to Base Framework are welcome. Follow these steps to contribute:
|
|
132
|
-
|
|
133
|
-
- Fork the repository.
|
|
134
|
-
- Create a new branch for your feature or bug fix.
|
|
135
|
-
- Commit your changes with clear, descriptive messages.
|
|
136
|
-
- Push your branch and submit a pull request.
|
|
137
|
-
- Before contributing, read our CONTRIBUTING.md for coding standards and community guidelines.
|
|
138
|
-
|
|
139
|
-
## License
|
|
140
|
-
|
|
141
|
-
Base Atoms are licensed under the MIT License. See the LICENSE file for details.
|
package/dist/organisms.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Div as
|
|
1
|
+
import{Div as w}from"@base-framework/atoms";import{Data as I,Jot as v}from"@base-framework/base";import{Builder as f,Html as k}from"@base-framework/base";var a=class{static first(t){return this.get(t,0)}static last(t){let e=t.childNodes.length-1;return this.get(t,e)}static get(t,e){return t?.childNodes[e]??null}static next(t){return t?.nextSibling??null}static previous(t){return t?.previousSibling??null}static index(t){if(!t||!t.parentNode)return-1;let e=t.parentNode.children;return Array.from(e).indexOf(t)}static getPreviousIndex(t){let e=this.index(t);return e>0?e-1:0}static replace(t,e,r){if(!e)return;let i=e.parentNode,n=this.getPreviousIndex(e);this.remove(e);let c=f.build(t,null,r);i.insertBefore(c,i.childNodes[n])}static remove(t){t&&k.removeChild(t)}static append(t,e,r){!t||f.build(t,e,r)}static prepend(t,e,r){if(!t)return;let i=f.build(t,null,r);e.insertBefore(i,e.firstChild)}};var p=(s,t,e)=>({index:s,item:t,status:e}),l=class{static diff(t,e,r){let i=this.arrayToMap(t,r),n=[],c=[];return e.forEach((o,d)=>{let u=o[r];if(!i.has(u)){n.push(p(d,o,"added"));return}let{item:x}=i.get(u);if(!this.deepEqual(x,o)){n.push(p(d,o,"updated"));return}n.push(p(d,o,"unchanged")),i.delete(u)}),i.forEach(({item:o})=>{c.push(o)}),{changes:n,deletedItems:c}}static arrayToMap(t,e){let r=new Map;return t.forEach((i,n)=>{r.set(i[e],{item:i,index:n})}),r}static deepEqual(t,e){if(t===e)return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;let r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(let n of r)if(!i.includes(n)||!this.deepEqual(t[n],e[n]))return!1;return!0}};var B=v({setData(){return new I({items:this.items??[]})},render(){let s=this.row.bind(this);return w({class:`list ${this.class||""}`,for:["items",s]})},row(s){return typeof this.rowItem!="function"?null:this.rowItem(s)},delete(s){let t=this.findIndexByKey(s);if(t===-1)return;this.data.delete(`items[${t}]`);let e=a.get(this.panel,t);a.remove(e)},replace(s){if(s.status==="unchanged")return;let t=s.item;if(s.status==="added"){this.append(t);return}let e=t[this.key],r=this.findIndexByKey(e);if(r===-1)return;this.data.set(`items[${r}]`,t);let i=a.get(this.panel,r),n=this.row(t,r);a.replace(n,i,this)},remove(s){s.forEach(t=>{this.delete(t[this.key])})},append(s){Array.isArray(s)||(s=[s]);let t=[],e=this.data.items.length-1;s.forEach(r=>{t.push(this.row(r)),this.data.set(`items[${++e}]`,r)}),a.append(t,this.panel,this)},mingle(s,t=!1){let e=this.data.get("items"),r=l.diff(e,s,this.key);t&&r.deletedItems.length>0&&this.remove(r.deletedItems),r.changes.forEach(i=>{this.replace(i)})},prepend(s){Array.isArray(s)||(s=[s]);let t=[],e=s.reverse();e.forEach(i=>{t.push(this.row(i))});let r=e.concat(this.data.get("items"));this.data.stage.items=r,a.prepend(t,this.panel,this)},findIndexByKey(s){return this.data.items.findIndex(e=>e[this.key]===s)}});import{Span as E}from"@base-framework/atoms";import{Component as T,SimpleData as N}from"@base-framework/base";var m=class{constructor(t,e){this.timer=null,this.callBack=e,this.duration=t||1e3}createTimer(t){this.timer=window.setTimeout(t,this.duration)}start(){this.stop();let t=this.returnCallBack.bind(this);this.createTimer(t)}stop(){window.clearTimeout(this.timer)}returnCallBack(){let t=this.callBack;typeof t=="function"&&t.call()}},h=class extends m{createTimer(t){this.timer=window.setInterval(t,this.duration)}stop(){window.clearInterval(this.timer)}};var y=new N({date:0}),A=6e4,D=new h(A,()=>{y.increment("date")});D.start();var g=class extends T{setData(){return y}render(){return E({class:this.class,text:this.getTime(),onSet:["date",()=>this.getTime()]})}getTime(){let t=this.dateTime;return this.filter?this.filter(t):t}};export{g as DynamicTime,B as List};
|
|
2
2
|
//# sourceMappingURL=organisms.js.map
|
package/dist/organisms.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/lists/list.js", "../src/utils/child-helper.js", "../src/utils/data-helper.js"],
|
|
4
|
-
"sourcesContent": ["import { Div } from '@base-framework/atoms';\r\nimport { Data, Jot } from '@base-framework/base';\r\nimport { ChildHelper } from 'src/utils/child-helper.js';\r\nimport { DataHelper } from 'src/utils/data-helper.js';\r\n\r\n/**\r\n * List\r\n *\r\n * This will create a list component.\r\n *\r\n * @class\r\n */\r\nexport const List = Jot(\r\n{\r\n /**\r\n * This will set the default data.\r\n *\r\n * @returns {object}\r\n */\r\n\tsetData()\r\n {\r\n // @ts-ignore\r\n return new Data({ items: this.items ?? [] })\r\n },\r\n\r\n /**\r\n * This will render the list.\r\n *\r\n * @returns {object}\r\n */\r\n\trender()\r\n {\r\n // @ts-ignore\r\n const rowCallBack = this.row.bind(this);\r\n\r\n return Div({\r\n // @ts-ignore\r\n class: `list ${this.class || ''}`,\r\n for: ['items', rowCallBack]\r\n });\r\n },\r\n\r\n /**\r\n * This will create a row for each item.\r\n *\r\n * @param {*} item\r\n * @returns {object|null}\r\n */\r\n row(item)\r\n {\r\n // @ts-ignore\r\n if (typeof this.rowItem !== 'function')\r\n {\r\n return null;\r\n }\r\n\r\n // @ts-ignore\r\n return this.rowItem(item);\r\n },\r\n\r\n /**\r\n * This will delete an item from the list.\r\n *\r\n * @public\r\n * @param {*} keyValue\r\n * @returns {void}\r\n */\r\n delete(keyValue)\r\n {\r\n // @ts-ignore\r\n const index = this.findIndexByKey(keyValue);\r\n if (index === -1)\r\n {\r\n return;\r\n }\r\n\r\n // @ts-ignore\r\n this.data.delete(`items[${index}]`);\r\n // @ts-ignore\r\n const rowElement = ChildHelper.get(this.panel, index);\r\n ChildHelper.remove(rowElement);\r\n },\r\n\r\n /**\r\n * This will replace an item in the list.\r\n *\r\n * @protected\r\n * @param {object} row\r\n * @returns {void}\r\n */\r\n replace(row)\r\n {\r\n if (row.status === 'unchanged')\r\n {\r\n return;\r\n }\r\n\r\n // @ts-ignore\r\n const item = row.item;\r\n if (row.status === 'added')\r\n {\r\n // @ts-ignore\r\n this.append(item);\r\n return;\r\n }\r\n\r\n // @ts-ignore\r\n const keyValue = item[this.key];\r\n // @ts-ignore\r\n const index = this.findIndexByKey(keyValue);\r\n if (index === -1)\r\n {\r\n return;\r\n }\r\n\r\n // @ts-ignore\r\n this.data.set(`items[${index}]`, item);\r\n // @ts-ignore\r\n const oldRow = ChildHelper.get(this.panel, index);\r\n // @ts-ignore\r\n const layout = this.row(item, index);\r\n ChildHelper.replace(layout, oldRow, this);\r\n },\r\n\r\n /**\r\n * This will remove items from the list.\r\n *\r\n * @public\r\n * @param {array} items\r\n * @returns {void}\r\n */\r\n remove(items)\r\n {\r\n /**\r\n * This will get the deleted rows.\r\n */\r\n items.forEach((item) =>\r\n {\r\n // @ts-ignore\r\n this.delete(item[this.key]);\r\n });\r\n },\r\n\r\n /**\r\n * This will append items to the list.\r\n *\r\n * @public\r\n * @param {array|object} items\r\n * @returns {void}\r\n */\r\n append(items)\r\n {\r\n if (!Array.isArray(items))\r\n {\r\n items = [items];\r\n }\r\n\r\n /**\r\n * This will get all the new rows to be batched later.\r\n */\r\n const rows = [];\r\n // @ts-ignore\r\n let lastIndex = this.data.items.length - 1;\r\n items.forEach((item) =>\r\n {\r\n /**\r\n * This will build the new rows that will be appended.\r\n */\r\n // @ts-ignore\r\n rows.push(this.row(item));\r\n\r\n /**\r\n * This will silently add the new rows without re-rendering the entire list.\r\n */\r\n // @ts-ignore\r\n this.data.set(`items[${++lastIndex}]`, item);\r\n });\r\n\r\n // This will batch push all the rows.\r\n // @ts-ignore\r\n ChildHelper.append(rows, this.panel, this);\r\n },\r\n\r\n /**\r\n * This will mingle the new items with the old items.\r\n *\r\n * @public\r\n * @param {Array<Object>} newItems\r\n * @param {boolean} withDelete\r\n * @returns {void}\r\n */\r\n mingle(newItems, withDelete = false)\r\n {\r\n // @ts-ignore\r\n const oldItems = this.data.items;\r\n\r\n /**\r\n * This will diff the old and new items to determine what has\r\n * been added, updated, or deleted.\r\n */\r\n // @ts-ignore\r\n const changes = DataHelper.diff(oldItems, newItems, this.key);\r\n\r\n /**\r\n * We want to delete the items before adding and updating the\r\n * new items.\r\n */\r\n if (withDelete && changes.deletedItems.length > 0)\r\n {\r\n // @ts-ignore\r\n this.remove(changes.deletedItems);\r\n }\r\n\r\n /**\r\n * This will add or update the new rows.\r\n */\r\n changes.changes.forEach((row) =>\r\n {\r\n // @ts-ignore\r\n this.replace(row);\r\n });\r\n },\r\n\r\n /**\r\n * This will prepend items to the list.\r\n *\r\n * @public\r\n * @param {array|object} items\r\n * @returns {void}\r\n */\r\n prepend(items)\r\n {\r\n if (!Array.isArray(items))\r\n {\r\n items = [items];\r\n }\r\n\r\n /**\r\n * This will get all the new rows to be batched later.\r\n */\r\n const rows = [];\r\n const reverseItems = items.reverse();\r\n reverseItems.forEach((item) =>\r\n {\r\n /**\r\n * This will build the new rows that will be appended.\r\n */\r\n // @ts-ignore\r\n rows.push(this.row(item));\r\n });\r\n\r\n /**\r\n * This will silently add the new rows without re-rendering the entire list.\r\n */\r\n // @ts-ignore\r\n this.data.stage.items = reverseItems.concat(this.data.items);\r\n\r\n // @ts-ignore\r\n ChildHelper.prepend(rows, this.panel, this);\r\n },\r\n\r\n /**\r\n * Finds the index of an item in the data array by its key.\r\n *\r\n * @private\r\n * @param {*} keyValue\r\n * @returns {number} Index of the item, or -1 if not found\r\n */\r\n findIndexByKey(keyValue)\r\n {\r\n //@ts-ignore\r\n const items = this.data.items;\r\n //@ts-ignore\r\n return items.findIndex((item) => item[this.key] === keyValue);\r\n }\r\n});", "import { Builder, Html } from \"@base-framework/base\";\r\n\r\n/**\r\n * ChildHelper\r\n *\r\n * This class will help with getting children of a node.\r\n *\r\n * @class\r\n */\r\nexport class ChildHelper\r\n{\r\n /**\r\n * This will get the first child.\r\n *\r\n * @param {object} parent\r\n * @returns {object|null}\r\n */\r\n\tstatic first(parent)\r\n {\r\n return this.get(parent, 0);\r\n }\r\n\r\n /**\r\n * This will get the last child.\r\n *\r\n * @param {object} parent\r\n * @returns {object|null}\r\n */\r\n static last(parent)\r\n {\r\n const index = parent.childNodes.length - 1;\r\n return this.get(parent, index);\r\n }\r\n\r\n /**\r\n * This will get the child at the specified index.\r\n *\r\n * @param {object} parent\r\n * @param {number} index\r\n * @returns {object|null}\r\n */\r\n static get(parent, index)\r\n {\r\n return parent?.childNodes[index] ?? null;\r\n }\r\n\r\n /**\r\n * This will get the parent of the node.\r\n *\r\n * @param {object} node\r\n * @returns {object|null}\r\n */\r\n static next(node)\r\n {\r\n return node?.nextSibling ?? null;\r\n }\r\n\r\n /**\r\n * This will get the previous sibling.\r\n *\r\n * @param {object} node\r\n * @returns {object|null}\r\n */\r\n static previous(node)\r\n {\r\n return node?.previousSibling ?? null;\r\n }\r\n\r\n /**\r\n * This will get the index of the node.\r\n *\r\n * @param {object} node\r\n * @returns {number}\r\n */\r\n static index(node)\r\n {\r\n if (!node || !node.parentNode)\r\n\t\t{\r\n return -1; // Return -1 if node or its parent doesn't exist\r\n }\r\n\r\n const children = node.parentNode.children;\r\n return Array.from(children).indexOf(node);\r\n }\r\n\r\n /**\r\n * This will get the previous index of the node.\r\n *\r\n * @param {object} node\r\n * @returns {number}\r\n */\r\n static getPreviousIndex(node)\r\n {\r\n let index = this.index(node);\r\n return (index > 0)? index - 1 : 0;\r\n }\r\n\r\n /**\r\n * This will replace a child layout.\r\n *\r\n * @param {object} layout\r\n * @param {object} oldChild\r\n * @param {object} parent\r\n * @returns {void}\r\n */\r\n static replace(layout, oldChild, parent)\r\n {\r\n if (!oldChild)\r\n {\r\n return;\r\n }\r\n\r\n // get child index from parent\r\n const container = oldChild.parentNode;\r\n const index = this.getPreviousIndex(oldChild);\r\n this.remove(oldChild);\r\n\r\n const frag = Builder.build(layout, null, parent);\r\n\r\n // append to parent at index\r\n container.insertBefore(frag, container.childNodes[index]);\r\n }\r\n\r\n /**\r\n * This will remove a child.\r\n *\r\n * @param {object} node\r\n * @returns {void}\r\n */\r\n static remove(node)\r\n {\r\n if (node)\r\n {\r\n Html.removeChild(node);\r\n }\r\n }\r\n\r\n /**\r\n * This will append a child layout.\r\n *\r\n * @param {object} childrenLayout\r\n * @param {object} container\r\n * @param {object} parent\r\n * @returns {void}\r\n */\r\n static append(childrenLayout, container, parent)\r\n {\r\n if (!childrenLayout)\r\n {\r\n return;\r\n }\r\n\r\n Builder.build(childrenLayout, container, parent);\r\n }\r\n\r\n /**\r\n * This will prepend a child layout.\r\n *\r\n * @param {object} childrenLayout\r\n * @param {object} container\r\n * @param {object} parent\r\n * @returns {void}\r\n */\r\n static prepend(childrenLayout, container, parent)\r\n {\r\n if (!childrenLayout)\r\n {\r\n return;\r\n }\r\n\r\n const frag = Builder.build(childrenLayout, null, parent);\r\n container.insertBefore(frag, container.firstChild);\r\n }\r\n}", "/**\r\n * This will create a new item.\r\n *\r\n * @param {number} index\r\n * @param {*} item\r\n * @param {string} status\r\n * @returns {object}\r\n */\r\nconst Item = (index, item, status) =>\r\n{\r\n\treturn {\r\n\t\tindex,\r\n\t\titem,\r\n\t\tstatus\r\n\t};\r\n};\r\n\r\n/**\r\n * DataHelper\r\n *\r\n * This will help with data manipulation.\r\n *\r\n * @class\r\n */\r\nexport class DataHelper\r\n{\r\n\t/**\r\n * Compares two arrays of objects and returns the differences based on a specified key.\r\n *\r\n * @param {Array<Object>} oldArray - The original array of objects.\r\n * @param {Array<Object>} newArray - The updated array of objects.\r\n * @param {string} key - The key used to compare objects in the arrays.\r\n * @returns {Object} An object containing arrays of added, updated, and deleted items.\r\n */\r\n\tstatic diff(oldArray, newArray, key)\r\n\t{\r\n\t\tconst oldItemsMap = this.arrayToMap(oldArray, key);\r\n\t\tconst changes = [];\r\n\t\tconst deletedItems = [];\r\n\r\n\t\t// Process new array to determine status of each item\r\n\t\tnewArray.forEach((newItem, newIndex) =>\r\n\t\t{\r\n\t\t\tconst keyValue = newItem[key];\r\n\t\t\tif (!oldItemsMap.has(keyValue))\r\n\t\t\t{\r\n\t\t\t\t// Item is added\r\n\t\t\t\tchanges.push(Item(newIndex, newItem, 'added'));\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconst { item: oldItem } = oldItemsMap.get(keyValue);\r\n\t\t\tif (!this.deepEqual(oldItem, newItem))\r\n\t\t\t{\r\n\t\t\t\t// Item is updated\r\n\t\t\t\tchanges.push(Item(newIndex, newItem, 'updated'));\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t// Item is unchanged\r\n\t\t\tchanges.push(Item(newIndex, newItem, 'unchanged'));\r\n\r\n\t\t\t// Remove from oldItemsMap to identify deletions later\r\n\t\t\toldItemsMap.delete(keyValue);\r\n\t\t});\r\n\r\n\t\t// Remaining items in oldItemsMap are deleted\r\n\t\toldItemsMap.forEach(({ item: oldItem }) =>\r\n\t\t{\r\n\t\t\tdeletedItems.push(oldItem);\r\n\t\t});\r\n\r\n\t\treturn {\r\n\t\t\tchanges,\r\n\t\t\tdeletedItems\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Converts an array of objects into a Map keyed by the specified property.\r\n * Each value in the Map is an object containing the item and its index in the array.\r\n\t *\r\n\t * @param {Array<Object>} array - The array to convert.\r\n\t * @param {string} key - The key used to map the objects.\r\n\t * @returns {Map} A Map with keys as specified property and values as objects.\r\n\t * @private\r\n\t */\r\n\tstatic arrayToMap(array, key)\r\n\t{\r\n\t\tconst map = new Map();\r\n\t\tarray.forEach((item, index) =>\r\n\t\t{\r\n\t\t\tmap.set(item[key], { item, index });\r\n\t\t});\r\n\t\treturn map;\r\n\t}\r\n\r\n\t/**\r\n\t * Performs a deep comparison between two objects.\r\n\t *\r\n\t * @param {Object} obj1 - The first object to compare.\r\n\t * @param {Object} obj2 - The second object to compare.\r\n\t * @returns {boolean} True if objects are equal, else false.\r\n\t * @private\r\n\t */\r\n\tstatic deepEqual(obj1, obj2)\r\n\t{\r\n\t\tif (obj1 === obj2) return true;\r\n\r\n\t\tif (\r\n\t\t\ttypeof obj1 !== 'object' ||\r\n\t\t\tobj1 === null ||\r\n\t\t\ttypeof obj2 !== 'object' ||\r\n\t\t\tobj2 === null\r\n\t\t)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tconst keys1 = Object.keys(obj1);\r\n\t\tconst keys2 = Object.keys(obj2);\r\n\r\n\t\t// Different number of properties\r\n\t\tif (keys1.length !== keys2.length)\r\n\t\t{\r\n\t\t\treturn false\r\n\t\t}\r\n\r\n\t\tfor (const key of keys1)\r\n\t\t{\r\n\t\t\tif (!keys2.includes(key))\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tif (!this.deepEqual(obj1[key], obj2[key]))\r\n\t\t\t{\r\n\t\t\t\treturn false\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}\r\n}"],
|
|
5
|
-
"mappings": "AAAA,OAAS,OAAAA,MAAW,wBACpB,OAAS,QAAAC,EAAM,OAAAC,MAAW,uBCD1B,OAAS,WAAAC,EAAS,QAAAC,MAAY,uBASvB,IAAMC,EAAN,KACP,CAOC,OAAO,MAAMC,EACV,CACI,OAAO,KAAK,IAAIA,EAAQ,CAAC,CAC7B,CAQA,OAAO,KAAKA,EACZ,CACI,IAAMC,EAAQD,EAAO,WAAW,OAAS,EACzC,OAAO,KAAK,IAAIA,EAAQC,CAAK,CACjC,CASA,OAAO,IAAID,EAAQC,EACnB,CACI,OAAOD,GAAQ,WAAWC,IAAU,IACxC,CAQA,OAAO,KAAKC,EACZ,CACI,OAAOA,GAAM,aAAe,IAChC,CAQA,OAAO,SAASA,EAChB,CACI,OAAOA,GAAM,iBAAmB,IACpC,CAQA,OAAO,MAAMA,EACb,CACI,GAAI,CAACA,GAAQ,CAACA,EAAK,WAEf,MAAO,GAGX,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
|
|
6
|
-
"names": ["Div", "Data", "Jot", "Builder", "Html", "ChildHelper", "parent", "index", "node", "children", "layout", "oldChild", "container", "frag", "childrenLayout", "Item", "index", "item", "status", "DataHelper", "oldArray", "newArray", "key", "oldItemsMap", "changes", "deletedItems", "newItem", "newIndex", "keyValue", "oldItem", "array", "map", "obj1", "obj2", "keys1", "keys2", "List", "Jot", "Data", "rowCallBack", "Div", "item", "keyValue", "index", "rowElement", "ChildHelper", "row", "oldRow", "layout", "items", "rows", "lastIndex", "newItems", "withDelete", "oldItems", "changes", "DataHelper", "reverseItems"]
|
|
3
|
+
"sources": ["../src/lists/list.js", "../src/utils/child-helper.js", "../src/utils/data-helper.js", "../src/time/dynamic-time.js", "../src/utils/timer.js"],
|
|
4
|
+
"sourcesContent": ["import { Div } from '@base-framework/atoms';\r\nimport { Data, Jot } from '@base-framework/base';\r\nimport { ChildHelper } from 'src/utils/child-helper.js';\r\nimport { DataHelper } from 'src/utils/data-helper.js';\r\n\r\n/**\r\n * List\r\n *\r\n * This will create a list component.\r\n *\r\n * @class\r\n */\r\nexport const List = Jot(\r\n{\r\n /**\r\n * This will set the default data.\r\n *\r\n * @returns {object}\r\n */\r\n\tsetData()\r\n {\r\n // @ts-ignore\r\n return new Data({ items: this.items ?? [] })\r\n },\r\n\r\n /**\r\n * This will render the list.\r\n *\r\n * @returns {object}\r\n */\r\n\trender()\r\n {\r\n // @ts-ignore\r\n const rowCallBack = this.row.bind(this);\r\n\r\n return Div({\r\n // @ts-ignore\r\n class: `list ${this.class || ''}`,\r\n for: ['items', rowCallBack]\r\n });\r\n },\r\n\r\n /**\r\n * This will create a row for each item.\r\n *\r\n * @param {*} item\r\n * @returns {object|null}\r\n */\r\n row(item)\r\n {\r\n // @ts-ignore\r\n if (typeof this.rowItem !== 'function')\r\n {\r\n return null;\r\n }\r\n\r\n // @ts-ignore\r\n return this.rowItem(item);\r\n },\r\n\r\n /**\r\n * This will delete an item from the list.\r\n *\r\n * @public\r\n * @param {*} keyValue\r\n * @returns {void}\r\n */\r\n delete(keyValue)\r\n {\r\n // @ts-ignore\r\n const index = this.findIndexByKey(keyValue);\r\n if (index === -1)\r\n {\r\n return;\r\n }\r\n\r\n // @ts-ignore\r\n this.data.delete(`items[${index}]`);\r\n // @ts-ignore\r\n const rowElement = ChildHelper.get(this.panel, index);\r\n ChildHelper.remove(rowElement);\r\n },\r\n\r\n /**\r\n * This will replace an item in the list.\r\n *\r\n * @protected\r\n * @param {object} row\r\n * @returns {void}\r\n */\r\n replace(row)\r\n {\r\n if (row.status === 'unchanged')\r\n {\r\n return;\r\n }\r\n\r\n // @ts-ignore\r\n const item = row.item;\r\n if (row.status === 'added')\r\n {\r\n // @ts-ignore\r\n this.append(item);\r\n return;\r\n }\r\n\r\n // @ts-ignore\r\n const keyValue = item[this.key];\r\n // @ts-ignore\r\n const index = this.findIndexByKey(keyValue);\r\n if (index === -1)\r\n {\r\n return;\r\n }\r\n\r\n // @ts-ignore\r\n this.data.set(`items[${index}]`, item);\r\n // @ts-ignore\r\n const oldRow = ChildHelper.get(this.panel, index);\r\n // @ts-ignore\r\n const layout = this.row(item, index);\r\n ChildHelper.replace(layout, oldRow, this);\r\n },\r\n\r\n /**\r\n * This will remove items from the list.\r\n *\r\n * @public\r\n * @param {array} items\r\n * @returns {void}\r\n */\r\n remove(items)\r\n {\r\n /**\r\n * This will get the deleted rows.\r\n */\r\n items.forEach((item) =>\r\n {\r\n // @ts-ignore\r\n this.delete(item[this.key]);\r\n });\r\n },\r\n\r\n /**\r\n * This will append items to the list.\r\n *\r\n * @public\r\n * @param {array|object} items\r\n * @returns {void}\r\n */\r\n append(items)\r\n {\r\n if (!Array.isArray(items))\r\n {\r\n items = [items];\r\n }\r\n\r\n /**\r\n * This will get all the new rows to be batched later.\r\n */\r\n const rows = [];\r\n // @ts-ignore\r\n let lastIndex = this.data.items.length - 1;\r\n items.forEach((item) =>\r\n {\r\n /**\r\n * This will build the new rows that will be appended.\r\n */\r\n // @ts-ignore\r\n rows.push(this.row(item));\r\n\r\n /**\r\n * This will silently add the new rows without re-rendering the entire list.\r\n */\r\n // @ts-ignore\r\n this.data.set(`items[${++lastIndex}]`, item);\r\n });\r\n\r\n // This will batch push all the rows.\r\n // @ts-ignore\r\n ChildHelper.append(rows, this.panel, this);\r\n },\r\n\r\n /**\r\n * This will mingle the new items with the old items.\r\n *\r\n * @public\r\n * @param {Array<Object>} newItems\r\n * @param {boolean} withDelete\r\n * @returns {void}\r\n */\r\n mingle(newItems, withDelete = false)\r\n {\r\n // @ts-ignore\r\n const oldItems = this.data.get('items');\r\n\r\n /**\r\n * This will diff the old and new items to determine what has\r\n * been added, updated, or deleted.\r\n */\r\n // @ts-ignore\r\n const changes = DataHelper.diff(oldItems, newItems, this.key);\r\n\r\n /**\r\n * We want to delete the items before adding and updating the\r\n * new items.\r\n */\r\n if (withDelete && changes.deletedItems.length > 0)\r\n {\r\n // @ts-ignore\r\n this.remove(changes.deletedItems);\r\n }\r\n\r\n /**\r\n * This will add or update the new rows.\r\n */\r\n changes.changes.forEach((row) =>\r\n {\r\n // @ts-ignore\r\n this.replace(row);\r\n });\r\n },\r\n\r\n /**\r\n * This will prepend items to the list.\r\n *\r\n * @public\r\n * @param {array|object} items\r\n * @returns {void}\r\n */\r\n prepend(items)\r\n {\r\n if (!Array.isArray(items))\r\n {\r\n items = [items];\r\n }\r\n\r\n /**\r\n * This will get all the new rows to be batched later.\r\n */\r\n const rows = [];\r\n const reverseItems = items.reverse();\r\n reverseItems.forEach((item) =>\r\n {\r\n /**\r\n * This will build the new rows that will be appended.\r\n */\r\n // @ts-ignore\r\n rows.push(this.row(item));\r\n });\r\n\r\n // This will use the get method to get the items as a raw array.\r\n // @ts-ignore\r\n const newItems = reverseItems.concat(this.data.get('items'));\r\n\r\n /**\r\n * This will silently add the new rows without re-rendering the entire\r\n * list. This will bypass the data object and directly add the items\r\n * to the stage.\r\n */\r\n // @ts-ignore\r\n this.data.stage.items = newItems;\r\n\r\n // @ts-ignore\r\n ChildHelper.prepend(rows, this.panel, this);\r\n },\r\n\r\n /**\r\n * Finds the index of an item in the data array by its key.\r\n *\r\n * @private\r\n * @param {*} keyValue\r\n * @returns {number} Index of the item, or -1 if not found\r\n */\r\n findIndexByKey(keyValue)\r\n {\r\n //@ts-ignore\r\n const items = this.data.items;\r\n //@ts-ignore\r\n return items.findIndex((item) => item[this.key] === keyValue);\r\n }\r\n});", "import { Builder, Html } from \"@base-framework/base\";\r\n\r\n/**\r\n * ChildHelper\r\n *\r\n * This class will help with getting children of a node.\r\n *\r\n * @class\r\n */\r\nexport class ChildHelper\r\n{\r\n /**\r\n * This will get the first child.\r\n *\r\n * @param {object} parent\r\n * @returns {object|null}\r\n */\r\n\tstatic first(parent)\r\n {\r\n return this.get(parent, 0);\r\n }\r\n\r\n /**\r\n * This will get the last child.\r\n *\r\n * @param {object} parent\r\n * @returns {object|null}\r\n */\r\n static last(parent)\r\n {\r\n const index = parent.childNodes.length - 1;\r\n return this.get(parent, index);\r\n }\r\n\r\n /**\r\n * This will get the child at the specified index.\r\n *\r\n * @param {object} parent\r\n * @param {number} index\r\n * @returns {object|null}\r\n */\r\n static get(parent, index)\r\n {\r\n return parent?.childNodes[index] ?? null;\r\n }\r\n\r\n /**\r\n * This will get the parent of the node.\r\n *\r\n * @param {object} node\r\n * @returns {object|null}\r\n */\r\n static next(node)\r\n {\r\n return node?.nextSibling ?? null;\r\n }\r\n\r\n /**\r\n * This will get the previous sibling.\r\n *\r\n * @param {object} node\r\n * @returns {object|null}\r\n */\r\n static previous(node)\r\n {\r\n return node?.previousSibling ?? null;\r\n }\r\n\r\n /**\r\n * This will get the index of the node.\r\n *\r\n * @param {object} node\r\n * @returns {number}\r\n */\r\n static index(node)\r\n {\r\n if (!node || !node.parentNode)\r\n\t\t{\r\n return -1; // Return -1 if node or its parent doesn't exist\r\n }\r\n\r\n const children = node.parentNode.children;\r\n return Array.from(children).indexOf(node);\r\n }\r\n\r\n /**\r\n * This will get the previous index of the node.\r\n *\r\n * @param {object} node\r\n * @returns {number}\r\n */\r\n static getPreviousIndex(node)\r\n {\r\n let index = this.index(node);\r\n return (index > 0)? index - 1 : 0;\r\n }\r\n\r\n /**\r\n * This will replace a child layout.\r\n *\r\n * @param {object} layout\r\n * @param {object} oldChild\r\n * @param {object} parent\r\n * @returns {void}\r\n */\r\n static replace(layout, oldChild, parent)\r\n {\r\n if (!oldChild)\r\n {\r\n return;\r\n }\r\n\r\n // get child index from parent\r\n const container = oldChild.parentNode;\r\n const index = this.getPreviousIndex(oldChild);\r\n this.remove(oldChild);\r\n\r\n const frag = Builder.build(layout, null, parent);\r\n\r\n // append to parent at index\r\n container.insertBefore(frag, container.childNodes[index]);\r\n }\r\n\r\n /**\r\n * This will remove a child.\r\n *\r\n * @param {object} node\r\n * @returns {void}\r\n */\r\n static remove(node)\r\n {\r\n if (node)\r\n {\r\n Html.removeChild(node);\r\n }\r\n }\r\n\r\n /**\r\n * This will append a child layout.\r\n *\r\n * @param {object} childrenLayout\r\n * @param {object} container\r\n * @param {object} parent\r\n * @returns {void}\r\n */\r\n static append(childrenLayout, container, parent)\r\n {\r\n if (!childrenLayout)\r\n {\r\n return;\r\n }\r\n\r\n Builder.build(childrenLayout, container, parent);\r\n }\r\n\r\n /**\r\n * This will prepend a child layout.\r\n *\r\n * @param {object} childrenLayout\r\n * @param {object} container\r\n * @param {object} parent\r\n * @returns {void}\r\n */\r\n static prepend(childrenLayout, container, parent)\r\n {\r\n if (!childrenLayout)\r\n {\r\n return;\r\n }\r\n\r\n const frag = Builder.build(childrenLayout, null, parent);\r\n container.insertBefore(frag, container.firstChild);\r\n }\r\n}", "/**\r\n * This will create a new item.\r\n *\r\n * @param {number} index\r\n * @param {*} item\r\n * @param {string} status\r\n * @returns {object}\r\n */\r\nconst Item = (index, item, status) =>\r\n{\r\n\treturn {\r\n\t\tindex,\r\n\t\titem,\r\n\t\tstatus\r\n\t};\r\n};\r\n\r\n/**\r\n * DataHelper\r\n *\r\n * This will help with data manipulation.\r\n *\r\n * @class\r\n */\r\nexport class DataHelper\r\n{\r\n\t/**\r\n * Compares two arrays of objects and returns the differences based on a specified key.\r\n *\r\n * @param {Array<Object>} oldArray - The original array of objects.\r\n * @param {Array<Object>} newArray - The updated array of objects.\r\n * @param {string} key - The key used to compare objects in the arrays.\r\n * @returns {Object} An object containing arrays of added, updated, and deleted items.\r\n */\r\n\tstatic diff(oldArray, newArray, key)\r\n\t{\r\n\t\tconst oldItemsMap = this.arrayToMap(oldArray, key);\r\n\t\tconst changes = [];\r\n\t\tconst deletedItems = [];\r\n\r\n\t\t// Process new array to determine status of each item\r\n\t\tnewArray.forEach((newItem, newIndex) =>\r\n\t\t{\r\n\t\t\tconst keyValue = newItem[key];\r\n\t\t\tif (!oldItemsMap.has(keyValue))\r\n\t\t\t{\r\n\t\t\t\t// Item is added\r\n\t\t\t\tchanges.push(Item(newIndex, newItem, 'added'));\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconst { item: oldItem } = oldItemsMap.get(keyValue);\r\n\t\t\tif (!this.deepEqual(oldItem, newItem))\r\n\t\t\t{\r\n\t\t\t\t// Item is updated\r\n\t\t\t\tchanges.push(Item(newIndex, newItem, 'updated'));\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\t// Item is unchanged\r\n\t\t\tchanges.push(Item(newIndex, newItem, 'unchanged'));\r\n\r\n\t\t\t// Remove from oldItemsMap to identify deletions later\r\n\t\t\toldItemsMap.delete(keyValue);\r\n\t\t});\r\n\r\n\t\t// Remaining items in oldItemsMap are deleted\r\n\t\toldItemsMap.forEach(({ item: oldItem }) =>\r\n\t\t{\r\n\t\t\tdeletedItems.push(oldItem);\r\n\t\t});\r\n\r\n\t\treturn {\r\n\t\t\tchanges,\r\n\t\t\tdeletedItems\r\n\t\t};\r\n\t}\r\n\r\n\t/**\r\n\t * Converts an array of objects into a Map keyed by the specified property.\r\n * Each value in the Map is an object containing the item and its index in the array.\r\n\t *\r\n\t * @param {Array<Object>} array - The array to convert.\r\n\t * @param {string} key - The key used to map the objects.\r\n\t * @returns {Map} A Map with keys as specified property and values as objects.\r\n\t * @private\r\n\t */\r\n\tstatic arrayToMap(array, key)\r\n\t{\r\n\t\tconst map = new Map();\r\n\t\tarray.forEach((item, index) =>\r\n\t\t{\r\n\t\t\tmap.set(item[key], { item, index });\r\n\t\t});\r\n\t\treturn map;\r\n\t}\r\n\r\n\t/**\r\n\t * Performs a deep comparison between two objects.\r\n\t *\r\n\t * @param {Object} obj1 - The first object to compare.\r\n\t * @param {Object} obj2 - The second object to compare.\r\n\t * @returns {boolean} True if objects are equal, else false.\r\n\t * @private\r\n\t */\r\n\tstatic deepEqual(obj1, obj2)\r\n\t{\r\n\t\tif (obj1 === obj2) return true;\r\n\r\n\t\tif (\r\n\t\t\ttypeof obj1 !== 'object' ||\r\n\t\t\tobj1 === null ||\r\n\t\t\ttypeof obj2 !== 'object' ||\r\n\t\t\tobj2 === null\r\n\t\t)\r\n\t\t{\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tconst keys1 = Object.keys(obj1);\r\n\t\tconst keys2 = Object.keys(obj2);\r\n\r\n\t\t// Different number of properties\r\n\t\tif (keys1.length !== keys2.length)\r\n\t\t{\r\n\t\t\treturn false\r\n\t\t}\r\n\r\n\t\tfor (const key of keys1)\r\n\t\t{\r\n\t\t\tif (!keys2.includes(key))\r\n\t\t\t{\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\r\n\t\t\tif (!this.deepEqual(obj1[key], obj2[key]))\r\n\t\t\t{\r\n\t\t\t\treturn false\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn true;\r\n\t}\r\n}", "import { Span } from \"@base-framework/atoms\";\r\nimport { Component, SimpleData } from \"@base-framework/base\";\r\nimport { IntervalTimer } from \"src/utils/timer\";\r\n\r\n/**\r\n * This will createa simple flat data object to use to bind\r\n * timer update.\r\n */\r\nconst data = new SimpleData({\r\n date: 0\r\n});\r\n\r\n/**\r\n * This will update the the data value every minute.\r\n */\r\nconst MINUTE_INTERVAL = 60000;\r\nconst timer = new IntervalTimer(MINUTE_INTERVAL, () =>\r\n{\r\n data.increment('date');\r\n});\r\n\r\ntimer.start();\r\n\r\n/**\r\n * DynamicTime\r\n *\r\n * This will create a dynamic time element that will update\r\n * the time every minute.\r\n *\r\n * @class\r\n * @augments Component\r\n */\r\nexport class DynamicTime extends Component\r\n{\r\n /**\r\n * This will set up the component data.\r\n *\r\n * @returns {object}\r\n */\r\n setData()\r\n {\r\n return data;\r\n }\r\n\r\n /**\r\n * This will redner the component.\r\n *\r\n * @returns {object}\r\n */\r\n render()\r\n {\r\n return Span({\r\n // @ts-ignore\r\n class: this.class,\r\n text: this.getTime(),\r\n onSet: ['date', () => this.getTime()]\r\n });\r\n }\r\n\r\n /**\r\n * This will get the date and check to filter the value.\r\n *\r\n * @returns {string}\r\n */\r\n getTime()\r\n {\r\n // @ts-ignore\r\n const dateTime = this.dateTime;\r\n // @ts-ignore\r\n return (this.filter) ? this.filter(dateTime) : dateTime;\r\n }\r\n}", "/**\r\n * Timer\r\n *\r\n * This will create a timer that will call a callback function.\r\n *\r\n * @class\r\n */\r\nexport class Timer\r\n{\r\n /**\r\n * This will create a new timer.\r\n *\r\n * @param {number} duration\r\n * @param {function} callBack\r\n */\r\n\tconstructor(duration, callBack)\r\n\t{\r\n\t\tthis.timer = null;\r\n\t\tthis.callBack = callBack;\r\n\t\tthis.duration = duration || 1000;\r\n\t}\r\n\r\n /**\r\n * This will create a timer.\r\n *\r\n * @protected\r\n * @param {function} callBack\r\n * @returns {void}\r\n */\r\n\tcreateTimer(callBack)\r\n\t{\r\n\t\tthis.timer = window.setTimeout(callBack, this.duration);\r\n\t}\r\n\r\n /**\r\n * This will start the timer.\r\n *\r\n * @returns {void}\r\n */\r\n\tstart()\r\n\t{\r\n\t\tthis.stop();\r\n\t\tlet callBack = this.returnCallBack.bind(this);\r\n\t\tthis.createTimer(callBack);\r\n\t}\r\n\r\n /**\r\n * This will stop the timer.\r\n *\r\n * @returns {void}\r\n */\r\n\tstop()\r\n\t{\r\n\t\twindow.clearTimeout(this.timer);\r\n\t}\r\n\r\n /**\r\n * This will call the callback function.\r\n *\r\n * @private\r\n * @returns {void}\r\n */\r\n\treturnCallBack()\r\n\t{\r\n\t\tconst callBack = this.callBack;\r\n\t\tif (typeof callBack === 'function')\r\n\t\t{\r\n\t\t\tcallBack.call();\r\n\t\t}\r\n\t}\r\n}\r\n\r\n/**\r\n * IntervalTimer\r\n *\r\n * This will create a timer that will call a callback function.\r\n *\r\n * @class\r\n */\r\nexport class IntervalTimer extends Timer\r\n{\r\n /**\r\n * This will create a timer.\r\n *\r\n * @protected\r\n * @param {function} callBack\r\n * @returns {void}\r\n */\r\n\tcreateTimer(callBack)\r\n\t{\r\n\t\tthis.timer = window.setInterval(callBack, this.duration);\r\n\t}\r\n\r\n /**\r\n * This will stop the timer.\r\n *\r\n * @returns {void}\r\n */\r\n\tstop()\r\n\t{\r\n\t\twindow.clearInterval(this.timer);\r\n\t}\r\n}"],
|
|
5
|
+
"mappings": "AAAA,OAAS,OAAAA,MAAW,wBACpB,OAAS,QAAAC,EAAM,OAAAC,MAAW,uBCD1B,OAAS,WAAAC,EAAS,QAAAC,MAAY,uBASvB,IAAMC,EAAN,KACP,CAOC,OAAO,MAAMC,EACV,CACI,OAAO,KAAK,IAAIA,EAAQ,CAAC,CAC7B,CAQA,OAAO,KAAKA,EACZ,CACI,IAAMC,EAAQD,EAAO,WAAW,OAAS,EACzC,OAAO,KAAK,IAAIA,EAAQC,CAAK,CACjC,CASA,OAAO,IAAID,EAAQC,EACnB,CACI,OAAOD,GAAQ,WAAWC,IAAU,IACxC,CAQA,OAAO,KAAKC,EACZ,CACI,OAAOA,GAAM,aAAe,IAChC,CAQA,OAAO,SAASA,EAChB,CACI,OAAOA,GAAM,iBAAmB,IACpC,CAQA,OAAO,MAAMA,EACb,CACI,GAAI,CAACA,GAAQ,CAACA,EAAK,WAEf,MAAO,GA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,MAAQ,OAAO,YAAYA,EAAU,KAAK,QAAQ,CACxD,CAOA,MACA,CACC,OAAO,cAAc,KAAK,KAAK,CAChC,CACD,ED9FA,IAAME,EAAO,IAAIC,EAAW,CACxB,KAAM,CACV,CAAC,EAKKC,EAAkB,IAClBC,EAAQ,IAAIC,EAAcF,EAAiB,IACjD,CACIF,EAAK,UAAU,MAAM,CACzB,CAAC,EAEDG,EAAM,MAAM,EAWL,IAAME,EAAN,cAA0BC,CACjC,CAMI,SACA,CACI,OAAON,CACX,CAOA,QACA,CACI,OAAOO,EAAK,CAER,MAAO,KAAK,MACZ,KAAM,KAAK,QAAQ,EACnB,MAAO,CAAC,OAAQ,IAAM,KAAK,QAAQ,CAAC,CACxC,CAAC,CACL,CAOA,SACA,CAEI,IAAMC,EAAW,KAAK,SAEtB,OAAQ,KAAK,OAAU,KAAK,OAAOA,CAAQ,EAAIA,CACnD,CACJ",
|
|
6
|
+
"names": ["Div", "Data", "Jot", "Builder", "Html", "ChildHelper", "parent", "index", "node", "children", "layout", "oldChild", "container", "frag", "childrenLayout", "Item", "index", "item", "status", "DataHelper", "oldArray", "newArray", "key", "oldItemsMap", "changes", "deletedItems", "newItem", "newIndex", "keyValue", "oldItem", "array", "map", "obj1", "obj2", "keys1", "keys2", "List", "Jot", "Data", "rowCallBack", "Div", "item", "keyValue", "index", "rowElement", "ChildHelper", "row", "oldRow", "layout", "items", "rows", "lastIndex", "newItems", "withDelete", "oldItems", "changes", "DataHelper", "reverseItems", "Span", "Component", "SimpleData", "Timer", "duration", "callBack", "IntervalTimer", "data", "SimpleData", "MINUTE_INTERVAL", "timer", "IntervalTimer", "DynamicTime", "Component", "Span", "dateTime"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DynamicTime
|
|
3
|
+
*
|
|
4
|
+
* This will create a dynamic time element that will update
|
|
5
|
+
* the time every minute.
|
|
6
|
+
*
|
|
7
|
+
* @class
|
|
8
|
+
* @augments Component
|
|
9
|
+
*/
|
|
10
|
+
export class DynamicTime extends Component {
|
|
11
|
+
/**
|
|
12
|
+
* This will set up the component data.
|
|
13
|
+
*
|
|
14
|
+
* @returns {object}
|
|
15
|
+
*/
|
|
16
|
+
setData(): object;
|
|
17
|
+
/**
|
|
18
|
+
* This will redner the component.
|
|
19
|
+
*
|
|
20
|
+
* @returns {object}
|
|
21
|
+
*/
|
|
22
|
+
render(): object;
|
|
23
|
+
/**
|
|
24
|
+
* This will get the date and check to filter the value.
|
|
25
|
+
*
|
|
26
|
+
* @returns {string}
|
|
27
|
+
*/
|
|
28
|
+
getTime(): string;
|
|
29
|
+
}
|
|
30
|
+
import { Component } from "@base-framework/base";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timer
|
|
3
|
+
*
|
|
4
|
+
* This will create a timer that will call a callback function.
|
|
5
|
+
*
|
|
6
|
+
* @class
|
|
7
|
+
*/
|
|
8
|
+
export class Timer {
|
|
9
|
+
/**
|
|
10
|
+
* This will create a new timer.
|
|
11
|
+
*
|
|
12
|
+
* @param {number} duration
|
|
13
|
+
* @param {function} callBack
|
|
14
|
+
*/
|
|
15
|
+
constructor(duration: number, callBack: Function);
|
|
16
|
+
timer: number;
|
|
17
|
+
callBack: Function;
|
|
18
|
+
duration: number;
|
|
19
|
+
/**
|
|
20
|
+
* This will create a timer.
|
|
21
|
+
*
|
|
22
|
+
* @protected
|
|
23
|
+
* @param {function} callBack
|
|
24
|
+
* @returns {void}
|
|
25
|
+
*/
|
|
26
|
+
protected createTimer(callBack: Function): void;
|
|
27
|
+
/**
|
|
28
|
+
* This will start the timer.
|
|
29
|
+
*
|
|
30
|
+
* @returns {void}
|
|
31
|
+
*/
|
|
32
|
+
start(): void;
|
|
33
|
+
/**
|
|
34
|
+
* This will stop the timer.
|
|
35
|
+
*
|
|
36
|
+
* @returns {void}
|
|
37
|
+
*/
|
|
38
|
+
stop(): void;
|
|
39
|
+
/**
|
|
40
|
+
* This will call the callback function.
|
|
41
|
+
*
|
|
42
|
+
* @private
|
|
43
|
+
* @returns {void}
|
|
44
|
+
*/
|
|
45
|
+
private returnCallBack;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* IntervalTimer
|
|
49
|
+
*
|
|
50
|
+
* This will create a timer that will call a callback function.
|
|
51
|
+
*
|
|
52
|
+
* @class
|
|
53
|
+
*/
|
|
54
|
+
export class IntervalTimer extends Timer {
|
|
55
|
+
}
|