@dskripchenko/laravel-admin 1.21.2 → 1.21.4
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/composables/useShellVisibility.d.ts +28 -0
- package/dist/composables/useShellVisibility.test.d.ts +1 -0
- package/dist/{formState-DeRZBwWH.js → formState-DC25j4xe.js} +2 -2
- package/dist/{formState-DeRZBwWH.js.map → formState-DC25j4xe.js.map} +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +881 -871
- package/dist/index.mjs.map +1 -1
- package/dist/quill.mjs +1 -1
- package/dist/style.css +1 -1
- package/dist/tinymce.mjs +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ComputedRef } from 'vue';
|
|
2
|
+
import type { RouteLocationNormalizedLoaded } from 'vue-router';
|
|
3
|
+
/**
|
|
4
|
+
* Should this route be drawn inside the admin shell, and is a catch-all match
|
|
5
|
+
* a real 404 yet?
|
|
6
|
+
*
|
|
7
|
+
* Extracted from AdminApp so the rule can be tested as itself. Inline in the
|
|
8
|
+
* SFC it was untestable, and the bug it now guards shipped unnoticed:
|
|
9
|
+
* reloading any screen showed a full-page «Page not found» first and the real
|
|
10
|
+
* page a moment later.
|
|
11
|
+
*
|
|
12
|
+
* The cause is that dynamic routes exist only after the manifest arrives, so
|
|
13
|
+
* during boot EVERY deep link resolves to the catch-all. A boot gate for that
|
|
14
|
+
* flash already existed — but it lived inside the shell branch, and the shell
|
|
15
|
+
* was dropped precisely for `admin.notFound`. The one route the gate was
|
|
16
|
+
* written for went down the ungated path.
|
|
17
|
+
*
|
|
18
|
+
* Hence `settledNotFound`: a catch-all match counts as a 404 only once the app
|
|
19
|
+
* is ready. Before that it is a boot artefact and the visitor should see the
|
|
20
|
+
* ordinary skeleton, exactly as on any other deep link.
|
|
21
|
+
*/
|
|
22
|
+
export interface ShellVisibility {
|
|
23
|
+
/** Catch-all match that survived boot — a genuinely unknown address. */
|
|
24
|
+
settledNotFound: ComputedRef<boolean>;
|
|
25
|
+
/** Draw the page inside the shell (sidebar + topbar). */
|
|
26
|
+
useShell: ComputedRef<boolean>;
|
|
27
|
+
}
|
|
28
|
+
export declare function useShellVisibility(route: RouteLocationNormalizedLoaded, appReady: ComputedRef<boolean>): ShellVisibility;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { inject as l, reactive as i, provide as d } from "vue";
|
|
2
2
|
const n = /* @__PURE__ */ Symbol("admin.form-state");
|
|
3
3
|
function F(o = {}, f = {}, u) {
|
|
4
4
|
const s = i(o), e = i({ ...f }), c = {
|
|
@@ -38,4 +38,4 @@ export {
|
|
|
38
38
|
y as t,
|
|
39
39
|
p as u
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=formState-
|
|
41
|
+
//# sourceMappingURL=formState-DC25j4xe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formState-
|
|
1
|
+
{"version":3,"file":"formState-DC25j4xe.js","sources":["../resources/ts/components/render/formState.ts"],"sourcesContent":["/**\n * Composable для form-state: предоставляет state + ошибки через provide/inject.\n *\n * Контейнер (Resource form / Settings page) вызывает `provideFormState()`,\n * Field-компоненты в дереве — `useFormState()` для чтения значения и\n * мутации поля.\n *\n * State — reactive proxy; setField мутирует ключ. Errors — отдельный\n * reactive Map (field-name → string[] messages).\n */\n\nimport { inject, provide, reactive, type InjectionKey } from 'vue'\n\nexport interface FormStateContext {\n state: Record<string, unknown>\n errors: Record<string, string[]>\n /** Контекст формы: FieldRenderer скрывает поля с visibility[mode]=false. */\n mode?: 'create' | 'update' | 'view'\n setField: (name: string, value: unknown) => void\n getField: (name: string) => unknown\n setError: (name: string, messages: string[] | null) => void\n setErrors: (next: Record<string, string[]>) => void\n clearErrors: () => void\n}\n\nconst FormStateKey: InjectionKey<FormStateContext> = Symbol('admin.form-state')\n\n/**\n * Создаёт form-context и provid'ит его потомкам.\n *\n * Переданный `initial`-object оборачивается в `reactive()` — мутации stora\n * видны и снаружи (caller владеет state'ом и может его читать после submit'а).\n *\n * @param initial Начальные значения state'а.\n * @param initialErrors Начальные ошибки (для повторного render'а после\n * ValidationError).\n */\nexport function provideFormState(\n initial: Record<string, unknown> = {},\n initialErrors: Record<string, string[]> = {},\n mode?: 'create' | 'update' | 'view',\n): FormStateContext {\n const state = reactive(initial)\n const errors = reactive<Record<string, string[]>>({ ...initialErrors })\n\n const ctx: FormStateContext = {\n state,\n errors,\n mode,\n setField(name, value) {\n ;(state as Record<string, unknown>)[name] = value\n // Очистить ошибки этого поля при изменении — стандартный UX.\n if (errors[name]) {\n delete errors[name]\n }\n },\n getField(name) {\n return (state as Record<string, unknown>)[name]\n },\n setError(name, messages) {\n if (messages === null || messages.length === 0) {\n delete errors[name]\n } else {\n errors[name] = messages\n }\n },\n setErrors(next) {\n for (const key of Object.keys(errors)) delete errors[key]\n Object.assign(errors, next)\n },\n clearErrors() {\n for (const key of Object.keys(errors)) delete errors[key]\n },\n }\n\n provide(FormStateKey, ctx)\n return ctx\n}\n\n/**\n * Получить form-context. Throws, если не вызван внутри `provideFormState()`.\n */\nexport function useFormState(): FormStateContext {\n const ctx = inject(FormStateKey)\n if (!ctx) {\n throw new Error('useFormState() called outside of provideFormState() scope')\n }\n return ctx\n}\n\n/** Опционально получить (null если нет). */\nexport function tryUseFormState(): FormStateContext | null {\n return inject(FormStateKey, null)\n}\n"],"names":["FormStateKey","provideFormState","initial","initialErrors","mode","state","reactive","errors","ctx","name","value","messages","next","key","provide","useFormState","inject","tryUseFormState"],"mappings":";AAyBA,MAAMA,2BAAsD,kBAAkB;AAYvE,SAASC,EACdC,IAAmC,CAAA,GACnCC,IAA0C,CAAA,GAC1CC,GACkB;AAClB,QAAMC,IAAQC,EAASJ,CAAO,GACxBK,IAASD,EAAmC,EAAE,GAAGH,GAAe,GAEhEK,IAAwB;AAAA,IAC5B,OAAAH;AAAA,IACA,QAAAE;AAAA,IACA,MAAAH;AAAA,IACA,SAASK,GAAMC,GAAO;AAClB,MAAAL,EAAkCI,CAAI,IAAIC,GAExCH,EAAOE,CAAI,KACb,OAAOF,EAAOE,CAAI;AAAA,IAEtB;AAAA,IACA,SAASA,GAAM;AACb,aAAQJ,EAAkCI,CAAI;AAAA,IAChD;AAAA,IACA,SAASA,GAAME,GAAU;AACvB,MAAIA,MAAa,QAAQA,EAAS,WAAW,IAC3C,OAAOJ,EAAOE,CAAI,IAElBF,EAAOE,CAAI,IAAIE;AAAA,IAEnB;AAAA,IACA,UAAUC,GAAM;AACd,iBAAWC,KAAO,OAAO,KAAKN,CAAM,EAAG,QAAOA,EAAOM,CAAG;AACxD,aAAO,OAAON,GAAQK,CAAI;AAAA,IAC5B;AAAA,IACA,cAAc;AACZ,iBAAWC,KAAO,OAAO,KAAKN,CAAM,EAAG,QAAOA,EAAOM,CAAG;AAAA,IAC1D;AAAA,EAAA;AAGF,SAAAC,EAAQd,GAAcQ,CAAG,GAClBA;AACT;AAKO,SAASO,IAAiC;AAC/C,QAAMP,IAAMQ,EAAOhB,CAAY;AAC/B,MAAI,CAACQ;AACH,UAAM,IAAI,MAAM,2DAA2D;AAE7E,SAAOA;AACT;AAGO,SAASS,IAA2C;AACzD,SAAOD,EAAOhB,GAAc,IAAI;AAClC;"}
|