@aplus-frontend/ui 6.41.0 → 7.0.0-beta.0

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.
Files changed (57) hide show
  1. package/es/src/ap-action/item/index.vue2.mjs +14 -12
  2. package/es/src/ap-action/style/index.d.ts +8 -0
  3. package/es/src/ap-action/style/index.js +61 -0
  4. package/es/src/ap-action/style/index.mjs +74 -0
  5. package/es/src/config-provider/config-provider-props.d.ts +7 -0
  6. package/es/src/config-provider/config-provider-props.mjs +6 -0
  7. package/es/src/config-provider/config-provider.d.ts +7 -0
  8. package/es/src/config-provider/config-provider.mjs +11 -10
  9. package/es/src/config-provider/hooks/use-global-config.d.ts +4 -0
  10. package/es/src/config-provider/hooks/use-global-config.mjs +27 -22
  11. package/es/src/config-provider/hooks/use-token.d.ts +4 -0
  12. package/es/src/config-provider/hooks/use-token.mjs +6 -0
  13. package/es/src/config-provider/index.d.ts +10 -0
  14. package/es/src/design-token/constants.d.ts +2 -0
  15. package/es/src/design-token/constants.mjs +44 -0
  16. package/es/src/design-token/interface.d.ts +123 -0
  17. package/es/src/style/index.d.ts +3 -0
  18. package/es/src/style/index.js +12 -0
  19. package/es/src/style/index.mjs +13 -0
  20. package/es/src/utils/cssinjs/index.d.ts +8 -0
  21. package/es/src/utils/cssinjs/index.mjs +56 -0
  22. package/es/src/version.d.ts +1 -1
  23. package/es/src/version.mjs +1 -1
  24. package/lib/src/ap-action/item/index.vue2.js +1 -1
  25. package/lib/src/ap-action/style/index.cjs +61 -0
  26. package/lib/src/ap-action/style/index.d.ts +8 -0
  27. package/lib/src/ap-action/style/index.js +1 -0
  28. package/lib/src/config-provider/config-provider-props.d.ts +7 -0
  29. package/lib/src/config-provider/config-provider-props.js +1 -1
  30. package/lib/src/config-provider/config-provider.d.ts +7 -0
  31. package/lib/src/config-provider/config-provider.js +1 -1
  32. package/lib/src/config-provider/hooks/use-global-config.d.ts +4 -0
  33. package/lib/src/config-provider/hooks/use-global-config.js +1 -1
  34. package/lib/src/config-provider/hooks/use-token.d.ts +4 -0
  35. package/lib/src/config-provider/hooks/use-token.js +1 -0
  36. package/lib/src/config-provider/index.d.ts +10 -0
  37. package/lib/src/design-token/constants.d.ts +2 -0
  38. package/lib/src/design-token/constants.js +1 -0
  39. package/lib/src/design-token/interface.d.ts +123 -0
  40. package/lib/src/style/index.cjs +12 -0
  41. package/lib/src/style/index.d.ts +3 -0
  42. package/lib/src/style/index.js +1 -0
  43. package/lib/src/utils/cssinjs/index.d.ts +8 -0
  44. package/lib/src/utils/cssinjs/index.js +1 -0
  45. package/lib/src/version.d.ts +1 -1
  46. package/lib/src/version.js +1 -1
  47. package/package.json +3 -1
  48. package/theme/ag-grid/index.css +0 -56
  49. package/theme/ag-grid-modal/index.css +0 -56
  50. package/theme/ap-action/item.css +0 -56
  51. package/theme/ap-action/item.less +1 -58
  52. package/theme/ap-grid/index.css +0 -56
  53. package/theme/ap-table/ap-table.css +0 -56
  54. package/theme/ap-table-modal/index.css +0 -56
  55. package/theme/editable-table/index.css +0 -56
  56. package/theme/index.css +0 -56
  57. package/theme/index.less +1 -1
