Skip to content

Commit

Permalink
Merge pull request sqlpage#427 from pchemguy/docs-cleanup
Browse files Browse the repository at this point in the history
Added "parameter_type" table and associated FK
  • Loading branch information
lovasoa authored Jun 19, 2024
2 parents 1360d54 + 6ae4f35 commit a20ed9d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 29 deletions.
58 changes: 32 additions & 26 deletions examples/official-site/sqlpage/migrations/01_documentation.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ CREATE TABLE component(
introduced_in_version TEXT
);

CREATE TABLE parameter_type(
name TEXT PRIMARY KEY
);
INSERT INTO parameter_type(name) VALUES
('BOOLEAN'), ('COLOR'), ('HTML'), ('ICON'), ('INTEGER'), ('JSON'), ('REAL'), ('TEXT'), ('TIMESTAMP'), ('URL');

CREATE TABLE parameter(
top_level BOOLEAN DEFAULT FALSE,
name TEXT,
component TEXT REFERENCES component(name) ON DELETE CASCADE,
description TEXT,
description_md TEXT,
type TEXT,
type TEXT REFERENCES parameter_type(name) ON DELETE CASCADE,
optional BOOLEAN DEFAULT FALSE,
PRIMARY KEY (component, top_level, name)
);
Expand Down Expand Up @@ -221,29 +227,29 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
('placeholder', 'A placeholder text that will be shown in the field when is is empty.', 'TEXT', FALSE, TRUE),
('value', 'A default value that will already be present in the field when the user loads the page.', 'TEXT', FALSE, TRUE),
('options', 'A json array of objects containing the label and value of all possible options of a select field. Used only when type=select. JSON objects in the array can contain the properties "label", "value" and "selected".', 'JSON', FALSE, TRUE),
('required', 'Set this to true to prevent the form contents from being sent if this field is left empty by the user.', 'BOOL', FALSE, TRUE),
('min', 'The minimum value to accept for an input of type number', 'NUMBER', FALSE, TRUE),
('max', 'The minimum value to accept for an input of type number', 'NUMBER', FALSE, TRUE),
('checked', 'Used only for checkboxes and radio buttons. Indicates whether the checkbox should appear as already checked.', 'BOOL', FALSE, TRUE),
('multiple', 'Used only for select elements. Indicates that multiple elements can be selected simultaneously. When using multiple, you should add square brackets after the variable name: ''my_variable[]'' as name', 'BOOL', FALSE, TRUE),
('searchable', 'For select and multiple-select elements, displays them with a nice dropdown that allows searching for options.', 'BOOL', FALSE, TRUE),
('dropdown', 'An alias for "searchable".', 'BOOL', FALSE, TRUE),
('create_new', 'In a multiselect with a dropdown, this option allows the user to enter new values, that are not in the list of options.', 'BOOL', FALSE, TRUE),
('step', 'The increment of values in an input of type number. Set to 1 to allow only integers.', 'NUMBER', FALSE, TRUE),
('required', 'Set this to true to prevent the form contents from being sent if this field is left empty by the user.', 'BOOLEAN', FALSE, TRUE),
('min', 'The minimum value to accept for an input of type number', 'REAL', FALSE, TRUE),
('max', 'The minimum value to accept for an input of type number', 'REAL', FALSE, TRUE),
('checked', 'Used only for checkboxes and radio buttons. Indicates whether the checkbox should appear as already checked.', 'BOOLEAN', FALSE, TRUE),
('multiple', 'Used only for select elements. Indicates that multiple elements can be selected simultaneously. When using multiple, you should add square brackets after the variable name: ''my_variable[]'' as name', 'BOOLEAN', FALSE, TRUE),
('searchable', 'For select and multiple-select elements, displays them with a nice dropdown that allows searching for options.', 'BOOLEAN', FALSE, TRUE),
('dropdown', 'An alias for "searchable".', 'BOOLEAN', FALSE, TRUE),
('create_new', 'In a multiselect with a dropdown, this option allows the user to enter new values, that are not in the list of options.', 'BOOLEAN', FALSE, TRUE),
('step', 'The increment of values in an input of type number. Set to 1 to allow only integers.', 'REAL', FALSE, TRUE),
('description', 'A helper text to display near the input field.', 'TEXT', FALSE, TRUE),
('pattern', 'A regular expression that the value must match. For instance, [0-9]{3} will only accept 3 digits.', 'TEXT', FALSE, TRUE),
('autofocus', 'Automatically focus the field when the page is loaded', 'BOOL', FALSE, TRUE),
('width', 'Width of the form field, between 1 and 12.', 'NUMBER', FALSE, TRUE),
('autocomplete', 'Whether the browser should suggest previously entered values for this field.', 'BOOL', FALSE, TRUE),
('minlength', 'Minimum length of text allowed in the field.', 'NUMBER', FALSE, TRUE),
('maxlength', 'Maximum length of text allowed in the field.', 'NUMBER', FALSE, TRUE),
('autofocus', 'Automatically focus the field when the page is loaded', 'BOOLEAN', FALSE, TRUE),
('width', 'Width of the form field, between 1 and 12.', 'INTEGER', FALSE, TRUE),
('autocomplete', 'Whether the browser should suggest previously entered values for this field.', 'BOOLEAN', FALSE, TRUE),
('minlength', 'Minimum length of text allowed in the field.', 'INTEGER', FALSE, TRUE),
('maxlength', 'Maximum length of text allowed in the field.', 'INTEGER', FALSE, TRUE),
('formaction', 'When type is "submit", this specifies the URL of the file that will handle the form submission. Useful when you need multiple submit buttons.', 'TEXT', FALSE, TRUE),
('class', 'A CSS class to apply to the form element.', 'TEXT', FALSE, TRUE),
('prefix_icon','Icon to display on the left side of the input field, on the same line.','ICON',FALSE,TRUE),
('prefix','Text to display on the left side of the input field, on the same line.','TEXT',FALSE,TRUE),
('suffix','Short text to display after th input, on the same line. Useful to add units or a currency symbol to an input.','TEXT',FALSE,TRUE),
('readonly','Set to true to prevent the user from modifying the value of the input field.','BOOL',FALSE,TRUE),
('disabled','Makes the field non-editable, non-focusable, and not submitted with the form. Use readonly instead for simple non-editable fields.','BOOL',FALSE,TRUE),
('readonly','Set to true to prevent the user from modifying the value of the input field.','BOOLEAN',FALSE,TRUE),
('disabled','Makes the field non-editable, non-focusable, and not submitted with the form. Use readonly instead for simple non-editable fields.','BOOLEAN',FALSE,TRUE),
('id','A unique identifier for the input, which can then be used to select and manage the field with Javascript code. Usefull for advanced using as setting client side event listeners, interactive control of input field (disabled, visibility, read only, e.g.) and AJAX requests.','TEXT',FALSE,TRUE)
) x;
INSERT INTO example(component, description, properties) VALUES
Expand Down Expand Up @@ -467,14 +473,14 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
('title', 'The name of the chart.', 'TEXT', TRUE, TRUE),
('type', 'The type of chart: "line", "area", "bar", "column", "pie", "scatter", "bubble", or "heatmap".', 'TEXT', TRUE, FALSE),
('time', 'Whether the x-axis represents time. If set to true, the x values will be parsed and formatted as dates for the user.', 'BOOLEAN', TRUE, TRUE),
('ymin', 'The minimal value for the y-axis.', 'NUMBER', TRUE, TRUE),
('ymax', 'The maximum value for the y-axis.', 'NUMBER', TRUE, TRUE),
('ymin', 'The minimal value for the y-axis.', 'REAL', TRUE, TRUE),
('ymax', 'The maximum value for the y-axis.', 'REAL', TRUE, TRUE),
('xtitle', 'Title of the x axis, displayed below it.', 'TEXT', TRUE, TRUE),
('ytitle', 'Title of the y axis, displayed to its left.', 'TEXT', TRUE, TRUE),
('ztitle', 'Title of the z axis, displayed in tooltips.', 'TEXT', TRUE, TRUE),
('xticks', 'Number of ticks on the x axis.', 'NUMBER', TRUE, TRUE),
('ystep', 'Step between ticks on the y axis.', 'NUMBER', TRUE, TRUE),
('marker', 'Marker size', 'NUMBER', TRUE, TRUE),
('xticks', 'Number of ticks on the x axis.', 'INTEGER', TRUE, TRUE),
('ystep', 'Step between ticks on the y axis.', 'REAL', TRUE, TRUE),
('marker', 'Marker size', 'REAL', TRUE, TRUE),
('labels', 'Whether to show the data labels on the chart or not.', 'BOOLEAN', TRUE, TRUE),
('color', 'The name of a color in which to display the chart. If there are multiple series in the chart, this parameter can be repeated multiple times.', 'COLOR', TRUE, TRUE),
('stacked', 'Whether to cumulate values from different series.', 'BOOLEAN', TRUE, TRUE),
Expand All @@ -483,10 +489,10 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
('horizontal', 'Displays a bar chart with horizontal bars instead of vertical ones.', 'BOOLEAN', TRUE, TRUE),
('height', 'Height of the chart, in pixels. By default: 250', 'INTEGER', TRUE, TRUE),
-- item level
('x', 'The value of the point on the horizontal axis', 'NUMBER', FALSE, FALSE),
('y', 'The value of the point on the vertical axis', 'NUMBER', FALSE, FALSE),
('label', 'An alias for parameter "x"', 'NUMBER', FALSE, TRUE),
('value', 'An alias for parameter "y"', 'NUMBER', FALSE, TRUE),
('x', 'The value of the point on the horizontal axis', 'REAL', FALSE, FALSE),
('y', 'The value of the point on the vertical axis', 'REAL', FALSE, FALSE),
('label', 'An alias for parameter "x"', 'REAL', FALSE, TRUE),
('value', 'An alias for parameter "y"', 'REAL', FALSE, TRUE),
('series', 'If multiple series are represented and share the same y-axis, this parameter can be used to distinguish between them.', 'TEXT', FALSE, TRUE)
) x;
INSERT INTO example(component, description, properties) VALUES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ VALUES (
'tracking',
'width',
'Width of the component, between 1 and 12.',
'NUMBER',
'INTEGER',
TRUE,
TRUE
),
Expand Down
2 changes: 1 addition & 1 deletion examples/official-site/sqlpage/migrations/34_carousel.sql
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ VALUES
'carousel',
'width',
'Width of the component, between 1 and 12. Default is 12.',
'NUMBER',
'INTEGER',
TRUE,
TRUE
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ INSERT INTO parameter (component,name,description,type,top_level,optional) VALUE
'title',
'level',
'Set the heading level (default level is 1)',
'NUMBER',
'INTEGER',
TRUE,
TRUE
);
Expand Down

0 comments on commit a20ed9d

Please sign in to comment.