@anzusystems/common-admin 2.0.0-rc.1 → 2.0.0-rc.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/dist/common-admin.js +188 -187
- package/dist/domains/dam/cropper/components/ACropper.js.map +1 -1
- package/dist/domains/dam/cropper/components/ACropper.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/domains/dam/cropper/components/ACropper.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/domains/dam/cropper/utils/cropperGeometry.js +1 -1
- package/dist/domains/dam/cropper/utils/cropperGeometry.js.map +1 -1
- package/dist/domains/dam/keyword/factory/KeywordFactory.js +2 -2
- package/dist/domains/dam/keyword/factory/KeywordFactory.js.map +1 -1
- package/dist/domains/filters/composables/filterFactory.d.ts +31 -2
- package/dist/domains/filters/composables/filterFactory.js +78 -67
- package/dist/domains/filters/composables/filterFactory.js.map +1 -1
- package/dist/domains/system/composables/breadcrumbs.d.ts +6 -6
- package/dist/domains/system/composables/breadcrumbs.js +7 -7
- package/dist/domains/system/composables/breadcrumbs.js.map +1 -1
- package/dist/domains/system/composables/recordActions.d.ts +41 -0
- package/dist/domains/system/composables/recordActions.js +33 -0
- package/dist/domains/system/composables/recordActions.js.map +1 -0
- package/dist/domains/system/composables/recordPage.d.ts +14 -4
- package/dist/domains/system/composables/recordPage.js +36 -34
- package/dist/domains/system/composables/recordPage.js.map +1 -1
- package/dist/lib.d.ts +3 -2
- package/dist/vendor/@cropper/element/dist/element.esm.raw.js +1 -1
- package/dist/vendor/@cropper/element/dist/element.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-canvas/dist/element-canvas.esm.raw.js +1 -1
- package/dist/vendor/@cropper/element-canvas/dist/element-canvas.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-crosshair/dist/element-crosshair.esm.raw.js +1 -1
- package/dist/vendor/@cropper/element-crosshair/dist/element-crosshair.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-grid/dist/element-grid.esm.raw.js +1 -1
- package/dist/vendor/@cropper/element-grid/dist/element-grid.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-handle/dist/element-handle.esm.raw.js +1 -1
- package/dist/vendor/@cropper/element-handle/dist/element-handle.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-image/dist/element-image.esm.raw.js +74 -58
- package/dist/vendor/@cropper/element-image/dist/element-image.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-selection/dist/element-selection.esm.raw.js +198 -52
- package/dist/vendor/@cropper/element-selection/dist/element-selection.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-shade/dist/element-shade.esm.raw.js +11 -4
- package/dist/vendor/@cropper/element-shade/dist/element-shade.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/element-viewer/dist/element-viewer.esm.raw.js +8 -8
- package/dist/vendor/@cropper/element-viewer/dist/element-viewer.esm.raw.js.map +1 -1
- package/dist/vendor/@cropper/utils/dist/utils.esm.raw.js +89 -46
- package/dist/vendor/@cropper/utils/dist/utils.esm.raw.js.map +1 -1
- package/dist/vendor/{cropperjs2 → cropperjs}/dist/cropper.esm.raw.js +11 -11
- package/dist/vendor/cropperjs/dist/cropper.esm.raw.js.map +1 -0
- package/package.json +10 -10
- package/src/eslint/adminConfig.mjs +2 -1
- package/src/eslint/oxlint-admin.json +3 -0
- package/dist/vendor/cropperjs2/dist/cropper.esm.raw.js.map +0 -1
|
@@ -27,6 +27,13 @@ export interface UseRecordPageOptions {
|
|
|
27
27
|
* next one -- a create form that loads nothing -- must not inherit it.
|
|
28
28
|
*/
|
|
29
29
|
loading?: Ref<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* The record's load, run on mount with the page's signal; `false` from it leaves the page (`leave`), `true` and
|
|
32
|
+
* `undefined` keep it. A load the page also calls later (a refresh after a save) is fine:
|
|
33
|
+
* `load: () => getData()`. Leave it out, and write the `onMounted` by hand, when the page acts on the result
|
|
34
|
+
* otherwise, loads in setup or makes more requests on mount.
|
|
35
|
+
*/
|
|
36
|
+
load?: (signal: AbortSignal) => Promise<boolean | undefined>;
|
|
30
37
|
}
|
|
31
38
|
export interface UseRecordPageReturn {
|
|
32
39
|
/** For the record's get-one: stopped when the page unmounts. */
|
|
@@ -41,14 +48,17 @@ export interface UseRecordPageReturn {
|
|
|
41
48
|
* the load fails.
|
|
42
49
|
*
|
|
43
50
|
* ```ts
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
51
|
+
* useRecordPage({
|
|
52
|
+
* fallbackRouteName: '/x',
|
|
53
|
+
* skipRouteNames: [...],
|
|
54
|
+
* loading: detailLoading,
|
|
55
|
+
* load: (signal) => fetchData(id, { signal }),
|
|
47
56
|
* })
|
|
48
57
|
* ```
|
|
49
58
|
*
|
|
50
59
|
* `false` from the loader means "leave"; `undefined` is a load that was superseded or stopped on
|
|
51
|
-
* purpose, after which the page stays.
|
|
60
|
+
* purpose, after which the page stays. A page that does more with the load writes its own `onMounted`
|
|
61
|
+
* with the returned `signal` and `leave`, see `load`.
|
|
52
62
|
*
|
|
53
63
|
* While the user is navigating to another page (an async guard, a lazy chunk; `trackNavigation`),
|
|
54
64
|
* the page does not leave: the user's navigation decides, and should it fail, the page stays with
|
|
@@ -8,36 +8,36 @@ import { isAppNavigationPending as a, usePageNavigation as o } from "./pageNavig
|
|
|
8
8
|
import { apiErrorStatus as s } from "../../api/utils/apiErrors.js";
|
|
9
9
|
import { forgetLeftAfterFailure as c, isLeftAfterFailureRecently as l, markLeftAfterFailure as u, useRouteHistory as d } from "./routeHistory.js";
|
|
10
10
|
import { useDatatablePageStore as f } from "../store/datatablePageStore.js";
|
|
11
|
-
import { onBeforeUnmount as p } from "vue";
|
|
12
|
-
import { useRouter as
|
|
11
|
+
import { onBeforeUnmount as p, onMounted as m } from "vue";
|
|
12
|
+
import { useRouter as h } from "vue-router";
|
|
13
13
|
//#region src/domains/system/composables/recordPage.ts
|
|
14
|
-
var
|
|
14
|
+
var g = (o, c = -1) => {
|
|
15
15
|
if (t(o) || r(o, (e) => e instanceof n)) return !1;
|
|
16
16
|
if (a()) return !0;
|
|
17
17
|
let { showErrorT: l, showErrorsDefault: u, showUnknownError: d } = i(), f = s(o);
|
|
18
18
|
return e(o) || f === 403 ? (l("common.alert.recordForbidden", c), !0) : f === 404 ? (l("common.alert.recordNotFound", c), !0) : (u(o, c) || d(c), !0);
|
|
19
|
-
},
|
|
19
|
+
}, _ = (e) => e.split(/[?#]/, 1)[0] ?? e, v = (e) => e.split("#", 1)[0] ?? e, y = /:(\w+)(?:\((?:\\.|[^\\)])*\))?([?*+])?/g, b = (e, t) => {
|
|
20
20
|
let n = e.getRoutes().find((e) => e.name === t);
|
|
21
|
-
if (n) return [...n.path.matchAll(
|
|
21
|
+
if (n) return [...n.path.matchAll(y)].map((e) => ({
|
|
22
22
|
key: e[1],
|
|
23
23
|
optional: e[2] === "?" || e[2] === "*"
|
|
24
24
|
}));
|
|
25
|
-
},
|
|
25
|
+
}, x = (e) => new Promise((t) => {
|
|
26
26
|
let n = (e) => {
|
|
27
27
|
r(), i(), t(e);
|
|
28
28
|
}, r = e.afterEach((e, t, r) => n(!r)), i = e.onError(() => n(!1));
|
|
29
|
-
}),
|
|
30
|
-
function
|
|
31
|
-
let t =
|
|
29
|
+
}), S = (e) => e.then((e) => !e, () => !1);
|
|
30
|
+
function C(e = {}) {
|
|
31
|
+
let t = h(), { history: n } = d(), { preservePageForLanding: r } = f(), { onPage: i } = o(), a = t.currentRoute.value.path;
|
|
32
32
|
c(a);
|
|
33
|
-
let s = new AbortController(),
|
|
33
|
+
let s = new AbortController(), g = !1;
|
|
34
34
|
p(() => {
|
|
35
|
-
|
|
35
|
+
g = !0, s.abort(), e.loading && (e.loading.value = !1);
|
|
36
36
|
});
|
|
37
|
-
let
|
|
38
|
-
let n = t.currentRoute.value, r = /* @__PURE__ */ new Set([
|
|
37
|
+
let y = () => !g && t.currentRoute.value.path === a, C = () => {
|
|
38
|
+
let n = t.currentRoute.value, r = /* @__PURE__ */ new Set([_(n.fullPath)]), i = /* @__PURE__ */ new Set();
|
|
39
39
|
for (let a of e.skipRouteNames ?? []) {
|
|
40
|
-
let e =
|
|
40
|
+
let e = b(t, a);
|
|
41
41
|
if (!e) continue;
|
|
42
42
|
if (e.length === 0 || e.some(({ key: e, optional: t }) => !t && !(e in n.params))) {
|
|
43
43
|
i.add(a);
|
|
@@ -45,7 +45,7 @@ function S(e = {}) {
|
|
|
45
45
|
}
|
|
46
46
|
let o = Object.fromEntries(e.filter(({ key: e }) => e in n.params).map(({ key: e }) => [e, n.params[e]]));
|
|
47
47
|
try {
|
|
48
|
-
r.add(
|
|
48
|
+
r.add(_(t.resolve({
|
|
49
49
|
name: a,
|
|
50
50
|
params: o
|
|
51
51
|
}).fullPath));
|
|
@@ -57,13 +57,13 @@ function S(e = {}) {
|
|
|
57
57
|
paths: r,
|
|
58
58
|
names: i
|
|
59
59
|
};
|
|
60
|
-
},
|
|
61
|
-
let { paths: e, names: t } =
|
|
60
|
+
}, w = () => {
|
|
61
|
+
let { paths: e, names: t } = C();
|
|
62
62
|
for (let r = n.value.length - 1; r >= 0; r--) {
|
|
63
63
|
let i = n.value[r];
|
|
64
|
-
if (!(e.has(
|
|
64
|
+
if (!(e.has(_(i.fullPath)) || l(_(i.fullPath))) && !(i.name !== void 0 && i.name !== null && t.has(i.name))) return i.fullPath;
|
|
65
65
|
}
|
|
66
|
-
},
|
|
66
|
+
}, T = async (e) => {
|
|
67
67
|
let n;
|
|
68
68
|
try {
|
|
69
69
|
n = t.resolve(e).fullPath;
|
|
@@ -71,31 +71,33 @@ function S(e = {}) {
|
|
|
71
71
|
return !1;
|
|
72
72
|
}
|
|
73
73
|
let i = t.options.history.state.back;
|
|
74
|
-
if (typeof i == "string" &&
|
|
75
|
-
let e =
|
|
74
|
+
if (typeof i == "string" && v(i) === v(n)) {
|
|
75
|
+
let e = x(t);
|
|
76
76
|
return r(t), t.back(), e;
|
|
77
77
|
}
|
|
78
78
|
let a = t.replace(e);
|
|
79
79
|
return r(t, {
|
|
80
80
|
to: e,
|
|
81
81
|
navigation: a
|
|
82
|
-
}),
|
|
83
|
-
}
|
|
84
|
-
|
|
82
|
+
}), S(a);
|
|
83
|
+
}, E = async () => {
|
|
84
|
+
if (!y() || (e.loading && (e.loading.value = !0), !i())) return !1;
|
|
85
|
+
u(a);
|
|
86
|
+
let t = w();
|
|
87
|
+
return t !== void 0 && await T(t) ? !0 : !y() || !i() || e.fallbackRouteName === void 0 ? !1 : T({
|
|
88
|
+
name: e.fallbackRouteName,
|
|
89
|
+
params: e.fallbackRouteParams
|
|
90
|
+
});
|
|
91
|
+
}, { load: D } = e;
|
|
92
|
+
return D && m(async () => {
|
|
93
|
+
await D(s.signal) === !1 && await E();
|
|
94
|
+
}), {
|
|
85
95
|
signal: s.signal,
|
|
86
|
-
leave:
|
|
87
|
-
if (!v() || (e.loading && (e.loading.value = !0), !i())) return !1;
|
|
88
|
-
u(a);
|
|
89
|
-
let t = C();
|
|
90
|
-
return t !== void 0 && await w(t) ? !0 : !v() || !i() || e.fallbackRouteName === void 0 ? !1 : w({
|
|
91
|
-
name: e.fallbackRouteName,
|
|
92
|
-
params: e.fallbackRouteParams
|
|
93
|
-
});
|
|
94
|
-
},
|
|
96
|
+
leave: E,
|
|
95
97
|
onPage: i
|
|
96
98
|
};
|
|
97
99
|
}
|
|
98
100
|
//#endregion
|
|
99
|
-
export {
|
|
101
|
+
export { g as handleRecordLoadError, C as useRecordPage };
|
|
100
102
|
|
|
101
103
|
//# sourceMappingURL=recordPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recordPage.js","names":["handleRecordLoadError","isAnzuApiCancelledError","error","isInCauseChain","cause","SessionExpiredError","isAppNavigationPending","useAlerts","status","apiErrorStatus","isAnzuApiForbiddenError","showErrorT","duration","showErrorsDefault","showUnknownError","pathOf","fullPath","withoutHash","PATH_PARAM","paramsOf","record","router","route","name","match","waitForLanding","done","stopAfterEach","stopError","resolve","landed","failure","settled","navigation","useRecordPage","useRouter","useRouteHistory","useDatatablePageStore","usePageNavigation","path","controller","unmounted","options","stillHere","skipped","current","paths","names","declared","optional","key","params","findTarget","i","history","entry","isLeftAfterFailureRecently","go","target","to","back","landing","preservePageForLanding","onPage"],"sources":["../../../../src/domains/system/composables/recordPage.ts"],"sourcesContent":["import { onBeforeUnmount, type Ref } from 'vue'\nimport { type NavigationFailure, type RouteLocationRaw, type RouteRecordName, type Router, useRouter } from 'vue-router'\nimport { useAlerts } from '@/domains/system/composables/alerts'\nimport {\n forgetLeftAfterFailure,\n isLeftAfterFailureRecently,\n markLeftAfterFailure,\n useRouteHistory,\n} from '@/domains/system/composables/routeHistory'\nimport { useDatatablePageStore } from '@/domains/system/store/datatablePageStore'\nimport { isAppNavigationPending, usePageNavigation } from '@/domains/system/composables/pageNavigation'\nimport { apiErrorStatus } from '@/domains/api/utils/apiErrors'\nimport { isAnzuApiCancelledError } from '@/shared/error/AnzuApiCancelledError'\nimport { isAnzuApiForbiddenError } from '@/shared/error/AnzuApiForbiddenError'\nimport { SessionExpiredError } from '@/shared/error/SessionExpiredError'\nimport { isInCauseChain } from '@/shared/error/isInCauseChain'\nimport { HTTP_STATUS_FORBIDDEN, HTTP_STATUS_NOT_FOUND } from '@/shared/statusCodes'\n\n/**\n * Shows why a record could not be loaded and says whether its page should leave.\n *\n * For the record's own get-one, not for what a page loads around it: a 404 or 403 there means the\n * record is not there for this user, a 404 of a secondary request does not. A request that was\n * stopped (the page is gone) and a session found expired (the logout is already loading) show\n * nothing and do not leave. Everything else -- a 5xx, the network, a timeout, the sign-in server --\n * shows the message `showErrorsDefault` has for it and leaves too: the page would only show an\n * empty record with live buttons. While the user is navigating to another page (`trackNavigation`)\n * it shows nothing, the message would stay there; the page's `leave` then stays put as well.\n */\nexport const handleRecordLoadError = (error: unknown, duration = -1): boolean => {\n if (isAnzuApiCancelledError(error)) return false\n if (isInCauseChain(error, (cause) => cause instanceof SessionExpiredError)) return false\n if (isAppNavigationPending()) return true\n\n const { showErrorT, showErrorsDefault, showUnknownError } = useAlerts()\n const status = apiErrorStatus(error)\n // A rejected 403 is `AnzuApiForbiddenError`, which carries no status; one let through by\n // `validateStatus` is a response code error that does.\n if (isAnzuApiForbiddenError(error) || status === HTTP_STATUS_FORBIDDEN) {\n showErrorT('common.alert.recordForbidden', duration)\n return true\n }\n if (status === HTTP_STATUS_NOT_FOUND) {\n showErrorT('common.alert.recordNotFound', duration)\n return true\n }\n if (!showErrorsDefault(error, duration)) showUnknownError(duration)\n return true\n}\n\nexport interface UseRecordPageOptions {\n /** Where to go when nothing in the history is a destination: the entity's list. */\n fallbackRouteName?: RouteRecordName\n fallbackRouteParams?: Record<string, any>\n /**\n * What the page gives its Close button: the record's sibling views and the create form. A route\n * with the record's params is skipped as that record's address only, see `leave`.\n */\n skipRouteNames?: RouteRecordName[]\n /**\n * The page's loading flag. `leave` holds it up, so the empty record's buttons never show, and the\n * page lowers it as it unmounts: the flag is often shared by every view of the entity, and the\n * next one -- a create form that loads nothing -- must not inherit it.\n */\n loading?: Ref<boolean>\n}\n\nexport interface UseRecordPageReturn {\n /** For the record's get-one: stopped when the page unmounts. */\n signal: AbortSignal\n /** Back to where the user came from, else to the fallback. Resolves whether it got there. */\n leave: () => Promise<boolean>\n /** The user is still on this page and not navigating away: for a redirect after the load. */\n onPage: () => boolean\n}\n\nconst pathOf = (fullPath: string) => fullPath.split(/[?#]/, 1)[0] ?? fullPath\nconst withoutHash = (fullPath: string) => fullPath.split('#', 1)[0] ?? fullPath\n\n// A param's name, its custom regex (whose `)` may be escaped) and its modifier: `?` and `*` make it optional.\nconst PATH_PARAM = /:(\\w+)(?:\\((?:\\\\.|[^\\\\)])*\\))?([?*+])?/g\n\nconst paramsOf = (router: Router, name: RouteRecordName) => {\n const record = router.getRoutes().find((route) => route.name === name)\n if (!record) return undefined\n return [...record.path.matchAll(PATH_PARAM)].map((match) => ({\n key: match[1]!,\n optional: match[2] === '?' || match[2] === '*',\n }))\n}\n\n// `router.back()` answers nothing; its landing, or its error, is the answer.\nconst waitForLanding = (router: Router) =>\n new Promise<boolean>((resolve) => {\n const done = (landed: boolean) => {\n stopAfterEach()\n stopError()\n resolve(landed)\n }\n const stopAfterEach = router.afterEach((_to, _from, failure) => done(!failure))\n const stopError = router.onError(() => done(false))\n })\n\nconst settled = (navigation: Promise<NavigationFailure | void | undefined>) =>\n navigation.then(\n (failure) => !failure,\n () => false\n )\n\n/**\n * For a detail or edit page: aborts the record's load when the page goes, and leaves the page when\n * the load fails.\n *\n * ```ts\n * const { signal, leave } = useRecordPage({ fallbackRouteName: '/x', skipRouteNames: [...], loading: detailLoading })\n * onMounted(async () => {\n * if ((await fetchData(id, { signal })) === false) await leave()\n * })\n * ```\n *\n * `false` from the loader means \"leave\"; `undefined` is a load that was superseded or stopped on\n * purpose, after which the page stays.\n *\n * While the user is navigating to another page (an async guard, a lazy chunk; `trackNavigation`),\n * the page does not leave: the user's navigation decides, and should it fail, the page stays with\n * its loading flag up. Not handled: a guard that refuses the step back can leave the address bar out\n * of step with the router.\n */\nexport function useRecordPage(options: UseRecordPageOptions = {}): UseRecordPageReturn {\n const router = useRouter()\n const { history } = useRouteHistory()\n const { preservePageForLanding } = useDatatablePageStore()\n const { onPage } = usePageNavigation()\n\n // The path, not the name: /x/1 and /x/2 share a name, and a late failure of the one must not move\n // the user off the other.\n const path = router.currentRoute.value.path\n // On it again: a failure there before no longer counts.\n forgetLeftAfterFailure(path)\n const controller = new AbortController()\n let unmounted = false\n onBeforeUnmount(() => {\n unmounted = true\n controller.abort()\n // Raised by `leave`, or left up by the load just aborted, whose `finally` no longer owns it. The\n // next page mounts after this one is gone and raises it again for its own load.\n if (options.loading) options.loading.value = false\n })\n\n const stillHere = () => !unmounted && router.currentRoute.value.path === path\n\n // Unlike the Close button, which skips every entry with the record's route name so that closing\n // one row never opens another, this goes back to the view the user actually came from -- another\n // record of the same entity included. Only the addresses of THIS record are skipped, compared\n // without query and hash (a tab in the query is the same view), plus the create form the record\n // may have been saved from: back there, Save would create a second record.\n const skipped = () => {\n const current = router.currentRoute.value\n const paths = new Set<string>([pathOf(current.fullPath)])\n const names = new Set<RouteRecordName>()\n for (const name of options.skipRouteNames ?? []) {\n const declared = paramsOf(router, name)\n if (!declared) continue\n // A route without params is one address; one the record cannot fill is skipped by name.\n if (declared.length === 0 || declared.some(({ key, optional }) => !optional && !(key in current.params))) {\n names.add(name)\n continue\n }\n const params = Object.fromEntries(\n declared.filter(({ key }) => key in current.params).map(({ key }) => [key, current.params[key]])\n )\n try {\n paths.add(pathOf(router.resolve({ name, params }).fullPath))\n } catch {\n names.add(name)\n }\n }\n return { paths, names }\n }\n\n const findTarget = (): string | undefined => {\n const { paths, names } = skipped()\n for (let i = history.value.length - 1; i >= 0; i--) {\n const entry = history.value[i]!\n // An address a page just left after a failure is no destination either: two failing records\n // next to each other in the history -- A, then B, while the backend is down -- would send the\n // user back and forth for as long as the outage lasts, B leaving to A, which finds B as its\n // newest entry. Skipped, the chain ends at the list.\n if (paths.has(pathOf(entry.fullPath)) || isLeftAfterFailureRecently(pathOf(entry.fullPath))) continue\n if (entry.name !== undefined && entry.name !== null && names.has(entry.name as RouteRecordName)) continue\n return entry.fullPath\n }\n return undefined\n }\n\n // Leaves no trace of the failed address: a step back when the target is the entry right before\n // it, a replace otherwise -- a push would let the browser's Back return to the page that just\n // failed, which would fail and leave again.\n const go = async (to: RouteLocationRaw): Promise<boolean> => {\n let target: string\n try {\n target = router.resolve(to).fullPath\n } catch {\n return false\n }\n // Without the hash: a list's filter writes it under the router, so the record's `state.back`\n // names the list without it, while the route history has it. The filter also keeps the list\n // entry's `current` in step, so the step back lands on the filter, and adds no entry.\n const back = router.options.history.state.back\n if (typeof back === 'string' && withoutHash(back) === withoutHash(target)) {\n const landing = waitForLanding(router)\n preservePageForLanding(router)\n router.back()\n return landing\n }\n const navigation = router.replace(to)\n preservePageForLanding(router, { to, navigation })\n return settled(navigation)\n }\n\n const leave = async (): Promise<boolean> => {\n if (!stillHere()) return false\n // Held up for good on a leave that fails: the record is not loaded, and its buttons -- Save\n // creating a new record, Delete with the address's id -- must not come back. The Close button,\n // which no page ties to loading, is the way out then.\n if (options.loading) options.loading.value = true\n // The user is on the way to another page: that navigation decides, ours would cancel it.\n if (!onPage()) return false\n markLeftAfterFailure(path)\n const target = findTarget()\n if (target !== undefined && (await go(target))) return true\n if (!stillHere() || !onPage() || options.fallbackRouteName === undefined) return false\n return go({ name: options.fallbackRouteName, params: options.fallbackRouteParams })\n }\n\n return { signal: controller.signal, leave, onPage }\n}\n"],"mappings":";;;;;;;;;;;;;AA6BA,IAAaA,KAAyB,GAAgB,IAAW,OAAgB;CAE/E,IADIC,EAAwBC,CAAK,KAC7BC,EAAeD,IAAQ,MAAUE,aAAiBC,CAAmB,GAAG,OAAO;CACnF,IAAIC,EAAuB,GAAG,OAAO;CAErC,IAAM,EAAE,eAAY,sBAAmB,wBAAqBC,EAAU,GAChEC,IAASC,EAAeP,CAAK;CAYnC,OATIQ,EAAwBR,CAAK,KAAKM,MAAA,OACpCG,EAAW,gCAAgCC,CAAQ,GAC5C,MAELJ,MAAA,OACFG,EAAW,+BAA+BC,CAAQ,GAC3C,OAEJC,EAAkBX,GAAOU,CAAQ,KAAGE,EAAiBF,CAAQ,GAC3D;AACT,GA4BMG,KAAU,MAAqBC,EAAS,MAAM,QAAQ,CAAC,CAAC,CAAC,MAAMA,GAC/DC,KAAe,MAAqBD,EAAS,MAAM,KAAK,CAAC,CAAC,CAAC,MAAMA,GAGjEE,IAAa,2CAEbC,KAAY,GAAgB,MAA0B;CAC1D,IAAMC,IAASC,EAAO,UAAU,CAAC,CAAC,MAAM,MAAUC,EAAM,SAASC,CAAI;CACrE,IAAKH,GACL,OAAO,CAAC,GAAGA,EAAO,KAAK,SAASF,CAAU,CAAC,CAAC,CAAC,KAAK,OAAW;EAC3D,KAAKM,EAAM;EACX,UAAUA,EAAM,OAAO,OAAOA,EAAM,O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Q,KAEzC,CAACqB,EAAO,IAAG,OAAO;GACtB,EAAqBxB,CAAI;GACzB,IAAMmB,IAASN,EAAW;GAG1B,OAFIM,MAAW,KAAA,KAAc,MAAMD,EAAGC,CAAM,IAAW,KACnD,CAACf,EAAU,KAAK,CAACoB,EAAO,KAAKrB,EAAQ,sBAAsB,KAAA,IAAkB,KAC1Ee,EAAG;IAAE,MAAMf,EAAQ;IAAmB,QAAQA,EAAQ;GAAoB,CAAC;EACpF;EAE2C;CAAO;AACpD"}
|
|
1
|
+
{"version":3,"file":"recordPage.js","names":["handleRecordLoadError","isAnzuApiCancelledError","error","isInCauseChain","cause","SessionExpiredError","isAppNavigationPending","useAlerts","status","apiErrorStatus","isAnzuApiForbiddenError","showErrorT","duration","showErrorsDefault","showUnknownError","pathOf","fullPath","withoutHash","PATH_PARAM","paramsOf","record","router","route","name","match","waitForLanding","done","stopAfterEach","stopError","resolve","landed","failure","settled","navigation","useRecordPage","useRouter","useRouteHistory","useDatatablePageStore","usePageNavigation","path","controller","unmounted","options","stillHere","skipped","current","paths","names","declared","optional","key","params","findTarget","i","history","entry","isLeftAfterFailureRecently","go","target","to","back","landing","preservePageForLanding","leave","onPage","load","onMounted"],"sources":["../../../../src/domains/system/composables/recordPage.ts"],"sourcesContent":["import { onBeforeUnmount, onMounted, type Ref } from 'vue'\nimport { type NavigationFailure, type RouteLocationRaw, type RouteRecordName, type Router, useRouter } from 'vue-router'\nimport { useAlerts } from '@/domains/system/composables/alerts'\nimport {\n forgetLeftAfterFailure,\n isLeftAfterFailureRecently,\n markLeftAfterFailure,\n useRouteHistory,\n} from '@/domains/system/composables/routeHistory'\nimport { useDatatablePageStore } from '@/domains/system/store/datatablePageStore'\nimport { isAppNavigationPending, usePageNavigation } from '@/domains/system/composables/pageNavigation'\nimport { apiErrorStatus } from '@/domains/api/utils/apiErrors'\nimport { isAnzuApiCancelledError } from '@/shared/error/AnzuApiCancelledError'\nimport { isAnzuApiForbiddenError } from '@/shared/error/AnzuApiForbiddenError'\nimport { SessionExpiredError } from '@/shared/error/SessionExpiredError'\nimport { isInCauseChain } from '@/shared/error/isInCauseChain'\nimport { HTTP_STATUS_FORBIDDEN, HTTP_STATUS_NOT_FOUND } from '@/shared/statusCodes'\n\n/**\n * Shows why a record could not be loaded and says whether its page should leave.\n *\n * For the record's own get-one, not for what a page loads around it: a 404 or 403 there means the\n * record is not there for this user, a 404 of a secondary request does not. A request that was\n * stopped (the page is gone) and a session found expired (the logout is already loading) show\n * nothing and do not leave. Everything else -- a 5xx, the network, a timeout, the sign-in server --\n * shows the message `showErrorsDefault` has for it and leaves too: the page would only show an\n * empty record with live buttons. While the user is navigating to another page (`trackNavigation`)\n * it shows nothing, the message would stay there; the page's `leave` then stays put as well.\n */\nexport const handleRecordLoadError = (error: unknown, duration = -1): boolean => {\n if (isAnzuApiCancelledError(error)) return false\n if (isInCauseChain(error, (cause) => cause instanceof SessionExpiredError)) return false\n if (isAppNavigationPending()) return true\n\n const { showErrorT, showErrorsDefault, showUnknownError } = useAlerts()\n const status = apiErrorStatus(error)\n // A rejected 403 is `AnzuApiForbiddenError`, which carries no status; one let through by\n // `validateStatus` is a response code error that does.\n if (isAnzuApiForbiddenError(error) || status === HTTP_STATUS_FORBIDDEN) {\n showErrorT('common.alert.recordForbidden', duration)\n return true\n }\n if (status === HTTP_STATUS_NOT_FOUND) {\n showErrorT('common.alert.recordNotFound', duration)\n return true\n }\n if (!showErrorsDefault(error, duration)) showUnknownError(duration)\n return true\n}\n\nexport interface UseRecordPageOptions {\n /** Where to go when nothing in the history is a destination: the entity's list. */\n fallbackRouteName?: RouteRecordName\n fallbackRouteParams?: Record<string, any>\n /**\n * What the page gives its Close button: the record's sibling views and the create form. A route\n * with the record's params is skipped as that record's address only, see `leave`.\n */\n skipRouteNames?: RouteRecordName[]\n /**\n * The page's loading flag. `leave` holds it up, so the empty record's buttons never show, and the\n * page lowers it as it unmounts: the flag is often shared by every view of the entity, and the\n * next one -- a create form that loads nothing -- must not inherit it.\n */\n loading?: Ref<boolean>\n /**\n * The record's load, run on mount with the page's signal; `false` from it leaves the page (`leave`), `true` and\n * `undefined` keep it. A load the page also calls later (a refresh after a save) is fine:\n * `load: () => getData()`. Leave it out, and write the `onMounted` by hand, when the page acts on the result\n * otherwise, loads in setup or makes more requests on mount.\n */\n load?: (signal: AbortSignal) => Promise<boolean | undefined>\n}\n\nexport interface UseRecordPageReturn {\n /** For the record's get-one: stopped when the page unmounts. */\n signal: AbortSignal\n /** Back to where the user came from, else to the fallback. Resolves whether it got there. */\n leave: () => Promise<boolean>\n /** The user is still on this page and not navigating away: for a redirect after the load. */\n onPage: () => boolean\n}\n\nconst pathOf = (fullPath: string) => fullPath.split(/[?#]/, 1)[0] ?? fullPath\nconst withoutHash = (fullPath: string) => fullPath.split('#', 1)[0] ?? fullPath\n\n// A param's name, its custom regex (whose `)` may be escaped) and its modifier: `?` and `*` make it optional.\nconst PATH_PARAM = /:(\\w+)(?:\\((?:\\\\.|[^\\\\)])*\\))?([?*+])?/g\n\nconst paramsOf = (router: Router, name: RouteRecordName) => {\n const record = router.getRoutes().find((route) => route.name === name)\n if (!record) return undefined\n return [...record.path.matchAll(PATH_PARAM)].map((match) => ({\n key: match[1]!,\n optional: match[2] === '?' || match[2] === '*',\n }))\n}\n\n// `router.back()` answers nothing; its landing, or its error, is the answer.\nconst waitForLanding = (router: Router) =>\n new Promise<boolean>((resolve) => {\n const done = (landed: boolean) => {\n stopAfterEach()\n stopError()\n resolve(landed)\n }\n const stopAfterEach = router.afterEach((_to, _from, failure) => done(!failure))\n const stopError = router.onError(() => done(false))\n })\n\nconst settled = (navigation: Promise<NavigationFailure | void | undefined>) =>\n navigation.then(\n (failure) => !failure,\n () => false\n )\n\n/**\n * For a detail or edit page: aborts the record's load when the page goes, and leaves the page when\n * the load fails.\n *\n * ```ts\n * useRecordPage({\n * fallbackRouteName: '/x',\n * skipRouteNames: [...],\n * loading: detailLoading,\n * load: (signal) => fetchData(id, { signal }),\n * })\n * ```\n *\n * `false` from the loader means \"leave\"; `undefined` is a load that was superseded or stopped on\n * purpose, after which the page stays. A page that does more with the load writes its own `onMounted`\n * with the returned `signal` and `leave`, see `load`.\n *\n * While the user is navigating to another page (an async guard, a lazy chunk; `trackNavigation`),\n * the page does not leave: the user's navigation decides, and should it fail, the page stays with\n * its loading flag up. Not handled: a guard that refuses the step back can leave the address bar out\n * of step with the router.\n */\nexport function useRecordPage(options: UseRecordPageOptions = {}): UseRecordPageReturn {\n const router = useRouter()\n const { history } = useRouteHistory()\n const { preservePageForLanding } = useDatatablePageStore()\n const { onPage } = usePageNavigation()\n\n // The path, not the name: /x/1 and /x/2 share a name, and a late failure of the one must not move\n // the user off the other.\n const path = router.currentRoute.value.path\n // On it again: a failure there before no longer counts.\n forgetLeftAfterFailure(path)\n const controller = new AbortController()\n let unmounted = false\n onBeforeUnmount(() => {\n unmounted = true\n controller.abort()\n // Raised by `leave`, or left up by the load just aborted, whose `finally` no longer owns it. The\n // next page mounts after this one is gone and raises it again for its own load.\n if (options.loading) options.loading.value = false\n })\n\n const stillHere = () => !unmounted && router.currentRoute.value.path === path\n\n // Unlike the Close button, which skips every entry with the record's route name so that closing\n // one row never opens another, this goes back to the view the user actually came from -- another\n // record of the same entity included. Only the addresses of THIS record are skipped, compared\n // without query and hash (a tab in the query is the same view), plus the create form the record\n // may have been saved from: back there, Save would create a second record.\n const skipped = () => {\n const current = router.currentRoute.value\n const paths = new Set<string>([pathOf(current.fullPath)])\n const names = new Set<RouteRecordName>()\n for (const name of options.skipRouteNames ?? []) {\n const declared = paramsOf(router, name)\n if (!declared) continue\n // A route without params is one address; one the record cannot fill is skipped by name.\n if (declared.length === 0 || declared.some(({ key, optional }) => !optional && !(key in current.params))) {\n names.add(name)\n continue\n }\n const params = Object.fromEntries(\n declared.filter(({ key }) => key in current.params).map(({ key }) => [key, current.params[key]])\n )\n try {\n paths.add(pathOf(router.resolve({ name, params }).fullPath))\n } catch {\n names.add(name)\n }\n }\n return { paths, names }\n }\n\n const findTarget = (): string | undefined => {\n const { paths, names } = skipped()\n for (let i = history.value.length - 1; i >= 0; i--) {\n const entry = history.value[i]!\n // An address a page just left after a failure is no destination either: two failing records\n // next to each other in the history -- A, then B, while the backend is down -- would send the\n // user back and forth for as long as the outage lasts, B leaving to A, which finds B as its\n // newest entry. Skipped, the chain ends at the list.\n if (paths.has(pathOf(entry.fullPath)) || isLeftAfterFailureRecently(pathOf(entry.fullPath))) continue\n if (entry.name !== undefined && entry.name !== null && names.has(entry.name as RouteRecordName)) continue\n return entry.fullPath\n }\n return undefined\n }\n\n // Leaves no trace of the failed address: a step back when the target is the entry right before\n // it, a replace otherwise -- a push would let the browser's Back return to the page that just\n // failed, which would fail and leave again.\n const go = async (to: RouteLocationRaw): Promise<boolean> => {\n let target: string\n try {\n target = router.resolve(to).fullPath\n } catch {\n return false\n }\n // Without the hash: a list's filter writes it under the router, so the record's `state.back`\n // names the list without it, while the route history has it. The filter also keeps the list\n // entry's `current` in step, so the step back lands on the filter, and adds no entry.\n const back = router.options.history.state.back\n if (typeof back === 'string' && withoutHash(back) === withoutHash(target)) {\n const landing = waitForLanding(router)\n preservePageForLanding(router)\n router.back()\n return landing\n }\n const navigation = router.replace(to)\n preservePageForLanding(router, { to, navigation })\n return settled(navigation)\n }\n\n const leave = async (): Promise<boolean> => {\n if (!stillHere()) return false\n // Held up for good on a leave that fails: the record is not loaded, and its buttons -- Save\n // creating a new record, Delete with the address's id -- must not come back. The Close button,\n // which no page ties to loading, is the way out then.\n if (options.loading) options.loading.value = true\n // The user is on the way to another page: that navigation decides, ours would cancel it.\n if (!onPage()) return false\n markLeftAfterFailure(path)\n const target = findTarget()\n if (target !== undefined && (await go(target))) return true\n if (!stillHere() || !onPage() || options.fallbackRouteName === undefined) return false\n return go({ name: options.fallbackRouteName, params: options.fallbackRouteParams })\n }\n\n const { load } = options\n if (load) {\n onMounted(async () => {\n if ((await load(controller.signal)) === false) await leave()\n })\n }\n\n return { signal: controller.signal, leave, onPage }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O,MAAMuB,EAAM;CAC7D,CAAC,GAGI;EAAE,QAAQvB,EAAW;EAAQ;EAAO;CAAO;AACpD"}
|
package/dist/lib.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ import { VuetifyIconValue } from './shared/types/Vuetify';
|
|
|
101
101
|
import { NavigateBackOptions, NavigateBackTarget, RouteHistoryEntry, useRouteHistory } from './domains/system/composables/routeHistory';
|
|
102
102
|
import { createNavigationErrorHandler, NavigationErrorHandlerOptions } from './domains/system/composables/navigationError';
|
|
103
103
|
import { handleRecordLoadError, useRecordPage, UseRecordPageOptions, UseRecordPageReturn } from './domains/system/composables/recordPage';
|
|
104
|
+
import { defineRecordLoader, defineRecordSave } from './domains/system/composables/recordActions';
|
|
104
105
|
import { isNavigationPending, trackNavigation, usePageNavigation, UsePageNavigationReturn } from './domains/system/composables/pageNavigation';
|
|
105
106
|
import { SubjectScopeKey, SystemScopeKey } from './shared/injectionKeys';
|
|
106
107
|
import { prettyBytes, prettyDuration } from './shared/utils/file';
|
|
@@ -262,7 +263,7 @@ import { default as ALogDetailView } from './domains/log/components/ALogDetailVi
|
|
|
262
263
|
import { DEFAULT_LOG_PATHS, isLogType, LogType, LogTypeDefault, LogPaths, LogTypeType } from './domains/log/composables/logType';
|
|
263
264
|
import { LogTimeWindow } from './domains/log/filter/logFilter';
|
|
264
265
|
import { DatatablePaginationKey, FilterConfigKey, FilterDataKey, FilterInnerConfigKey, FilterInnerDataKey } from './domains/filters/utils/filterInjectionKeys';
|
|
265
|
-
import { buildFilterHash, createFilter, createFilterStore, FilterConfig, FilterData, isRouterSafeHash, FilterStoreIdentifier, MakeFilterOption, useFilterHelpers, AllowedFilterValues, FilterField, FilterType, FilterVariant } from './domains/filters/composables/filterFactory';
|
|
266
|
+
import { buildFilterHash, createFilter, createFilterStore, FilterConfig, FilterData, isRouterSafeHash, FilterStoreIdentifier, MakeFilterOption, useFilterHelpers, useDatatableList, FilterHelpersMoreOptions, AllowedFilterValues, FilterField, FilterType, FilterVariant } from './domains/filters/composables/filterFactory';
|
|
266
267
|
import { TimeIntervalSpecialOptions, TimeIntervalSpecialOptionsType, TimeIntervalToolsValue } from './domains/filters/composables/filterTimeIntervalTools';
|
|
267
268
|
import { Pagination, usePagination } from './domains/api/composables/pagination';
|
|
268
269
|
import { createDatatableColumnsConfig } from './domains/filters/datatable/composables/createDatatableColumnsConfig';
|
|
@@ -297,7 +298,7 @@ import { default as AUserTabsShell } from './domains/anzuUser/components/AUserTa
|
|
|
297
298
|
import { OTHER_SYSTEMS_TAB } from './domains/anzuUser/utils/userTabs';
|
|
298
299
|
import { USER_PROBE_ENTITY, UserSystemRefreshHook } from './domains/anzuUser/composables/userSystemProbe';
|
|
299
300
|
import { default as AUserSystemOverview } from './domains/anzuUser/components/AUserSystemOverview.vue';
|
|
300
|
-
export { ACard, AProgress, ARow, AChipNoLink, AAlerts, AActionbar, AActionbarTarget, ALayoutLoader, ALayoutSwitch, actionbarSlot, createTeleportSlot, type TeleportSlot, ABooleanValue, ASystemEntityScope, AFormTextField, AFormTextarea, AFormDatetimePicker, AFormFlagDatetimePicker, AFormRemoteCheckbox, AFormRemoteSwitch, AFormSwitch, AFormValueObjectOptionsSelect, ADatetime, ADatetimePicker, ADatatableConfigButton, ADialogToolbar, ACreateDialog, AJobStatusChip, ACachedChip, ACachedUserChip, AAdminSwitcher, ATimeTrackingFields, Acl, ACopyText, AIconGroup, AUserAndTimeTrackingFields, AActionCloseButtonHistory, AActionCreateButton, AActionDeleteButton, AActionEditButton, AActionSaveAndCloseButton, AActionSaveButton, ATableCopyIdButton, ATableDetailButton, ATableEditButton, ABtnSplit, AThemeSelect, ALanguageSelect, ASystemBar, AAnzuUserAvatar, AAvatarColorPicker, ACurrentUserDropdown, AJobDetailCommon, AJobPriorityChip, AJobBaseCreateForm, ACustomDataForm, ACustomDataFormElement, AImageWidget, AImageWidgetInner, AImageMediaWidget, AImageWidgetSimple, AMediaWidgetSimple, AImageWidgetMultiple, AImageWidgetMultipleInner, AImageWidgetMultipleSimple, AImageMassOperations, AImagePublicInput, ADamAssetImageRoiSelect, ACollabLockedByUser, ACollabManagement, AFileInput, AAssetSelect, AAssetListInner, ABooleanSelect, ADamExtSystemRemoteAutocomplete, ADamExternalProviderAssetSelect, ADamDistributionServiceSelect, ADamAssetLicenceRemoteAutocomplete, ADamAssetLicenceGroupRemoteAutocomplete, ADamAuthorFilterRemoteAutocomplete, ADamKeywordFilterRemoteAutocomplete, ADamUserFilterRemoteAutocomplete, ADamUserRemoteAutocomplete, ADamAdminAssetLink, ALoginView, ALogoutView, AUnauthorizedView, ANotFoundView, AGenericView, useRouteHistory, type NavigateBackOptions, type NavigateBackTarget, type RouteHistoryEntry, handleRecordLoadError, useRecordPage, type UseRecordPageOptions, type UseRecordPageReturn, trackNavigation, isNavigationPending, usePageNavigation, type UsePageNavigationReturn, createNavigationErrorHandler, type NavigationErrorHandlerOptions, useRemainingTime, useAlerts, useTheme, defineCached, useCachedItem, Theme, type ThemeType, useLanguageSettings, modifyLanguageSettings, useLoginStatus, generateDatatableMinMaxSelectStrategy, useCustomDataFormElementType, useDamConfigState, useUploadQueueItemFactory, useDamUploadChunkSize, useDamAcceptTypeAndSizeHelper, useAssetSuggestions, destroyDamNotifications, initDamNotifications, useDamNotifications, useDamNotificationsConnection, createUploadSettlement, uploadSettlementRuntime, UPLOAD_POLL_SCHEDULE, useDropzoneGlobalDragState, useDamKeywordFactory, useDamAuthorFactory, useDamAuthorType, useDamDistributionServiceType, useDamAssetLicenceInnerFilter, useImageActions, useCommonAdminImageOptions, defineAuth, useAclAllowed, AuthUnavailableError, type AuthCookieState, createRefreshRequestInterceptor, createRefreshSession, isInCauseChain, type RefreshResult, SessionExpiredError, defineBreadcrumbs, useDamCachedUsers, useUnreleasedFeatures, useDebugFeatures, useSentry, useUserActivity, type GrantType, Grant, useGrant, type GrantOriginType, GrantOrigin, GrantOriginDefault, useGrantOrigin, LogLevel, type LogLevelType, type IntegerId, type IntegerIdNullable, type DocId, type DocIdNullable, type DatetimeUTCNullable, type DatetimeUTC, type DateUTC, type DatetimePickerType, type AnzuUser, type BaseUser, type AnzuUserMinimal, type AnzuUserAndTimeTrackingAware, type ValueObjectOption, type CreatedByAware, type PermissionConfig, type PermissionTranslationGroup, type PermissionGroup, type PermissionGroupMinimal, type VuetifyIconValue, type JobBase, type JobUserDataDelete, JOB_RESOURCE_USER_DATA_DELETE, JobStatus, JobStatusDefault, type JobStatusType, type JobBaseResource, useCommonJobFactory, type AclValue, type AclRegistry, type AclValueOf, type RegisteredAclValue, type Permissions, type PluginOptions, type CommonAdminImageOptions, type CommonAdminCoreDamOptions, type CommonAdminCollabOptions, type LanguageCode, type Immutable, type ResourceNameSystemAware, type ValidationScope, type AFormFieldValidation, type CommonAdminGlobalComponents, type ACreateDialogValidation, type Log, type ApiInfiniteResponseList, type DatatableOrderingOption, type DatatableOrderingOptions, type DatatableSortBy, type SortOrderType, type ObjectLeaves, type UniqueValues, ensureUniqueValues, type CachedItem, type AddToCachedArgs, type CachedUnresolvedReason, type DefineCachedOptions, type RecordWasType, type UrlParams, type AssetSelectReturnData, AssetSelectReturnType, type AssetSelectReturnTypeType, type SortableItemDataAware, type AssetFileProperties, type AssetSearchListItemDto, type AssetDetailItemDto, type AssetMetadataDto, type AssetCustomData, type AssetMetadataSuggestions, AssetFileFailReason, type AssetFileFailReasonType, AssetFileProcessStatus, type AssetFileProcessStatusType, AssetFileLinkType, type AssetFileLinkTypeType, type AssetFile, type AssetFileDocument, type AssetFileVideo, type AssetFileAudio, type AssetFileImage, type AssetFileNullable, type AssetFileLink, type AssetFileLinks, type AssetFileRoute, AssetFileRouteStatus, type AssetFileRouteStatusType, type AssetFileMainRouteAware, type AssetFileDownloadLink, type AssetFileImagePreviewNullable, assetFileIsImageFile, assetFileIsVideoFile, assetFileIsAudioFile, type UploadQueue, type UploadQueueItem, UploadQueueItemStatus, type UploadQueueItemStatusType, UploadQueueItemType, type UploadQueueItemTypeType, type CustomDataAware, type CustomDataValue, type CustomDataFormElement, type CustomDataFormElementAttributes, CustomDataFormElementType, CustomDataFormElementTypeDefault, type CustomDataFormElementTypeType, DamAssetType, DamAssetTypeDefault, type DamAssetTypeType, DamAssetStatus, DamAssetStatusDefault, type DamAssetStatusType, type DamPubConfig, type DamPrvConfig, type DamExtSystemConfig, type DamDistributionServiceName, type DamExtSystemConfigItem, type DamExtSystemConfigItemImage, type DamExternalProviderAssetConfig, type DamExternalProviderAssetName, type DamDistributionConfig, type DamDistributionRequirementsConfig, DamDistributionRequirementStrategy, type DamDistributionRequirementStrategyType, type DamDistributionRequirementsCategorySelectConfig, type DamExtSystemAssetTypeExifMetadata, DamDistributionServiceType, type DamDistributionServiceTypeType, DamDistributionStatus, type DamDistributionStatusType, UserAuthType, type UserAuthTypeType, type DamUploadStartResponse, type DamNotificationNameType, DamNotificationName, type DamNotificationListenerOptions, UploadRowRole, type UploadRowRoleType, type UploadSettlement, type UploadSettlementProfile, type UploadSettlementEvent, type UploadSettlementTarget, type UploadSettlePolicy, type UploadRefreshOutcome, type UploadReadOptions, type UploadSettlementScheduler, type UploadSettlementVisibility, type ImageAware, type ImageCreateUpdateAware, type ImageCreateUpdateAwareKeyed, type UploadMetadataToImageMapFn, type UploadMetadataToImageMapItem, type AssetSelectMetadataToImageMapFn, isImageCreateUpdateAware, type ImageMediaCollabValue, type MediaAware, isMediaAware, type DamMediaFromDam, type DamMedia, DamMediaType, type DamMediaTypeType, type DamAuthor, type DamAuthorMinimal, type DamKeyword, type DamKeywordMinimal, DamAuthorType, type DamAuthorTypeType, type DamExtSystem, type DamExtSystemMinimal, type DamCurrentUserDto, type DamAssetLicence, type DamAssetLicenceMinimal, type DamAssetLicenceGroup, type DamUserUpdateDto, type DamUser, type BreadcrumbItem, type Breadcrumbs, type UploadQueueKey, type DamConfigLicenceExtSystemReturnType, useAnzuUserFactory, usePermissionConfigFactory, usePermissionGroupFactory, cloneDeep, isEmpty, isEmptyObject, isObject, isArray, isFunction, isBoolean, isDocId, isNull, isUndefined, isDefined, isInt, isString, isNumber, objectGetValueByPath, objectSetValueByPath, objectDeletePropertyByPath, objectDeepFreeze, stringToInt, stringToFloat, stringToSlug, stringSplitOnFirstOccurrence, stringToKebabCase, stringIsValidEmail, stringToBooleanExact, DATETIME_MIN, DATETIME_MAX, dateTimeEndOfDay, dateTimeStartOfDay, dateTimeNow, dateTimeFriendly, dateTimePretty, dateModifyMinutes, dateToUtc, dateNow, dateTimeToDate, datePretty, dateUtcPretty, dateUtcToday, timePretty, dateDiff, type DateDiffUnit, prettyBytes, prettyDuration, booleanToInteger, arrayItemToggle, arrayFromArgs, arrayFlatten, type NestedArray, arraysHaveSameElements, browserHistoryReplaceUrlByRouter, eventClickBlur, generateUUIDv1, generateUUIDv4, isOneOf, useJobBaseResource, useJobStatus, fetchDamAssetLicenceListByIds, useFetchDamAssetLicenceList, fetchDamAssetLicenceGroupListByIds, fetchDamExtSystemListByIds, fetchDamUserListByIds, useFetchDamUserList, updateDamUser, fetchDamUser, fetchAssetAndCheckForSingleUseByFileIds, fetchAsset, fetchAssetAsCmsMedia, fetchAssetByFileId, type IdsGroupedByLicences, messagesCs, messagesEn, messagesSk, SystemScopeKey, SubjectScopeKey, HTTP_STATUS_OK, HTTP_STATUS_CREATED, HTTP_STATUS_NO_CONTENT, HTTP_STATUS_BAD_REQUEST, HTTP_STATUS_UNAUTHORIZED, HTTP_STATUS_FORBIDDEN, HTTP_STATUS_NOT_FOUND, HTTP_STATUS_UNPROCESSABLE_ENTITY, ROLE_SUPER_ADMIN, NEW_LINE_MARK, COMMON_CONFIG, SORT_BY_SCORE, SORT_BY_SCORE_BEST, SORT_BY_SCORE_DATE, SORT_BY_ID, SortOrder, ImageWidgetUploadConfigKey, useValidate, useCollabInit, useCommonAdminCollabOptions, useCollabCurrentUserId, useCollabState, useCollabField, useCollabRoom, useCollabHelpers, useCollabAnyDataChange, type CollabGatheringBufferDataEvent, useCollabReconnectEventBus, useCollabGatheringBufferDataEventBus, CollabFieldLockType, type CollabFieldLockTypeType, CollabFieldLockStatus, type CollabFieldLockStatusType, type CollabFieldLockStatusPayload, type CollabUserId, type CollabUserIdNullable, type CollabRoom, CollabStatus, type CollabStatusType, type CollabRoomInfo, type CollabRoomsInfo, type CollabFieldDataEnvelope, type CollabFieldData, type CollabFieldName, type CollabFieldLock, type CollabRoomLocks, type CollabRoomData, type CollabRoomPlainData, CollabAccessRoomStatus, type CollabAccessRoomStatusType, CollabChangeRoomLockStatus, type CollabChangeRoomLockStatusType, type CollabFieldLockOptions, CollabRoomJoinStrategy, type CollabRoomJoinStrategyType, type CollabJoinAckOptions, type CollabRoomOptions, CollabRequestToTakeModerationStatus, type CollabRequestToTakeModerationStatusType, CollabRequestToJoinStatus, type CollabRequestToJoinStatusType, type CollabCachedUsersMap, type CollabComponentConfig, COLLAB_FIELD_PREFIX_COMMENT, COLLAB_FIELD_PREFIX_EMBED, useDamConfigStore, useDamConfigStoreOf, type DamConfigStore, useImageStore, type CommonAdminI18n, slovakPluralizationRule, isAnzuApiForbiddenError, axiosErrorResponseIsForbidden, AnzuApiForbiddenError, isAnzuApiResponseCodeError, AnzuApiResponseCodeError, isAnzuApiForbiddenOperationError, axiosErrorResponseHasForbiddenOperationData, AnzuApiForbiddenOperationError, isAnzuApiValidationError, hasAnzuApiValidationErrorSpecific, axiosErrorResponseHasValidationData, AnzuApiValidationError, isAnzuFatalError, AnzuFatalError, isAnzuApiTimeoutError, AnzuApiTimeoutError, AnzuApiCancelledError, isAnzuApiCancelledError, AnzuError, isAnzuError, isAnzuApiAxiosError, AnzuApiAxiosError, type ValidationError, type AnzuApiValidationResponseData, isAnzuApiDependencyExistsError, axiosErrorResponseHasDependencyExistsData, AnzuApiDependencyExistsError, AnzuSystemsCommonAdmin, useCommonVuetifyConfig, createAnzuVuetify, type CreateAnzuVuetifyOptions, loadCommonFonts, getAssetTypeByMimeType, damFileTypeFix, localTimeShiftInSeconds, useSystemBar, AFilterWrapper, AFilterWrapperSidebar, AFilterWrapperSubjectSelect, AFiltersSelected, AFilterBooleanSelect, AFilterInteger, AFilterRemoteAutocomplete, AFilterString, AFilterTimeInterval, AFilterValueObjectOptionsSelect, FilterConfigKey, FilterDataKey, FilterInnerConfigKey, FilterInnerDataKey, ADatatableOrdering, ADatatablePagination, DatatablePaginationKey, AFormRemoteAutocomplete, createFilterRemoteAutocomplete, createRemoteAutocomplete, type CreateRemoteAutocompleteOptions, type RemoteAutocompleteScope, type FilterRemoteAutocompleteComponent, type FilterRemoteAutocompleteProps, type RemoteAutocompleteComponent, type RemoteAutocompleteProps, type RemoteInnerFilter, type RemoteSelectActions, AFormRemoteAutocompleteWithCached, buildFilterHash, createFilter, createFilterStore, isRouterSafeHash, useFilterHelpers, type FilterConfig, type FilterData, type FilterStoreIdentifier, type MakeFilterOption, type AllowedFilterValues, type FilterField, type FilterType, type FilterVariant, TimeIntervalSpecialOptions, type TimeIntervalToolsValue, type TimeIntervalSpecialOptionsType, type Pagination, useApiFetchByIds, useApiFetchItems, useApiFetchList, useApiCommand, useApiRequest, defineApiClient, startWithEnvConfig, checkForNewVersion, requestAppReload, RELOAD_VETO_GRACE, skipUrlPrefixes, type ApiClientSetup, type ApiClientRequestInterceptor, type ApiClientResponseInterceptor, type UseApiRequestParams, type ExecuteRequestParams, type UseApiRequestReturnType, type UseApiFetchListParams, type FetchListParams, type UseApiFetchListReturnType, type UseApiFetchByIdsParams, type FetchByIdsParams, type UseApiFetchByIdsReturnType, type UseApiFetchItemsParams, type FetchItemsParams, type ItemsShape, type UseApiFetchItemsReturnType, type UseApiFetchListBatchParams, type FetchListBatchParams, type UseApiFetchListBatchReturnType, defaultApiErrorLogger, apiErrorStatus, apiErrorIsReported, setApiErrorLogger, type ApiErrorContext, type ApiErrorLogger, useApiFetchListBatch, useApiQueryBuilder, generateListQuery, usePagination, createDatatableColumnsConfig, useSubjectSelect, ASubjectSelect, AListEditor, ASortableListEditor, ANestedSortableListEditor, AUnsavedConfirmDialog, useUnsavedChangesGuard, useUnsavedSection, type UnsavedSectionDescriptor, type UnsavedSectionSource, useListEditorController, type ListEditorHandle, type ExposedListEditorHandle, type UseListEditorControllerOptions, type ListEditorChanges, type ListEditorValidationResult, type GetKey, type PositionOption, type PositionStrategy, type PositionAction, renumberPositions, sortByPosition, sortByPositionDeep, type RenumberPositionsOptions, nextListEditorTempId, type NestedViewItem, useNestedListEditorController, type NestedListEditorHandle, type ExposedNestedListEditorHandle, type ExposedNestedSortableListEditorHandle, type NestedSortableListEditorExtras, type UseNestedListEditorControllerOptions, type NestedListEditorChanges, type ListEditorKey, type ListEditorValidationState, type ListViewItem, type NestedPositionHint, type NestedTree, type NestedTreeNode, type PositionHint, useJobApi, type AxiosClientFn, useUserAdminConfigApi, type UserAdminConfig, UserAdminConfigType, type UserAdminConfigTypeType, UserAdminConfigLayoutType, type UserAdminConfigLayoutTypeType, type UserAdminConfigDataFilterBookmark, type UserAdminConfigDataPinnedWidgets, useUserAdminConfigFactory, ALogListView, ALogDetailView, LogType, LogTypeDefault, type LogTypeType, isLogType, DEFAULT_LOG_PATHS, type LogPaths, type LogTimeWindow, APermissionGroupDatatable, APermissionGroupDetail, APermissionGroupManage, usePermissionGroupActions, type PermissionGroupActionsParams, AAnzuUserDatatable, AAnzuUserForm, AUserCopyPermissionsDialog, useAnzuUserActions, type AnzuUserActionsParams, defineUserSystemDescriptor, descriptorMayWrite, type UserSystemWriteAction, resolveProbeEndpoint, resolveMetadataWrite, resolveEnabledWrite, resolveCreateEndpoint, type UserSystemDescriptor, type AnyUserSystemDescriptor, type UserSystemEndpoints, type AnzuUserEndpointPair, type BaseUserEndpointPair, type UserSystemExtraState, type UserSystemManageTarget, AUserTabsShell, OTHER_SYSTEMS_TAB, USER_PROBE_ENTITY, type UserSystemRefreshHook, AUserSystemOverview, };
|
|
301
|
+
export { ACard, AProgress, ARow, AChipNoLink, AAlerts, AActionbar, AActionbarTarget, ALayoutLoader, ALayoutSwitch, actionbarSlot, createTeleportSlot, type TeleportSlot, ABooleanValue, ASystemEntityScope, AFormTextField, AFormTextarea, AFormDatetimePicker, AFormFlagDatetimePicker, AFormRemoteCheckbox, AFormRemoteSwitch, AFormSwitch, AFormValueObjectOptionsSelect, ADatetime, ADatetimePicker, ADatatableConfigButton, ADialogToolbar, ACreateDialog, AJobStatusChip, ACachedChip, ACachedUserChip, AAdminSwitcher, ATimeTrackingFields, Acl, ACopyText, AIconGroup, AUserAndTimeTrackingFields, AActionCloseButtonHistory, AActionCreateButton, AActionDeleteButton, AActionEditButton, AActionSaveAndCloseButton, AActionSaveButton, ATableCopyIdButton, ATableDetailButton, ATableEditButton, ABtnSplit, AThemeSelect, ALanguageSelect, ASystemBar, AAnzuUserAvatar, AAvatarColorPicker, ACurrentUserDropdown, AJobDetailCommon, AJobPriorityChip, AJobBaseCreateForm, ACustomDataForm, ACustomDataFormElement, AImageWidget, AImageWidgetInner, AImageMediaWidget, AImageWidgetSimple, AMediaWidgetSimple, AImageWidgetMultiple, AImageWidgetMultipleInner, AImageWidgetMultipleSimple, AImageMassOperations, AImagePublicInput, ADamAssetImageRoiSelect, ACollabLockedByUser, ACollabManagement, AFileInput, AAssetSelect, AAssetListInner, ABooleanSelect, ADamExtSystemRemoteAutocomplete, ADamExternalProviderAssetSelect, ADamDistributionServiceSelect, ADamAssetLicenceRemoteAutocomplete, ADamAssetLicenceGroupRemoteAutocomplete, ADamAuthorFilterRemoteAutocomplete, ADamKeywordFilterRemoteAutocomplete, ADamUserFilterRemoteAutocomplete, ADamUserRemoteAutocomplete, ADamAdminAssetLink, ALoginView, ALogoutView, AUnauthorizedView, ANotFoundView, AGenericView, useRouteHistory, type NavigateBackOptions, type NavigateBackTarget, type RouteHistoryEntry, handleRecordLoadError, useRecordPage, type UseRecordPageOptions, type UseRecordPageReturn, defineRecordLoader, defineRecordSave, trackNavigation, isNavigationPending, usePageNavigation, type UsePageNavigationReturn, createNavigationErrorHandler, type NavigationErrorHandlerOptions, useRemainingTime, useAlerts, useTheme, defineCached, useCachedItem, Theme, type ThemeType, useLanguageSettings, modifyLanguageSettings, useLoginStatus, generateDatatableMinMaxSelectStrategy, useCustomDataFormElementType, useDamConfigState, useUploadQueueItemFactory, useDamUploadChunkSize, useDamAcceptTypeAndSizeHelper, useAssetSuggestions, destroyDamNotifications, initDamNotifications, useDamNotifications, useDamNotificationsConnection, createUploadSettlement, uploadSettlementRuntime, UPLOAD_POLL_SCHEDULE, useDropzoneGlobalDragState, useDamKeywordFactory, useDamAuthorFactory, useDamAuthorType, useDamDistributionServiceType, useDamAssetLicenceInnerFilter, useImageActions, useCommonAdminImageOptions, defineAuth, useAclAllowed, AuthUnavailableError, type AuthCookieState, createRefreshRequestInterceptor, createRefreshSession, isInCauseChain, type RefreshResult, SessionExpiredError, defineBreadcrumbs, useDamCachedUsers, useUnreleasedFeatures, useDebugFeatures, useSentry, useUserActivity, type GrantType, Grant, useGrant, type GrantOriginType, GrantOrigin, GrantOriginDefault, useGrantOrigin, LogLevel, type LogLevelType, type IntegerId, type IntegerIdNullable, type DocId, type DocIdNullable, type DatetimeUTCNullable, type DatetimeUTC, type DateUTC, type DatetimePickerType, type AnzuUser, type BaseUser, type AnzuUserMinimal, type AnzuUserAndTimeTrackingAware, type ValueObjectOption, type CreatedByAware, type PermissionConfig, type PermissionTranslationGroup, type PermissionGroup, type PermissionGroupMinimal, type VuetifyIconValue, type JobBase, type JobUserDataDelete, JOB_RESOURCE_USER_DATA_DELETE, JobStatus, JobStatusDefault, type JobStatusType, type JobBaseResource, useCommonJobFactory, type AclValue, type AclRegistry, type AclValueOf, type RegisteredAclValue, type Permissions, type PluginOptions, type CommonAdminImageOptions, type CommonAdminCoreDamOptions, type CommonAdminCollabOptions, type LanguageCode, type Immutable, type ResourceNameSystemAware, type ValidationScope, type AFormFieldValidation, type CommonAdminGlobalComponents, type ACreateDialogValidation, type Log, type ApiInfiniteResponseList, type DatatableOrderingOption, type DatatableOrderingOptions, type DatatableSortBy, type SortOrderType, type ObjectLeaves, type UniqueValues, ensureUniqueValues, type CachedItem, type AddToCachedArgs, type CachedUnresolvedReason, type DefineCachedOptions, type RecordWasType, type UrlParams, type AssetSelectReturnData, AssetSelectReturnType, type AssetSelectReturnTypeType, type SortableItemDataAware, type AssetFileProperties, type AssetSearchListItemDto, type AssetDetailItemDto, type AssetMetadataDto, type AssetCustomData, type AssetMetadataSuggestions, AssetFileFailReason, type AssetFileFailReasonType, AssetFileProcessStatus, type AssetFileProcessStatusType, AssetFileLinkType, type AssetFileLinkTypeType, type AssetFile, type AssetFileDocument, type AssetFileVideo, type AssetFileAudio, type AssetFileImage, type AssetFileNullable, type AssetFileLink, type AssetFileLinks, type AssetFileRoute, AssetFileRouteStatus, type AssetFileRouteStatusType, type AssetFileMainRouteAware, type AssetFileDownloadLink, type AssetFileImagePreviewNullable, assetFileIsImageFile, assetFileIsVideoFile, assetFileIsAudioFile, type UploadQueue, type UploadQueueItem, UploadQueueItemStatus, type UploadQueueItemStatusType, UploadQueueItemType, type UploadQueueItemTypeType, type CustomDataAware, type CustomDataValue, type CustomDataFormElement, type CustomDataFormElementAttributes, CustomDataFormElementType, CustomDataFormElementTypeDefault, type CustomDataFormElementTypeType, DamAssetType, DamAssetTypeDefault, type DamAssetTypeType, DamAssetStatus, DamAssetStatusDefault, type DamAssetStatusType, type DamPubConfig, type DamPrvConfig, type DamExtSystemConfig, type DamDistributionServiceName, type DamExtSystemConfigItem, type DamExtSystemConfigItemImage, type DamExternalProviderAssetConfig, type DamExternalProviderAssetName, type DamDistributionConfig, type DamDistributionRequirementsConfig, DamDistributionRequirementStrategy, type DamDistributionRequirementStrategyType, type DamDistributionRequirementsCategorySelectConfig, type DamExtSystemAssetTypeExifMetadata, DamDistributionServiceType, type DamDistributionServiceTypeType, DamDistributionStatus, type DamDistributionStatusType, UserAuthType, type UserAuthTypeType, type DamUploadStartResponse, type DamNotificationNameType, DamNotificationName, type DamNotificationListenerOptions, UploadRowRole, type UploadRowRoleType, type UploadSettlement, type UploadSettlementProfile, type UploadSettlementEvent, type UploadSettlementTarget, type UploadSettlePolicy, type UploadRefreshOutcome, type UploadReadOptions, type UploadSettlementScheduler, type UploadSettlementVisibility, type ImageAware, type ImageCreateUpdateAware, type ImageCreateUpdateAwareKeyed, type UploadMetadataToImageMapFn, type UploadMetadataToImageMapItem, type AssetSelectMetadataToImageMapFn, isImageCreateUpdateAware, type ImageMediaCollabValue, type MediaAware, isMediaAware, type DamMediaFromDam, type DamMedia, DamMediaType, type DamMediaTypeType, type DamAuthor, type DamAuthorMinimal, type DamKeyword, type DamKeywordMinimal, DamAuthorType, type DamAuthorTypeType, type DamExtSystem, type DamExtSystemMinimal, type DamCurrentUserDto, type DamAssetLicence, type DamAssetLicenceMinimal, type DamAssetLicenceGroup, type DamUserUpdateDto, type DamUser, type BreadcrumbItem, type Breadcrumbs, type UploadQueueKey, type DamConfigLicenceExtSystemReturnType, useAnzuUserFactory, usePermissionConfigFactory, usePermissionGroupFactory, cloneDeep, isEmpty, isEmptyObject, isObject, isArray, isFunction, isBoolean, isDocId, isNull, isUndefined, isDefined, isInt, isString, isNumber, objectGetValueByPath, objectSetValueByPath, objectDeletePropertyByPath, objectDeepFreeze, stringToInt, stringToFloat, stringToSlug, stringSplitOnFirstOccurrence, stringToKebabCase, stringIsValidEmail, stringToBooleanExact, DATETIME_MIN, DATETIME_MAX, dateTimeEndOfDay, dateTimeStartOfDay, dateTimeNow, dateTimeFriendly, dateTimePretty, dateModifyMinutes, dateToUtc, dateNow, dateTimeToDate, datePretty, dateUtcPretty, dateUtcToday, timePretty, dateDiff, type DateDiffUnit, prettyBytes, prettyDuration, booleanToInteger, arrayItemToggle, arrayFromArgs, arrayFlatten, type NestedArray, arraysHaveSameElements, browserHistoryReplaceUrlByRouter, eventClickBlur, generateUUIDv1, generateUUIDv4, isOneOf, useJobBaseResource, useJobStatus, fetchDamAssetLicenceListByIds, useFetchDamAssetLicenceList, fetchDamAssetLicenceGroupListByIds, fetchDamExtSystemListByIds, fetchDamUserListByIds, useFetchDamUserList, updateDamUser, fetchDamUser, fetchAssetAndCheckForSingleUseByFileIds, fetchAsset, fetchAssetAsCmsMedia, fetchAssetByFileId, type IdsGroupedByLicences, messagesCs, messagesEn, messagesSk, SystemScopeKey, SubjectScopeKey, HTTP_STATUS_OK, HTTP_STATUS_CREATED, HTTP_STATUS_NO_CONTENT, HTTP_STATUS_BAD_REQUEST, HTTP_STATUS_UNAUTHORIZED, HTTP_STATUS_FORBIDDEN, HTTP_STATUS_NOT_FOUND, HTTP_STATUS_UNPROCESSABLE_ENTITY, ROLE_SUPER_ADMIN, NEW_LINE_MARK, COMMON_CONFIG, SORT_BY_SCORE, SORT_BY_SCORE_BEST, SORT_BY_SCORE_DATE, SORT_BY_ID, SortOrder, ImageWidgetUploadConfigKey, useValidate, useCollabInit, useCommonAdminCollabOptions, useCollabCurrentUserId, useCollabState, useCollabField, useCollabRoom, useCollabHelpers, useCollabAnyDataChange, type CollabGatheringBufferDataEvent, useCollabReconnectEventBus, useCollabGatheringBufferDataEventBus, CollabFieldLockType, type CollabFieldLockTypeType, CollabFieldLockStatus, type CollabFieldLockStatusType, type CollabFieldLockStatusPayload, type CollabUserId, type CollabUserIdNullable, type CollabRoom, CollabStatus, type CollabStatusType, type CollabRoomInfo, type CollabRoomsInfo, type CollabFieldDataEnvelope, type CollabFieldData, type CollabFieldName, type CollabFieldLock, type CollabRoomLocks, type CollabRoomData, type CollabRoomPlainData, CollabAccessRoomStatus, type CollabAccessRoomStatusType, CollabChangeRoomLockStatus, type CollabChangeRoomLockStatusType, type CollabFieldLockOptions, CollabRoomJoinStrategy, type CollabRoomJoinStrategyType, type CollabJoinAckOptions, type CollabRoomOptions, CollabRequestToTakeModerationStatus, type CollabRequestToTakeModerationStatusType, CollabRequestToJoinStatus, type CollabRequestToJoinStatusType, type CollabCachedUsersMap, type CollabComponentConfig, COLLAB_FIELD_PREFIX_COMMENT, COLLAB_FIELD_PREFIX_EMBED, useDamConfigStore, useDamConfigStoreOf, type DamConfigStore, useImageStore, type CommonAdminI18n, slovakPluralizationRule, isAnzuApiForbiddenError, axiosErrorResponseIsForbidden, AnzuApiForbiddenError, isAnzuApiResponseCodeError, AnzuApiResponseCodeError, isAnzuApiForbiddenOperationError, axiosErrorResponseHasForbiddenOperationData, AnzuApiForbiddenOperationError, isAnzuApiValidationError, hasAnzuApiValidationErrorSpecific, axiosErrorResponseHasValidationData, AnzuApiValidationError, isAnzuFatalError, AnzuFatalError, isAnzuApiTimeoutError, AnzuApiTimeoutError, AnzuApiCancelledError, isAnzuApiCancelledError, AnzuError, isAnzuError, isAnzuApiAxiosError, AnzuApiAxiosError, type ValidationError, type AnzuApiValidationResponseData, isAnzuApiDependencyExistsError, axiosErrorResponseHasDependencyExistsData, AnzuApiDependencyExistsError, AnzuSystemsCommonAdmin, useCommonVuetifyConfig, createAnzuVuetify, type CreateAnzuVuetifyOptions, loadCommonFonts, getAssetTypeByMimeType, damFileTypeFix, localTimeShiftInSeconds, useSystemBar, AFilterWrapper, AFilterWrapperSidebar, AFilterWrapperSubjectSelect, AFiltersSelected, AFilterBooleanSelect, AFilterInteger, AFilterRemoteAutocomplete, AFilterString, AFilterTimeInterval, AFilterValueObjectOptionsSelect, FilterConfigKey, FilterDataKey, FilterInnerConfigKey, FilterInnerDataKey, ADatatableOrdering, ADatatablePagination, DatatablePaginationKey, AFormRemoteAutocomplete, createFilterRemoteAutocomplete, createRemoteAutocomplete, type CreateRemoteAutocompleteOptions, type RemoteAutocompleteScope, type FilterRemoteAutocompleteComponent, type FilterRemoteAutocompleteProps, type RemoteAutocompleteComponent, type RemoteAutocompleteProps, type RemoteInnerFilter, type RemoteSelectActions, AFormRemoteAutocompleteWithCached, buildFilterHash, createFilter, createFilterStore, isRouterSafeHash, useFilterHelpers, useDatatableList, type FilterHelpersMoreOptions, type FilterConfig, type FilterData, type FilterStoreIdentifier, type MakeFilterOption, type AllowedFilterValues, type FilterField, type FilterType, type FilterVariant, TimeIntervalSpecialOptions, type TimeIntervalToolsValue, type TimeIntervalSpecialOptionsType, type Pagination, useApiFetchByIds, useApiFetchItems, useApiFetchList, useApiCommand, useApiRequest, defineApiClient, startWithEnvConfig, checkForNewVersion, requestAppReload, RELOAD_VETO_GRACE, skipUrlPrefixes, type ApiClientSetup, type ApiClientRequestInterceptor, type ApiClientResponseInterceptor, type UseApiRequestParams, type ExecuteRequestParams, type UseApiRequestReturnType, type UseApiFetchListParams, type FetchListParams, type UseApiFetchListReturnType, type UseApiFetchByIdsParams, type FetchByIdsParams, type UseApiFetchByIdsReturnType, type UseApiFetchItemsParams, type FetchItemsParams, type ItemsShape, type UseApiFetchItemsReturnType, type UseApiFetchListBatchParams, type FetchListBatchParams, type UseApiFetchListBatchReturnType, defaultApiErrorLogger, apiErrorStatus, apiErrorIsReported, setApiErrorLogger, type ApiErrorContext, type ApiErrorLogger, useApiFetchListBatch, useApiQueryBuilder, generateListQuery, usePagination, createDatatableColumnsConfig, useSubjectSelect, ASubjectSelect, AListEditor, ASortableListEditor, ANestedSortableListEditor, AUnsavedConfirmDialog, useUnsavedChangesGuard, useUnsavedSection, type UnsavedSectionDescriptor, type UnsavedSectionSource, useListEditorController, type ListEditorHandle, type ExposedListEditorHandle, type UseListEditorControllerOptions, type ListEditorChanges, type ListEditorValidationResult, type GetKey, type PositionOption, type PositionStrategy, type PositionAction, renumberPositions, sortByPosition, sortByPositionDeep, type RenumberPositionsOptions, nextListEditorTempId, type NestedViewItem, useNestedListEditorController, type NestedListEditorHandle, type ExposedNestedListEditorHandle, type ExposedNestedSortableListEditorHandle, type NestedSortableListEditorExtras, type UseNestedListEditorControllerOptions, type NestedListEditorChanges, type ListEditorKey, type ListEditorValidationState, type ListViewItem, type NestedPositionHint, type NestedTree, type NestedTreeNode, type PositionHint, useJobApi, type AxiosClientFn, useUserAdminConfigApi, type UserAdminConfig, UserAdminConfigType, type UserAdminConfigTypeType, UserAdminConfigLayoutType, type UserAdminConfigLayoutTypeType, type UserAdminConfigDataFilterBookmark, type UserAdminConfigDataPinnedWidgets, useUserAdminConfigFactory, ALogListView, ALogDetailView, LogType, LogTypeDefault, type LogTypeType, isLogType, DEFAULT_LOG_PATHS, type LogPaths, type LogTimeWindow, APermissionGroupDatatable, APermissionGroupDetail, APermissionGroupManage, usePermissionGroupActions, type PermissionGroupActionsParams, AAnzuUserDatatable, AAnzuUserForm, AUserCopyPermissionsDialog, useAnzuUserActions, type AnzuUserActionsParams, defineUserSystemDescriptor, descriptorMayWrite, type UserSystemWriteAction, resolveProbeEndpoint, resolveMetadataWrite, resolveEnabledWrite, resolveCreateEndpoint, type UserSystemDescriptor, type AnyUserSystemDescriptor, type UserSystemEndpoints, type AnzuUserEndpointPair, type BaseUserEndpointPair, type UserSystemExtraState, type UserSystemManageTarget, AUserTabsShell, OTHER_SYSTEMS_TAB, USER_PROBE_ENTITY, type UserSystemRefreshHook, AUserSystemOverview, };
|
|
301
302
|
export { createCachedChip } from './domains/cached/composables/createCachedChip';
|
|
302
303
|
export type { CreateCachedChipOptions } from './domains/cached/composables/createCachedChip';
|
|
303
304
|
export { createUserAndTimeTrackingFields } from './domains/cached/composables/createUserAndTimeTrackingFields';
|
|
@@ -96,7 +96,7 @@ var u = ":host([hidden]){display:none!important}", d = /left|top|width|height/i,
|
|
|
96
96
|
a(n) && (r = n, n = ""), n ||= this.$name || this.name, n = l(n), e && t.customElements && !t.customElements.get(n) && customElements.define(n, this, r);
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
|
-
_.$version = "2.
|
|
99
|
+
_.$version = "2.3.1";
|
|
100
100
|
//#endregion
|
|
101
101
|
export { _ as default };
|
|
102
102
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.esm.raw.js","names":["style","REGEXP_SUFFIX","DEFAULT_SHADOW_ROOT_MODE","shadowRoots","styleSheets","tagNames","supportsAdoptedStyleSheets","WINDOW","CropperElement","name","newValue","oldValue","propertyName","toCamelCase","oldPropertyValue","newPropertyValue","styleSheet","styles","toKebabCase","isNaN","property","attribute","value","isUndefined","shadow","template","slot","properties","isNumber","emit","type","detail","options","nextTick","callback","isObject","IS_BROWSER"],"sources":["../../../../../node_modules/@cropper/element/dist/element.esm.raw.js"],"sourcesContent":["import { WINDOW, toCamelCase, toKebabCase, isNaN, isUndefined, isNumber, emit, nextTick, isObject, IS_BROWSER } from '@cropper/utils';\n\nvar style = `:host([hidden]){display:none!important}`;\n\nconst REGEXP_SUFFIX = /left|top|width|height/i;\nconst DEFAULT_SHADOW_ROOT_MODE = 'open';\nconst shadowRoots = new WeakMap();\nconst styleSheets = new WeakMap();\nconst tagNames = new Map();\nconst supportsAdoptedStyleSheets = Boolean(WINDOW.document\n && Array.isArray(WINDOW.document.adoptedStyleSheets)\n && WINDOW.CSSStyleSheet\n && 'replaceSync' in WINDOW.CSSStyleSheet.prototype);\nclass CropperElement extends HTMLElement {\n get $sharedStyle() {\n return `${this.themeColor ? `:host{--theme-color: ${this.themeColor};}` : ''}${style}`;\n }\n constructor() {\n var _a, _b;\n super();\n this.shadowRootMode = DEFAULT_SHADOW_ROOT_MODE;\n this.slottable = true;\n const name = (_b = (_a = Object.getPrototypeOf(this)) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.$name;\n if (name) {\n tagNames.set(name, this.tagName.toLowerCase());\n }\n }\n static get observedAttributes() {\n return [\n 'shadow-root-mode',\n 'slottable',\n 'theme-color',\n ];\n }\n // Convert attribute to property\n attributeChangedCallback(name, oldValue, newValue) {\n if (Object.is(newValue, oldValue)) {\n return;\n }\n const propertyName = toCamelCase(name);\n const oldPropertyValue = this[propertyName];\n let newPropertyValue = newValue;\n switch (typeof oldPropertyValue) {\n case 'boolean':\n newPropertyValue = newValue !== null && newValue !== 'false';\n break;\n case 'number':\n newPropertyValue = Number(newValue);\n break;\n }\n this[propertyName] = newPropertyValue;\n switch (name) {\n case 'theme-color': {\n const styleSheet = styleSheets.get(this);\n const styles = this.$sharedStyle;\n if (styleSheet && styles) {\n if (supportsAdoptedStyleSheets) {\n styleSheet.replaceSync(styles);\n }\n else {\n styleSheet.textContent = styles;\n }\n }\n break;\n }\n }\n }\n // Convert property to attribute\n $propertyChangedCallback(name, oldValue, newValue) {\n if (Object.is(newValue, oldValue)) {\n return;\n }\n name = toKebabCase(name);\n switch (typeof newValue) {\n case 'boolean':\n if (newValue === true) {\n if (!this.hasAttribute(name)) {\n this.setAttribute(name, '');\n }\n }\n else {\n this.removeAttribute(name);\n }\n break;\n case 'number':\n if (isNaN(newValue)) {\n newValue = '';\n }\n else {\n newValue = String(newValue);\n }\n // Fall through\n // case 'string':\n // eslint-disable-next-line no-fallthrough\n default:\n if (newValue) {\n if (this.getAttribute(name) !== newValue) {\n this.setAttribute(name, newValue);\n }\n }\n else {\n this.removeAttribute(name);\n }\n }\n }\n connectedCallback() {\n // Observe properties after observed attributes\n Object.getPrototypeOf(this).constructor.observedAttributes.forEach((attribute) => {\n const property = toCamelCase(attribute);\n let value = this[property];\n if (!isUndefined(value)) {\n this.$propertyChangedCallback(property, undefined, value);\n }\n Object.defineProperty(this, property, {\n enumerable: true,\n configurable: true,\n get() {\n return value;\n },\n set(newValue) {\n const oldValue = value;\n value = newValue;\n this.$propertyChangedCallback(property, oldValue, newValue);\n },\n });\n });\n const shadow = this.shadowRoot || this.attachShadow({\n mode: this.shadowRootMode || DEFAULT_SHADOW_ROOT_MODE,\n });\n shadowRoots.set(this, shadow);\n styleSheets.set(this, this.$addStyles(this.$sharedStyle));\n if (this.$style) {\n this.$addStyles(this.$style);\n }\n if (this.$template) {\n const template = document.createElement('template');\n template.innerHTML = this.$template;\n shadow.appendChild(template.content);\n }\n if (this.slottable) {\n const slot = document.createElement('slot');\n shadow.appendChild(slot);\n }\n }\n disconnectedCallback() {\n if (styleSheets.has(this)) {\n styleSheets.delete(this);\n }\n if (shadowRoots.has(this)) {\n shadowRoots.delete(this);\n }\n }\n // eslint-disable-next-line class-methods-use-this\n $getTagNameOf(name) {\n var _a;\n return (_a = tagNames.get(name)) !== null && _a !== void 0 ? _a : name;\n }\n $setStyles(properties) {\n Object.keys(properties).forEach((property) => {\n let value = properties[property];\n if (isNumber(value)) {\n if (value !== 0 && REGEXP_SUFFIX.test(property)) {\n value = `${value}px`;\n }\n else {\n value = String(value);\n }\n }\n this.style[property] = value;\n });\n return this;\n }\n /**\n * Outputs the shadow root of the element.\n * @returns {ShadowRoot} Returns the shadow root.\n */\n $getShadowRoot() {\n return this.shadowRoot || shadowRoots.get(this);\n }\n /**\n * Adds styles to the shadow root.\n * @param {string} styles The styles to add.\n * @returns {CSSStyleSheet|HTMLStyleElement} Returns the generated style sheet.\n */\n $addStyles(styles) {\n let styleSheet;\n const shadow = this.$getShadowRoot();\n if (supportsAdoptedStyleSheets) {\n styleSheet = new CSSStyleSheet();\n styleSheet.replaceSync(styles);\n shadow.adoptedStyleSheets = shadow.adoptedStyleSheets.concat(styleSheet);\n }\n else {\n styleSheet = document.createElement('style');\n styleSheet.textContent = styles;\n shadow.appendChild(styleSheet);\n }\n return styleSheet;\n }\n /**\n * Dispatches an event at the element.\n * @param {string} type The name of the event.\n * @param {*} [detail] The data passed when initializing the event.\n * @param {CustomEventInit} [options] The other event options.\n * @returns {boolean} Returns the result value.\n */\n $emit(type, detail, options) {\n return emit(this, type, detail, options);\n }\n /**\n * Defers the callback to be executed after the next DOM update cycle.\n * @param {Function} [callback] The callback to execute after the next DOM update cycle.\n * @returns {Promise} A promise that resolves to nothing.\n */\n $nextTick(callback) {\n return nextTick(this, callback);\n }\n /**\n * Defines the constructor as a new custom element.\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define}\n * @param {string|object} [name] The element name.\n * @param {object} [options] The element definition options.\n */\n static $define(name, options) {\n if (isObject(name)) {\n options = name;\n name = '';\n }\n if (!name) {\n name = this.$name || this.name;\n }\n name = toKebabCase(name);\n if (IS_BROWSER && WINDOW.customElements && !WINDOW.customElements.get(name)) {\n customElements.define(name, this, options);\n }\n }\n}\nCropperElement.$version = '2.2.0';\n\nexport { CropperElement as default };\n"],"ignoreList":[0],"m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DEFAULT_SHADOW_ROOT_MODE","shadowRoots","styleSheets","tagNames","supportsAdoptedStyleSheets","WINDOW","CropperElement","name","newValue","oldValue","propertyName","toCamelCase","oldPropertyValue","newPropertyValue","styleSheet","styles","toKebabCase","isNaN","property","attribute","value","isUndefined","shadow","template","slot","properties","isNumber","emit","type","detail","options","nextTick","callback","isObject","IS_BROWSER"],"sources":["../../../../../node_modules/@cropper/element/dist/element.esm.raw.js"],"sourcesContent":["import { WINDOW, toCamelCase, toKebabCase, isNaN, isUndefined, isNumber, emit, nextTick, isObject, IS_BROWSER } from '@cropper/utils';\n\nvar style = `:host([hidden]){display:none!important}`;\n\nconst REGEXP_SUFFIX = /left|top|width|height/i;\nconst DEFAULT_SHADOW_ROOT_MODE = 'open';\nconst shadowRoots = new WeakMap();\nconst styleSheets = new WeakMap();\nconst tagNames = new Map();\nconst supportsAdoptedStyleSheets = Boolean(WINDOW.document\n && Array.isArray(WINDOW.document.adoptedStyleSheets)\n && WINDOW.CSSStyleSheet\n && 'replaceSync' in WINDOW.CSSStyleSheet.prototype);\nclass CropperElement extends HTMLElement {\n get $sharedStyle() {\n return `${this.themeColor ? `:host{--theme-color: ${this.themeColor};}` : ''}${style}`;\n }\n constructor() {\n var _a, _b;\n super();\n this.shadowRootMode = DEFAULT_SHADOW_ROOT_MODE;\n this.slottable = true;\n const name = (_b = (_a = Object.getPrototypeOf(this)) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.$name;\n if (name) {\n tagNames.set(name, this.tagName.toLowerCase());\n }\n }\n static get observedAttributes() {\n return [\n 'shadow-root-mode',\n 'slottable',\n 'theme-color',\n ];\n }\n // Convert attribute to property\n attributeChangedCallback(name, oldValue, newValue) {\n if (Object.is(newValue, oldValue)) {\n return;\n }\n const propertyName = toCamelCase(name);\n const oldPropertyValue = this[propertyName];\n let newPropertyValue = newValue;\n switch (typeof oldPropertyValue) {\n case 'boolean':\n newPropertyValue = newValue !== null && newValue !== 'false';\n break;\n case 'number':\n newPropertyValue = Number(newValue);\n break;\n }\n this[propertyName] = newPropertyValue;\n switch (name) {\n case 'theme-color': {\n const styleSheet = styleSheets.get(this);\n const styles = this.$sharedStyle;\n if (styleSheet && styles) {\n if (supportsAdoptedStyleSheets) {\n styleSheet.replaceSync(styles);\n }\n else {\n styleSheet.textContent = styles;\n }\n }\n break;\n }\n }\n }\n // Convert property to attribute\n $propertyChangedCallback(name, oldValue, newValue) {\n if (Object.is(newValue, oldValue)) {\n return;\n }\n name = toKebabCase(name);\n switch (typeof newValue) {\n case 'boolean':\n if (newValue === true) {\n if (!this.hasAttribute(name)) {\n this.setAttribute(name, '');\n }\n }\n else {\n this.removeAttribute(name);\n }\n break;\n case 'number':\n if (isNaN(newValue)) {\n newValue = '';\n }\n else {\n newValue = String(newValue);\n }\n // Fall through\n // case 'string':\n // eslint-disable-next-line no-fallthrough\n default:\n if (newValue) {\n if (this.getAttribute(name) !== newValue) {\n this.setAttribute(name, newValue);\n }\n }\n else {\n this.removeAttribute(name);\n }\n }\n }\n connectedCallback() {\n // Observe properties after observed attributes\n Object.getPrototypeOf(this).constructor.observedAttributes.forEach((attribute) => {\n const property = toCamelCase(attribute);\n let value = this[property];\n if (!isUndefined(value)) {\n this.$propertyChangedCallback(property, undefined, value);\n }\n Object.defineProperty(this, property, {\n enumerable: true,\n configurable: true,\n get() {\n return value;\n },\n set(newValue) {\n const oldValue = value;\n value = newValue;\n this.$propertyChangedCallback(property, oldValue, newValue);\n },\n });\n });\n const shadow = this.shadowRoot || this.attachShadow({\n mode: this.shadowRootMode || DEFAULT_SHADOW_ROOT_MODE,\n });\n shadowRoots.set(this, shadow);\n styleSheets.set(this, this.$addStyles(this.$sharedStyle));\n if (this.$style) {\n this.$addStyles(this.$style);\n }\n if (this.$template) {\n const template = document.createElement('template');\n template.innerHTML = this.$template;\n shadow.appendChild(template.content);\n }\n if (this.slottable) {\n const slot = document.createElement('slot');\n shadow.appendChild(slot);\n }\n }\n disconnectedCallback() {\n if (styleSheets.has(this)) {\n styleSheets.delete(this);\n }\n if (shadowRoots.has(this)) {\n shadowRoots.delete(this);\n }\n }\n // eslint-disable-next-line class-methods-use-this\n $getTagNameOf(name) {\n var _a;\n return (_a = tagNames.get(name)) !== null && _a !== void 0 ? _a : name;\n }\n $setStyles(properties) {\n Object.keys(properties).forEach((property) => {\n let value = properties[property];\n if (isNumber(value)) {\n if (value !== 0 && REGEXP_SUFFIX.test(property)) {\n value = `${value}px`;\n }\n else {\n value = String(value);\n }\n }\n this.style[property] = value;\n });\n return this;\n }\n /**\n * Outputs the shadow root of the element.\n * @returns {ShadowRoot} Returns the shadow root.\n */\n $getShadowRoot() {\n return this.shadowRoot || shadowRoots.get(this);\n }\n /**\n * Adds styles to the shadow root.\n * @param {string} styles The styles to add.\n * @returns {CSSStyleSheet|HTMLStyleElement} Returns the generated style sheet.\n */\n $addStyles(styles) {\n let styleSheet;\n const shadow = this.$getShadowRoot();\n if (supportsAdoptedStyleSheets) {\n styleSheet = new CSSStyleSheet();\n styleSheet.replaceSync(styles);\n shadow.adoptedStyleSheets = shadow.adoptedStyleSheets.concat(styleSheet);\n }\n else {\n styleSheet = document.createElement('style');\n styleSheet.textContent = styles;\n shadow.appendChild(styleSheet);\n }\n return styleSheet;\n }\n /**\n * Dispatches an event at the element.\n * @param {string} type The name of the event.\n * @param {*} [detail] The data passed when initializing the event.\n * @param {CustomEventInit} [options] The other event options.\n * @returns {boolean} Returns the result value.\n */\n $emit(type, detail, options) {\n return emit(this, type, detail, options);\n }\n /**\n * Defers the callback to be executed after the next DOM update cycle.\n * @param {Function} [callback] The callback to execute after the next DOM update cycle.\n * @returns {Promise} A promise that resolves to nothing.\n */\n $nextTick(callback) {\n return nextTick(this, callback);\n }\n /**\n * Defines the constructor as a new custom element.\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry/define}\n * @param {string|object} [name] The element name.\n * @param {object} [options] The element definition options.\n */\n static $define(name, options) {\n if (isObject(name)) {\n options = name;\n name = '';\n }\n if (!name) {\n name = this.$name || this.name;\n }\n name = toKebabCase(name);\n if (IS_BROWSER && WINDOW.customElements && !WINDOW.customElements.get(name)) {\n customElements.define(name, this, options);\n }\n }\n}\nCropperElement.$version = '2.3.1';\n\nexport { CropperElement as default };\n"],"ignoreList":[0],"mappings":";;AAEA,IAAIA,IAAQ,2CAENC,IAAgB,0BAChBC,IAA2B,QAC3BC,oBAAc,IAAI,QAAQ,GAC1BC,oBAAc,IAAI,QAAQ,GAC1BC,oBAAW,IAAI,IAAI,GACnBC,IAA6B,GAAQC,EAAO,YAC3C,MAAM,QAAQA,EAAO,SAAS,kBAAkB,KAChDA,EAAO,iBACP,iBAAiBA,EAAO,cAAc,YACvCC,IAAN,cAA6B,YAAY;CACrC,IAAI,eAAe;EACf,OAAO,GAAG,KAAK,aAAa,wBAAwB,KAAK,WAAW,MAAM,KAAKR;CACnF;CACA,cAAc;EAIV,AAFA,MAAM,GACN,KAAK,iBAAiBE,GACtB,KAAK,YAAY;EACjB,IAAMO,IAAmB,OAAO,eAAe,IAAI,CAAA,EAA2C,aAAqD;EACnJ,AAAIA,KACAJ,EAAS,IAAII,GAAM,KAAK,QAAQ,YAAY,CAAC;CAErD;CACA,WAAW,qBAAqB;EAC5B,OAAO;GACH;GACA;GACA;EACJ;CACJ;CAEA,yBAAyB,GAAM,GAAU,GAAU;EAC/C,IAAI,OAAO,GAAGC,GAAUC,CAAQ,GAC5B;EAEJ,IAAMC,IAAeC,EAAYJ,CAAI,GAC/BK,IAAmB,KAAKF,IAC1BG,IAAmBL;EACvB,QAAQ,OAAOI,GAAf;GACI,KAAK;IACD,IAAmBJ,MAAa,QAAQA,MAAa;IACrD;GACJ,KAAK,UACD,IAAmB,OAAOA,CAAQ;EAE1C;EAEA,QADA,KAAKE,KAAgBG,GACbN,GAAR;GACI,KAAK,eAAe;IAChB,IAAMO,IAAaZ,EAAY,IAAI,IAAI,GACjCa,IAAS,KAAK;IACpB,AAAID,KAAcC,MACVX,IAC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nB2B,KAAc7B,EAAO,kBAAkB,CAACA,EAAO,eAAe,IAAIE,CAAI,KACtE,eAAe,OAAOA,GAAM,MAAMuB,CAAO;CAEjD;AACJ;AACA,EAAe,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-canvas.esm.raw.js","names":["CropperElement","style","CropperCanvas","ACTION_NONE","newValue","oldValue","name","on","EVENT_POINTER_DOWN","EVENT_POINTER_MOVE","EVENT_POINTER_UP","EVENT_WHEEL","off","event","identifier","pageX","pageY","pointerId","$pointers","type","isNumber","buttons","button","action","ACTION_TRANSFORM","isElement","$action","pointer","detail","pointers2","maxRotateRate","maxScaleRate","rotate","scale","centerX","centerY","x1","pointer2","y1","x2","y2","z1","z2","a1","a2","rotateRate","absRotateRate","scaleRate","absScaleRate","rotatable","scalable","ACTION_ROTATE","ACTION_SCALE","EVENT_ACTION","isString","canvas","width","height","isPlainObject","options","isPositiveNumber","getAdjustedSizes","cropperImage","CROPPER_IMAGE","context","a","b","c","e","f","newE","newF","destWidth","image","destHeight","isFunction","reject","resolve","CROPPER_CANVAS"],"sources":["../../../../../node_modules/@cropper/element-canvas/dist/element-canvas.esm.raw.js"],"sourcesContent":["import CropperElement from '@cropper/element';\nimport { CROPPER_CANVAS, ACTION_NONE, on, EVENT_POINTER_DOWN, EVENT_POINTER_MOVE, EVENT_POINTER_UP, EVENT_WHEEL, off, isNumber, isElement, ATTRIBUTE_ACTION, EVENT_ACTION_START, EVENT_ACTION_MOVE, ACTION_TRANSFORM, EVENT_ACTION, EVENT_ACTION_END, ACTION_SCALE, isString, isPlainObject, isPositiveNumber, getAdjustedSizes, CROPPER_IMAGE, isFunction, ACTION_ROTATE } from '@cropper/utils';\n\nvar style = `:host{display:block;min-height:100px;min-width:200px;overflow:hidden;position:relative;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([background]){background-color:#fff;background-image:repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);background-image:repeating-conic-gradient(#ccc 0 25%,#fff 0 50%);background-position:0 0,.5rem .5rem;background-size:1rem 1rem}:host([disabled]){pointer-events:none}:host([disabled]):after{bottom:0;content:\"\";cursor:not-allowed;display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}`;\n\nclass CropperCanvas extends CropperElement {\n constructor() {\n super(...arguments);\n this.$onPointerDown = null;\n this.$onPointerMove = null;\n this.$onPointerUp = null;\n this.$onWheel = null;\n this.$wheeling = false;\n this.$pointers = new Map();\n this.$style = style;\n this.$action = ACTION_NONE;\n this.background = false;\n this.disabled = false;\n this.scaleStep = 0.1;\n this.themeColor = '#39f';\n }\n static get observedAttributes() {\n return super.observedAttributes.concat([\n 'background',\n 'disabled',\n 'scale-step',\n ]);\n }\n connectedCallback() {\n super.connectedCallback();\n if (!this.disabled) {\n this.$bind();\n }\n }\n disconnectedCallback() {\n this.$unbind();\n super.disconnectedCallback();\n }\n $propertyChangedCallback(name, oldValue, newValue) {\n if (Object.is(newValue, oldValue)) {\n return;\n }\n super.$propertyChangedCallback(name, oldValue, newValue);\n switch (name) {\n case 'disabled':\n if (newValue) {\n this.$unbind();\n }\n else {\n this.$bind();\n }\n break;\n }\n }\n $bind() {\n if (!this.$onPointerDown) {\n this.$onPointerDown = this.$handlePointerDown.bind(this);\n on(this, EVENT_POINTER_DOWN, this.$onPointerDown);\n }\n if (!this.$onPointerMove) {\n this.$onPointerMove = this.$handlePointerMove.bind(this);\n on(this.ownerDocument, EVENT_POINTER_MOVE, this.$onPointerMove);\n }\n if (!this.$onPointerUp) {\n this.$onPointerUp = this.$handlePointerUp.bind(this);\n on(this.ownerDocument, EVENT_POINTER_UP, this.$onPointerUp);\n }\n if (!this.$onWheel) {\n this.$onWheel = this.$handleWheel.bind(this);\n on(this, EVENT_WHEEL, this.$onWheel, {\n passive: false,\n capture: true,\n });\n }\n }\n $unbind() {\n if (this.$onPointerDown) {\n off(this, EVENT_POINTER_DOWN, this.$onPointerDown);\n this.$onPointerDown = null;\n }\n if (this.$onPointerMove) {\n off(this.ownerDocument, EVENT_POINTER_MOVE, this.$onPointerMove);\n this.$onPointerMove = null;\n }\n if (this.$onPointerUp) {\n off(this.ownerDocument, EVENT_POINTER_UP, this.$onPointerUp);\n this.$onPointerUp = null;\n }\n if (this.$onWheel) {\n off(this, EVENT_WHEEL, this.$onWheel, {\n capture: true,\n });\n this.$onWheel = null;\n }\n this.$pointers.clear();\n this.style.willChange = '';\n this.$action = ACTION_NONE;\n }\n $addPointers(event) {\n const { $pointers } = this;\n if (event.changedTouches) {\n Array.from(event.changedTouches).forEach(({ identifier, pageX, pageY, }) => {\n $pointers.set(identifier, {\n startX: pageX,\n startY: pageY,\n endX: pageX,\n endY: pageY,\n });\n });\n }\n else {\n const { pointerId = 0, pageX, pageY } = event;\n $pointers.set(pointerId, {\n startX: pageX,\n startY: pageY,\n endX: pageX,\n endY: pageY,\n });\n }\n }\n $removePointers(event) {\n const { $pointers } = this;\n if (event.changedTouches) {\n Array.from(event.changedTouches).forEach(({ identifier }) => {\n $pointers.delete(identifier);\n });\n }\n else {\n const { pointerId = 0 } = event;\n $pointers.delete(pointerId);\n }\n if ($pointers.size === 0) {\n this.style.willChange = '';\n this.$action = ACTION_NONE;\n }\n }\n $handlePointerDown(event) {\n const { buttons, button, type } = event;\n if (this.disabled || (\n // Handle pointer or mouse event, and ignore touch event\n ((type === 'pointerdown' && event.pointerType === 'mouse') || type === 'mousedown') && (\n // No primary button (Usually the left button)\n (isNumber(buttons) && buttons !== 1) || (isNumber(button) && button !== 0)\n // Open context menu\n || event.ctrlKey))) {\n return;\n }\n this.$addPointers(event);\n const { $pointers } = this;\n let action = ACTION_NONE;\n if ($pointers.size > 1) {\n action = ACTION_TRANSFORM;\n }\n else if (isElement(event.target)) {\n action = event.target.action\n || event.target.getAttribute(ATTRIBUTE_ACTION)\n || ACTION_NONE;\n }\n if (this.$emit(EVENT_ACTION_START, {\n action,\n relatedEvent: event,\n }) === false) {\n this.$removePointers(event);\n return;\n }\n // Prevent page zooming in the browsers for iOS.\n event.preventDefault();\n this.$action = action;\n this.style.willChange = 'transform';\n }\n $handlePointerMove(event) {\n const { $action, $pointers } = this;\n if (this.disabled || $action === ACTION_NONE || $pointers.size === 0) {\n return;\n }\n if (this.$emit(EVENT_ACTION_MOVE, {\n action: $action,\n relatedEvent: event,\n }) === false) {\n return;\n }\n // Prevent page scrolling.\n event.preventDefault();\n if (event.changedTouches) {\n Array.from(event.changedTouches).forEach(({ identifier, pageX, pageY, }) => {\n const pointer = $pointers.get(identifier);\n if (pointer) {\n Object.assign(pointer, {\n endX: pageX,\n endY: pageY,\n });\n }\n });\n }\n else {\n const { pointerId = 0, pageX, pageY } = event;\n const pointer = $pointers.get(pointerId);\n if (pointer) {\n Object.assign(pointer, {\n endX: pageX,\n endY: pageY,\n });\n }\n }\n const detail = {\n action: $action,\n relatedEvent: event,\n };\n if ($action === ACTION_TRANSFORM) {\n const pointers2 = new Map($pointers);\n let maxRotateRate = 0;\n let maxScaleRate = 0;\n let rotate = 0;\n let scale = 0;\n let centerX = event.pageX;\n let centerY = event.pageY;\n $pointers.forEach((pointer, pointerId) => {\n pointers2.delete(pointerId);\n pointers2.forEach((pointer2) => {\n let x1 = pointer2.startX - pointer.startX;\n let y1 = pointer2.startY - pointer.startY;\n let x2 = pointer2.endX - pointer.endX;\n let y2 = pointer2.endY - pointer.endY;\n let z1 = 0;\n let z2 = 0;\n let a1 = 0;\n let a2 = 0;\n if (x1 === 0) {\n if (y1 < 0) {\n a1 = Math.PI * 2;\n }\n else if (y1 > 0) {\n a1 = Math.PI;\n }\n }\n else if (x1 > 0) {\n a1 = (Math.PI / 2) + Math.atan(y1 / x1);\n }\n else if (x1 < 0) {\n a1 = (Math.PI * 1.5) + Math.atan(y1 / x1);\n }\n if (x2 === 0) {\n if (y2 < 0) {\n a2 = Math.PI * 2;\n }\n else if (y2 > 0) {\n a2 = Math.PI;\n }\n }\n else if (x2 > 0) {\n a2 = (Math.PI / 2) + Math.atan(y2 / x2);\n }\n else if (x2 < 0) {\n a2 = (Math.PI * 1.5) + Math.atan(y2 / x2);\n }\n if (a2 > 0 || a1 > 0) {\n const rotateRate = a2 - a1;\n const absRotateRate = Math.abs(rotateRate);\n if (absRotateRate > maxRotateRate) {\n maxRotateRate = absRotateRate;\n rotate = rotateRate;\n centerX = (pointer.startX + pointer2.startX) / 2;\n centerY = (pointer.startY + pointer2.startY) / 2;\n }\n }\n x1 = Math.abs(x1);\n y1 = Math.abs(y1);\n x2 = Math.abs(x2);\n y2 = Math.abs(y2);\n if (x1 > 0 && y1 > 0) {\n z1 = Math.sqrt((x1 * x1) + (y1 * y1));\n }\n else if (x1 > 0) {\n z1 = x1;\n }\n else if (y1 > 0) {\n z1 = y1;\n }\n if (x2 > 0 && y2 > 0) {\n z2 = Math.sqrt((x2 * x2) + (y2 * y2));\n }\n else if (x2 > 0) {\n z2 = x2;\n }\n else if (y2 > 0) {\n z2 = y2;\n }\n if (z1 > 0 && z2 > 0) {\n const scaleRate = (z2 - z1) / z1;\n const absScaleRate = Math.abs(scaleRate);\n if (absScaleRate > maxScaleRate) {\n maxScaleRate = absScaleRate;\n scale = scaleRate;\n centerX = (pointer.startX + pointer2.startX) / 2;\n centerY = (pointer.startY + pointer2.startY) / 2;\n }\n }\n });\n });\n const rotatable = maxRotateRate > 0;\n const scalable = maxScaleRate > 0;\n if (rotatable && scalable) {\n detail.rotate = rotate;\n detail.scale = scale;\n detail.centerX = centerX;\n detail.centerY = centerY;\n }\n else if (rotatable) {\n detail.action = ACTION_ROTATE;\n detail.rotate = rotate;\n detail.centerX = centerX;\n detail.centerY = centerY;\n }\n else if (scalable) {\n detail.action = ACTION_SCALE;\n detail.scale = scale;\n detail.centerX = centerX;\n detail.centerY = centerY;\n }\n else {\n detail.action = ACTION_NONE;\n }\n }\n else {\n const [pointer] = Array.from($pointers.values());\n Object.assign(detail, pointer);\n }\n // Override the starting coordinate\n $pointers.forEach((pointer) => {\n pointer.startX = pointer.endX;\n pointer.startY = pointer.endY;\n });\n if (detail.action !== ACTION_NONE) {\n this.$emit(EVENT_ACTION, detail);\n }\n }\n $handlePointerUp(event) {\n const { $action } = this;\n if (this.disabled) {\n this.$removePointers(event);\n return;\n }\n if ($action === ACTION_NONE) {\n this.$removePointers(event);\n return;\n }\n if (this.$emit(EVENT_ACTION_END, {\n action: $action,\n relatedEvent: event,\n }) === false) {\n this.$removePointers(event);\n return;\n }\n event.preventDefault();\n this.$removePointers(event);\n }\n $handleWheel(event) {\n if (this.disabled) {\n return;\n }\n event.preventDefault();\n // Limit wheel speed to prevent zoom too fast (#21)\n if (this.$wheeling) {\n return;\n }\n this.$wheeling = true;\n // Debounce by 50ms\n setTimeout(() => {\n this.$wheeling = false;\n }, 50);\n const delta = event.deltaY > 0 ? -1 : 1;\n const scale = delta * this.scaleStep;\n this.$emit(EVENT_ACTION, {\n action: ACTION_SCALE,\n scale,\n relatedEvent: event,\n });\n }\n /**\n * Changes the current action to a new one.\n * @param {string} action The new action.\n * @returns {CropperCanvas} Returns `this` for chaining.\n */\n $setAction(action) {\n if (isString(action)) {\n this.$action = action;\n }\n return this;\n }\n /**\n * Generates a real canvas element, with the image draw into if there is one.\n * @param {object} [options] The available options.\n * @param {number} [options.width] The width of the canvas.\n * @param {number} [options.height] The height of the canvas.\n * @param {Function} [options.beforeDraw] The function called before drawing the image onto the canvas.\n * @returns {Promise} Returns a promise that resolves to the generated canvas element.\n */\n $toCanvas(options) {\n return new Promise((resolve, reject) => {\n if (!this.isConnected) {\n reject(new Error('The current element is not connected to the DOM.'));\n return;\n }\n const canvas = document.createElement('canvas');\n let width = this.offsetWidth;\n let height = this.offsetHeight;\n let scale = 1;\n if (isPlainObject(options)\n && (isPositiveNumber(options.width) || isPositiveNumber(options.height))) {\n ({ width, height } = getAdjustedSizes({\n aspectRatio: width / height,\n width: options.width,\n height: options.height,\n }));\n scale = width / this.offsetWidth;\n }\n canvas.width = width;\n canvas.height = height;\n const cropperImage = this.querySelector(this.$getTagNameOf(CROPPER_IMAGE));\n if (!cropperImage) {\n resolve(canvas);\n return;\n }\n cropperImage.$ready().then((image) => {\n const context = canvas.getContext('2d');\n if (context) {\n const [a, b, c, d, e, f] = cropperImage.$getTransform();\n let newE = e;\n let newF = f;\n let destWidth = image.naturalWidth;\n let destHeight = image.naturalHeight;\n if (scale !== 1) {\n newE *= scale;\n newF *= scale;\n destWidth *= scale;\n destHeight *= scale;\n }\n const centerX = destWidth / 2;\n const centerY = destHeight / 2;\n context.fillStyle = 'transparent';\n context.fillRect(0, 0, width, height);\n if (isPlainObject(options) && isFunction(options.beforeDraw)) {\n options.beforeDraw.call(this, context, canvas);\n }\n context.save();\n // Move the transform origin to the center of the image.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin\n context.translate(centerX, centerY);\n context.transform(a, b, c, d, newE, newF);\n // Reset the transform origin to the top-left of the image.\n context.translate(-centerX, -centerY);\n context.drawImage(image, 0, 0, destWidth, destHeight);\n context.restore();\n }\n resolve(canvas);\n }).catch(reject);\n });\n }\n}\nCropperCanvas.$name = CROPPER_CANVAS;\nCropperCanvas.$version = '2.2.0';\n\nexport { CropperCanvas as default };\n"],"ignoreList":[0],"mappings":";;;AAGA,IAAIC,IAAQ,0tBAENC,IAAN,cAA4BF,EAAe;CACvC,cAAc;EAaV,AAZA,MAAM,GAAG,SAAS,GAClB,KAAK,iBAAiB,MACtB,KAAK,iBAAiB,MACtB,KAAK,eAAe,MACpB,KAAK,WAAW,MAChB,KAAK,YAAY,IACjB,KAAK,4BAAY,IAAI,IAAI,GACzB,KAAK,SAASC,GACd,KAAK,UAAUE,GACf,KAAK,aAAa,IAClB,KAAK,WAAW,IAChB,KAAK,YAAY,IACjB,KAAK,aAAa;CACtB;CACA,WAAW,qBAAqB;EAC5B,OAAO,MAAM,mBAAmB,OAAO;GACnC;GACA;GACA;EACJ,CAAC;CAC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Ac,QAAQuB,GACtB,EAAc,WAAW"}
|
|
1
|
+
{"version":3,"file":"element-canvas.esm.raw.js","names":["CropperElement","style","CropperCanvas","ACTION_NONE","newValue","oldValue","name","on","EVENT_POINTER_DOWN","EVENT_POINTER_MOVE","EVENT_POINTER_UP","EVENT_WHEEL","off","event","identifier","pageX","pageY","pointerId","$pointers","type","isNumber","buttons","button","action","ACTION_TRANSFORM","isElement","$action","pointer","detail","pointers2","maxRotateRate","maxScaleRate","rotate","scale","centerX","centerY","x1","pointer2","y1","x2","y2","z1","z2","a1","a2","rotateRate","absRotateRate","scaleRate","absScaleRate","rotatable","scalable","ACTION_ROTATE","ACTION_SCALE","EVENT_ACTION","isString","canvas","width","height","isPlainObject","options","isPositiveNumber","getAdjustedSizes","cropperImage","CROPPER_IMAGE","context","a","b","c","e","f","newE","newF","destWidth","image","destHeight","isFunction","reject","resolve","CROPPER_CANVAS"],"sources":["../../../../../node_modules/@cropper/element-canvas/dist/element-canvas.esm.raw.js"],"sourcesContent":["import CropperElement from '@cropper/element';\nimport { CROPPER_CANVAS, ACTION_NONE, on, EVENT_POINTER_DOWN, EVENT_POINTER_MOVE, EVENT_POINTER_UP, EVENT_WHEEL, off, isNumber, isElement, ATTRIBUTE_ACTION, EVENT_ACTION_START, EVENT_ACTION_MOVE, ACTION_TRANSFORM, EVENT_ACTION, EVENT_ACTION_END, ACTION_SCALE, isString, isPlainObject, isPositiveNumber, getAdjustedSizes, CROPPER_IMAGE, isFunction, ACTION_ROTATE } from '@cropper/utils';\n\nvar style = `:host{display:block;min-height:100px;min-width:200px;overflow:hidden;position:relative;touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}:host([background]){background-color:#fff;background-image:repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc),repeating-linear-gradient(45deg,#ccc 25%,transparent 0,transparent 75%,#ccc 0,#ccc);background-image:repeating-conic-gradient(#ccc 0 25%,#fff 0 50%);background-position:0 0,.5rem .5rem;background-size:1rem 1rem}:host([disabled]){pointer-events:none}:host([disabled]):after{bottom:0;content:\"\";cursor:not-allowed;display:block;left:0;pointer-events:none;position:absolute;right:0;top:0}`;\n\nclass CropperCanvas extends CropperElement {\n constructor() {\n super(...arguments);\n this.$onPointerDown = null;\n this.$onPointerMove = null;\n this.$onPointerUp = null;\n this.$onWheel = null;\n this.$wheeling = false;\n this.$pointers = new Map();\n this.$style = style;\n this.$action = ACTION_NONE;\n this.background = false;\n this.disabled = false;\n this.scaleStep = 0.1;\n this.themeColor = '#39f';\n }\n static get observedAttributes() {\n return super.observedAttributes.concat([\n 'background',\n 'disabled',\n 'scale-step',\n ]);\n }\n connectedCallback() {\n super.connectedCallback();\n if (!this.disabled) {\n this.$bind();\n }\n }\n disconnectedCallback() {\n this.$unbind();\n super.disconnectedCallback();\n }\n $propertyChangedCallback(name, oldValue, newValue) {\n if (Object.is(newValue, oldValue)) {\n return;\n }\n super.$propertyChangedCallback(name, oldValue, newValue);\n switch (name) {\n case 'disabled':\n if (newValue) {\n this.$unbind();\n }\n else {\n this.$bind();\n }\n break;\n }\n }\n $bind() {\n if (!this.$onPointerDown) {\n this.$onPointerDown = this.$handlePointerDown.bind(this);\n on(this, EVENT_POINTER_DOWN, this.$onPointerDown);\n }\n if (!this.$onPointerMove) {\n this.$onPointerMove = this.$handlePointerMove.bind(this);\n on(this.ownerDocument, EVENT_POINTER_MOVE, this.$onPointerMove);\n }\n if (!this.$onPointerUp) {\n this.$onPointerUp = this.$handlePointerUp.bind(this);\n on(this.ownerDocument, EVENT_POINTER_UP, this.$onPointerUp);\n }\n if (!this.$onWheel) {\n this.$onWheel = this.$handleWheel.bind(this);\n on(this, EVENT_WHEEL, this.$onWheel, {\n passive: false,\n capture: true,\n });\n }\n }\n $unbind() {\n if (this.$onPointerDown) {\n off(this, EVENT_POINTER_DOWN, this.$onPointerDown);\n this.$onPointerDown = null;\n }\n if (this.$onPointerMove) {\n off(this.ownerDocument, EVENT_POINTER_MOVE, this.$onPointerMove);\n this.$onPointerMove = null;\n }\n if (this.$onPointerUp) {\n off(this.ownerDocument, EVENT_POINTER_UP, this.$onPointerUp);\n this.$onPointerUp = null;\n }\n if (this.$onWheel) {\n off(this, EVENT_WHEEL, this.$onWheel, {\n capture: true,\n });\n this.$onWheel = null;\n }\n this.$pointers.clear();\n this.style.willChange = '';\n this.$action = ACTION_NONE;\n }\n $addPointers(event) {\n const { $pointers } = this;\n if (event.changedTouches) {\n Array.from(event.changedTouches).forEach(({ identifier, pageX, pageY, }) => {\n $pointers.set(identifier, {\n startX: pageX,\n startY: pageY,\n endX: pageX,\n endY: pageY,\n });\n });\n }\n else {\n const { pointerId = 0, pageX, pageY } = event;\n $pointers.set(pointerId, {\n startX: pageX,\n startY: pageY,\n endX: pageX,\n endY: pageY,\n });\n }\n }\n $removePointers(event) {\n const { $pointers } = this;\n if (event.changedTouches) {\n Array.from(event.changedTouches).forEach(({ identifier }) => {\n $pointers.delete(identifier);\n });\n }\n else {\n const { pointerId = 0 } = event;\n $pointers.delete(pointerId);\n }\n if ($pointers.size === 0) {\n this.style.willChange = '';\n this.$action = ACTION_NONE;\n }\n }\n $handlePointerDown(event) {\n const { buttons, button, type } = event;\n if (this.disabled || (\n // Handle pointer or mouse event, and ignore touch event\n ((type === 'pointerdown' && event.pointerType === 'mouse') || type === 'mousedown') && (\n // No primary button (Usually the left button)\n (isNumber(buttons) && buttons !== 1) || (isNumber(button) && button !== 0)\n // Open context menu\n || event.ctrlKey))) {\n return;\n }\n this.$addPointers(event);\n const { $pointers } = this;\n let action = ACTION_NONE;\n if ($pointers.size > 1) {\n action = ACTION_TRANSFORM;\n }\n else if (isElement(event.target)) {\n action = event.target.action\n || event.target.getAttribute(ATTRIBUTE_ACTION)\n || ACTION_NONE;\n }\n if (this.$emit(EVENT_ACTION_START, {\n action,\n relatedEvent: event,\n }) === false) {\n this.$removePointers(event);\n return;\n }\n // Prevent page zooming in the browsers for iOS.\n event.preventDefault();\n this.$action = action;\n this.style.willChange = 'transform';\n }\n $handlePointerMove(event) {\n const { $action, $pointers } = this;\n if (this.disabled || $action === ACTION_NONE || $pointers.size === 0) {\n return;\n }\n if (this.$emit(EVENT_ACTION_MOVE, {\n action: $action,\n relatedEvent: event,\n }) === false) {\n return;\n }\n // Prevent page scrolling.\n event.preventDefault();\n if (event.changedTouches) {\n Array.from(event.changedTouches).forEach(({ identifier, pageX, pageY, }) => {\n const pointer = $pointers.get(identifier);\n if (pointer) {\n Object.assign(pointer, {\n endX: pageX,\n endY: pageY,\n });\n }\n });\n }\n else {\n const { pointerId = 0, pageX, pageY } = event;\n const pointer = $pointers.get(pointerId);\n if (pointer) {\n Object.assign(pointer, {\n endX: pageX,\n endY: pageY,\n });\n }\n }\n const detail = {\n action: $action,\n relatedEvent: event,\n };\n if ($action === ACTION_TRANSFORM) {\n const pointers2 = new Map($pointers);\n let maxRotateRate = 0;\n let maxScaleRate = 0;\n let rotate = 0;\n let scale = 0;\n let centerX = event.pageX;\n let centerY = event.pageY;\n $pointers.forEach((pointer, pointerId) => {\n pointers2.delete(pointerId);\n pointers2.forEach((pointer2) => {\n let x1 = pointer2.startX - pointer.startX;\n let y1 = pointer2.startY - pointer.startY;\n let x2 = pointer2.endX - pointer.endX;\n let y2 = pointer2.endY - pointer.endY;\n let z1 = 0;\n let z2 = 0;\n let a1 = 0;\n let a2 = 0;\n if (x1 === 0) {\n if (y1 < 0) {\n a1 = Math.PI * 2;\n }\n else if (y1 > 0) {\n a1 = Math.PI;\n }\n }\n else if (x1 > 0) {\n a1 = (Math.PI / 2) + Math.atan(y1 / x1);\n }\n else if (x1 < 0) {\n a1 = (Math.PI * 1.5) + Math.atan(y1 / x1);\n }\n if (x2 === 0) {\n if (y2 < 0) {\n a2 = Math.PI * 2;\n }\n else if (y2 > 0) {\n a2 = Math.PI;\n }\n }\n else if (x2 > 0) {\n a2 = (Math.PI / 2) + Math.atan(y2 / x2);\n }\n else if (x2 < 0) {\n a2 = (Math.PI * 1.5) + Math.atan(y2 / x2);\n }\n if (a2 > 0 || a1 > 0) {\n const rotateRate = a2 - a1;\n const absRotateRate = Math.abs(rotateRate);\n if (absRotateRate > maxRotateRate) {\n maxRotateRate = absRotateRate;\n rotate = rotateRate;\n centerX = (pointer.startX + pointer2.startX) / 2;\n centerY = (pointer.startY + pointer2.startY) / 2;\n }\n }\n x1 = Math.abs(x1);\n y1 = Math.abs(y1);\n x2 = Math.abs(x2);\n y2 = Math.abs(y2);\n if (x1 > 0 && y1 > 0) {\n z1 = Math.sqrt((x1 * x1) + (y1 * y1));\n }\n else if (x1 > 0) {\n z1 = x1;\n }\n else if (y1 > 0) {\n z1 = y1;\n }\n if (x2 > 0 && y2 > 0) {\n z2 = Math.sqrt((x2 * x2) + (y2 * y2));\n }\n else if (x2 > 0) {\n z2 = x2;\n }\n else if (y2 > 0) {\n z2 = y2;\n }\n if (z1 > 0 && z2 > 0) {\n const scaleRate = (z2 - z1) / z1;\n const absScaleRate = Math.abs(scaleRate);\n if (absScaleRate > maxScaleRate) {\n maxScaleRate = absScaleRate;\n scale = scaleRate;\n centerX = (pointer.startX + pointer2.startX) / 2;\n centerY = (pointer.startY + pointer2.startY) / 2;\n }\n }\n });\n });\n const rotatable = maxRotateRate > 0;\n const scalable = maxScaleRate > 0;\n if (rotatable && scalable) {\n detail.rotate = rotate;\n detail.scale = scale;\n detail.centerX = centerX;\n detail.centerY = centerY;\n }\n else if (rotatable) {\n detail.action = ACTION_ROTATE;\n detail.rotate = rotate;\n detail.centerX = centerX;\n detail.centerY = centerY;\n }\n else if (scalable) {\n detail.action = ACTION_SCALE;\n detail.scale = scale;\n detail.centerX = centerX;\n detail.centerY = centerY;\n }\n else {\n detail.action = ACTION_NONE;\n }\n }\n else {\n const [pointer] = Array.from($pointers.values());\n Object.assign(detail, pointer);\n }\n // Override the starting coordinate\n $pointers.forEach((pointer) => {\n pointer.startX = pointer.endX;\n pointer.startY = pointer.endY;\n });\n if (detail.action !== ACTION_NONE) {\n this.$emit(EVENT_ACTION, detail);\n }\n }\n $handlePointerUp(event) {\n const { $action } = this;\n if (this.disabled) {\n this.$removePointers(event);\n return;\n }\n if ($action === ACTION_NONE) {\n this.$removePointers(event);\n return;\n }\n if (this.$emit(EVENT_ACTION_END, {\n action: $action,\n relatedEvent: event,\n }) === false) {\n this.$removePointers(event);\n return;\n }\n event.preventDefault();\n this.$removePointers(event);\n }\n $handleWheel(event) {\n if (this.disabled) {\n return;\n }\n event.preventDefault();\n // Limit wheel speed to prevent zoom too fast (#21)\n if (this.$wheeling) {\n return;\n }\n this.$wheeling = true;\n // Debounce by 50ms\n setTimeout(() => {\n this.$wheeling = false;\n }, 50);\n const delta = event.deltaY > 0 ? -1 : 1;\n const scale = delta * this.scaleStep;\n this.$emit(EVENT_ACTION, {\n action: ACTION_SCALE,\n scale,\n relatedEvent: event,\n });\n }\n /**\n * Changes the current action to a new one.\n * @param {string} action The new action.\n * @returns {CropperCanvas} Returns `this` for chaining.\n */\n $setAction(action) {\n if (isString(action)) {\n this.$action = action;\n }\n return this;\n }\n /**\n * Generates a real canvas element, with the image draw into if there is one.\n * @param {object} [options] The available options.\n * @param {number} [options.width] The width of the canvas.\n * @param {number} [options.height] The height of the canvas.\n * @param {Function} [options.beforeDraw] The function called before drawing the image onto the canvas.\n * @returns {Promise} Returns a promise that resolves to the generated canvas element.\n */\n $toCanvas(options) {\n return new Promise((resolve, reject) => {\n if (!this.isConnected) {\n reject(new Error('The current element is not connected to the DOM.'));\n return;\n }\n const canvas = document.createElement('canvas');\n let width = this.offsetWidth;\n let height = this.offsetHeight;\n let scale = 1;\n if (isPlainObject(options)\n && (isPositiveNumber(options.width) || isPositiveNumber(options.height))) {\n ({ width, height } = getAdjustedSizes({\n aspectRatio: width / height,\n width: options.width,\n height: options.height,\n }));\n scale = width / this.offsetWidth;\n }\n canvas.width = width;\n canvas.height = height;\n const cropperImage = this.querySelector(this.$getTagNameOf(CROPPER_IMAGE));\n if (!cropperImage) {\n resolve(canvas);\n return;\n }\n cropperImage.$ready().then((image) => {\n const context = canvas.getContext('2d');\n if (context) {\n const [a, b, c, d, e, f] = cropperImage.$getTransform();\n let newE = e;\n let newF = f;\n let destWidth = image.naturalWidth;\n let destHeight = image.naturalHeight;\n if (scale !== 1) {\n newE *= scale;\n newF *= scale;\n destWidth *= scale;\n destHeight *= scale;\n }\n const centerX = destWidth / 2;\n const centerY = destHeight / 2;\n context.fillStyle = 'transparent';\n context.fillRect(0, 0, width, height);\n if (isPlainObject(options) && isFunction(options.beforeDraw)) {\n options.beforeDraw.call(this, context, canvas);\n }\n context.save();\n // Move the transform origin to the center of the image.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/transform-origin\n context.translate(centerX, centerY);\n context.transform(a, b, c, d, newE, newF);\n // Reset the transform origin to the top-left of the image.\n context.translate(-centerX, -centerY);\n context.drawImage(image, 0, 0, destWidth, destHeight);\n context.restore();\n }\n resolve(canvas);\n }).catch(reject);\n });\n }\n}\nCropperCanvas.$name = CROPPER_CANVAS;\nCropperCanvas.$version = '2.3.1';\n\nexport { CropperCanvas as default };\n"],"ignoreList":[0],"mappings":";;;AAGA,IAAIC,IAAQ,0tBAENC,IAAN,cAA4BF,EAAe;CACvC,cAAc;EAaV,AAZA,MAAM,GAAG,SAAS,GAClB,KAAK,iBAAiB,MACtB,KAAK,iBAAiB,MACtB,KAAK,eAAe,MACpB,KAAK,WAAW,MAChB,KAAK,YAAY,IACjB,KAAK,4BAAY,IAAI,IAAI,GACzB,KAAK,SAASC,GACd,KAAK,UAAUE,GACf,KAAK,aAAa,IAClB,KAAK,WAAW,IAChB,KAAK,YAAY,IACjB,KAAK,aAAa;CACtB;CACA,WAAW,qBAAqB;EAC5B,OAAO,MAAM,mBAAmB,OAAO;GACnC;GACA;GACA;EACJ,CAAC;CACL;CACA,oBAAoB;EAEhB,AADA,MAAM,kBAAkB,GACnB,KAAK,YACN,KAAK,MAAM;CAEnB;CACA,uBAAuB;EAEnB,AADA,KAAK,QAAQ,GACb,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at(["centered"]);
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
r.$name = e, r.$version = "2.
|
|
12
|
+
r.$name = e, r.$version = "2.3.1";
|
|
13
13
|
//#endregion
|
|
14
14
|
export { r as default };
|
|
15
15
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-crosshair.esm.raw.js","names":["CropperElement","style","CropperCrosshair","CROPPER_CROSSHAIR"],"sources":["../../../../../node_modules/@cropper/element-crosshair/dist/element-crosshair.esm.raw.js"],"sourcesContent":["import CropperElement from '@cropper/element';\nimport { CROPPER_CROSSHAIR } from '@cropper/utils';\n\nvar style = `:host{display:inline-block;height:1em;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1em}:host:after,:host:before{background-color:var(--theme-color);content:\"\";display:block;position:absolute}:host:before{height:1px;left:0;top:50%;transform:translateY(-50%);width:100%}:host:after{height:100%;left:50%;top:0;transform:translateX(-50%);width:1px}:host([centered]){left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}`;\n\nclass CropperCrosshair extends CropperElement {\n constructor() {\n super(...arguments);\n this.$style = style;\n this.centered = false;\n this.slottable = false;\n this.themeColor = 'rgba(238, 238, 238, 0.5)';\n }\n static get observedAttributes() {\n return super.observedAttributes.concat([\n 'centered',\n ]);\n }\n}\nCropperCrosshair.$name = CROPPER_CROSSHAIR;\nCropperCrosshair.$version = '2.
|
|
1
|
+
{"version":3,"file":"element-crosshair.esm.raw.js","names":["CropperElement","style","CropperCrosshair","CROPPER_CROSSHAIR"],"sources":["../../../../../node_modules/@cropper/element-crosshair/dist/element-crosshair.esm.raw.js"],"sourcesContent":["import CropperElement from '@cropper/element';\nimport { CROPPER_CROSSHAIR } from '@cropper/utils';\n\nvar style = `:host{display:inline-block;height:1em;position:relative;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;vertical-align:middle;width:1em}:host:after,:host:before{background-color:var(--theme-color);content:\"\";display:block;position:absolute}:host:before{height:1px;left:0;top:50%;transform:translateY(-50%);width:100%}:host:after{height:100%;left:50%;top:0;transform:translateX(-50%);width:1px}:host([centered]){left:50%;position:absolute;top:50%;transform:translate(-50%,-50%)}`;\n\nclass CropperCrosshair extends CropperElement {\n constructor() {\n super(...arguments);\n this.$style = style;\n this.centered = false;\n this.slottable = false;\n this.themeColor = 'rgba(238, 238, 238, 0.5)';\n }\n static get observedAttributes() {\n return super.observedAttributes.concat([\n 'centered',\n ]);\n }\n}\nCropperCrosshair.$name = CROPPER_CROSSHAIR;\nCropperCrosshair.$version = '2.3.1';\n\nexport { CropperCrosshair as default };\n"],"ignoreList":[0],"mappings":";;;AAGA,IAAIC,IAAQ,qgBAENC,IAAN,cAA+BF,EAAe;CAC1C,cAAc;EAKV,AAJA,MAAM,GAAG,SAAS,GAClB,KAAK,SAASC,GACd,KAAK,WAAW,IAChB,KAAK,YAAY,IACjB,KAAK,aAAa;CACtB;CACA,WAAW,qBAAqB;EAC5B,OAAO,MAAM,mBAAmB,OAAO,CACnC,UACJ,CAAC;CACL;AACJ;AACA,EAAiB,QAAQE,GACzB,EAAiB,WAAW"}
|
|
@@ -35,7 +35,7 @@ var n = ":host{display:flex;flex-direction:column;position:relative;touch-action
|
|
|
35
35
|
e && (e.querySelectorAll("[data-cropper-grid-row]").forEach((e) => e.remove()), e.appendChild(t));
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
r.$name = e, r.$version = "2.
|
|
38
|
+
r.$name = e, r.$version = "2.3.1";
|
|
39
39
|
//#endregion
|
|
40
40
|
export { r as default };
|
|
41
41
|
|