diff options
author | dizzy <diosmosis@users.noreply.github.com> | 2021-11-05 08:39:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-05 08:39:33 +0300 |
commit | 2b94200db7e08389466859377c1b4732207673a2 (patch) | |
tree | e2f8ed241b13b1792e4f7e18d80622c77859dea8 /plugins/CoreVue/types/index.d.ts | |
parent | 0917a39fc686ac2d5e349b3bcc5266598ce59ee7 (diff) |
[Vue] migrate comparisons service + component (#18193)
* migrating RateFeature and ReviewLinks + adding AjaxHelper.fetch utility method (all untested)
* get ratefeature component to work, modify matomodialog component to use v-model, add event parameters to createAngularAdapter, allow translate to use variadic args or one string array + rebuild
* remove ratefeature angularjs files
* rebuild + make vue mapping property optional in createANgularJsAdapter
* migrate enrichedheadline and get to work
* fix test
* fix translate
* fix another translate issue & migrate contentblock directive
* fix anchor links, not including the "/" causes angularjs to fail (also on 4.x-dev)
* update expected screenshots
* fix ui test
* fix some test failures
* fix nested transclude issue
* remove content block files
* fix icon spacing that occurs due to angularjs inserting empty comments in between nodes while vue 3 does not
* update some screenshots
* update screenshot (actually fixes an alignment issue)
* update screenshot
* first pass at converting comparisons service/component
* get new code to build and load without error in the UI
* debugging
* getting basic functionaltiy to work
* fix UI test failure + URL encoding/angularjs issue causing back button to not work
* using ref in setup() is not needed to access this.$refs
* Convert comparisons service angularjs tests to comparison store typescript tests.
* built vue files
* rewrite URL handling to use computed properties in a URL store + do the same for other dependent data in the comparison store to allow vues to subscribe to the properties for changes to global state
* fix some tests
* some more fixes
* more fixes + disallow modifications to MatomoUrl state
* get angularjs unit tests to pass + fix a couple more issues
* another fix
* fix bad merge
* self review + fixes
* remove old fix as it may not be needed anymore
* empty string is not a valid date + do not report invalid date exception just rethrow
* update screenshots and try to fix random failure
* use jquery $destroy event instead of scope one since the scope one is broadcasted
* update expected screenshot
Diffstat (limited to 'plugins/CoreVue/types/index.d.ts')
-rw-r--r-- | plugins/CoreVue/types/index.d.ts | 170 |
1 files changed, 98 insertions, 72 deletions
diff --git a/plugins/CoreVue/types/index.d.ts b/plugins/CoreVue/types/index.d.ts index ac3c37e2d5..a5ae060795 100644 --- a/plugins/CoreVue/types/index.d.ts +++ b/plugins/CoreVue/types/index.d.ts @@ -5,95 +5,120 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later */ -import { IAngularStatic } from 'angular'; +import jqXHR = JQuery.jqXHR; +import { IAngularEvent, IAngularStatic } from 'angular'; -/** - * global ajax queue - * - * @type {Array} array holding XhrRequests with automatic cleanup - */ -interface GlobalAjaxQueue extends Array<XMLHttpRequest|null> { - active:number; +declare global { + type ParameterValue = string | number | null | undefined | ParameterValue[]; + type QueryParameters = {[name: string]: ParameterValue | QueryParameters}; - /** - * Removes all finished requests from the queue. - * - * @return {void} - */ - clean(); + interface WrappedEventListener extends Function { + wrapper?: (evt: Event) => void; + } /** - * Extend Array.push with automatic cleanup for finished requests + * global ajax queue * - * @return {Object} + * @type {Array} array holding XhrRequests with automatic cleanup */ - push(); + interface GlobalAjaxQueue extends Array<XMLHttpRequest|null> { + active:number; + + /** + * Removes all finished requests from the queue. + * + * @return {void} + */ + clean(); + + /** + * Extend Array.push with automatic cleanup for finished requests + * + * @return {Object} + */ + push(...args: (XMLHttpRequest|jqXHR|null)[]); + + /** + * Extend with abort function to abort all queued requests + * + * @return {void} + */ + abort(); + } - /** - * Extend with abort function to abort all queued requests - * - * @return {void} - */ - abort(); -} + interface PiwikPopoverGlobal { + isOpen(); + } -interface PiwikPopoverGlobal { - isOpen(); -} + let Piwik_Popover: PiwikPopoverGlobal; + + interface ModalConfirmCallbacks { + yes: () => void; + no: () => void; + } -let Piwik_Popover: PiwikPopoverGlobal; + interface ModalConfirmOptions { + onCloseEnd: () => void; + } -interface ModalConfirmCallbacks { - yes: () => void; - no: () => void; -} + interface PiwikHelperGlobal { + escape(text: string): string; + redirect(params: any); + htmlDecode(encoded: string): string; + modalConfirm(element: JQuery|JQLite|HTMLElement|string, callbacks: ModalConfirmCallbacks, options: ModalConfirmOptions); + getAngularDependency(eventName: string): any; + isAngularRenderingThePage(): boolean; + } -interface ModalConfirmOptions { - onCloseEnd: () => void; -} + let piwikHelper: PiwikHelperGlobal; -interface PiwikHelperGlobal { - escape(text: string): string; - redirect(params: any); - htmlDecode(encoded: string): string; - modalConfirm(element: JQuery|JQLite|HTMLElement|string, callbacks: ModalConfirmCallbacks, options: ModalConfirmOptions); -} + interface BroadcastGlobal { + getValueFromUrl(paramName: string, url?: string): string; + getValuesFromUrl(paramName: string, decode?: boolean): QueryParameters; + getValueFromHash(paramName: string, url?: string): string; + isWidgetizeRequestWithoutSession(): boolean; + updateParamValue(newParamValue: string, urlStr: string): string; + propagateNewPage(str: string, showAjaxLoading?: boolean, strHash?: string, paramsToRemove?: string[]); + } -let piwikHelper: PiwikHelperGlobal; + let broadcast: BroadcastGlobal; -interface BroadcastGlobal { - getValueFromUrl(paramName: string, url?: string): string; - getValueFromHash(paramName: string, url?: string): string; - isWidgetizeRequestWithoutSession(): boolean; -} + interface ColorManagerService { + getColor(namespace: string, name: string): string; + getColors(namespace: string, names: string[], asArray?: boolean): string[]|{[name: string]: string}; + } -let broadcast: BroadcastGlobal; - -interface PiwikGlobal { - timezoneOffset: number; - addCustomPeriod: (name: string, periodClass: any) => void; - shouldPropagateTokenAuth: boolean; - token_auth: string; - idSite: string|number; - siteName: string; - period?: string; - currentDateString?: string; - startDateString?: string; - endDateString?: string; - userCapabilities: string[]; - piwik_url: string; - helper: PiwikHelperGlobal; - broadcast: BroadcastGlobal; - - updatePeriodParamsFromUrl(): void; - updateDateInTitle(date: string, period: string): void; - hasUserCapability(capability: string): boolean; -} + interface PiwikGlobal { + timezoneOffset: number; + addCustomPeriod: (name: string, periodClass: any) => void; + shouldPropagateTokenAuth: boolean; + token_auth: string; + idSite: string|number; + siteName: string; + period?: string; + currentDateString?: string; + startDateString?: string; + endDateString?: string; + userCapabilities: string[]; + piwik_url: string; + helper: PiwikHelperGlobal; + broadcast: BroadcastGlobal; + ColorManager: ColorManagerService; + ajaxRequestFinished?: () => void; -let piwik: PiwikGlobal; + updatePeriodParamsFromUrl(): void; + updateDateInTitle(date: string, period: string): void; + hasUserCapability(capability: string): boolean; -// add the objects to Window so we can access them through window if needed -declare global { + on(eventName: string, listener: WrappedEventListener): void; + off(eventName: string, listener: WrappedEventListener): void; + postEvent(eventName: string, ...args: any[]): IAngularEvent; + postEventNoEmit(eventName: string, ...args: any[]): void; + } + + let piwik: PiwikGlobal; + + // add the objects to Window so we can access them through window if needed interface Window { angular: IAngularStatic; globalAjaxQueue: GlobalAjaxQueue; @@ -101,6 +126,7 @@ declare global { piwikHelper: PiwikHelperGlobal; broadcast: BroadcastGlobal; hasBlockedContent: boolean; + piwik_translations: {[key: string]: string}; _pk_translate(translationStringId: string, values: string[]): string; } |