@stonecrop/atable 0.2.64 → 0.2.65

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/atable.d.ts CHANGED
@@ -1,17 +1,14 @@
1
- import ACell from '@/components/ACell.vue';
2
- import AExpansionRow from '@/components/AExpansionRow.vue';
1
+ import ACell from './components/ACell.vue';
2
+ import AExpansionRow from './components/AExpansionRow.vue';
3
3
  import { App } from 'vue';
4
- import ARow from '@/components/ARow.vue';
5
- import ATable from '@/components/ATable.vue';
6
- import ATableHeader from '@/components/ATableHeader.vue';
7
- import ATableModal from '@/components/ATableModal.vue';
8
- import { CellContext } from '@/types';
9
- import { createTableStore } from '@/stores/table';
10
- import { TableColumn } from '@/types';
11
- import { TableConfig } from '@/types';
12
- import { TableDisplay } from '@/types';
13
- import { TableModal } from '@/types';
14
- import { TableRow } from '@/types';
4
+ import ARow from './components/ARow.vue';
5
+ import ATable from './components/ATable.vue';
6
+ import ATableHeader from './components/ATableHeader.vue';
7
+ import ATableModal from './components/ATableModal.vue';
8
+ import { ComputedRef } from 'vue';
9
+ import { CSSProperties } from 'vue';
10
+ import { Ref } from 'vue';
11
+ import { Store } from 'pinia';
15
12
 
16
13
  export { ACell }
17
14
 
@@ -25,9 +22,351 @@ export { ATableHeader }
25
22
 
26
23
  export { ATableModal }
27
24
 
28
- export { CellContext }
25
+ /**
26
+ * Table cell context definition.
27
+ * @public
28
+ */
29
+ export declare type CellContext = {
30
+ row: TableRow;
31
+ column: TableColumn;
32
+ table: {
33
+ [key: string]: any;
34
+ };
35
+ };
29
36
 
