@aplus-frontend/ui 0.0.22 → 0.0.24
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/es/src/ap-field/date/index.vue.mjs +26 -26
- package/es/src/ap-field/number/helper.d.ts +9 -0
- package/es/src/ap-field/number/helper.mjs +20 -11
- package/es/src/ap-table/ap-table.vue.d.ts +2137 -112
- package/es/src/ap-table/ap-table.vue.mjs +31 -30
- package/es/src/check-card/group.vue.d.ts +1 -1
- package/es/src/check-card/group.vue.mjs +1 -1
- package/es/src/check-card/index.vue.d.ts +1 -1
- package/es/src/check-card/index.vue2.mjs +40 -36
- package/es/src/check-card/interface.d.ts +1 -1
- package/es/src/check-card/style/index.css +1 -0
- package/es/src/editable-table/form-item.vue.d.ts +755 -105
- package/es/src/editable-table/form-item.vue.mjs +80 -65
- package/es/src/editable-table/hooks/use-get-columns.mjs +27 -27
- package/es/src/editable-table/index.vue.d.ts +527 -112
- package/es/src/editable-table/index.vue.mjs +93 -78
- package/es/src/editable-table/interface.d.ts +11 -5
- package/es/src/editable-table/utils.d.ts +13 -0
- package/es/src/editable-table/utils.mjs +26 -6
- package/es/src/theme/check-card/index.css +1 -0
- package/lib/src/ap-field/date/index.vue.js +1 -1
- package/lib/src/ap-field/number/helper.d.ts +9 -0
- package/lib/src/ap-field/number/helper.js +1 -1
- package/lib/src/ap-table/ap-table.vue.d.ts +2137 -112
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/check-card/group.vue.d.ts +1 -1
- package/lib/src/check-card/group.vue.js +1 -1
- package/lib/src/check-card/index.vue.d.ts +1 -1
- package/lib/src/check-card/index.vue2.js +1 -1
- package/lib/src/check-card/interface.d.ts +1 -1
- package/lib/src/check-card/style/index.css +1 -0
- package/lib/src/editable-table/form-item.vue.d.ts +755 -105
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
- package/lib/src/editable-table/index.vue.d.ts +527 -112
- package/lib/src/editable-table/index.vue.js +1 -1
- package/lib/src/editable-table/interface.d.ts +11 -5
- package/lib/src/editable-table/utils.d.ts +13 -0
- package/lib/src/editable-table/utils.js +1 -1
- package/lib/src/theme/check-card/index.css +1 -0
- package/package.json +5 -5
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
3
|
-
import { ApForm as
|
|
4
|
-
import { cloneDeep as
|
|
1
|
+
import { defineComponent as T, useSlots as K, ref as M, watch as q, unref as a, openBlock as w, createBlock as G, withCtx as c, createVNode as y, mergeProps as H, createSlots as U, createElementBlock as W, Fragment as $, createElementVNode as v, normalizeClass as J, toDisplayString as Q, createCommentVNode as X, renderList as Y, renderSlot as Z, normalizeProps as ee, guardReactiveProps as te } from "vue";
|
|
2
|
+
import { Table as ae } from "ant-design-vue";
|
|
3
|
+
import { ApForm as f } from "../ap-form/index.mjs";
|
|
4
|
+
import { isNumber as p, cloneDeep as x, omit as ne } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
6
|
import "../hooks/index.mjs";
|
|
7
|
-
import { isDef as
|
|
8
|
-
import
|
|
7
|
+
import { isDef as h } from "../utils/index.mjs";
|
|
8
|
+
import { getColumnIsRequired as oe } from "./utils.mjs";
|
|
9
|
+
import le from "./hooks/use-get-columns.mjs";
|
|
9
10
|
import "./style/index.css";
|
|
10
|
-
import { useNamespace as
|
|
11
|
-
import { useGlobalConfig as
|
|
12
|
-
import { useControllableValue as
|
|
13
|
-
const
|
|
11
|
+
import { useNamespace as re } from "../config-provider/hooks/use-namespace.mjs";
|
|
12
|
+
import { useGlobalConfig as se } from "../config-provider/hooks/use-global-config.mjs";
|
|
13
|
+
import { useControllableValue as ue } from "../hooks/useControllableValue.mjs";
|
|
14
|
+
const be = /* @__PURE__ */ T({
|
|
14
15
|
name: "EditableTable",
|
|
15
16
|
__name: "index",
|
|
16
17
|
props: {
|
|
@@ -109,94 +110,108 @@ const xe = /* @__PURE__ */ L({
|
|
|
109
110
|
onFieldChange: {}
|
|
110
111
|
},
|
|
111
112
|
emits: ["update:value"],
|
|
112
|
-
setup(
|
|
113
|
-
expose:
|
|
114
|
-
emit:
|
|
113
|
+
setup(b, {
|
|
114
|
+
expose: R,
|
|
115
|
+
emit: B
|
|
115
116
|
}) {
|
|
116
|
-
const l =
|
|
117
|
-
b:
|
|
118
|
-
em:
|
|
119
|
-
} =
|
|
117
|
+
const l = b, {
|
|
118
|
+
b: g,
|
|
119
|
+
em: F
|
|
120
|
+
} = re("editable-table"), D = se("uiMode", "aplus"), _ = K(), E = B, {
|
|
120
121
|
value: s,
|
|
121
|
-
updateValue:
|
|
122
|
-
} =
|
|
123
|
-
|
|
122
|
+
updateValue: L
|
|
123
|
+
} = ue(l, E), u = M(), k = f.useWatch(l.name, u);
|
|
124
|
+
q(() => k.value, (e) => {
|
|
124
125
|
var n;
|
|
125
|
-
|
|
126
|
+
L(e), (n = l.onChange) == null || n.call(l, e);
|
|
126
127
|
});
|
|
127
|
-
const
|
|
128
|
-
function
|
|
128
|
+
const N = le(l);
|
|
129
|
+
function S() {
|
|
130
|
+
var e;
|
|
131
|
+
(e = u.value) == null || e.resetFields();
|
|
132
|
+
}
|
|
133
|
+
async function V(e, n) {
|
|
129
134
|
var t;
|
|
130
|
-
(t =
|
|
135
|
+
const o = await ((t = u.value) == null ? void 0 : t.validateFields(e, n));
|
|
136
|
+
return o == null ? void 0 : o[l.name];
|
|
131
137
|
}
|
|
132
|
-
|
|
133
|
-
var
|
|
134
|
-
const
|
|
135
|
-
|
|
138
|
+
function z(e, n) {
|
|
139
|
+
var r, d, i;
|
|
140
|
+
const o = ((r = a(s)) == null ? void 0 : r.length) || 0;
|
|
141
|
+
if (h(l.maxLength) && o >= l.maxLength)
|
|
142
|
+
return;
|
|
143
|
+
const t = [...a(s) || []];
|
|
144
|
+
h(n) ? t.splice(n, 0, {
|
|
145
|
+
...e || {}
|
|
146
|
+
}) : t.push({
|
|
147
|
+
...e || {}
|
|
148
|
+
}), (i = (d = u.value) == null ? void 0 : d.setFieldValue) == null || i.call(d, l.name, t);
|
|
136
149
|
}
|
|
137
|
-
function
|
|
138
|
-
var
|
|
139
|
-
const
|
|
140
|
-
|
|
150
|
+
function P(e, n = "suffix") {
|
|
151
|
+
var i, m, C;
|
|
152
|
+
const o = ((i = a(s)) == null ? void 0 : i.length) || 0, t = p(e) ? e : e.length;
|
|
153
|
+
if (h(l.maxLength) && o + t > l.maxLength)
|
|
154
|
+
return;
|
|
155
|
+
const r = [...a(s) || []], d = p(e) ? new Array(e).fill({}) : x(e);
|
|
156
|
+
n === "suffix" ? r.push(...d) : r.unshift(...d), (C = (m = u.value) == null ? void 0 : m.setFieldValue) == null || C.call(m, l.name, r);
|
|
141
157
|
}
|
|
142
|
-
function
|
|
143
|
-
var
|
|
144
|
-
|
|
145
|
-
|
|
158
|
+
function j(e) {
|
|
159
|
+
var t, r;
|
|
160
|
+
let n = x(a(s) || []);
|
|
161
|
+
const o = p(e) ? [e] : e;
|
|
162
|
+
n = n.filter((d, i) => !o.includes(i)), (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, n);
|
|
146
163
|
}
|
|
147
|
-
function
|
|
148
|
-
return
|
|
164
|
+
function A() {
|
|
165
|
+
return a(s);
|
|
149
166
|
}
|
|
150
|
-
function
|
|
167
|
+
function I(e) {
|
|
151
168
|
var n;
|
|
152
|
-
return (n =
|
|
169
|
+
return (n = a(s)) == null ? void 0 : n[e];
|
|
153
170
|
}
|
|
154
|
-
function
|
|
155
|
-
var
|
|
156
|
-
const
|
|
157
|
-
e
|
|
158
|
-
...e
|
|
171
|
+
function O(e, n) {
|
|
172
|
+
var t, r;
|
|
173
|
+
const o = x(a(s));
|
|
174
|
+
o[e] && (o[e] = {
|
|
175
|
+
...o[e],
|
|
159
176
|
...n
|
|
160
|
-
}, (r = (
|
|
177
|
+
}, (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, [...o]));
|
|
161
178
|
}
|
|
162
|
-
return
|
|
163
|
-
resetFields:
|
|
164
|
-
validateFields:
|
|
165
|
-
add:
|
|
166
|
-
remove:
|
|
167
|
-
getRowData:
|
|
168
|
-
getRowsData:
|
|
169
|
-
setRowData:
|
|
170
|
-
|
|
179
|
+
return R({
|
|
180
|
+
resetFields: S,
|
|
181
|
+
validateFields: V,
|
|
182
|
+
add: z,
|
|
183
|
+
remove: j,
|
|
184
|
+
getRowData: I,
|
|
185
|
+
getRowsData: A,
|
|
186
|
+
setRowData: O,
|
|
187
|
+
addMultiple: P
|
|
188
|
+
}), (e, n) => (w(), G(a(f), {
|
|
171
189
|
"initial-values": {
|
|
172
|
-
[l.name]:
|
|
190
|
+
[l.name]: a(s)
|
|
173
191
|
},
|
|
174
192
|
ref_key: "formRef",
|
|
175
|
-
ref:
|
|
193
|
+
ref: u
|
|
176
194
|
}, {
|
|
177
|
-
default:
|
|
178
|
-
name:
|
|
195
|
+
default: c(() => [y(a(f).FormItem, {
|
|
196
|
+
name: e.name,
|
|
179
197
|
"no-style": ""
|
|
180
198
|
}, {
|
|
181
|
-
default:
|
|
182
|
-
class: [
|
|
183
|
-
columns:
|
|
184
|
-
"data-source":
|
|
185
|
-
}),
|
|
186
|
-
headerCell:
|
|
187
|
-
column:
|
|
188
|
-
}) => {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
class: G(o(y)("header-cell", "required"))
|
|
194
|
-
}, "*", 2), x("span", null, H(e.title), 1)], 64)) : M("", !0)];
|
|
195
|
-
}),
|
|
199
|
+
default: c(() => [y(a(ae), H(a(ne)(l, ["name", "value", "onUpdate:value", "maxLength"]), {
|
|
200
|
+
class: [a(g)(), a(D) === "admin" ? a(g)("admin") : null],
|
|
201
|
+
columns: a(N),
|
|
202
|
+
"data-source": a(s)
|
|
203
|
+
}), U({
|
|
204
|
+
headerCell: c(({
|
|
205
|
+
column: o
|
|
206
|
+
}) => [a(oe)(o) ? (w(), W($, {
|
|
207
|
+
key: 0
|
|
208
|
+
}, [v("span", {
|
|
209
|
+
class: J(a(F)("header-cell", "required"))
|
|
210
|
+
}, "*", 2), v("span", null, Q(o.title), 1)], 64)) : X("", !0)]),
|
|
196
211
|
_: 2
|
|
197
|
-
}, [
|
|
198
|
-
name:
|
|
199
|
-
fn:
|
|
212
|
+
}, [Y(_, (o, t) => ({
|
|
213
|
+
name: t,
|
|
214
|
+
fn: c((r) => [Z(e.$slots, t, ee(te(r || {})))])
|
|
200
215
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
201
216
|
_: 3
|
|
202
217
|
}, 8, ["name"])]),
|
|
@@ -205,5 +220,5 @@ const xe = /* @__PURE__ */ L({
|
|
|
205
220
|
}
|
|
206
221
|
});
|
|
207
222
|
export {
|
|
208
|
-
|
|
223
|
+
be as default
|
|
209
224
|
};
|
|
@@ -124,17 +124,23 @@ export type EditableTableExpose<ModelType = any, RecordType = any> = {
|
|
|
124
124
|
*/
|
|
125
125
|
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<ModelType>> | undefined;
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
128
|
-
* @param defaultValue
|
|
129
|
-
* @
|
|
127
|
+
* 添加单条数据
|
|
128
|
+
* @param defaultValue 默认值,如果需要设置`insertIndex`,可以设置`defaultValue`为`{}`
|
|
129
|
+
* @param insertIndex 数据插入的位置
|
|
130
|
+
*/
|
|
131
|
+
add: (defaultValue?: Partial<RecordType>, insertIndex?: number) => void;
|
|
132
|
+
/**
|
|
133
|
+
* 添加多条数据
|
|
134
|
+
* @param list 添加的条数或数据
|
|
135
|
+
* @param insetIn 插入的位置(前/后)
|
|
130
136
|
*/
|
|
131
|
-
|
|
137
|
+
addMultiple: (list: number | Partial<RecordType>[], insetIn?: 'prefix' | 'suffix') => void;
|
|
132
138
|
/**
|
|
133
139
|
* 删除一行数据
|
|
134
140
|
* @param index
|
|
135
141
|
* @returns
|
|
136
142
|
*/
|
|
137
|
-
remove: (index: number) => void;
|
|
143
|
+
remove: (index: number | number[]) => void;
|
|
138
144
|
/**
|
|
139
145
|
* 获取所有行的数据
|
|
140
146
|
* @returns
|
|
@@ -6,3 +6,16 @@ import { EditableColumnType } from './interface';
|
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
8
|
export declare function getEditableComponent(valueType: EditableColumnType['valueType']): any;
|
|
9
|
+
/**
|
|
10
|
+
* 获取可编辑表格的某列字段是否是required
|
|
11
|
+
* @param column
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare function getColumnIsRequired(column: EditableColumnType<any, 'text'>): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* 获取ellipsis模式下最终需要渲染的字符串
|
|
17
|
+
* @param column
|
|
18
|
+
* @param value
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare function getRawDisplayValue(column: EditableColumnType, value: any): any;
|
|
@@ -1,10 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { isFunction as i, isArray as o } from "lodash-unified";
|
|
2
|
+
import { apTableFormItemMap as f } from "../ap-table/constants.mjs";
|
|
3
|
+
import { isDef as n } from "../utils/index.mjs";
|
|
4
|
+
import { getValueStr as p } from "../ap-field/number/helper.mjs";
|
|
5
|
+
function P(e) {
|
|
6
|
+
const r = f[e];
|
|
7
|
+
return r || console.warn(
|
|
5
8
|
`${e} can not render because of no default renderer, use customRender instead.`
|
|
6
|
-
),
|
|
9
|
+
), r;
|
|
10
|
+
}
|
|
11
|
+
function m(e) {
|
|
12
|
+
if (!e.fieldProps)
|
|
13
|
+
return !1;
|
|
14
|
+
const r = i(e.fieldProps) ? e.fieldProps({}) : e.fieldProps;
|
|
15
|
+
return n(r.required) ? r.required : (o(r.rules) ? r.rules : r.rules ? [r.rules] : []).some((s) => s.required);
|
|
16
|
+
}
|
|
17
|
+
function b(e, r) {
|
|
18
|
+
if (e.valueType === "text" || e.valueType === "textArea")
|
|
19
|
+
return r || "--";
|
|
20
|
+
if (e.valueType === "number") {
|
|
21
|
+
const t = e.fieldProps ? i(e.fieldProps) ? e.fieldProps({}) : e.fieldProps : {};
|
|
22
|
+
return p(r, t) || "--";
|
|
23
|
+
}
|
|
24
|
+
return r;
|
|
7
25
|
}
|
|
8
26
|
export {
|
|
9
|
-
|
|
27
|
+
m as getColumnIsRequired,
|
|
28
|
+
P as getEditableComponent,
|
|
29
|
+
b as getRawDisplayValue
|
|
10
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("dayjs"),b=require("ant-design-vue"),s=require("./constant.js");require("../../hooks/index.js");const v=require("lodash-unified"),S=require("./helper.js"),T=require("@aplus-frontend/utils"),_=require("../../hooks/useControllableValue.js"),M=e.defineComponent({name:"ApFieldDate",__name:"index",props:{mode:{default:"edit"},class:{},style:{},dropdownClassName:{},dropdownAlign:{},popupStyle:{},transitionName:{},placeholder:{},allowClear:{type:Boolean,default:!0},autofocus:{type:Boolean,default:void 0},disabled:{type:Boolean,default:void 0},tabindex:{},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},inputReadOnly:{type:Boolean,default:void 0},id:{},presets:{},suffixIcon:{type:[Object,String,Number,Boolean,null,Array],default:void 0},clearIcon:{type:[Object,String,Number,Boolean,null,Array],default:void 0},getPopupContainer:{},panelRender:{},inputRender:{},onOpenChange:{},onPanelChange:{},onFocus:{},onBlur:{},onMousedown:{},onMouseup:{},onMouseenter:{},onMouseleave:{},onClick:{},onContextmenu:{},onKeydown:{},role:{},name:{},autocomplete:{},direction:{},showToday:{type:Boolean,default:void 0},showTime:{type:Boolean,default:void 0},picker:{},prefixCls:{},defaultPickerValue:{},disabledDate:{},dateRender:{},monthCellRender:{},renderExtraFooter:{},onSelect:{},locale:{},size:{},bordered:{type:Boolean,default:void 0},showNow:{type:Boolean,default:void 0},disabledTime:{},defaultOpenValue:{},showHour:{type:Boolean,default:void 0},showMinute:{type:Boolean,default:void 0},showSecond:{type:Boolean,default:void 0},use12Hours:{type:Boolean,default:void 0},hourStep:{},minuteStep:{},secondStep:{},hideDisabledOptions:{type:Boolean,default:void 0},disabledHours:{},disabledMinutes:{},disabledSeconds:{},valueFormat:{},emptyText:{default:"--"},value:{},defaultValue:{},onChange:{},onOk:{},format:{default:"Y-D"},timezone:{}},emits:["update:value"],setup(y,{emit:h}){const o=y,g=h,{value:f,updateValue:c}=_.useControllableValue(o,g),l=e.computed(()=>s.ApFieldDatePresetFormats.indexOf(o.format)>-1),r=e.computed(()=>l.value?s.PRESET_FORMAT_MAP[o.format]:o.format),p=e.computed(()=>{if(v.isNil(e.unref(f)))return;let t=u(e.unref(f));return o.timezone&&(t=u(T.getTimeFormatToZone(e.unref(f),o.timezone))),t}),B=e.computed(()=>e.unref(l)?o.picker??s.PRESET_FORMAT_PICK_MAP[o.format]:o.picker),k=e.computed(()=>{const t=e.unref(l)?s.PRESET_FORMAT_TIME_MAP[o.format]:{};return{...v.omit(o,["value","defaultValue","onChange","onOk","format","onUpdate:value","mode"]),...t}}),m=S.formatDayWithTimezone(o.timezone);function O(t){if(v.isNil(t)){c(null);return}const n=u(t);e.unref(l)?c(m(n,e.unref(r))):c(n.valueOf())}function P(t,n){var i;const d=u(t),a=t?e.unref(l)?m(d,e.unref(r)):d.valueOf():null;(i=o.onChange)==null||i.call(o,a,n)}function C(t){var a;const n=u(t),d=t?e.unref(l)?m(n,e.unref(r)):n.valueOf():null;(a=o.onOk)==null||a.call(o,d)}return(t,n)=>t.mode==="read"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(p.value?e.unref(u)(p.value).format(r.value):t.emptyText),1)],64)):(e.openBlock(),e.createBlock(e.unref(b.DatePicker),e.mergeProps({key:1},k.value,{value:p.value,format:r.value,"onUpdate:value":O,onChange:P,onOk:C,picker:B.value}),e.createSlots({_:2},[e.renderList(t.$slots,(d,a)=>({name:a,fn:e.withCtx(i=>[e.renderSlot(t.$slots,a,e.normalizeProps(e.guardReactiveProps(i||{})))])}))]),1040,["value","format","picker"]))}});exports.default=M;
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
import { ApFieldNumberProps } from '../interface';
|
|
2
|
+
|
|
1
3
|
export declare function addZeroToDecimalPlaces(numStr: string, precision?: number): string;
|
|
4
|
+
/**
|
|
5
|
+
* 获取字符串类型的值
|
|
6
|
+
* @param value
|
|
7
|
+
* @param options
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare function getValueStr(value?: number, options?: ApFieldNumberProps): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("lodash-unified"),u=require("@fruits-chain/utils");function i(l,e){if(c.isNil(e))return l;let[a,r=""]=l.split(".");if(r.length>=e)return l;for(let t=r.length;t<e;t++)r+="0";return a+"."+r}function f(l,e){const a=l;if(c.isNil(a))return e==null?void 0:e.emptyText;let r=e!=null&&e.thousands?u.toDecimalMark(a,e.precision):String(a);return e!=null&&e.precision&&e.limitDecimalsRetain&&(r=i(r,e.precision)),r}exports.addZeroToDecimalPlaces=i;exports.getValueStr=f;
|