@aplus-frontend/ui 0.0.16 → 0.0.18

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 (81) hide show
  1. package/es/index.mjs +51 -46
  2. package/es/src/ap-field/date/helper.d.ts +7 -0
  3. package/es/src/ap-field/date/helper.mjs +17 -7
  4. package/es/src/ap-field/date/index.vue.mjs +46 -39
  5. package/es/src/ap-field/date-range/index.vue.mjs +63 -61
  6. package/es/src/ap-field/interface.d.ts +9 -0
  7. package/es/src/ap-table/ap-table.vue.mjs +92 -95
  8. package/es/src/ap-table/constants.d.ts +24 -0
  9. package/es/src/ap-table/interface.d.ts +18 -4
  10. package/es/src/ap-table/style/ap-table.css +6 -0
  11. package/es/src/ap-table/utils.d.ts +6831 -845
  12. package/es/src/business/ap-label/ApLabel.vue.d.ts +38 -0
  13. package/es/src/business/ap-label/ApLabel.vue.mjs +4 -0
  14. package/es/src/business/ap-label/ApLabel.vue2.mjs +52 -0
  15. package/es/src/business/ap-label/index.d.ts +4 -0
  16. package/es/src/business/ap-label/interface.d.ts +8 -0
  17. package/es/src/business/ap-label/style.css +4 -0
  18. package/es/src/business/index.d.ts +256 -1
  19. package/es/src/business/index.mjs +7 -4
  20. package/es/src/check-card/checked.svg.mjs +4 -0
  21. package/es/src/check-card/context.d.ts +6 -0
  22. package/es/src/check-card/context.mjs +16 -0
  23. package/es/src/check-card/group.vue.d.ts +57 -0
  24. package/es/src/check-card/group.vue.mjs +57 -0
  25. package/es/src/check-card/group.vue2.mjs +4 -0
  26. package/es/src/check-card/index.d.ts +9 -0
  27. package/es/src/check-card/index.mjs +11 -0
  28. package/es/src/check-card/index.vue.d.ts +54 -0
  29. package/es/src/check-card/index.vue.mjs +4 -0
  30. package/es/src/check-card/index.vue2.mjs +133 -0
  31. package/es/src/check-card/interface.d.ts +100 -0
  32. package/es/src/check-card/interface.mjs +1 -0
  33. package/es/src/check-card/style/index.css +108 -0
  34. package/es/src/editable-table/interface.d.ts +1 -1
  35. package/es/src/hooks/useControllableValue.mjs +15 -13
  36. package/es/src/index.d.ts +1 -0
  37. package/es/src/index.mjs +197 -192
  38. package/es/src/theme/ap-label/ap-label.css +4 -0
  39. package/es/src/theme/ap-table/ap-table.css +6 -0
  40. package/es/src/theme/check-card/index.css +108 -0
  41. package/lib/index.js +1 -1
  42. package/lib/src/ap-field/date/helper.d.ts +7 -0
  43. package/lib/src/ap-field/date/helper.js +1 -1
  44. package/lib/src/ap-field/date/index.vue.js +1 -1
  45. package/lib/src/ap-field/date-range/index.vue.js +1 -1
  46. package/lib/src/ap-field/interface.d.ts +9 -0
  47. package/lib/src/ap-table/ap-table.vue.js +1 -1
  48. package/lib/src/ap-table/constants.d.ts +24 -0
  49. package/lib/src/ap-table/interface.d.ts +18 -4
  50. package/lib/src/ap-table/style/ap-table.css +6 -0
  51. package/lib/src/ap-table/utils.d.ts +6831 -845
  52. package/lib/src/business/ap-label/ApLabel.vue.d.ts +38 -0
  53. package/lib/src/business/ap-label/ApLabel.vue.js +1 -0
  54. package/lib/src/business/ap-label/ApLabel.vue2.js +1 -0
  55. package/lib/src/business/ap-label/index.d.ts +4 -0
  56. package/lib/src/business/ap-label/interface.d.ts +8 -0
  57. package/lib/src/business/ap-label/style.css +4 -0
  58. package/lib/src/business/index.d.ts +256 -1
  59. package/lib/src/business/index.js +1 -1
  60. package/lib/src/check-card/checked.svg.js +1 -0
  61. package/lib/src/check-card/context.d.ts +6 -0
  62. package/lib/src/check-card/context.js +1 -0
  63. package/lib/src/check-card/group.vue.d.ts +57 -0
  64. package/lib/src/check-card/group.vue.js +1 -0
  65. package/lib/src/check-card/group.vue2.js +1 -0
  66. package/lib/src/check-card/index.d.ts +9 -0
  67. package/lib/src/check-card/index.js +1 -0
  68. package/lib/src/check-card/index.vue.d.ts +54 -0
  69. package/lib/src/check-card/index.vue.js +1 -0
  70. package/lib/src/check-card/index.vue2.js +1 -0
  71. package/lib/src/check-card/interface.d.ts +100 -0
  72. package/lib/src/check-card/interface.js +1 -0
  73. package/lib/src/check-card/style/index.css +108 -0
  74. package/lib/src/editable-table/interface.d.ts +1 -1
  75. package/lib/src/hooks/useControllableValue.js +1 -1
  76. package/lib/src/index.d.ts +1 -0
  77. package/lib/src/index.js +1 -1
  78. package/lib/src/theme/ap-label/ap-label.css +4 -0
  79. package/lib/src/theme/ap-table/ap-table.css +6 -0
  80. package/lib/src/theme/check-card/index.css +108 -0
  81. package/package.json +2 -2