30
- export { createTableStore }
37
+ /**
38
+ * Table cell context definition.
39
+ * @public
40
+ */
41
+ declare type CellContext_2 = {
42
+ row: TableRow_2
43
+ column: TableColumn_2
44
+ table: { [key: string]: any }
45
+ }
46
+
47
+ /**
48
+ * Create a table store
49
+ * @param initData - Initial data for the table store
50
+ * @returns table store instance
51
+ * @public
52
+ */
53
+ export declare const createTableStore: (initData: {
54
+ columns: TableColumn_2[];
55
+ rows: TableRow_2[];
56
+ id?: string;
57
+ config?: TableConfig_2;
58
+ table?: {
59
+ [key: string]: any;
60
+ };
61
+ display?: TableDisplay_2[];
62
+ modal?: TableModal_2;
63
+ }) => Store<`table-${string}`, Pick<{
64
+ columns: Ref< {
65
+ name: string;
66
+ align?: CanvasTextAlign;
67
+ edit?: boolean;
68
+ label?: string;
69
+ type?: string;
70
+ width?: string;
71
+ pinned?: boolean;
72
+ cellComponent?: string;
73
+ cellComponentProps?: Record<string, any>;
74
+ modalComponent?: string | ((context?: CellContext_2) => string);
75
+ modalComponentExtraProps?: Record<string, any>;
76
+ format?: string | ((value: any, context?: CellContext_2) => string);
77
+ mask?: (value: any) => any;
78
+ }[], TableColumn_2[] | {
79
+ name: string;
80
+ align?: CanvasTextAlign;
81
+ edit?: boolean;
82
+ label?: string;
83
+ type?: string;
84
+ width?: string;
85
+ pinned?: boolean;
86
+ cellComponent?: string;
87
+ cellComponentProps?: Record<string, any>;
88
+ modalComponent?: string | ((context?: CellContext_2) => string);
89
+ modalComponentExtraProps?: Record<string, any>;
90
+ format?: string | ((value: any, context?: CellContext_2) => string);
91
+ mask?: (value: any) => any;
92
+ }[]>;
93
+ rows: Ref< {
94
+ [x: string]: any;
95
+ indent?: number;
96
+ parent?: number;
97
+ }[], TableRow_2[] | {
98
+ [x: string]: any;
99
+ indent?: number;
100
+ parent?: number;
101
+ }[]>;
102
+ config: Ref< {
103
+ view?: "uncounted" | "list" | "list-expansion" | "tree";
104
+ fullWidth?: boolean;
105
+ }, TableConfig_2 | {
106
+ view?: "uncounted" | "list" | "list-expansion" | "tree";
107
+ fullWidth?: boolean;
108
+ }>;
109
+ table: Ref< {}, {}>;
110
+ display: Ref< {
111
+ childrenOpen?: boolean;
112
+ expanded?: boolean;
113
+ indent?: number;
114
+ isParent?: boolean;
115
+ isRoot?: boolean;
116
+ open?: boolean;
117
+ parent?: number;
118
+ rowModified?: boolean;
119
+ }[], TableDisplay_2[] | {
120
+ childrenOpen?: boolean;
121
+ expanded?: boolean;
122
+ indent?: number;
123
+ isParent?: boolean;
124
+ isRoot?: boolean;
125
+ open?: boolean;
126
+ parent?: number;
127
+ rowModified?: boolean;
128
+ }[]>;
129
+ modal: Ref< {
130
+ colIndex?: number;
131
+ event?: string;
132
+ left?: number;
133
+ parent?: HTMLElement;
134
+ rowIndex?: number;
135
+ top?: number;
136
+ visible?: boolean;
137
+ width?: string;
138
+ component?: string;
139
+ componentProps?: Record<string, any>;
140
+ }, TableModal_2 | {
141
+ colIndex?: number;
142
+ event?: string;
143
+ left?: number;
144
+ parent?: HTMLElement;
145
+ rowIndex?: number;
146
+ top?: number;
147
+ visible?: boolean;
148
+ width?: string;
149
+ component?: string;
150
+ componentProps?: Record<string, any>;
151
+ }>;
152
+ hasPinnedColumns: ComputedRef<boolean>;
153
+ numberedRowWidth: ComputedRef<string>;
154
+ zeroColumn: ComputedRef<boolean>;
155
+ closeModal: (event: MouseEvent) => void;
156
+ getCellData: <T = any>(colIndex: number, rowIndex: number) => T;
157
+ getCellDisplayValue: (colIndex: number, rowIndex: number) => any;
158
+ getFormattedValue: (colIndex: number, rowIndex: number, value: any) => any;
159
+ getHeaderCellStyle: (column: TableColumn_2) => CSSProperties;
160
+ getIndent: (colIndex: number, indentLevel?: number) => string;
161
+ getRowExpandSymbol: (rowIndex: number) => "" | "-" | "+";
162
+ isRowVisible: (rowIndex: number) => boolean;
163
+ setCellData: (colIndex: number, rowIndex: number, value: any) => void;
164
+ toggleRowExpand: (rowIndex: number) => void;
165
+ }, "columns" | "rows" | "config" | "table" | "display" | "modal">, Pick<{
166
+ columns: Ref< {
167
+ name: string;
168
+ align?: CanvasTextAlign;
169
+ edit?: boolean;
170
+ label?: string;
171
+ type?: string;
172
+ width?: string;
173
+ pinned?: boolean;
174
+ cellComponent?: string;
175
+ cellComponentProps?: Record<string, any>;
176
+ modalComponent?: string | ((context?: CellContext_2) => string);
177
+ modalComponentExtraProps?: Record<string, any>;
178
+ format?: string | ((value: any, context?: CellContext_2) => string);
179
+ mask?: (value: any) => any;
180
+ }[], TableColumn_2[] | {
181
+ name: string;
182
+ align?: CanvasTextAlign;
183
+ edit?: boolean;
184
+ label?: string;
185
+ type?: string;
186
+ width?: string;
187
+ pinned?: boolean;
188
+ cellComponent?: string;
189
+ cellComponentProps?: Record<string, any>;
190
+ modalComponent?: string | ((context?: CellContext_2) => string);
191
+ modalComponentExtraProps?: Record<string, any>;
192
+ format?: string | ((value: any, context?: CellContext_2) => string);
193
+ mask?: (value: any) => any;
194
+ }[]>;
195
+ rows: Ref< {
196
+ [x: string]: any;
197
+ indent?: number;
198
+ parent?: number;
199
+ }[], TableRow_2[] | {
200
+ [x: string]: any;
201
+ indent?: number;
202
+ parent?: number;
203
+ }[]>;
204
+ config: Ref< {
205
+ view?: "uncounted" | "list" | "list-expansion" | "tree";
206
+ fullWidth?: boolean;
207
+ }, TableConfig_2 | {
208
+ view?: "uncounted" | "list" | "list-expansion" | "tree";
209
+ fullWidth?: boolean;
210
+ }>;
211
+ table: Ref< {}, {}>;
212
+ display: Ref< {
213
+ childrenOpen?: boolean;
214
+ expanded?: boolean;
215
+ indent?: number;
216
+ isParent?: boolean;
217
+ isRoot?: boolean;
218
+ open?: boolean;
219
+ parent?: number;
220
+ rowModified?: boolean;
221
+ }[], TableDisplay_2[] | {
222
+ childrenOpen?: boolean;
223
+ expanded?: boolean;
224
+ indent?: number;
225
+ isParent?: boolean;
226
+ isRoot?: boolean;
227
+ open?: boolean;
228
+ parent?: number;
229
+ rowModified?: boolean;
230
+ }[]>;
231
+ modal: Ref< {
232
+ colIndex?: number;
233
+ event?: string;
234
+ left?: number;
235
+ parent?: HTMLElement;
236
+ rowIndex?: number;
237
+ top?: number;
238
+ visible?: boolean;
239
+ width?: string;
240
+ component?: string;
241
+ componentProps?: Record<string, any>;
242
+ }, TableModal_2 | {
243
+ colIndex?: number;
244
+ event?: string;
245
+ left?: number;
246
+ parent?: HTMLElement;
247
+ rowIndex?: number;
248
+ top?: number;
249
+ visible?: boolean;
250
+ width?: string;
251
+ component?: string;
252
+ componentProps?: Record<string, any>;
253
+ }>;
254
+ hasPinnedColumns: ComputedRef<boolean>;
255
+ numberedRowWidth: ComputedRef<string>;
256
+ zeroColumn: ComputedRef<boolean>;
257
+ closeModal: (event: MouseEvent) => void;
258
+ getCellData: <T = any>(colIndex: number, rowIndex: number) => T;
259
+ getCellDisplayValue: (colIndex: number, rowIndex: number) => any;
260
+ getFormattedValue: (colIndex: number, rowIndex: number, value: any) => any;
261
+ getHeaderCellStyle: (column: TableColumn_2) => CSSProperties;
262
+ getIndent: (colIndex: number, indentLevel?: number) => string;
263
+ getRowExpandSymbol: (rowIndex: number) => "" | "-" | "+";
264
+ isRowVisible: (rowIndex: number) => boolean;
265
+ setCellData: (colIndex: number, rowIndex: number, value: any) => void;
266
+ toggleRowExpand: (rowIndex: number) => void;
267
+ }, "hasPinnedColumns" | "numberedRowWidth" | "zeroColumn">, Pick<{
268
+ columns: Ref< {
269
+ name: string;
270
+ align?: CanvasTextAlign;
271
+ edit?: boolean;
272
+ label?: string;
273
+ type?: string;
274
+ width?: string;
275
+ pinned?: boolean;
276
+ cellComponent?: string;
277
+ cellComponentProps?: Record<string, any>;
278
+ modalComponent?: string | ((context?: CellContext_2) => string);
279
+ modalComponentExtraProps?: Record<string, any>;
280
+ format?: string | ((value: any, context?: CellContext_2) => string);
281
+ mask?: (value: any) => any;
282
+ }[], TableColumn_2[] | {
283
+ name: string;
284
+ align?: CanvasTextAlign;
285
+ edit?: boolean;
286
+ label?: string;
287
+ type?: string;
288
+ width?: string;
289
+ pinned?: boolean;
290
+ cellComponent?: string;
291
+ cellComponentProps?: Record<string, any>;
292
+ modalComponent?: string | ((context?: CellContext_2) => string);
293
+ modalComponentExtraProps?: Record<string, any>;
294
+ format?: string | ((value: any, context?: CellContext_2) => string);
295
+ mask?: (value: any) => any;
296
+ }[]>;
297
+ rows: Ref< {
298
+ [x: string]: any;
299
+ indent?: number;
300
+ parent?: number;
301
+ }[], TableRow_2[] | {
302
+ [x: string]: any;
303
+ indent?: number;
304
+ parent?: number;
305
+ }[]>;
306
+ config: Ref< {
307
+ view?: "uncounted" | "list" | "list-expansion" | "tree";
308
+ fullWidth?: boolean;
309
+ }, TableConfig_2 | {
310
+ view?: "uncounted" | "list" | "list-expansion" | "tree";
311
+ fullWidth?: boolean;
312
+ }>;
313
+ table: Ref< {}, {}>;
314
+ display: Ref< {
315
+ childrenOpen?: boolean;
316
+ expanded?: boolean;
317
+ indent?: number;
318
+ isParent?: boolean;
319
+ isRoot?: boolean;
320
+ open?: boolean;
321
+ parent?: number;
322
+ rowModified?: boolean;
323
+ }[], TableDisplay_2[] | {
324
+ childrenOpen?: boolean;
325
+ expanded?: boolean;
326
+ indent?: number;
327
+ isParent?: boolean;
328
+ isRoot?: boolean;
329
+ open?: boolean;
330
+ parent?: number;
331
+ rowModified?: boolean;
332
+ }[]>;
333
+ modal: Ref< {
334
+ colIndex?: number;
335
+ event?: string;
336
+ left?: number;
337
+ parent?: HTMLElement;
338
+ rowIndex?: number;
339
+ top?: number;
340
+ visible?: boolean;
341
+ width?: string;
342
+ component?: string;
343
+ componentProps?: Record<string, any>;
344
+ }, TableModal_2 | {
345
+ colIndex?: number;
346
+ event?: string;
347
+ left?: number;
348
+ parent?: HTMLElement;
349
+ rowIndex?: number;
350
+ top?: number;
351
+ visible?: boolean;
352
+ width?: string;
353
+ component?: string;
354
+ componentProps?: Record<string, any>;
355
+ }>;
356
+ hasPinnedColumns: ComputedRef<boolean>;
357
+ numberedRowWidth: ComputedRef<string>;
358
+ zeroColumn: ComputedRef<boolean>;
359
+ closeModal: (event: MouseEvent) => void;
360
+ getCellData: <T = any>(colIndex: number, rowIndex: number) => T;
361
+ getCellDisplayValue: (colIndex: number, rowIndex: number) => any;
362
+ getFormattedValue: (colIndex: number, rowIndex: number, value: any) => any;
363
+ getHeaderCellStyle: (column: TableColumn_2) => CSSProperties;
364
+ getIndent: (colIndex: number, indentLevel?: number) => string;
365
+ getRowExpandSymbol: (rowIndex: number) => "" | "-" | "+";
366
+ isRowVisible: (rowIndex: number) => boolean;
367
+ setCellData: (colIndex: number, rowIndex: number, value: any) => void;
368
+ toggleRowExpand: (rowIndex: number) => void;
369
+ }, "closeModal" | "getCellData" | "getCellDisplayValue" | "getFormattedValue" | "getHeaderCellStyle" | "getIndent" | "getRowExpandSymbol" | "isRowVisible" | "setCellData" | "toggleRowExpand">>;
31
370
 
