ziko 0.0.12 → 0.0.14
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/dist/ziko.cjs +3069 -2463
- package/dist/ziko.js +2993 -2329
- package/dist/ziko.min.js +2 -2
- package/dist/ziko.mjs +2984 -2328
- package/package.json +39 -12
- package/src/__helpers__/index.js +41 -0
- package/src/app/accessibility/index.js +0 -0
- package/src/app/app.js +46 -0
- package/src/app/component/index.js +38 -0
- package/src/app/globals/index.js +20 -0
- package/src/app/index.js +12 -0
- package/src/app/params/index.js +40 -0
- package/src/app/router/index.js +67 -0
- package/src/app/seo/index.js +43 -0
- package/src/app/themes/dark.js +885 -0
- package/src/app/themes/index.js +11 -0
- package/src/app/themes/light.js +255 -0
- package/src/data/api/fetchdom.js +14 -0
- package/src/data/api/index.js +4 -0
- package/src/data/api/preload.js +11 -0
- package/src/data/converter/adoc.js +130 -0
- package/src/data/converter/array.js +43 -0
- package/src/data/converter/canvas.js +25 -0
- package/src/data/converter/csv.js +33 -0
- package/src/data/converter/idea.txt +10 -0
- package/src/data/converter/index.js +34 -0
- package/src/data/converter/json.js +80 -0
- package/src/data/converter/markdown.js +95 -0
- package/src/data/converter/object.js +70 -0
- package/src/data/converter/svg.js +11 -0
- package/src/data/decorators.js +0 -0
- package/src/data/index.js +74 -0
- package/src/data/parser/markdown.js +0 -0
- package/src/data/parser/xml.js +47 -0
- package/src/data/string/index.js +1 -0
- package/src/data/string/patterns.js +12 -0
- package/src/data/string/string.js +170 -0
- package/src/graphics/canvas/_canvas_offscreen +0 -0
- package/src/graphics/canvas/canvas.js +189 -0
- package/src/graphics/canvas/elements/Basic/arc.js +43 -0
- package/src/graphics/canvas/elements/Basic/image.js +0 -0
- package/src/graphics/canvas/elements/Basic/line.js +26 -0
- package/src/graphics/canvas/elements/Basic/path.js +0 -0
- package/src/graphics/canvas/elements/Basic/points.js +48 -0
- package/src/graphics/canvas/elements/Basic/polygon.js +7 -0
- package/src/graphics/canvas/elements/Basic/polyline.js +0 -0
- package/src/graphics/canvas/elements/Basic/rect.js +46 -0
- package/src/graphics/canvas/elements/Basic/text.js +0 -0
- package/src/graphics/canvas/elements/Chart/histogram.js +0 -0
- package/src/graphics/canvas/elements/Chart/plot.js +0 -0
- package/src/graphics/canvas/elements/Chart/scatter.js +2 -0
- package/src/graphics/canvas/elements/Chart/stem.js +0 -0
- package/src/graphics/canvas/elements/Element.js +115 -0
- package/src/graphics/canvas/elements/Groupe.js +0 -0
- package/src/graphics/canvas/elements/grid.js +0 -0
- package/src/graphics/canvas/elements/index.js +13 -0
- package/src/graphics/canvas/filter/index.js +0 -0
- package/src/graphics/canvas/index.js +15 -0
- package/src/graphics/canvas/paint/index.js +0 -0
- package/src/graphics/canvas/utils/color.js +8 -0
- package/src/graphics/canvas/utils/floodFill.js +58 -0
- package/src/graphics/index.js +69 -0
- package/src/graphics/svg/Elements/Basic/circle.js +26 -0
- package/src/graphics/svg/Elements/Basic/ellipse.js +21 -0
- package/src/graphics/svg/Elements/Basic/foreignObject.js +33 -0
- package/src/graphics/svg/Elements/Basic/groupe.js +29 -0
- package/src/graphics/svg/Elements/Basic/image.js +33 -0
- package/src/graphics/svg/Elements/Basic/line.js +29 -0
- package/src/graphics/svg/Elements/Basic/link.js +30 -0
- package/src/graphics/svg/Elements/Basic/path.js +59 -0
- package/src/graphics/svg/Elements/Basic/polygon.js +32 -0
- package/src/graphics/svg/Elements/Basic/polyline.js +4 -0
- package/src/graphics/svg/Elements/Basic/rect.js +43 -0
- package/src/graphics/svg/Elements/Basic/text.js +26 -0
- package/src/graphics/svg/Elements/Derived/grid.js +9 -0
- package/src/graphics/svg/Elements/ZikoSvgElement.js +46 -0
- package/src/graphics/svg/Elements/index.js +14 -0
- package/src/graphics/svg/index.js +2 -0
- package/src/graphics/svg/svg.js +115 -0
- package/src/index.js +88 -0
- package/src/math/absract.js +1 -0
- package/src/math/calculus/index.js +1 -0
- package/src/math/calculus/special-functions/bessel.js +31 -0
- package/src/math/calculus/special-functions/beta.js +38 -0
- package/src/math/calculus/special-functions/gamma.js +30 -0
- package/src/math/calculus/special-functions/index.js +4 -0
- package/src/math/complex/Fractals/julia.js +0 -0
- package/src/math/complex/index.js +203 -0
- package/src/math/const.js +3 -0
- package/src/math/discret/Combinaison/index.js +34 -0
- package/src/math/discret/Conversion/index.js +86 -0
- package/src/math/discret/Logic/index.js +46 -0
- package/src/math/discret/Permutation/index.js +31 -0
- package/src/math/discret/Set/index.js +2 -0
- package/src/math/discret/Set/power-set.js +15 -0
- package/src/math/discret/Set/sub-set.js +10 -0
- package/src/math/discret/index.js +23 -0
- package/src/math/functions/index.js +182 -0
- package/src/math/index.js +189 -0
- package/src/math/matrix/Decomposition.js +90 -0
- package/src/math/matrix/LinearSystem.js +10 -0
- package/src/math/matrix/Matrix.js +717 -0
- package/src/math/matrix/index.js +3 -0
- package/src/math/numeric/index.js +0 -0
- package/src/math/random/index.js +173 -0
- package/src/math/signal/__np.py.txt +40 -0
- package/src/math/signal/conv.js +175 -0
- package/src/math/signal/fft.js +55 -0
- package/src/math/signal/filter.js +39 -0
- package/src/math/signal/functions.js +146 -0
- package/src/math/signal/index.js +110 -0
- package/src/math/statistics/Functions/index.js +100 -0
- package/src/math/statistics/index.js +16 -0
- package/src/math/utils/arithmetic.js +139 -0
- package/src/math/utils/checkers.js +29 -0
- package/src/math/utils/comparaison.js +1 -0
- package/src/math/utils/conversions.js +19 -0
- package/src/math/utils/discret.js +51 -0
- package/src/math/utils/index.js +102 -0
- package/src/math/utils/mapfun.js +50 -0
- package/src/reactivity/events/Global/Click.js +56 -0
- package/src/reactivity/events/Global/Clipboard.js +84 -0
- package/src/reactivity/events/Global/CustomEvent.js +53 -0
- package/src/reactivity/events/Global/Drag.js +137 -0
- package/src/reactivity/events/Global/Focus.js +56 -0
- package/src/reactivity/events/Global/Key.js +104 -0
- package/src/reactivity/events/Global/Mouse.js +230 -0
- package/src/reactivity/events/Global/Pointer.js +234 -0
- package/src/reactivity/events/Global/Swipe.js +147 -0
- package/src/reactivity/events/Global/Touch.js +0 -0
- package/src/reactivity/events/Global/Wheel.js +44 -0
- package/src/reactivity/events/Partiel/Hash.js +44 -0
- package/src/reactivity/events/Partiel/Input.js +59 -0
- package/src/reactivity/events/Partiel/Media.js +1 -0
- package/src/reactivity/events/ZikoEvent.js +91 -0
- package/src/reactivity/events/index.js +63 -0
- package/src/reactivity/hooks/Contexte/index.js +1 -0
- package/src/reactivity/hooks/Contexte/useSuccesifKeys.js +14 -0
- package/src/reactivity/hooks/Decorators/index.js +6 -0
- package/src/reactivity/hooks/Decorators/time.js +17 -0
- package/src/reactivity/hooks/Decorators/type.js +88 -0
- package/src/reactivity/hooks/Interactions/index.js +4 -0
- package/src/reactivity/hooks/Interactions/useBluetooth.js +48 -0
- package/src/reactivity/hooks/Interactions/useChannel.js +50 -0
- package/src/reactivity/hooks/Interactions/useEventEmmiter.js +64 -0
- package/src/reactivity/hooks/Interactions/useSerial.js +0 -0
- package/src/reactivity/hooks/Interactions/useThread.js +44 -0
- package/src/reactivity/hooks/Interactions/useUsb.js +0 -0
- package/src/reactivity/hooks/Sensors/index.js +2 -0
- package/src/reactivity/hooks/Sensors/useBattery.js +36 -0
- package/src/reactivity/hooks/Sensors/useCamera.js +0 -0
- package/src/reactivity/hooks/Sensors/useGeolocation.js +17 -0
- package/src/reactivity/hooks/Sensors/useMicro.js +0 -0
- package/src/reactivity/hooks/Sensors/useOrientation.js +0 -0
- package/src/reactivity/hooks/Storage/index.js +1 -0
- package/src/reactivity/hooks/Storage/useCookie.js +0 -0
- package/src/reactivity/hooks/Storage/useIndexedDb.js +0 -0
- package/src/reactivity/hooks/Storage/useStorage.js +73 -0
- package/src/reactivity/hooks/UI/index.js +5 -0
- package/src/reactivity/hooks/UI/useCssLink.js +0 -0
- package/src/reactivity/hooks/UI/useCssText.js +21 -0
- package/src/reactivity/hooks/UI/useFavIcon.js +38 -0
- package/src/reactivity/hooks/UI/useLinearGradient.js +0 -0
- package/src/reactivity/hooks/UI/useMediaQuery.js +43 -0
- package/src/reactivity/hooks/UI/useRadialGradient.js +0 -0
- package/src/reactivity/hooks/UI/useStyle.js +79 -0
- package/src/reactivity/hooks/UI/useTheme.js +62 -0
- package/src/reactivity/hooks/UI/useTitle.js +30 -0
- package/src/reactivity/hooks/index.js +85 -0
- package/src/reactivity/hooks/todo.md +26 -0
- package/src/reactivity/idea +2 -0
- package/src/reactivity/index.js +22 -0
- package/src/reactivity/observer/attributes.js +28 -0
- package/src/reactivity/observer/children.js +37 -0
- package/src/reactivity/observer/index.js +44 -0
- package/src/reactivity/observer/intersection.js +44 -0
- package/src/reactivity/observer/mutation.js +113 -0
- package/src/reactivity/observer/resize.js +47 -0
- package/src/reactivity/observer/screen.js +45 -0
- package/src/reactivity/observer/screen.js.txt +84 -0
- package/src/reactivity/observer/screen.txt +13 -0
- package/src/time/animation.js +76 -0
- package/src/time/index.js +54 -0
- package/src/time/loop.js +87 -0
- package/src/time/utils/decorators.js +17 -0
- package/src/time/utils/ease.js +144 -0
- package/src/time/utils/index.js +18 -0
- package/src/time/utils/performance.js +16 -0
- package/src/time/utils/ui.js +26 -0
- package/src/types.js +71 -0
- package/src/user-interface/elements/derived/Flex.js +103 -0
- package/src/user-interface/elements/derived/Grid.js +33 -0
- package/src/user-interface/elements/derived/elements/Notification.js +0 -0
- package/src/user-interface/elements/derived/elements/Popover.js +0 -0
- package/src/user-interface/elements/derived/elements/Popup.js +0 -0
- package/src/user-interface/elements/derived/elements/Swipper.js +4 -0
- package/src/user-interface/elements/derived/elements/Timeline.js +0 -0
- package/src/user-interface/elements/derived/elements/Toast.js +0 -0
- package/src/user-interface/elements/derived/elements/Treeview.js +0 -0
- package/src/user-interface/elements/derived/elements/accordion/accordion.js +45 -0
- package/src/user-interface/elements/derived/elements/accordion/collapsible.js +82 -0
- package/src/user-interface/elements/derived/elements/accordion/index.js +2 -0
- package/src/user-interface/elements/derived/elements/alert/alert.js +80 -0
- package/src/user-interface/elements/derived/elements/alert/index.js +1 -0
- package/src/user-interface/elements/derived/elements/alert/palette.js +52 -0
- package/src/user-interface/elements/derived/elements/carousel/index.js +51 -0
- package/src/user-interface/elements/derived/elements/code-note/SubElements.js.txt +105 -0
- package/src/user-interface/elements/derived/elements/code-note/code-cell.js +195 -0
- package/src/user-interface/elements/derived/elements/code-note/code-note.js +72 -0
- package/src/user-interface/elements/derived/elements/code-note/index.js +2 -0
- package/src/user-interface/elements/derived/elements/code-note/sub-elements.js +67 -0
- package/src/user-interface/elements/derived/elements/columns.js +1 -0
- package/src/user-interface/elements/derived/elements/fab.js +0 -0
- package/src/user-interface/elements/derived/elements/index.js +9 -0
- package/src/user-interface/elements/derived/elements/menu/index.js +1 -0
- package/src/user-interface/elements/derived/elements/menu/menu3d.js +260 -0
- package/src/user-interface/elements/derived/elements/modal/index.js +92 -0
- package/src/user-interface/elements/derived/elements/pagination/breadcrumbs.js +54 -0
- package/src/user-interface/elements/derived/elements/pagination/index.js +1 -0
- package/src/user-interface/elements/derived/elements/splitter/__ZikoUISplitter__.js +62 -0
- package/src/user-interface/elements/derived/elements/splitter/hsplitter.js +40 -0
- package/src/user-interface/elements/derived/elements/splitter/index.js +2 -0
- package/src/user-interface/elements/derived/elements/splitter/vsplitter.js +40 -0
- package/src/user-interface/elements/derived/elements/tabs/index.js +180 -0
- package/src/user-interface/elements/derived/index.js +3 -0
- package/src/user-interface/elements/primitives/ZikoUIContainerElement.js +127 -0
- package/src/user-interface/elements/primitives/ZikoUIElement.js +480 -0
- package/src/user-interface/elements/primitives/embaded/html.js +21 -0
- package/src/user-interface/elements/primitives/embaded/index.js +3 -0
- package/src/user-interface/elements/primitives/embaded/pdf.js +18 -0
- package/src/user-interface/elements/primitives/embaded/youtube.js +26 -0
- package/src/user-interface/elements/primitives/index.js +8 -0
- package/src/user-interface/elements/primitives/io/Form/index.js +42 -0
- package/src/user-interface/elements/primitives/io/Form/index.js.txt +104 -0
- package/src/user-interface/elements/primitives/io/Inputs/__helpers__.js +52 -0
- package/src/user-interface/elements/primitives/io/Inputs/index.js +12 -0
- package/src/user-interface/elements/primitives/io/Inputs/input/index.js +99 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-camera/index.js +26 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-checkbox/index.js +26 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-color/index.js +16 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-date-time/index.js +3 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date-time.js +14 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-date.js +14 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-date-time/input-time.js +14 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-email-password/index.js +2 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-email.js +15 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-email-password/input-password.js +14 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-file/index.js +1 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-file/input-file.js +0 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-file/input-image.js +43 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-number/index.js +37 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-radio/index.js +26 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-search/index.js +45 -0
- package/src/user-interface/elements/primitives/io/Inputs/input-slider/index.js +34 -0
- package/src/user-interface/elements/primitives/io/Select/index.js +20 -0
- package/src/user-interface/elements/primitives/io/Textarea/index.js +18 -0
- package/src/user-interface/elements/primitives/io/index.js +4 -0
- package/src/user-interface/elements/primitives/list/elements.js +0 -0
- package/src/user-interface/elements/primitives/list/index.js +139 -0
- package/src/user-interface/elements/primitives/media/Audio/index.js +17 -0
- package/src/user-interface/elements/primitives/media/Image/figure.js +19 -0
- package/src/user-interface/elements/primitives/media/Image/image.js +37 -0
- package/src/user-interface/elements/primitives/media/Image/index.js +2 -0
- package/src/user-interface/elements/primitives/media/Video/index.js +27 -0
- package/src/user-interface/elements/primitives/media/__ZikoUIDynamicMediaELement__.js +47 -0
- package/src/user-interface/elements/primitives/media/index.js +3 -0
- package/src/user-interface/elements/primitives/misc/index.js +100 -0
- package/src/user-interface/elements/primitives/semantic/index.js +82 -0
- package/src/user-interface/elements/primitives/table/elements.js +94 -0
- package/src/user-interface/elements/primitives/table/index.js +3 -0
- package/src/user-interface/elements/primitives/table/table.js +115 -0
- package/src/user-interface/elements/primitives/table/utils.js +12 -0
- package/src/user-interface/elements/primitives/text/__ZikoUIText__.js +71 -0
- package/src/user-interface/elements/primitives/text/heading.js +36 -0
- package/src/user-interface/elements/primitives/text/index.js +3 -0
- package/src/user-interface/elements/primitives/text/p.js +26 -0
- package/src/user-interface/elements/primitives/text/pre.js +0 -0
- package/src/user-interface/elements/primitives/text/text.js +81 -0
- package/src/user-interface/index.js +190 -0
- package/src/user-interface/style/index.js +510 -0
- package/src/user-interface/utils/index.js +70 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js";
|
|
2
|
+
import ZikoUIContainerElement from "../ZikoUIContainerElement.js";
|
|
3
|
+
import {text} from "../text/index.js";
|
|
4
|
+
class ZikoUILI extends ZikoUIContainerElement{
|
|
5
|
+
constructor(UI){
|
|
6
|
+
super("li","li");
|
|
7
|
+
this.append(UI);
|
|
8
|
+
}
|
|
9
|
+
get isLi(){
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
class ZikoUIList extends ZikoUIContainerElement {
|
|
14
|
+
constructor(element,name) {
|
|
15
|
+
super(element,name);
|
|
16
|
+
delete this.append;
|
|
17
|
+
this.style({ listStylePosition: "inside" });
|
|
18
|
+
}
|
|
19
|
+
get isList(){
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
append(...arr){
|
|
23
|
+
for (let i = 0; i < arr.length; i++) {
|
|
24
|
+
let li = null;
|
|
25
|
+
if(["string","number"].includes(typeof arr[i]))arr[i]=text(arr[i])
|
|
26
|
+
if (arr[i] instanceof ZikoUIElement)li=new ZikoUILI(arr[i]);
|
|
27
|
+
li.setTarget(this.element)
|
|
28
|
+
this.items.push(li[0]);
|
|
29
|
+
this.maintain();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
remove(...ele) {
|
|
33
|
+
if(ele.length==0){
|
|
34
|
+
if(this.target.children.length) this.target.removeChild(this.element);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const remove = (ele) => {
|
|
38
|
+
if(typeof ele === "number") ele=this.items[ele];
|
|
39
|
+
if(ele instanceof ZikoUIElement)this.element?.removeChild(ele.parent.element);
|
|
40
|
+
this.items=this.items.filter(n=>n!==ele);
|
|
41
|
+
};
|
|
42
|
+
for (let i = 0; i < ele.length; i++) remove(ele[i]);
|
|
43
|
+
for (let i = 0; i < this.items.length; i++)
|
|
44
|
+
Object.assign(this, { [[i]]: this.items[i] });
|
|
45
|
+
}
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
insertAt(index, ...ele) {
|
|
49
|
+
if (index >= this.element.children.length) this.append(...ele);
|
|
50
|
+
else
|
|
51
|
+
for (let i = 0; i < ele.length; i++) {
|
|
52
|
+
let li = null;
|
|
53
|
+
if(["number","string"].includes(typeof ele[i]))ele[i]=text(ele[i]);
|
|
54
|
+
if (ele[i] instanceof ZikoUIElement)li=new ZikoUILI(ele[i]);
|
|
55
|
+
this.element?.insertBefore(li.element, this.items[index].parent.element);
|
|
56
|
+
this.items.splice(index, 0, ele[i][0]);
|
|
57
|
+
}
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
filterByTextContent(text,exactMatch=false){
|
|
61
|
+
this.items.map(n=>n.parent.render());
|
|
62
|
+
this.items.filter(n=>{
|
|
63
|
+
const content=n.element.textContent
|
|
64
|
+
return !(exactMatch?content===text:content.includes(text))
|
|
65
|
+
}).map(n=>n.parent.render(false));
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
sortByTextContent(order=1){
|
|
69
|
+
this.items.map(n=>n.parent.render(false));
|
|
70
|
+
// To Fix
|
|
71
|
+
this.sortedItems=this.items.sort((a,b)=>order*a.element.textContent.localeCompare(b.element.textContent))
|
|
72
|
+
this.append(...this.sortedItems);
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
filterByClass(value) {
|
|
76
|
+
this.items.map(n=>n.parent.render(true));
|
|
77
|
+
this.items.filter(n=>!n.Classes.includes(value)).map(n=>n.parent.render(false));
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
delete(value) {
|
|
81
|
+
const valueIndex = [...this.element.children].indexOf(value);
|
|
82
|
+
return valueIndex;
|
|
83
|
+
/*if(valueIndex >= 0) {
|
|
84
|
+
return this.list.splice(valueIndex, 1);
|
|
85
|
+
}*/
|
|
86
|
+
}
|
|
87
|
+
push(){
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
pop(){
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
unshift(){
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
shift(){
|
|
97
|
+
|
|
98
|
+
}
|
|
99
|
+
sort(){
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
filter(){
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
slice(){
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
class ZikoUIOList extends ZikoUIList{
|
|
110
|
+
constructor(...arr){
|
|
111
|
+
super("ol","ol");
|
|
112
|
+
this.append(...arr);
|
|
113
|
+
}
|
|
114
|
+
get isOl(){
|
|
115
|
+
return true;
|
|
116
|
+
}
|
|
117
|
+
type(tp = 1) {
|
|
118
|
+
this.element?.setAttribute("type", tp);
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
121
|
+
start(st = 1) {
|
|
122
|
+
this.element?.setAttribute("start", st);
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
class ZikoUIUList extends ZikoUIList{
|
|
127
|
+
constructor(...arr){
|
|
128
|
+
super("ul","ul");
|
|
129
|
+
this.append(...arr);
|
|
130
|
+
}
|
|
131
|
+
get isUl(){
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
const li=UI=>new ZikoUILI(UI)
|
|
136
|
+
const ol = (...arr) => new ZikoUIOList(...arr);
|
|
137
|
+
const ul = (...arr) => new ZikoUIUList(...arr);
|
|
138
|
+
|
|
139
|
+
export{ol,ul,li}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __ZikoUIDynamicMediaElement__ } from "../__ZikoUIDynamicMediaELement__.js";
|
|
2
|
+
class ZikoUIAudio extends __ZikoUIDynamicMediaElement__ {
|
|
3
|
+
constructor(src) {
|
|
4
|
+
super("audio","audio");
|
|
5
|
+
this.element?.setAttribute("src", src);
|
|
6
|
+
this.size("150px","30px")
|
|
7
|
+
// this.useControls();
|
|
8
|
+
}
|
|
9
|
+
get isAudio(){
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const audio = (src) => new ZikoUIAudio(src);
|
|
14
|
+
export {
|
|
15
|
+
audio,
|
|
16
|
+
ZikoUIAudio
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import ZikoUIElement from "../../ZikoUIElement";
|
|
2
|
+
class ZikoUIFigure extends ZikoUIElement{
|
|
3
|
+
constructor(src,caption){
|
|
4
|
+
super("figure","figure")
|
|
5
|
+
this.img=src.width("100%").element;
|
|
6
|
+
this.caption=document?.createElementt("figcaption");
|
|
7
|
+
this.caption.append(caption.element)
|
|
8
|
+
this.element?.append(this.img);
|
|
9
|
+
this.element?.append(this.caption);
|
|
10
|
+
}
|
|
11
|
+
get isFigure(){
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
const figure =(image,caption) =>new ZikoUIFigure(image,caption);
|
|
16
|
+
export{
|
|
17
|
+
figure,
|
|
18
|
+
ZikoUIFigure
|
|
19
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import ZikoUIElement from "../../ZikoUIElement.js";
|
|
2
|
+
class ZikoUIImage extends ZikoUIElement {
|
|
3
|
+
constructor(src,alt, w, h) {
|
|
4
|
+
super("img","image");
|
|
5
|
+
this.value=src;
|
|
6
|
+
if (src.nodeName === "IMG")this.element.setAttribute("src", src.src);
|
|
7
|
+
else this.element?.setAttribute("src", src);
|
|
8
|
+
if (typeof w == "number") w += "%";
|
|
9
|
+
if (typeof h == "number") h += "%";
|
|
10
|
+
this.setAttr("alt", alt)
|
|
11
|
+
this.style({ border: "1px solid black", width: w, height: h });
|
|
12
|
+
}
|
|
13
|
+
get isImg(){
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
updateSrc(url){
|
|
17
|
+
this.value=url;
|
|
18
|
+
this.element.src=url;
|
|
19
|
+
return this;
|
|
20
|
+
}
|
|
21
|
+
toggleSrc(...values){
|
|
22
|
+
values=values.map(n=>""+n);
|
|
23
|
+
let index=values.indexOf(""+this.value);
|
|
24
|
+
if(index!=-1&&index!=(values.length-1))this.updateSrc(values[index+1]);
|
|
25
|
+
else this.updateSrc(values[0]);
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
alt(alt){
|
|
29
|
+
this.element.alt=alt;
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const image = (src,alt, width, height) => new ZikoUIImage(src,alt, width, height);
|
|
34
|
+
export{
|
|
35
|
+
image,
|
|
36
|
+
ZikoUIImage
|
|
37
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { __ZikoUIDynamicMediaElement__ } from "../__ZikoUIDynamicMediaELement__.js";
|
|
2
|
+
class ZikoUIVideo extends __ZikoUIDynamicMediaElement__ {
|
|
3
|
+
constructor(src="", w = "100%", h = "50vh") {
|
|
4
|
+
super("video","video");
|
|
5
|
+
if (src.nodeName === "VIDEO") this.element?.setAttribute("src", src.src);
|
|
6
|
+
else this.element?.setAttribute("src", src);
|
|
7
|
+
if (typeof w == "number") w += "%";
|
|
8
|
+
if (typeof h == "number") h += "%";
|
|
9
|
+
this.style({ width: w, height: h });
|
|
10
|
+
}
|
|
11
|
+
get isVideo(){
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
usePoster(src=""){
|
|
15
|
+
this.element.poster=src;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
usePIP(e){
|
|
19
|
+
this.element.requestPictureInPicture(e);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const video = (src, width, height) => new ZikoUIVideo(src, width, height);
|
|
24
|
+
export {
|
|
25
|
+
video,
|
|
26
|
+
ZikoUIVideo
|
|
27
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js";
|
|
2
|
+
class __ZikoUIDynamicMediaElement__ extends ZikoUIElement {
|
|
3
|
+
constructor(element, name) {
|
|
4
|
+
super(element, name);
|
|
5
|
+
this.useControls();
|
|
6
|
+
}
|
|
7
|
+
get t(){
|
|
8
|
+
return this.element.currentTime;
|
|
9
|
+
}
|
|
10
|
+
useControls(enabled = true) {
|
|
11
|
+
this.element.controls = enabled;
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
enableControls(){
|
|
15
|
+
this.element.controls = true;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
disableControls(){
|
|
19
|
+
this.element.controls = true;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
toggleControls(){
|
|
23
|
+
this.element.controls = !this.element.controls;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
play() {
|
|
27
|
+
this.element.play();
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
pause() {
|
|
31
|
+
this.element.pause();
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
seekTo(time) {
|
|
35
|
+
this.element.currentTime = time;
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
onPlay(){
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
onPause(){
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
__ZikoUIDynamicMediaElement__
|
|
47
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js";
|
|
2
|
+
import ZikoUIContainerElement from "../ZikoUIContainerElement.js";
|
|
3
|
+
class ZikoUIHtmlTag extends ZikoUIContainerElement {
|
|
4
|
+
constructor(element) {
|
|
5
|
+
super(element,"html");
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
class ZikoUIBtn extends ZikoUIElement {
|
|
9
|
+
constructor(value = "button") {
|
|
10
|
+
super("button","btn");
|
|
11
|
+
this.element = document?.createElement("button");
|
|
12
|
+
this.setValue(value);
|
|
13
|
+
this.st.cursor("pointer");
|
|
14
|
+
globalThis.__Ziko__.__Config__.default.render && this.render();
|
|
15
|
+
}
|
|
16
|
+
get isBtn(){
|
|
17
|
+
return true
|
|
18
|
+
}
|
|
19
|
+
setValue(value) {
|
|
20
|
+
if (value instanceof ZikoUIElement) value.setTarget(this.element);
|
|
21
|
+
else {
|
|
22
|
+
this.element?.appendChild(document.createTextNode(""));
|
|
23
|
+
this.element.childNodes[0].data = value;
|
|
24
|
+
}
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
get value() {
|
|
28
|
+
return this.element.innerText;
|
|
29
|
+
}
|
|
30
|
+
toggleValues(...values) {
|
|
31
|
+
values = values.map((n) => "" + n);
|
|
32
|
+
let index = values.indexOf("" + this.value);
|
|
33
|
+
if (index != -1 && index != values.length - 1)
|
|
34
|
+
this.setValue(values[index + 1]);
|
|
35
|
+
else this.setValue(values[0]);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
class ZikoUIBr extends ZikoUIElement {
|
|
40
|
+
constructor() {
|
|
41
|
+
super("br","br");
|
|
42
|
+
}
|
|
43
|
+
get isBr(){
|
|
44
|
+
return true
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
class ZikoUIHr extends ZikoUIElement {
|
|
48
|
+
constructor() {
|
|
49
|
+
super("hr","hr");
|
|
50
|
+
this.setAttr("role", "none");
|
|
51
|
+
}
|
|
52
|
+
get isHr(){
|
|
53
|
+
return true
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
class ZikoUILink extends ZikoUIContainerElement{
|
|
57
|
+
constructor(href){
|
|
58
|
+
super("a","link");
|
|
59
|
+
Object.assign(this.cache,{
|
|
60
|
+
defaultStyle:{
|
|
61
|
+
color:"#0275d8",
|
|
62
|
+
textDecoration: "none"
|
|
63
|
+
},
|
|
64
|
+
hoverStyle:{
|
|
65
|
+
color:"#01447e",
|
|
66
|
+
textDecoration: "underline"
|
|
67
|
+
},
|
|
68
|
+
})
|
|
69
|
+
this.setHref(href);
|
|
70
|
+
this.style(this.cache.defaultStyle);
|
|
71
|
+
this.onPtrEnter(()=>this.style(this.cache.hoverStyle));
|
|
72
|
+
this.onPtrLeave(()=>this.style(this.cache.defaultStyle));
|
|
73
|
+
}
|
|
74
|
+
setHref(href){
|
|
75
|
+
this.element.href=href;
|
|
76
|
+
}
|
|
77
|
+
get isLink(){
|
|
78
|
+
return true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const br = () => new ZikoUIBr();
|
|
82
|
+
const hr = () => new ZikoUIHr();
|
|
83
|
+
const brs = (n=1)=> new Array(n).fill(new ZikoUIBr());
|
|
84
|
+
const hrs = (n=1)=> new Array(n).fill(new ZikoUIHr());
|
|
85
|
+
const link=(href,...UIElement)=>new ZikoUILink(href).append(...UIElement);
|
|
86
|
+
const html=(tag,...UIElement)=>new ZikoUIHtmlTag(tag).append(...UIElement);
|
|
87
|
+
const btn = (value) => new ZikoUIBtn(value);
|
|
88
|
+
export{
|
|
89
|
+
html,
|
|
90
|
+
btn,
|
|
91
|
+
br,
|
|
92
|
+
hr,
|
|
93
|
+
brs,
|
|
94
|
+
hrs,
|
|
95
|
+
link,
|
|
96
|
+
ZikoUIHtmlTag,
|
|
97
|
+
ZikoUIBr,
|
|
98
|
+
ZikoUIHr,
|
|
99
|
+
ZikoUILink
|
|
100
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import ZikoUIContainerElement from "../ZikoUIContainerElement.js";
|
|
2
|
+
class ZikoUIMain extends ZikoUIContainerElement{
|
|
3
|
+
constructor(){
|
|
4
|
+
super("main","Main");
|
|
5
|
+
}
|
|
6
|
+
get isMain(){
|
|
7
|
+
return true
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
class ZikoUIHeader extends ZikoUIContainerElement{
|
|
11
|
+
constructor(){
|
|
12
|
+
super("header","Header");
|
|
13
|
+
}
|
|
14
|
+
get isHeader(){
|
|
15
|
+
return true
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
class ZikoUINav extends ZikoUIContainerElement{
|
|
19
|
+
constructor(){
|
|
20
|
+
super("nav","Nav");
|
|
21
|
+
}
|
|
22
|
+
get isNav(){
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
class ZikoUISection extends ZikoUIContainerElement{
|
|
27
|
+
constructor(){
|
|
28
|
+
super("section","Section");
|
|
29
|
+
this.style({position:"relative"})
|
|
30
|
+
}
|
|
31
|
+
get isSection(){
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class ZikoUIArticle extends ZikoUIContainerElement{
|
|
36
|
+
constructor(){
|
|
37
|
+
super("article","Article");
|
|
38
|
+
}
|
|
39
|
+
get isArticle(){
|
|
40
|
+
return true
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
class ZikoUIAside extends ZikoUIContainerElement{
|
|
44
|
+
constructor(){
|
|
45
|
+
super("aside","Aside");
|
|
46
|
+
}
|
|
47
|
+
get isAside(){
|
|
48
|
+
return true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class ZikoUIFooter extends ZikoUIContainerElement{
|
|
52
|
+
constructor(){
|
|
53
|
+
super("footer","Footer");
|
|
54
|
+
this.element=document?.createElement("footer");
|
|
55
|
+
}
|
|
56
|
+
get isFooter(){
|
|
57
|
+
return true
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const Section = (...ZikoUIElement) => new ZikoUISection().append(...ZikoUIElement);
|
|
61
|
+
const Article = (...ZikoUIElement) => new ZikoUIArticle().append(...ZikoUIElement);
|
|
62
|
+
const Main = (...ZikoUIElement) => new ZikoUIMain().append(...ZikoUIElement);
|
|
63
|
+
const Header = (...ZikoUIElement) => new ZikoUIHeader().append(...ZikoUIElement);
|
|
64
|
+
const Footer = (...ZikoUIElement) => new ZikoUIFooter().append(...ZikoUIElement);
|
|
65
|
+
const Nav = (...ZikoUIElement) => new ZikoUINav().append(...ZikoUIElement);
|
|
66
|
+
const Aside = (...ZikoUIElement) => new ZikoUIAside().append(...ZikoUIElement);
|
|
67
|
+
export{
|
|
68
|
+
Header,
|
|
69
|
+
Main,
|
|
70
|
+
Section,
|
|
71
|
+
Article,
|
|
72
|
+
Aside,
|
|
73
|
+
Nav,
|
|
74
|
+
Footer,
|
|
75
|
+
ZikoUIHeader,
|
|
76
|
+
ZikoUIMain,
|
|
77
|
+
ZikoUISection,
|
|
78
|
+
ZikoUIArticle,
|
|
79
|
+
ZikoUIAside,
|
|
80
|
+
ZikoUINav,
|
|
81
|
+
ZikoUIFooter
|
|
82
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js"
|
|
2
|
+
import { text } from "../text/text.js";
|
|
3
|
+
class ZikoUITh extends ZikoUIElement{
|
|
4
|
+
constructor(...ZikoUIElement){
|
|
5
|
+
super()
|
|
6
|
+
this.element=document?.createElement("Th");
|
|
7
|
+
this.append(...ZikoUIElement)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
class ZikoUITr extends ZikoUIElement{
|
|
11
|
+
constructor(...ZikoUIElement){
|
|
12
|
+
super()
|
|
13
|
+
this.element=document?.createElement("Tr");
|
|
14
|
+
this.append(...ZikoUIElement)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
class ZikoUITd extends ZikoUIElement{
|
|
18
|
+
constructor(...ZikoUIElement){
|
|
19
|
+
super()
|
|
20
|
+
this.element=document?.createElement("Td");
|
|
21
|
+
this.append(...ZikoUIElement)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class ZikoUIThead extends ZikoUIElement{
|
|
25
|
+
constructor(...ZikoUITr){
|
|
26
|
+
super()
|
|
27
|
+
this.element=document?.createElement("Thead");
|
|
28
|
+
this.append(...ZikoUITr)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
class ZikoUITbody extends ZikoUIElement{
|
|
32
|
+
constructor(...ZikoUITr){
|
|
33
|
+
super()
|
|
34
|
+
this.element=document?.createElement("Tbody");
|
|
35
|
+
this.append(...ZikoUITr)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
class ZikoUITfoot extends ZikoUIElement{
|
|
39
|
+
constructor(...ZikoUITr){
|
|
40
|
+
super()
|
|
41
|
+
this.element=document?.createElement("Tfoot");
|
|
42
|
+
this.append(...ZikoUITr)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export class ZikoUICaption extends ZikoUIElement{
|
|
46
|
+
constructor(ZikoUIElement){
|
|
47
|
+
super()
|
|
48
|
+
this.element=document?.createElement("Caption");
|
|
49
|
+
this.append(ZikoUIElement)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
class ZikoUICol extends ZikoUIElement{
|
|
53
|
+
constructor(...ZikoUIElement){
|
|
54
|
+
super()
|
|
55
|
+
this.element=document?.createElement("Col");
|
|
56
|
+
this.append(...ZikoUIElement)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
class ZikoUIColgroup extends ZikoUIElement{
|
|
60
|
+
constructor(...ZikoUIElement){
|
|
61
|
+
super()
|
|
62
|
+
this.element=document?.createElement("Colgroup");
|
|
63
|
+
this.append(...ZikoUIElement)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const tr=(...ZikoUIElement)=>new ZikoUITr(...ZikoUIElement)
|
|
68
|
+
const th=(...UI)=>{
|
|
69
|
+
UI=UI.map(n=>{
|
|
70
|
+
if(!(n instanceof ZikoUIElement))n=text(n)
|
|
71
|
+
return n
|
|
72
|
+
})
|
|
73
|
+
return new ZikoUITh(...UI)
|
|
74
|
+
}
|
|
75
|
+
const td=(...UI)=>{
|
|
76
|
+
UI=UI.map(n=>{
|
|
77
|
+
if(!(n instanceof ZikoUIElement))n=text(n)
|
|
78
|
+
return n
|
|
79
|
+
})
|
|
80
|
+
return new ZikoUITd(...UI)
|
|
81
|
+
}
|
|
82
|
+
const thead=(...ZikoUITd)=>{
|
|
83
|
+
ZikoUITd=ZikoUITd.map(n=>{
|
|
84
|
+
if(!(n instanceof ZikoUIElement))n=td(n)
|
|
85
|
+
return n
|
|
86
|
+
})
|
|
87
|
+
return new ZikoUIThead(...UI)
|
|
88
|
+
}
|
|
89
|
+
const tbody=(...ZikoUITr)=>new ZikoUITbody(...ZikoUITr)
|
|
90
|
+
const tfoot=(...ZikoUITr)=>new ZikoUITfoot(...ZikoUITr)
|
|
91
|
+
const caption=(ZikoUITr)=>new ZikoUICaption(ZikoUITr)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
export {th,tr,td,thead,tbody,tfoot,caption}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import ZikoUIElement from "../ZikoUIElement.js"
|
|
2
|
+
import { tbody,caption,ZikoUICaption,thead} from "./elements.js";
|
|
3
|
+
import { matrix } from "../../../../math/matrix/index.js";
|
|
4
|
+
import { MatrixToTableUI } from "./utils.js";
|
|
5
|
+
class ZikoUITable extends ZikoUIElement {
|
|
6
|
+
constructor(body,{caption=null,head=null,foot=null}={}){
|
|
7
|
+
super("table","Table");
|
|
8
|
+
this.structure={
|
|
9
|
+
caption,
|
|
10
|
+
head,
|
|
11
|
+
body:null,
|
|
12
|
+
foot
|
|
13
|
+
}
|
|
14
|
+
if(body)this.fromMatrix(body);
|
|
15
|
+
if(caption)this.setCaption(caption)
|
|
16
|
+
}
|
|
17
|
+
get isTable(){
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
get caption(){
|
|
21
|
+
return this.structure.caption;
|
|
22
|
+
}
|
|
23
|
+
get header(){
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
get body(){
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
get footer(){
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
setCaption(c){
|
|
33
|
+
this.removeCaption();
|
|
34
|
+
this.structure.caption=caption(c);
|
|
35
|
+
this.append(this.structure.caption);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
removeCaption(){
|
|
39
|
+
if(this.structure.caption)this.removeItem(...this.items.filter(n=>n instanceof ZikoUICaption));
|
|
40
|
+
this.structure.caption=null;
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
setHeader(...c){
|
|
44
|
+
this.tHead=thead(...c);
|
|
45
|
+
this.append(this.tHead);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
removeHeader(){
|
|
49
|
+
this.removeItem(...this.items.filter(n=>n instanceof ZikoUICaption));
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
setFooter(c){
|
|
53
|
+
this.structure.caption=caption(c);
|
|
54
|
+
this.append(this.structure.caption);
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
removeFooter(){
|
|
58
|
+
this.removeItem(...this.items.filter(n=>n instanceof ZikoUICaption));
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
fromMatrix(bodyMatrix) {
|
|
62
|
+
(bodyMatrix instanceof Array)?this.bodyMatrix=matrix(bodyMatrix):this.bodyMatrix=bodyMatrix;
|
|
63
|
+
if(this.structure.body)this.remove(this.structure.body);
|
|
64
|
+
this.structure.body=tbody()
|
|
65
|
+
this.append(this.structure.body);
|
|
66
|
+
this.structure.body.append(...MatrixToTableUI(this.bodyMatrix))
|
|
67
|
+
//this.structure.body.append(...MatrixToTableUI(matrix))
|
|
68
|
+
//this.cellStyles({ padding: "0.2rem 0.4rem", textAlign: "center" });
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
transpose() {
|
|
72
|
+
this.fromMatrix(this.bodyMatrix.T);
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
hstack(m) {
|
|
76
|
+
if(m instanceof ZikoUITable)m=m.bodyMatrix
|
|
77
|
+
this.fromMatrix(this.bodyMatrix.clone.hstack(m));
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
vstack(m) {
|
|
81
|
+
if(m instanceof ZikoUITable)m=m.bodyMatrix
|
|
82
|
+
this.fromMatrix(this.bodyMatrix.clone.vstack(m));
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
slice(r0=0,c0=0,r1=this.bodyMatrix.rows-1,c1=this.bodyMatrix.cols-1) {
|
|
86
|
+
this.fromMatrix(this.bodyMatrix.slice(r0,c0,r1,c1));
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
sortByCols(n, config = { type: "num", order: "asc" }) {
|
|
90
|
+
this.fromMatrix(this.bodyMatrix.clone.sortTable(n, config));
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
sortByRows(n, config = { type: "num", order: "asc" }) {
|
|
94
|
+
this.fromMatrix(this.bodyMatrix.T.clone.sortTable(n, config).T);
|
|
95
|
+
return this;
|
|
96
|
+
}
|
|
97
|
+
filterByRows(item) {
|
|
98
|
+
this.fromMatrix(this.bodyMatrix.clone.filterByRows(item));
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
filterByCols(item) {
|
|
102
|
+
this.fromMatrix(this.bodyMatrix.clone.filterByCols(item));
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
forEachRow(callback){
|
|
106
|
+
this.structure.body.forEach(callback);
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
forEachItem(callback){
|
|
110
|
+
this.structure.body.forEach(n=>n.forEach(callback));
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const Table=(matrix,config)=>new ZikoUITable(matrix,config)
|
|
115
|
+
export {Table}
|