@quillsql/admin 1.3.0 → 1.3.2
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/{lib → dist}/Admin.d.ts +12 -7
- package/dist/Admin.d.ts.map +1 -0
- package/dist/Admin.js +1384 -0
- package/{lib → dist}/AdminProvider.d.ts +41 -27
- package/dist/AdminProvider.d.ts.map +1 -0
- package/{lib → dist}/AdminProvider.js +105 -90
- package/dist/api/ConnectionClient.d.ts +27 -0
- package/dist/api/ConnectionClient.d.ts.map +1 -0
- package/dist/api/ConnectionClient.js +247 -0
- package/dist/components/Banner/index.d.ts +3 -0
- package/dist/components/Banner/index.d.ts.map +1 -0
- package/dist/components/Banner/index.js +27 -0
- package/dist/components/CardSection.d.ts +3 -0
- package/dist/components/CardSection.d.ts.map +1 -0
- package/dist/components/CardSection.js +9 -0
- package/dist/components/CardTitle.d.ts +3 -0
- package/dist/components/CardTitle.d.ts.map +1 -0
- package/dist/components/CardTitle.js +11 -0
- package/dist/components/DashboardSelectPopover.d.ts +11 -0
- package/dist/components/DashboardSelectPopover.d.ts.map +1 -0
- package/dist/components/DashboardSelectPopover.js +175 -0
- package/dist/components/DatabaseSelector.d.ts +11 -0
- package/dist/components/DatabaseSelector.d.ts.map +1 -0
- package/dist/components/DatabaseSelector.js +22 -0
- package/dist/components/DeleteButton.d.ts +3 -0
- package/dist/components/DeleteButton.d.ts.map +1 -0
- package/dist/components/DeleteButton.js +10 -0
- package/{lib → dist}/components/DropDownMenu.d.ts +1 -0
- package/dist/components/DropDownMenu.d.ts.map +1 -0
- package/dist/components/DropDownMenu.js +39 -0
- package/dist/components/DropDownMenuWithLabel.d.ts +12 -0
- package/dist/components/DropDownMenuWithLabel.d.ts.map +1 -0
- package/dist/components/DropDownMenuWithLabel.js +47 -0
- package/{lib → dist}/components/EnvSelectPopover.d.ts +1 -0
- package/dist/components/EnvSelectPopover.d.ts.map +1 -0
- package/dist/components/EnvSelectPopover.js +205 -0
- package/dist/components/InputLabel.d.ts +3 -0
- package/dist/components/InputLabel.d.ts.map +1 -0
- package/dist/components/InputLabel.js +10 -0
- package/{lib → dist}/components/OrgSelect.d.ts +1 -0
- package/dist/components/OrgSelect.d.ts.map +1 -0
- package/dist/components/OrgSelect.js +193 -0
- package/dist/components/SqlViewTile.d.ts +8 -0
- package/dist/components/SqlViewTile.d.ts.map +1 -0
- package/dist/components/SqlViewTile.js +40 -0
- package/dist/components/StepDisplay.d.ts +10 -0
- package/dist/components/StepDisplay.d.ts.map +1 -0
- package/dist/components/StepDisplay.js +15 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/forms/client_onboard/ConnectDatabase.d.ts +11 -0
- package/dist/forms/client_onboard/ConnectDatabase.d.ts.map +1 -0
- package/dist/forms/client_onboard/ConnectDatabase.js +137 -0
- package/dist/forms/client_onboard/ConnectSchema.d.ts +13 -0
- package/dist/forms/client_onboard/ConnectSchema.d.ts.map +1 -0
- package/dist/forms/client_onboard/ConnectSchema.js +171 -0
- package/dist/forms/client_onboard/CreateSqlViews.d.ts +15 -0
- package/dist/forms/client_onboard/CreateSqlViews.d.ts.map +1 -0
- package/dist/forms/client_onboard/CreateSqlViews.js +202 -0
- package/dist/hooks/useItemBeingEdited.d.ts +4 -0
- package/dist/hooks/useItemBeingEdited.d.ts.map +1 -0
- package/dist/hooks/useItemBeingEdited.js +25 -0
- package/{lib → dist}/icons/ArrowDownHeadIcon.d.ts +1 -0
- package/dist/icons/ArrowDownHeadIcon.d.ts.map +1 -0
- package/dist/icons/ArrowDownHeadIcon.js +3 -0
- package/dist/icons/XMarkIcon.d.ts +3 -0
- package/dist/icons/XMarkIcon.d.ts.map +1 -0
- package/dist/icons/XMarkIcon.js +11 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/{lib/index.d.ts → dist/index.js} +1 -0
- package/{lib → dist}/modals/EditDashboardsModal.d.ts +1 -0
- package/dist/modals/EditDashboardsModal.d.ts.map +1 -0
- package/dist/modals/EditDashboardsModal.js +91 -0
- package/dist/modals/NewDashboardModal.d.ts +19 -0
- package/dist/modals/NewDashboardModal.d.ts.map +1 -0
- package/dist/modals/NewDashboardModal.js +276 -0
- package/{lib → dist}/modals/PromoteDashModal.d.ts +2 -1
- package/dist/modals/PromoteDashModal.d.ts.map +1 -0
- package/dist/modals/PromoteDashModal.js +123 -0
- package/{lib → dist}/modals/PromoteViewModal.d.ts +1 -0
- package/dist/modals/PromoteViewModal.d.ts.map +1 -0
- package/{lib → dist}/modals/PromoteViewModal.js +13 -16
- package/{lib → dist}/modals/ReorderDashboardModal.d.ts +4 -1
- package/dist/modals/ReorderDashboardModal.d.ts.map +1 -0
- package/{lib → dist}/modals/ReorderDashboardModal.js +53 -55
- package/dist/modals/index.d.ts +5 -0
- package/dist/modals/index.d.ts.map +1 -0
- package/{lib → dist}/primitives/ButtonPrimitive.d.ts +3 -0
- package/dist/primitives/ButtonPrimitive.d.ts.map +1 -0
- package/dist/primitives/ButtonPrimitive.js +47 -0
- package/{lib → dist}/primitives/HeaderPrimitive.d.ts +1 -0
- package/dist/primitives/HeaderPrimitive.d.ts.map +1 -0
- package/dist/primitives/HeaderPrimitive.js +9 -0
- package/{lib → dist}/primitives/ModalPrimitive.d.ts +3 -1
- package/dist/primitives/ModalPrimitive.d.ts.map +1 -0
- package/{lib → dist}/primitives/ModalPrimitive.js +9 -11
- package/{lib → dist}/primitives/SecondaryButtonPrimitive.d.ts +1 -0
- package/dist/primitives/SecondaryButtonPrimitive.d.ts.map +1 -0
- package/{lib → dist}/primitives/SecondaryButtonPrimitive.js +5 -8
- package/{lib → dist}/primitives/SelectPrimitive.d.ts +1 -0
- package/dist/primitives/SelectPrimitive.d.ts.map +1 -0
- package/{lib → dist}/primitives/SelectPrimitive.js +8 -11
- package/{lib → dist}/primitives/TextInputPrimitive.d.ts +2 -0
- package/dist/primitives/TextInputPrimitive.d.ts.map +1 -0
- package/dist/primitives/TextInputPrimitive.js +24 -0
- package/dist/primitives/TogglePrimitive.d.ts +6 -0
- package/dist/primitives/TogglePrimitive.d.ts.map +1 -0
- package/dist/primitives/TogglePrimitive.js +45 -0
- package/dist/primitives/index.d.ts +7 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/public_components/CreateEnvironment.d.ts +6 -0
- package/dist/public_components/CreateEnvironment.d.ts.map +1 -0
- package/dist/public_components/CreateEnvironment.js +129 -0
- package/{lib → dist}/public_components/DashboardBuilder.d.ts +2 -1
- package/dist/public_components/DashboardBuilder.d.ts.map +1 -0
- package/dist/public_components/DashboardBuilder.js +192 -0
- package/{lib → dist}/public_components/DashboardManager.d.ts +2 -1
- package/dist/public_components/DashboardManager.d.ts.map +1 -0
- package/dist/public_components/DashboardManager.js +308 -0
- package/{lib → dist}/public_components/SQLViewManager.d.ts +2 -1
- package/dist/public_components/SQLViewManager.d.ts.map +1 -0
- package/dist/public_components/SQLViewManager.js +394 -0
- package/dist/utils/constants.d.ts +26 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +13 -0
- package/dist/utils/databases.d.ts +34 -0
- package/dist/utils/databases.d.ts.map +1 -0
- package/dist/utils/databases.js +51 -0
- package/dist/utils/delay.d.ts +2 -0
- package/dist/utils/delay.d.ts.map +1 -0
- package/dist/utils/delay.js +3 -0
- package/dist/utils/schema.d.ts +22 -0
- package/dist/utils/schema.d.ts.map +1 -0
- package/dist/utils/schema.js +1 -0
- package/dist/utils/table.d.ts +9 -0
- package/dist/utils/table.d.ts.map +1 -0
- package/dist/utils/table.js +1 -0
- package/package.json +19 -26
- package/LICENSE +0 -21
- package/README.md +0 -10
- package/lib/Admin.js +0 -1573
- package/lib/Admin.js.map +0 -1
- package/lib/AdminProvider.js.map +0 -1
- package/lib/components/DashboardSelectPopover.d.ts +0 -9
- package/lib/components/DashboardSelectPopover.js +0 -187
- package/lib/components/DashboardSelectPopover.js.map +0 -1
- package/lib/components/DropDownMenu.js +0 -43
- package/lib/components/DropDownMenu.js.map +0 -1
- package/lib/components/EnvSelectPopover.js +0 -190
- package/lib/components/EnvSelectPopover.js.map +0 -1
- package/lib/components/OrgSelect.js +0 -188
- package/lib/components/OrgSelect.js.map +0 -1
- package/lib/components/index.js +0 -17
- package/lib/components/index.js.map +0 -1
- package/lib/icons/ArrowDownHeadIcon.js +0 -6
- package/lib/icons/ArrowDownHeadIcon.js.map +0 -1
- package/lib/icons/index.js +0 -9
- package/lib/icons/index.js.map +0 -1
- package/lib/index.js +0 -17
- package/lib/index.js.map +0 -1
- package/lib/modals/EditDashboardsModal.js +0 -94
- package/lib/modals/EditDashboardsModal.js.map +0 -1
- package/lib/modals/PromoteDashModal.js +0 -126
- package/lib/modals/PromoteDashModal.js.map +0 -1
- package/lib/modals/PromoteViewModal.js.map +0 -1
- package/lib/modals/ReorderDashboardModal.js.map +0 -1
- package/lib/modals/index.js +0 -15
- package/lib/modals/index.js.map +0 -1
- package/lib/primitives/ButtonPrimitive.js +0 -25
- package/lib/primitives/ButtonPrimitive.js.map +0 -1
- package/lib/primitives/HeaderPrimitive.js +0 -12
- package/lib/primitives/HeaderPrimitive.js.map +0 -1
- package/lib/primitives/ModalPrimitive.js.map +0 -1
- package/lib/primitives/SecondaryButtonPrimitive.js.map +0 -1
- package/lib/primitives/SelectPrimitive.js.map +0 -1
- package/lib/primitives/TextInputPrimitive.js +0 -26
- package/lib/primitives/TextInputPrimitive.js.map +0 -1
- package/lib/primitives/index.js +0 -19
- package/lib/primitives/index.js.map +0 -1
- package/lib/public_components/DashboardBuilder.js +0 -166
- package/lib/public_components/DashboardBuilder.js.map +0 -1
- package/lib/public_components/DashboardManager.js +0 -255
- package/lib/public_components/DashboardManager.js.map +0 -1
- package/lib/public_components/SQLViewManager.js +0 -400
- package/lib/public_components/SQLViewManager.js.map +0 -1
- /package/{lib/components/index.d.ts → dist/components/index.js} +0 -0
- /package/{lib/icons/index.d.ts → dist/icons/index.js} +0 -0
- /package/{lib/modals/index.d.ts → dist/modals/index.js} +0 -0
- /package/{lib/primitives/index.d.ts → dist/primitives/index.js} +0 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { QUILL_SERVER } from '../utils/constants';
|
|
2
|
+
import { formConnectionString, } from '../utils/databases';
|
|
3
|
+
export async function testConnectionString(connectionString) {
|
|
4
|
+
const localURL = `${QUILL_SERVER}/sdk/test-connection`;
|
|
5
|
+
const response = await fetch(localURL, {
|
|
6
|
+
method: 'POST',
|
|
7
|
+
headers: {
|
|
8
|
+
'Content-Type': 'application/json',
|
|
9
|
+
},
|
|
10
|
+
body: JSON.stringify({
|
|
11
|
+
connectionString,
|
|
12
|
+
task: 'test-connection',
|
|
13
|
+
}),
|
|
14
|
+
});
|
|
15
|
+
const results = await response.json();
|
|
16
|
+
return results.success;
|
|
17
|
+
}
|
|
18
|
+
export async function getSchemaTableInfo(connectionString, schema) {
|
|
19
|
+
const localURL = `${QUILL_SERVER}/sdk/schema-info`;
|
|
20
|
+
const response = await fetch(localURL, {
|
|
21
|
+
method: 'POST',
|
|
22
|
+
headers: {
|
|
23
|
+
'Content-Type': 'application/json',
|
|
24
|
+
},
|
|
25
|
+
body: JSON.stringify({
|
|
26
|
+
connectionString,
|
|
27
|
+
schema,
|
|
28
|
+
task: 'schema-info',
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
const results = await response.json();
|
|
32
|
+
return results;
|
|
33
|
+
}
|
|
34
|
+
export async function getTablesBySchema(connectionString, schema) {
|
|
35
|
+
const localURL = `${QUILL_SERVER}/sdk/tables-by-schema`;
|
|
36
|
+
const response = await fetch(localURL, {
|
|
37
|
+
method: 'POST',
|
|
38
|
+
headers: {
|
|
39
|
+
'Content-Type': 'application/json',
|
|
40
|
+
},
|
|
41
|
+
body: JSON.stringify({
|
|
42
|
+
connectionString,
|
|
43
|
+
schema,
|
|
44
|
+
task: 'tables-by-schema',
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
const results = await response.json();
|
|
48
|
+
return results.tables;
|
|
49
|
+
}
|
|
50
|
+
export async function getTableInfo(connectionString, schema, table) {
|
|
51
|
+
const localURL = `${QUILL_SERVER}/sdk/table-info`;
|
|
52
|
+
const response = await fetch(localURL, {
|
|
53
|
+
method: 'POST',
|
|
54
|
+
headers: {
|
|
55
|
+
'Content-Type': 'application/json',
|
|
56
|
+
},
|
|
57
|
+
body: JSON.stringify({
|
|
58
|
+
connectionString,
|
|
59
|
+
schema,
|
|
60
|
+
table,
|
|
61
|
+
task: 'table-info',
|
|
62
|
+
}),
|
|
63
|
+
});
|
|
64
|
+
const results = await response.json();
|
|
65
|
+
return results;
|
|
66
|
+
}
|
|
67
|
+
export async function getOrgInfo(connectionString, schema, table, orgIdColumn, orgColumn) {
|
|
68
|
+
const localURL = `${QUILL_SERVER}/sdk/org-info`;
|
|
69
|
+
const response = await fetch(localURL, {
|
|
70
|
+
method: 'POST',
|
|
71
|
+
headers: {
|
|
72
|
+
'Content-Type': 'application/json',
|
|
73
|
+
},
|
|
74
|
+
body: JSON.stringify({
|
|
75
|
+
connectionString,
|
|
76
|
+
schema,
|
|
77
|
+
table,
|
|
78
|
+
orgColumn,
|
|
79
|
+
orgIdColumn,
|
|
80
|
+
task: 'org-info',
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
83
|
+
const results = await response.json();
|
|
84
|
+
return results.orgStrings;
|
|
85
|
+
}
|
|
86
|
+
export async function getFKInfo(connectionString, schema, table, primaryKey) {
|
|
87
|
+
const localURL = `${QUILL_SERVER}/sdk/fk-info`;
|
|
88
|
+
const response = await fetch(localURL, {
|
|
89
|
+
method: 'POST',
|
|
90
|
+
headers: {
|
|
91
|
+
'Content-Type': 'application/json',
|
|
92
|
+
},
|
|
93
|
+
body: JSON.stringify({
|
|
94
|
+
connectionString,
|
|
95
|
+
schema,
|
|
96
|
+
table,
|
|
97
|
+
primaryKey,
|
|
98
|
+
task: 'fk-info',
|
|
99
|
+
}),
|
|
100
|
+
});
|
|
101
|
+
const results = await response.json();
|
|
102
|
+
return results.foreignKeysString;
|
|
103
|
+
}
|
|
104
|
+
export async function getTableSchema(connectionString, tables) {
|
|
105
|
+
const localURL = `${QUILL_SERVER}/sdk/table-schemas`;
|
|
106
|
+
const response = await fetch(localURL, {
|
|
107
|
+
method: 'POST',
|
|
108
|
+
headers: {
|
|
109
|
+
'Content-Type': 'application/json',
|
|
110
|
+
},
|
|
111
|
+
body: JSON.stringify({
|
|
112
|
+
connectionString,
|
|
113
|
+
tables,
|
|
114
|
+
task: 'table-schemas',
|
|
115
|
+
}),
|
|
116
|
+
});
|
|
117
|
+
const results = await response.json();
|
|
118
|
+
return results;
|
|
119
|
+
}
|
|
120
|
+
export async function getSQLViews(tableSchemas, customerNameField) {
|
|
121
|
+
const localURL = `${QUILL_SERVER}/sqlviewai`;
|
|
122
|
+
const response = await fetch(localURL, {
|
|
123
|
+
method: 'POST',
|
|
124
|
+
headers: {
|
|
125
|
+
'Content-Type': 'application/json',
|
|
126
|
+
},
|
|
127
|
+
body: JSON.stringify({
|
|
128
|
+
tableSchemas,
|
|
129
|
+
customerNameField,
|
|
130
|
+
task: 'sqlviewai',
|
|
131
|
+
}),
|
|
132
|
+
});
|
|
133
|
+
const results = await response.json();
|
|
134
|
+
if (results.notSureWhatThisIs.length === 0) {
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
if (results.notSureWhatThisIs.sqlQuery) {
|
|
138
|
+
return [{ sqlQuery: results.notSureWhatThisIs.sqlQuery }];
|
|
139
|
+
}
|
|
140
|
+
return results.notSureWhatThisIs.sqlQueries;
|
|
141
|
+
}
|
|
142
|
+
export async function getSqlViewData(connectionString, query) {
|
|
143
|
+
const localURL = `${QUILL_SERVER}/sdk/query-view`;
|
|
144
|
+
const response = await fetch(localURL, {
|
|
145
|
+
method: 'POST',
|
|
146
|
+
headers: {
|
|
147
|
+
'Content-Type': 'application/json',
|
|
148
|
+
},
|
|
149
|
+
body: JSON.stringify({
|
|
150
|
+
connectionString,
|
|
151
|
+
query,
|
|
152
|
+
task: 'query-view',
|
|
153
|
+
}),
|
|
154
|
+
});
|
|
155
|
+
const results = await response.json();
|
|
156
|
+
return results;
|
|
157
|
+
}
|
|
158
|
+
export async function getQueryFromAI(aiPrompt, columnsByTable) {
|
|
159
|
+
const localURL = `${QUILL_SERVER}/sdk/sql-generator`;
|
|
160
|
+
const response = await fetch(localURL, {
|
|
161
|
+
method: 'POST',
|
|
162
|
+
headers: {
|
|
163
|
+
'Content-Type': 'application/json',
|
|
164
|
+
},
|
|
165
|
+
body: JSON.stringify({
|
|
166
|
+
initialQuestion: aiPrompt,
|
|
167
|
+
tableSchemas: columnsByTable,
|
|
168
|
+
task: 'sql-generator',
|
|
169
|
+
}),
|
|
170
|
+
});
|
|
171
|
+
const results = await response.json();
|
|
172
|
+
return results.message;
|
|
173
|
+
}
|
|
174
|
+
export async function addEnvironment(connectionType, allSchemaInfo, columnsByTable, viewInfo, client, domainName, tableData, currentTableNames, override = false) {
|
|
175
|
+
let queryName = viewInfo.name;
|
|
176
|
+
let localURL = `${QUILL_SERVER}/astify`;
|
|
177
|
+
const astResponse = await fetch(localURL, {
|
|
178
|
+
method: 'POST',
|
|
179
|
+
headers: {
|
|
180
|
+
'Content-Type': 'application/json',
|
|
181
|
+
},
|
|
182
|
+
body: JSON.stringify({ query: viewInfo.query }),
|
|
183
|
+
});
|
|
184
|
+
const queryAstRaw = await astResponse.json();
|
|
185
|
+
const queryAst = queryAstRaw.ast[0] ? queryAstRaw.ast[0] : queryAstRaw.ast;
|
|
186
|
+
queryName = queryAst.from.map((ast) => ast.table).join('_');
|
|
187
|
+
let validQuery = false;
|
|
188
|
+
// check the columns from queryAst.ast[0] to see if the foreign key is in the query
|
|
189
|
+
queryAst.columns.forEach((column) => {
|
|
190
|
+
if (column.expr.column === allSchemaInfo.selectedFields.foreignKey) {
|
|
191
|
+
validQuery = true;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
// If query ast is only a * check the tables for the foreign key
|
|
195
|
+
if (!override && !validQuery && queryAst.columns[0].expr.column === '*') {
|
|
196
|
+
queryAst.from.forEach((table) => {
|
|
197
|
+
const columnInfo = columnsByTable.find((tableInfo) => tableInfo.tableName === table.table);
|
|
198
|
+
columnInfo?.columns.forEach((column) => {
|
|
199
|
+
if (column.columnName === allSchemaInfo.selectedFields.foreignKey) {
|
|
200
|
+
validQuery = true;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
if (!override && !validQuery) {
|
|
206
|
+
return {
|
|
207
|
+
success: false,
|
|
208
|
+
throwModal: true,
|
|
209
|
+
message: `No foreign key (${allSchemaInfo.selectedFields.foreignKey}) detected in the view. If this is a utility table override this error but if it isn’t you should rework your query.`,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
// if queryAst.ast[0] has a columns of * with a table of customers, the we can assume the customer id is in the query
|
|
213
|
+
if (currentTableNames.includes(queryName)) {
|
|
214
|
+
return { success: false, message: 'Query name already exists' };
|
|
215
|
+
}
|
|
216
|
+
const columns = columnsByTable.find((table) => table.tableName === allSchemaInfo.selectedFields.table).columns;
|
|
217
|
+
const customerFieldType = columns.find((column) => column.columnName === allSchemaInfo.selectedFields.organizationIdField).fieldType;
|
|
218
|
+
const fuzzyType = customerFieldType === 'string' || customerFieldType === 'uuid'
|
|
219
|
+
? 'text'
|
|
220
|
+
: 'number';
|
|
221
|
+
localURL = `${QUILL_SERVER}/sdk/create-environment`;
|
|
222
|
+
const payload = {
|
|
223
|
+
databaseConnectionString: formConnectionString(connectionType),
|
|
224
|
+
databaseType: connectionType.type,
|
|
225
|
+
customerFieldName: allSchemaInfo.selectedFields.foreignKey,
|
|
226
|
+
customerTableName: allSchemaInfo.selectedFields.table,
|
|
227
|
+
customerTableFieldName: allSchemaInfo.selectedFields.organizationIdField,
|
|
228
|
+
adminCustomerId: allSchemaInfo.selectedFields.defaultOrg?.id,
|
|
229
|
+
customerTableTitleFieldName: allSchemaInfo.selectedFields.customerNameField,
|
|
230
|
+
columns: tableData?.columns,
|
|
231
|
+
task: 'create-environment',
|
|
232
|
+
viewQuery: viewInfo.query,
|
|
233
|
+
customerFieldType: fuzzyType,
|
|
234
|
+
name: queryName,
|
|
235
|
+
client,
|
|
236
|
+
domainName,
|
|
237
|
+
};
|
|
238
|
+
const response = await fetch(localURL, {
|
|
239
|
+
method: 'POST',
|
|
240
|
+
headers: {
|
|
241
|
+
'Content-Type': 'application/json',
|
|
242
|
+
},
|
|
243
|
+
body: JSON.stringify(payload),
|
|
244
|
+
});
|
|
245
|
+
const results = await response.json();
|
|
246
|
+
return { ...results, success: true };
|
|
247
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Banner/index.tsx"],"names":[],"mappings":";AAGA,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAgElE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useAdmin } from '../../AdminProvider';
|
|
3
|
+
import XMarkIcon from '../../icons/XMarkIcon';
|
|
4
|
+
export default function Banner({ onExit }) {
|
|
5
|
+
const { state } = useAdmin();
|
|
6
|
+
if (!state.activeEditItem)
|
|
7
|
+
return null;
|
|
8
|
+
return (_jsxs("div", { id: "quill-edit-banner", style: {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
paddingTop: '0.625rem',
|
|
11
|
+
paddingBottom: '0.625rem',
|
|
12
|
+
paddingLeft: '24px',
|
|
13
|
+
paddingRight: '24px',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
backgroundColor: '#111827',
|
|
16
|
+
}, children: [_jsxs("p", { style: {
|
|
17
|
+
fontSize: '14px',
|
|
18
|
+
color: '#ffffff',
|
|
19
|
+
}, children: [_jsx("strong", { style: { fontWeight: 600 }, children: "Edit Mode" }), _jsx("svg", { viewBox: "0 0 2 2", style: {
|
|
20
|
+
display: 'inline',
|
|
21
|
+
marginLeft: '8px',
|
|
22
|
+
marginRight: '8px',
|
|
23
|
+
width: '2px',
|
|
24
|
+
height: '2px',
|
|
25
|
+
fill: 'currentColor',
|
|
26
|
+
}, "aria-hidden": "true", children: _jsx("circle", { cx: 1, cy: 1, r: 1 }) }), `You are currently editing `, _jsx("strong", { style: { fontWeight: 600 }, children: state.activeEditItem.name }), ` on the `, _jsx("strong", { style: { fontWeight: 600 }, children: state.activeEditItem.dashboardName }), ` dashboard.`] }), _jsx("div", { style: { display: 'flex', flex: '1 1 0%', justifyContent: 'flex-end' }, children: _jsx("button", { type: "button", onClick: onExit, style: { padding: '6px', margin: '-6px' }, children: _jsx(XMarkIcon, { style: { width: '16px', height: '16px' }, fill: "#fff", "aria-hidden": "true" }) }) })] }));
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardSection.d.ts","sourceRoot":"","sources":["../../src/components/CardSection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAazE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CardTitle.d.ts","sourceRoot":"","sources":["../../src/components/CardTitle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,KAAK,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CAevE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export default function CardTitle(props) {
|
|
3
|
+
return (_jsx("div", { style: {
|
|
4
|
+
fontFamily: 'Inter; Helvetica',
|
|
5
|
+
color: '#6C727F',
|
|
6
|
+
fontSize: 14,
|
|
7
|
+
fontWeight: '600',
|
|
8
|
+
marginBottom: 3,
|
|
9
|
+
marginTop: 8,
|
|
10
|
+
}, children: props.children }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface DashboardSelectPopoverProps {
|
|
2
|
+
dashboards: any[];
|
|
3
|
+
setDashboard: (dashboard: any) => void;
|
|
4
|
+
dashboard: any;
|
|
5
|
+
theme: any;
|
|
6
|
+
setSelectedEditDashboard: (dashboard: string) => void;
|
|
7
|
+
onClickNewDashboard: () => void;
|
|
8
|
+
}
|
|
9
|
+
export default function DashboardSelectDropdown({ dashboards, setDashboard, dashboard, theme, setSelectedEditDashboard, onClickNewDashboard, }: DashboardSelectPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=DashboardSelectPopover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardSelectPopover.d.ts","sourceRoot":"","sources":["../../src/components/DashboardSelectPopover.tsx"],"names":[],"mappings":"AAIA,UAAU,2BAA2B;IACnC,UAAU,EAAE,GAAG,EAAE,CAAC;IAClB,YAAY,EAAE,CAAC,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC;IACvC,SAAS,EAAE,GAAG,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;IACX,wBAAwB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,mBAAmB,EAAE,MAAM,IAAI,CAAC;CACjC;AAED,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,EAC9C,UAAU,EACV,YAAY,EACZ,SAAS,EACT,KAAK,EACL,wBAAwB,EACxB,mBAAmB,GACpB,EAAE,2BAA2B,2CAyN7B"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { ArrowDownHeadIcon } from '../icons';
|
|
4
|
+
export default function DashboardSelectDropdown({ dashboards, setDashboard, dashboard, theme, setSelectedEditDashboard, onClickNewDashboard, }) {
|
|
5
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
6
|
+
const [hoveredItemId, setHoveredItemId] = useState(null);
|
|
7
|
+
const [isPromoteHovered, setIsPromoteHovered] = useState(false);
|
|
8
|
+
const handleItemClick = (selectedDashboard) => {
|
|
9
|
+
setDashboard(selectedDashboard);
|
|
10
|
+
setIsOpen(false);
|
|
11
|
+
};
|
|
12
|
+
const popoverRef = useRef(null);
|
|
13
|
+
const handleOutsideClick = (event) => {
|
|
14
|
+
if (popoverRef.current && !popoverRef.current.contains(event.target)) {
|
|
15
|
+
setIsOpen(false);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (isOpen) {
|
|
20
|
+
document.addEventListener('mousedown', handleOutsideClick);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
document.removeEventListener('mousedown', handleOutsideClick);
|
|
24
|
+
}
|
|
25
|
+
return () => {
|
|
26
|
+
document.removeEventListener('mousedown', handleOutsideClick); // Cleanup
|
|
27
|
+
};
|
|
28
|
+
}, [isOpen]);
|
|
29
|
+
const dropdownStyles = {
|
|
30
|
+
position: 'relative',
|
|
31
|
+
display: 'inline-block',
|
|
32
|
+
fontFamily: theme?.fontFamily,
|
|
33
|
+
fontSize: 14,
|
|
34
|
+
};
|
|
35
|
+
const triggerButtonStyles = {
|
|
36
|
+
width: '100%',
|
|
37
|
+
minWidth: 230,
|
|
38
|
+
maxWidth: 230,
|
|
39
|
+
outline: 'none',
|
|
40
|
+
textAlign: 'left',
|
|
41
|
+
whiteSpace: 'nowrap',
|
|
42
|
+
overflow: 'hidden',
|
|
43
|
+
textOverflow: 'ellipsis',
|
|
44
|
+
borderRadius: 6,
|
|
45
|
+
WebkitAppearance: 'none',
|
|
46
|
+
paddingLeft: 12,
|
|
47
|
+
paddingRight: 12,
|
|
48
|
+
height: 38,
|
|
49
|
+
borderTop: '1px solid #e7e7e7',
|
|
50
|
+
borderLeft: '1px solid #e7e7e7',
|
|
51
|
+
borderRight: '1px solid #e7e7e7',
|
|
52
|
+
borderBottom: '1px solid #e7e7e7',
|
|
53
|
+
background: theme?.backgroundColor,
|
|
54
|
+
color: theme?.primaryTextColor,
|
|
55
|
+
fontFamily: theme?.fontFamily,
|
|
56
|
+
fontWeight: 500,
|
|
57
|
+
borderStyle: 'solid',
|
|
58
|
+
};
|
|
59
|
+
const dropdownContentStyles = {
|
|
60
|
+
display: isOpen ? 'flex' : 'none',
|
|
61
|
+
flexDirection: 'column',
|
|
62
|
+
background: '#FFFFFF',
|
|
63
|
+
position: 'absolute',
|
|
64
|
+
boxShadow: '0px 1px 12px 0px rgba(56, 65, 81, 0.1)',
|
|
65
|
+
border: '1px solid #e7e7e7',
|
|
66
|
+
boxSizing: 'border-box',
|
|
67
|
+
zIndex: 1,
|
|
68
|
+
borderRadius: 6,
|
|
69
|
+
padding: 8,
|
|
70
|
+
maxHeight: 420,
|
|
71
|
+
width: 230,
|
|
72
|
+
marginTop: 8,
|
|
73
|
+
gap: 5,
|
|
74
|
+
};
|
|
75
|
+
const itemStyles = {
|
|
76
|
+
height: 42,
|
|
77
|
+
paddingLeft: 10,
|
|
78
|
+
paddingRight: 4,
|
|
79
|
+
cursor: 'pointer',
|
|
80
|
+
fontSize: '14px',
|
|
81
|
+
color: theme?.primaryTextColor,
|
|
82
|
+
display: 'flex',
|
|
83
|
+
flexDirection: 'row',
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
justifyContent: 'space-between',
|
|
86
|
+
fontWeight: '500',
|
|
87
|
+
};
|
|
88
|
+
const itemHoverStyles = {
|
|
89
|
+
backgroundColor: 'rgba(56, 65, 81, 0.04)',
|
|
90
|
+
borderRadius: 6,
|
|
91
|
+
};
|
|
92
|
+
const selectedItemStyles = {
|
|
93
|
+
backgroundColor: 'rgba(56, 65, 81, 0.04)',
|
|
94
|
+
borderRadius: 6,
|
|
95
|
+
fontWeight: '500',
|
|
96
|
+
};
|
|
97
|
+
const promoteStyles = {
|
|
98
|
+
color: theme?.primaryTextColor,
|
|
99
|
+
cursor: 'pointer',
|
|
100
|
+
fontSize: '13px',
|
|
101
|
+
border: isPromoteHovered ? '1px solid #e7e7e7' : '1px solid transparent',
|
|
102
|
+
backgroundColor: isPromoteHovered ? 'white' : undefined,
|
|
103
|
+
boxShadow: isPromoteHovered
|
|
104
|
+
? '0px 1px 12px 0px rgba(56, 65, 81, 0.1)'
|
|
105
|
+
: undefined,
|
|
106
|
+
display: 'flex',
|
|
107
|
+
flexDirection: 'row',
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
paddingLeft: 7,
|
|
110
|
+
paddingRight: 9,
|
|
111
|
+
paddingTop: 6,
|
|
112
|
+
paddingBottom: 6,
|
|
113
|
+
borderRadius: 4,
|
|
114
|
+
gap: 3,
|
|
115
|
+
};
|
|
116
|
+
const itemTextStyles = {
|
|
117
|
+
// marginRight: "30px",
|
|
118
|
+
};
|
|
119
|
+
return (_jsxs("div", { style: dropdownStyles, ref: popoverRef, children: [_jsx("button", {
|
|
120
|
+
// onMouseEnter={() => setIsOpen(true)}
|
|
121
|
+
onClick: () => setIsOpen(true), style: triggerButtonStyles, children: dashboard ? dashboard : 'Select dashboard' }), _jsxs("div", { style: dropdownContentStyles, children: [dashboards.map((item, index) => (_jsxs("div", { onClick: dashboard && dashboard !== item.value
|
|
122
|
+
? () => handleItemClick(item.value)
|
|
123
|
+
: undefined, style: {
|
|
124
|
+
...itemStyles,
|
|
125
|
+
...(hoveredItemId === item.value ? itemHoverStyles : {}),
|
|
126
|
+
...(dashboard && dashboard === item.value
|
|
127
|
+
? selectedItemStyles
|
|
128
|
+
: {}),
|
|
129
|
+
textOverflow: 'ellipsis',
|
|
130
|
+
whiteSpace: 'nowrap',
|
|
131
|
+
overflow: 'hidden',
|
|
132
|
+
}, onMouseEnter: () => setHoveredItemId(item.value), onMouseLeave: () => setHoveredItemId(null), children: [_jsx("span", { style: {
|
|
133
|
+
...itemTextStyles,
|
|
134
|
+
textOverflow: 'ellipsis',
|
|
135
|
+
whiteSpace: 'nowrap',
|
|
136
|
+
overflow: 'hidden',
|
|
137
|
+
}, children: item.value }), dashboard && dashboard === item.value && (_jsxs("div", { onClick: () => {
|
|
138
|
+
setSelectedEditDashboard(item.value);
|
|
139
|
+
}, style: {
|
|
140
|
+
...promoteStyles,
|
|
141
|
+
// visibility: showPromote ? "visible" : "hidden",
|
|
142
|
+
}, onMouseEnter: () => setIsPromoteHovered(true), onMouseLeave: () => setIsPromoteHovered(false), children: [_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "12px", width: "12px", style: { marginRight: 1 }, children: _jsx("path", { fillRule: "evenodd", d: "M8.34 1.804A1 1 0 0 1 9.32 1h1.36a1 1 0 0 1 .98.804l.295 1.473c.497.144.971.342 1.416.587l1.25-.834a1 1 0 0 1 1.262.125l.962.962a1 1 0 0 1 .125 1.262l-.834 1.25c.245.445.443.919.587 1.416l1.473.294a1 1 0 0 1 .804.98v1.361a1 1 0 0 1-.804.98l-1.473.295a6.95 6.95 0 0 1-.587 1.416l.834 1.25a1 1 0 0 1-.125 1.262l-.962.962a1 1 0 0 1-1.262.125l-1.25-.834a6.953 6.953 0 0 1-1.416.587l-.294 1.473a1 1 0 0 1-.98.804H9.32a1 1 0 0 1-.98-.804l-.295-1.473a6.957 6.957 0 0 1-1.416-.587l-1.25.834a1 1 0 0 1-1.262-.125l-.962-.962a1 1 0 0 1-.125-1.262l.834-1.25a6.957 6.957 0 0 1-.587-1.416l-1.473-.294A1 1 0 0 1 1 10.68V9.32a1 1 0 0 1 .804-.98l1.473-.295c.144-.497.342-.971.587-1.416l-.834-1.25a1 1 0 0 1 .125-1.262l.962-.962A1 1 0 0 1 5.38 3.03l1.25.834a6.957 6.957 0 0 1 1.416-.587l.294-1.473ZM13 10a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z", clipRule: "evenodd" }) }), "Manage"] }))] }, item.value))), _jsx(CreateNewButton, { onClick: onClickNewDashboard, theme: theme })] }), _jsx(ArrowDownHeadIcon, { style: {
|
|
143
|
+
height: '20px',
|
|
144
|
+
width: '20px',
|
|
145
|
+
flex: 'none',
|
|
146
|
+
position: 'absolute',
|
|
147
|
+
right: 8,
|
|
148
|
+
top: 9.5,
|
|
149
|
+
color: '#6C727F',
|
|
150
|
+
}, "aria-hidden": "true" })] }));
|
|
151
|
+
}
|
|
152
|
+
function CreateNewButton({ onClick, theme, }) {
|
|
153
|
+
return (_jsxs("button", { onClick: onClick, style: {
|
|
154
|
+
height: 42,
|
|
155
|
+
paddingLeft: 10,
|
|
156
|
+
paddingRight: 4,
|
|
157
|
+
cursor: 'pointer',
|
|
158
|
+
fontSize: '14px',
|
|
159
|
+
color: theme?.primaryTextColor,
|
|
160
|
+
display: 'flex',
|
|
161
|
+
flexDirection: 'row',
|
|
162
|
+
alignItems: 'center',
|
|
163
|
+
fontWeight: '500',
|
|
164
|
+
borderRadius: 4,
|
|
165
|
+
outline: 'none',
|
|
166
|
+
}, className: "quill-create-dash", children: [_jsx("style", { children: `.quill-create-dash {
|
|
167
|
+
background: white;
|
|
168
|
+
border: 1px solid transparent;
|
|
169
|
+
}
|
|
170
|
+
.quill-create-dash:hover {
|
|
171
|
+
background: white;
|
|
172
|
+
border: 1px solid #e7e7e7;
|
|
173
|
+
box-shadow: 0px 1px 4px 0px rgba(56, 65, 81, 0.1);
|
|
174
|
+
}` }), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", height: "16", width: "16", style: { marginRight: 3 }, children: _jsx("path", { d: "M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z" }) }), "New dashboard"] }));
|
|
175
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
interface DatabaseSelectorProps {
|
|
3
|
+
label: string;
|
|
4
|
+
imageUrl: string;
|
|
5
|
+
value: string;
|
|
6
|
+
onDatabaseSelect: (database: string) => void;
|
|
7
|
+
containerStyle?: CSSProperties;
|
|
8
|
+
}
|
|
9
|
+
export default function DatabaseSelector({ label, imageUrl, value, onDatabaseSelect, containerStyle, }: DatabaseSelectorProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=DatabaseSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatabaseSelector.d.ts","sourceRoot":"","sources":["../../src/components/DatabaseSelector.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAY,MAAM,OAAO,CAAC;AAGvD,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,cAAc,CAAC,EAAE,aAAa,CAAC;CAChC;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,KAAK,EACL,QAAQ,EACR,KAAK,EACL,gBAAgB,EAChB,cAAc,GACf,EAAE,qBAAqB,2CAqCvB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export default function DatabaseSelector({ label, imageUrl, value, onDatabaseSelect, containerStyle, }) {
|
|
3
|
+
return (_jsxs("div", { style: {
|
|
4
|
+
...containerStyle,
|
|
5
|
+
height: 128,
|
|
6
|
+
width: 128,
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexDirection: 'column',
|
|
9
|
+
justifyContent: 'center',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
border: '1px solid #e0e0e0',
|
|
12
|
+
borderRadius: 6,
|
|
13
|
+
padding: 12,
|
|
14
|
+
}, id: "connect-database-form", onClick: () => {
|
|
15
|
+
onDatabaseSelect(value);
|
|
16
|
+
}, children: [_jsx("img", { src: imageUrl, alt: label, style: { height: 72, width: 72, objectFit: 'contain' } }), _jsx("h1", { style: {
|
|
17
|
+
fontSize: 14,
|
|
18
|
+
fontWeight: '500',
|
|
19
|
+
color: '#212121',
|
|
20
|
+
marginTop: 10,
|
|
21
|
+
}, children: label })] }));
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeleteButton.d.ts","sourceRoot":"","sources":["../../src/components/DeleteButton.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CA2B5D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export default function DeleteButton(props) {
|
|
3
|
+
return (_jsx("div", { onClick: props.onClick, style: {
|
|
4
|
+
height: 38,
|
|
5
|
+
width: 42,
|
|
6
|
+
alignItems: 'center',
|
|
7
|
+
justifyContent: 'center',
|
|
8
|
+
display: 'flex',
|
|
9
|
+
}, children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "#4C5462", width: "20", height: "20", children: _jsx("path", { fillRule: "evenodd", d: "M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z", clipRule: "evenodd" }) }) }));
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropDownMenu.d.ts","sourceRoot":"","sources":["../../src/components/DropDownMenu.tsx"],"names":[],"mappings":"AAEA,UAAU,iBAAiB;IACzB,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,WAAW,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,KAAK,EACL,WAAW,EACX,QAAQ,EACR,KAAK,EACL,QAAgB,GACjB,EAAE,iBAAiB,2CA2EnB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export default function DropdownMenu({ items, setSelected, selected, theme, disabled = false, }) {
|
|
3
|
+
return (_jsx("div", { style: { display: 'flex', flexDirection: 'column' }, children: _jsxs("div", { style: {
|
|
4
|
+
position: 'relative',
|
|
5
|
+
fontFamily: theme?.fontFamily,
|
|
6
|
+
fontSize: 14,
|
|
7
|
+
fontWeight: 500,
|
|
8
|
+
}, children: [_jsxs("select", { style: {
|
|
9
|
+
width: '100%',
|
|
10
|
+
minWidth: 230,
|
|
11
|
+
maxWidth: 230,
|
|
12
|
+
outline: 'none',
|
|
13
|
+
textAlign: 'left',
|
|
14
|
+
whiteSpace: 'nowrap',
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
textOverflow: 'ellipsis',
|
|
17
|
+
borderRadius: 6,
|
|
18
|
+
WebkitAppearance: 'none',
|
|
19
|
+
paddingLeft: 12,
|
|
20
|
+
paddingRight: 12,
|
|
21
|
+
height: 38,
|
|
22
|
+
borderWidth: theme?.borderWidth,
|
|
23
|
+
borderColor: theme?.borderColor,
|
|
24
|
+
background: theme?.backgroundColor,
|
|
25
|
+
color: theme?.primaryTextColor,
|
|
26
|
+
boxShadow: '0 1px 2px 0 rgba(0,0,0,.05)',
|
|
27
|
+
fontFamily: theme?.fontFamily,
|
|
28
|
+
}, disabled: disabled, onChange: (e) => {
|
|
29
|
+
setSelected(items.find((item) => item.name === e.target.value));
|
|
30
|
+
}, value: selected ? selected.name : '', children: [_jsx("option", { value: "", children: items && items.length !== 0 ? 'Select' : 'N/A' }), items.slice(0, 50).map((item) => (_jsx("option", { value: item.name, children: item.name }, item.name)))] }), _jsxs("svg", { style: {
|
|
31
|
+
height: '20px',
|
|
32
|
+
width: '20px',
|
|
33
|
+
flex: 'none',
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
right: 8,
|
|
36
|
+
top: 9,
|
|
37
|
+
color: theme?.secondaryTextColor,
|
|
38
|
+
}, "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", width: "24", height: "24", visibility: disabled ? 'hidden' : 'visible', children: [_jsx("path", { fill: "none", d: "M0 0h24v24H0z" }), _jsx("path", { fill: "currentColor", d: "M12 13.172l4.95-4.95 1.414 1.414L12 16 5.636 9.636 7.05 8.222z" })] })] }) }));
|
|
39
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface DropdownMenuWithLabelProps {
|
|
2
|
+
items: any[];
|
|
3
|
+
setSelected: (selected: any) => void;
|
|
4
|
+
selected: any;
|
|
5
|
+
label: string;
|
|
6
|
+
theme?: any;
|
|
7
|
+
secondaryTextColor?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export default function DropdownMenuWithLabel({ items, setSelected, selected, theme, label, disabled, secondaryTextColor, }: DropdownMenuWithLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=DropDownMenuWithLabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropDownMenuWithLabel.d.ts","sourceRoot":"","sources":["../../src/components/DropDownMenuWithLabel.tsx"],"names":[],"mappings":"AAEA,UAAU,0BAA0B;IAClC,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,WAAW,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAC5C,KAAK,EACL,WAAW,EACX,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAgB,EAChB,kBAA8B,GAC/B,EAAE,0BAA0B,2CA0F5B"}
|