coles-solid-library 0.0.1
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/components/Button/Button.d.ts +15 -0
- package/dist/components/Carosel/Carosel.d.ts +15 -0
- package/dist/components/Chip/Chip.d.ts +12 -0
- package/dist/components/Chipbar/chipbar.d.ts +13 -0
- package/dist/components/ComponentBody/body.component.d.ts +10 -0
- package/dist/components/FormField/formField.d.ts +13 -0
- package/dist/components/FormField/formProvider.d.ts +22 -0
- package/dist/components/Input/Input.d.ts +13 -0
- package/dist/components/Select/option.component.d.ts +9 -0
- package/dist/components/Select/select.component.d.ts +27 -0
- package/dist/components/Snackbar/snackbar.d.ts +11 -0
- package/dist/components/Table/innerTable.d.ts +30 -0
- package/dist/components/Table/rowProvider.d.ts +15 -0
- package/dist/components/Table/table.d.ts +15 -0
- package/dist/components/Table/tableProvider.d.ts +24 -0
- package/dist/components/Table2/table.d.ts +13 -0
- package/dist/components/Tabs/tab.d.ts +8 -0
- package/dist/components/Tabs/tabs.d.ts +18 -0
- package/dist/components/TextArea/TextArea.d.ts +15 -0
- package/dist/components/cssmodule.d.ts +70 -0
- package/dist/components/expansion/expansion.d.ts +18 -0
- package/dist/components/popup/popup.component.d.ts +34 -0
- package/dist/components/svgs/arrows.d.ts +6 -0
- package/dist/components/svgs/barMenu.d.ts +3 -0
- package/dist/components/svgs/calulator.d.ts +5 -0
- package/dist/components/svgs/camera.d.ts +6 -0
- package/dist/components/svgs/eye.d.ts +4 -0
- package/dist/components/svgs/gear.d.ts +6 -0
- package/dist/components/svgs/pencil.d.ts +4 -0
- package/dist/components/svgs/skinnySnowman.d.ts +6 -0
- package/dist/index.cjs.js +1866 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.esm.js +1848 -0
- package/dist/styles.css +752 -0
- package/dist/tools.d.ts +11 -0
- package/package.json +38 -0
|
@@ -0,0 +1,1848 @@
|
|
|
1
|
+
import { sharedConfig, createRenderEffect, untrack, getOwner, createEffect, runWithOwner, createMemo, createSignal, createRoot, onCleanup, mergeProps, createComponent, Show, onMount, For, splitProps, createContext, useContext, children } from 'solid-js';
|
|
2
|
+
|
|
3
|
+
const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
|
|
4
|
+
const Properties = /*#__PURE__*/new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
|
|
5
|
+
const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
|
|
6
|
+
const Aliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
7
|
+
className: "class",
|
|
8
|
+
htmlFor: "for"
|
|
9
|
+
});
|
|
10
|
+
const PropAliases = /*#__PURE__*/Object.assign(Object.create(null), {
|
|
11
|
+
class: "className",
|
|
12
|
+
formnovalidate: {
|
|
13
|
+
$: "formNoValidate",
|
|
14
|
+
BUTTON: 1,
|
|
15
|
+
INPUT: 1
|
|
16
|
+
},
|
|
17
|
+
ismap: {
|
|
18
|
+
$: "isMap",
|
|
19
|
+
IMG: 1
|
|
20
|
+
},
|
|
21
|
+
nomodule: {
|
|
22
|
+
$: "noModule",
|
|
23
|
+
SCRIPT: 1
|
|
24
|
+
},
|
|
25
|
+
playsinline: {
|
|
26
|
+
$: "playsInline",
|
|
27
|
+
VIDEO: 1
|
|
28
|
+
},
|
|
29
|
+
readonly: {
|
|
30
|
+
$: "readOnly",
|
|
31
|
+
INPUT: 1,
|
|
32
|
+
TEXTAREA: 1
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
function getPropAlias(prop, tagName) {
|
|
36
|
+
const a = PropAliases[prop];
|
|
37
|
+
return typeof a === "object" ? a[tagName] ? a["$"] : undefined : a;
|
|
38
|
+
}
|
|
39
|
+
const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
|
|
40
|
+
const SVGNamespace = {
|
|
41
|
+
xlink: "http://www.w3.org/1999/xlink",
|
|
42
|
+
xml: "http://www.w3.org/XML/1998/namespace"
|
|
43
|
+
};
|
|
44
|
+
function reconcileArrays(parentNode, a, b) {
|
|
45
|
+
let bLength = b.length,
|
|
46
|
+
aEnd = a.length,
|
|
47
|
+
bEnd = bLength,
|
|
48
|
+
aStart = 0,
|
|
49
|
+
bStart = 0,
|
|
50
|
+
after = a[aEnd - 1].nextSibling,
|
|
51
|
+
map = null;
|
|
52
|
+
while (aStart < aEnd || bStart < bEnd) {
|
|
53
|
+
if (a[aStart] === b[bStart]) {
|
|
54
|
+
aStart++;
|
|
55
|
+
bStart++;
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
while (a[aEnd - 1] === b[bEnd - 1]) {
|
|
59
|
+
aEnd--;
|
|
60
|
+
bEnd--;
|
|
61
|
+
}
|
|
62
|
+
if (aEnd === aStart) {
|
|
63
|
+
const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
|
|
64
|
+
while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
|
|
65
|
+
} else if (bEnd === bStart) {
|
|
66
|
+
while (aStart < aEnd) {
|
|
67
|
+
if (!map || !map.has(a[aStart])) a[aStart].remove();
|
|
68
|
+
aStart++;
|
|
69
|
+
}
|
|
70
|
+
} else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
|
|
71
|
+
const node = a[--aEnd].nextSibling;
|
|
72
|
+
parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
|
|
73
|
+
parentNode.insertBefore(b[--bEnd], node);
|
|
74
|
+
a[aEnd] = b[bEnd];
|
|
75
|
+
} else {
|
|
76
|
+
if (!map) {
|
|
77
|
+
map = new Map();
|
|
78
|
+
let i = bStart;
|
|
79
|
+
while (i < bEnd) map.set(b[i], i++);
|
|
80
|
+
}
|
|
81
|
+
const index = map.get(a[aStart]);
|
|
82
|
+
if (index != null) {
|
|
83
|
+
if (bStart < index && index < bEnd) {
|
|
84
|
+
let i = aStart,
|
|
85
|
+
sequence = 1,
|
|
86
|
+
t;
|
|
87
|
+
while (++i < aEnd && i < bEnd) {
|
|
88
|
+
if ((t = map.get(a[i])) == null || t !== index + sequence) break;
|
|
89
|
+
sequence++;
|
|
90
|
+
}
|
|
91
|
+
if (sequence > index - bStart) {
|
|
92
|
+
const node = a[aStart];
|
|
93
|
+
while (bStart < index) parentNode.insertBefore(b[bStart++], node);
|
|
94
|
+
} else parentNode.replaceChild(b[bStart++], a[aStart++]);
|
|
95
|
+
} else aStart++;
|
|
96
|
+
} else a[aStart++].remove();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const $$EVENTS = "_$DX_DELEGATE";
|
|
101
|
+
function template(html, isImportNode, isSVG, isMathML) {
|
|
102
|
+
let node;
|
|
103
|
+
const create = () => {
|
|
104
|
+
const t = document.createElement("template");
|
|
105
|
+
t.innerHTML = html;
|
|
106
|
+
return t.content.firstChild;
|
|
107
|
+
};
|
|
108
|
+
const fn = () => (node || (node = create())).cloneNode(true);
|
|
109
|
+
fn.cloneNode = fn;
|
|
110
|
+
return fn;
|
|
111
|
+
}
|
|
112
|
+
function delegateEvents(eventNames, document = window.document) {
|
|
113
|
+
const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
|
|
114
|
+
for (let i = 0, l = eventNames.length; i < l; i++) {
|
|
115
|
+
const name = eventNames[i];
|
|
116
|
+
if (!e.has(name)) {
|
|
117
|
+
e.add(name);
|
|
118
|
+
document.addEventListener(name, eventHandler);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function setAttribute(node, name, value) {
|
|
123
|
+
if (isHydrating(node)) return;
|
|
124
|
+
if (value == null) node.removeAttribute(name);else node.setAttribute(name, value);
|
|
125
|
+
}
|
|
126
|
+
function setAttributeNS(node, namespace, name, value) {
|
|
127
|
+
if (isHydrating(node)) return;
|
|
128
|
+
if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
|
|
129
|
+
}
|
|
130
|
+
function setBoolAttribute(node, name, value) {
|
|
131
|
+
if (isHydrating(node)) return;
|
|
132
|
+
value ? node.setAttribute(name, "") : node.removeAttribute(name);
|
|
133
|
+
}
|
|
134
|
+
function className(node, value) {
|
|
135
|
+
if (isHydrating(node)) return;
|
|
136
|
+
if (value == null) node.removeAttribute("class");else node.className = value;
|
|
137
|
+
}
|
|
138
|
+
function addEventListener(node, name, handler, delegate) {
|
|
139
|
+
if (delegate) {
|
|
140
|
+
if (Array.isArray(handler)) {
|
|
141
|
+
node[`$$${name}`] = handler[0];
|
|
142
|
+
node[`$$${name}Data`] = handler[1];
|
|
143
|
+
} else node[`$$${name}`] = handler;
|
|
144
|
+
} else if (Array.isArray(handler)) {
|
|
145
|
+
const handlerFn = handler[0];
|
|
146
|
+
node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
|
|
147
|
+
} else node.addEventListener(name, handler, typeof handler !== "function" && handler);
|
|
148
|
+
}
|
|
149
|
+
function classList(node, value, prev = {}) {
|
|
150
|
+
const classKeys = Object.keys(value || {}),
|
|
151
|
+
prevKeys = Object.keys(prev);
|
|
152
|
+
let i, len;
|
|
153
|
+
for (i = 0, len = prevKeys.length; i < len; i++) {
|
|
154
|
+
const key = prevKeys[i];
|
|
155
|
+
if (!key || key === "undefined" || value[key]) continue;
|
|
156
|
+
toggleClassKey(node, key, false);
|
|
157
|
+
delete prev[key];
|
|
158
|
+
}
|
|
159
|
+
for (i = 0, len = classKeys.length; i < len; i++) {
|
|
160
|
+
const key = classKeys[i],
|
|
161
|
+
classValue = !!value[key];
|
|
162
|
+
if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
|
|
163
|
+
toggleClassKey(node, key, true);
|
|
164
|
+
prev[key] = classValue;
|
|
165
|
+
}
|
|
166
|
+
return prev;
|
|
167
|
+
}
|
|
168
|
+
function style(node, value, prev) {
|
|
169
|
+
if (!value) return prev ? setAttribute(node, "style") : value;
|
|
170
|
+
const nodeStyle = node.style;
|
|
171
|
+
if (typeof value === "string") return nodeStyle.cssText = value;
|
|
172
|
+
typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
|
|
173
|
+
prev || (prev = {});
|
|
174
|
+
value || (value = {});
|
|
175
|
+
let v, s;
|
|
176
|
+
for (s in prev) {
|
|
177
|
+
value[s] == null && nodeStyle.removeProperty(s);
|
|
178
|
+
delete prev[s];
|
|
179
|
+
}
|
|
180
|
+
for (s in value) {
|
|
181
|
+
v = value[s];
|
|
182
|
+
if (v !== prev[s]) {
|
|
183
|
+
nodeStyle.setProperty(s, v);
|
|
184
|
+
prev[s] = v;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return prev;
|
|
188
|
+
}
|
|
189
|
+
function spread(node, props = {}, isSVG, skipChildren) {
|
|
190
|
+
const prevProps = {};
|
|
191
|
+
if (!skipChildren) {
|
|
192
|
+
createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
|
|
193
|
+
}
|
|
194
|
+
createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
|
|
195
|
+
createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
|
|
196
|
+
return prevProps;
|
|
197
|
+
}
|
|
198
|
+
function use(fn, element, arg) {
|
|
199
|
+
return untrack(() => fn(element, arg));
|
|
200
|
+
}
|
|
201
|
+
function insert(parent, accessor, marker, initial) {
|
|
202
|
+
if (marker !== undefined && !initial) initial = [];
|
|
203
|
+
if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
|
|
204
|
+
createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);
|
|
205
|
+
}
|
|
206
|
+
function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
|
|
207
|
+
props || (props = {});
|
|
208
|
+
for (const prop in prevProps) {
|
|
209
|
+
if (!(prop in props)) {
|
|
210
|
+
if (prop === "children") continue;
|
|
211
|
+
prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef, props);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
for (const prop in props) {
|
|
215
|
+
if (prop === "children") {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
const value = props[prop];
|
|
219
|
+
prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef, props);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function isHydrating(node) {
|
|
223
|
+
return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
|
|
224
|
+
}
|
|
225
|
+
function toPropertyName(name) {
|
|
226
|
+
return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
|
|
227
|
+
}
|
|
228
|
+
function toggleClassKey(node, key, value) {
|
|
229
|
+
const classNames = key.trim().split(/\s+/);
|
|
230
|
+
for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
|
|
231
|
+
}
|
|
232
|
+
function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
|
|
233
|
+
let isCE, isProp, isChildProp, propAlias, forceProp;
|
|
234
|
+
if (prop === "style") return style(node, value, prev);
|
|
235
|
+
if (prop === "classList") return classList(node, value, prev);
|
|
236
|
+
if (value === prev) return prev;
|
|
237
|
+
if (prop === "ref") {
|
|
238
|
+
if (!skipRef) value(node);
|
|
239
|
+
} else if (prop.slice(0, 3) === "on:") {
|
|
240
|
+
const e = prop.slice(3);
|
|
241
|
+
prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
|
|
242
|
+
value && node.addEventListener(e, value, typeof value !== "function" && value);
|
|
243
|
+
} else if (prop.slice(0, 10) === "oncapture:") {
|
|
244
|
+
const e = prop.slice(10);
|
|
245
|
+
prev && node.removeEventListener(e, prev, true);
|
|
246
|
+
value && node.addEventListener(e, value, true);
|
|
247
|
+
} else if (prop.slice(0, 2) === "on") {
|
|
248
|
+
const name = prop.slice(2).toLowerCase();
|
|
249
|
+
const delegate = DelegatedEvents.has(name);
|
|
250
|
+
if (!delegate && prev) {
|
|
251
|
+
const h = Array.isArray(prev) ? prev[0] : prev;
|
|
252
|
+
node.removeEventListener(name, h);
|
|
253
|
+
}
|
|
254
|
+
if (delegate || value) {
|
|
255
|
+
addEventListener(node, name, value, delegate);
|
|
256
|
+
delegate && delegateEvents([name]);
|
|
257
|
+
}
|
|
258
|
+
} else if (prop.slice(0, 5) === "attr:") {
|
|
259
|
+
setAttribute(node, prop.slice(5), value);
|
|
260
|
+
} else if (prop.slice(0, 5) === "bool:") {
|
|
261
|
+
setBoolAttribute(node, prop.slice(5), value);
|
|
262
|
+
} else if ((forceProp = prop.slice(0, 5) === "prop:") || (isChildProp = ChildProperties.has(prop)) || !isSVG && ((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop))) || (isCE = node.nodeName.includes("-") || "is" in props)) {
|
|
263
|
+
if (forceProp) {
|
|
264
|
+
prop = prop.slice(5);
|
|
265
|
+
isProp = true;
|
|
266
|
+
} else if (isHydrating(node)) return value;
|
|
267
|
+
if (prop === "class" || prop === "className") className(node, value);else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;else node[propAlias || prop] = value;
|
|
268
|
+
} else {
|
|
269
|
+
const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
|
|
270
|
+
if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, Aliases[prop] || prop, value);
|
|
271
|
+
}
|
|
272
|
+
return value;
|
|
273
|
+
}
|
|
274
|
+
function eventHandler(e) {
|
|
275
|
+
if (sharedConfig.registry && sharedConfig.events) {
|
|
276
|
+
if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
|
|
277
|
+
}
|
|
278
|
+
let node = e.target;
|
|
279
|
+
const key = `$$${e.type}`;
|
|
280
|
+
const oriTarget = e.target;
|
|
281
|
+
const oriCurrentTarget = e.currentTarget;
|
|
282
|
+
const retarget = value => Object.defineProperty(e, "target", {
|
|
283
|
+
configurable: true,
|
|
284
|
+
value
|
|
285
|
+
});
|
|
286
|
+
const handleNode = () => {
|
|
287
|
+
const handler = node[key];
|
|
288
|
+
if (handler && !node.disabled) {
|
|
289
|
+
const data = node[`${key}Data`];
|
|
290
|
+
data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
|
|
291
|
+
if (e.cancelBubble) return;
|
|
292
|
+
}
|
|
293
|
+
node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
|
|
294
|
+
return true;
|
|
295
|
+
};
|
|
296
|
+
const walkUpTree = () => {
|
|
297
|
+
while (handleNode() && (node = node._$host || node.parentNode || node.host));
|
|
298
|
+
};
|
|
299
|
+
Object.defineProperty(e, "currentTarget", {
|
|
300
|
+
configurable: true,
|
|
301
|
+
get() {
|
|
302
|
+
return node || document;
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
|
|
306
|
+
if (e.composedPath) {
|
|
307
|
+
const path = e.composedPath();
|
|
308
|
+
retarget(path[0]);
|
|
309
|
+
for (let i = 0; i < path.length - 2; i++) {
|
|
310
|
+
node = path[i];
|
|
311
|
+
if (!handleNode()) break;
|
|
312
|
+
if (node._$host) {
|
|
313
|
+
node = node._$host;
|
|
314
|
+
walkUpTree();
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
if (node.parentNode === oriCurrentTarget) {
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
} else walkUpTree();
|
|
322
|
+
retarget(oriTarget);
|
|
323
|
+
}
|
|
324
|
+
function insertExpression(parent, value, current, marker, unwrapArray) {
|
|
325
|
+
const hydrating = isHydrating(parent);
|
|
326
|
+
if (hydrating) {
|
|
327
|
+
!current && (current = [...parent.childNodes]);
|
|
328
|
+
let cleaned = [];
|
|
329
|
+
for (let i = 0; i < current.length; i++) {
|
|
330
|
+
const node = current[i];
|
|
331
|
+
if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();else cleaned.push(node);
|
|
332
|
+
}
|
|
333
|
+
current = cleaned;
|
|
334
|
+
}
|
|
335
|
+
while (typeof current === "function") current = current();
|
|
336
|
+
if (value === current) return current;
|
|
337
|
+
const t = typeof value,
|
|
338
|
+
multi = marker !== undefined;
|
|
339
|
+
parent = multi && current[0] && current[0].parentNode || parent;
|
|
340
|
+
if (t === "string" || t === "number") {
|
|
341
|
+
if (hydrating) return current;
|
|
342
|
+
if (t === "number") {
|
|
343
|
+
value = value.toString();
|
|
344
|
+
if (value === current) return current;
|
|
345
|
+
}
|
|
346
|
+
if (multi) {
|
|
347
|
+
let node = current[0];
|
|
348
|
+
if (node && node.nodeType === 3) {
|
|
349
|
+
node.data !== value && (node.data = value);
|
|
350
|
+
} else node = document.createTextNode(value);
|
|
351
|
+
current = cleanChildren(parent, current, marker, node);
|
|
352
|
+
} else {
|
|
353
|
+
if (current !== "" && typeof current === "string") {
|
|
354
|
+
current = parent.firstChild.data = value;
|
|
355
|
+
} else current = parent.textContent = value;
|
|
356
|
+
}
|
|
357
|
+
} else if (value == null || t === "boolean") {
|
|
358
|
+
if (hydrating) return current;
|
|
359
|
+
current = cleanChildren(parent, current, marker);
|
|
360
|
+
} else if (t === "function") {
|
|
361
|
+
createRenderEffect(() => {
|
|
362
|
+
let v = value();
|
|
363
|
+
while (typeof v === "function") v = v();
|
|
364
|
+
current = insertExpression(parent, v, current, marker);
|
|
365
|
+
});
|
|
366
|
+
return () => current;
|
|
367
|
+
} else if (Array.isArray(value)) {
|
|
368
|
+
const array = [];
|
|
369
|
+
const currentArray = current && Array.isArray(current);
|
|
370
|
+
if (normalizeIncomingArray(array, value, current, unwrapArray)) {
|
|
371
|
+
createRenderEffect(() => current = insertExpression(parent, array, current, marker, true));
|
|
372
|
+
return () => current;
|
|
373
|
+
}
|
|
374
|
+
if (hydrating) {
|
|
375
|
+
if (!array.length) return current;
|
|
376
|
+
if (marker === undefined) return current = [...parent.childNodes];
|
|
377
|
+
let node = array[0];
|
|
378
|
+
if (node.parentNode !== parent) return current;
|
|
379
|
+
const nodes = [node];
|
|
380
|
+
while ((node = node.nextSibling) !== marker) nodes.push(node);
|
|
381
|
+
return current = nodes;
|
|
382
|
+
}
|
|
383
|
+
if (array.length === 0) {
|
|
384
|
+
current = cleanChildren(parent, current, marker);
|
|
385
|
+
if (multi) return current;
|
|
386
|
+
} else if (currentArray) {
|
|
387
|
+
if (current.length === 0) {
|
|
388
|
+
appendNodes(parent, array, marker);
|
|
389
|
+
} else reconcileArrays(parent, current, array);
|
|
390
|
+
} else {
|
|
391
|
+
current && cleanChildren(parent);
|
|
392
|
+
appendNodes(parent, array);
|
|
393
|
+
}
|
|
394
|
+
current = array;
|
|
395
|
+
} else if (value.nodeType) {
|
|
396
|
+
if (hydrating && value.parentNode) return current = multi ? [value] : value;
|
|
397
|
+
if (Array.isArray(current)) {
|
|
398
|
+
if (multi) return current = cleanChildren(parent, current, marker, value);
|
|
399
|
+
cleanChildren(parent, current, null, value);
|
|
400
|
+
} else if (current == null || current === "" || !parent.firstChild) {
|
|
401
|
+
parent.appendChild(value);
|
|
402
|
+
} else parent.replaceChild(value, parent.firstChild);
|
|
403
|
+
current = value;
|
|
404
|
+
} else ;
|
|
405
|
+
return current;
|
|
406
|
+
}
|
|
407
|
+
function normalizeIncomingArray(normalized, array, current, unwrap) {
|
|
408
|
+
let dynamic = false;
|
|
409
|
+
for (let i = 0, len = array.length; i < len; i++) {
|
|
410
|
+
let item = array[i],
|
|
411
|
+
prev = current && current[normalized.length],
|
|
412
|
+
t;
|
|
413
|
+
if (item == null || item === true || item === false) ;else if ((t = typeof item) === "object" && item.nodeType) {
|
|
414
|
+
normalized.push(item);
|
|
415
|
+
} else if (Array.isArray(item)) {
|
|
416
|
+
dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
|
|
417
|
+
} else if (t === "function") {
|
|
418
|
+
if (unwrap) {
|
|
419
|
+
while (typeof item === "function") item = item();
|
|
420
|
+
dynamic = normalizeIncomingArray(normalized, Array.isArray(item) ? item : [item], Array.isArray(prev) ? prev : [prev]) || dynamic;
|
|
421
|
+
} else {
|
|
422
|
+
normalized.push(item);
|
|
423
|
+
dynamic = true;
|
|
424
|
+
}
|
|
425
|
+
} else {
|
|
426
|
+
const value = String(item);
|
|
427
|
+
if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);else normalized.push(document.createTextNode(value));
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return dynamic;
|
|
431
|
+
}
|
|
432
|
+
function appendNodes(parent, array, marker = null) {
|
|
433
|
+
for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
|
|
434
|
+
}
|
|
435
|
+
function cleanChildren(parent, current, marker, replacement) {
|
|
436
|
+
if (marker === undefined) return parent.textContent = "";
|
|
437
|
+
const node = replacement || document.createTextNode("");
|
|
438
|
+
if (current.length) {
|
|
439
|
+
let inserted = false;
|
|
440
|
+
for (let i = current.length - 1; i >= 0; i--) {
|
|
441
|
+
const el = current[i];
|
|
442
|
+
if (node !== el) {
|
|
443
|
+
const isParent = el.parentNode === parent;
|
|
444
|
+
if (!inserted && !i) isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);else isParent && el.remove();
|
|
445
|
+
} else inserted = true;
|
|
446
|
+
}
|
|
447
|
+
} else parent.insertBefore(node, marker);
|
|
448
|
+
return [node];
|
|
449
|
+
}
|
|
450
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
451
|
+
function createElement(tagName, isSVG = false) {
|
|
452
|
+
return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
|
|
453
|
+
}
|
|
454
|
+
function Portal(props) {
|
|
455
|
+
const {
|
|
456
|
+
useShadow
|
|
457
|
+
} = props,
|
|
458
|
+
marker = document.createTextNode(""),
|
|
459
|
+
mount = () => props.mount || document.body,
|
|
460
|
+
owner = getOwner();
|
|
461
|
+
let content;
|
|
462
|
+
let hydrating = !!sharedConfig.context;
|
|
463
|
+
createEffect(() => {
|
|
464
|
+
if (hydrating) getOwner().user = hydrating = false;
|
|
465
|
+
content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
|
|
466
|
+
const el = mount();
|
|
467
|
+
if (el instanceof HTMLHeadElement) {
|
|
468
|
+
const [clean, setClean] = createSignal(false);
|
|
469
|
+
const cleanup = () => setClean(true);
|
|
470
|
+
createRoot(dispose => insert(el, () => !clean() ? content() : dispose(), null));
|
|
471
|
+
onCleanup(cleanup);
|
|
472
|
+
} else {
|
|
473
|
+
const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
|
|
474
|
+
renderRoot = useShadow && container.attachShadow ? container.attachShadow({
|
|
475
|
+
mode: "open"
|
|
476
|
+
}) : container;
|
|
477
|
+
Object.defineProperty(container, "_$host", {
|
|
478
|
+
get() {
|
|
479
|
+
return marker.parentNode;
|
|
480
|
+
},
|
|
481
|
+
configurable: true
|
|
482
|
+
});
|
|
483
|
+
insert(renderRoot, content);
|
|
484
|
+
el.appendChild(container);
|
|
485
|
+
props.ref && props.ref(container);
|
|
486
|
+
onCleanup(() => el.removeChild(container));
|
|
487
|
+
}
|
|
488
|
+
}, undefined, {
|
|
489
|
+
render: !hydrating
|
|
490
|
+
});
|
|
491
|
+
return marker;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
var _tmpl$$d = /*#__PURE__*/template(`<button>`);
|
|
495
|
+
const Button = props => {
|
|
496
|
+
const styleTypeConst = props.styleType ?? "accent";
|
|
497
|
+
return (() => {
|
|
498
|
+
var _el$ = _tmpl$$d();
|
|
499
|
+
spread(_el$, mergeProps(props, {
|
|
500
|
+
"onClick": e => {
|
|
501
|
+
if (props.onClick) props.onClick(e);
|
|
502
|
+
},
|
|
503
|
+
get ["class"]() {
|
|
504
|
+
return `.${styleTypeConst} .customButtonStyle ${props.transparent ? '.transparent' : ""} ${props.class ?? ""} `;
|
|
505
|
+
}
|
|
506
|
+
}), false, true);
|
|
507
|
+
insert(_el$, () => props.children);
|
|
508
|
+
return _el$;
|
|
509
|
+
})();
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
var _tmpl$$c = /*#__PURE__*/template(`<span>`),
|
|
513
|
+
_tmpl$2$7 = /*#__PURE__*/template(`<span>:`),
|
|
514
|
+
_tmpl$3$4 = /*#__PURE__*/template(`<span><span>`);
|
|
515
|
+
const Chip = props => {
|
|
516
|
+
const hoverChip = props.onClick ? '.hover' : "";
|
|
517
|
+
return (() => {
|
|
518
|
+
var _el$ = _tmpl$3$4(),
|
|
519
|
+
_el$4 = _el$.firstChild;
|
|
520
|
+
addEventListener(_el$, "click", props.onClick, true);
|
|
521
|
+
insert(_el$, createComponent(Show, {
|
|
522
|
+
get when() {
|
|
523
|
+
return !!props.key;
|
|
524
|
+
},
|
|
525
|
+
get children() {
|
|
526
|
+
return [(() => {
|
|
527
|
+
var _el$2 = _tmpl$$c();
|
|
528
|
+
insert(_el$2, () => props.key);
|
|
529
|
+
return _el$2;
|
|
530
|
+
})(), _tmpl$2$7()];
|
|
531
|
+
}
|
|
532
|
+
}), _el$4);
|
|
533
|
+
insert(_el$4, () => ' ' + props.value);
|
|
534
|
+
insert(_el$, createComponent(Show, {
|
|
535
|
+
get when() {
|
|
536
|
+
return !!props.remove;
|
|
537
|
+
},
|
|
538
|
+
get children() {
|
|
539
|
+
return createComponent(Button, {
|
|
540
|
+
"class": `'.hover' .removeChipButton`,
|
|
541
|
+
get onClick() {
|
|
542
|
+
return props.remove;
|
|
543
|
+
},
|
|
544
|
+
children: "X"
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
}), null);
|
|
548
|
+
createRenderEffect(() => className(_el$, `.accent .Chip ${props.class ?? ""} ${hoverChip}`));
|
|
549
|
+
return _el$;
|
|
550
|
+
})();
|
|
551
|
+
};
|
|
552
|
+
delegateEvents(["click"]);
|
|
553
|
+
|
|
554
|
+
var _tmpl$$b = /*#__PURE__*/template(`<span class=.leftArrow>`),
|
|
555
|
+
_tmpl$2$6 = /*#__PURE__*/template(`<span>`),
|
|
556
|
+
_tmpl$3$3 = /*#__PURE__*/template(`<span class=.rightArrow>`),
|
|
557
|
+
_tmpl$4$3 = /*#__PURE__*/template(`<div class=.chipbar><div class=.chipContainer>`);
|
|
558
|
+
const Chipbar = props => {
|
|
559
|
+
const [chipContainer, setChipContainer] = createSignal();
|
|
560
|
+
const [showLeft, setShowLeft] = createSignal(false);
|
|
561
|
+
const [showRight, setShowRight] = createSignal(false);
|
|
562
|
+
const scrollFunction = e => {
|
|
563
|
+
setShowRight(chipContainer()?.scrollLeft !== chipContainer().scrollWidth - chipContainer().clientWidth);
|
|
564
|
+
setShowLeft(chipContainer().scrollLeft > 0);
|
|
565
|
+
if (chipContainer().scrollLeft <= 0) {
|
|
566
|
+
setShowLeft(false);
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
onMount(() => {
|
|
570
|
+
if (chipContainer()) {
|
|
571
|
+
chipContainer().addEventListener("scroll", scrollFunction);
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
onCleanup(() => {
|
|
575
|
+
if (chipContainer()) {
|
|
576
|
+
chipContainer().removeEventListener("scroll", scrollFunction);
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
createRenderEffect(() => {
|
|
580
|
+
if (props.chips().length > 0) {
|
|
581
|
+
scrollFunction();
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
const scrollLeft = () => {
|
|
585
|
+
chipContainer().scrollLeft -= 100;
|
|
586
|
+
scrollFunction();
|
|
587
|
+
};
|
|
588
|
+
const scrollRight = () => {
|
|
589
|
+
chipContainer().scrollLeft += 100;
|
|
590
|
+
scrollFunction();
|
|
591
|
+
setShowLeft(true);
|
|
592
|
+
};
|
|
593
|
+
return createComponent(Show, {
|
|
594
|
+
get when() {
|
|
595
|
+
return props.chips().length > 0;
|
|
596
|
+
},
|
|
597
|
+
get children() {
|
|
598
|
+
var _el$ = _tmpl$4$3(),
|
|
599
|
+
_el$3 = _el$.firstChild;
|
|
600
|
+
insert(_el$, createComponent(Show, {
|
|
601
|
+
get when() {
|
|
602
|
+
return showLeft();
|
|
603
|
+
},
|
|
604
|
+
get children() {
|
|
605
|
+
var _el$2 = _tmpl$$b();
|
|
606
|
+
insert(_el$2, createComponent(Button, {
|
|
607
|
+
onClick: scrollLeft,
|
|
608
|
+
children: "\u2190"
|
|
609
|
+
}));
|
|
610
|
+
return _el$2;
|
|
611
|
+
}
|
|
612
|
+
}), _el$3);
|
|
613
|
+
use(setChipContainer, _el$3);
|
|
614
|
+
insert(_el$3, createComponent(Show, {
|
|
615
|
+
get when() {
|
|
616
|
+
return props.chips().length > 1;
|
|
617
|
+
},
|
|
618
|
+
get children() {
|
|
619
|
+
var _el$4 = _tmpl$2$6();
|
|
620
|
+
insert(_el$4, createComponent(Button, {
|
|
621
|
+
onClick: () => props.setChips ? props.setChips([]) : null,
|
|
622
|
+
children: "Clear All"
|
|
623
|
+
}));
|
|
624
|
+
return _el$4;
|
|
625
|
+
}
|
|
626
|
+
}), null);
|
|
627
|
+
insert(_el$3, createComponent(For, {
|
|
628
|
+
get each() {
|
|
629
|
+
return props.chips();
|
|
630
|
+
},
|
|
631
|
+
children: (chip, i) => createComponent(Chip, {
|
|
632
|
+
get key() {
|
|
633
|
+
return chip.key;
|
|
634
|
+
},
|
|
635
|
+
get value() {
|
|
636
|
+
return chip.value;
|
|
637
|
+
},
|
|
638
|
+
get remove() {
|
|
639
|
+
return props.chips().length > 0 ? () => props.setChips ? props.setChips(old => [...old].filter((x, index) => index !== i())) : null : undefined;
|
|
640
|
+
}
|
|
641
|
+
})
|
|
642
|
+
}), null);
|
|
643
|
+
insert(_el$, createComponent(Show, {
|
|
644
|
+
get when() {
|
|
645
|
+
return showRight();
|
|
646
|
+
},
|
|
647
|
+
get children() {
|
|
648
|
+
var _el$5 = _tmpl$3$3();
|
|
649
|
+
insert(_el$5, createComponent(Button, {
|
|
650
|
+
onClick: scrollRight,
|
|
651
|
+
children: "\u2192"
|
|
652
|
+
}));
|
|
653
|
+
return _el$5;
|
|
654
|
+
}
|
|
655
|
+
}), null);
|
|
656
|
+
return _el$;
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
var _tmpl$$a = /*#__PURE__*/template(`<div>`);
|
|
662
|
+
const Body = props => {
|
|
663
|
+
const [customProps, normalProps] = splitProps(props, ["children", "class", 'style']);
|
|
664
|
+
return (() => {
|
|
665
|
+
var _el$ = _tmpl$$a();
|
|
666
|
+
spread(_el$, mergeProps(normalProps, {
|
|
667
|
+
get ["class"]() {
|
|
668
|
+
return `${customProps.style} .compBody ${customProps.class ?? ""}`;
|
|
669
|
+
}
|
|
670
|
+
}), false, true);
|
|
671
|
+
insert(_el$, () => customProps.children);
|
|
672
|
+
return _el$;
|
|
673
|
+
})();
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
const FormFieldContext = createContext({
|
|
677
|
+
getName: () => "",
|
|
678
|
+
setName: () => {},
|
|
679
|
+
getTextInside: () => true,
|
|
680
|
+
setTextInside: () => {},
|
|
681
|
+
getFocused: () => false,
|
|
682
|
+
setFocused: () => {},
|
|
683
|
+
getValue: () => "",
|
|
684
|
+
setValue: () => {},
|
|
685
|
+
getFieldType: () => "",
|
|
686
|
+
setFieldType: () => {}
|
|
687
|
+
});
|
|
688
|
+
const Provider = props => {
|
|
689
|
+
const [getName, setName] = createSignal(props.name ?? "");
|
|
690
|
+
const [getTextInside, setTextInside] = createSignal(false);
|
|
691
|
+
const [getFocused, setFocused] = createSignal(false);
|
|
692
|
+
const [getValue, setValue] = createSignal(props.value ?? "");
|
|
693
|
+
const [getFieldType, setFieldType] = createSignal(props.type ?? "text");
|
|
694
|
+
return createComponent(FormFieldContext.Provider, {
|
|
695
|
+
value: {
|
|
696
|
+
getName,
|
|
697
|
+
setName,
|
|
698
|
+
getTextInside,
|
|
699
|
+
setTextInside,
|
|
700
|
+
getFocused,
|
|
701
|
+
setFocused,
|
|
702
|
+
getValue,
|
|
703
|
+
setValue,
|
|
704
|
+
getFieldType,
|
|
705
|
+
setFieldType
|
|
706
|
+
},
|
|
707
|
+
get children() {
|
|
708
|
+
return props.children;
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
};
|
|
712
|
+
function useFormProvider() {
|
|
713
|
+
const context = useContext(FormFieldContext);
|
|
714
|
+
return context;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
function useClickOutside(ref, handler) {
|
|
718
|
+
const listener = e => {
|
|
719
|
+
if (ref() && !ref().contains(e.target)) handler(e);
|
|
720
|
+
};
|
|
721
|
+
document.addEventListener("mousedown", listener);
|
|
722
|
+
return () => document.removeEventListener("mousedown", listener);
|
|
723
|
+
}
|
|
724
|
+
function isNullish(params) {
|
|
725
|
+
return params === null || params === undefined;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
var _tmpl$$9 = /*#__PURE__*/template(`<fieldset><legend>`);
|
|
729
|
+
const FormField = props => {
|
|
730
|
+
return createComponent(Provider, {
|
|
731
|
+
get name() {
|
|
732
|
+
return props.name;
|
|
733
|
+
},
|
|
734
|
+
get children() {
|
|
735
|
+
return createComponent(FormField2, props);
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
};
|
|
739
|
+
const FormField2 = props => {
|
|
740
|
+
const [local, others] = splitProps(props, ["children", "styleType", "name", "class", "value", "legendClass"]);
|
|
741
|
+
const context = useFormProvider();
|
|
742
|
+
const hasInsideText = createMemo(() => !context.getValue() && !context.getFocused() && !context.getTextInside());
|
|
743
|
+
// -- context --
|
|
744
|
+
const theChildren = children(() => props.children);
|
|
745
|
+
const [fieldRef, setFieldRef] = createSignal();
|
|
746
|
+
useClickOutside(fieldRef, () => {
|
|
747
|
+
context.setTextInside(!!context.getValue().trim());
|
|
748
|
+
context.setFocused(false);
|
|
749
|
+
});
|
|
750
|
+
createRenderEffect(() => {
|
|
751
|
+
context.setName(props.name);
|
|
752
|
+
});
|
|
753
|
+
return (() => {
|
|
754
|
+
var _el$ = _tmpl$$9(),
|
|
755
|
+
_el$2 = _el$.firstChild;
|
|
756
|
+
use(setFieldRef, _el$);
|
|
757
|
+
spread(_el$, mergeProps(others, {
|
|
758
|
+
"onClick": () => context.setFocused(true),
|
|
759
|
+
get ["class"]() {
|
|
760
|
+
return `.${local.styleType ?? "accent"} .formField ${local.class ?? ''}`;
|
|
761
|
+
}
|
|
762
|
+
}), false, true);
|
|
763
|
+
insert(_el$2, (() => {
|
|
764
|
+
var _c$ = createMemo(() => !!context.getName());
|
|
765
|
+
return () => _c$() ? context.getName() : ``;
|
|
766
|
+
})());
|
|
767
|
+
insert(_el$, theChildren, null);
|
|
768
|
+
createRenderEffect(() => className(_el$2, `${hasInsideText() ? `.moveLegendInside` : ``} ${local?.legendClass ?? ''}`));
|
|
769
|
+
return _el$;
|
|
770
|
+
})();
|
|
771
|
+
};
|
|
772
|
+
|
|
773
|
+
var _tmpl$$8 = /*#__PURE__*/template(`<input>`);
|
|
774
|
+
const Input = props => {
|
|
775
|
+
const [customProps, normalProps] = splitProps(props, ["tooltip", "transparent", "value", "onChange"]);
|
|
776
|
+
const noTransparent = type => "checkbox" !== (type ?? "text");
|
|
777
|
+
const context = useFormProvider();
|
|
778
|
+
const inputValue = createMemo(() => props.value);
|
|
779
|
+
const hasTrasparent = createMemo(() => {
|
|
780
|
+
return Object.keys(customProps).includes("transparent");
|
|
781
|
+
});
|
|
782
|
+
createEffect(() => {
|
|
783
|
+
if (Object.keys(props).includes("required") || props?.required === true) {
|
|
784
|
+
context.setName(old => `${old} *`);
|
|
785
|
+
} else {
|
|
786
|
+
context.setName(old => old);
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
onMount(() => {
|
|
790
|
+
if (!isNullish(context.getName)) {
|
|
791
|
+
context.setFieldType(props.type ?? "text");
|
|
792
|
+
}
|
|
793
|
+
});
|
|
794
|
+
return (() => {
|
|
795
|
+
var _el$ = _tmpl$$8();
|
|
796
|
+
spread(_el$, mergeProps(normalProps, {
|
|
797
|
+
get placeholder() {
|
|
798
|
+
return createMemo(() => !!(!!context.getName() && !context.getTextInside() && !context.getFocused()))() ? context.getName() : props.placeholder;
|
|
799
|
+
},
|
|
800
|
+
get value() {
|
|
801
|
+
return inputValue();
|
|
802
|
+
},
|
|
803
|
+
"onFocus": e => {
|
|
804
|
+
if (!isNullish(context.getName)) {
|
|
805
|
+
context.setFocused(true);
|
|
806
|
+
}
|
|
807
|
+
},
|
|
808
|
+
"onBlur": e => {
|
|
809
|
+
if (!isNullish(context.getName)) {
|
|
810
|
+
context.setFocused(false);
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
get type() {
|
|
814
|
+
return createMemo(() => context.getFieldType().length > 0)() ? context.getFieldType() : props.type;
|
|
815
|
+
},
|
|
816
|
+
"onChange": e => {
|
|
817
|
+
if (!isNullish(context.getName)) {
|
|
818
|
+
if (e.currentTarget.value.trim()) {
|
|
819
|
+
context.setValue(e.currentTarget.value);
|
|
820
|
+
context.setTextInside(true);
|
|
821
|
+
} else {
|
|
822
|
+
if (props.type === "checkbox") {
|
|
823
|
+
context.setValue(e.currentTarget.checked ? "true" : "");
|
|
824
|
+
context.setTextInside(e.currentTarget.checked);
|
|
825
|
+
} else {
|
|
826
|
+
context.setValue("");
|
|
827
|
+
context.setTextInside(false);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
if (props.onChange) props.onChange(e);
|
|
832
|
+
},
|
|
833
|
+
get ["class"]() {
|
|
834
|
+
return `input ${hasTrasparent() && noTransparent(normalProps.type) ? 'transparent' : ""} ${props.class ?? ""}`;
|
|
835
|
+
},
|
|
836
|
+
get title() {
|
|
837
|
+
return customProps.tooltip;
|
|
838
|
+
}
|
|
839
|
+
}), false, false);
|
|
840
|
+
return _el$;
|
|
841
|
+
})();
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
var _tmpl$$7 = /*#__PURE__*/template(`<span class=solid-select__placeholder>`),
|
|
845
|
+
_tmpl$2$5 = /*#__PURE__*/template(`<span>`),
|
|
846
|
+
_tmpl$3$2 = /*#__PURE__*/template(`<span class=solid-select__arrow>▲`),
|
|
847
|
+
_tmpl$4$2 = /*#__PURE__*/template(`<span class=solid-select__arrow>▼`),
|
|
848
|
+
_tmpl$5$1 = /*#__PURE__*/template(`<div>`),
|
|
849
|
+
_tmpl$6 = /*#__PURE__*/template(`<div tabindex=0><div><span class=solid-select__value>`);
|
|
850
|
+
const SelectContext = createContext();
|
|
851
|
+
function Select(props) {
|
|
852
|
+
const isMultiple = Object.keys(props).includes("multiple") || props.multiple === true ? !!props.multiple : false;
|
|
853
|
+
// Internal state for selected value(s). Use provided value or defaultValue or an initial default.
|
|
854
|
+
const currStyle = props.style ?? "accent";
|
|
855
|
+
const defaultSelected = isMultiple ? props.value ?? props.defaultValue ?? [] : props.value ?? props.defaultValue ?? undefined;
|
|
856
|
+
const [selected, setSelected] = createSignal(defaultSelected);
|
|
857
|
+
const [selectRef, setSelectRef] = createSignal();
|
|
858
|
+
const [dropdownRef, setDropdownRef] = createSignal();
|
|
859
|
+
// Update internal state if `value` prop changes (controlled mode)
|
|
860
|
+
createEffect(() => {
|
|
861
|
+
if (!isNullish(props.value)) {
|
|
862
|
+
setSelected(() => props.value);
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
// Signal for dropdown open/closed
|
|
866
|
+
const [open, setOpen] = createSignal(false);
|
|
867
|
+
// Map of option value to label (JSX) for displaying selected labels
|
|
868
|
+
const optionsMap = new Map();
|
|
869
|
+
const registerOption = (val, label) => {
|
|
870
|
+
optionsMap.set(val, label);
|
|
871
|
+
};
|
|
872
|
+
const unregisterOption = val => {
|
|
873
|
+
optionsMap.delete(val);
|
|
874
|
+
};
|
|
875
|
+
// Helper to check if a value is selected (for Option highlighting)
|
|
876
|
+
const isSelected = val => {
|
|
877
|
+
const current = selected();
|
|
878
|
+
return isMultiple ? Array.isArray(current) && current.includes(val) : current === val;
|
|
879
|
+
};
|
|
880
|
+
// Function to handle selecting/toggling an option
|
|
881
|
+
const selectValue = val => {
|
|
882
|
+
if (isMultiple) {
|
|
883
|
+
// For multi-select, toggle the value in the array
|
|
884
|
+
const current = selected() ?? [];
|
|
885
|
+
let newSelected;
|
|
886
|
+
console.log('current', current, val);
|
|
887
|
+
if (current.includes(val)) {
|
|
888
|
+
newSelected = current.filter(item => item !== val);
|
|
889
|
+
} else {
|
|
890
|
+
newSelected = [...current, val];
|
|
891
|
+
}
|
|
892
|
+
console.log('newSelected', newSelected);
|
|
893
|
+
setSelected(newSelected);
|
|
894
|
+
props.onChange?.(newSelected);
|
|
895
|
+
} else {
|
|
896
|
+
setSelected(() => val);
|
|
897
|
+
props.onChange?.(val);
|
|
898
|
+
setOpen(false);
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
const toggleOpen = () => {
|
|
902
|
+
setOpen(!open());
|
|
903
|
+
};
|
|
904
|
+
onMount(() => {
|
|
905
|
+
const handleOutsideClick = e => {
|
|
906
|
+
if (open() && dropdownRef() && !dropdownRef().contains(e.target)) {
|
|
907
|
+
setOpen(false);
|
|
908
|
+
}
|
|
909
|
+
};
|
|
910
|
+
document.addEventListener("mousedown", handleOutsideClick);
|
|
911
|
+
onCleanup(() => document.removeEventListener("mousedown", handleOutsideClick));
|
|
912
|
+
});
|
|
913
|
+
// Compute the content to display in the closed select (trigger area)
|
|
914
|
+
const displayValue = createMemo(() => {
|
|
915
|
+
const current = selected();
|
|
916
|
+
if (isMultiple) {
|
|
917
|
+
const selectedArray = Array.isArray(current) ? current : [];
|
|
918
|
+
if (selectedArray.length === 0) {
|
|
919
|
+
return (() => {
|
|
920
|
+
var _el$ = _tmpl$$7();
|
|
921
|
+
insert(_el$, () => props.placeholder || "Select...");
|
|
922
|
+
return _el$;
|
|
923
|
+
})();
|
|
924
|
+
}
|
|
925
|
+
if (props.renderValue) {
|
|
926
|
+
return props.renderValue(selectedArray);
|
|
927
|
+
} else {
|
|
928
|
+
const labels = selectedArray.map(val => optionsMap.get(val) || String(val));
|
|
929
|
+
return (() => {
|
|
930
|
+
var _el$2 = _tmpl$2$5();
|
|
931
|
+
insert(_el$2, () => labels.join(", "));
|
|
932
|
+
return _el$2;
|
|
933
|
+
})();
|
|
934
|
+
}
|
|
935
|
+
} else {
|
|
936
|
+
// Single selection
|
|
937
|
+
const singleVal = current;
|
|
938
|
+
if (singleVal === undefined || singleVal === null) {
|
|
939
|
+
return (() => {
|
|
940
|
+
var _el$3 = _tmpl$$7();
|
|
941
|
+
insert(_el$3, () => props.placeholder || "Select...");
|
|
942
|
+
return _el$3;
|
|
943
|
+
})();
|
|
944
|
+
}
|
|
945
|
+
if (props.renderValue) {
|
|
946
|
+
return props.renderValue(singleVal);
|
|
947
|
+
} else {
|
|
948
|
+
const label = optionsMap.get(singleVal) || String(singleVal);
|
|
949
|
+
return (() => {
|
|
950
|
+
var _el$4 = _tmpl$2$5();
|
|
951
|
+
insert(_el$4, label);
|
|
952
|
+
return _el$4;
|
|
953
|
+
})();
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
const selectLocation = () => {
|
|
958
|
+
if (selectRef()) {
|
|
959
|
+
const rect = selectRef().getBoundingClientRect();
|
|
960
|
+
return {
|
|
961
|
+
x: rect.left,
|
|
962
|
+
y: rect.bottom
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
return {
|
|
966
|
+
x: 0,
|
|
967
|
+
y: 0
|
|
968
|
+
};
|
|
969
|
+
};
|
|
970
|
+
const selectWidth = () => {
|
|
971
|
+
if (selectRef()) {
|
|
972
|
+
return selectRef().getBoundingClientRect().width;
|
|
973
|
+
}
|
|
974
|
+
return 0;
|
|
975
|
+
};
|
|
976
|
+
createEffect(() => {
|
|
977
|
+
console.log('selected', selected());
|
|
978
|
+
});
|
|
979
|
+
// Update width of select to match option text width
|
|
980
|
+
createEffect(() => {
|
|
981
|
+
if (selectRef() && dropdownRef()) {
|
|
982
|
+
const dropdownWidth = dropdownRef().getBoundingClientRect().width;
|
|
983
|
+
const selectWidth = selectRef().getBoundingClientRect().width;
|
|
984
|
+
if (dropdownWidth > selectWidth) {
|
|
985
|
+
setSelectRef(old => {
|
|
986
|
+
if (!old) return;
|
|
987
|
+
old.style.width = `${dropdownWidth}px`;
|
|
988
|
+
return old;
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
const isTransparent = Object.keys(props).includes("transparent") || props.transparent === true;
|
|
994
|
+
const styleClass = !isTransparent ? "solid-select__" + currStyle : '';
|
|
995
|
+
const styleClassDropdown = "solid-select__" + currStyle + "_dropdown";
|
|
996
|
+
const styleClassTransparent = isTransparent ? "solid-select__transparent" : "";
|
|
997
|
+
return (() => {
|
|
998
|
+
var _el$5 = _tmpl$6(),
|
|
999
|
+
_el$6 = _el$5.firstChild,
|
|
1000
|
+
_el$7 = _el$6.firstChild;
|
|
1001
|
+
_el$5.$$keydown = e => {
|
|
1002
|
+
// (Optional) keyboard support for navigation can be added here
|
|
1003
|
+
if (e.key === "Escape") setOpen(false);
|
|
1004
|
+
};
|
|
1005
|
+
_el$5.addEventListener("focus", () => {});
|
|
1006
|
+
use(setSelectRef, _el$5);
|
|
1007
|
+
className(_el$5, `solid-select ${styleClass} ${styleClassTransparent}`);
|
|
1008
|
+
_el$6.$$click = toggleOpen;
|
|
1009
|
+
insert(_el$7, displayValue);
|
|
1010
|
+
insert(_el$6, createComponent(Show, {
|
|
1011
|
+
get when() {
|
|
1012
|
+
return open();
|
|
1013
|
+
},
|
|
1014
|
+
get children() {
|
|
1015
|
+
return _tmpl$3$2();
|
|
1016
|
+
}
|
|
1017
|
+
}), null);
|
|
1018
|
+
insert(_el$6, createComponent(Show, {
|
|
1019
|
+
get when() {
|
|
1020
|
+
return !open();
|
|
1021
|
+
},
|
|
1022
|
+
get children() {
|
|
1023
|
+
return _tmpl$4$2();
|
|
1024
|
+
}
|
|
1025
|
+
}), null);
|
|
1026
|
+
insert(_el$5, createComponent(SelectContext.Provider, {
|
|
1027
|
+
value: {
|
|
1028
|
+
isSelected,
|
|
1029
|
+
selectValue,
|
|
1030
|
+
registerOption,
|
|
1031
|
+
unregisterOption,
|
|
1032
|
+
selectRef
|
|
1033
|
+
},
|
|
1034
|
+
get children() {
|
|
1035
|
+
return createComponent(Show, {
|
|
1036
|
+
get when() {
|
|
1037
|
+
return open();
|
|
1038
|
+
},
|
|
1039
|
+
get children() {
|
|
1040
|
+
return createComponent(Portal, {
|
|
1041
|
+
get children() {
|
|
1042
|
+
var _el$10 = _tmpl$5$1();
|
|
1043
|
+
use(setDropdownRef, _el$10);
|
|
1044
|
+
insert(_el$10, () => props.children);
|
|
1045
|
+
createRenderEffect(_p$ => {
|
|
1046
|
+
var _v$ = `solid-select__dropdown ${styleClassDropdown} ${props.dropdownClass || ""}`,
|
|
1047
|
+
_v$2 = `${selectLocation().y}px`,
|
|
1048
|
+
_v$3 = `${selectLocation().x}px`,
|
|
1049
|
+
_v$4 = `${selectWidth()}px`;
|
|
1050
|
+
_v$ !== _p$.e && className(_el$10, _p$.e = _v$);
|
|
1051
|
+
_v$2 !== _p$.t && ((_p$.t = _v$2) != null ? _el$10.style.setProperty("top", _v$2) : _el$10.style.removeProperty("top"));
|
|
1052
|
+
_v$3 !== _p$.a && ((_p$.a = _v$3) != null ? _el$10.style.setProperty("left", _v$3) : _el$10.style.removeProperty("left"));
|
|
1053
|
+
_v$4 !== _p$.o && ((_p$.o = _v$4) != null ? _el$10.style.setProperty("width", _v$4) : _el$10.style.removeProperty("width"));
|
|
1054
|
+
return _p$;
|
|
1055
|
+
}, {
|
|
1056
|
+
e: undefined,
|
|
1057
|
+
t: undefined,
|
|
1058
|
+
a: undefined,
|
|
1059
|
+
o: undefined
|
|
1060
|
+
});
|
|
1061
|
+
return _el$10;
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
}), null);
|
|
1068
|
+
createRenderEffect(_p$ => {
|
|
1069
|
+
var _v$5 = props.id,
|
|
1070
|
+
_v$6 = props.tooltip,
|
|
1071
|
+
_v$7 = `solid-select__control ${props.class || ""}`;
|
|
1072
|
+
_v$5 !== _p$.e && setAttribute(_el$5, "id", _p$.e = _v$5);
|
|
1073
|
+
_v$6 !== _p$.t && setAttribute(_el$5, "title", _p$.t = _v$6);
|
|
1074
|
+
_v$7 !== _p$.a && className(_el$6, _p$.a = _v$7);
|
|
1075
|
+
return _p$;
|
|
1076
|
+
}, {
|
|
1077
|
+
e: undefined,
|
|
1078
|
+
t: undefined,
|
|
1079
|
+
a: undefined
|
|
1080
|
+
});
|
|
1081
|
+
return _el$5;
|
|
1082
|
+
})();
|
|
1083
|
+
}
|
|
1084
|
+
delegateEvents(["keydown", "click"]);
|
|
1085
|
+
|
|
1086
|
+
var _tmpl$$6 = /*#__PURE__*/template(`<div><span class=checkmark></span><span class=option-label>`);
|
|
1087
|
+
function Option(props) {
|
|
1088
|
+
const select = useContext(SelectContext);
|
|
1089
|
+
if (!select) {
|
|
1090
|
+
throw new Error("<Option> must be used within a <Select>");
|
|
1091
|
+
}
|
|
1092
|
+
onMount(() => select.registerOption?.(props.value, props.children));
|
|
1093
|
+
onCleanup(() => select.unregisterOption?.(props.value));
|
|
1094
|
+
const handleClick = e => {
|
|
1095
|
+
e.stopPropagation();
|
|
1096
|
+
select.selectValue(props.value);
|
|
1097
|
+
};
|
|
1098
|
+
return (() => {
|
|
1099
|
+
var _el$ = _tmpl$$6(),
|
|
1100
|
+
_el$2 = _el$.firstChild,
|
|
1101
|
+
_el$3 = _el$2.nextSibling;
|
|
1102
|
+
_el$.$$click = handleClick;
|
|
1103
|
+
insert(_el$2, () => select.isSelected(props.value) ? "✓" : "");
|
|
1104
|
+
insert(_el$3, () => props.children ?? "");
|
|
1105
|
+
createRenderEffect(_p$ => {
|
|
1106
|
+
var _v$ = `solid-select__option ${props.class || ""}`,
|
|
1107
|
+
_v$2 = !!select.isSelected(props.value);
|
|
1108
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
1109
|
+
_v$2 !== _p$.t && _el$.classList.toggle("selected", _p$.t = _v$2);
|
|
1110
|
+
return _p$;
|
|
1111
|
+
}, {
|
|
1112
|
+
e: undefined,
|
|
1113
|
+
t: undefined
|
|
1114
|
+
});
|
|
1115
|
+
return _el$;
|
|
1116
|
+
})();
|
|
1117
|
+
}
|
|
1118
|
+
delegateEvents(["click"]);
|
|
1119
|
+
|
|
1120
|
+
var _tmpl$$5 = /*#__PURE__*/template(`<div class=snackContainer>`),
|
|
1121
|
+
_tmpl$2$4 = /*#__PURE__*/template(`<div><span>`);
|
|
1122
|
+
const [snackbars, setSnackbars] = createSignal([]);
|
|
1123
|
+
const addSnackbar = snack => {
|
|
1124
|
+
setSnackbars(old => [...old, snack]);
|
|
1125
|
+
};
|
|
1126
|
+
const removeSnackbar = index => {
|
|
1127
|
+
setSnackbars(old => old.filter((_, i) => i !== index));
|
|
1128
|
+
};
|
|
1129
|
+
const SnackbarController = () => {
|
|
1130
|
+
return createComponent(Show, {
|
|
1131
|
+
get when() {
|
|
1132
|
+
return snackbars().length > 0;
|
|
1133
|
+
},
|
|
1134
|
+
get children() {
|
|
1135
|
+
var _el$ = _tmpl$$5();
|
|
1136
|
+
insert(_el$, createComponent(For, {
|
|
1137
|
+
get each() {
|
|
1138
|
+
return snackbars();
|
|
1139
|
+
},
|
|
1140
|
+
children: (snack, index) => createComponent(Snackbar, mergeProps(snack, {
|
|
1141
|
+
get index() {
|
|
1142
|
+
return index();
|
|
1143
|
+
},
|
|
1144
|
+
onClose: () => removeSnackbar(index())
|
|
1145
|
+
}))
|
|
1146
|
+
}));
|
|
1147
|
+
return _el$;
|
|
1148
|
+
}
|
|
1149
|
+
});
|
|
1150
|
+
};
|
|
1151
|
+
const Snackbar = props => {
|
|
1152
|
+
const [isOpen, setIsOpen] = createSignal(true);
|
|
1153
|
+
if (props.closeTimeout) setTimeout(() => props.onClose(), props.closeTimeout);
|
|
1154
|
+
if (!props.closeTimeout) setTimeout(() => props.onClose(), 5000);
|
|
1155
|
+
const messageLength = Math.floor(props.message.length / 17);
|
|
1156
|
+
return createComponent(Portal, {
|
|
1157
|
+
get mount() {
|
|
1158
|
+
return document.body;
|
|
1159
|
+
},
|
|
1160
|
+
get children() {
|
|
1161
|
+
return createComponent(Show, {
|
|
1162
|
+
get when() {
|
|
1163
|
+
return isOpen();
|
|
1164
|
+
},
|
|
1165
|
+
get children() {
|
|
1166
|
+
var _el$2 = _tmpl$2$4(),
|
|
1167
|
+
_el$3 = _el$2.firstChild;
|
|
1168
|
+
insert(_el$3, () => props.message);
|
|
1169
|
+
insert(_el$2, createComponent(Button, {
|
|
1170
|
+
get onClick() {
|
|
1171
|
+
return props.onClose;
|
|
1172
|
+
},
|
|
1173
|
+
children: "X"
|
|
1174
|
+
}), null);
|
|
1175
|
+
createRenderEffect(_p$ => {
|
|
1176
|
+
var _v$ = `${10 + props.index * (50 + messageLength * 8)}px`,
|
|
1177
|
+
_v$2 = `.primary .snack ${props.severity ?? "info"}`;
|
|
1178
|
+
_v$ !== _p$.e && ((_p$.e = _v$) != null ? _el$2.style.setProperty("bottom", _v$) : _el$2.style.removeProperty("bottom"));
|
|
1179
|
+
_v$2 !== _p$.t && className(_el$2, _p$.t = _v$2);
|
|
1180
|
+
return _p$;
|
|
1181
|
+
}, {
|
|
1182
|
+
e: undefined,
|
|
1183
|
+
t: undefined
|
|
1184
|
+
});
|
|
1185
|
+
return _el$2;
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
});
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
const tableContext = createContext({
|
|
1193
|
+
tableState: () => ({
|
|
1194
|
+
headers: [],
|
|
1195
|
+
rowTransform: [],
|
|
1196
|
+
currentColumns: []
|
|
1197
|
+
}),
|
|
1198
|
+
setTableState: () => {}
|
|
1199
|
+
});
|
|
1200
|
+
const TableProvider = props => {
|
|
1201
|
+
const [tableState, setTableState] = createSignal(props.value);
|
|
1202
|
+
return createComponent(tableContext.Provider, {
|
|
1203
|
+
value: {
|
|
1204
|
+
tableState,
|
|
1205
|
+
setTableState
|
|
1206
|
+
},
|
|
1207
|
+
get children() {
|
|
1208
|
+
return props.children;
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
};
|
|
1212
|
+
function getTableContext() {
|
|
1213
|
+
return useContext(tableContext);
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
var _tmpl$$4 = /*#__PURE__*/template(`<svg width=46 height=44><path d="M24.15 12.7875L37.6625 25.575C39.1 26.95 39.1 29.15 37.6625 30.525C36.225 31.9 33.925 31.9 32.4875 30.525L24.15 22.6875C23.4312 22 22.425 22 21.7062 22.6875L13.3687 30.525C11.9312 31.9 9.63123 31.9 8.19373 30.525C6.75623 29.15 6.75623 26.95 8.19373 25.575L21.7062 12.7875C22.425 12.2375 23.575 12.2375 24.15 12.7875Z"stroke=white stroke-width=2 stroke-miterlimit=10 stroke-linecap=round stroke-linejoin=round>`),
|
|
1217
|
+
_tmpl$2$3 = /*#__PURE__*/template(`<svg width=44 height=43><path d="M20.7625 31.8469L7.83752 19.35C6.46252 18.0062 6.46252 15.8562 7.83752 14.5125C9.21252 13.1687 11.4125 13.1687 12.7875 14.5125L20.7625 22.1719C21.45 22.8437 22.4125 22.8437 23.1 22.1719L31.075 14.5125C32.45 13.1687 34.65 13.1687 36.025 14.5125C37.4 15.8562 37.4 18.0062 36.025 19.35L23.1 31.8469C22.55 32.3844 21.45 32.3844 20.7625 31.8469Z"stroke=white stroke-width=2 stroke-miterlimit=10 stroke-linecap=round stroke-linejoin=round>`);
|
|
1218
|
+
const UpArrow = props => {
|
|
1219
|
+
return (() => {
|
|
1220
|
+
var _el$ = _tmpl$$4();
|
|
1221
|
+
spread(_el$, mergeProps(props, {
|
|
1222
|
+
"viewBox": "0 0 46 44",
|
|
1223
|
+
"fill": "none",
|
|
1224
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
1225
|
+
}), true, true);
|
|
1226
|
+
return _el$;
|
|
1227
|
+
})();
|
|
1228
|
+
};
|
|
1229
|
+
const DownArrow = props => {
|
|
1230
|
+
return (() => {
|
|
1231
|
+
var _el$2 = _tmpl$2$3();
|
|
1232
|
+
spread(_el$2, mergeProps(props, {
|
|
1233
|
+
"viewBox": "0 0 44 43",
|
|
1234
|
+
"fill": "none",
|
|
1235
|
+
"xmlns": "http://www.w3.org/2000/svg"
|
|
1236
|
+
}), true, true);
|
|
1237
|
+
return _el$2;
|
|
1238
|
+
})();
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1241
|
+
var _tmpl$$3 = /*#__PURE__*/template(`<table><thead></thead><tbody>`),
|
|
1242
|
+
_tmpl$2$2 = /*#__PURE__*/template(`<tr><td>`),
|
|
1243
|
+
_tmpl$3$1 = /*#__PURE__*/template(`<tr>`),
|
|
1244
|
+
_tmpl$4$1 = /*#__PURE__*/template(`<td>`);
|
|
1245
|
+
const Table = props => {
|
|
1246
|
+
return createComponent(TableProvider, {
|
|
1247
|
+
value: {
|
|
1248
|
+
headers: [],
|
|
1249
|
+
rowTransform: [],
|
|
1250
|
+
currentColumns: []
|
|
1251
|
+
},
|
|
1252
|
+
get children() {
|
|
1253
|
+
return createComponent(TableComponent, props);
|
|
1254
|
+
}
|
|
1255
|
+
});
|
|
1256
|
+
};
|
|
1257
|
+
const TableComponent = props => {
|
|
1258
|
+
const state = getTableContext();
|
|
1259
|
+
const [local, others] = splitProps(props, ["data", "columns", "children", "dropdown"]);
|
|
1260
|
+
const [theadRef, setTheadRef] = createSignal();
|
|
1261
|
+
const [tbodyRef, setTbodyRef] = createSignal();
|
|
1262
|
+
state.setTableState({
|
|
1263
|
+
headers: [],
|
|
1264
|
+
rowTransform: [],
|
|
1265
|
+
currentColumns: []
|
|
1266
|
+
});
|
|
1267
|
+
const [showDropdown, setShowDropdown] = createSignal({});
|
|
1268
|
+
const getColumnIndex = name => state.tableState().currentColumns.findIndex(x => x === name);
|
|
1269
|
+
const getHeaderTransform = name => state.tableState().headers[getColumnIndex(name)];
|
|
1270
|
+
const isDropTable = () => Object.keys(props).includes("dropdown");
|
|
1271
|
+
const dropCheck = i => {
|
|
1272
|
+
const hasTransform = !!state.tableState().dropTransform;
|
|
1273
|
+
const showDrop = !!showDropdown()[i] || !Object.keys(props).includes("dropdown");
|
|
1274
|
+
return hasTransform && showDrop;
|
|
1275
|
+
};
|
|
1276
|
+
props.children;
|
|
1277
|
+
return (() => {
|
|
1278
|
+
var _el$ = _tmpl$$3(),
|
|
1279
|
+
_el$2 = _el$.firstChild,
|
|
1280
|
+
_el$3 = _el$2.nextSibling;
|
|
1281
|
+
spread(_el$, others, false, true);
|
|
1282
|
+
use(setTheadRef, _el$2);
|
|
1283
|
+
insert(_el$2, createComponent(For, {
|
|
1284
|
+
get each() {
|
|
1285
|
+
return local.columns;
|
|
1286
|
+
},
|
|
1287
|
+
children: (column, i) => createMemo(() => getHeaderTransform(column))
|
|
1288
|
+
}));
|
|
1289
|
+
use(setTbodyRef, _el$3);
|
|
1290
|
+
insert(_el$3, createComponent(Show, {
|
|
1291
|
+
get when() {
|
|
1292
|
+
return !local.data().length;
|
|
1293
|
+
},
|
|
1294
|
+
get children() {
|
|
1295
|
+
return [];
|
|
1296
|
+
}
|
|
1297
|
+
}), null);
|
|
1298
|
+
insert(_el$3, createComponent(Show, {
|
|
1299
|
+
get when() {
|
|
1300
|
+
return local.data().length;
|
|
1301
|
+
},
|
|
1302
|
+
get children() {
|
|
1303
|
+
return createComponent(For, {
|
|
1304
|
+
get each() {
|
|
1305
|
+
return local.data();
|
|
1306
|
+
},
|
|
1307
|
+
children: (row, i) => [createComponent(BuildTableRow, {
|
|
1308
|
+
get columns() {
|
|
1309
|
+
return local.columns;
|
|
1310
|
+
},
|
|
1311
|
+
get showDropdown() {
|
|
1312
|
+
return showDropdown()[i()];
|
|
1313
|
+
},
|
|
1314
|
+
setShowDropdown: setShowDropdown,
|
|
1315
|
+
get dropdownArrow() {
|
|
1316
|
+
return others.dropdownArrow;
|
|
1317
|
+
},
|
|
1318
|
+
get isDropTable() {
|
|
1319
|
+
return isDropTable();
|
|
1320
|
+
},
|
|
1321
|
+
row: row,
|
|
1322
|
+
get rowI() {
|
|
1323
|
+
return i();
|
|
1324
|
+
}
|
|
1325
|
+
}), createComponent(Show, {
|
|
1326
|
+
get when() {
|
|
1327
|
+
return dropCheck(i());
|
|
1328
|
+
},
|
|
1329
|
+
get children() {
|
|
1330
|
+
return createComponent(BuildSecondRow, {
|
|
1331
|
+
get colSpan() {
|
|
1332
|
+
return local.columns.length;
|
|
1333
|
+
},
|
|
1334
|
+
row: row,
|
|
1335
|
+
get rowI() {
|
|
1336
|
+
return i();
|
|
1337
|
+
},
|
|
1338
|
+
get transform() {
|
|
1339
|
+
return state.tableState().dropTransform;
|
|
1340
|
+
}
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
})]
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
}), null);
|
|
1347
|
+
return _el$;
|
|
1348
|
+
})();
|
|
1349
|
+
};
|
|
1350
|
+
const BuildTableRow = props => {
|
|
1351
|
+
const state = getTableContext();
|
|
1352
|
+
const getCellProps = i => state.tableState().cellProps ? state.tableState().cellProps[i] : {};
|
|
1353
|
+
const getColumnIndex = name => state.tableState().currentColumns.findIndex(x => x === name);
|
|
1354
|
+
const getCellTransform = name => state.tableState().rowTransform[getColumnIndex(name)];
|
|
1355
|
+
const hasTransforms = () => !!props.columns.map(x => getCellTransform(x)).filter(x => typeof x === "function").length;
|
|
1356
|
+
return [createComponent(Show, {
|
|
1357
|
+
get when() {
|
|
1358
|
+
return createMemo(() => !!props.isDropTable)() && hasTransforms();
|
|
1359
|
+
},
|
|
1360
|
+
get children() {
|
|
1361
|
+
var _el$4 = _tmpl$2$2(),
|
|
1362
|
+
_el$5 = _el$4.firstChild;
|
|
1363
|
+
insert(_el$4, createComponent(For, {
|
|
1364
|
+
get each() {
|
|
1365
|
+
return props.columns;
|
|
1366
|
+
},
|
|
1367
|
+
children: (column, i) => {
|
|
1368
|
+
const cellTransform = getCellTransform(column);
|
|
1369
|
+
return createComponent(Show, {
|
|
1370
|
+
when: typeof cellTransform === "function",
|
|
1371
|
+
get children() {
|
|
1372
|
+
var _el$7 = _tmpl$4$1();
|
|
1373
|
+
spread(_el$7, mergeProps({
|
|
1374
|
+
get ["data-index"]() {
|
|
1375
|
+
return i();
|
|
1376
|
+
}
|
|
1377
|
+
}, () => getCellProps(getColumnIndex(column))), false, true);
|
|
1378
|
+
insert(_el$7, () => cellTransform(props.row, props.rowI));
|
|
1379
|
+
return _el$7;
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
}), _el$5);
|
|
1384
|
+
insert(_el$5, createComponent(Show, {
|
|
1385
|
+
get when() {
|
|
1386
|
+
return props.showDropdown;
|
|
1387
|
+
},
|
|
1388
|
+
get children() {
|
|
1389
|
+
return createComponent(Button, {
|
|
1390
|
+
onClick: () => props.setShowDropdown(old => ({
|
|
1391
|
+
...old,
|
|
1392
|
+
[props.rowI]: false
|
|
1393
|
+
})),
|
|
1394
|
+
get children() {
|
|
1395
|
+
return createComponent(UpArrow, {
|
|
1396
|
+
get width() {
|
|
1397
|
+
return props.dropdownArrow?.width;
|
|
1398
|
+
},
|
|
1399
|
+
get height() {
|
|
1400
|
+
return props.dropdownArrow?.height;
|
|
1401
|
+
}
|
|
1402
|
+
});
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
1405
|
+
}
|
|
1406
|
+
}), null);
|
|
1407
|
+
insert(_el$5, createComponent(Show, {
|
|
1408
|
+
get when() {
|
|
1409
|
+
return !props.showDropdown;
|
|
1410
|
+
},
|
|
1411
|
+
get children() {
|
|
1412
|
+
return createComponent(Button, {
|
|
1413
|
+
onClick: () => props.setShowDropdown(old => ({
|
|
1414
|
+
...old,
|
|
1415
|
+
[props.rowI]: true
|
|
1416
|
+
})),
|
|
1417
|
+
get children() {
|
|
1418
|
+
return createComponent(DownArrow, {
|
|
1419
|
+
get width() {
|
|
1420
|
+
return props.dropdownArrow?.width;
|
|
1421
|
+
},
|
|
1422
|
+
get height() {
|
|
1423
|
+
return props.dropdownArrow?.height;
|
|
1424
|
+
}
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
}), null);
|
|
1430
|
+
return _el$4;
|
|
1431
|
+
}
|
|
1432
|
+
}), createComponent(Show, {
|
|
1433
|
+
get when() {
|
|
1434
|
+
return createMemo(() => !!!props.isDropTable)() && hasTransforms();
|
|
1435
|
+
},
|
|
1436
|
+
get children() {
|
|
1437
|
+
var _el$6 = _tmpl$3$1();
|
|
1438
|
+
insert(_el$6, createComponent(For, {
|
|
1439
|
+
get each() {
|
|
1440
|
+
return props.columns;
|
|
1441
|
+
},
|
|
1442
|
+
children: (column, i) => {
|
|
1443
|
+
const cellTransform = getCellTransform(column);
|
|
1444
|
+
return createComponent(Show, {
|
|
1445
|
+
when: typeof cellTransform === "function",
|
|
1446
|
+
get children() {
|
|
1447
|
+
var _el$8 = _tmpl$4$1();
|
|
1448
|
+
spread(_el$8, mergeProps({
|
|
1449
|
+
get ["data-index"]() {
|
|
1450
|
+
return i();
|
|
1451
|
+
}
|
|
1452
|
+
}, () => getCellProps(getColumnIndex(column))), false, true);
|
|
1453
|
+
insert(_el$8, () => cellTransform(props.row, props.rowI));
|
|
1454
|
+
return _el$8;
|
|
1455
|
+
}
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
}));
|
|
1459
|
+
return _el$6;
|
|
1460
|
+
}
|
|
1461
|
+
})];
|
|
1462
|
+
};
|
|
1463
|
+
const BuildSecondRow = props => {
|
|
1464
|
+
return (() => {
|
|
1465
|
+
var _el$9 = _tmpl$2$2(),
|
|
1466
|
+
_el$10 = _el$9.firstChild;
|
|
1467
|
+
insert(_el$10, () => props.transform(props.row, props.rowI));
|
|
1468
|
+
createRenderEffect(() => setAttribute(_el$10, "colspan", props.colSpan));
|
|
1469
|
+
return _el$9;
|
|
1470
|
+
})();
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1473
|
+
const Tab = props => {
|
|
1474
|
+
const {
|
|
1475
|
+
tabs,
|
|
1476
|
+
setTabs
|
|
1477
|
+
} = getTabContext();
|
|
1478
|
+
createEffect(() => {
|
|
1479
|
+
if (props.hidden) {
|
|
1480
|
+
if (props.hidden()) {
|
|
1481
|
+
setTabs(old => {
|
|
1482
|
+
const newTabs = {
|
|
1483
|
+
...old
|
|
1484
|
+
};
|
|
1485
|
+
delete newTabs[props.name];
|
|
1486
|
+
return newTabs;
|
|
1487
|
+
});
|
|
1488
|
+
} else {
|
|
1489
|
+
if (!!props.name && !Object.keys(tabs()).includes(props.name)) {
|
|
1490
|
+
setTabs(old => ({
|
|
1491
|
+
...old,
|
|
1492
|
+
[props.name]: props.children
|
|
1493
|
+
}));
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
onMount(() => {
|
|
1499
|
+
if (props.name !== undefined) {
|
|
1500
|
+
if (!props.hidden || props.hidden && !props.hidden()) {
|
|
1501
|
+
setTabs(old => ({
|
|
1502
|
+
...old,
|
|
1503
|
+
[props.name]: props.children
|
|
1504
|
+
}));
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
});
|
|
1508
|
+
return createComponent(Show, {
|
|
1509
|
+
get when() {
|
|
1510
|
+
return !props.hidden || props.hidden();
|
|
1511
|
+
},
|
|
1512
|
+
get children() {
|
|
1513
|
+
return props.children;
|
|
1514
|
+
}
|
|
1515
|
+
});
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
var _tmpl$$2 = /*#__PURE__*/template(`<span class=leftArrow>`),
|
|
1519
|
+
_tmpl$2$1 = /*#__PURE__*/template(`<span class=rightArrow>`),
|
|
1520
|
+
_tmpl$3 = /*#__PURE__*/template(`<div class=.tabs><div><div class=tabHeader></div></div><div>`),
|
|
1521
|
+
_tmpl$4 = /*#__PURE__*/template(`<b>`),
|
|
1522
|
+
_tmpl$5 = /*#__PURE__*/template(`<span class=hover>`);
|
|
1523
|
+
const tabContext = createContext({
|
|
1524
|
+
tabs: () => ({}),
|
|
1525
|
+
setTabs: () => {}
|
|
1526
|
+
});
|
|
1527
|
+
function getTabContext() {
|
|
1528
|
+
return useContext(tabContext);
|
|
1529
|
+
}
|
|
1530
|
+
const TabProvider = props => {
|
|
1531
|
+
const [tabs, setTabs] = createSignal(props.value, {
|
|
1532
|
+
equals: (a, b) => {
|
|
1533
|
+
const sameLength = Object.keys(a).length === Object.keys(b).length;
|
|
1534
|
+
if (!sameLength) return false;
|
|
1535
|
+
for (const key in a) {
|
|
1536
|
+
if (a[key] !== b[key]) return false;
|
|
1537
|
+
}
|
|
1538
|
+
if (JSON.stringify(a) !== JSON.stringify(b)) return false;
|
|
1539
|
+
return true;
|
|
1540
|
+
}
|
|
1541
|
+
});
|
|
1542
|
+
return createComponent(tabContext.Provider, {
|
|
1543
|
+
value: {
|
|
1544
|
+
tabs,
|
|
1545
|
+
setTabs
|
|
1546
|
+
},
|
|
1547
|
+
get children() {
|
|
1548
|
+
return props.children;
|
|
1549
|
+
}
|
|
1550
|
+
});
|
|
1551
|
+
};
|
|
1552
|
+
const Tabs = props => {
|
|
1553
|
+
return createComponent(TabProvider, {
|
|
1554
|
+
value: {},
|
|
1555
|
+
get children() {
|
|
1556
|
+
return createComponent(TabInternal, props);
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
};
|
|
1560
|
+
const TabInternal = props => {
|
|
1561
|
+
const {
|
|
1562
|
+
tabs,
|
|
1563
|
+
setTabs
|
|
1564
|
+
} = useContext(tabContext);
|
|
1565
|
+
const [selectedTab, setSelectedTab] = createSignal(Object.keys(tabs())[0]);
|
|
1566
|
+
const currentElement = createMemo(() => tabs()[selectedTab()]);
|
|
1567
|
+
children(() => props.children);
|
|
1568
|
+
const isMobile = createMemo(() => window.innerWidth < 768);
|
|
1569
|
+
const hasTranparent = createMemo(() => Object.keys(props).includes("transparent"));
|
|
1570
|
+
createRenderEffect(() => {
|
|
1571
|
+
setSelectedTab(Object.keys(tabs())[0]);
|
|
1572
|
+
});
|
|
1573
|
+
const [showLeft, setShowLeft] = createSignal(false);
|
|
1574
|
+
const [showRight, setShowRight] = createSignal(false);
|
|
1575
|
+
const scrollFunction = e => {
|
|
1576
|
+
const scrollLeft = tabContainer?.scrollLeft;
|
|
1577
|
+
tabContainer?.offsetWidth;
|
|
1578
|
+
const scrollWidth = tabContainer?.scrollWidth ?? 0;
|
|
1579
|
+
const clientWidth = tabContainer?.clientWidth ?? 0;
|
|
1580
|
+
const newWidth = scrollWidth - clientWidth;
|
|
1581
|
+
const showRight = Object.keys(tabs()).length >= 3 && isMobile() || scrollLeft !== newWidth;
|
|
1582
|
+
const showLeft = scrollLeft > 0;
|
|
1583
|
+
setShowRight(showRight);
|
|
1584
|
+
setShowLeft(showLeft);
|
|
1585
|
+
if (scrollLeft <= 0) {
|
|
1586
|
+
setShowLeft(false);
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
let tabContainer;
|
|
1590
|
+
onMount(() => {
|
|
1591
|
+
if (tabContainer) {
|
|
1592
|
+
tabContainer.addEventListener("scroll", scrollFunction);
|
|
1593
|
+
scrollFunction();
|
|
1594
|
+
}
|
|
1595
|
+
});
|
|
1596
|
+
onCleanup(() => {
|
|
1597
|
+
if (tabContainer) {
|
|
1598
|
+
tabContainer.removeEventListener("scroll", scrollFunction);
|
|
1599
|
+
}
|
|
1600
|
+
});
|
|
1601
|
+
const scrollLeft = () => {
|
|
1602
|
+
tabContainer.scrollLeft -= 100;
|
|
1603
|
+
scrollFunction();
|
|
1604
|
+
};
|
|
1605
|
+
const scrollRight = () => {
|
|
1606
|
+
tabContainer.scrollLeft += 100;
|
|
1607
|
+
scrollFunction();
|
|
1608
|
+
setShowLeft(true);
|
|
1609
|
+
};
|
|
1610
|
+
const styleType = props.styleType ?? "accent";
|
|
1611
|
+
const [tabsArr, setTabsArr] = createSignal(Object.keys(tabs()));
|
|
1612
|
+
createEffect(() => {
|
|
1613
|
+
setTabsArr(Object.keys(tabs()));
|
|
1614
|
+
});
|
|
1615
|
+
return (() => {
|
|
1616
|
+
var _el$ = _tmpl$3(),
|
|
1617
|
+
_el$2 = _el$.firstChild,
|
|
1618
|
+
_el$4 = _el$2.firstChild,
|
|
1619
|
+
_el$6 = _el$2.nextSibling;
|
|
1620
|
+
insert(_el$2, createComponent(Show, {
|
|
1621
|
+
get when() {
|
|
1622
|
+
return showLeft();
|
|
1623
|
+
},
|
|
1624
|
+
get children() {
|
|
1625
|
+
var _el$3 = _tmpl$$2();
|
|
1626
|
+
insert(_el$3, createComponent(Button, {
|
|
1627
|
+
onClick: scrollLeft,
|
|
1628
|
+
children: "\u2190"
|
|
1629
|
+
}));
|
|
1630
|
+
return _el$3;
|
|
1631
|
+
}
|
|
1632
|
+
}), _el$4);
|
|
1633
|
+
var _ref$ = tabContainer;
|
|
1634
|
+
typeof _ref$ === "function" ? use(_ref$, _el$4) : tabContainer = _el$4;
|
|
1635
|
+
insert(_el$4, createComponent(For, {
|
|
1636
|
+
get each() {
|
|
1637
|
+
return tabsArr();
|
|
1638
|
+
},
|
|
1639
|
+
children: (tab, index) => (() => {
|
|
1640
|
+
var _el$7 = _tmpl$5();
|
|
1641
|
+
_el$7.$$click = () => setSelectedTab(tab);
|
|
1642
|
+
insert(_el$7, createComponent(Show, {
|
|
1643
|
+
get when() {
|
|
1644
|
+
return tab === selectedTab();
|
|
1645
|
+
},
|
|
1646
|
+
get children() {
|
|
1647
|
+
var _el$8 = _tmpl$4();
|
|
1648
|
+
insert(_el$8, tab);
|
|
1649
|
+
return _el$8;
|
|
1650
|
+
}
|
|
1651
|
+
}), null);
|
|
1652
|
+
insert(_el$7, createComponent(Show, {
|
|
1653
|
+
get when() {
|
|
1654
|
+
return tab !== selectedTab();
|
|
1655
|
+
},
|
|
1656
|
+
children: tab
|
|
1657
|
+
}), null);
|
|
1658
|
+
return _el$7;
|
|
1659
|
+
})()
|
|
1660
|
+
}));
|
|
1661
|
+
insert(_el$2, createComponent(Show, {
|
|
1662
|
+
get when() {
|
|
1663
|
+
return showRight();
|
|
1664
|
+
},
|
|
1665
|
+
get children() {
|
|
1666
|
+
var _el$5 = _tmpl$2$1();
|
|
1667
|
+
insert(_el$5, createComponent(Button, {
|
|
1668
|
+
onClick: scrollRight,
|
|
1669
|
+
children: "\u2192"
|
|
1670
|
+
}));
|
|
1671
|
+
return _el$5;
|
|
1672
|
+
}
|
|
1673
|
+
}), null);
|
|
1674
|
+
insert(_el$6, currentElement);
|
|
1675
|
+
createRenderEffect(_p$ => {
|
|
1676
|
+
var _v$ = `${styleType} singleTabs ${hasTranparent() === true ? 'transparent' : ""}`,
|
|
1677
|
+
_v$2 = `${styleType} tabBody ${hasTranparent() === true ? 'transparent' : ""}`;
|
|
1678
|
+
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
1679
|
+
_v$2 !== _p$.t && className(_el$6, _p$.t = _v$2);
|
|
1680
|
+
return _p$;
|
|
1681
|
+
}, {
|
|
1682
|
+
e: undefined,
|
|
1683
|
+
t: undefined
|
|
1684
|
+
});
|
|
1685
|
+
return _el$;
|
|
1686
|
+
})();
|
|
1687
|
+
};
|
|
1688
|
+
delegateEvents(["click"]);
|
|
1689
|
+
|
|
1690
|
+
var _tmpl$$1 = /*#__PURE__*/template(`<textarea>`);
|
|
1691
|
+
const TextArea = props => {
|
|
1692
|
+
let myElement;
|
|
1693
|
+
const [customProps, normalProps] = splitProps(props, ["minSize", "text", "setText", "class", "tooltip", "transparent"]);
|
|
1694
|
+
const [showPicModal, setShowPicModal] = createSignal(false);
|
|
1695
|
+
const context = useFormProvider();
|
|
1696
|
+
/**
|
|
1697
|
+
* Function to set the height of the textarea based on the content
|
|
1698
|
+
*/
|
|
1699
|
+
function OnInput() {
|
|
1700
|
+
if (myElement) {
|
|
1701
|
+
myElement.style.height = 'auto';
|
|
1702
|
+
const minHeight = customProps.minSize?.height ?? 100;
|
|
1703
|
+
const currentHeight = myElement.scrollHeight < minHeight ? minHeight : myElement.scrollHeight;
|
|
1704
|
+
myElement.style.height = `${currentHeight}px`;
|
|
1705
|
+
myElement.setAttribute("style", "height:" + currentHeight + "px;overflow-y:hidden;");
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
// sets the field type on mount and sets the height of the textarea
|
|
1709
|
+
onMount(() => {
|
|
1710
|
+
OnInput();
|
|
1711
|
+
context.setFieldType("textarea");
|
|
1712
|
+
});
|
|
1713
|
+
// updates height of textarea when text is changed
|
|
1714
|
+
createRenderEffect(() => {
|
|
1715
|
+
OnInput();
|
|
1716
|
+
customProps.text();
|
|
1717
|
+
});
|
|
1718
|
+
createEffect(() => {
|
|
1719
|
+
if (Object.keys(props).includes("required") || props?.required === true) {
|
|
1720
|
+
context.setName(old => `${old} *`);
|
|
1721
|
+
} else {
|
|
1722
|
+
context.setName(old => old);
|
|
1723
|
+
}
|
|
1724
|
+
});
|
|
1725
|
+
return (() => {
|
|
1726
|
+
var _el$ = _tmpl$$1();
|
|
1727
|
+
use(el => {
|
|
1728
|
+
myElement = el;
|
|
1729
|
+
OnInput();
|
|
1730
|
+
}, _el$);
|
|
1731
|
+
spread(_el$, mergeProps(normalProps, {
|
|
1732
|
+
"onFocus": e => {
|
|
1733
|
+
if (!isNullish(context.getName)) {
|
|
1734
|
+
context.setFocused(true);
|
|
1735
|
+
}
|
|
1736
|
+
},
|
|
1737
|
+
"onBlur": e => {
|
|
1738
|
+
if (context.setFocused) {
|
|
1739
|
+
context.setFocused(false);
|
|
1740
|
+
}
|
|
1741
|
+
},
|
|
1742
|
+
get placeholder() {
|
|
1743
|
+
return createMemo(() => !!(!!context.getName && !context.getTextInside() && !context.getFocused()))() ? context.getName() : props.placeholder;
|
|
1744
|
+
},
|
|
1745
|
+
get ["class"]() {
|
|
1746
|
+
return `.areaStyle ${customProps.class ?? ""} ${customProps.transparent ? '.transparent' : ""}`;
|
|
1747
|
+
},
|
|
1748
|
+
get value() {
|
|
1749
|
+
return customProps.text();
|
|
1750
|
+
},
|
|
1751
|
+
"onInput": e => {
|
|
1752
|
+
customProps.setText(e.currentTarget.value);
|
|
1753
|
+
OnInput();
|
|
1754
|
+
if (!!context.getName && !!e.currentTarget.value.trim()) {
|
|
1755
|
+
context.setValue(e.currentTarget.value);
|
|
1756
|
+
context.setTextInside(true);
|
|
1757
|
+
} else if (!!context.getName && !e.currentTarget.value.trim()) {
|
|
1758
|
+
context.setValue("");
|
|
1759
|
+
context.setTextInside(false);
|
|
1760
|
+
}
|
|
1761
|
+
},
|
|
1762
|
+
get title() {
|
|
1763
|
+
return customProps.tooltip;
|
|
1764
|
+
}
|
|
1765
|
+
}), false, false);
|
|
1766
|
+
return _el$;
|
|
1767
|
+
})();
|
|
1768
|
+
};
|
|
1769
|
+
|
|
1770
|
+
var _tmpl$ = /*#__PURE__*/template(`<div class=".accent .body">`),
|
|
1771
|
+
_tmpl$2 = /*#__PURE__*/template(`<div class=".totalPanel .styles"><div class=".accent .header"><span>`);
|
|
1772
|
+
const ExpansionPanel = props => {
|
|
1773
|
+
const [open, setOpen] = createSignal(!!props.startOpen);
|
|
1774
|
+
return (() => {
|
|
1775
|
+
var _el$ = _tmpl$2(),
|
|
1776
|
+
_el$2 = _el$.firstChild,
|
|
1777
|
+
_el$3 = _el$2.firstChild;
|
|
1778
|
+
spread(_el$, props, false, true);
|
|
1779
|
+
_el$3.style.setProperty("width", "min-content");
|
|
1780
|
+
_el$3.style.setProperty("height", "min-content");
|
|
1781
|
+
insert(_el$3, () => props.children[0]);
|
|
1782
|
+
insert(_el$2, createComponent(Button, {
|
|
1783
|
+
style: {
|
|
1784
|
+
width: 'min-content',
|
|
1785
|
+
height: 'min-content',
|
|
1786
|
+
padding: '0px',
|
|
1787
|
+
margin: '0px'
|
|
1788
|
+
},
|
|
1789
|
+
onClick: () => {
|
|
1790
|
+
setOpen(old => !old);
|
|
1791
|
+
props.extraLogic ? props.extraLogic() : null;
|
|
1792
|
+
},
|
|
1793
|
+
"class": `.hover`,
|
|
1794
|
+
get children() {
|
|
1795
|
+
return [createComponent(Show, {
|
|
1796
|
+
get when() {
|
|
1797
|
+
return !open();
|
|
1798
|
+
},
|
|
1799
|
+
get children() {
|
|
1800
|
+
return createComponent(DownArrow, {
|
|
1801
|
+
style: {
|
|
1802
|
+
padding: '0px',
|
|
1803
|
+
margin: '0px'
|
|
1804
|
+
},
|
|
1805
|
+
get width() {
|
|
1806
|
+
return props.arrowSize?.width;
|
|
1807
|
+
},
|
|
1808
|
+
get height() {
|
|
1809
|
+
return props.arrowSize?.height;
|
|
1810
|
+
}
|
|
1811
|
+
});
|
|
1812
|
+
}
|
|
1813
|
+
}), createComponent(Show, {
|
|
1814
|
+
get when() {
|
|
1815
|
+
return open();
|
|
1816
|
+
},
|
|
1817
|
+
get children() {
|
|
1818
|
+
return createComponent(UpArrow, {
|
|
1819
|
+
style: {
|
|
1820
|
+
padding: '0px',
|
|
1821
|
+
margin: '0px'
|
|
1822
|
+
},
|
|
1823
|
+
get width() {
|
|
1824
|
+
return props.arrowSize?.width;
|
|
1825
|
+
},
|
|
1826
|
+
get height() {
|
|
1827
|
+
return props.arrowSize?.height;
|
|
1828
|
+
}
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
})];
|
|
1832
|
+
}
|
|
1833
|
+
}), null);
|
|
1834
|
+
insert(_el$, createComponent(Show, {
|
|
1835
|
+
get when() {
|
|
1836
|
+
return open();
|
|
1837
|
+
},
|
|
1838
|
+
get children() {
|
|
1839
|
+
var _el$4 = _tmpl$();
|
|
1840
|
+
insert(_el$4, () => props.children[1]);
|
|
1841
|
+
return _el$4;
|
|
1842
|
+
}
|
|
1843
|
+
}), null);
|
|
1844
|
+
return _el$;
|
|
1845
|
+
})();
|
|
1846
|
+
};
|
|
1847
|
+
|
|
1848
|
+
export { Body, Button, Chip, Chipbar, ExpansionPanel, FormField, Input, Option, Select, SelectContext, SnackbarController, Tab, Table, Tabs, TextArea, addSnackbar, getTabContext };
|