32
371
  /**
33
372
  * Install all ATable components
@@ -36,14 +375,164 @@ export { createTableStore }
36
375
  */
37
376
  export declare function install(app: App): void;
38
377
 
39
- export { TableColumn }
378
+ /**
379
+ * Table column definition.
380
+ * @public
381
+ */
382
+ export declare type TableColumn = {
383
+ name: string;
384
+ align?: CanvasTextAlign;
385
+ edit?: boolean;
386
+ label?: string;
387
+ type?: string;
388
+ width?: string;
389
+ pinned?: boolean;
390
+ cellComponent?: string;
391
+ cellComponentProps?: Record<string, any>;
392
+ modalComponent?: string | ((context?: CellContext) => string);
393
+ modalComponentExtraProps?: Record<string, any>;
394
+ format?: string | ((value: any, context?: CellContext) => string);
395
+ mask?: (value: any) => any;
396
+ };
40
397
 
41
- export { TableConfig }
398
+ /**
399
+ * Table column definition.
400
+ * @public
401
+ */
402
+ declare type TableColumn_2 = {
403
+ name: string
404
+
405
+ align?: CanvasTextAlign
406
+ edit?: boolean
407
+ label?: string
408
+ type?: string
409
+ width?: string
410
+ pinned?: boolean
411
+
412
+ cellComponent?: string
413
+ cellComponentProps?: Record<string, any>
414
+ modalComponent?: string | ((context?: CellContext_2) => string)
415
+ modalComponentExtraProps?: Record<string, any>
416
+
417
+ format?: string | ((value: any, context?: CellContext_2) => string)
418
+ mask?: (value: any) => any
419
+ }
42
420
 
