@svgrid/enterprise 2.0.4 → 2.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/README.md +18 -6
- package/dist/cdn/svgrid-enterprise.svelte-external.js +14024 -6835
- package/dist/node/studio.js +7888 -2459
- package/package.json +9 -4
- package/src/SvGridMasterDetail.svelte +24 -3
- package/src/SvGridScheduler.svelte +4410 -0
- package/src/SvPivotDesigner.svelte +1990 -1045
- package/src/SvSchemaChart.svelte +10 -9
- package/src/ai.test.ts +522 -522
- package/src/ai.ts +202 -2
- package/src/index.ts +409 -384
- package/src/install.ts +10 -0
- package/src/pivot-chart.test.ts +86 -0
- package/src/pivot-chart.ts +112 -0
- package/src/scheduler.ts +37 -0
- package/src/scheduling.test.ts +194 -0
- package/src/scheduling.ts +293 -0
- package/src/sources/filters.ts +6 -0
- package/src/studio/HANDLERS-DESIGN.md +142 -0
- package/src/studio/cli.ts +7 -2
- package/src/studio/emit-project.test.ts +1447 -13
- package/src/studio/emit-project.ts +3995 -1273
- package/src/studio/emit-schema.ts +146 -29
- package/src/studio/index.ts +320 -195
- package/src/studio/project.test.ts +370 -0
- package/src/studio/project.ts +1146 -26
- package/src/studio/sample-data.ts +4 -1
- package/src/studio/samples/ats.ts +2 -2
- package/src/studio/samples/clinic.ts +4 -2
- package/src/studio/samples/crm.ts +16 -8
- package/src/studio/samples/events.ts +4 -2
- package/src/studio/samples/fleet.ts +4 -2
- package/src/studio/samples/gym.ts +4 -2
- package/src/studio/samples/hr.ts +3 -1
- package/src/studio/samples/live-data.ts +308 -308
- package/src/studio/samples/projects.ts +2 -2
- package/src/studio/samples/restaurant.ts +4 -2
- package/src/studio/samples/samples.test.ts +13 -5
- package/src/studio/samples/shared.ts +346 -305
- package/src/studio/samples/support.ts +3 -1
- package/src/studio/scaffold.test.ts +15 -1
- package/src/studio/scaffold.ts +16 -0
- package/src/studio/themes.ts +7 -0
- package/src/studio/ui-components.ts +472 -0
- package/src/sveltekit/transport.test.ts +26 -0
- package/src/sveltekit/transport.ts +50 -5
- package/dist/designer/assets/index-Dp44bTid.js +0 -939
- package/dist/designer/assets/index-RJp6x8tw.css +0 -1
- package/dist/designer/assets/jszip.min-CjMo-QGg.js +0 -2
- package/dist/designer/index.html +0 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EntitySchema } from '../../schema.js'
|
|
2
2
|
import type { FormatRule } from '../project.js'
|
|
3
|
-
import { screen, formScreen, boardScreen,
|
|
3
|
+
import { screen, formScreen, boardScreen, schedulerScreen, detailScreen, project, dashScreen, statusPills, pad, ids, type SampleApp } from './shared.js'
|
|
4
4
|
|
|
5
5
|
const projectsEntity: EntitySchema = {
|
|
6
6
|
name: 'projects',
|
|
@@ -183,7 +183,7 @@ export const projectTracker: SampleApp = {
|
|
|
183
183
|
formScreen(tasks, { id: 'tasks', title: 'Tasks', order: 5 }, undefined, { format: taskFormats, summaries: true, rowActions: [{ kind: 'edit' }] }, ['status', 'priority', 'assigneeId']),
|
|
184
184
|
formScreen(members, { id: 'members', title: 'Members', order: 6 }, undefined, { format: statusPills(members, 'role'), summaries: true }, ['role']),
|
|
185
185
|
// Schedule: tasks placed on a month calendar by due date.
|
|
186
|
-
|
|
186
|
+
schedulerScreen(tasks, { id: 'calendar', title: 'Schedule', order: 7 }, { startField: 'startedAt', endField: 'dueDate', titleField: 'title', colorField: 'priority', resourceField: 'assigneeId', initialView: 'timelineWeek' }),
|
|
187
187
|
],
|
|
188
188
|
})
|
|
189
189
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EntitySchema } from '../../schema.js'
|
|
2
2
|
import type { FormatRule } from '../project.js'
|
|
3
|
-
import { screen, formScreen,
|
|
3
|
+
import { screen, formScreen, schedulerScreen, detailScreen, project, dashScreen, statusPills, pad, ids, type SampleApp } from './shared.js'
|
|
4
4
|
|
|
5
5
|
const menuItems: EntitySchema = {
|
|
6
6
|
name: 'menuItems',
|
|
@@ -173,7 +173,9 @@ export const restaurant: SampleApp = {
|
|
|
173
173
|
{ filter: ['category', 'available'], span: 3 },
|
|
174
174
|
{ grid: true, format: menuFormats, summaries: true, rowActions: [{ kind: 'edit' }], span: 3 },
|
|
175
175
|
]),
|
|
176
|
-
|
|
176
|
+
// Resource scheduler: a column per table, reservations placed by time + tinted by
|
|
177
|
+
// status, drag-to-reassign a table + a detail drawer (day view). Was a month calendar.
|
|
178
|
+
schedulerScreen(orders, { id: 'reservations', title: 'Reservations', order: 2 }, { startField: 'reservationTime', titleField: 'name', colorField: 'status', resourceField: 'tableId', initialView: 'day' }),
|
|
177
179
|
detailScreen(tables, { id: 'table-detail', title: 'Table detail', order: 3 }, {
|
|
178
180
|
titleField: 'name', statusField: 'section', metricFields: ['seats'],
|
|
179
181
|
related: [{ entity: 'orders', foreignKey: 'tableId', label: 'Orders', titleField: 'customerPhone', subtitleField: 'total', dateField: 'reservationTime', statusField: 'status' }],
|
|
@@ -196,12 +196,20 @@ describe('sample apps', () => {
|
|
|
196
196
|
}
|
|
197
197
|
})
|
|
198
198
|
|
|
199
|
-
it('
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
it('scheduler apps resolve relation title + resource fields to their display columns', () => {
|
|
200
|
+
// The scheduler grid view carries titleField + resourceField in the `scheduler={{ ... }}`
|
|
201
|
+
// config; relation FKs resolve to their display columns (classId -> class, etc.).
|
|
202
|
+
const cases: Record<string, { title: string; resource?: string }> = {
|
|
203
|
+
clinic: { title: 'patient', resource: 'doctor' },
|
|
204
|
+
gym: { title: 'member', resource: 'class' },
|
|
205
|
+
restaurant: { title: 'name', resource: 'table' }, // title is a plain text field
|
|
206
|
+
fleet: { title: 'driver', resource: 'vehicle' },
|
|
207
|
+
}
|
|
208
|
+
for (const [id, { title, resource }] of Object.entries(cases)) {
|
|
202
209
|
const all = emitStudioProject(getSampleApp(id)!.build()).map((f) => f.contents).join('\n')
|
|
203
|
-
const tag = all.match(
|
|
204
|
-
expect(tag, `${id}: schedule title not resolved`).toContain(`titleField
|
|
210
|
+
const tag = all.match(/scheduler=\{\{[\s\S]*?\}\}/)![0]
|
|
211
|
+
expect(tag, `${id}: schedule title not resolved`).toContain(`titleField: '${title}'`)
|
|
212
|
+
if (resource) expect(tag, `${id}: resource not resolved`).toContain(`resourceField: '${resource}'`)
|
|
205
213
|
}
|
|
206
214
|
})
|
|
207
215
|
})
|