@zeyos/zx 4.1.0 → 4.2.0
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/CHANGELOG.md +61 -0
- package/DESIGN-SYSTEM.md +33 -3
- package/README.md +17 -5
- package/dist/types/components/app-icon/app-icon.d.ts +8 -1
- package/dist/types/components/aurora/aurora.d.ts +72 -0
- package/dist/types/components/calendar/calendar-model.d.ts +202 -0
- package/dist/types/components/calendar/calendar.d.ts +500 -0
- package/dist/types/components/card-view/card-view.d.ts +303 -0
- package/dist/types/components/card-view/record-card.d.ts +242 -0
- package/dist/types/components/kanban-view/kanban-view.d.ts +572 -0
- package/dist/types/components/table/table.d.ts +120 -31
- package/dist/types/components/table-view/table-view.d.ts +192 -0
- package/dist/types/components/view/record-view.d.ts +464 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/zeyos/calendar.d.ts +91 -0
- package/dist/types/zeyos/icons.d.ts +19 -3
- package/dist/types/zeyos/index.d.ts +4 -0
- package/dist/types/zeyos/legacy-saved-views.d.ts +66 -0
- package/dist/types/zeyos/saved-views.d.ts +331 -0
- package/dist/types/zeyos/view.d.ts +305 -0
- package/dist/zx-zeyos.esm.js +4627 -1460
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +2492 -410
- package/dist/zx.esm.js +4891 -115
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +4891 -115
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +1702 -191
- package/docs/llms.md +207 -20
- package/docs/llms.txt +16 -6
- package/package.json +1 -1
- package/src/components/app-icon/app-icon.css +140 -30
- package/src/components/app-icon/app-icon.js +32 -5
- package/src/components/app-rail/app-rail.css +11 -2
- package/src/components/app-sidebar/app-sidebar.css +11 -2
- package/src/components/aurora/aurora.css +143 -0
- package/src/components/aurora/aurora.js +146 -0
- package/src/components/avatar/avatar.css +1 -1
- package/src/components/button/button.css +34 -2
- package/src/components/calendar/calendar-model.js +402 -0
- package/src/components/calendar/calendar.css +567 -0
- package/src/components/calendar/calendar.js +1524 -0
- package/src/components/card/card.css +25 -3
- package/src/components/card-view/card-view.css +389 -0
- package/src/components/card-view/card-view.js +527 -0
- package/src/components/card-view/record-card.js +392 -0
- package/src/components/context-menu/context-menu.css +2 -2
- package/src/components/date-picker/date-picker.css +15 -3
- package/src/components/datebox/date-range-box.css +15 -2
- package/src/components/datebox/datebox.css +16 -3
- package/src/components/dropdown/dropdown.css +15 -3
- package/src/components/kanban-view/kanban-view.css +216 -0
- package/src/components/kanban-view/kanban-view.js +1228 -0
- package/src/components/launcher/launcher.css +18 -5
- package/src/components/master-panel/master-panel.css +14 -3
- package/src/components/menu-button/menu-button.css +2 -2
- package/src/components/message/message.css +15 -10
- package/src/components/modal/modal.css +15 -3
- package/src/components/navigation-bar/navigation-bar.css +17 -5
- package/src/components/panel/panel.css +10 -2
- package/src/components/select/select.css +20 -4
- package/src/components/sheet/sheet.css +4 -1
- package/src/components/table/table.css +80 -4
- package/src/components/table/table.js +322 -37
- package/src/components/table-view/table-view.css +18 -0
- package/src/components/table-view/table-view.js +347 -0
- package/src/components/tag-picker/tag-picker.css +15 -3
- package/src/components/tooltip/tooltip.css +15 -3
- package/src/components/view/record-view.css +114 -0
- package/src/components/view/record-view.js +770 -0
- package/src/index.js +15 -0
- package/src/zeyos/calendar.js +115 -0
- package/src/zeyos/icons.js +15 -8
- package/src/zeyos/index.js +13 -0
- package/src/zeyos/launcher.js +2 -2
- package/src/zeyos/legacy-saved-views.js +155 -0
- package/src/zeyos/saved-views.js +815 -0
- package/src/zeyos/table.js +3 -1
- package/src/zeyos/view.js +543 -0
- package/styles/icons.css +3 -10
- package/styles/tokens/semantic.css +74 -2
- package/styles/zx.css +6 -0
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type ViewRecord = Record<string, any>;
|
|
3
|
+
export type ViewSortDirection = 'asc' | 'desc';
|
|
4
|
+
export type ViewSelectionMode = false | 'single' | 'multi';
|
|
5
|
+
export type ViewField = {
|
|
6
|
+
/**
|
|
7
|
+
* Stable field identifier and default record property.
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* Human-readable field label.
|
|
12
|
+
*/
|
|
13
|
+
label: string;
|
|
14
|
+
/**
|
|
15
|
+
* Value accessor.
|
|
16
|
+
*/
|
|
17
|
+
get?: (record: ViewRecord, index: number) => unknown;
|
|
18
|
+
/**
|
|
19
|
+
* Text-safe renderer. A returned Node is adopted; every other value is inserted as text.
|
|
20
|
+
*/
|
|
21
|
+
render?: (record: ViewRecord, index: number, value: unknown) => Node | string | number | null | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Local sort accessor.
|
|
24
|
+
*/
|
|
25
|
+
sortValue?: (record: ViewRecord, index: number) => unknown;
|
|
26
|
+
/**
|
|
27
|
+
* Whether the field may become the active sort.
|
|
28
|
+
*/
|
|
29
|
+
sortable?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Initial visibility when `hiddenFields` does not name the field.
|
|
32
|
+
*/
|
|
33
|
+
visible?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Semantic display type available to concrete views.
|
|
36
|
+
*/
|
|
37
|
+
type?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Whether title/subtitle fields also appear in metadata.
|
|
40
|
+
*/
|
|
41
|
+
duplicate?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Table-oriented width hint.
|
|
44
|
+
*/
|
|
45
|
+
width?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Alignment hint.
|
|
48
|
+
*/
|
|
49
|
+
align?: 'start' | 'center' | 'end' | 'left' | 'right';
|
|
50
|
+
/**
|
|
51
|
+
* View-specific descriptor values.
|
|
52
|
+
*/
|
|
53
|
+
view?: Record<string, unknown>;
|
|
54
|
+
};
|
|
55
|
+
export type ViewSort = {
|
|
56
|
+
/**
|
|
57
|
+
* Field id.
|
|
58
|
+
*/
|
|
59
|
+
id: string;
|
|
60
|
+
/**
|
|
61
|
+
* Sort direction.
|
|
62
|
+
*/
|
|
63
|
+
dir: ViewSortDirection;
|
|
64
|
+
};
|
|
65
|
+
export type RecordViewState = {
|
|
66
|
+
/**
|
|
67
|
+
* State schema version.
|
|
68
|
+
*/
|
|
69
|
+
version: 1;
|
|
70
|
+
/**
|
|
71
|
+
* Complete reconciled field order.
|
|
72
|
+
*/
|
|
73
|
+
fieldOrder: string[];
|
|
74
|
+
/**
|
|
75
|
+
* Hidden field ids.
|
|
76
|
+
*/
|
|
77
|
+
hiddenFields: string[];
|
|
78
|
+
/**
|
|
79
|
+
* Active sort.
|
|
80
|
+
*/
|
|
81
|
+
sort: ViewSort | null;
|
|
82
|
+
};
|
|
83
|
+
export type RecordViewOptions = {
|
|
84
|
+
/**
|
|
85
|
+
* Shared ordered field descriptors.
|
|
86
|
+
*/
|
|
87
|
+
fields?: ViewField[];
|
|
88
|
+
/**
|
|
89
|
+
* Initial records.
|
|
90
|
+
*/
|
|
91
|
+
data?: ViewRecord[];
|
|
92
|
+
/**
|
|
93
|
+
* Record id accessor.
|
|
94
|
+
*/
|
|
95
|
+
recordId?: string | ((record: ViewRecord) => unknown);
|
|
96
|
+
/**
|
|
97
|
+
* Initial sort.
|
|
98
|
+
*/
|
|
99
|
+
sort?: ViewSort | null;
|
|
100
|
+
/**
|
|
101
|
+
* Whether Zx reorders local records.
|
|
102
|
+
*/
|
|
103
|
+
sortMode?: 'local' | 'server';
|
|
104
|
+
/**
|
|
105
|
+
* Record selection behavior.
|
|
106
|
+
*/
|
|
107
|
+
selectable?: ViewSelectionMode;
|
|
108
|
+
/**
|
|
109
|
+
* Initially selected record ids.
|
|
110
|
+
*/
|
|
111
|
+
selection?: unknown[];
|
|
112
|
+
/**
|
|
113
|
+
* Field ids in preferred order.
|
|
114
|
+
*/
|
|
115
|
+
fieldOrder?: string[];
|
|
116
|
+
/**
|
|
117
|
+
* Initially hidden field ids.
|
|
118
|
+
*/
|
|
119
|
+
hiddenFields?: string[];
|
|
120
|
+
/**
|
|
121
|
+
* Whether concrete views show the shared field chooser.
|
|
122
|
+
*/
|
|
123
|
+
fieldControls?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Empty-result content.
|
|
126
|
+
*/
|
|
127
|
+
emptyText?: string | Node | (() => string | Node) | null;
|
|
128
|
+
onrecordclick?: (event: CustomEvent<Record<string, unknown>>) => void;
|
|
129
|
+
onrecorddblclick?: (event: CustomEvent<Record<string, unknown>>) => void;
|
|
130
|
+
ondatachange?: (event: CustomEvent<{
|
|
131
|
+
records: ViewRecord[];
|
|
132
|
+
}>) => void;
|
|
133
|
+
onselectionchange?: (event: CustomEvent<{
|
|
134
|
+
records: ViewRecord[];
|
|
135
|
+
ids: unknown[];
|
|
136
|
+
}>) => void;
|
|
137
|
+
onsortchange?: (event: CustomEvent<{
|
|
138
|
+
id: string | null;
|
|
139
|
+
dir: ViewSortDirection | null;
|
|
140
|
+
}>) => void;
|
|
141
|
+
onfieldvisibilitychange?: (event: CustomEvent<{
|
|
142
|
+
visible: string[];
|
|
143
|
+
hidden: string[];
|
|
144
|
+
}>) => void;
|
|
145
|
+
onfieldorderchange?: (event: CustomEvent<{
|
|
146
|
+
order: string[];
|
|
147
|
+
}>) => void;
|
|
148
|
+
onstatechange?: (event: CustomEvent<{
|
|
149
|
+
state: RecordViewState;
|
|
150
|
+
reason: string;
|
|
151
|
+
}>) => void;
|
|
152
|
+
};
|
|
153
|
+
/** @typedef {Record<string, any>} ViewRecord */
|
|
154
|
+
/** @typedef {'asc'|'desc'} ViewSortDirection */
|
|
155
|
+
/** @typedef {false|'single'|'multi'} ViewSelectionMode */
|
|
156
|
+
/**
|
|
157
|
+
* @typedef {Object} ViewField
|
|
158
|
+
* @property {string} id Stable field identifier and default record property.
|
|
159
|
+
* @property {string} label Human-readable field label.
|
|
160
|
+
* @property {(record: ViewRecord, index: number) => unknown} [get] Value accessor.
|
|
161
|
+
* @property {(record: ViewRecord, index: number, value: unknown) => Node|string|number|null|undefined} [render]
|
|
162
|
+
* Text-safe renderer. A returned Node is adopted; every other value is inserted as text.
|
|
163
|
+
* @property {(record: ViewRecord, index: number) => unknown} [sortValue] Local sort accessor.
|
|
164
|
+
* @property {boolean} [sortable=false] Whether the field may become the active sort.
|
|
165
|
+
* @property {boolean} [visible=true] Initial visibility when `hiddenFields` does not name the field.
|
|
166
|
+
* @property {string} [type='text'] Semantic display type available to concrete views.
|
|
167
|
+
* @property {boolean} [duplicate=false] Whether title/subtitle fields also appear in metadata.
|
|
168
|
+
* @property {string} [width] Table-oriented width hint.
|
|
169
|
+
* @property {'start'|'center'|'end'|'left'|'right'} [align] Alignment hint.
|
|
170
|
+
* @property {Record<string, unknown>} [view] View-specific descriptor values.
|
|
171
|
+
*/
|
|
172
|
+
/**
|
|
173
|
+
* @typedef {Object} ViewSort
|
|
174
|
+
* @property {string} id Field id.
|
|
175
|
+
* @property {ViewSortDirection} dir Sort direction.
|
|
176
|
+
*/
|
|
177
|
+
/**
|
|
178
|
+
* @typedef {Object} RecordViewState
|
|
179
|
+
* @property {1} version State schema version.
|
|
180
|
+
* @property {string[]} fieldOrder Complete reconciled field order.
|
|
181
|
+
* @property {string[]} hiddenFields Hidden field ids.
|
|
182
|
+
* @property {ViewSort|null} sort Active sort.
|
|
183
|
+
*/
|
|
184
|
+
/**
|
|
185
|
+
* @typedef {Object} RecordViewOptions
|
|
186
|
+
* @property {ViewField[]} [fields=[]] Shared ordered field descriptors.
|
|
187
|
+
* @property {ViewRecord[]} [data=[]] Initial records.
|
|
188
|
+
* @property {string|((record: ViewRecord) => unknown)} [recordId='ID'] Record id accessor.
|
|
189
|
+
* @property {ViewSort|null} [sort=null] Initial sort.
|
|
190
|
+
* @property {'local'|'server'} [sortMode='local'] Whether Zx reorders local records.
|
|
191
|
+
* @property {ViewSelectionMode} [selectable=false] Record selection behavior.
|
|
192
|
+
* @property {unknown[]} [selection=[]] Initially selected record ids.
|
|
193
|
+
* @property {string[]} [fieldOrder=[]] Field ids in preferred order.
|
|
194
|
+
* @property {string[]} [hiddenFields=[]] Initially hidden field ids.
|
|
195
|
+
* @property {boolean} [fieldControls=true] Whether concrete views show the shared field chooser.
|
|
196
|
+
* @property {string|Node|(() => string|Node)|null} [emptyText=null] Empty-result content.
|
|
197
|
+
* @property {(event: CustomEvent<Record<string, unknown>>) => void} [onrecordclick]
|
|
198
|
+
* @property {(event: CustomEvent<Record<string, unknown>>) => void} [onrecorddblclick]
|
|
199
|
+
* @property {(event: CustomEvent<{records:ViewRecord[]}>) => void} [ondatachange]
|
|
200
|
+
* @property {(event: CustomEvent<{records:ViewRecord[],ids:unknown[]}>) => void} [onselectionchange]
|
|
201
|
+
* @property {(event: CustomEvent<{id:string|null,dir:ViewSortDirection|null}>) => void} [onsortchange]
|
|
202
|
+
* @property {(event: CustomEvent<{visible:string[],hidden:string[]}>) => void} [onfieldvisibilitychange]
|
|
203
|
+
* @property {(event: CustomEvent<{order:string[]}>) => void} [onfieldorderchange]
|
|
204
|
+
* @property {(event: CustomEvent<{state:RecordViewState,reason:string}>) => void} [onstatechange]
|
|
205
|
+
*/
|
|
206
|
+
/**
|
|
207
|
+
* Presentation-neutral state and controls shared by record collection views. Concrete view classes
|
|
208
|
+
* initialize this base from their `render()` method and implement `_refreshView()`.
|
|
209
|
+
* @fires RecordView#datachange
|
|
210
|
+
* @fires RecordView#selectionchange
|
|
211
|
+
* @fires RecordView#sortchange
|
|
212
|
+
* @fires RecordView#fieldvisibilitychange
|
|
213
|
+
* @fires RecordView#fieldorderchange
|
|
214
|
+
* @fires RecordView#statechange
|
|
215
|
+
* @extends {Component<RecordViewOptions>}
|
|
216
|
+
*/
|
|
217
|
+
export declare class RecordView extends Component<RecordViewOptions> {
|
|
218
|
+
_recordViewOriginal: import("../../core/dom.js").TargetSnapshot;
|
|
219
|
+
_recordViewDestroyed: boolean;
|
|
220
|
+
_viewFields: ViewField[];
|
|
221
|
+
_viewFieldOrder: string[];
|
|
222
|
+
_viewHidden: Set<string>;
|
|
223
|
+
_viewData: ViewRecord[];
|
|
224
|
+
_viewSort: ViewSort;
|
|
225
|
+
_viewSelected: any;
|
|
226
|
+
_viewSelectionAnchor: unknown;
|
|
227
|
+
_viewFieldControls: HTMLElement;
|
|
228
|
+
_viewFieldList: HTMLElement;
|
|
229
|
+
_viewInitialized: boolean;
|
|
230
|
+
static cssName: string;
|
|
231
|
+
/** @type {Readonly<RecordViewOptions>} */
|
|
232
|
+
static defaults: Readonly<RecordViewOptions>;
|
|
233
|
+
/**
|
|
234
|
+
* Creates the abstract base as a minimal record view. Concrete views normally call this through
|
|
235
|
+
* their own explicitly typed constructors.
|
|
236
|
+
* @param {Element|string|null} [target=null] Existing root, selector, or null.
|
|
237
|
+
* @param {RecordViewOptions} [options={}] Shared view options.
|
|
238
|
+
*/
|
|
239
|
+
constructor(target?: Element | string | null, options?: RecordViewOptions);
|
|
240
|
+
/** @returns {HTMLElement} Minimal base root. */
|
|
241
|
+
render(): HTMLElement;
|
|
242
|
+
/** Cleans up a directly instantiated base view and restores an enhanced target. @returns {void} */
|
|
243
|
+
destroy(): void;
|
|
244
|
+
/**
|
|
245
|
+
* Initializes shared state during a concrete view's `render()` call.
|
|
246
|
+
* @protected
|
|
247
|
+
* @param {HTMLElement} root Concrete view root.
|
|
248
|
+
* @returns {void}
|
|
249
|
+
*/
|
|
250
|
+
protected _initRecordView(root: HTMLElement): void;
|
|
251
|
+
/**
|
|
252
|
+
* Replaces every record and clears selections whose ids disappeared.
|
|
253
|
+
* @param {ViewRecord[]} records New records.
|
|
254
|
+
* @returns {this}
|
|
255
|
+
*/
|
|
256
|
+
setData(records: ViewRecord[]): this;
|
|
257
|
+
/**
|
|
258
|
+
* Appends records without mutating the supplied array.
|
|
259
|
+
* @param {ViewRecord[]} records Records to append.
|
|
260
|
+
* @returns {this}
|
|
261
|
+
*/
|
|
262
|
+
addData(records: ViewRecord[]): this;
|
|
263
|
+
/**
|
|
264
|
+
* Replaces the record currently identified by `id`.
|
|
265
|
+
* @param {unknown} id Existing record id.
|
|
266
|
+
* @param {ViewRecord} record Replacement record.
|
|
267
|
+
* @returns {this}
|
|
268
|
+
*/
|
|
269
|
+
updateRecord(id: unknown, record: ViewRecord): this;
|
|
270
|
+
/**
|
|
271
|
+
* Removes one record by id.
|
|
272
|
+
* @param {unknown} id Record id.
|
|
273
|
+
* @returns {this}
|
|
274
|
+
*/
|
|
275
|
+
removeRecord(id: unknown): this;
|
|
276
|
+
/** Returns a record by id. @param {unknown} id Record id. @returns {ViewRecord|null} */
|
|
277
|
+
getRecord(id: unknown): ViewRecord | null;
|
|
278
|
+
/** Returns a shallow copy in current display order. @returns {ViewRecord[]} */
|
|
279
|
+
getData(): ViewRecord[];
|
|
280
|
+
/**
|
|
281
|
+
* Replaces field descriptors while reconciling order, visibility, and sort by stable id.
|
|
282
|
+
* @param {ViewField[]} fields Next fields.
|
|
283
|
+
* @returns {this}
|
|
284
|
+
*/
|
|
285
|
+
setFields(fields: ViewField[]): this;
|
|
286
|
+
/** Returns cloned field descriptors in configured order. @returns {ViewField[]} */
|
|
287
|
+
getFields(): ViewField[];
|
|
288
|
+
/** Returns visible cloned descriptors in configured order. @returns {ViewField[]} */
|
|
289
|
+
getVisibleFields(): ViewField[];
|
|
290
|
+
/** Returns hidden field ids in configured order. @returns {string[]} */
|
|
291
|
+
getHiddenFields(): string[];
|
|
292
|
+
/** Returns the complete field id order. @returns {string[]} */
|
|
293
|
+
getFieldOrder(): string[];
|
|
294
|
+
/**
|
|
295
|
+
* Shows or hides one field. The final visible field cannot be hidden.
|
|
296
|
+
* @param {string} id Field id.
|
|
297
|
+
* @param {boolean} [visible=true] Desired visibility.
|
|
298
|
+
* @param {{silent?:boolean}} [options={}] Event behavior.
|
|
299
|
+
* @returns {this}
|
|
300
|
+
*/
|
|
301
|
+
setFieldVisible(id: string, visible?: boolean, options?: {
|
|
302
|
+
silent?: boolean;
|
|
303
|
+
}): this;
|
|
304
|
+
/** Toggles one field. @param {string} id Field id. @param {{silent?:boolean}} [options={}] @returns {this} */
|
|
305
|
+
toggleField(id: string, options?: {
|
|
306
|
+
silent?: boolean;
|
|
307
|
+
}): this;
|
|
308
|
+
/**
|
|
309
|
+
* Moves one field relative to another.
|
|
310
|
+
* @param {string} id Moving field id.
|
|
311
|
+
* @param {string} targetId Target field id.
|
|
312
|
+
* @param {'before'|'after'} [position='before'] Target edge.
|
|
313
|
+
* @param {{silent?:boolean}} [options={}] Event behavior.
|
|
314
|
+
* @returns {this}
|
|
315
|
+
*/
|
|
316
|
+
moveField(id: string, targetId: string, position?: 'before' | 'after', options?: {
|
|
317
|
+
silent?: boolean;
|
|
318
|
+
}): this;
|
|
319
|
+
/**
|
|
320
|
+
* Reconciles a preferred field order with every current field.
|
|
321
|
+
* @param {string[]} order Preferred ids.
|
|
322
|
+
* @param {{silent?:boolean}} [options={}] Event behavior.
|
|
323
|
+
* @returns {this}
|
|
324
|
+
*/
|
|
325
|
+
setFieldOrder(order: string[], options?: {
|
|
326
|
+
silent?: boolean;
|
|
327
|
+
}): this;
|
|
328
|
+
/**
|
|
329
|
+
* Changes or clears the active sort.
|
|
330
|
+
* @param {string|null} id Sort field, or null to clear.
|
|
331
|
+
* @param {ViewSortDirection} [dir='asc'] Direction.
|
|
332
|
+
* @param {{silent?:boolean}} [options={}] Event behavior.
|
|
333
|
+
* @returns {this}
|
|
334
|
+
*/
|
|
335
|
+
setSort(id: string | null, dir?: ViewSortDirection, options?: {
|
|
336
|
+
silent?: boolean;
|
|
337
|
+
}): this;
|
|
338
|
+
/** Returns a copy of the active sort. @returns {ViewSort|null} */
|
|
339
|
+
getSort(): ViewSort | null;
|
|
340
|
+
/** Returns selected records in display order. @returns {ViewRecord[]} */
|
|
341
|
+
getSelection(): ViewRecord[];
|
|
342
|
+
/** Returns selected record ids in display order. @returns {unknown[]} */
|
|
343
|
+
getSelectionIds(): unknown[];
|
|
344
|
+
/**
|
|
345
|
+
* Replaces selection from record ids.
|
|
346
|
+
* @param {unknown[]} ids Record ids.
|
|
347
|
+
* @param {{silent?:boolean}} [options={}] Event behavior.
|
|
348
|
+
* @returns {this}
|
|
349
|
+
*/
|
|
350
|
+
setSelection(ids: unknown[], options?: {
|
|
351
|
+
silent?: boolean;
|
|
352
|
+
}): this;
|
|
353
|
+
/** Clears selection. @param {{silent?:boolean}} [options={}] @returns {this} */
|
|
354
|
+
clearSelection(options?: {
|
|
355
|
+
silent?: boolean;
|
|
356
|
+
}): this;
|
|
357
|
+
/**
|
|
358
|
+
* Toggles a record selection, with optional multi-select range behavior.
|
|
359
|
+
* @param {unknown} id Record id.
|
|
360
|
+
* @param {{selected?:boolean,range?:boolean}} [options={}] Toggle behavior.
|
|
361
|
+
* @returns {this}
|
|
362
|
+
*/
|
|
363
|
+
toggleSelection(id: unknown, options?: {
|
|
364
|
+
selected?: boolean;
|
|
365
|
+
range?: boolean;
|
|
366
|
+
}): this;
|
|
367
|
+
/**
|
|
368
|
+
* Marks the whole view busy without imposing a loading presentation.
|
|
369
|
+
* @param {boolean} [loading=true] Busy state.
|
|
370
|
+
* @returns {this}
|
|
371
|
+
*/
|
|
372
|
+
setLoading(loading?: boolean): this;
|
|
373
|
+
/** Returns JSON-safe, persistence-neutral view configuration. @returns {RecordViewState} */
|
|
374
|
+
getViewState(): RecordViewState;
|
|
375
|
+
/**
|
|
376
|
+
* Restores common configuration. Unknown fields are ignored and newly introduced fields append.
|
|
377
|
+
* @param {Partial<RecordViewState>|null} state Saved state.
|
|
378
|
+
* @param {{silent?:boolean}} [options={}] Event behavior.
|
|
379
|
+
* @returns {this}
|
|
380
|
+
*/
|
|
381
|
+
setViewState(state: Partial<RecordViewState> | null, options?: {
|
|
382
|
+
silent?: boolean;
|
|
383
|
+
}): this;
|
|
384
|
+
/**
|
|
385
|
+
* Builds the shared show/hide and ordering disclosure for a concrete view toolbar.
|
|
386
|
+
* @protected
|
|
387
|
+
* @param {string} [label='Fields'] Trigger label.
|
|
388
|
+
* @returns {HTMLElement} Disclosure element.
|
|
389
|
+
*/
|
|
390
|
+
protected _createViewFieldControls(label?: string): HTMLElement;
|
|
391
|
+
/** Concrete renderers override this hook. @protected @param {string} _reason Refresh reason. @returns {void} */
|
|
392
|
+
protected _refreshView(_reason: string): void;
|
|
393
|
+
/** Reads one record's stable id. @protected @param {ViewRecord} record Record. @returns {unknown} */
|
|
394
|
+
protected _viewRecordId(record: ViewRecord): unknown;
|
|
395
|
+
/** Returns whether a record is selected. @protected @param {unknown} id Record id. @returns {boolean} */
|
|
396
|
+
protected _isViewSelected(id: unknown): boolean;
|
|
397
|
+
/** Sorts the internal record copy. @private @returns {void} */
|
|
398
|
+
private _sortViewData;
|
|
399
|
+
/** @private @param {unknown[]} selection @returns {void} */
|
|
400
|
+
private _setInitialSelection;
|
|
401
|
+
/** @private @returns {boolean} */
|
|
402
|
+
private _pruneViewSelection;
|
|
403
|
+
/** @private @returns {void} */
|
|
404
|
+
private _emitViewSelection;
|
|
405
|
+
/** @private @param {string} reason @returns {void} */
|
|
406
|
+
private _emitViewState;
|
|
407
|
+
/** @private @param {string|null} [focusId=null] @returns {void} */
|
|
408
|
+
private _renderViewFieldControls;
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Validates and clones field descriptors.
|
|
412
|
+
* @param {ViewField[]} fields Fields.
|
|
413
|
+
* @returns {ViewField[]} Normalized fields.
|
|
414
|
+
*/
|
|
415
|
+
export declare function normalizeViewFields(fields: ViewField[]): ViewField[];
|
|
416
|
+
/**
|
|
417
|
+
* Reconciles a partial or stale order with all current fields.
|
|
418
|
+
* @param {ViewField[]} fields Current fields.
|
|
419
|
+
* @param {unknown} order Preferred ids.
|
|
420
|
+
* @returns {string[]} Complete order.
|
|
421
|
+
*/
|
|
422
|
+
export declare function reconcileFieldOrder(fields: ViewField[], order: unknown): string[];
|
|
423
|
+
/**
|
|
424
|
+
* Moves one id in an immutable order.
|
|
425
|
+
* @param {string[]} order Current order.
|
|
426
|
+
* @param {string} id Moving id.
|
|
427
|
+
* @param {string} targetId Target id.
|
|
428
|
+
* @param {'before'|'after'} [position='before'] Target edge.
|
|
429
|
+
* @returns {string[]} Next order, or an unchanged copy for invalid moves.
|
|
430
|
+
*/
|
|
431
|
+
export declare function moveViewField(order: string[], id: string, targetId: string, position?: 'before' | 'after'): string[];
|
|
432
|
+
/**
|
|
433
|
+
* Reads one field through its accessor or record property.
|
|
434
|
+
* @param {ViewField} field Field.
|
|
435
|
+
* @param {ViewRecord} record Record.
|
|
436
|
+
* @param {number} [index=0] Display index.
|
|
437
|
+
* @returns {unknown} Field value.
|
|
438
|
+
*/
|
|
439
|
+
export declare function readViewField(field: ViewField, record: ViewRecord, index?: number): unknown;
|
|
440
|
+
/**
|
|
441
|
+
* Resolves display content without parsing HTML.
|
|
442
|
+
* @param {ViewField} field Field.
|
|
443
|
+
* @param {ViewRecord} record Record.
|
|
444
|
+
* @param {number} [index=0] Display index.
|
|
445
|
+
* @returns {Node|string|number|null|undefined} Rendered content.
|
|
446
|
+
*/
|
|
447
|
+
export declare function renderViewField(field: ViewField, record: ViewRecord, index?: number): Node | string | number | null | undefined;
|
|
448
|
+
/**
|
|
449
|
+
* Stably sorts a cloned record array by one shared field descriptor.
|
|
450
|
+
* @param {ViewRecord[]} records Records.
|
|
451
|
+
* @param {ViewField[]} fields Fields.
|
|
452
|
+
* @param {ViewSort|null} sort Sort.
|
|
453
|
+
* @returns {ViewRecord[]} Sorted copy.
|
|
454
|
+
*/
|
|
455
|
+
export declare function sortViewRecords(records: ViewRecord[], fields: ViewField[], sort: ViewSort | null): ViewRecord[];
|
|
456
|
+
/**
|
|
457
|
+
* Normalizes saved common state against current fields.
|
|
458
|
+
* @param {Partial<RecordViewState>|null|undefined} state Saved state.
|
|
459
|
+
* @param {ViewField[]} fields Current normalized fields.
|
|
460
|
+
* @returns {RecordViewState} Reconciled state.
|
|
461
|
+
*/
|
|
462
|
+
export declare function normalizeViewState(state: Partial<RecordViewState> | null | undefined, fields: ViewField[]): RecordViewState;
|
|
463
|
+
/** Reads a stable record id. @param {ViewRecord} record @param {string|((record:ViewRecord)=>unknown)} accessor @returns {unknown} */
|
|
464
|
+
export declare function viewRecordId(record: ViewRecord, accessor: string | ((record: ViewRecord) => unknown)): unknown;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export { Toolbar } from './components/toolbar/toolbar.js';
|
|
|
38
38
|
export { Toggle } from './components/toggle/toggle.js';
|
|
39
39
|
export { Groupbox } from './components/groupbox/groupbox.js';
|
|
40
40
|
export { Card } from './components/card/card.js';
|
|
41
|
+
export { Aurora } from './components/aurora/aurora.js';
|
|
41
42
|
export { Panel } from './components/panel/panel.js';
|
|
42
43
|
export { MasterPanel } from './components/master-panel/master-panel.js';
|
|
43
44
|
export { SplitView, clampSize, resolveSize, snapSize } from './components/split-view/split-view.js';
|
|
@@ -76,7 +77,13 @@ export { Datebox, DateTimeBox } from './components/datebox/datebox.js';
|
|
|
76
77
|
export { DateRangePicker, clampRange, defaultDateRangePresets, normalizeRange, rangeNights, rangeStateOf } from './components/date-picker/date-range-picker.js';
|
|
77
78
|
export { DateRangeBox, formatRangeText, parseRangeText } from './components/datebox/date-range-box.js';
|
|
78
79
|
export { Timebox, splitTime, joinTime } from './components/timebox/timebox.js';
|
|
80
|
+
export { Calendar } from './components/calendar/calendar.js';
|
|
81
|
+
export { CALENDAR_VIEWS, addCalendarDays, calendarDayDifference, calendarDayKey, calendarEventIntersects, calendarEventSpansDays, calendarRange, cloneCalendarEvent, layoutCalendarSpans, layoutTimedCalendarEvents, normalizeCalendarEvents, shiftCalendarEvent, startOfCalendarDay, startOfCalendarWeek } from './components/calendar/calendar-model.js';
|
|
82
|
+
export { RecordView, normalizeViewFields, reconcileFieldOrder, moveViewField, readViewField, renderViewField, sortViewRecords, normalizeViewState, viewRecordId } from './components/view/record-view.js';
|
|
79
83
|
export { Table, reorderTableRows } from './components/table/table.js';
|
|
84
|
+
export { TableView } from './components/table-view/table-view.js';
|
|
85
|
+
export { CardView } from './components/card-view/card-view.js';
|
|
86
|
+
export { KanbanView } from './components/kanban-view/kanban-view.js';
|
|
80
87
|
export { Grid, billingColumns, isBillingLine } from './components/grid/grid.js';
|
|
81
88
|
export { Chart, ChartJsAdapter, chartSummaryTable, cloneChartValue, isEmptyChartData } from './components/chart/chart.js';
|
|
82
89
|
export { TreeView } from './components/tree/tree.js';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Calendar } from '../index.js';
|
|
2
|
+
export type ZeyosCalendarOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Current ZeyOS appointment/event occurrences.
|
|
5
|
+
*/
|
|
6
|
+
appointments?: Record<string, any>[];
|
|
7
|
+
/**
|
|
8
|
+
* Already-normalized generic Calendar records.
|
|
9
|
+
*/
|
|
10
|
+
events?: Record<string, any>[];
|
|
11
|
+
/**
|
|
12
|
+
* Calendar anchor.
|
|
13
|
+
*/
|
|
14
|
+
date?: string | number | Date | null;
|
|
15
|
+
/**
|
|
16
|
+
* Initial view.
|
|
17
|
+
*/
|
|
18
|
+
view?: 'agenda' | 'day' | 'week' | 'month' | 'year';
|
|
19
|
+
/**
|
|
20
|
+
* Apply move/resize proposals locally before persistence.
|
|
21
|
+
*/
|
|
22
|
+
optimistic?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Enable moving and resizing.
|
|
25
|
+
*/
|
|
26
|
+
editable?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* User-preferred first weekday.
|
|
29
|
+
*/
|
|
30
|
+
weekStart?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Show five days in week view.
|
|
33
|
+
*/
|
|
34
|
+
workweek?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Persistence listener.
|
|
37
|
+
*/
|
|
38
|
+
oneventchange?: (event: CustomEvent<Record<string, any>>) => void;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {Object} ZeyosCalendarOptions
|
|
42
|
+
* @property {Record<string, any>[]} [appointments=[]] Current ZeyOS appointment/event occurrences.
|
|
43
|
+
* @property {Record<string, any>[]} [events] Already-normalized generic Calendar records.
|
|
44
|
+
* @property {string|number|Date|null} [date] Calendar anchor.
|
|
45
|
+
* @property {'agenda'|'day'|'week'|'month'|'year'} [view='month'] Initial view.
|
|
46
|
+
* @property {boolean} [optimistic=true] Apply move/resize proposals locally before persistence.
|
|
47
|
+
* @property {boolean} [editable=false] Enable moving and resizing.
|
|
48
|
+
* @property {number} [weekStart=1] User-preferred first weekday.
|
|
49
|
+
* @property {boolean} [workweek=false] Show five days in week view.
|
|
50
|
+
* @property {(event: CustomEvent<Record<string, any>>) => void} [oneventchange] Persistence listener.
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Maps one expanded ZeyOS appointment/event row to the product-neutral Calendar shape. Occurrence
|
|
54
|
+
* identity includes the start timestamp because recurring rows intentionally share their base ID;
|
|
55
|
+
* persistence callers keep using `event.data.ID`.
|
|
56
|
+
* @param {Record<string, any>} record ZeyOS row.
|
|
57
|
+
* @returns {Record<string, any>} Generic Calendar event.
|
|
58
|
+
*/
|
|
59
|
+
export declare function zeyosAppointmentToEvent(record: Record<string, any>): Record<string, any>;
|
|
60
|
+
/** @param {Record<string, any>[]} records @returns {Record<string, any>[]} */
|
|
61
|
+
export declare function zeyosAppointmentsToEvents(records: Record<string, any>[]): Record<string, any>[];
|
|
62
|
+
/**
|
|
63
|
+
* Converts a proposed Calendar occurrence back to the current ZeyOS appointment update fields.
|
|
64
|
+
* The base appointment identifier remains the source record's `ID`; date values become Unix
|
|
65
|
+
* seconds and the adapter never adds recurrence or DAV fields.
|
|
66
|
+
* @param {{start: Date, end: Date, data?: Record<string, any>}} event Calendar event proposal.
|
|
67
|
+
* @returns {{ID?: unknown, datefrom: number|null, dateto: number|null}}
|
|
68
|
+
*/
|
|
69
|
+
export declare function calendarEventToZeyosPatch(event: {
|
|
70
|
+
start: Date;
|
|
71
|
+
end: Date;
|
|
72
|
+
data?: Record<string, any>;
|
|
73
|
+
}): {
|
|
74
|
+
ID?: unknown;
|
|
75
|
+
datefrom: number | null;
|
|
76
|
+
dateto: number | null;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Builds Calendar options while preserving every explicit generic option. `appointments` is
|
|
80
|
+
* mapped only when present; callers may instead pass already-normalized `events`.
|
|
81
|
+
* @param {ZeyosCalendarOptions & Record<string, any>} [options={}] ZeyOS and Calendar options.
|
|
82
|
+
* @returns {Record<string, any>} Plain Calendar options.
|
|
83
|
+
*/
|
|
84
|
+
export declare function buildZeyosCalendarOptions(options?: ZeyosCalendarOptions & Record<string, any>): Record<string, any>;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a Calendar that accepts current ZeyOS appointment/event occurrences directly.
|
|
87
|
+
* @param {Element|string|null} target Existing target or null.
|
|
88
|
+
* @param {ZeyosCalendarOptions & Record<string, any>} [options={}] Adapter and Calendar options.
|
|
89
|
+
* @returns {Calendar}
|
|
90
|
+
*/
|
|
91
|
+
export declare function zeyosCalendar(target: Element | string | null, options?: ZeyosCalendarOptions & Record<string, any>): Calendar;
|
|
@@ -87,6 +87,18 @@ export type ModuleChipOptions = {
|
|
|
87
87
|
* Override the module colour for a server-defined fork or weblet.
|
|
88
88
|
*/
|
|
89
89
|
color?: string;
|
|
90
|
+
/**
|
|
91
|
+
* Optional corner badge.
|
|
92
|
+
*/
|
|
93
|
+
badge?: string | number | null;
|
|
94
|
+
/**
|
|
95
|
+
* Whether the application identity is selected.
|
|
96
|
+
*/
|
|
97
|
+
selected?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* AppIcon vessel geometry.
|
|
100
|
+
*/
|
|
101
|
+
shape?: 'tile' | 'circle';
|
|
90
102
|
/**
|
|
91
103
|
* AppIcon material treatment.
|
|
92
104
|
*/
|
|
@@ -105,20 +117,24 @@ export type ModuleChipOptions = {
|
|
|
105
117
|
* @property {boolean} [standard=false] Use the stock Font Awesome fallback glyph.
|
|
106
118
|
* @property {string|Node|(()=>string|Node)|null} [icon] Explicit glyph override, useful for an offline fallback.
|
|
107
119
|
* @property {string} [color] Override the module colour for a server-defined fork or weblet.
|
|
120
|
+
* @property {string|number|null} [badge=null] Optional corner badge.
|
|
121
|
+
* @property {boolean} [selected=false] Whether the application identity is selected.
|
|
122
|
+
* @property {'tile'|'circle'} [shape='tile'] AppIcon vessel geometry.
|
|
108
123
|
* @property {false|'subtle'|'strong'} [glass='subtle'] AppIcon material treatment.
|
|
109
124
|
* @property {string|string[]} [class] Extra class names.
|
|
110
125
|
*/
|
|
111
126
|
/**
|
|
112
127
|
* Creates a module's icon chip: the glyph on the module's identity colour, the way ZeyOS draws
|
|
113
|
-
* module icons in navigation and record headers.
|
|
114
|
-
*
|
|
128
|
+
* module icons in navigation and record headers. AppIcon identity glyphs stay white across every
|
|
129
|
+
* module colour; material shading preserves their silhouette on light colours.
|
|
115
130
|
* @param {string} name Module, entity, or resource name.
|
|
116
131
|
* @param {ModuleChipOptions} [options={}] Display and accessibility options.
|
|
117
132
|
* @returns {HTMLElement} A `<span class="zx-module-icon">` wrapping the glyph.
|
|
118
133
|
*/
|
|
119
134
|
export declare function moduleChip(name: string, options?: ModuleChipOptions): HTMLElement;
|
|
120
135
|
/**
|
|
121
|
-
* Creates the public ZeyOS
|
|
136
|
+
* Creates the public ZeyOS application-identity preset for any module, fork, or weblet. It uses
|
|
137
|
+
* the circular application vessel by default; use `moduleChip()` for compact entity/record tiles.
|
|
122
138
|
* @param {string} name Module/entity identifier.
|
|
123
139
|
* @param {ModuleChipOptions} [options={}] AppIcon options.
|
|
124
140
|
* @returns {HTMLElement}
|
|
@@ -11,3 +11,7 @@ export { ZEYOS_LAUNCHER_APPLICATIONS, buildZeyosLauncherConfig, zeyosLauncher, n
|
|
|
11
11
|
export { zeyosSelect, buildZeyosSelectConfig, zeyosEntitySelect, buildZeyosEntitySelectConfig } from './select.js';
|
|
12
12
|
export { zeyosForm } from './form.js';
|
|
13
13
|
export { zeyosTable } from './table.js';
|
|
14
|
+
export { buildZeyosCalendarOptions, calendarEventToZeyosPatch, zeyosAppointmentToEvent, zeyosAppointmentsToEvents, zeyosCalendar } from './calendar.js';
|
|
15
|
+
export { buildZeyosViewConfig, zeyosView } from './view.js';
|
|
16
|
+
export { SAVED_VIEWS_VERSION, SavedViewDuplicateNameError, SavedViewRegistry, SavedViewScopeMismatchError, createSavedViewRegistry, migrateSavedViewDocument, normalizeSavedViewDocument, normalizeSavedViewScope } from './saved-views.js';
|
|
17
|
+
export { createLegacySavedViewTransport, legacySavedViewRequest } from './legacy-saved-views.js';
|