juxscript 1.1.4 → 1.1.6
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/index.d.ts +10 -10
- package/index.d.ts.map +1 -0
- package/lib/components/alert.d.ts +32 -0
- package/lib/components/alert.d.ts.map +1 -0
- package/lib/components/alert.js +153 -0
- package/lib/components/alert.ts +200 -0
- package/lib/components/app.d.ts +89 -0
- package/lib/components/app.d.ts.map +1 -0
- package/lib/components/app.js +175 -0
- package/lib/components/app.ts +247 -0
- package/lib/components/badge.d.ts +27 -0
- package/lib/components/badge.d.ts.map +1 -0
- package/lib/components/badge.js +70 -0
- package/lib/components/badge.ts +101 -0
- package/lib/components/base/BaseComponent.d.ts +142 -0
- package/lib/components/base/BaseComponent.d.ts.map +1 -0
- package/lib/components/base/BaseComponent.js +363 -0
- package/lib/components/base/BaseComponent.ts +421 -0
- package/lib/components/base/FormInput.d.ts +73 -0
- package/lib/components/base/FormInput.d.ts.map +1 -0
- package/lib/components/base/FormInput.js +163 -0
- package/lib/components/base/FormInput.ts +227 -0
- package/lib/components/button.d.ts +48 -0
- package/lib/components/button.d.ts.map +1 -0
- package/lib/components/button.js +121 -0
- package/lib/components/button.ts +178 -0
- package/lib/components/card.d.ts +34 -0
- package/lib/components/card.d.ts.map +1 -0
- package/lib/components/card.js +127 -0
- package/lib/components/card.ts +173 -0
- package/lib/components/chart.d.ts +45 -0
- package/lib/components/chart.d.ts.map +1 -0
- package/lib/components/chart.js +186 -0
- package/lib/components/chart.ts +231 -0
- package/lib/components/checkbox.d.ts +31 -0
- package/lib/components/checkbox.d.ts.map +1 -0
- package/lib/components/checkbox.js +185 -0
- package/lib/components/checkbox.ts +242 -0
- package/lib/components/code.d.ts +24 -0
- package/lib/components/code.d.ts.map +1 -0
- package/lib/components/code.js +88 -0
- package/lib/components/code.ts +123 -0
- package/lib/components/container.d.ts +42 -0
- package/lib/components/container.d.ts.map +1 -0
- package/lib/components/container.js +93 -0
- package/lib/components/container.ts +140 -0
- package/lib/components/data.d.ts +36 -0
- package/lib/components/data.d.ts.map +1 -0
- package/lib/components/data.js +110 -0
- package/lib/components/data.ts +135 -0
- package/lib/components/datepicker.d.ts +38 -0
- package/lib/components/datepicker.d.ts.map +1 -0
- package/lib/components/datepicker.js +177 -0
- package/lib/components/datepicker.ts +234 -0
- package/lib/components/dialog.d.ts +38 -0
- package/lib/components/dialog.d.ts.map +1 -0
- package/lib/components/dialog.js +126 -0
- package/lib/components/dialog.ts +172 -0
- package/lib/components/divider.d.ts +30 -0
- package/lib/components/divider.d.ts.map +1 -0
- package/lib/components/divider.js +69 -0
- package/lib/components/divider.ts +100 -0
- package/lib/components/dropdown.d.ts +39 -0
- package/lib/components/dropdown.d.ts.map +1 -0
- package/lib/components/dropdown.js +133 -0
- package/lib/components/dropdown.ts +186 -0
- package/lib/components/element.d.ts +50 -0
- package/lib/components/element.d.ts.map +1 -0
- package/lib/components/element.js +206 -0
- package/lib/components/element.ts +267 -0
- package/lib/components/fileupload.d.ts +40 -0
- package/lib/components/fileupload.d.ts.map +1 -0
- package/lib/components/fileupload.js +241 -0
- package/lib/components/fileupload.ts +309 -0
- package/lib/components/grid.d.ts +87 -0
- package/lib/components/grid.d.ts.map +1 -0
- package/lib/components/grid.js +205 -0
- package/lib/components/grid.ts +291 -0
- package/lib/components/guard.d.ts +41 -0
- package/lib/components/guard.d.ts.map +1 -0
- package/lib/components/guard.js +56 -0
- package/lib/components/guard.ts +92 -0
- package/lib/components/heading.d.ts +24 -0
- package/lib/components/heading.d.ts.map +1 -0
- package/lib/components/heading.js +67 -0
- package/lib/components/heading.ts +96 -0
- package/lib/components/helpers.d.ts +9 -0
- package/lib/components/helpers.d.ts.map +1 -0
- package/lib/components/helpers.js +30 -0
- package/lib/components/helpers.ts +41 -0
- package/lib/components/hero.d.ts +45 -0
- package/lib/components/hero.d.ts.map +1 -0
- package/lib/components/hero.js +165 -0
- package/lib/components/hero.ts +224 -0
- package/lib/components/icon.d.ts +35 -0
- package/lib/components/icon.d.ts.map +1 -0
- package/lib/components/icon.js +132 -0
- package/lib/components/icon.ts +178 -0
- package/lib/components/icons.d.ts +25 -0
- package/lib/components/icons.d.ts.map +1 -0
- package/lib/components/icons.js +440 -0
- package/lib/components/icons.ts +464 -0
- package/lib/components/include.d.ts +120 -0
- package/lib/components/include.d.ts.map +1 -0
- package/lib/components/include.js +350 -0
- package/lib/components/include.ts +410 -0
- package/lib/components/input.d.ts +83 -0
- package/lib/components/input.d.ts.map +1 -0
- package/lib/components/input.js +348 -0
- package/lib/components/input.ts +457 -0
- package/lib/components/list.d.ts +82 -0
- package/lib/components/list.d.ts.map +1 -0
- package/lib/components/list.js +311 -0
- package/lib/components/list.ts +419 -0
- package/lib/components/loading.d.ts +24 -0
- package/lib/components/loading.d.ts.map +1 -0
- package/lib/components/loading.js +73 -0
- package/lib/components/loading.ts +100 -0
- package/lib/components/menu.d.ts +37 -0
- package/lib/components/menu.d.ts.map +1 -0
- package/lib/components/menu.js +202 -0
- package/lib/components/menu.ts +275 -0
- package/lib/components/modal.d.ts +51 -0
- package/lib/components/modal.d.ts.map +1 -0
- package/lib/components/modal.js +227 -0
- package/lib/components/modal.ts +284 -0
- package/lib/components/nav.d.ts +45 -0
- package/lib/components/nav.d.ts.map +1 -0
- package/lib/components/nav.js +190 -0
- package/lib/components/nav.ts +257 -0
- package/lib/components/paragraph.d.ts +21 -0
- package/lib/components/paragraph.d.ts.map +1 -0
- package/lib/components/paragraph.js +70 -0
- package/lib/components/paragraph.ts +97 -0
- package/lib/components/progress.d.ts +39 -0
- package/lib/components/progress.d.ts.map +1 -0
- package/lib/components/progress.js +113 -0
- package/lib/components/progress.ts +159 -0
- package/lib/components/radio.d.ts +41 -0
- package/lib/components/radio.d.ts.map +1 -0
- package/lib/components/radio.js +203 -0
- package/lib/components/radio.ts +278 -0
- package/lib/components/req.d.ts +155 -0
- package/lib/components/req.d.ts.map +1 -0
- package/lib/components/req.js +253 -0
- package/lib/components/req.ts +303 -0
- package/lib/components/script.d.ts +14 -0
- package/lib/components/script.d.ts.map +1 -0
- package/lib/components/script.js +33 -0
- package/lib/components/script.ts +41 -0
- package/lib/components/select.d.ts +40 -0
- package/lib/components/select.d.ts.map +1 -0
- package/lib/components/select.js +183 -0
- package/lib/components/select.ts +252 -0
- package/lib/components/sidebar.d.ts +48 -0
- package/lib/components/sidebar.d.ts.map +1 -0
- package/lib/components/sidebar.js +207 -0
- package/lib/components/sidebar.ts +275 -0
- package/lib/components/style.d.ts +14 -0
- package/lib/components/style.d.ts.map +1 -0
- package/lib/components/style.js +33 -0
- package/lib/components/style.ts +41 -0
- package/lib/components/switch.d.ts +32 -0
- package/lib/components/switch.d.ts.map +1 -0
- package/lib/components/switch.js +186 -0
- package/lib/components/switch.ts +246 -0
- package/lib/components/table.d.ts +137 -0
- package/lib/components/table.d.ts.map +1 -0
- package/lib/components/table.js +1045 -0
- package/lib/components/table.ts +1249 -0
- package/lib/components/tabs.d.ts +36 -0
- package/lib/components/tabs.d.ts.map +1 -0
- package/lib/components/tabs.js +198 -0
- package/lib/components/tabs.ts +250 -0
- package/lib/components/theme-toggle.d.ts +44 -0
- package/lib/components/theme-toggle.d.ts.map +1 -0
- package/lib/components/theme-toggle.js +215 -0
- package/lib/components/theme-toggle.ts +293 -0
- package/lib/components/tooltip.d.ts +30 -0
- package/lib/components/tooltip.d.ts.map +1 -0
- package/lib/components/tooltip.js +109 -0
- package/lib/components/tooltip.ts +144 -0
- package/lib/components/view.d.ts +48 -0
- package/lib/components/view.d.ts.map +1 -0
- package/lib/components/view.js +149 -0
- package/lib/components/view.ts +190 -0
- package/lib/components/write.d.ts +107 -0
- package/lib/components/write.d.ts.map +1 -0
- package/lib/components/write.js +222 -0
- package/lib/components/write.ts +272 -0
- package/lib/layouts/default.css +260 -0
- package/lib/layouts/figma.css +334 -0
- package/lib/reactivity/state.d.ts +36 -0
- package/lib/reactivity/state.d.ts.map +1 -0
- package/lib/reactivity/state.js +67 -0
- package/lib/reactivity/state.ts +78 -0
- package/lib/utils/fetch.d.ts +176 -0
- package/lib/utils/fetch.d.ts.map +1 -0
- package/lib/utils/fetch.js +427 -0
- package/lib/utils/fetch.ts +553 -0
- package/machinery/compiler3.js +78 -0
- package/machinery/doc-generator.js +136 -0
- package/machinery/imports.js +155 -0
- package/machinery/ts-shim.js +46 -0
- package/package.json +9 -15
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { FormInput, FormInputState } from './base/FormInput.js';
|
|
2
|
+
|
|
3
|
+
// Event definitions
|
|
4
|
+
const TRIGGER_EVENTS = [] as const;
|
|
5
|
+
const CALLBACK_EVENTS = ['change'] as const;
|
|
6
|
+
|
|
7
|
+
export interface SwitchOptions {
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
label?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
name?: string;
|
|
13
|
+
value?: string;
|
|
14
|
+
style?: string;
|
|
15
|
+
class?: string;
|
|
16
|
+
onValidate?: (checked: boolean) => boolean | string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface SwitchState extends FormInputState {
|
|
20
|
+
checked: boolean;
|
|
21
|
+
value: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class Switch extends FormInput<SwitchState> {
|
|
25
|
+
constructor(id: string, options: SwitchOptions = {}) {
|
|
26
|
+
super(id, {
|
|
27
|
+
checked: options.checked ?? false,
|
|
28
|
+
value: options.value ?? 'on',
|
|
29
|
+
label: options.label ?? '',
|
|
30
|
+
required: options.required ?? false,
|
|
31
|
+
disabled: options.disabled ?? false,
|
|
32
|
+
name: options.name ?? id,
|
|
33
|
+
style: options.style ?? '',
|
|
34
|
+
class: options.class ?? '',
|
|
35
|
+
errorMessage: undefined
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
if (options.onValidate) {
|
|
39
|
+
this._onValidate = options.onValidate;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
protected getTriggerEvents(): readonly string[] {
|
|
44
|
+
return TRIGGER_EVENTS;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
protected getCallbackEvents(): readonly string[] {
|
|
48
|
+
return CALLBACK_EVENTS;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* ═════════════════════════════════════════════════════════════════
|
|
52
|
+
* FLUENT API
|
|
53
|
+
* ═════════════════════════════════════════════════════════════════ */
|
|
54
|
+
|
|
55
|
+
// ✅ Inherited from FormInput/BaseComponent:
|
|
56
|
+
// - label(), required(), name(), onValidate()
|
|
57
|
+
// - validate(), isValid()
|
|
58
|
+
// - style(), class()
|
|
59
|
+
// - bind(), sync(), renderTo()
|
|
60
|
+
// - disabled(), enable(), disable()
|
|
61
|
+
|
|
62
|
+
checked(value: boolean): this {
|
|
63
|
+
return this.setValue(value);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
value(value: string): this {
|
|
67
|
+
this.state.value = value;
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
toggle(): this {
|
|
72
|
+
return this.setValue(!this.state.checked);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* ═════════════════════════════════════════════════════════════════
|
|
76
|
+
* FORM INPUT IMPLEMENTATION
|
|
77
|
+
* ═════════════════════════════════════════════════════════════════ */
|
|
78
|
+
|
|
79
|
+
getValue(): boolean {
|
|
80
|
+
return this.state.checked;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
setValue(value: boolean): this {
|
|
84
|
+
this.state.checked = value;
|
|
85
|
+
if (this._inputElement) {
|
|
86
|
+
(this._inputElement as HTMLInputElement).checked = value;
|
|
87
|
+
}
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
protected _validateValue(checked: boolean): boolean | string {
|
|
92
|
+
const { required } = this.state;
|
|
93
|
+
|
|
94
|
+
if (required && !checked) {
|
|
95
|
+
return 'This field must be enabled';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (this._onValidate) {
|
|
99
|
+
const result = this._onValidate(checked);
|
|
100
|
+
if (result !== true) {
|
|
101
|
+
return result || 'Invalid value';
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
protected _buildInputElement(): HTMLElement {
|
|
109
|
+
const { checked, value, required, disabled, name } = this.state;
|
|
110
|
+
|
|
111
|
+
const input = document.createElement('input');
|
|
112
|
+
input.type = 'checkbox';
|
|
113
|
+
input.className = 'jux-switch-input';
|
|
114
|
+
input.id = `${this._id}-input`;
|
|
115
|
+
input.name = name;
|
|
116
|
+
input.value = value;
|
|
117
|
+
input.checked = checked;
|
|
118
|
+
input.required = required;
|
|
119
|
+
input.disabled = disabled;
|
|
120
|
+
|
|
121
|
+
return input;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* ═════════════════════════════════════════════════════════════════
|
|
125
|
+
* RENDER
|
|
126
|
+
* ═════════════════════════════════════════════════════════════════ */
|
|
127
|
+
|
|
128
|
+
render(targetId?: string): this {
|
|
129
|
+
const container = this._setupContainer(targetId);
|
|
130
|
+
|
|
131
|
+
const { style, class: className } = this.state;
|
|
132
|
+
|
|
133
|
+
// Build wrapper
|
|
134
|
+
const wrapper = document.createElement('div');
|
|
135
|
+
wrapper.className = 'jux-switch';
|
|
136
|
+
wrapper.id = this._id;
|
|
137
|
+
if (className) wrapper.className += ` ${className}`;
|
|
138
|
+
if (style) wrapper.setAttribute('style', style);
|
|
139
|
+
|
|
140
|
+
// Switch container
|
|
141
|
+
const switchContainer = document.createElement('label');
|
|
142
|
+
switchContainer.className = 'jux-switch-container';
|
|
143
|
+
switchContainer.htmlFor = `${this._id}-input`;
|
|
144
|
+
|
|
145
|
+
// Input element
|
|
146
|
+
const inputEl = this._buildInputElement() as HTMLInputElement;
|
|
147
|
+
this._inputElement = inputEl;
|
|
148
|
+
switchContainer.appendChild(inputEl);
|
|
149
|
+
|
|
150
|
+
// Toggle slider
|
|
151
|
+
const slider = document.createElement('span');
|
|
152
|
+
slider.className = 'jux-switch-slider';
|
|
153
|
+
switchContainer.appendChild(slider);
|
|
154
|
+
|
|
155
|
+
// Label text
|
|
156
|
+
if (this.state.label) {
|
|
157
|
+
const labelText = document.createElement('span');
|
|
158
|
+
labelText.className = 'jux-switch-label-text';
|
|
159
|
+
labelText.textContent = this.state.label;
|
|
160
|
+
if (this.state.required) {
|
|
161
|
+
const requiredSpan = document.createElement('span');
|
|
162
|
+
requiredSpan.className = 'jux-input-required';
|
|
163
|
+
requiredSpan.textContent = ' *';
|
|
164
|
+
labelText.appendChild(requiredSpan);
|
|
165
|
+
}
|
|
166
|
+
switchContainer.appendChild(labelText);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
wrapper.appendChild(switchContainer);
|
|
170
|
+
|
|
171
|
+
// Error element
|
|
172
|
+
wrapper.appendChild(this._renderError());
|
|
173
|
+
|
|
174
|
+
// Wire events
|
|
175
|
+
this._wireStandardEvents(wrapper);
|
|
176
|
+
|
|
177
|
+
// Wire switch-specific sync (maps 'checked' to 'value' property for consistency)
|
|
178
|
+
const valueSync = this._syncBindings.find(b => b.property === 'value' || b.property === 'checked');
|
|
179
|
+
|
|
180
|
+
if (valueSync) {
|
|
181
|
+
const { stateObj, toState, toComponent } = valueSync;
|
|
182
|
+
|
|
183
|
+
const transformToState = toState || ((v: boolean) => v);
|
|
184
|
+
const transformToComponent = toComponent || ((v: any) => Boolean(v));
|
|
185
|
+
|
|
186
|
+
let isUpdating = false;
|
|
187
|
+
|
|
188
|
+
// State → Component
|
|
189
|
+
stateObj.subscribe((val: any) => {
|
|
190
|
+
if (isUpdating) return;
|
|
191
|
+
const transformed = transformToComponent(val);
|
|
192
|
+
this.setValue(transformed);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// Component → State
|
|
196
|
+
inputEl.addEventListener('change', () => {
|
|
197
|
+
if (isUpdating) return;
|
|
198
|
+
isUpdating = true;
|
|
199
|
+
|
|
200
|
+
const checked = inputEl.checked;
|
|
201
|
+
this.state.checked = checked;
|
|
202
|
+
this._clearError();
|
|
203
|
+
|
|
204
|
+
const transformed = transformToState(checked);
|
|
205
|
+
stateObj.set(transformed);
|
|
206
|
+
|
|
207
|
+
// 🎯 Fire the change callback event
|
|
208
|
+
this._triggerCallback('change', checked);
|
|
209
|
+
|
|
210
|
+
setTimeout(() => { isUpdating = false; }, 0);
|
|
211
|
+
});
|
|
212
|
+
} else {
|
|
213
|
+
// Default behavior without sync
|
|
214
|
+
inputEl.addEventListener('change', () => {
|
|
215
|
+
this.state.checked = inputEl.checked;
|
|
216
|
+
this._clearError();
|
|
217
|
+
|
|
218
|
+
// 🎯 Fire the change callback event
|
|
219
|
+
this._triggerCallback('change', inputEl.checked);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Always add blur validation
|
|
224
|
+
inputEl.addEventListener('blur', () => {
|
|
225
|
+
this.validate();
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
// Sync label changes
|
|
229
|
+
const labelSync = this._syncBindings.find(b => b.property === 'label');
|
|
230
|
+
if (labelSync) {
|
|
231
|
+
const transform = labelSync.toComponent || ((v: any) => String(v));
|
|
232
|
+
labelSync.stateObj.subscribe((val: any) => {
|
|
233
|
+
this.label(transform(val));
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
container.appendChild(wrapper);
|
|
238
|
+
|
|
239
|
+
return this;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export function switchComponent(id: string, options: SwitchOptions = {}): Switch {
|
|
244
|
+
return new Switch(id, options);
|
|
245
|
+
}
|
|
246
|
+
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { BaseComponent } from './base/BaseComponent.js';
|
|
2
|
+
export type SelectionBehaviorOnDataChange = 'clear' | 'preserve';
|
|
3
|
+
export type SelectionTrigger = 'row' | 'checkbox';
|
|
4
|
+
export interface ColumnDef {
|
|
5
|
+
key: string;
|
|
6
|
+
label: string;
|
|
7
|
+
width?: string;
|
|
8
|
+
render?: (value: any, row: any) => string | HTMLElement;
|
|
9
|
+
computed?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ComputedColumnDef {
|
|
12
|
+
key: string;
|
|
13
|
+
label: string;
|
|
14
|
+
compute: (row: any, rowIndex: number) => any;
|
|
15
|
+
render?: (value: any, row: any, rowIndex: number) => string | HTMLElement;
|
|
16
|
+
width?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface TableOptions {
|
|
19
|
+
columns?: (string | ColumnDef)[];
|
|
20
|
+
rows?: any[][];
|
|
21
|
+
headers?: boolean;
|
|
22
|
+
striped?: boolean;
|
|
23
|
+
hoverable?: boolean;
|
|
24
|
+
bordered?: boolean;
|
|
25
|
+
compact?: boolean;
|
|
26
|
+
sortable?: boolean;
|
|
27
|
+
filterable?: boolean;
|
|
28
|
+
paginated?: boolean;
|
|
29
|
+
rowsPerPage?: number;
|
|
30
|
+
selectable?: boolean;
|
|
31
|
+
multiSelect?: boolean;
|
|
32
|
+
showCheckboxes?: boolean;
|
|
33
|
+
showBulkCheckbox?: boolean;
|
|
34
|
+
selectionTrigger?: SelectionTrigger;
|
|
35
|
+
style?: string;
|
|
36
|
+
class?: string;
|
|
37
|
+
rowIdField?: string;
|
|
38
|
+
selectionBehavior?: SelectionBehaviorOnDataChange;
|
|
39
|
+
}
|
|
40
|
+
type TableState = {
|
|
41
|
+
columns: ColumnDef[];
|
|
42
|
+
rows: any[][];
|
|
43
|
+
computedColumns: Map<string, ComputedColumnDef>;
|
|
44
|
+
headers: boolean;
|
|
45
|
+
striped: boolean;
|
|
46
|
+
hoverable: boolean;
|
|
47
|
+
bordered: boolean;
|
|
48
|
+
compact: boolean;
|
|
49
|
+
sortable: boolean;
|
|
50
|
+
filterable: boolean;
|
|
51
|
+
paginated: boolean;
|
|
52
|
+
rowsPerPage: number;
|
|
53
|
+
currentPage: number;
|
|
54
|
+
sortColumn: string | null;
|
|
55
|
+
sortDirection: 'asc' | 'desc';
|
|
56
|
+
filterText: string;
|
|
57
|
+
selectable: boolean;
|
|
58
|
+
multiSelect: boolean;
|
|
59
|
+
showCheckboxes: boolean;
|
|
60
|
+
showBulkCheckbox: boolean;
|
|
61
|
+
selectionTrigger: SelectionTrigger;
|
|
62
|
+
selectedIndexes: Set<number>;
|
|
63
|
+
style: string;
|
|
64
|
+
class: string;
|
|
65
|
+
rowIdField?: string;
|
|
66
|
+
selectionBehavior: SelectionBehaviorOnDataChange;
|
|
67
|
+
};
|
|
68
|
+
export declare class Table extends BaseComponent<TableState> {
|
|
69
|
+
private _tableElement;
|
|
70
|
+
constructor(id: string, options?: TableOptions);
|
|
71
|
+
protected getTriggerEvents(): readonly string[];
|
|
72
|
+
protected getCallbackEvents(): readonly string[];
|
|
73
|
+
columns(value: (string | ColumnDef)[]): this;
|
|
74
|
+
rows(value: any[][]): this;
|
|
75
|
+
/**
|
|
76
|
+
* Add a computed column that evaluates dynamically at render time
|
|
77
|
+
*
|
|
78
|
+
* @param key - Unique key for the column
|
|
79
|
+
* @param label - Display label in header
|
|
80
|
+
* @param compute - Function to compute value from row data
|
|
81
|
+
* @param render - Optional custom renderer for the computed value
|
|
82
|
+
* @param width - Optional column width
|
|
83
|
+
*/
|
|
84
|
+
computedColumn(key: string, label: string, compute: (row: any, rowIndex: number) => any, render?: (value: any, row: any, rowIndex: number) => string | HTMLElement, width?: string): this;
|
|
85
|
+
/**
|
|
86
|
+
* Remove a computed column
|
|
87
|
+
*/
|
|
88
|
+
removeComputedColumn(key: string): this;
|
|
89
|
+
headers(value: boolean): this;
|
|
90
|
+
striped(value: boolean): this;
|
|
91
|
+
hoverable(value: boolean): this;
|
|
92
|
+
bordered(value: boolean): this;
|
|
93
|
+
compact(value: boolean): this;
|
|
94
|
+
sortable(value: boolean): this;
|
|
95
|
+
filterable(value: boolean): this;
|
|
96
|
+
paginated(value: boolean): this;
|
|
97
|
+
rowsPerPage(value: number): this;
|
|
98
|
+
selectable(value: boolean): this;
|
|
99
|
+
multiSelect(value: boolean): this;
|
|
100
|
+
showCheckboxes(value: boolean): this;
|
|
101
|
+
showBulkCheckbox(value: boolean): this;
|
|
102
|
+
selectionTrigger(value: SelectionTrigger): this;
|
|
103
|
+
selectAll(): this;
|
|
104
|
+
deselectAll(): this;
|
|
105
|
+
clearSelection(): this;
|
|
106
|
+
selectRows(indexes: number[]): this;
|
|
107
|
+
deselectRows(indexes: number[]): this;
|
|
108
|
+
getSelectedIndexes(): number[];
|
|
109
|
+
getSelectedRows(): any[];
|
|
110
|
+
render(targetId?: string): this;
|
|
111
|
+
protected _setupContainer(targetId?: string): HTMLElement;
|
|
112
|
+
private _buildWrapper;
|
|
113
|
+
private _buildFilterInput;
|
|
114
|
+
private _buildTable;
|
|
115
|
+
private _buildTableHeader;
|
|
116
|
+
private _buildBulkCheckboxCell;
|
|
117
|
+
private _buildColumnHeader;
|
|
118
|
+
private _wireAllEvents;
|
|
119
|
+
private _wireTriggerEvents;
|
|
120
|
+
private _wireSyncBindings;
|
|
121
|
+
private _wireSyncRows;
|
|
122
|
+
private _wireSyncColumns;
|
|
123
|
+
private _getFilteredRows;
|
|
124
|
+
private _getSortedRows;
|
|
125
|
+
private _getPaginatedRows;
|
|
126
|
+
private _updateTable;
|
|
127
|
+
private _renderTableBody;
|
|
128
|
+
private _updateHeaderCheckbox;
|
|
129
|
+
private _updateBulkCheckboxState;
|
|
130
|
+
private _updateRowSelectionUI;
|
|
131
|
+
private _preserveSelections;
|
|
132
|
+
private _updatePagination;
|
|
133
|
+
renderTo(juxComponent: any): this;
|
|
134
|
+
}
|
|
135
|
+
export declare function table(id: string, options?: TableOptions): Table;
|
|
136
|
+
export {};
|
|
137
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.ts"],"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