@@ -0,0 +1,133 @@
1
+ import { defineComponent as F, computed as i, unref as l, createVNode as m, watch as I, watchEffect as U, openBlock as c, createElementBlock as N, normalizeStyle as W, normalizeClass as P, withModifiers as j, createBlock as f, renderSlot as G, resolveDynamicComponent as V, createCommentVNode as v, createElementVNode as O } from "vue";
2
+ import { Skeleton as $ } from "ant-design-vue";
3
+ import "../config-provider/index.mjs";
4
+ import "../hooks/index.mjs";
5
+ import { isFunction as z } from "lodash-unified";
6
+ import { useInjectCheckCard as q } from "./context.mjs";
7
+ import "./style/index.css";
8
+ import A from "./checked.svg.mjs";
9
+ import { useNamespace as H } from "../config-provider/hooks/use-namespace.mjs";
10
+ import { useGlobalConfig as J } from "../config-provider/hooks/use-global-config.mjs";
11
+ import { useControllableValue as K } from "../hooks/useControllableValue.mjs";
12
+ const L = ["src"], ne = /* @__PURE__ */ F({
13
+ name: "CheckCard",
14
+ __name: "index",
15
+ props: {
16
+ bordered: {
17
+ type: Boolean,
18
+ default: !0
19
+ },
20
+ disabled: {
21
+ type: Boolean
22
+ },
23
+ loading: {
24
+ type: Boolean
25
+ },
26
+ size: {
27
+ default: "middle"
28
+ },
29
+ stopPropagation: {
30
+ type: Boolean,
31
+ default: !1
32
+ },
33
+ checked: {
34
+ type: Boolean,
35
+ default: void 0
36
+ },
37
+ "onUpdate:checked": {},
38
+ defaultChecked: {
39
+ type: Boolean
40
+ },
41
+ value: {
42
+ type: [String, Number, Boolean]
43
+ },
44
+ style: {
45
+ default: () => ({})
46
+ },
47
+ title: {},
48
+ content: {}
49
+ },
50
+ emits: ["update:checked"],
51
+ setup(_, {
52
+ emit: w
53
+ }) {
54
+ const o = _, {
55
+ b: g,
56
+ m: u,
57
+ e: p,
58
+ bm: D,
59
+ em: k
60
+ } = H("check-card"), b = J("uiMode", "aplus"), E = w, n = q(), {
61
+ value: r,
62
+ updateValue: h
63
+ } = K(o, E, {
64
+ valuePropName: "checked",
65
+ defaultValuePropName: "defaultChecked"
66
+ }), a = i(() => {
67
+ const e = {
68
+ ...o
69
+ }, t = l(n);
70
+ return t && (e.disabled = e.disabled || t.disabled, e.bordered = e.bordered || t.bordered, e.loading = e.loading || t.loading, e.size = e.size || t.size, e.stopPropagation = e.stopPropagation || t.stopPropagation), e;
71
+ }), S = i(() => {
72
+ const e = l(b), t = l(a);
73
+ return [g(), ...t.disabled ? [] : [g(e), l(r) ? D(e, "checked") : null], u(t.size), t.bordered ? u("bordered") : null, t.disabled ? u("disabled") : null];
74
+ }), M = i(() => ({
75
+ ...o.style,
76
+ "--check-card-border-color": b.value === "admin" ? "#D9D9D9" : "#E9EDF3"
77
+ })), y = i(() => {
78
+ if (!o.title)
79
+ return;
80
+ const e = z(o.title) ? o.title(l(r)) : m("span", null, [o.title]);
81
+ return m("div", {
82
+ class: [p("title"), a.value.disabled ? k("title", "disabled") : null]
83
+ }, [e]);
84
+ }), C = i(() => {
85
+ if (!o.content)
86
+ return;
87
+ const e = z(o.content) ? o.content(l(r)) : o.content;
88
+ return m("div", {
89
+ class: [p("content"), a.value.disabled ? k("content", "disabled") : null]
90
+ }, [e]);
91
+ });
92
+ function T(e) {
93
+ var t, d;
94
+ a.value.stopPropagation && e.target !== e.currentTarget || a.value.loading || a.value.disabled || (n.value ? (d = (t = n.value) == null ? void 0 : t.toggleOption) == null || d.call(t, o.value) : h(!l(r)));
95
+ }
96
+ return I(() => n.value, (e) => {
97
+ if (!e)
98
+ return;
99
+ const t = e.multiple ? (e.value || []).includes(o.value) : e.value === o.value;
100
+ h(t);
101
+ }, {
102
+ immediate: !0
103
+ }), U((e) => {
104
+ var t, d;
105
+ (d = (t = n.value) == null ? void 0 : t.registerValue) == null || d.call(t, o.value), e(() => {
106
+ var s, B;
107
+ return (B = (s = n.value) == null ? void 0 : s.cancelValue) == null ? void 0 : B.call(s, o.value);
108
+ });
109
+ }), (e, t) => (c(), N("div", {
110
+ style: W(M.value),
111
+ class: P(S.value),
112
+ onClick: j(T, ["stop"])
113
+ }, [a.value.loading ? (c(), f(l($), {
114
+ key: 0,
115
+ active: ""
116
+ })) : G(e.$slots, "default", {
117
+ key: 1,
118
+ checked: l(r)
119
+ }, () => [y.value ? (c(), f(V(y.value), {
120
+ key: 0
121
+ })) : v("", !0), C.value ? (c(), f(V(C.value), {
122
+ key: 1
123
+ })) : v("", !0)]), l(r) ? (c(), N("div", {
124
+ key: 2,
125
+ class: P(l(p)("checked-icon"))
126
+ }, [O("img", {
127
+ src: l(A)
128
+ }, null, 8, L)], 2)) : v("", !0)], 6));
129
+ }
130
+ });
131
+ export {
132
+ ne as default
133
+ };
@@ -0,0 +1,100 @@
1
+ import { CSSProperties, VNode } from 'vue';
2
+
3
+ export type CheckCardValueType = string | number | boolean;
4
+ /**
5
+ * 可选卡片的通用配置,在Group中使用将会是整组CheckCard生效
6
+ */
7
+ type CheckCardCommonType = {
8
+ /**
9
+ * 是否显示边框
10
+ */
11
+ bordered?: boolean;
12
+ /**
13
+ * 是否禁用
14
+ */
15
+ disabled?: boolean;
16
+ /**
17
+ * 是否显示加载中样式
18
+ */
19
+ loading?: boolean;
20
+ /**
21
+ * 卡片的尺寸,目前内置中等/小尺寸两种
22
+ */
23
+ size?: 'middle' | 'small';
24
+ /**
25
+ * 是否阻止点击事件冒泡(对于自定义内容包含输入控件时需要设置)
26
+ */
27
+ stopPropagation?: boolean;
28
+ };
29
+ export type CheckCardProps = CheckCardCommonType & {
30
+ /**
31
+ * 当前选项卡是否选中(v-model)
32
+ */
33
+ checked?: boolean;
34
+ 'onUpdate:checked'?: (checked: boolean) => void;
35
+ /**
36
+ * 默认是否选中
37
+ */
38
+ defaultChecked?: boolean;
39
+ /**
40
+ * 作为选项时的值
41
+ */
42
+ value?: CheckCardValueType;
43
+ /**
44
+ * 容器自定义CSS样式
45
+ */
46
+ style?: CSSProperties;
47
+ /**
48
+ * 标题
49
+ */
50
+ title?: string | ((checked: boolean) => VNode);
51
+ /**
52
+ * 内容
53
+ */
54
+ content?: string | ((checked: boolean) => VNode);
55
+ };
56
+ export type CheckCardGroupValueType = CheckCardValueType | CheckCardValueType[] | undefined;
57
+ export type CheckCardGroupProps = CheckCardCommonType & {
58
+ /**
59
+ * 是否多选
60
+ */
61
+ multiple?: boolean;
62
+ /**
63
+ * 选中的默认值
64
+ */
65
+ defaultValue?: CheckCardGroupValueType;
66
+ /**
67
+ * 选中的值(v-model)
68
+ */
69
+ value?: CheckCardGroupValueType;
70
+ 'onUpdate:Value'?: (nextValue: CheckCardGroupValueType) => void;
71
+ };
72
+ export type CheckCardGroupContextType = CheckCardCommonType & {
73
+ /**
74
+ * 是否是多选
75
+ */
76
+ multiple?: boolean;
77
+ /**
78
+ * 切换单个可选卡片时触发
79
+ * @param value
80
+ * @returns
81
+ */
82
+ toggleOption?: (value: any) => void;
83
+ /**
84
+ * 当前被选中的值
85
+ */
86
+ value?: any;
87
+ /**
88
+ * 注册一个CheckCard的value
89
+ * @param value
90
+ * @returns
91
+ */
92
+ registerValue?: (value: any) => void;
93
+ /**
94
+ * 取消注册
95
+ * @param value
96
+ * @returns
97
+ */
98
+ cancelValue?: (value: any) => void;
99
+ };
100
+ export {};
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,108 @@
1
+ .aplus-check-card {
2
+ border-radius: 4px;
3
+ position: relative;
4
+ }
5
+ .aplus-check-card--disabled {
6
+ background-color: #F9F9FA;
7
+ cursor: not-allowed;
8
+ }
9
+ .aplus-check-card--bordered {
10
+ outline: 1px solid var(--check-card-border-color);
11
+ }
12
+ .aplus-check-card-aplus:hover {
13
+ cursor: pointer;
14
+ outline: 1px solid #0070ff;
15
+ }
16
+ .aplus-check-card-aplus::after {
17
+ content: '';
18
+ position: absolute;
19
+ width: 0;
20
+ height: 0;
21
+ opacity: 0;
22
+ inset-block-start: -2px;
23
+ inset-inline-end: -2px;
24
+ border-inline-start: 16px solid transparent;
25
+ border-block-end: 16px solid transparent;
26
+ border-radius: 4px;
27
+ }
28
+ .aplus-check-card-aplus--checked {
29
+ outline: 2px solid #0070ff;
30
+ }
31
+ .aplus-check-card-aplus--checked:hover {
32
+ outline: 2px solid #0070ff;
33
+ }
34
+ .aplus-check-card-aplus--checked::after {
35
+ opacity: 1;
36
+ border: 16px solid #0070ff;
37
+ border-inline-start: 16px solid transparent;
38
+ border-block-end: 16px solid transparent;
39
+ inset-block-start: -2px;
40
+ inset-inline-end: -2px;
41
+ transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
42
+ }
43
+ .aplus-check-card-admin:hover {
44
+ cursor: pointer;
45
+ outline: 1px solid #34b77c;
46
+ }
47
+ .aplus-check-card-admin::after {
48
+ content: '';
49
+ position: absolute;
50
+ width: 0px;
51
+ height: 0px;
52
+ opacity: 0;
53
+ inset-block-start: -2px;
54
+ inset-inline-end: -2px;
55
+ border-inline-start: 16px solid transparent;
56
+ border-block-end: 16px solid transparent;
57
+ border-radius: 4px;
58
+ }
59
+ .aplus-check-card-admin--checked {
60
+ outline: 2px solid #34b77c;
61
+ }
62
+ .aplus-check-card-admin--checked:hover {
63
+ outline: 2px solid #34b77c;
64
+ }
65
+ .aplus-check-card-admin--checked::after {
66
+ content: '';
67
+ opacity: 1;
68
+ border: 16px solid #34b77c;
69
+ border-inline-start: 16px solid transparent;
70
+ border-block-end: 16px solid transparent;
71
+ inset-block-start: -2px;
72
+ inset-inline-end: -2px;
73
+ transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
74
+ }
75
+ .aplus-check-card--middle {
76
+ padding: 16px 24px;
77
+ }
78
+ .aplus-check-card--small {
79
+ padding: 12px 24px;
80
+ }
81
+ .aplus-check-card__title {
82
+ margin-bottom: 8px;
83
+ }
84
+ .aplus-check-card__title > span {
85
+ font-size: 14px;
86
+ line-height: 22px;
87
+ color: #333;
88
+ }
89
+ .aplus-check-card__title--disabled {
90
+ color: #ABB7CC;
91
+ }
92
+ .aplus-check-card__content {
93
+ font-size: 14px;
94
+ line-height: 22px;
95
+ color: #333;
96
+ }
97
+ .aplus-check-card__content--disabled {
98
+ color: #ABB7CC;
99
+ }
100
+ .aplus-check-card__checked-icon {
101
+ position: absolute;
102
+ top: 0;
103
+ right: 0;
104
+ z-index: 1;
105
+ -webkit-user-select: none;
106
+ -moz-user-select: none;
107
+ user-select: none;
108
+ }
@@ -35,7 +35,7 @@ export type EditableColumnType<RecordType = any, ValueType extends ApTableValueT
35
35
  /**
36
36
  * 值类型额外配置的参数(支持函数)
37
37
  */