43
- export { TableDisplay }
421
+ /**
422
+ * Table configuration definition.
423
+ * @public
424
+ */
425
+ export declare type TableConfig = {
426
+ /**
427
+ * The type of view to display the table in. Possible values:
428
+ * - `uncounted` - row numbers are not displayed in the table
429
+ * - `list` - row numbers are displayed in the table
430
+ * - `list-expansion` - carets are displayed in the number column that expand/collapse the row inline
431
+ * - `tree` - carets are displayed in the number column that expand/collapse grouped rows
432
+ */
433
+ view?: 'uncounted' | 'list' | 'list-expansion' | 'tree';
434
+ fullWidth?: boolean;
435
+ };
44
436
 
45
- export { TableModal }
437
+ /**
438
+ * Table configuration definition.
439
+ * @public
440
+ */
441
+ declare type TableConfig_2 = {
442
+ /**
443
+ * The type of view to display the table in. Possible values:
444
+ * - `uncounted` - row numbers are not displayed in the table
445
+ * - `list` - row numbers are displayed in the table
446
+ * - `list-expansion` - carets are displayed in the number column that expand/collapse the row inline
447
+ * - `tree` - carets are displayed in the number column that expand/collapse grouped rows
448
+ */
449
+ view?: 'uncounted' | 'list' | 'list-expansion' | 'tree'
450
+ fullWidth?: boolean
451
+ }
46
452
 
