@stonecrop/aform 0.4.12 → 0.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/aform.d.ts CHANGED
@@ -62,13 +62,22 @@ export declare type BaseSchema = {
62
62
  * Table cell context definition.
63
63
  * @public
64
64
  */
65
- export declare type CellContext = {
65
+ export declare interface CellContext {
66
+ /**
67
+ * The row object for the current cell.
68
+ */
66
69
  row: TableRow;
70
+ /**
71
+ * The column object for the current cell.
72
+ */
67
73
  column: TableColumn;
74
+ /**
75
+ * The table object for the current cell.
76
+ */
68
77
  table: {
69
78
  [key: string]: any;
70
79
  };
71
- };
80
+ }
72
81
 
73
82
  /**
74
83
  * Schema structure for defining fieldsets inside AForm
@@ -145,6 +154,31 @@ export declare type FormSchema = BaseSchema & {
145
154
  mask?: string;
146
155
  };
147
156
 
157
+ /**
158
+ * This interface defines the options for a row when it is being viewed as a Gantt chart.
159
+ * @public
160
+ */
161
+ export declare interface GanttOptions {
162
+ /**
163
+ * The colour to be applied to the row's gantt bar.
164
+ */
165
+ color?: string;
166
+ /**
167
+ * The starting column index for the gantt bar.
168
+ */
169
+ startIndex?: number;
170
+ /**
171
+ * The ending column index for the gantt bar. If the endIndex and colspan are not provided,
172
+ * the bar will stretch to the end of the table.
173
+ */
174
+ endIndex?: number;
175
+ /**
176
+ * The length of the gantt bar. Useful when only the start index is provided. If the
177
+ * colspan and endIndex are not provided, the bar will stretch to the end of the table.
178
+ */
179
+ colspan?: number;
180
+ }
181
+
148
182
  /**
149
183
  * Install all AForm components
150
184
  * @param app - Vue app instance
@@ -164,19 +198,67 @@ export declare type SchemaTypes = FormSchema | TableSchema | FieldsetSchema;
164
198
  * Table column definition.
165
199
  * @public
166
200
  */
167
- export declare type TableColumn = {
201
+ export declare interface TableColumn {
202
+ /**
203
+ * The key of the column. This is used to identify the column in the table.
204
+ */
168
205
  name: string;
206
+ /**
207
+ * The alignment of the column. Possible values:
208
+ * - `left` - left aligned
209
+ * - `center` - center aligned
210
+ * - `right` - right aligned
211
+ * - `start` - aligned to the start of the column
212
+ * - `end` - aligned to the end of the column
213
+ *
214
+ * @defaultValue 'center'
215
+ */
169
216
  align?: CanvasTextAlign;
217
+ /**
218
+ * Control whether cells for the column is editable.
219
+ *
220
+ * @defaultValue false
221
+ */
170
222
  edit?: boolean;
223
+ /**
224
+ * The label of the column. This is displayed in the table header.
225
+ *
226
+ * @defaultValue If no label is provided, a character will be assigned alphabetically,
227
+ * starting from 'A' for the first column, 'B' for the second column, and so on.
228
+ */
171
229
  label?: string;
230
+ /**
231
+ * The data-type of the column. Possible values:
232
+ * - `Data` - the column contains text data
233
+ * - `Select` - the column contains a select input
234
+ * - `Date` - the column contains a date input
235
+ * - `component` - the column contains a custom component
236
+ *
237
+ * @beta
238
+ */
172
239
  type?: string;
240
+ /**
241
+ * The width of the column. This can be a number (in pixels) or a string (in CSS units).
242
+ *
243
+ * @defaultValue '40ch'
244
+ */
173
245
  width?: string;
246
+ /**
247
+ * Control whether the column should be pinned to the table.
248
+ *
249
+ * @defaultValue false
250
+ */
174
251
  pinned?: boolean;
175
- colspan?: number;
176
- ganttComponent?: string;
177
- isGantt?: boolean;
178
- originalIndex?: number;
252
+ /**
253
+ * The component to use to render the cell for the column. If not provided, the table will
254
+ * render the default `<td>` element.
255
+ */
179
256
  cellComponent?: string;
257
+ /**
258
+ * Additional properties to pass to the table's cell component.
259
+ *
260
+ * Only applicable if the `cellComponent` property is set for the column.
261
+ */
180
262
  cellComponentProps?: Record<string, any>;
181
263
  /**
182
264
  * The component to use for the modal. If a function is provided, it will be called with the cell context.
@@ -193,16 +275,63 @@ export declare type TableColumn = {
193
275
  * - `store` - the table data store
194
276
  */
195
277
  modalComponent?: string | ((context: CellContext) => string);
278
+ /**
279
+ * Additional properties to pass to the modal component.
280
+ *
281
+ * Only applicable if the `modalComponent` property is set for the column.
282
+ */
196
283
  modalComponentExtraProps?: Record<string, any>;
284
+ /**
285
+ * The format function to use to format the value of the cell. This can either be a normal or stringified
286
+ * function that takes the value and the cell context and returns a string.
287
+ */
197
288
  format?: string | ((value: any, context: CellContext) => string);
289
+ /**
290
+ * The masking function to use to apply an input mask to the cell. This will accept an input value and
291
+ * return the masked value.
292
+ */
198
293
  mask?: (value: any) => any;
199
- };
294
+ /**
295
+ * Whether the column is a Gantt column.
296
+ *
297
+ * Only applicable for Gantt tables.
298
+ *
299
+ * @defaultValue false
300
+ */
301
+ isGantt?: boolean;
302
+ /**
303
+ * The component to use to render the Gantt bar for the column.
304
+ *
305
+ * Only applicable for Gantt tables.
306
+ *
307
+ * @defaultValue 'AGanttCell'
308
+ */
309
+ ganttComponent?: string;
310
+ /**
311
+ * The colspan of the Gantt-bar for the column. This is used to determine how many columns
312
+ * the Gantt-bar should span.
313
+ *
314
+ * Only applicable for Gantt tables.
315
+ *
316
+ * @defaultValue The number of columns in the table, excluding any pinned columns.
317
+ */
318
+ colspan?: number;
319
+ /**
320
+ * The starting column index for the Gantt-bar, excluding any pinned columns. This is
321
+ * evaluated automatically while rendering the table.
322
+ *
323
+ * Only applicable for Gantt tables.
324
+ *
325
+ * @defaultValue 0
326
+ */
327
+ originalIndex?: number;
328
+ }
200
329
 
201
330
  /**
202
331
  * Table configuration definition.
203
332
  * @public
204
333
  */
205
- export declare type TableConfig = {
334
+ export declare interface TableConfig {
206
335
  /**
207
336
  * The type of view to display the table in. Possible values:
208
337
  * - `uncounted` - row numbers are not displayed in the table
@@ -211,22 +340,43 @@ export declare type TableConfig = {
211
340
  * - `tree` - carets are displayed in the number column that expand/collapse grouped rows
212
341
  */
213
342
  view?: 'uncounted' | 'list' | 'list-expansion' | 'tree' | 'gantt';
343
+ /**
344
+ * Control whether the table should be allowed to use the full width of its container.
345
+ *
346
+ * @defaultValue false
347
+ */
214
348
  fullWidth?: boolean;
215
- };
349
+ }
216
350
 
217
351
  /**
218
352
  * Table row definition.
219
353
  * @public
220
354
  */
221
- export declare type TableRow = {
355
+ export declare interface TableRow {
356
+ /**
357
+ * Additional arbitrary properties that can be passed to the row object.
358
+ */
222
359
  [key: string]: any;
360
+ /**
361
+ * The indentation level of the row node.
362
+ *
363
+ * Only applicable for tree and gantt views.
364
+ *
365
+ * @defaultValue 0
366
+ */
223
367
  indent?: number;
368
+ /**
369
+ * The HTML parent element for the row node. This is evaluated automatically while rendering
370
+ * the table.
371
+ *
372
+ * Only applicable for tree and gantt views.
373
+ */
224
374
  parent?: number;
225
375
  /**
226
- * When a table is being viewed as a Gantt chart, this colour would be applied to the row's gantt bar, if one exists.
376
+ * The options to use when rendering the row as a Gantt table.
227
377
  */
228
- gantt_color?: string;
229
- };
378
+ gantt?: GanttOptions;
379
+ }
230
380
 
231
381
  /**
232
382
  * Schema structure for defining tables inside AForm