@qfei-design/make-app-approval 0.2.15 → 0.2.17
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/PUBLIC_API.md +103 -1
- package/README.md +5 -0
- package/capabilities.json +14 -0
- package/dist/detail/instance-types.d.ts +4 -1
- package/dist/detail/types.d.ts +4 -1
- package/dist/detail.cjs +1 -1
- package/dist/detail.mjs +308 -298
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +37 -14
- package/dist/list/approval-canvas-theme.d.ts +7 -0
- package/dist/list/approval-columns.d.ts +1 -1
- package/dist/list/approval-header-icons.d.ts +2 -0
- package/dist/list/types.d.ts +4 -0
- package/dist/list/ui-components.d.ts +5 -1
- package/dist/list.cjs +1 -1
- package/dist/list.mjs +380 -348
- package/dist/mobile/index.d.ts +2 -0
- package/dist/mobile/mobile-components.d.ts +4 -0
- package/dist/mobile/types.d.ts +67 -0
- package/dist/mobile.cjs +1 -0
- package/dist/mobile.mjs +111 -0
- package/dist/react/index.d.ts +6 -1
- package/dist/react/theme.d.ts +59 -0
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +12 -6
- package/dist/styles.css +159 -3
- package/dist/theme-pzn9q1zq.cjs +1 -0
- package/dist/theme-qxOS-jIA.js +15 -0
- package/dist/theme.d.ts +52 -0
- package/docs/host-integration.md +2 -0
- package/examples/antd-components.tsx +4 -2
- package/package.ai.json +7 -1
- package/package.json +6 -1
- package/recipes.json +8 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { createMobileApprovalComponents } from "./mobile-components.js";
|
|
2
|
+
export type { ApprovalApplicantLoader, ApprovalMobileDateRangeFieldProps, ApprovalMobileDateValue, ApprovalMobileDiagnostic, ApprovalMobileFilterTriggerProps, ApprovalMobilePickerItem, ApprovalMobileSearchPickerSheetProps, ApprovalMobileToolkit, CreateMobileApprovalComponentsOptions, } from "./types.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ApprovalUIComponents } from "../list/ui-components.js";
|
|
2
|
+
import type { CreateMobileApprovalComponentsOptions } from "./types.js";
|
|
3
|
+
/** 只组合公开移动控件和候选 I/O;审批列表查询仍完全交给 MyApprovalsPage。 */
|
|
4
|
+
export declare const createMobileApprovalComponents: ({ Tabs, Button, mobile, loadApplicants, logger }: CreateMobileApprovalComponentsOptions) => ApprovalUIComponents;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ComponentType, ReactNode } from "react";
|
|
2
|
+
import type { ApprovalUIComponents } from "../list/ui-components.js";
|
|
3
|
+
import type { ApprovalSelectOption } from "../list/types.js";
|
|
4
|
+
/** 公开结构合同;不要求列表或 Service 消费方安装移动组件包。 */
|
|
5
|
+
export type ApprovalMobileFilterTriggerProps = ButtonHTMLAttributes<HTMLButtonElement> & Readonly<{
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
muted?: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
export type ApprovalMobileDateValue = Readonly<{
|
|
10
|
+
format: (template: string) => string;
|
|
11
|
+
}>;
|
|
12
|
+
export type ApprovalMobileDateRangeFieldProps = Readonly<{
|
|
13
|
+
id?: string;
|
|
14
|
+
fieldName: string;
|
|
15
|
+
variant: "filter";
|
|
16
|
+
value?: readonly [string, string];
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
onChange: (value: readonly [ApprovalMobileDateValue, ApprovalMobileDateValue] | undefined) => void;
|
|
19
|
+
}>;
|
|
20
|
+
export type ApprovalMobilePickerItem = Readonly<{
|
|
21
|
+
key: string;
|
|
22
|
+
label: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
leading?: ReactNode;
|
|
25
|
+
secondary?: ReactNode;
|
|
26
|
+
}>;
|
|
27
|
+
export type ApprovalMobileSearchPickerSheetProps = Readonly<{
|
|
28
|
+
title: ReactNode;
|
|
29
|
+
open: boolean;
|
|
30
|
+
onClose: () => void;
|
|
31
|
+
items: readonly ApprovalMobilePickerItem[];
|
|
32
|
+
selectedItems: readonly ApprovalMobilePickerItem[];
|
|
33
|
+
selectedKeys: readonly string[];
|
|
34
|
+
onSelectedKeysChange: (keys: string[]) => void;
|
|
35
|
+
onConfirm?: (payload: Readonly<{
|
|
36
|
+
selectedItems: readonly ApprovalMobilePickerItem[];
|
|
37
|
+
selectedKeys: readonly string[];
|
|
38
|
+
}>) => void;
|
|
39
|
+
selectionMode?: "single" | "multiple";
|
|
40
|
+
searchValue: string;
|
|
41
|
+
onSearchValueChange: (value: string) => void;
|
|
42
|
+
searchPlaceholder?: string;
|
|
43
|
+
emptyContent?: ReactNode;
|
|
44
|
+
clearText?: string;
|
|
45
|
+
confirmText?: string;
|
|
46
|
+
}>;
|
|
47
|
+
export type ApprovalMobileToolkit = Readonly<{
|
|
48
|
+
FilterTrigger: ComponentType<ApprovalMobileFilterTriggerProps>;
|
|
49
|
+
DateRangeField: ComponentType<ApprovalMobileDateRangeFieldProps>;
|
|
50
|
+
SearchPickerSheet: ComponentType<ApprovalMobileSearchPickerSheetProps>;
|
|
51
|
+
}>;
|
|
52
|
+
export type ApprovalMobileDiagnostic = Readonly<{
|
|
53
|
+
operation: "applicants";
|
|
54
|
+
phase: "start" | "success" | "error" | "cancel";
|
|
55
|
+
count?: number;
|
|
56
|
+
}>;
|
|
57
|
+
export type ApprovalApplicantLoader = (keyword: string, context: Readonly<{
|
|
58
|
+
signal: AbortSignal;
|
|
59
|
+
}>) => Promise<readonly ApprovalSelectOption[]>;
|
|
60
|
+
export type CreateMobileApprovalComponentsOptions = Readonly<{
|
|
61
|
+
Tabs: ApprovalUIComponents["Tabs"];
|
|
62
|
+
Button: ApprovalUIComponents["Button"];
|
|
63
|
+
mobile: ApprovalMobileToolkit;
|
|
64
|
+
/** 不传时使用 MyApprovalsPage.applicantOptions;传入时由宿主复用真实 users 请求。 */
|
|
65
|
+
loadApplicants?: ApprovalApplicantLoader;
|
|
66
|
+
logger?: (event: ApprovalMobileDiagnostic) => void;
|
|
67
|
+
}>;
|
package/dist/mobile.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),i=require("react"),M=(r,t)=>{if(t.every(n=>r.get(n.value)===n.label))return r;const m=new Map(r);return t.forEach(n=>m.set(n.value,n.label)),m},z=r=>{if(!Array.isArray(r)||r.some(t=>!t||typeof t.value!="string"||!t.value||typeof t.label!="string")||new Set(r.map(t=>t.value)).size!==r.length)throw new Error("Invalid applicant options");return r},G=({Tabs:r,Button:t,mobile:m,loadApplicants:n,logger:x})=>{const{FilterTrigger:E,DateRangeField:F,SearchPickerSheet:O}=m,g=l=>{try{x?x(l):l.phase==="error"?console.warn("[make-app-approval]",l):console.info("[make-app-approval]",l)}catch{console.warn("[make-app-approval] diagnostic sink failed")}};return{Tabs:r,Button:t,Input:({id:l,ariaLabel:d,value:a,onChange:b,placeholder:s,disabled:c})=>o.jsx("input",{className:"make-app-approval-mobile-input",type:"search",id:l,"aria-label":d,value:a,placeholder:s,disabled:c,autoComplete:"off",onChange:v=>b(v.target.value)}),Select:({id:l,ariaLabel:d,value:a,onChange:b,options:s,selectedOption:c,disabled:v})=>{const[y,Y]=i.useState(!1),[S,C]=i.useState(""),[T,q]=i.useState(0),[I,w]=i.useState([]),[A,k]=i.useState("ready"),[K,j]=i.useState(()=>new Map(s.map(e=>[e.value,e.label])));i.useEffect(()=>j(e=>M(e,s)),[s]),i.useEffect(()=>{if(!y||!n)return;const e=new AbortController;let f=!0,p=!1;return w([]),k("loading"),g({operation:"applicants",phase:"start"}),Promise.resolve().then(()=>n(S.trim(),{signal:e.signal})).then(z).then(u=>{p=!0,!(!f||e.signal.aborted)&&(w(u),j(h=>M(h,u)),k("ready"),g({operation:"applicants",phase:"success",count:u.length}))}).catch(()=>{p=!0,!(!f||e.signal.aborted)&&(k("error"),g({operation:"applicants",phase:"error"}))}),()=>{f=!1,p||(e.abort(),g({operation:"applicants",phase:"cancel"}))}},[y,S,T]);const D=s.find(e=>e.value==="")?.label??"全部申请人",L=(c?.value===a?c.label:void 0)??s.find(e=>e.value===a)?.label??K.get(a)??(a?"已选择":D),N=(n?I:s.filter(e=>e.label.includes(S.trim()))).filter(e=>e.value!=="").map(e=>({key:e.value,label:e.label})),P=()=>{Y(!1),C("")},V=A==="loading"?o.jsx("p",{role:"status",children:"正在加载申请人…"}):A==="error"?o.jsxs("div",{role:"alert",children:["申请人加载失败,请重试",o.jsx(t,{htmlType:"button",variant:"text",ariaLabel:"重试加载申请人",onClick:()=>q(e=>e+1),children:"重试"})]}):"暂无可选申请人";return o.jsxs(o.Fragment,{children:[o.jsx(E,{id:l,type:"button","aria-label":d,"aria-haspopup":"dialog","aria-expanded":y,disabled:v,muted:!a,onClick:()=>{C(""),Y(!0)},children:a?L:D}),o.jsx(O,{title:"选择申请人",open:y,onClose:P,selectionMode:"single",items:N,searchValue:S,onSearchValueChange:C,searchPlaceholder:"搜索申请人",emptyContent:V,selectedKeys:a?[a]:[],selectedItems:a?[{key:a,label:L}]:[],onSelectedKeysChange:()=>{},onConfirm:({selectedItems:e,selectedKeys:f})=>{const p=f[0]??"",u=e.find(h=>h.key===p);j(h=>M(h,e.map(R=>({value:R.key,label:R.label})))),b(p,u?{value:p,label:u.label}:void 0),P()}})]})},DateRangePicker:({id:l,ariaLabel:d,value:a,onChange:b,disabled:s})=>o.jsx(F,{id:l,fieldName:d,variant:"filter",disabled:s,value:a[0]&&a[1]?a:void 0,onChange:c=>b(c?[c[0].format("YYYY-MM-DD"),c[1].format("YYYY-MM-DD")]:["",""])})}};exports.createMobileApprovalComponents=G;
|
package/dist/mobile.mjs
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { jsx as p, jsxs as F, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d, useEffect as j } from "react";
|
|
3
|
+
const Y = (r, t) => {
|
|
4
|
+
if (t.every((s) => r.get(s.value) === s.label)) return r;
|
|
5
|
+
const u = new Map(r);
|
|
6
|
+
return t.forEach((s) => u.set(s.value, s.label)), u;
|
|
7
|
+
}, H = (r) => {
|
|
8
|
+
if (!Array.isArray(r) || r.some((t) => !t || typeof t.value != "string" || !t.value || typeof t.label != "string") || new Set(r.map((t) => t.value)).size !== r.length) throw new Error("Invalid applicant options");
|
|
9
|
+
return r;
|
|
10
|
+
}, X = ({ Tabs: r, Button: t, mobile: u, loadApplicants: s, logger: w }) => {
|
|
11
|
+
const { FilterTrigger: I, DateRangeField: K, SearchPickerSheet: N } = u, g = (l) => {
|
|
12
|
+
try {
|
|
13
|
+
w ? w(l) : l.phase === "error" ? console.warn("[make-app-approval]", l) : console.info("[make-app-approval]", l);
|
|
14
|
+
} catch {
|
|
15
|
+
console.warn("[make-app-approval] diagnostic sink failed");
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
Tabs: r,
|
|
20
|
+
Button: t,
|
|
21
|
+
Input: ({ id: l, ariaLabel: h, value: a, onChange: f, placeholder: n, disabled: o }) => /* @__PURE__ */ p(
|
|
22
|
+
"input",
|
|
23
|
+
{
|
|
24
|
+
className: "make-app-approval-mobile-input",
|
|
25
|
+
type: "search",
|
|
26
|
+
id: l,
|
|
27
|
+
"aria-label": h,
|
|
28
|
+
value: a,
|
|
29
|
+
placeholder: n,
|
|
30
|
+
disabled: o,
|
|
31
|
+
autoComplete: "off",
|
|
32
|
+
onChange: (C) => f(C.target.value)
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
Select: ({ id: l, ariaLabel: h, value: a, onChange: f, options: n, selectedOption: o, disabled: C }) => {
|
|
36
|
+
const [y, D] = d(!1), [v, k] = d(""), [O, T] = d(0), [V, A] = d([]), [L, S] = d("ready"), [z, M] = d(() => new Map(n.map((e) => [e.value, e.label])));
|
|
37
|
+
j(() => M((e) => Y(e, n)), [n]), j(() => {
|
|
38
|
+
if (!y || !s) return;
|
|
39
|
+
const e = new AbortController();
|
|
40
|
+
let m = !0, c = !1;
|
|
41
|
+
return A([]), S("loading"), g({ operation: "applicants", phase: "start" }), Promise.resolve().then(() => s(v.trim(), { signal: e.signal })).then(H).then((i) => {
|
|
42
|
+
c = !0, !(!m || e.signal.aborted) && (A(i), M((b) => Y(b, i)), S("ready"), g({ operation: "applicants", phase: "success", count: i.length }));
|
|
43
|
+
}).catch(() => {
|
|
44
|
+
c = !0, !(!m || e.signal.aborted) && (S("error"), g({ operation: "applicants", phase: "error" }));
|
|
45
|
+
}), () => {
|
|
46
|
+
m = !1, c || (e.abort(), g({ operation: "applicants", phase: "cancel" }));
|
|
47
|
+
};
|
|
48
|
+
}, [y, v, O]);
|
|
49
|
+
const P = n.find((e) => e.value === "")?.label ?? "全部申请人", R = (o?.value === a ? o.label : void 0) ?? n.find((e) => e.value === a)?.label ?? z.get(a) ?? (a ? "已选择" : P), q = (s ? V : n.filter((e) => e.label.includes(v.trim()))).filter((e) => e.value !== "").map((e) => ({ key: e.value, label: e.label })), x = () => {
|
|
50
|
+
D(!1), k("");
|
|
51
|
+
};
|
|
52
|
+
return /* @__PURE__ */ F(G, { children: [
|
|
53
|
+
/* @__PURE__ */ p(
|
|
54
|
+
I,
|
|
55
|
+
{
|
|
56
|
+
id: l,
|
|
57
|
+
type: "button",
|
|
58
|
+
"aria-label": h,
|
|
59
|
+
"aria-haspopup": "dialog",
|
|
60
|
+
"aria-expanded": y,
|
|
61
|
+
disabled: C,
|
|
62
|
+
muted: !a,
|
|
63
|
+
onClick: () => {
|
|
64
|
+
k(""), D(!0);
|
|
65
|
+
},
|
|
66
|
+
children: a ? R : P
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
/* @__PURE__ */ p(
|
|
70
|
+
N,
|
|
71
|
+
{
|
|
72
|
+
title: "选择申请人",
|
|
73
|
+
open: y,
|
|
74
|
+
onClose: x,
|
|
75
|
+
selectionMode: "single",
|
|
76
|
+
items: q,
|
|
77
|
+
searchValue: v,
|
|
78
|
+
onSearchValueChange: k,
|
|
79
|
+
searchPlaceholder: "搜索申请人",
|
|
80
|
+
emptyContent: L === "loading" ? /* @__PURE__ */ p("p", { role: "status", children: "正在加载申请人…" }) : L === "error" ? /* @__PURE__ */ F("div", { role: "alert", children: [
|
|
81
|
+
"申请人加载失败,请重试",
|
|
82
|
+
/* @__PURE__ */ p(t, { htmlType: "button", variant: "text", ariaLabel: "重试加载申请人", onClick: () => T((e) => e + 1), children: "重试" })
|
|
83
|
+
] }) : "暂无可选申请人",
|
|
84
|
+
selectedKeys: a ? [a] : [],
|
|
85
|
+
selectedItems: a ? [{ key: a, label: R }] : [],
|
|
86
|
+
onSelectedKeysChange: () => {
|
|
87
|
+
},
|
|
88
|
+
onConfirm: ({ selectedItems: e, selectedKeys: m }) => {
|
|
89
|
+
const c = m[0] ?? "", i = e.find((b) => b.key === c);
|
|
90
|
+
M((b) => Y(b, e.map((E) => ({ value: E.key, label: E.label })))), f(c, i ? { value: c, label: i.label } : void 0), x();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
] });
|
|
95
|
+
},
|
|
96
|
+
DateRangePicker: ({ id: l, ariaLabel: h, value: a, onChange: f, disabled: n }) => /* @__PURE__ */ p(
|
|
97
|
+
K,
|
|
98
|
+
{
|
|
99
|
+
id: l,
|
|
100
|
+
fieldName: h,
|
|
101
|
+
variant: "filter",
|
|
102
|
+
disabled: n,
|
|
103
|
+
value: a[0] && a[1] ? a : void 0,
|
|
104
|
+
onChange: (o) => f(o ? [o[0].format("YYYY-MM-DD"), o[1].format("YYYY-MM-DD")] : ["", ""])
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
export {
|
|
110
|
+
X as createMobileApprovalComponents
|
|
111
|
+
};
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import type { CSSProperties } from "react";
|
|
2
|
+
import type { MakeApprovalPresentation } from "../theme.js";
|
|
2
3
|
export type ApprovalStatusProps = {
|
|
3
4
|
value: unknown;
|
|
4
5
|
className?: string;
|
|
5
6
|
style?: CSSProperties;
|
|
7
|
+
presentation?: MakeApprovalPresentation;
|
|
6
8
|
};
|
|
7
|
-
export declare const ApprovalStatus: ({ value, className, style }: ApprovalStatusProps) => import("react").JSX.Element;
|
|
9
|
+
export declare const ApprovalStatus: ({ value, className, style, presentation }: ApprovalStatusProps) => import("react").JSX.Element;
|
|
10
|
+
export { MakeApprovalThemeProvider, useMakeApprovalThemeStyle } from "./theme.js";
|
|
11
|
+
export type { MakeApprovalThemeProviderProps } from "./theme.js";
|
|
12
|
+
export type { MakeApprovalTheme, MakeApprovalThemeStyle, MakeApprovalPresentation } from "../theme.js";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import { type MakeApprovalTheme, type MakeApprovalPresentation } from "../theme.js";
|
|
3
|
+
export type MakeApprovalThemeProviderProps = Readonly<{
|
|
4
|
+
theme?: MakeApprovalTheme;
|
|
5
|
+
presentation?: MakeApprovalPresentation;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}>;
|
|
8
|
+
/** Context only. It never adds a DOM wrapper, mutates global CSS, or keys business controllers. */
|
|
9
|
+
export declare const MakeApprovalThemeProvider: ({ theme, presentation, children }: MakeApprovalThemeProviderProps) => import("react").JSX.Element;
|
|
10
|
+
export declare const useApprovalThemeState: (presentation?: MakeApprovalPresentation) => {
|
|
11
|
+
theme: Readonly<{
|
|
12
|
+
colors?: Readonly<Partial<Record<import("../theme.js").MakeApprovalColor, string>>>;
|
|
13
|
+
typography?: Readonly<{
|
|
14
|
+
fontFamily?: string;
|
|
15
|
+
headingFontFamily?: string;
|
|
16
|
+
roles?: Readonly<Partial<Record<import("../theme.js").MakeApprovalTypographyRole, number>>>;
|
|
17
|
+
lineHeight?: number;
|
|
18
|
+
weights?: Readonly<{
|
|
19
|
+
body?: number;
|
|
20
|
+
heading?: number;
|
|
21
|
+
}>;
|
|
22
|
+
tracking?: Readonly<{
|
|
23
|
+
body?: number;
|
|
24
|
+
heading?: number;
|
|
25
|
+
}>;
|
|
26
|
+
}>;
|
|
27
|
+
density?: Readonly<{
|
|
28
|
+
controlHeight?: number;
|
|
29
|
+
rowHeight?: number;
|
|
30
|
+
headerHeight?: number;
|
|
31
|
+
}>;
|
|
32
|
+
spacing?: Readonly<{
|
|
33
|
+
controlInline?: number;
|
|
34
|
+
controlBlock?: number;
|
|
35
|
+
field?: number;
|
|
36
|
+
section?: number;
|
|
37
|
+
tableCell?: number;
|
|
38
|
+
tableHeader?: number;
|
|
39
|
+
}>;
|
|
40
|
+
radius?: Readonly<{
|
|
41
|
+
control?: number;
|
|
42
|
+
panel?: number;
|
|
43
|
+
popup?: number;
|
|
44
|
+
}>;
|
|
45
|
+
border?: Readonly<{
|
|
46
|
+
width?: number;
|
|
47
|
+
color?: string;
|
|
48
|
+
subtleColor?: string;
|
|
49
|
+
}>;
|
|
50
|
+
shadow?: Readonly<{
|
|
51
|
+
panel?: string;
|
|
52
|
+
popup?: string;
|
|
53
|
+
}>;
|
|
54
|
+
}> | undefined;
|
|
55
|
+
presentation: MakeApprovalPresentation;
|
|
56
|
+
style: CSSProperties | undefined;
|
|
57
|
+
};
|
|
58
|
+
/** Apply to a host-owned portal surface when renderLayout moves package slots outside their DOM ancestor. */
|
|
59
|
+
export declare const useMakeApprovalThemeStyle: (presentation?: MakeApprovalPresentation) => CSSProperties;
|
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),t=require("./theme-pzn9q1zq.cjs"),n=require("./index.cjs"),i=({value:r,className:p,style:a,presentation:s})=>{const o=n.getApprovalStatusDisplay(r),e=t.useApprovalThemeState(s);return l.jsx("span",{className:["make-app-approval-status",p].filter(Boolean).join(" "),"data-tone":o.tone,"data-make-approval-theme":e.style?e.presentation:void 0,"data-make-approval-presentation":e.presentation==="mobile"?"mobile":void 0,style:e.style?{...e.style,...a}:a,children:o.label})};exports.MakeApprovalThemeProvider=t.MakeApprovalThemeProvider;exports.useMakeApprovalThemeStyle=t.useMakeApprovalThemeStyle;exports.ApprovalStatus=i;
|
package/dist/react.mjs
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { u as l } from "./theme-qxOS-jIA.js";
|
|
3
|
+
import { M as c, a as f } from "./theme-qxOS-jIA.js";
|
|
4
|
+
import { getApprovalStatusDisplay as m } from "./index.mjs";
|
|
5
|
+
const u = ({ value: o, className: p, style: a, presentation: r }) => {
|
|
6
|
+
const t = m(o), e = l(r);
|
|
5
7
|
return /* @__PURE__ */ s(
|
|
6
8
|
"span",
|
|
7
9
|
{
|
|
8
|
-
className: ["make-app-approval-status",
|
|
10
|
+
className: ["make-app-approval-status", p].filter(Boolean).join(" "),
|
|
9
11
|
"data-tone": t.tone,
|
|
10
|
-
style:
|
|
12
|
+
"data-make-approval-theme": e.style ? e.presentation : void 0,
|
|
13
|
+
"data-make-approval-presentation": e.presentation === "mobile" ? "mobile" : void 0,
|
|
14
|
+
style: e.style ? { ...e.style, ...a } : a,
|
|
11
15
|
children: t.label
|
|
12
16
|
}
|
|
13
17
|
);
|
|
14
18
|
};
|
|
15
19
|
export {
|
|
16
|
-
|
|
20
|
+
u as ApprovalStatus,
|
|
21
|
+
c as MakeApprovalThemeProvider,
|
|
22
|
+
f as useMakeApprovalThemeStyle
|
|
17
23
|
};
|
package/dist/styles.css
CHANGED
|
@@ -39,9 +39,15 @@
|
|
|
39
39
|
box-sizing: border-box;
|
|
40
40
|
}
|
|
41
41
|
/* 宿主页签与面板统一留白,筛选区仅保留下方间距。 */
|
|
42
|
-
.my-approvals .approval-host-tabs__control > .ui-tabs__list,
|
|
43
|
-
.make-app-approval .approval-host-tabs__control > .ui-tabs__list { padding-left: 12px; padding-right: 12px; }
|
|
44
|
-
.make-app-approval .ui-tabs__panel { padding: 12px; }
|
|
42
|
+
.my-approvals .make-app-approval:not(.make-app-approval--standard) .approval-host-tabs__control > .ui-tabs__list,
|
|
43
|
+
.make-app-approval:not(.make-app-approval--standard) .approval-host-tabs__control > .ui-tabs__list { padding-left: 12px; padding-right: 12px; }
|
|
44
|
+
.make-app-approval:not(.make-app-approval--standard) .ui-tabs__panel { padding: 12px; }
|
|
45
|
+
/* 标准模式仅布局包自有节点,不依赖任何宿主 Tabs 内部类名。 */
|
|
46
|
+
.make-app-approval--standard { padding: 0 12px; }
|
|
47
|
+
.make-app-approval--standard > * { min-width: 0; }
|
|
48
|
+
.make-app-approval-panel { box-sizing: border-box; display: flex; flex: 1; flex-direction: column; min-height: 0; min-width: 0; padding: 12px 0; }
|
|
49
|
+
.make-app-approval--standard.make-app-approval--mobile,
|
|
50
|
+
.make-app-approval--mobile .make-app-approval-panel { padding: 0; }
|
|
45
51
|
.make-app-approval-filters { display: flex; flex: none; align-items: end; flex-wrap: wrap; gap: 14px; margin: 0; padding: 0 0 12px; }
|
|
46
52
|
.make-app-approval-filter-field { display: flex; flex-direction: column; gap: 6px; width: 200px; min-width: 0; }
|
|
47
53
|
.make-app-approval-filter-actions { display: flex; align-items: center; gap: 8px; }
|
|
@@ -133,6 +139,7 @@
|
|
|
133
139
|
/* 手机 View 由宿主显式选择;不改变桌面/平板 Canvas 布局。 */
|
|
134
140
|
.make-app-approval--mobile { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
|
|
135
141
|
.make-app-approval--mobile .make-app-approval-filters { align-items: stretch; flex-direction: row; flex-wrap: wrap; gap: 12px; padding: 12px 16px; background: var(--make-approval-bg); }
|
|
142
|
+
.make-app-approval--standard.make-app-approval--mobile .make-app-approval-filters { align-items: center; row-gap: 0; column-gap: 12px; }
|
|
136
143
|
.make-app-approval--mobile .make-app-approval-filter-field,
|
|
137
144
|
.make-app-approval--mobile .make-app-approval-date-control { width: calc((100% - 12px) / 2); }
|
|
138
145
|
.make-app-approval--mobile .make-app-approval-filter-field:first-child { width: 100%; display: flex; flex-direction: row; align-items: center; gap: 0; border-radius: var(--make-approval-radius); background: var(--make-approval-header); }
|
|
@@ -140,6 +147,13 @@
|
|
|
140
147
|
.make-app-approval--mobile .make-app-approval-filter-field:first-child > input,
|
|
141
148
|
.make-app-approval--mobile .make-app-approval-filter-field:first-child > .ui-input-wrapper { flex: 1; min-width: 0; border: 0; background: transparent; box-shadow: none; }
|
|
142
149
|
.make-app-approval--mobile input { font-size: 16px; }
|
|
150
|
+
/* 标准搜索拥有28px视觉底色和44px真实点击层,不受宿主Button的outlined映射影响。 */
|
|
151
|
+
.make-app-approval--standard.make-app-approval--mobile .make-app-approval-filter-field:first-child { position: relative; min-height: 44px; background: transparent; }
|
|
152
|
+
.make-app-approval--standard.make-app-approval--mobile .make-app-approval-filter-field:first-child::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 28px; transform: translateY(-50%); border-radius: var(--make-approval-radius); background: var(--make-approval-header); pointer-events: none; }
|
|
153
|
+
.make-app-approval--standard.make-app-approval--mobile .make-app-approval-filter-field:first-child > .make-app-approval-mobile-search-button { position: relative; width: 44px; height: 44px; min-width: 44px; min-height: 44px; border: 0; border-radius: var(--make-approval-radius); background: transparent; box-shadow: none; font: inherit; cursor: pointer; }
|
|
154
|
+
.make-app-approval-mobile-input { position: relative; flex: 1; width: 100%; min-width: 0; box-sizing: border-box; height: 28px; padding: 0 8px 0 0; border: 0; border-radius: var(--make-approval-radius); background: transparent; color: inherit; font: inherit; font-size: 16px; line-height: 24px; }
|
|
155
|
+
.make-app-approval-mobile-search-button:focus-visible,
|
|
156
|
+
.make-app-approval-mobile-input:focus-visible { outline: 2px solid var(--make-approval-primary); outline-offset: -2px; }
|
|
143
157
|
.make-app-approval--mobile .make-app-approval-results { min-height: 0; flex: 1; overflow: hidden; display: flex; flex-direction: column; background: var(--make-approval-header); }
|
|
144
158
|
.make-app-approval--mobile .make-app-approval-overlay { inset: 0; }
|
|
145
159
|
.make-app-approval-mobile-list { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior-y: contain; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
|
|
@@ -153,3 +167,145 @@
|
|
|
153
167
|
.make-app-approval-mobile-person { display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
|
|
154
168
|
.make-app-approval-mobile-avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; font-size: 9px; border-radius: 50%; background: var(--make-approval-primary); color: var(--make-approval-primary-foreground); }
|
|
155
169
|
.make-app-approval-mobile-feedback { flex: none; text-align: center; color: var(--make-approval-muted); padding: 12px 0; margin: 0; }
|
|
170
|
+
|
|
171
|
+
/* 可选语义主题:仅包自有节点消费。旧公开变量和省略 Provider 的发布基线不变。 */
|
|
172
|
+
.make-app-approval[data-make-approval-theme="desktop"],
|
|
173
|
+
.make-app-approval-detail[data-make-approval-theme="desktop"] {
|
|
174
|
+
color: var(--make-approval-theme-text, var(--make-approval-foreground, #1f2937));
|
|
175
|
+
background: var(--make-approval-theme-surface, var(--make-approval-bg, #fff));
|
|
176
|
+
border-radius: var(--make-approval-theme-radius-panel, 0);
|
|
177
|
+
box-shadow: var(--make-approval-theme-shadow-panel, none);
|
|
178
|
+
}
|
|
179
|
+
[data-make-approval-theme="desktop"] :where(.make-app-approval-detail-content, .make-app-approval-detail-section, .make-app-approval-detail-header, .make-app-approval-detail-footer, .make-app-approval-overlay, .make-app-approval-table-feedback, .make-app-approval-table-loading):not([data-make-approval-presentation="mobile"], [data-make-approval-presentation="mobile"] *) {
|
|
180
|
+
color: var(--make-approval-theme-text, #1f2937);
|
|
181
|
+
background: var(--make-approval-theme-surface, #fff);
|
|
182
|
+
border-color: var(--make-approval-theme-border-color, #f0f0f0);
|
|
183
|
+
}
|
|
184
|
+
.make-app-approval-detail-section[data-make-approval-theme="desktop"] {
|
|
185
|
+
padding: var(--make-approval-theme-spacing-section, 16px) var(--make-approval-theme-spacing-section, 24px);
|
|
186
|
+
color: var(--make-approval-theme-text, #1f2937);
|
|
187
|
+
background: var(--make-approval-theme-surface, #fff);
|
|
188
|
+
border-color: var(--make-approval-theme-border-color, #f0f0f0);
|
|
189
|
+
}
|
|
190
|
+
@media (max-width: 680px) {
|
|
191
|
+
.make-app-approval-detail-section[data-make-approval-theme="desktop"] { padding: var(--make-approval-theme-spacing-section, 16px); }
|
|
192
|
+
}
|
|
193
|
+
[data-make-approval-theme="desktop"] :where(.make-app-approval-detail-field, .make-app-approval-detail-fields):not([data-make-approval-presentation="mobile"] *) { border-color: var(--make-approval-theme-border-subtle-color, #f0f0f0); }
|
|
194
|
+
[data-make-approval-theme="desktop"] .make-app-approval-detail-fields:not([data-make-approval-presentation="mobile"] *) { column-gap: var(--make-approval-theme-spacing-field, 28px); }
|
|
195
|
+
[data-make-approval-theme="desktop"] .make-app-approval-detail-field:not([data-make-approval-presentation="mobile"] *) { column-gap: var(--make-approval-theme-spacing-field, 14px); }
|
|
196
|
+
[data-make-approval-theme="desktop"] :where(.make-app-approval-detail-value, .make-app-approval-detail-field > label, .make-app-approval-detail-opinion > label, .make-app-approval-detail-title h2, .make-app-approval-detail-section h3, .make-app-approval-detail-loading, .make-app-approval-table-loading, .make-app-approval-table-feedback, .make-app-approval-filter-field, .make-app-approval-filter-actions):not([data-make-approval-presentation="mobile"] *) {
|
|
197
|
+
font-family: var(--make-approval-theme-font-family, inherit);
|
|
198
|
+
font-size: var(--make-approval-theme-font-size-body, 14px);
|
|
199
|
+
font-weight: var(--make-approval-theme-font-weight-body, 400);
|
|
200
|
+
line-height: var(--make-approval-theme-line-height, 20px);
|
|
201
|
+
letter-spacing: var(--make-approval-theme-tracking-body, normal);
|
|
202
|
+
color: var(--make-approval-theme-text, #1f2937);
|
|
203
|
+
}
|
|
204
|
+
/* 部分主题保留节点原有排版;意见分段独立移入Portal时也命中,手机继续隔离PC值。 */
|
|
205
|
+
[data-make-approval-theme="desktop"] :where(.make-app-approval-detail-opinion > label):not([data-make-approval-presentation="mobile"] *) { font-weight: var(--make-approval-theme-font-weight-body, 600); }
|
|
206
|
+
[data-make-approval-theme="desktop"] .make-app-approval-table-loading:not([data-make-approval-presentation="mobile"] *) { font-size: var(--make-approval-theme-font-size-meta, 12px); }
|
|
207
|
+
[data-make-approval-theme="desktop"] :where(.make-app-approval-detail-title h2, .make-app-approval-detail-section h3):not([data-make-approval-presentation="mobile"] *) { color: var(--make-approval-theme-heading-text, var(--make-approval-theme-text, #1f2937)); font-family: var(--make-approval-theme-heading-font-family, var(--make-approval-theme-font-family, inherit)); font-weight: var(--make-approval-theme-font-weight-heading, 600); }
|
|
208
|
+
[data-make-approval-theme="desktop"] :where(.make-app-approval-overlay, .make-app-approval-table-feedback, .make-app-approval-table-loading):not([data-make-approval-presentation="mobile"] *) {
|
|
209
|
+
color: var(--make-approval-theme-secondary-text, var(--make-approval-muted));
|
|
210
|
+
background: var(--make-approval-theme-surface, var(--make-approval-bg));
|
|
211
|
+
border-color: var(--make-approval-theme-border-color, var(--make-approval-border));
|
|
212
|
+
}
|
|
213
|
+
[data-make-approval-theme="desktop"] .make-app-approval-detail-title h2:not([data-make-approval-presentation="mobile"] *) { font-size: var(--make-approval-theme-font-size-record-title, 16px); }
|
|
214
|
+
[data-make-approval-theme="desktop"] .make-app-approval-detail-section h3:not([data-make-approval-presentation="mobile"] *) { font-size: var(--make-approval-theme-font-size-section-title, 14px); }
|
|
215
|
+
[data-make-approval-theme="desktop"] .make-app-approval-detail-field > label:not([data-make-approval-presentation="mobile"] *) { color: var(--make-approval-theme-secondary-text, #64748b); font-size: var(--make-approval-theme-font-size-field-label, 14px); }
|
|
216
|
+
[data-make-approval-theme="desktop"] .make-app-approval-detail-field[data-invalid="true"] > label:not([data-make-approval-presentation="mobile"] *) { color: var(--make-approval-theme-danger, var(--make-approval-error, var(--make-mobile-error, #dc2626))); }
|
|
217
|
+
[data-make-approval-theme="desktop"] .make-app-approval-inline-editor:not([data-disabled="true"]):is(:hover,:focus-within):not([data-make-approval-presentation="mobile"] *) { background: var(--make-approval-theme-hover-surface, #f2f4f7); }
|
|
218
|
+
.make-app-approval-status[data-make-approval-theme="desktop"] { background: var(--make-approval-theme-subtle-surface, var(--make-approval-surface, hsl(var(--muted, 150 22% 94%)))); color: var(--make-approval-theme-secondary-text, var(--make-approval-text, hsl(var(--muted-foreground, 160 8% 42%)))); font-family: var(--make-approval-theme-font-family, inherit); font-size: var(--make-approval-theme-font-size-meta, 12px); border-radius: var(--make-approval-theme-radius-control, 4px); }
|
|
219
|
+
.make-app-approval-status[data-make-approval-theme="desktop"][data-tone="success"] { color: var(--make-approval-theme-success, var(--make-approval-theme-primary, var(--make-approval-primary, hsl(var(--primary, 176 77% 26%))))); }
|
|
220
|
+
.make-app-approval-status[data-make-approval-theme][data-tone="processing"] { color: var(--make-approval-theme-primary, var(--make-approval-primary, hsl(var(--primary, 176 77% 26%)))); }
|
|
221
|
+
.make-app-approval-status[data-make-approval-theme="desktop"]:is([data-tone="danger"],[data-tone="unknown"]) { color: var(--make-approval-theme-danger, var(--make-approval-error, var(--make-mobile-error, #dc2626))); }
|
|
222
|
+
[data-make-approval-theme="desktop"] :where(.make-app-approval-detail-error,.make-app-approval-error):not([data-make-approval-presentation="mobile"] *) { color: var(--make-approval-theme-danger, var(--make-approval-error, var(--make-mobile-error, #dc2626))); }
|
|
223
|
+
[data-make-approval-theme] .make-app-approval-loading-spinner { border-top-color: var(--make-approval-theme-primary, var(--make-approval-primary, hsl(var(--primary, 176 77% 26%)))); }
|
|
224
|
+
[data-make-approval-theme="mobile"] :where(.make-app-approval-mobile-card,.make-app-approval-mobile-input,.make-app-approval-mobile-search-button):focus-visible { outline-color: var(--make-approval-theme-focus-ring, var(--make-approval-theme-primary, var(--make-approval-primary))); }
|
|
225
|
+
[data-make-approval-theme="mobile"] .make-app-approval-mobile-avatar { color: var(--make-approval-theme-on-primary, var(--make-approval-primary-foreground)); background: var(--make-approval-theme-primary, var(--make-approval-primary)); }
|
|
226
|
+
|
|
227
|
+
/* 手机边界只隔离本次新增PC变量;旧--make-approval-*主题仍原样继承。 */
|
|
228
|
+
[data-make-approval-presentation="mobile"] {
|
|
229
|
+
--make-approval-theme-active-surface: initial;
|
|
230
|
+
--make-approval-theme-border-color: initial;
|
|
231
|
+
--make-approval-theme-border-subtle-color: initial;
|
|
232
|
+
--make-approval-theme-border-width: initial;
|
|
233
|
+
--make-approval-theme-control-height: initial;
|
|
234
|
+
--make-approval-theme-danger: initial;
|
|
235
|
+
--make-approval-theme-elevated-surface: initial;
|
|
236
|
+
--make-approval-theme-font-family: initial;
|
|
237
|
+
--make-approval-theme-font-size-body: initial;
|
|
238
|
+
--make-approval-theme-font-size-control-text: initial;
|
|
239
|
+
--make-approval-theme-font-size-field-label: initial;
|
|
240
|
+
--make-approval-theme-font-size-meta: initial;
|
|
241
|
+
--make-approval-theme-font-size-record-title: initial;
|
|
242
|
+
--make-approval-theme-font-size-section-title: initial;
|
|
243
|
+
--make-approval-theme-font-weight-body: initial;
|
|
244
|
+
--make-approval-theme-font-weight-heading: initial;
|
|
245
|
+
--make-approval-theme-header-height: initial;
|
|
246
|
+
--make-approval-theme-heading-font-family: initial;
|
|
247
|
+
--make-approval-theme-heading-text: initial;
|
|
248
|
+
--make-approval-theme-hover-surface: initial;
|
|
249
|
+
--make-approval-theme-line-height: initial;
|
|
250
|
+
--make-approval-theme-mask: initial;
|
|
251
|
+
--make-approval-theme-page: initial;
|
|
252
|
+
--make-approval-theme-placeholder-text: initial;
|
|
253
|
+
--make-approval-theme-radius-control: initial;
|
|
254
|
+
--make-approval-theme-radius-panel: initial;
|
|
255
|
+
--make-approval-theme-radius-popup: initial;
|
|
256
|
+
--make-approval-theme-row-height: initial;
|
|
257
|
+
--make-approval-theme-secondary-text: initial;
|
|
258
|
+
--make-approval-theme-selected-surface: initial;
|
|
259
|
+
--make-approval-theme-shadow-panel: initial;
|
|
260
|
+
--make-approval-theme-shadow-popup: initial;
|
|
261
|
+
--make-approval-theme-spacing-control-block: initial;
|
|
262
|
+
--make-approval-theme-spacing-control-inline: initial;
|
|
263
|
+
--make-approval-theme-spacing-field: initial;
|
|
264
|
+
--make-approval-theme-spacing-section: initial;
|
|
265
|
+
--make-approval-theme-spacing-table-cell: initial;
|
|
266
|
+
--make-approval-theme-spacing-table-header: initial;
|
|
267
|
+
--make-approval-theme-subtle-surface: initial;
|
|
268
|
+
--make-approval-theme-success: initial;
|
|
269
|
+
--make-approval-theme-surface: initial;
|
|
270
|
+
--make-approval-theme-tertiary-text: initial;
|
|
271
|
+
--make-approval-theme-text: initial;
|
|
272
|
+
--make-approval-theme-tracking-body: initial;
|
|
273
|
+
--make-approval-theme-tracking-heading: initial;
|
|
274
|
+
--make-approval-theme-warning: initial;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
[data-make-approval-theme="desktop"] :where(.make-app-approval-detail-title h2,.make-app-approval-detail-section h3):not([data-make-approval-presentation="mobile"] *) { letter-spacing: var(--make-approval-theme-tracking-heading, normal); }
|
|
278
|
+
|
|
279
|
+
/* 移入Portal的标题/分段仍由其自有边界消费,不要求宿主复制包CSS或再加Controller。 */
|
|
280
|
+
.make-app-approval-detail-title[data-make-approval-theme="desktop"] > h2,
|
|
281
|
+
.make-app-approval-detail-section[data-make-approval-theme="desktop"] > h3 {
|
|
282
|
+
color: var(--make-approval-theme-heading-text, var(--make-approval-theme-text, #1f2937));
|
|
283
|
+
font-family: var(--make-approval-theme-heading-font-family, var(--make-approval-theme-font-family, inherit));
|
|
284
|
+
font-weight: var(--make-approval-theme-font-weight-heading, 600);
|
|
285
|
+
line-height: var(--make-approval-theme-line-height, 20px);
|
|
286
|
+
letter-spacing: var(--make-approval-theme-tracking-heading, normal);
|
|
287
|
+
}
|
|
288
|
+
.make-app-approval-detail-title[data-make-approval-theme="desktop"] > h2 { font-size: var(--make-approval-theme-font-size-record-title, 16px); }
|
|
289
|
+
.make-app-approval-detail-section[data-make-approval-theme="desktop"] > h3 { font-size: var(--make-approval-theme-font-size-section-title, 14px); }
|
|
290
|
+
|
|
291
|
+
.make-app-approval-detail-loading[data-make-approval-theme="desktop"] { color: var(--make-approval-theme-secondary-text, #64748b); font-family: var(--make-approval-theme-font-family, inherit); font-size: var(--make-approval-theme-font-size-body, 14px); line-height: var(--make-approval-theme-line-height, 20px); }
|
|
292
|
+
|
|
293
|
+
/* 每个公开可移动槽自身拥有表面;宿主只传slots.themeStyle即可,不复制私有标记。 */
|
|
294
|
+
.make-app-approval-detail-content[data-make-approval-theme="desktop"],
|
|
295
|
+
.make-app-approval-detail-actions[data-make-approval-theme="desktop"],
|
|
296
|
+
.make-app-approval-detail-message[data-make-approval-theme="desktop"],
|
|
297
|
+
.make-app-approval-detail-request-state[data-make-approval-theme="desktop"] {
|
|
298
|
+
color: var(--make-approval-theme-text, #1f2937);
|
|
299
|
+
background: var(--make-approval-theme-surface, #fff);
|
|
300
|
+
}
|
|
301
|
+
.make-app-approval-detail-message[data-make-approval-theme="desktop"],
|
|
302
|
+
.make-app-approval-detail-request-state[data-make-approval-theme="desktop"] {
|
|
303
|
+
font-family: var(--make-approval-theme-font-family, inherit);
|
|
304
|
+
font-size: var(--make-approval-theme-font-size-body, 14px);
|
|
305
|
+
line-height: var(--make-approval-theme-line-height, 20px);
|
|
306
|
+
letter-spacing: var(--make-approval-theme-tracking-body, normal);
|
|
307
|
+
}
|
|
308
|
+
.make-app-approval-detail-error[data-make-approval-theme="desktop"],
|
|
309
|
+
.make-app-approval-detail-request-state[data-make-approval-theme="desktop"] > [role="alert"] { color: var(--make-approval-theme-danger, var(--make-approval-error, var(--make-mobile-error, #dc2626))); }
|
|
310
|
+
.make-app-approval-status[data-make-approval-theme="mobile"][data-tone="success"] { color: var(--make-approval-theme-primary, var(--make-approval-primary, hsl(var(--primary, 176 77% 26%)))); }
|
|
311
|
+
.make-app-approval-detail-loading[data-make-approval-theme="desktop"] { background: var(--make-approval-theme-surface, #fff); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const h=require("react/jsx-runtime"),o=require("react"),y=require("./index.cjs"),i=o.createContext({presentation:"desktop"}),u=(t,e)=>t?e?{...t,...e,colors:{...t.colors,...e.colors},typography:{...t.typography,...e.typography,roles:{...t.typography?.roles,...e.typography?.roles},tracking:{...t.typography?.tracking,...e.typography?.tracking},weights:{...t.typography?.weights,...e.typography?.weights}},density:{...t.density,...e.density},spacing:{...t.spacing,...e.spacing},radius:{...t.radius,...e.radius},border:{...t.border,...e.border},shadow:{...t.shadow,...e.shadow}}:t:e,d=({theme:t,presentation:e,children:s})=>{const r=o.useContext(i),p=o.useMemo(()=>({theme:u(r.theme,t),presentation:e??r.presentation}),[r,t,e]);return h.jsx(i.Provider,{value:p,children:s})},n=t=>{const e=o.useContext(i),s=t??e.presentation,r=o.useMemo(()=>y.toMakeApprovalThemeStyle(e.theme,s),[e.theme,s]);return{theme:e.theme,presentation:s,style:Object.keys(r).length?r:void 0}},g=t=>n(t).style??{};exports.MakeApprovalThemeProvider=d;exports.useApprovalThemeState=n;exports.useMakeApprovalThemeStyle=g;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as p, useMemo as i, createContext as n } from "react";
|
|
3
|
+
import { toMakeApprovalThemeStyle as g } from "./index.mjs";
|
|
4
|
+
const s = n({ presentation: "desktop" }), m = (t, e) => t ? e ? { ...t, ...e, colors: { ...t.colors, ...e.colors }, typography: { ...t.typography, ...e.typography, roles: { ...t.typography?.roles, ...e.typography?.roles }, tracking: { ...t.typography?.tracking, ...e.typography?.tracking }, weights: { ...t.typography?.weights, ...e.typography?.weights } }, density: { ...t.density, ...e.density }, spacing: { ...t.spacing, ...e.spacing }, radius: { ...t.radius, ...e.radius }, border: { ...t.border, ...e.border }, shadow: { ...t.shadow, ...e.shadow } } : t : e, k = ({ theme: t, presentation: e, children: r }) => {
|
|
5
|
+
const o = p(s), h = i(() => ({ theme: m(o.theme, t), presentation: e ?? o.presentation }), [o, t, e]);
|
|
6
|
+
return /* @__PURE__ */ y(s.Provider, { value: h, children: r });
|
|
7
|
+
}, d = (t) => {
|
|
8
|
+
const e = p(s), r = t ?? e.presentation, o = i(() => g(e.theme, r), [e.theme, r]);
|
|
9
|
+
return { theme: e.theme, presentation: r, style: Object.keys(o).length ? o : void 0 };
|
|
10
|
+
}, v = (t) => d(t).style ?? {};
|
|
11
|
+
export {
|
|
12
|
+
k as M,
|
|
13
|
+
v as a,
|
|
14
|
+
d as u
|
|
15
|
+
};
|
package/dist/theme.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Optional semantic presentation only; never carries MakeDesign IDs or business state. */
|
|
2
|
+
export declare const MAKE_APPROVAL_THEME_CONTRACT: "make-app-approval/semantic-theme/v1";
|
|
3
|
+
export type MakeApprovalPresentation = "desktop" | "mobile";
|
|
4
|
+
export type MakeApprovalColor = "primary" | "onPrimary" | "primarySoft" | "link" | "focusRing" | "text" | "headingText" | "secondaryText" | "tertiaryText" | "placeholderText" | "page" | "surface" | "elevatedSurface" | "subtleSurface" | "hoverSurface" | "selectedSurface" | "activeSurface" | "mask" | "success" | "warning" | "danger";
|
|
5
|
+
export type MakeApprovalTypographyRole = "recordTitle" | "sectionTitle" | "body" | "fieldLabel" | "controlText" | "meta";
|
|
6
|
+
export type MakeApprovalTheme = Readonly<{
|
|
7
|
+
colors?: Readonly<Partial<Record<MakeApprovalColor, string>>>;
|
|
8
|
+
typography?: Readonly<{
|
|
9
|
+
fontFamily?: string;
|
|
10
|
+
headingFontFamily?: string;
|
|
11
|
+
roles?: Readonly<Partial<Record<MakeApprovalTypographyRole, number>>>; /** Unitless multiplier. */
|
|
12
|
+
lineHeight?: number;
|
|
13
|
+
weights?: Readonly<{
|
|
14
|
+
body?: number;
|
|
15
|
+
heading?: number;
|
|
16
|
+
}>; /** em, not pixels. */
|
|
17
|
+
tracking?: Readonly<{
|
|
18
|
+
body?: number;
|
|
19
|
+
heading?: number;
|
|
20
|
+
}>;
|
|
21
|
+
}>;
|
|
22
|
+
density?: Readonly<{
|
|
23
|
+
controlHeight?: number;
|
|
24
|
+
rowHeight?: number;
|
|
25
|
+
headerHeight?: number;
|
|
26
|
+
}>;
|
|
27
|
+
spacing?: Readonly<{
|
|
28
|
+
controlInline?: number;
|
|
29
|
+
controlBlock?: number;
|
|
30
|
+
field?: number;
|
|
31
|
+
section?: number;
|
|
32
|
+
tableCell?: number;
|
|
33
|
+
tableHeader?: number;
|
|
34
|
+
}>;
|
|
35
|
+
radius?: Readonly<{
|
|
36
|
+
control?: number;
|
|
37
|
+
panel?: number;
|
|
38
|
+
popup?: number;
|
|
39
|
+
}>;
|
|
40
|
+
border?: Readonly<{
|
|
41
|
+
width?: number;
|
|
42
|
+
color?: string;
|
|
43
|
+
subtleColor?: string;
|
|
44
|
+
}>;
|
|
45
|
+
shadow?: Readonly<{
|
|
46
|
+
panel?: string;
|
|
47
|
+
popup?: string;
|
|
48
|
+
}>;
|
|
49
|
+
}>;
|
|
50
|
+
export type MakeApprovalThemeStyle = Readonly<Partial<Record<`--make-approval-theme-${string}`, string>>>;
|
|
51
|
+
/** Missing values emit nothing, so all 0.2.16 defaults and legacy public variables remain intact. */
|
|
52
|
+
export declare const toMakeApprovalThemeStyle: (theme?: MakeApprovalTheme, presentation?: MakeApprovalPresentation) => MakeApprovalThemeStyle;
|
package/docs/host-integration.md
CHANGED
|
@@ -57,6 +57,8 @@
|
|
|
57
57
|
|
|
58
58
|
## 宿主最小接入步骤
|
|
59
59
|
|
|
60
|
+
本轮标准展示为未发布候选,先按 [标准列表展示](../PUBLIC_API.md#标准列表展示未发布候选) 核验正式产物。新接入使用 `spacing="standard"`,宿主 Tabs 仅保留主题、键盘语义和确定高度链,不再添加页签/内容内边距;PC 的 12px 留白归审批包,手机 16px 筛选不叠加。旧应用不传 spacing 时保留旧行为。手机可使用 `/mobile` 的 `createMobileApprovalComponents`,由宿主一次注入公开移动 toolkit 和人员 I/O;这不是缺控件时的原生兜底,也不要求更换 UI 库。成功零条数据仍应看见四列表头和空态,不能以没有任务解释整块空白;检查请求状态及真实容器尺寸。
|
|
61
|
+
|
|
60
62
|
1. 安装审批包和 CanvasTable。未发布前使用本项目生成的 `.tgz`,不能直接安装不存在的 npm 版本。UI 从 npmjs 安装 `@qfei-design/canvas-table@1.3.2`;宿主默认使用公司安装源时,可在自己的 `.npmrc` 添加 `@qfei-design:registry=https://registry.npmjs.org/`。只有根入口工具需求的 Service 不必安装 CanvasTable。
|
|
61
63
|
2. 在 UI 入口导入一次 `@qfei-design/make-app-approval/styles.css`。
|
|
62
64
|
3. 在现有 App Service 增加审批查询适配,再通过 UI 已有鉴权/Trace/错误处理请求层调用它。不要在包里放 Token、环境 URL,也不要绕过 Service 直连工作流后端。
|
|
@@ -8,9 +8,11 @@ export const antdApprovalComponents: ApprovalUIComponents = {
|
|
|
8
8
|
id={id} aria-label={ariaLabel} value={value} placeholder={placeholder} disabled={disabled}
|
|
9
9
|
allowClear onChange={event => onChange(event.target.value)} style={{ width: "100%" }}
|
|
10
10
|
/>,
|
|
11
|
-
Select: ({ id, ariaLabel, value, onChange, options, disabled }) => <Select<string>
|
|
11
|
+
Select: ({ id, ariaLabel, value, onChange, options, selectedOption, disabled }) => <Select<string>
|
|
12
12
|
id={id} aria-label={ariaLabel} value={value} disabled={disabled}
|
|
13
|
-
options={options.map(option => ({ ...option }))}
|
|
13
|
+
options={options.map(option => ({ ...option }))}
|
|
14
|
+
labelRender={item => selectedOption?.value === item.value ? selectedOption.label : item.label ?? item.value}
|
|
15
|
+
onChange={value => onChange(value ?? "", options.find(option => option.value === value))} style={{ width: "100%" }}
|
|
14
16
|
/>,
|
|
15
17
|
DateRangePicker: ({ id, ariaLabel, value, onChange, placeholder, disabled }) => <DatePicker.RangePicker
|
|
16
18
|
id={{ start: id, end: `${id}-end` }} aria-label={ariaLabel}
|