@antcde/component-library 0.1.14-rc.f79030c → 0.1.14-rc.fd98dae
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 +2 -2
- package/dist/index.js +40068 -35097
- package/dist/types/src/components/AntTourZone/_TourInfoCard.vue.d.ts +18 -0
- package/dist/types/src/components/AntTourZone/_TourRing.vue.d.ts +15 -0
- package/dist/types/src/components/AntTourZone/index.vue.d.ts +49 -0
- package/dist/types/{components → src/components}/BaseAntDatePicker.vue.d.ts +2 -0
- package/dist/types/{components → src/components}/BaseDeleteDialog.vue.d.ts +8 -1
- package/dist/types/src/components/DmsFilePicker/composables/usePickerNavigation.d.ts +196 -0
- package/dist/types/src/components/DmsFilePicker/composables/usePickerUpload.d.ts +22 -0
- package/dist/types/src/components/DmsFilePicker/index.vue.d.ts +28 -0
- package/dist/types/src/components/DmsFilePicker/utils/fileFormatting.d.ts +6 -0
- package/dist/types/src/components/FilePreviewContent/index.vue.d.ts +31 -0
- package/dist/types/src/components/FlowWindowContent/index.vue.d.ts +51 -0
- package/dist/types/src/components/RichTextEditor/index.vue.d.ts +51 -0
- package/dist/types/{components → src/components}/StackedLabels/_LabelsMenuCard.vue.d.ts +1 -1
- package/dist/types/src/components/TasksFlow/components/_FlowBreadcrumb.vue.d.ts +17 -0
- package/dist/types/src/components/TasksFlow/components/_FlowEdgeConditionsDialog.vue.d.ts +10 -0
- package/dist/types/{components/TasksFlow/components/nodes/_triggerNode.vue.d.ts → src/components/TasksFlow/components/_FlowSearch.vue.d.ts} +4 -3
- package/dist/types/src/components/TasksFlow/components/_FlowStats.vue.d.ts +5 -0
- package/dist/types/src/components/TasksFlow/components/_FlowToolbar.vue.d.ts +26 -0
- package/dist/types/src/components/TasksFlow/components/_FlowTriggerMenu.vue.d.ts +17 -0
- package/dist/types/src/components/TasksFlow/components/_FlowVersionBar.vue.d.ts +12 -0
- package/dist/types/src/components/TasksFlow/components/_InsertTemplateDialog.vue.d.ts +17 -0
- package/dist/types/src/components/TasksFlow/components/_SubflowPanel.vue.d.ts +33 -0
- package/dist/types/src/components/TasksFlow/components/_VersionDiffView.vue.d.ts +14 -0
- package/dist/types/src/components/TasksFlow/components/_VersionPublishDialog.vue.d.ts +14 -0
- package/dist/types/src/components/TasksFlow/components/_flowEditor.vue.d.ts +13 -0
- package/dist/types/src/components/TasksFlow/components/nodes/_DurationEditor.vue.d.ts +33 -0
- package/dist/types/src/components/TasksFlow/components/nodes/_NodeContextMenu.vue.d.ts +35 -0
- package/dist/types/src/components/TasksFlow/components/nodes/_NodeMeta.vue.d.ts +14 -0
- package/dist/types/src/components/TasksFlow/components/nodes/_UserPicker.vue.d.ts +32 -0
- package/dist/types/{components → src/components}/TasksFlow/components/nodes/_taskNode.vue.d.ts +2 -2
- package/dist/types/src/components/TasksFlow/components/nodes/_triggerNode.vue.d.ts +10 -0
- package/dist/types/src/components/TasksFlow/components/nodes/useTaskNodeState.d.ts +86 -0
- package/dist/types/src/components/TasksFlow/composables/useAutoLayout.d.ts +22 -0
- package/dist/types/src/components/TasksFlow/composables/useCriticalPath.d.ts +8 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowAutoLayout.d.ts +12 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowCache.d.ts +17 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowCrud.d.ts +21 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowEditor.d.ts +54 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowFetch.d.ts +33 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowKeyboard.d.ts +15 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowNotifications.d.ts +15 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowOperations.d.ts +8 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowRealtime.d.ts +23 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowSearch.d.ts +14 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowSubflows.d.ts +22 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowUsers.d.ts +27 -0
- package/dist/types/src/components/TasksFlow/composables/useFlowViewport.d.ts +28 -0
- package/dist/types/src/components/TasksFlow/composables/useTaskFlow.d.ts +321 -0
- package/dist/types/{components → src/components}/TasksFlow/composables/useTaskFlowDragDrop.d.ts +0 -1
- package/dist/types/src/components/TasksFlow/composables/useTaskFlowEdgeConditions.d.ts +10 -0
- package/dist/types/src/components/TasksFlow/composables/useTaskFlowEdges.d.ts +18 -0
- package/dist/types/src/components/TasksFlow/composables/useTaskFlowMappers.d.ts +4 -0
- package/dist/types/src/components/TasksFlow/composables/useTaskFlowTypes.d.ts +76 -0
- package/dist/types/src/components/TasksFlow/composables/useTemplateVersioning.d.ts +188 -0
- package/dist/types/src/components/TasksFlow/composables/useTemplateVersioningState.d.ts +176 -0
- package/dist/types/src/components/TasksFlow/composables/useTriggerExecution.d.ts +21 -0
- package/dist/types/src/components/TasksFlow/index.vue.d.ts +39 -0
- package/dist/types/src/components/UnifiedWindow/index.vue.d.ts +67 -0
- package/dist/types/src/components/UnifiedWindow/useWindowDrag.d.ts +28 -0
- package/dist/types/src/components/VersionPublishDialog.vue.d.ts +24 -0
- package/dist/types/{index.d.ts → src/index.d.ts} +12 -1
- package/lib/GisViewer/GisViewer.vue +3 -2
- package/lib/build/layer-order.css +33 -0
- package/lib/build/uno.ts +117 -0
- package/lib/build/vite.ts +117 -0
- package/lib/build/vuetify-overrides.css +14 -0
- package/lib/build/vuetify.ts +230 -0
- package/lib/test/TESTING.claude.md +225 -0
- package/lib/test/createMockAppContext.ts +211 -0
- package/lib/test/createTestPinia.ts +31 -0
- package/lib/test/createTestRouter.ts +31 -0
- package/lib/test/index.ts +41 -0
- package/lib/test/mockVueRouter.ts +93 -0
- package/lib/test/mocks/createMockApi.ts +43 -0
- package/lib/test/mocks/createMockContext.ts +109 -0
- package/lib/test/mocks/createMockSignal.ts +30 -0
- package/lib/test/mocks/createMockUser.ts +87 -0
- package/lib/test/mocks/index.ts +11 -0
- package/lib/test/mountApp.ts +47 -0
- package/lib/test/mountWithContext.ts +94 -0
- package/lib/test/setup.ts +151 -0
- package/lib/test/testAppSetup.ts +115 -0
- package/lib/test/vitest.ts +69 -0
- package/package.json +128 -30
- package/dist/types/components/TasksFlow/components/_flowEditor.vue.d.ts +0 -16
- package/dist/types/components/TasksFlow/composables/useTaskFlow.d.ts +0 -103
- package/dist/types/components/TasksFlow/index.vue.d.ts +0 -51
- /package/dist/types/{components → src/components}/BaseAntButton.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseAntCard.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseAntCreateCard.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseAntInput.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseAntLoading.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseAppCard.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseAppCardSkeleton.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseClickableIcon.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseConfirmDialog.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseDialog.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseLimitedButton.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BaseResizePanel.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/BulkLabelsMenu.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/GlobalLabelBadge.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/RBAC/Permissions/PermissionCard.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/StackedLabels/index.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/TasksFlow/components/_dropzoneBackground.vue.d.ts +0 -0
- /package/dist/types/{components → src/components}/TasksFlow/components/_flowEdge.vue.d.ts +0 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { I18nOptions } from 'vue-i18n'
|
|
2
|
+
import { config, enableAutoUnmount } from '@vue/test-utils'
|
|
3
|
+
import { afterEach, vi } from 'vitest'
|
|
4
|
+
import { ref } from 'vue'
|
|
5
|
+
import { createI18n } from 'vue-i18n'
|
|
6
|
+
import { createVuetify } from 'vuetify'
|
|
7
|
+
import * as components from 'vuetify/components'
|
|
8
|
+
import * as directives from 'vuetify/directives'
|
|
9
|
+
|
|
10
|
+
interface HappyDOMWindow {
|
|
11
|
+
Response: typeof Response
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface HappyDOMHandle {
|
|
15
|
+
settings?: {
|
|
16
|
+
fetch?: {
|
|
17
|
+
interceptor?: {
|
|
18
|
+
beforeAsyncRequest?: (ctx: { window: HappyDOMWindow }) => Promise<unknown>
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare global {
|
|
25
|
+
interface Window {
|
|
26
|
+
happyDOM?: HappyDOMHandle
|
|
27
|
+
}
|
|
28
|
+
// eslint-disable-next-line vars-on-top
|
|
29
|
+
var __antTestMockComms: Record<string, unknown> | undefined
|
|
30
|
+
// eslint-disable-next-line vars-on-top
|
|
31
|
+
var __antTestMockColorMode: unknown
|
|
32
|
+
// eslint-disable-next-line vars-on-top
|
|
33
|
+
var __antTestMockI18n: unknown
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Builds an i18n instance with ANT test defaults. Missing keys fall back to the
|
|
38
|
+
* key itself so tests can assert `expect(html).toContain('foo.bar')`.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const i18n = createTestI18n({ messages: { en: { greeting: 'Hi' } } })
|
|
43
|
+
* mount(MyComponent, { global: { plugins: [i18n] } })
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export function createTestI18n(overrides: Partial<I18nOptions> = {}) {
|
|
47
|
+
return createI18n({
|
|
48
|
+
legacy: false,
|
|
49
|
+
locale: 'en',
|
|
50
|
+
fallbackLocale: 'en',
|
|
51
|
+
missing: (_locale, key) => key,
|
|
52
|
+
messages: { en: {} },
|
|
53
|
+
...overrides,
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
config.global.plugins = [
|
|
58
|
+
createVuetify({ components, directives }),
|
|
59
|
+
createTestI18n(),
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
enableAutoUnmount(afterEach)
|
|
63
|
+
|
|
64
|
+
const happyDOM = window.happyDOM
|
|
65
|
+
if (happyDOM?.settings?.fetch) {
|
|
66
|
+
happyDOM.settings.fetch.interceptor = {
|
|
67
|
+
beforeAsyncRequest: async ({ window: w }) => new w.Response('', { status: 200 }),
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
Object.defineProperty(window, 'scrollTo', { value: () => null, writable: true })
|
|
72
|
+
|
|
73
|
+
if (!globalThis.ResizeObserver) {
|
|
74
|
+
globalThis.ResizeObserver = class ResizeObserver {
|
|
75
|
+
observe() {}
|
|
76
|
+
unobserve() {}
|
|
77
|
+
disconnect() {}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!globalThis.visualViewport) {
|
|
82
|
+
Object.defineProperty(globalThis, 'visualViewport', {
|
|
83
|
+
value: {
|
|
84
|
+
width: 1024,
|
|
85
|
+
height: 768,
|
|
86
|
+
offsetLeft: 0,
|
|
87
|
+
offsetTop: 0,
|
|
88
|
+
pageLeft: 0,
|
|
89
|
+
pageTop: 0,
|
|
90
|
+
scale: 1,
|
|
91
|
+
addEventListener: () => {},
|
|
92
|
+
removeEventListener: () => {},
|
|
93
|
+
dispatchEvent: () => true,
|
|
94
|
+
},
|
|
95
|
+
writable: true,
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
vi.mock('@antcde/vue-utils', async (importOriginal) => {
|
|
100
|
+
const imported = await importOriginal<Record<string, any>>()
|
|
101
|
+
const real = { ...imported, ...(imported.default ?? {}) }
|
|
102
|
+
|
|
103
|
+
if (!real.useSingleton) {
|
|
104
|
+
for (const key of Object.getOwnPropertyNames(imported)) {
|
|
105
|
+
if (!(key in real))
|
|
106
|
+
real[key] = imported[key]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
...real,
|
|
112
|
+
|
|
113
|
+
useApi: (serviceFn: (...args: any[]) => Promise<any>, defaultValue: any) => {
|
|
114
|
+
const state = ref(structuredClone(defaultValue))
|
|
115
|
+
const isLoading = ref(false)
|
|
116
|
+
const error = ref(null)
|
|
117
|
+
const execute = vi.fn(async (...args: any[]) => {
|
|
118
|
+
isLoading.value = true
|
|
119
|
+
try {
|
|
120
|
+
const result = await serviceFn(...args)
|
|
121
|
+
state.value = result ?? structuredClone(defaultValue)
|
|
122
|
+
error.value = null
|
|
123
|
+
return result
|
|
124
|
+
}
|
|
125
|
+
catch (e: any) {
|
|
126
|
+
error.value = e
|
|
127
|
+
return undefined
|
|
128
|
+
}
|
|
129
|
+
finally {
|
|
130
|
+
isLoading.value = false
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
return { state, isLoading, error, execute, isReady: ref(true), executeDelayed: vi.fn() }
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
useCommsClient: () => {
|
|
137
|
+
const mocks = globalThis.__antTestMockComms
|
|
138
|
+
if (!mocks)
|
|
139
|
+
throw new Error('createMockAppContext() must be called before mounting. It sets up mock comms for the real context plugin.')
|
|
140
|
+
return mocks
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
useAntColorMode: () => {
|
|
144
|
+
return globalThis.__antTestMockColorMode ?? ref('light')
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
useAntI18n: () => {
|
|
148
|
+
return globalThis.__antTestMockI18n ?? { t: (k: string) => k, locale: ref('en') }
|
|
149
|
+
},
|
|
150
|
+
}
|
|
151
|
+
})
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { Component, Plugin } from 'vue'
|
|
2
|
+
import type { MockAppContext } from './createMockAppContext'
|
|
3
|
+
import { flushPromises, mount } from '@vue/test-utils'
|
|
4
|
+
import { describe, expect, it } from 'vitest'
|
|
5
|
+
import { nextTick } from 'vue'
|
|
6
|
+
|
|
7
|
+
export interface TestAppSetupOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The real `provideContext` plugin from your app's `@/plugins/context`.
|
|
10
|
+
* Tests use real Vue provide/inject — if context plugin is missing, tests fail.
|
|
11
|
+
*/
|
|
12
|
+
provideContext: Plugin
|
|
13
|
+
plugins?: Plugin[]
|
|
14
|
+
props?: Record<string, any>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Verifies the app correctly integrates with ANT-OS:
|
|
19
|
+
* 1. Mounts with real context (provide/inject)
|
|
20
|
+
* 2. Fails without context plugin (catches wiring bugs)
|
|
21
|
+
* 3. Implements dark mode from host colorMode preference
|
|
22
|
+
* 4. Has working i18n from context
|
|
23
|
+
* 5. useApi works with connect service mocks
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { createMockAppContext, testAppSetup } from '@antcde/component-library/test'
|
|
28
|
+
* import { provideContext } from '@/plugins/context'
|
|
29
|
+
* import App from '@/App.vue'
|
|
30
|
+
*
|
|
31
|
+
* const mockContext = createMockAppContext({
|
|
32
|
+
* connect: { myService: { getItems: vi.fn().mockResolvedValue([]) } },
|
|
33
|
+
* })
|
|
34
|
+
*
|
|
35
|
+
* testAppSetup(App, mockContext, { provideContext })
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export function testAppSetup(
|
|
39
|
+
App: Component,
|
|
40
|
+
mockContext: MockAppContext,
|
|
41
|
+
options: TestAppSetupOptions,
|
|
42
|
+
) {
|
|
43
|
+
const mountApp = () => {
|
|
44
|
+
return mount(App, {
|
|
45
|
+
global: {
|
|
46
|
+
plugins: [options.provideContext, ...(options.plugins ?? [])],
|
|
47
|
+
stubs: { Transition: false, TransitionGroup: false },
|
|
48
|
+
config: { warnHandler: () => {} },
|
|
49
|
+
},
|
|
50
|
+
props: options.props,
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
describe('app setup', () => {
|
|
55
|
+
it('mounts with context provided', () => {
|
|
56
|
+
const wrapper = mountApp()
|
|
57
|
+
expect(wrapper.vm).toBeTruthy()
|
|
58
|
+
wrapper.unmount()
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
it('fails without provideContext plugin', () => {
|
|
62
|
+
expect(() => mount(App, {
|
|
63
|
+
global: {
|
|
64
|
+
plugins: [...(options.plugins ?? [])],
|
|
65
|
+
stubs: { Transition: false, TransitionGroup: false },
|
|
66
|
+
config: { warnHandler: () => {} },
|
|
67
|
+
},
|
|
68
|
+
props: options.props,
|
|
69
|
+
})).toThrow()
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it('responds to dark mode preference from host', async () => {
|
|
73
|
+
const wrapper = mountApp()
|
|
74
|
+
await nextTick()
|
|
75
|
+
|
|
76
|
+
// The app must root its UI in a Vuetify `<v-app :theme="colorMode">`, which
|
|
77
|
+
// is the wiring point that feeds the host colorMode into the theme system.
|
|
78
|
+
const vApp = wrapper.findComponent({ name: 'VApp' })
|
|
79
|
+
expect(vApp.exists()).toBe(true)
|
|
80
|
+
|
|
81
|
+
// Toggling the host preference must re-render the app without error. We do
|
|
82
|
+
// NOT assert on serialized HTML (or the resolved theme): Vuetify applies
|
|
83
|
+
// themes via CSS custom properties, which don't reliably surface in
|
|
84
|
+
// happy-dom — the old html-inequality check only passed for apps whose
|
|
85
|
+
// output happened to differ for unrelated reasons, and failed for apps
|
|
86
|
+
// that render a stable, theme-independent tree.
|
|
87
|
+
mockContext.colorMode.value = 'dark'
|
|
88
|
+
await nextTick()
|
|
89
|
+
mockContext.colorMode.value = 'light'
|
|
90
|
+
await nextTick()
|
|
91
|
+
expect(wrapper.vm).toBeTruthy()
|
|
92
|
+
wrapper.unmount()
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('has working i18n from context', () => {
|
|
96
|
+
const wrapper = mountApp()
|
|
97
|
+
const text = wrapper.text().trim()
|
|
98
|
+
expect(text.length).toBeGreaterThan(0)
|
|
99
|
+
expect(mockContext.i18n.t('test.key')).toBe('test.key')
|
|
100
|
+
wrapper.unmount()
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
it('useApi resolves connect service mocks', async () => {
|
|
104
|
+
const wrapper = mountApp()
|
|
105
|
+
await flushPromises()
|
|
106
|
+
expect(wrapper.vm).toBeTruthy()
|
|
107
|
+
|
|
108
|
+
const services = Object.entries(mockContext.comms.connect)
|
|
109
|
+
.filter(([key]) => key !== 'httpClient')
|
|
110
|
+
expect(services.length).toBeGreaterThan(0)
|
|
111
|
+
|
|
112
|
+
wrapper.unmount()
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { fileURLToPath, URL } from 'node:url'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import vuetify from 'vite-plugin-vuetify'
|
|
4
|
+
import { defineConfig, mergeConfig } from 'vitest/config'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a Vitest config pre-configured for ANT platform packages.
|
|
8
|
+
*
|
|
9
|
+
* Includes: vue plugin, vuetify auto-import, happy-dom environment,
|
|
10
|
+
* vuetify dep inlining, path alias resolution, and the shared setup file
|
|
11
|
+
* that registers Vuetify + i18n on `config.global.plugins` and mocks
|
|
12
|
+
* `@antcde/vue-utils`.
|
|
13
|
+
*
|
|
14
|
+
* @param appRoot - Pass `import.meta.url` from your vitest.config.ts.
|
|
15
|
+
* @param overrides - Additional config merged via `mergeConfig()`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { createAntVitestConfig } from '@antcde/component-library/test/vitest'
|
|
20
|
+
* export default createAntVitestConfig(import.meta.url)
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function createAntVitestConfig(appRoot: string | URL, overrides: Record<string, any> = {}) {
|
|
24
|
+
const rootDir = fileURLToPath(new URL('.', appRoot))
|
|
25
|
+
const sharedSetup = fileURLToPath(new URL('./setup.ts', import.meta.url))
|
|
26
|
+
|
|
27
|
+
const base = defineConfig({
|
|
28
|
+
plugins: [
|
|
29
|
+
vue(),
|
|
30
|
+
vuetify({ autoImport: true }),
|
|
31
|
+
],
|
|
32
|
+
resolve: {
|
|
33
|
+
extensions: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json', '.vue'],
|
|
34
|
+
alias: {
|
|
35
|
+
'@': fileURLToPath(new URL('./src', appRoot)),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
test: {
|
|
39
|
+
globals: true,
|
|
40
|
+
environment: 'happy-dom',
|
|
41
|
+
environmentOptions: {
|
|
42
|
+
happyDOM: {
|
|
43
|
+
settings: {
|
|
44
|
+
navigator: {
|
|
45
|
+
maxTouchPoints: 0,
|
|
46
|
+
},
|
|
47
|
+
disableCSSFileLoading: true,
|
|
48
|
+
disableJavaScriptFileLoading: true,
|
|
49
|
+
handleDisabledFileLoadingAsSuccess: true,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
root: rootDir,
|
|
54
|
+
include: [
|
|
55
|
+
'src/**/*.{test,spec}.ts',
|
|
56
|
+
'tests/**/*.{test,spec}.ts',
|
|
57
|
+
],
|
|
58
|
+
exclude: ['node_modules'],
|
|
59
|
+
server: {
|
|
60
|
+
deps: {
|
|
61
|
+
inline: ['vuetify'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
setupFiles: [sharedSetup],
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
return mergeConfig(base, overrides)
|
|
69
|
+
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antcde/component-library",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.14-rc.
|
|
4
|
+
"version": "0.1.14-rc.fd98dae",
|
|
5
5
|
"description": "Helper to use ant components in Vue 3",
|
|
6
6
|
"author": "CollaborAll",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"types": "./dist/types/index.d.ts",
|
|
9
|
+
"types": "./dist/types/src/index.d.ts",
|
|
10
10
|
"import": "./dist/index.js",
|
|
11
11
|
"require": "./dist/index.cjs.js"
|
|
12
12
|
},
|
|
13
13
|
"./composables/*": {
|
|
14
|
-
"types": "./dist/types/composables/*.d.ts"
|
|
14
|
+
"types": "./dist/types/src/composables/*.d.ts"
|
|
15
|
+
},
|
|
16
|
+
"./build/uno": {
|
|
17
|
+
"import": "./lib/build/uno.ts",
|
|
18
|
+
"default": "./lib/build/uno.ts"
|
|
19
|
+
},
|
|
20
|
+
"./build/vite": {
|
|
21
|
+
"import": "./lib/build/vite.ts"
|
|
22
|
+
},
|
|
23
|
+
"./build/vuetify": {
|
|
24
|
+
"import": "./lib/build/vuetify.ts"
|
|
25
|
+
},
|
|
26
|
+
"./build/layer-order.css": "./lib/build/layer-order.css",
|
|
27
|
+
"./test": {
|
|
28
|
+
"import": "./lib/test/index.ts"
|
|
29
|
+
},
|
|
30
|
+
"./test/vitest": {
|
|
31
|
+
"import": "./lib/test/vitest.ts"
|
|
32
|
+
},
|
|
33
|
+
"./test/mocks": {
|
|
34
|
+
"import": "./lib/test/mocks/index.ts"
|
|
35
|
+
},
|
|
36
|
+
"./test/mount": {
|
|
37
|
+
"import": "./lib/test/mountWithContext.ts"
|
|
38
|
+
},
|
|
39
|
+
"./test/mockVueRouter": {
|
|
40
|
+
"import": "./lib/test/mockVueRouter.ts"
|
|
15
41
|
},
|
|
16
42
|
"./lib/ForgeViewer": {
|
|
17
43
|
"import": "./lib/ForgeViewer/index.ts"
|
|
@@ -40,7 +66,7 @@
|
|
|
40
66
|
},
|
|
41
67
|
"main": "./dist/index.js",
|
|
42
68
|
"module": "./dist/index.js",
|
|
43
|
-
"types": "./dist/types/index.d.ts",
|
|
69
|
+
"types": "./dist/types/src/index.d.ts",
|
|
44
70
|
"files": [
|
|
45
71
|
"/dist",
|
|
46
72
|
"/lib",
|
|
@@ -60,48 +86,120 @@
|
|
|
60
86
|
"format": "prettier --write src/"
|
|
61
87
|
},
|
|
62
88
|
"peerDependencies": {
|
|
89
|
+
"@iconify/vue": ">=5.0.0",
|
|
90
|
+
"@intlify/unplugin-vue-i18n": ">=11.0.0",
|
|
91
|
+
"@pinia/testing": ">=1.0.0",
|
|
92
|
+
"@unocss/preset-rem-to-px": "*",
|
|
93
|
+
"@unocss/preset-wind4": "*",
|
|
94
|
+
"@vitejs/plugin-vue": ">=6.0.0",
|
|
95
|
+
"@vue/test-utils": ">=2.4.0",
|
|
96
|
+
"happy-dom": ">=20.0.0",
|
|
97
|
+
"pinia": ">=3.0.0",
|
|
98
|
+
"unocss": "*",
|
|
99
|
+
"unplugin-auto-import": "*",
|
|
100
|
+
"unplugin-icons": "*",
|
|
101
|
+
"unplugin-vue-components": "*",
|
|
102
|
+
"vite": ">=8.0.0",
|
|
103
|
+
"vite-plugin-vuetify": ">=2.0.0",
|
|
104
|
+
"vitest": ">=4.0.0",
|
|
63
105
|
"vue": "^3.5.29",
|
|
64
|
-
"
|
|
106
|
+
"vue-router": ">=4.0.0",
|
|
107
|
+
"vuetify": "^4.0.4"
|
|
108
|
+
},
|
|
109
|
+
"peerDependenciesMeta": {
|
|
110
|
+
"@iconify/vue": {
|
|
111
|
+
"optional": true
|
|
112
|
+
},
|
|
113
|
+
"@intlify/unplugin-vue-i18n": {
|
|
114
|
+
"optional": true
|
|
115
|
+
},
|
|
116
|
+
"@unocss/preset-rem-to-px": {
|
|
117
|
+
"optional": true
|
|
118
|
+
},
|
|
119
|
+
"@unocss/preset-wind4": {
|
|
120
|
+
"optional": true
|
|
121
|
+
},
|
|
122
|
+
"@vitejs/plugin-vue": {
|
|
123
|
+
"optional": true
|
|
124
|
+
},
|
|
125
|
+
"unocss": {
|
|
126
|
+
"optional": true
|
|
127
|
+
},
|
|
128
|
+
"unplugin-auto-import": {
|
|
129
|
+
"optional": true
|
|
130
|
+
},
|
|
131
|
+
"unplugin-icons": {
|
|
132
|
+
"optional": true
|
|
133
|
+
},
|
|
134
|
+
"unplugin-vue-components": {
|
|
135
|
+
"optional": true
|
|
136
|
+
},
|
|
137
|
+
"vite": {
|
|
138
|
+
"optional": true
|
|
139
|
+
},
|
|
140
|
+
"vite-plugin-vuetify": {
|
|
141
|
+
"optional": true
|
|
142
|
+
},
|
|
143
|
+
"@vue/test-utils": {
|
|
144
|
+
"optional": true
|
|
145
|
+
},
|
|
146
|
+
"vitest": {
|
|
147
|
+
"optional": true
|
|
148
|
+
},
|
|
149
|
+
"happy-dom": {
|
|
150
|
+
"optional": true
|
|
151
|
+
},
|
|
152
|
+
"pinia": {
|
|
153
|
+
"optional": true
|
|
154
|
+
},
|
|
155
|
+
"@pinia/testing": {
|
|
156
|
+
"optional": true
|
|
157
|
+
},
|
|
158
|
+
"vue-router": {
|
|
159
|
+
"optional": true
|
|
160
|
+
}
|
|
65
161
|
},
|
|
66
162
|
"dependencies": {
|
|
67
|
-
"@antcde/connect-ts": "0.4.
|
|
68
|
-
"@antcde/vue-utils": "0.2.
|
|
163
|
+
"@antcde/connect-ts": "0.4.18-rc.fd98dae",
|
|
164
|
+
"@antcde/vue-utils": "0.2.14-rc.fd98dae",
|
|
69
165
|
"@arcgis/core": "^4.34.8",
|
|
70
166
|
"@mdi/font": "^7.4.47",
|
|
167
|
+
"@tiptap/extension-link": "^3.26.1",
|
|
168
|
+
"@tiptap/extension-mention": "^3.26.1",
|
|
169
|
+
"@tiptap/extension-placeholder": "^3.26.1",
|
|
170
|
+
"@tiptap/starter-kit": "^3.26.1",
|
|
171
|
+
"@tiptap/suggestion": "^3.26.1",
|
|
172
|
+
"@tiptap/vue-3": "^3.26.1",
|
|
71
173
|
"@vue-flow/background": "^1.3.2",
|
|
72
174
|
"@vue-flow/core": "^1.48.2",
|
|
73
175
|
"@vue-flow/minimap": "^1.5.4",
|
|
74
|
-
"@vueuse/core": "^14.
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"vue-i18n": "^11.3.2",
|
|
79
|
-
"vue-router": "^5.0.4"
|
|
176
|
+
"@vueuse/core": "^14.3.0",
|
|
177
|
+
"qs": "^6.15.2",
|
|
178
|
+
"sanitize-html": "^2.17.5",
|
|
179
|
+
"vue-i18n": "^11.4.5"
|
|
80
180
|
},
|
|
81
181
|
"devDependencies": {
|
|
82
182
|
"@arcgis/core": "^4.30.9",
|
|
83
183
|
"@iconify-json/mdi": "^1.2.3",
|
|
84
|
-
"@iconify/vue": "^5.0.
|
|
85
|
-
"@intlify/unplugin-vue-i18n": "^11.
|
|
184
|
+
"@iconify/vue": "^5.0.1",
|
|
185
|
+
"@intlify/unplugin-vue-i18n": "^11.2.3",
|
|
86
186
|
"@mdi/font": "^7.2.96",
|
|
87
|
-
"@tsconfig/
|
|
88
|
-
"@types/node": "^
|
|
89
|
-
"@types/qs": "^6.15.
|
|
90
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
91
|
-
"@vue/
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
"glob": "^13.0.6",
|
|
95
|
-
"npm-run-all2": "^6.2.6",
|
|
187
|
+
"@tsconfig/node22": "^22.0.5",
|
|
188
|
+
"@types/node": "^25.9.3",
|
|
189
|
+
"@types/qs": "^6.15.1",
|
|
190
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
191
|
+
"@vue/test-utils": "^2.4.11",
|
|
192
|
+
"@vue/tsconfig": "^0.9.1",
|
|
193
|
+
"happy-dom": "^20.10.4",
|
|
96
194
|
"pinia": "^3.0.4",
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"typescript": "~5.9.3",
|
|
195
|
+
"sass": "^1.101.0",
|
|
196
|
+
"typescript": "~6.0.3",
|
|
100
197
|
"unplugin-icons": "^23.0.1",
|
|
101
|
-
"vite": "^
|
|
102
|
-
"vite-plugin-css-injected-by-js": "^
|
|
198
|
+
"vite": "^8.0.16",
|
|
199
|
+
"vite-plugin-css-injected-by-js": "^5.0.1",
|
|
103
200
|
"vite-plugin-dts": "^4.5.4",
|
|
104
201
|
"vite-plugin-vuetify": "^2.1.3",
|
|
105
|
-
"
|
|
202
|
+
"vitest": "^4.1.9",
|
|
203
|
+
"vue-tsc": "^3.3.5"
|
|
106
204
|
}
|
|
107
205
|
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
type __VLS_Props = {
|
|
2
|
-
isDark: boolean;
|
|
3
|
-
};
|
|
4
|
-
declare function createTaskAtViewportCenter(): Promise<void>;
|
|
5
|
-
declare function createTriggerAtViewportCenter(triggerId: string): Promise<void>;
|
|
6
|
-
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
7
|
-
createTaskAtViewportCenter: typeof createTaskAtViewportCenter;
|
|
8
|
-
createTriggerAtViewportCenter: typeof createTriggerAtViewportCenter;
|
|
9
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
10
|
-
editTask: (...args: any[]) => void;
|
|
11
|
-
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
-
onEditTask?: ((...args: any[]) => any) | undefined;
|
|
13
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
14
|
-
containerEl: HTMLDivElement;
|
|
15
|
-
}, HTMLDivElement>;
|
|
16
|
-
export default _default;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { AntConnect, Event, Notepad, TableQueryShort, Task } from '@antcde/connect-ts';
|
|
2
|
-
import { Ref } from 'vue';
|
|
3
|
-
export declare function useTaskFlow(antConnect: AntConnect, notepad: Notepad): {
|
|
4
|
-
showTask: (taskId: string) => PromiseLike<boolean>;
|
|
5
|
-
setHighlightedNode: (taskId: string) => Promise<unknown>;
|
|
6
|
-
flowParent: Ref<Task | null, Task | null>;
|
|
7
|
-
flowNodes: Ref<TaskFlowNode[], TaskFlowNode[]>;
|
|
8
|
-
flowEdges: Ref<TaskFlowEdge[], TaskFlowEdge[]>;
|
|
9
|
-
highlightedNodeId: Ref<string | null, string | null>;
|
|
10
|
-
projectQueries: Ref<TableQueryShort[], TableQueryShort[]>;
|
|
11
|
-
isAutoRefreshEnabled: Ref<boolean, boolean>;
|
|
12
|
-
fetchFlowParent: (taskId: string) => Promise<boolean>;
|
|
13
|
-
updateFlowParent: (title: string) => Promise<void>;
|
|
14
|
-
deleteFlowParent: () => Promise<void>;
|
|
15
|
-
toggleLockFlowParent: (is_locked: boolean) => Promise<void>;
|
|
16
|
-
fetchFlowNodesAndEdges: () => Promise<void>;
|
|
17
|
-
createNode: (position?: {
|
|
18
|
-
x: number;
|
|
19
|
-
y: number;
|
|
20
|
-
}) => Promise<string | null>;
|
|
21
|
-
updateNode: (data: {
|
|
22
|
-
id: string;
|
|
23
|
-
position_x: number;
|
|
24
|
-
position_y: number;
|
|
25
|
-
}) => Promise<void>;
|
|
26
|
-
deleteNode: (nodeId: string) => Promise<void>;
|
|
27
|
-
createEdge: (source: string, target: string, type: "BLOCKED_BY" | "NON_BLOCKING") => Promise<void>;
|
|
28
|
-
deleteEdge: (edgeId: string) => Promise<void>;
|
|
29
|
-
createTriggerNode: (triggerId: string, position?: {
|
|
30
|
-
x: number;
|
|
31
|
-
y: number;
|
|
32
|
-
}) => Promise<string | null>;
|
|
33
|
-
addRelationQuery: (edgeId: string, queryId: string) => Promise<void>;
|
|
34
|
-
deleteRelationQuery: (edgeId: string, queryId: string) => Promise<void>;
|
|
35
|
-
setEdgeRelationType: (edgeId: string, newType: "BLOCKED_BY" | "NON_BLOCKING") => Promise<void>;
|
|
36
|
-
addTaskRelationQueryApi: import('@antcde/vue-utils').UseApiReturn<import('@antcde/connect-ts').TableQuery | null, [taskId: string, relationId: string, queryId: string], true>;
|
|
37
|
-
deleteTaskRelationQueryApi: import('@antcde/vue-utils').UseApiReturn<{
|
|
38
|
-
id: string;
|
|
39
|
-
} | null, [taskId: string, relationId: string, queryId: string], true>;
|
|
40
|
-
deleteFlowParentApi: import('@antcde/vue-utils').UseApiReturn<import('@antcde/connect-ts').MessageResponse | null, [taskId: string, method: string], true>;
|
|
41
|
-
getFlowNodesApi: import('@antcde/vue-utils').UseApiReturn<import('@antcde/connect-ts/services/TaskService').GetTasksResponse<Task> | null, [licenseId: string, query?: string | undefined], true>;
|
|
42
|
-
deletedFlowId: Ref<string | null, string | null>;
|
|
43
|
-
updateFlowTask: (task: Task) => void;
|
|
44
|
-
enableAutoRefresh: () => void;
|
|
45
|
-
disableAutoRefresh: () => void;
|
|
46
|
-
};
|
|
47
|
-
export interface TaskFlowNode {
|
|
48
|
-
id: string;
|
|
49
|
-
type: string;
|
|
50
|
-
data: {
|
|
51
|
-
status: string;
|
|
52
|
-
title: string;
|
|
53
|
-
description?: string;
|
|
54
|
-
progress: number;
|
|
55
|
-
script?: string;
|
|
56
|
-
isLocked: boolean;
|
|
57
|
-
app?: {
|
|
58
|
-
title: string;
|
|
59
|
-
color: string;
|
|
60
|
-
icon: string;
|
|
61
|
-
} | null;
|
|
62
|
-
assigned_to: string | {
|
|
63
|
-
id: string;
|
|
64
|
-
firstname: string;
|
|
65
|
-
lastname: string;
|
|
66
|
-
email: string;
|
|
67
|
-
} | null;
|
|
68
|
-
trigger?: {
|
|
69
|
-
id: string;
|
|
70
|
-
name: string;
|
|
71
|
-
is_active: boolean;
|
|
72
|
-
close_task_after_execution: boolean;
|
|
73
|
-
event: Pick<Event, 'id' | 'name' | 'code' | 'description'>;
|
|
74
|
-
};
|
|
75
|
-
trigger_id?: string;
|
|
76
|
-
isTriggerTask?: boolean;
|
|
77
|
-
};
|
|
78
|
-
draggable: boolean;
|
|
79
|
-
position: {
|
|
80
|
-
x: number;
|
|
81
|
-
y: number;
|
|
82
|
-
};
|
|
83
|
-
isLoading: boolean;
|
|
84
|
-
}
|
|
85
|
-
export interface TaskFlowEdge {
|
|
86
|
-
id: string;
|
|
87
|
-
source: string;
|
|
88
|
-
target: string;
|
|
89
|
-
type: string;
|
|
90
|
-
sourceHandle: string;
|
|
91
|
-
data: {
|
|
92
|
-
relationType: 'BLOCKED_BY' | 'NON_BLOCKING';
|
|
93
|
-
queries: TaskFlowQuery[];
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
export interface TaskFlowQuery {
|
|
97
|
-
id: string;
|
|
98
|
-
name: string;
|
|
99
|
-
}
|
|
100
|
-
type TaskFlowStore = ReturnType<typeof useTaskFlow>;
|
|
101
|
-
export declare function provideTaskFlow(instance: TaskFlowStore): TaskFlowStore;
|
|
102
|
-
export declare function injectTaskFlow(): TaskFlowStore;
|
|
103
|
-
export {};
|