@@ -0,0 +1,8 @@
1
+ import { BaseToken, GenStyleCallback } from '../../design-token/interface';
2
+ import { Ref } from 'vue';
3
+ type GeneraterOption = {
4
+ skipUnit: string[];
5
+ };
6
+ export declare function camelToKebab(str: string): string;
7
+ export declare function genComponentStyleHook<ComponentToken>(componentName: string, cb: GenStyleCallback<BaseToken & ComponentToken>, componentToken?: Partial<ComponentToken>, option?: GeneraterOption): (prefixCls: string) => Ref<string | undefined, string | undefined>;
8
+ export {};
@@ -0,0 +1,56 @@
1
+ import { omit as b, merge as d } from "lodash-unified";
2
+ import { ref as k, computed as C, watch as i } from "vue";
3
+ import { useToken as g } from "../../config-provider/hooks/use-token.mjs";
4
+ import { injectGlobal as T, css as $ } from "@emotion/css";
5
+ import "../../config-provider/index.mjs";
6
+ import { useGlobalConfig as V } from "../../config-provider/hooks/use-global-config.mjs";
7
+ function v(e, n) {
8
+ return Object.entries(e).reduce((o, [c, r]) => {
9
+ const s = typeof r == "number" && !n?.skipUnit?.includes(c) ? `${r}px` : r;
10
+ return o[l(c)] = s, o;
11
+ }, {});
12
+ }
13
+ function l(e) {
14
+ return "--" + e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
15
+ }
16
+ function S(e) {
17
+ const n = {};
18
+ for (const o in e)
19
+ n[o] = `var(${l(o)})`;
20
+ return n;
21
+ }
22
+ function z(e, n, o, c) {
23
+ return (r) => {
24
+ const s = k(), u = g(), p = V("namespace"), a = C(() => {
25
+ let t = b(u.value || {}, "components");
26
+ return t = {
27
+ ...t,
28
+ ...d(
29
+ o || {},
30
+ u.value.components?.[e] || {}
31
+ )
32
+ }, t;
33
+ });
34
+ return i(
35
+ () => a.value,
36
+ (t) => {
37
+ const m = S(t);
38
+ m.componentCls = `.${p.value}-${r}`;
39
+ const f = n(m);
40
+ T(f);
41
+ },
42
+ { immediate: !0, once: !0 }
43
+ ), i(
44
+ () => a.value,
45
+ (t) => {
46
+ const m = v(t, c);
47
+ s.value = $(m);
48
+ },
49
+ { deep: !0, immediate: !0 }
50
+ ), s;
51
+ };
52
+ }
53
+ export {
54
+ l as camelToKebab,
55
+ z as genComponentStyleHook
56
+ };
@@ -1,2 +1,2 @@
1
- declare const _default: "6.41.0";
1
+ declare const _default: "7.0.0-beta.0";
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- const e = "6.41.0";
1
+ const e = "7.0.0-beta.0";
2
2
  export {
3
3
  e as default
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../../config-provider/index.js");const f=require("@aplus-frontend/antdv/es/button/LoadingIcon"),p=require("@aplus-frontend/antdv"),k=require("../../config-provider/hooks/use-namespace.js"),y={key:1},g=e.defineComponent({name:"ApActionItem",__name:"index",props:{text:{},color:{default:"primary"},disabled:{type:Boolean,default:!1},visible:{type:Boolean,default:!0},onAction:{type:Function},onClick:{type:Function},loading:{type:Boolean,default:!1},icon:{},iconFirst:{type:Boolean,default:!1},tooltip:{default:()=>({})}},setup(t){const i=e.useSlots(),a=e.createPropsRestProxy(t,["color","disabled","visible","loading","iconFirst","icon","tooltip"]),{b:u,m:n,e:d}=k.useNamespace("action-item"),r=e.ref(!1),c=e.computed(()=>t.iconFirst&&(t.icon||i.icon));function s(o){e.unref(l)||t.disabled||(a.onClick?.(o),a.onAction&&(r.value=!0,a.onAction(o).finally(()=>r.value=!1)))}const l=e.computed(()=>t.loading||e.unref(r)),m=e.computed(()=>[u(),n(t.color),c.value?n("icon-first"):null,t.disabled?n("disabled"):null,l.value?n("loading"):null].filter(Boolean));return(o,v)=>e.renderSlot(o.$slots,"trigger",{loading:l.value,disabled:o.disabled,onClick:s},()=>[o.visible?(e.openBlock(),e.createElementBlock("span",e.mergeProps({key:0},o.$attrs,{class:m.value,onClick:s}),[l.value?(e.openBlock(),e.createBlock(e.unref(f),{key:0,"prefix-cls":"btn","exist-icon":!1,loading:""})):e.createCommentVNode("",!0),o.icon||i.icon?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(d)("icon-wrapper"))},[e.createVNode(e.unref(p.Tooltip),e.mergeProps({title:c.value?o.text:null},o.tooltip),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon||i.icon)))]),_:1},16,["title"])],2)):e.createCommentVNode("",!0),c.value?e.createCommentVNode("",!0):e.renderSlot(o.$slots,"default",{key:2},()=>[e.isVNode(o.text)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.text),{key:0})):(e.openBlock(),e.createElementBlock("span",y,e.toDisplayString(o.text||""),1))])],16)):e.createCommentVNode("",!0)])}});exports.default=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");require("../../config-provider/index.js");const p=require("@aplus-frontend/antdv/es/button/LoadingIcon"),k=require("@aplus-frontend/antdv"),v=require("../style/index.js"),y=require("../../config-provider/hooks/use-namespace.js"),g={key:1},B=e.defineComponent({name:"ApActionItem",__name:"index",props:{text:{},color:{default:"primary"},disabled:{type:Boolean,default:!1},visible:{type:Boolean,default:!0},onAction:{type:Function},onClick:{type:Function},loading:{type:Boolean,default:!1},icon:{},iconFirst:{type:Boolean,default:!1},tooltip:{default:()=>({})}},setup(t){const i=e.useSlots(),a=e.createPropsRestProxy(t,["color","disabled","visible","loading","iconFirst","icon","tooltip"]),{b:u,m:n,e:d}=y.useNamespace("action-item"),r=e.ref(!1),c=e.computed(()=>t.iconFirst&&(t.icon||i.icon)),f=v.default("action");function s(o){e.unref(l)||t.disabled||(a.onClick?.(o),a.onAction&&(r.value=!0,a.onAction(o).finally(()=>r.value=!1)))}const l=e.computed(()=>t.loading||e.unref(r)),m=e.computed(()=>[f.value,u(),n(t.color),c.value?n("icon-first"):null,t.disabled?n("disabled"):null,l.value?n("loading"):null].filter(Boolean));return(o,C)=>e.renderSlot(o.$slots,"trigger",{loading:l.value,disabled:o.disabled,onClick:s},()=>[o.visible?(e.openBlock(),e.createElementBlock("span",e.mergeProps({key:0},o.$attrs,{class:m.value,onClick:s}),[l.value?(e.openBlock(),e.createBlock(e.unref(p),{key:0,"prefix-cls":"btn","exist-icon":!1,loading:""})):e.createCommentVNode("",!0),o.icon||i.icon?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(d)("icon-wrapper"))},[e.createVNode(e.unref(k.Tooltip),e.mergeProps({title:c.value?o.text:null},o.tooltip),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.icon||i.icon)))]),_:1},16,["title"])],2)):e.createCommentVNode("",!0),c.value?e.createCommentVNode("",!0):e.renderSlot(o.$slots,"default",{key:2},()=>[e.isVNode(o.text)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.text),{key:0})):(e.openBlock(),e.createElementBlock("span",g,e.toDisplayString(o.text||""),1))])],16)):e.createCommentVNode("",!0)])}});exports.default=B;
@@ -0,0 +1,61 @@
1
+ import { resetComponent } from '~/style';
2
+ import { genComponentStyleHook } from '~/utils/cssinjs';
3
+ export const genActionItemStyle = (token) => {
4
+ const { loadingOpacity, colorLink, colorLinkHover, colorSuccess, colorError, colorWarn, componentCls } = token;
5
+ return {
6
+ [`${componentCls}-item`]: {
7
+ display: 'inline-block',
8
+ cursor: 'pointer',
9
+ ...resetComponent(token),
10
+ '&--primary': {
11
+ color: colorLink,
12
+ [`&:not(${componentCls}-item--disabled):hover`]: {
13
+ color: colorLinkHover
14
+ },
15
+ [`&${componentCls}-item--disabled`]: {
16
+ color: token.colorLinkDisabled
17
+ }
18
+ },
19
+ '&--success': {
20
+ color: colorSuccess,
21
+ [`&${componentCls}-item--disabled`]: {
22
+ color: token.colorSuccessDisabled
23
+ }
24
+ },
25
+ '&--error': {
26
+ color: colorError,
27
+ [`&${componentCls}-item--disabled`]: {
28
+ color: token.colorErrorDisabled
29
+ }
30
+ },
31
+ '&--warn': {
32
+ color: colorWarn,
33
+ [`&${componentCls}-item--disabled`]: {
34
+ color: token.colorWarnDisabled
35
+ }
36
+ },
37
+ '&--loading': {
38
+ opacity: loadingOpacity,
39
+ transition: 'opacity 0.2s',
40
+ cursor: 'default',
41
+ '.btn-loading-icon': {
42
+ marginRight: token.spaceXS
43
+ }
44
+ },
45
+ '&--disabled': {
46
+ cursor: 'not-allowed'
47
+ },
48
+ [`${componentCls}-item__icon-wrapper`]: {
49
+ paddingRight: token.spaceXS
50
+ },
51
+ '&--icon-first': {
52
+ [`${componentCls}-item__icon-wrapper`]: {
53
+ paddingRight: 0
54
+ }
55
+ }
56
+ }
57
+ };
58
+ };
59
+ export default genComponentStyleHook('ApAction', (token) => {
60
+ return [genActionItemStyle(token)];
61
+ }, { loadingOpacity: 0.35 });
@@ -0,0 +1,8 @@
1
+ import { BaseToken, GenStyleFunc } from '../../design-token/interface';
2
+ import { Ref } from 'vue';
3
+ export type ActionToken = {
4
+ loadingOpacity: number;
5
+ };
6
+ export declare const genActionItemStyle: GenStyleFunc<BaseToken & ActionToken>;
7
+ declare const _default: (prefixCls: string) => Ref<string | undefined, string | undefined>;
8
+ export default _default;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("../../style/index.js"),d=require("../../utils/cssinjs/index.js"),e=o=>{const{loadingOpacity:i,colorLink:c,colorLinkHover:l,colorSuccess:t,colorError:n,colorWarn:s,componentCls:r}=o;return{[`${r}-item`]:{display:"inline-block",cursor:"pointer",...a.resetComponent(o),"&--primary":{color:c,[`&:not(${r}-item--disabled):hover`]:{color:l},[`&${r}-item--disabled`]:{color:o.colorLinkDisabled}},"&--success":{color:t,[`&${r}-item--disabled`]:{color:o.colorSuccessDisabled}},"&--error":{color:n,[`&${r}-item--disabled`]:{color:o.colorErrorDisabled}},"&--warn":{color:s,[`&${r}-item--disabled`]:{color:o.colorWarnDisabled}},"&--loading":{opacity:i,transition:"opacity 0.2s",cursor:"default",".btn-loading-icon":{marginRight:o.spaceXS}},"&--disabled":{cursor:"not-allowed"},[`${r}-item__icon-wrapper`]:{paddingRight:o.spaceXS},"&--icon-first":{[`${r}-item__icon-wrapper`]:{paddingRight:0}}}}},p=d.genComponentStyleHook("ApAction",o=>[e(o)],{loadingOpacity:.35});exports.default=p;exports.genActionItemStyle=e;
@@ -4,6 +4,7 @@ import { ApiType, ApUploadConfig, ApDescriptionsConfig, ValueTypeRenderConfig, d
4
4
  import { ApGridProps } from '../ap-grid';
5
5
  import { AgGridProps } from '../ag-grid';
6
6
  import { ViewCacheOption } from '../business';
7
+ import { FullToken } from '../design-token/interface';
7
8
  import { default as __DTS_DEFAULT_0__ } from '@aplus-frontend/antdv/es/config-provider/renderEmpty';
8
9
  import { TransformCellTextProps } from '@aplus-frontend/antdv/es/table/interface';
9
10
  import { CSPConfig } from '@aplus-frontend/antdv/es/config-provider';
@@ -156,6 +157,12 @@ export declare const configProviderProps: () => {
156
157
  aplusLocale: {
157
158
  type: PropType<LocaleType>;
158
159
  };
160
+ /**
161
+ * APlus-UI 自己的token
162
+ */
163
+ aplusToken: {
164
+ type: PropType<Partial<FullToken>>;
165
+ };
159
166
  namespace: {
160
167
  type: StringConstructor;
161
168
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@aplus-frontend/antdv/es/config-provider/context"),t=()=>({apGrid:{type:Object},agGrid:{type:Object}}),o=()=>({aplusLocale:{type:Object},namespace:{type:String},api:{type:Object,default:()=>({})},uiMode:{type:String},apUpload:{type:Object,default:()=>({})},apDescriptions:{type:Object,default:()=>({})},valueTypeMap:{type:Object,default:()=>({})},downloadCenterTriggerConfig:{type:Object,default:()=>({})},exportField:{type:[Object,Boolean],default:!1},scrollYDomName:{type:String},viewCacheOption:{type:Object,default:()=>({})},searchForm:{type:Object,default:()=>({})},...t(),...e.configProviderProps()});exports.configProviderProps=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@aplus-frontend/antdv/es/config-provider/context"),t=()=>({apGrid:{type:Object},agGrid:{type:Object}}),o=()=>({aplusLocale:{type:Object},aplusToken:{type:Object},namespace:{type:String},api:{type:Object,default:()=>({})},uiMode:{type:String},apUpload:{type:Object,default:()=>({})},apDescriptions:{type:Object,default:()=>({})},valueTypeMap:{type:Object,default:()=>({})},downloadCenterTriggerConfig:{type:Object,default:()=>({})},exportField:{type:[Object,Boolean],default:!1},scrollYDomName:{type:String},viewCacheOption:{type:Object,default:()=>({})},searchForm:{type:Object,default:()=>({})},...t(),...e.configProviderProps()});exports.configProviderProps=o;
@@ -8,6 +8,7 @@ import { ButtonSize } from '@aplus-frontend/antdv/es/button';
8
8
  import { ThemeConfig, InputConfig, PaginationConfig, FormConfig, SelectConfig, CascaderConfig, DatePickerConfig, RangePickerConfig, TreeSelectConfig, TextAreaConfig, InputNumberConfig, MentionsConfig, TimePickerConfig, CardConfig } from '@aplus-frontend/antdv/es/config-provider/context';
9
9
  import { ApGridRowSelection, AgGridRowSelection, ViewCacheOption } from '..';
10
10
  import { LocaleType } from '../locale';
11
+ import { FullToken } from '../design-token/interface';
11
12
  import { ApiType, ApUploadConfig, ApDescriptionsConfig, ValueTypeRenderConfig, downloadCenterTriggerConfig, ExportField, SearchFormGlobalConfig } from './constants';
12
13
  export declare const globalConfigCached: Ref<ConfigProviderProps>;
13
14
  export declare const ConfigProvider: DefineComponent<ExtractPropTypes<{
@@ -155,6 +156,9 @@ export declare const ConfigProvider: DefineComponent<ExtractPropTypes<{
155
156
  aplusLocale: {
156
157
  type: PropType<LocaleType>;
157
158
  };
159
+ aplusToken: {
160
+ type: PropType<Partial< FullToken>>;
161
+ };
158
162
  namespace: {
159
163
  type: StringConstructor;
160
164
  };
@@ -341,6 +345,9 @@ export declare const ConfigProvider: DefineComponent<ExtractPropTypes<{
341
345
  aplusLocale: {
342
346
  type: PropType<LocaleType>;
343
347
  };
348
+ aplusToken: {
349
+ type: PropType<Partial< FullToken>>;
350
+ };
344
351
  namespace: {
345
352
  type: StringConstructor;
346
353
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),C=require("@aplus-frontend/antdv"),u=require("./hooks/use-global-config.js"),P=require("./config-provider-props.js"),r=require("../utils/config-provider-preset.js"),c=require("./constants.js");function G(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!i.isVNode(e)}const o=i.ref({}),h=i.defineComponent({name:"AplusConfigProvider",props:P.configProviderProps(),setup(e,{slots:l}){const t=u.useGlobalConfig();let a=!0;const f=i.computed(()=>e.namespace!==void 0?e.namespace:t.value?.namespace||c.DEFAULT_NAMESPACE),d=i.computed(()=>e.uiMode!==void 0?e.uiMode:t.value?.uiMode||c.DEFAULT_UIMODE),g=i.computed(()=>e.apGrid!==void 0?e.apGrid:t.value?.apGrid),m=i.computed(()=>e.agGrid!==void 0?e.agGrid:t.value?.agGrid),v=i.computed(()=>({namespace:i.unref(f),aplusLocale:e.aplusLocale,api:e.api,uiMode:i.unref(d),apUpload:e.apUpload,apDescriptions:e.apDescriptions,valueTypeMap:e.valueTypeMap,downloadCenterTriggerConfig:e.downloadCenterTriggerConfig,exportField:e.exportField,scrollYDomName:e.scrollYDomName,viewCacheOption:e.viewCacheOption,searchForm:e.searchForm,apGrid:i.unref(g),agGrid:i.unref(m)})),s=u.provideGlobalConfig(v);return i.watch(()=>e,n=>{o.value=r.mergeAntdProviderConfigWithCache(r.mergeAntdProvideConfig(n),o.value)},{deep:!0,immediate:!0}),i.onActivated(()=>{if(a){a=!1;return}o.value=r.mergeAntdProviderConfigWithCache(r.mergeAntdProvideConfig(e),o.value)}),typeof window<"u"&&i.watch(()=>i.unref(d),n=>{document.documentElement.dataset.aplusUiMode=n},{immediate:!0}),()=>{let n;return i.createVNode(C.ConfigProvider,o.value,G(n=i.renderSlot(l,"default",{config:s?.value}))?n:{default:()=>[n]})}}});exports.ConfigProvider=h;exports.globalConfigCached=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("vue"),C=require("@aplus-frontend/antdv"),u=require("./hooks/use-global-config.js"),P=require("./config-provider-props.js"),r=require("../utils/config-provider-preset.js"),c=require("./constants.js");function G(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!n.isVNode(e)}const o=n.ref({}),h=n.defineComponent({name:"AplusConfigProvider",props:P.configProviderProps(),setup(e,{slots:l}){const t=u.useGlobalConfig();let a=!0;const f=n.computed(()=>e.namespace!==void 0?e.namespace:t.value?.namespace||c.DEFAULT_NAMESPACE),d=n.computed(()=>e.uiMode!==void 0?e.uiMode:t.value?.uiMode||c.DEFAULT_UIMODE),g=n.computed(()=>e.apGrid!==void 0?e.apGrid:t.value?.apGrid),m=n.computed(()=>e.agGrid!==void 0?e.agGrid:t.value?.agGrid),s=n.computed(()=>({namespace:n.unref(f),aplusLocale:e.aplusLocale,aplusToken:e.aplusToken,api:e.api,uiMode:n.unref(d),apUpload:e.apUpload,apDescriptions:e.apDescriptions,valueTypeMap:e.valueTypeMap,downloadCenterTriggerConfig:e.downloadCenterTriggerConfig,exportField:e.exportField,scrollYDomName:e.scrollYDomName,viewCacheOption:e.viewCacheOption,searchForm:e.searchForm,apGrid:n.unref(g),agGrid:n.unref(m)})),v=u.provideGlobalConfig(s);return n.watch(()=>e,i=>{o.value=r.mergeAntdProviderConfigWithCache(r.mergeAntdProvideConfig(i),o.value)},{deep:!0,immediate:!0}),n.onActivated(()=>{if(a){a=!1;return}o.value=r.mergeAntdProviderConfigWithCache(r.mergeAntdProvideConfig(e),o.value)}),typeof window<"u"&&n.watch(()=>n.unref(d),i=>{document.documentElement.dataset.aplusUiMode=i},{immediate:!0}),()=>{let i;return n.createVNode(C.ConfigProvider,o.value,G(i=n.renderSlot(l,"default",{config:v?.value}))?i:{default:()=>[i]})}}});exports.ConfigProvider=h;exports.globalConfigCached=o;
@@ -9,6 +9,7 @@ import { ButtonSize } from '@aplus-frontend/antdv/es/button';
9
9
  import { ThemeConfig, InputConfig, PaginationConfig, FormConfig, SelectConfig, CascaderConfig, DatePickerConfig, RangePickerConfig, TreeSelectConfig, TextAreaConfig, InputNumberConfig, MentionsConfig, TimePickerConfig, CardConfig } from '@aplus-frontend/antdv/es/config-provider/context';
10
10
  import { ApGridRowSelection, AgGridRowSelection, ViewCacheOption } from '../..';
11
11
  import { LocaleType } from '../../locale';
12
+ import { FullToken } from '../../design-token/interface';
12
13
  import { ApiType, ApUploadConfig, ApDescriptionsConfig, ValueTypeRenderConfig, downloadCenterTriggerConfig, ExportField, SearchFormGlobalConfig } from '..';
13
14
  export declare const keysOf: <T extends Record<string, any>>(arr: T) => Array<keyof T>;
14
15
  export declare function useGlobalConfig<K extends keyof ConfigProviderContext, D extends ConfigProviderContext[K]>(key: K, defaultValue?: D): Ref<Exclude<ConfigProviderContext[K], undefined> | D>;
@@ -158,6 +159,9 @@ export declare const provideGlobalConfig: (config: MaybeRef<ConfigProviderContex
158
159
  aplusLocale: {
159
160
  type: PropType<LocaleType>;
160
161
  };
162
+ aplusToken: {
163
+ type: PropType<Partial< FullToken>>;
164
+ };
161
165
  namespace: {
162
166
  type: StringConstructor;
163
167
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),f=require("../constants.js"),d=require("./use-locale.js"),g=require("./use-namespace.js"),l=e=>Object.keys(e),i=o.ref();function v(e,n=void 0){const r=o.getCurrentInstance()?o.inject(f.configProviderContextKey,i):i;return e?o.computed(()=>r.value?.[e]??n):r}const p=(e,n,r=!1)=>{const c=!!o.getCurrentInstance(),t=c?v():void 0,u=n?.provide??(c?o.provide:void 0);if(!u)return;const s=o.computed(()=>{const a=o.unref(e);return t?.value?C(t.value,a):a});return u(f.configProviderContextKey,s),u(g.namespaceContextKey,s.value.namespace),u(d.localeContextKey,o.computed(()=>s.value.aplusLocale)),(r||!i.value)&&(i.value=s.value),s},C=(e,n)=>{const r=[...new Set([...l(e),...l(n)])],c={};for(const t of r)c[t]=n[t]!==void 0?n[t]:e[t];return c};exports.keysOf=l;exports.provideGlobalConfig=p;exports.useGlobalConfig=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),f=require("../constants.js"),g=require("./use-locale.js"),p=require("./use-namespace.js"),C=require("./use-token.js"),m=require("lodash-unified"),y=require("../../design-token/constants.js"),a=o=>Object.keys(o),i=e.ref();function d(o,n=void 0){const r=e.getCurrentInstance()?e.inject(f.configProviderContextKey,i):i;return o?e.computed(()=>r.value?.[o]??n):r}const k=(o,n,r=!1)=>{const c=!!e.getCurrentInstance(),t=c?d():void 0,u=n?.provide??(c?e.provide:void 0);if(!u)return;const s=e.computed(()=>{const l=e.unref(o);return t?.value?b(t.value,l):l});u(f.configProviderContextKey,s),u(p.namespaceContextKey,s.value.namespace);const v=e.computed(()=>({...m.merge(y.defaultToken,s.value.aplusToken||{})}));return u(C.designTokenContextKey,v),u(g.localeContextKey,e.computed(()=>s.value.aplusLocale)),(r||!i.value)&&(i.value=s.value),s},b=(o,n)=>{const r=[...new Set([...a(o),...a(n)])],c={};for(const t of r)c[t]=n[t]!==void 0?n[t]:o[t];return c};exports.keysOf=a;exports.provideGlobalConfig=k;exports.useGlobalConfig=d;
@@ -0,0 +1,4 @@
1
+ import { InjectionKey, Ref } from 'vue';
2
+ import { FullToken } from '../../design-token/interface';
3
+ export declare const designTokenContextKey: InjectionKey<Ref<Partial<FullToken>>>;
4
+ export declare const useToken: () => Ref<FullToken>;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),n=Symbol("designTokenContextKey"),t=()=>e.inject(n,e.ref({}));exports.designTokenContextKey=n;exports.useToken=t;
@@ -7,6 +7,7 @@ import { ButtonSize } from '@aplus-frontend/antdv/es/button';
7
7
  import { ThemeConfig, InputConfig, PaginationConfig, FormConfig, SelectConfig, CascaderConfig, DatePickerConfig, RangePickerConfig, TreeSelectConfig, TextAreaConfig, InputNumberConfig, MentionsConfig, TimePickerConfig, CardConfig } from '@aplus-frontend/antdv/es/config-provider/context';
8
8
  import { ApGridRowSelection, AgGridRowSelection, ViewCacheOption } from '..';
9
9
  import { LocaleType } from '../locale';
10
+ import { FullToken } from '../design-token/interface';
10
11
  import { ApiType, ApUploadConfig, ApDescriptionsConfig, ValueTypeRenderConfig, downloadCenterTriggerConfig, ExportField, SearchFormGlobalConfig } from './constants';
11
12
  export * from './config-provider-props';
12
13
  export * from './constants';
@@ -160,6 +161,9 @@ export declare const APConfigProvider: {
160
161
  aplusLocale: {
161
162
  type: PropType<LocaleType>;
162
163
  };
164
+ aplusToken: {
165
+ type: PropType<Partial< FullToken>>;
166
+ };
163
167
  namespace: {
164
168
  type: StringConstructor;
165
169
  };
@@ -392,6 +396,9 @@ export declare const APConfigProvider: {
392
396
  aplusLocale: {
393
397
  type: PropType<LocaleType>;
394
398
  };
399
+ aplusToken: {
400
+ type: PropType<Partial< FullToken>>;
401
+ };
395
402
  namespace: {
396
403
  type: StringConstructor;
397
404
  };
@@ -621,6 +628,9 @@ export declare const APConfigProvider: {
621
628
  aplusLocale: {
622
629
  type: PropType<LocaleType>;
623
630
  };
631
+ aplusToken: {
632
+ type: PropType<Partial< FullToken>>;
633
+ };
624
634
  namespace: {
625
635
  type: StringConstructor;
626
636
  };
@@ -0,0 +1,2 @@
1
+ import { BaseToken } from './interface';
2
+ export declare const defaultToken: BaseToken;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o={borderColorBase:"#dee4ed",hoverColorBase:"#66a9ff",activeColorBase:"#66a9ff",colorPrimary:"#0070ff",colorPrimaryDisabled:"#cce2ff",colorLink:"#0070ff",colorLinkHover:"#66a9ff",colorLinkDisabled:"#cce2ff",colorSuccess:"#2ed1a3",colorSuccessDisabled:"#d5f6ed",colorError:"#ff4d4f",colorErrorDisabled:"#ffdbdc",colorWarn:"#ffa940",colorWarnDisabled:"#ffeed9",textColor1:"#526a90",textColor2:"#182948",textColor3:"#8896b0",textColor4:"#abb7cc",colorBg1:"#e9edf3",colorBg2:"#f6f9fa",colorBg3:"#f3f5f8",colorBgDisabled:"#f2f6f9",fontSizeSM:10,fontSize:12,fontSizeLG:14,fontSizeXL:16,lineHeightSM:16,lineHeight:18,lineHeightLG:22,borderRadiusXS:1,borderRadius:4,spaceXXS:2,spaceXS:4,spaceSM:6,space:8,spaceMD:10,spaceLG:12,spaceXL:16,spaceXXL:24};exports.defaultToken=o;
@@ -0,0 +1,123 @@
1
+ import { ActionToken } from '../ap-action/style';
2
+ import { Recordable } from '../type';
3
+ import { CSSInterpolation } from '@emotion/serialize';
4
+ export type BaseToken = {
5
+ /**
6
+ * 基础边框色
7
+ */
8
+ borderColorBase: string;
9
+ /**
10
+ * 基础hover色
11
+ */
12
+ hoverColorBase: string;
13
+ /**
14
+ * 基础active色
15
+ */
16
+ activeColorBase: string;
17
+ /**
18
+ * 主色
19
+ */
20
+ colorPrimary: string;
21
+ /**
22
+ * 主色禁用色
23
+ */
24
+ colorPrimaryDisabled: string;
25
+ /**
26
+ * 链接色
27
+ */
28
+ colorLink: string;
29
+ /**
30
+ * 链接色-hover
31
+ */
32
+ colorLinkHover: string;
33
+ /**
34
+ * 链接色-禁用
35
+ */
36
+ colorLinkDisabled: string;
37
+ /**
38
+ * 成功色
39
+ */
40
+ colorSuccess: string;
41
+ /**
42
+ * 成功色-禁用
43
+ */
44
+ colorSuccessDisabled: string;
45
+ /**
46
+ * 失败色
47
+ */
48
+ colorError: string;
49
+ /**
50
+ * 失败色-禁用
51
+ */
52
+ colorErrorDisabled: string;
53
+ /**
54
+ * 警告色
55
+ */
56
+ colorWarn: string;
57
+ /**
58
+ * 警告色-禁用
59
+ */
60
+ colorWarnDisabled: string;
61
+ /**
62
+ * 一级文本色
63
+ */
64
+ textColor1: string;
65
+ /**
66
+ * 二级文本色
67
+ */
68
+ textColor2: string;
69
+ /**
70
+ * 三级文本色
71
+ */
72
+ textColor3: string;
73
+ /**
74
+ * 四级文本色
75
+ */
76
+ textColor4: string;
77
+ /**
78
+ * 一级背景色
79
+ */
80
+ colorBg1: string;
81
+ /**
82
+ * 二级背景色
83
+ */
84
+ colorBg2: string;
85
+ /**
86
+ * 三级背景色
87
+ */
88
+ colorBg3: string;
89
+ /**
90
+ * 背景禁用色
91
+ */
92
+ colorBgDisabled: string;
93
+ fontSizeXL: number;
94
+ fontSizeLG: number;
95
+ fontSize: number;
96
+ fontSizeSM: number;
97
+ lineHeightLG: number;
98
+ lineHeight: number;
99
+ lineHeightSM: number;
100
+ borderRadiusXS: number;
101
+ borderRadius: number;
102
+ spaceXXS: number;
103
+ spaceXS: number;
104
+ spaceSM: number;
105
+ space: number;
106
+ spaceMD: number;
107
+ spaceLG: number;
108
+ spaceXL: number;
109
+ spaceXXL: number;
110
+ };
111
+ export type FullToken = BaseToken & {
112
+ components: {
113
+ ApAction: ActionToken;
114
+ };
115
+ };
116
+ export type TokenWithComponentCls<Token> = Token & {
117
+ componentCls: string;
118
+ };
119
+ export type CssVarToken<Token = Recordable> = {
120
+ [key in keyof Token]: Token[key] | string;
121
+ };
122
+ export type GenStyleFunc<Token> = (token: TokenWithComponentCls<Token>) => CSSInterpolation;
123
+ export type GenStyleCallback<Token> = (token: TokenWithComponentCls<Token>) => CSSInterpolation[];
@@ -0,0 +1,12 @@
1
+ export const resetComponent = (token) => {
2
+ return {
3
+ boxSizing: 'border-box',
4
+ margin: 0,
5
+ padding: 0,
6
+ color: token.textColor2,
7
+ fontSize: token.fontSize,
8
+ fontFamily: 'inherit',
9
+ lineHeight: token.lineHeight,
10
+ listStyle: 'none'
11
+ };
12
+ };
@@ -0,0 +1,3 @@
1
+ import { CSSProperties } from 'vue';
2
+ import { BaseToken } from '../design-token/interface';
3
+ export declare const resetComponent: (token: BaseToken) => CSSProperties;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=e=>({boxSizing:"border-box",margin:0,padding:0,color:e.textColor2,fontSize:e.fontSize,fontFamily:"inherit",lineHeight:e.lineHeight,listStyle:"none"});exports.resetComponent=t;
@@ -0,0 +1,8 @@
1
+ import { BaseToken, GenStyleCallback } from '../../design-token/interface';
2
+ import { Ref } from 'vue';
3
+ type GeneraterOption = {
4
+ skipUnit: string[];
5
+ };
6
+ export declare function camelToKebab(str: string): string;
7
+ export declare function genComponentStyleHook<ComponentToken>(componentName: string, cb: GenStyleCallback<BaseToken & ComponentToken>, componentToken?: Partial<ComponentToken>, option?: GeneraterOption): (prefixCls: string) => Ref<string | undefined, string | undefined>;
8
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("lodash-unified"),a=require("vue"),g=require("../../config-provider/hooks/use-token.js"),f=require("@emotion/css");require("../../config-provider/index.js");const k=require("../../config-provider/hooks/use-global-config.js");function C(e,t){return Object.entries(e).reduce((n,[s,r])=>{const c=typeof r=="number"&&!t?.skipUnit?.includes(s)?`${r}px`:r;return n[i(s)]=c,n},{})}function i(e){return"--"+e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function T(e){const t={};for(const n in e)t[n]=`var(${i(n)})`;return t}function S(e,t,n,s){return r=>{const c=a.ref(),l=g.useToken(),b=k.useGlobalConfig("namespace"),m=a.computed(()=>{let o=p.omit(l.value||{},"components");return o={...o,...p.merge(n||{},l.value.components?.[e]||{})},o});return a.watch(()=>m.value,o=>{const u=T(o);u.componentCls=`.${b.value}-${r}`;const d=t(u);f.injectGlobal(d)},{immediate:!0,once:!0}),a.watch(()=>m.value,o=>{const u=C(o,s);c.value=f.css(u)},{deep:!0,immediate:!0}),c}}exports.camelToKebab=i;exports.genComponentStyleHook=S;
@@ -1,2 +1,2 @@
1
- declare const _default: "6.41.0";
1
+ declare const _default: "7.0.0-beta.0";
2
2
  export default _default;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="6.41.0";exports.default=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="7.0.0-beta.0";exports.default=e;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aplus-frontend/ui",
3
- "version": "6.41.0",
3
+ "version": "7.0.0-beta.0",
4
4
  "main": "./lib/index.js",
5
5
  "type": "module",
6
6
  "files": [
@@ -27,6 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@ant-design/icons-vue": "^7.0.1",
30
+ "@emotion/css": "^11.13.5",
30
31
  "@fruits-chain/utils": "^1.0.7",
31
32
  "@vueuse/core": "^10.9.0",
32
33
  "ag-grid-community": "^33.3.2",
@@ -51,6 +52,7 @@
51
52
  "@aplus-frontend/antdv": "^1.2.16",
52
53
  "@aplus-frontend/icon": "^1.3.2",
53
54
  "@aplus-frontend/oss": "^1.1.2",
55
+ "@emotion/serialize": "^1.3.3",
54
56
  "@types/sortablejs": "^1.15.8",
55
57
  "@vue/test-utils": "^2.4.6",
56
58
  "axios": "^1.7.2",
@@ -485,62 +485,6 @@
485
485
  word-wrap: break-word;
486
486
  word-break: break-all;
487
487
  }
488
- .aplus-action-item {
489
- box-sizing: border-box;
490
- margin: 0;
491
- padding: 0;
492
- color: #182948;
493
- font-size: 12px;
494
- font-family: inherit;
495
- line-height: 18px;
496
- list-style: none;
497
- display: inline-block;
498
- cursor: pointer;
499
- }
500
- .aplus-action-item--primary {
501
- color: var(--ap-color-link);
502
- }
503
- .aplus-action-item--primary:not(.aplus-action-item--disabled):hover {
504
- color: var(--ap-color-link-hover);
505
- }
506
- .aplus-action-item--success {
507
- color: var(--ap-color-success);
508
- }
509
- .aplus-action-item--error {
510
- color: var(--ap-color-error);
511
- }
512
- .aplus-action-item--warn {
513
- color: var(--ap-color-warn);
514
- }
515
- .aplus-action-item--loading {
516
- opacity: 0.35;
517
- transition: opacity 0.2s;
518
- cursor: default;
519
- }
520
- .aplus-action-item--loading .btn-loading-icon {
521
- margin-right: 4px;
522
- }
523
- .aplus-action-item--disabled {
524
- cursor: not-allowed;
525
- }
526
- .aplus-action-item--primary.aplus-action-item--disabled {
527
- color: var(--ap-color-link-disabled);
528
- }
529
- .aplus-action-item--success.aplus-action-item--disabled {
530
- color: var(--ap-color-success-disabled);
531
- }
532
- .aplus-action-item--error.aplus-action-item--disabled {
533
- color: var(--ap-color-error-disabled);
534
- }
535
- .aplus-action-item--warn.aplus-action-item--disabled {
536
- color: var(--ap-color-warn-disabled);
537
- }
538
- .aplus-action-item__icon-wrapper {
539
- padding-right: 4px;
540
- }
541
- .aplus-action-item--icon-first .aplus-action-item__icon-wrapper {
542
- padding-right: 0;
543
- }
544
488
  .aplus-action-item-dropdown__item .aplus-action-item {
545
489
  width: 100%;
546
490
  }
@@ -485,62 +485,6 @@
485
485
  word-wrap: break-word;
486
486
  word-break: break-all;
487
487
  }
488
- .aplus-action-item {
489
- box-sizing: border-box;
490
- margin: 0;
491
- padding: 0;
492
- color: #182948;
493
- font-size: 12px;
494
- font-family: inherit;
495
- line-height: 18px;
496
- list-style: none;
497
- display: inline-block;
498
- cursor: pointer;
499
- }
500
- .aplus-action-item--primary {
501
- color: var(--ap-color-link);
502
- }
503
- .aplus-action-item--primary:not(.aplus-action-item--disabled):hover {
504
- color: var(--ap-color-link-hover);
505
- }
506
- .aplus-action-item--success {
507
- color: var(--ap-color-success);
508
- }
509
- .aplus-action-item--error {
510
- color: var(--ap-color-error);
511
- }
512
- .aplus-action-item--warn {
513
- color: var(--ap-color-warn);
514
- }
515
- .aplus-action-item--loading {
516
- opacity: 0.35;
517
- transition: opacity 0.2s;
518
- cursor: default;
519
- }
520
- .aplus-action-item--loading .btn-loading-icon {
521
- margin-right: 4px;
522
- }
523
- .aplus-action-item--disabled {
524
- cursor: not-allowed;
525
- }
526
- .aplus-action-item--primary.aplus-action-item--disabled {
527
- color: var(--ap-color-link-disabled);
528
- }
529
- .aplus-action-item--success.aplus-action-item--disabled {
530
- color: var(--ap-color-success-disabled);
531
- }
532
- .aplus-action-item--error.aplus-action-item--disabled {
533
- color: var(--ap-color-error-disabled);
534
- }
535
- .aplus-action-item--warn.aplus-action-item--disabled {
536
- color: var(--ap-color-warn-disabled);
537
- }
538
- .aplus-action-item__icon-wrapper {
539
- padding-right: 4px;
540
- }
541
- .aplus-action-item--icon-first .aplus-action-item__icon-wrapper {
542
- padding-right: 0;
543
- }
544
488
  .aplus-action-item-dropdown__item .aplus-action-item {
545
489
  width: 100%;
546
490
  }