47
- export { TableRow }
453
+ /**
454
+ * Table display definition.
455
+ * @public
456
+ */
457
+ export declare type TableDisplay = {
458
+ childrenOpen?: boolean;
459
+ expanded?: boolean;
460
+ indent?: number;
461
+ isParent?: boolean;
462
+ isRoot?: boolean;
463
+ open?: boolean;
464
+ parent?: number;
465
+ rowModified?: boolean;
466
+ };
467
+
468
+ /**
469
+ * Table display definition.
470
+ * @public
471
+ */
472
+ declare type TableDisplay_2 = {
473
+ childrenOpen?: boolean
474
+ expanded?: boolean
475
+ indent?: number
476
+ isParent?: boolean
477
+ isRoot?: boolean
478
+ open?: boolean
479
+ parent?: number
480
+ rowModified?: boolean
481
+ }
482
+
483
+ /**
484
+ * Table modal definition.
485
+ * @public
486
+ */
487
+ export declare type TableModal = {
488
+ colIndex?: number;
489
+ event?: string;
490
+ left?: number;
491
+ parent?: HTMLElement;
492
+ rowIndex?: number;
493
+ top?: number;
494
+ visible?: boolean;
495
+ width?: string;
496
+ component?: string;
497
+ componentProps?: Record<string, any>;
498
+ };
499
+
500
+ /**
501
+ * Table modal definition.
502
+ * @public
503
+ */
504
+ declare type TableModal_2 = {
505
+ colIndex?: number
506
+ event?: string
507
+ left?: number
508
+ parent?: HTMLElement
509
+ rowIndex?: number
510
+ top?: number
511
+ visible?: boolean
512
+ width?: string
513
+
514
+ component?: string
515
+ componentProps?: Record<string, any>
516
+ }
517
+
518
+ /**
519
+ * Table row definition.
520
+ * @public
521
+ */
522
+ export declare type TableRow = {
523
+ [key: string]: any;
524
+ indent?: number;
525
+ parent?: number;
526
+ };
527
+
528
+ /**
529
+ * Table row definition.
530
+ * @public
531
+ */
532
+ declare type TableRow_2 = {
533
+ [key: string]: any
534
+ indent?: number
535
+ parent?: number
536
+ }
48
537
 
49
538
  export { }