38
- fieldProps?: ApTableValueFields[ValueType] | ((opt?: {
38
+ fieldProps?: ApTableValueFields[ValueType] | ((opt: {
39
39
  value: any;
40
40
  text: any;
41
41
  record: RecordType;
@@ -1,21 +1,23 @@
1
- import { ref as c, watch as m } from "vue";
2
- function N(a, r, e) {
3
- const d = (e == null ? void 0 : e.defaultValuePropName) || "defaultValue", u = (e == null ? void 0 : e.valuePropName) || "value", f = c(
4
- a[u] || a[d] || (e == null ? void 0 : e.defaultValue)
5
- );
6
- function v(l) {
7
- a[u] === void 0 && (f.value = l), r(`update:${u}`, l);
1
+ import { ref as v, watch as V } from "vue";
2
+ import { isUndefined as d } from "lodash-unified";
3
+ function P(u, t, e) {
4
+ const f = (e == null ? void 0 : e.defaultValuePropName) || "defaultValue", a = (e == null ? void 0 : e.valuePropName) || "value", r = v(c());
5
+ function m(l) {
6
+ u[a] === void 0 && (r.value = l), t(`update:${a}`, l);
8
7
  }
9
- return m(
10
- () => a[u],
8
+ function c() {
9
+ return d(u[a]) ? d(u[f]) ? e == null ? void 0 : e.defaultValue : u[f] : u[a];
10
+ }
11
+ return V(
12
+ () => u[a],
11
13
  (l) => {
12
- f.value = l;
14
+ r.value = l;
13
15
  }
14
16
  ), {
15
- value: f,
16
- updateValue: v
17
+ value: r,
18
+ updateValue: m
17
19
  };
18
20
  }
19
21
  export {
20
- N as useControllableValue
22
+ P as useControllableValue
21
23
  };
package/es/src/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export * from './ap-tag';
26
26
  export * from './ap-layout';
27
27
  export * from './ap-upload';
28
28
  export * from './ap-download';
29
+ export * from './check-card';
29
30
  export * from './business';
30
31
  export * from './ap-table';
31
32
  export * from './editable-table';