@aplus-frontend/ui 0.0.5 → 0.0.6
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.
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ApFieldDatePresetFormats as
|
|
1
|
+
import { defineComponent as E, computed as p, unref as t, openBlock as y, createElementBlock as k, Fragment as B, createTextVNode as O, toDisplayString as C, createVNode as F, createBlock as N, mergeProps as V, createSlots as I, renderList as j, withCtx as U, renderSlot as H, normalizeProps as z, guardReactiveProps as K } from "vue";
|
|
2
|
+
import { ApFieldDatePresetFormats as $, PRESET_FORMAT_MAP as L, PRESET_FORMAT_PICK_MAP as Y, PRESET_FORMAT_TIME_MAP as q } from "../date/constant.mjs";
|
|
3
3
|
import "../../hooks/index.mjs";
|
|
4
|
-
import { isNil as
|
|
4
|
+
import { isNil as b, omit as G, isString as s } from "lodash-unified";
|
|
5
5
|
import u from "dayjs";
|
|
6
|
-
import { DatePicker as
|
|
7
|
-
import { formatDay as
|
|
8
|
-
import { SwapRightOutlined as
|
|
9
|
-
import { omitUndefined as
|
|
10
|
-
import { useControllableValue as
|
|
11
|
-
const
|
|
6
|
+
import { DatePicker as J } from "ant-design-vue";
|
|
7
|
+
import { formatDay as f, formatValue as S } from "../date/helper.mjs";
|
|
8
|
+
import { SwapRightOutlined as Q } from "@ant-design/icons-vue";
|
|
9
|
+
import { omitUndefined as W } from "../../utils/index.mjs";
|
|
10
|
+
import { useControllableValue as X } from "../../hooks/useControllableValue.mjs";
|
|
11
|
+
const de = /* @__PURE__ */ E({
|
|
12
12
|
__name: "index",
|
|
13
13
|
props: {
|
|
14
14
|
mode: { default: "edit" },
|
|
@@ -84,26 +84,26 @@ const ie = /* @__PURE__ */ A({
|
|
|
84
84
|
onOk: {}
|
|
85
85
|
},
|
|
86
86
|
emits: ["update:value"],
|
|
87
|
-
setup(
|
|
88
|
-
const
|
|
89
|
-
() =>
|
|
90
|
-
), l =
|
|
91
|
-
() => r.value ?
|
|
92
|
-
), { value:
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
), m =
|
|
96
|
-
var
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}),
|
|
103
|
-
const e =
|
|
87
|
+
setup(T, { emit: R }) {
|
|
88
|
+
const o = T, w = R, r = p(
|
|
89
|
+
() => $.indexOf(o.format) > -1
|
|
90
|
+
), l = p(
|
|
91
|
+
() => r.value ? L[o.format] : o.format
|
|
92
|
+
), { value: g, updateValue: h } = X(
|
|
93
|
+
o,
|
|
94
|
+
w
|
|
95
|
+
), m = p(() => {
|
|
96
|
+
var a, n;
|
|
97
|
+
const e = t(g);
|
|
98
|
+
return b(e) || !(e != null && e.length) ? e : [
|
|
99
|
+
u((a = t(g)) == null ? void 0 : a[0]),
|
|
100
|
+
u((n = t(g)) == null ? void 0 : n[1])
|
|
101
|
+
];
|
|
102
|
+
}), _ = p(() => t(r) ? o.picker ?? Y[o.format] : o.picker), D = p(() => {
|
|
103
|
+
const e = t(r) ? q[o.format] : {};
|
|
104
104
|
return {
|
|
105
|
-
...
|
|
106
|
-
|
|
105
|
+
...W(
|
|
106
|
+
G(o, [
|
|
107
107
|
"value",
|
|
108
108
|
"onUpdate:value",
|
|
109
109
|
"onChange",
|
|
@@ -115,46 +115,53 @@ const ie = /* @__PURE__ */ A({
|
|
|
115
115
|
...e
|
|
116
116
|
};
|
|
117
117
|
});
|
|
118
|
-
function
|
|
119
|
-
|
|
118
|
+
function M(e) {
|
|
119
|
+
if (!e) {
|
|
120
|
+
h(e);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
120
123
|
const a = s(e[0]) ? u(e[0]) : e[0], n = s(e[1]) ? u(e[1]) : e[1];
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
]) :
|
|
124
|
+
t(r) ? h([
|
|
125
|
+
f(a, t(l)),
|
|
126
|
+
f(n, t(l), !1)
|
|
127
|
+
]) : h([S(a), S(n)]);
|
|
125
128
|
}
|
|
126
|
-
function
|
|
129
|
+
function A(e) {
|
|
127
130
|
var d;
|
|
128
|
-
const a = s(e[0]) ? u(e[0]) : e[0], n = s(e[1]) ? u(e[1]) : e[1], i = e[0] ?
|
|
129
|
-
(d =
|
|
131
|
+
const a = s(e[0]) ? u(e[0]) : e[0], n = s(e[1]) ? u(e[1]) : e[1], i = e[0] ? t(r) ? f(a, t(l)) : a.valueOf() : null, c = e[1] ? t(r) ? f(n, t(l), !1) : n.valueOf() : null;
|
|
132
|
+
(d = o.onOk) == null || d.call(o, [i, c]);
|
|
130
133
|
}
|
|
131
|
-
function
|
|
132
|
-
var v;
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
function x(e, a) {
|
|
135
|
+
var v, P;
|
|
136
|
+
if (b(e)) {
|
|
137
|
+
(v = o.onChange) == null || v.call(o, e, a);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const n = s(e[0]) ? u(e[0]) : e[0], i = s(e[1]) ? u(e[1]) : e[1], c = e[0] ? t(r) ? f(n, t(l)) : n.valueOf() : null, d = e[1] ? t(r) ? f(i, t(l), !1) : i.valueOf() : null;
|
|
141
|
+
(P = o.onChange) == null || P.call(o, [c, d], a);
|
|
135
142
|
}
|
|
136
143
|
return (e, a) => {
|
|
137
144
|
var n, i;
|
|
138
|
-
return e.mode === "read" ? (y(),
|
|
139
|
-
m.value ? (y(),
|
|
140
|
-
O(
|
|
141
|
-
|
|
142
|
-
O(" " +
|
|
143
|
-
], 64)) : (y(),
|
|
144
|
-
O(
|
|
145
|
+
return e.mode === "read" ? (y(), k(B, { key: 0 }, [
|
|
146
|
+
m.value ? (y(), k(B, { key: 0 }, [
|
|
147
|
+
O(C((n = m.value[0]) == null ? void 0 : n.format(l.value)) + " ", 1),
|
|
148
|
+
F(t(Q)),
|
|
149
|
+
O(" " + C((i = m.value[1]) == null ? void 0 : i.format(l.value)), 1)
|
|
150
|
+
], 64)) : (y(), k(B, { key: 1 }, [
|
|
151
|
+
O(C(e.emptyText), 1)
|
|
145
152
|
], 64))
|
|
146
|
-
], 64)) : (y(),
|
|
153
|
+
], 64)) : (y(), N(t(J).RangePicker, V({ key: 1 }, D.value, {
|
|
147
154
|
value: m.value,
|
|
148
|
-
"onUpdate:value":
|
|
149
|
-
onChange:
|
|
150
|
-
picker:
|
|
155
|
+
"onUpdate:value": M,
|
|
156
|
+
onChange: x,
|
|
157
|
+
picker: _.value,
|
|
151
158
|
format: l.value,
|
|
152
|
-
onOk:
|
|
153
|
-
}),
|
|
154
|
-
|
|
159
|
+
onOk: A
|
|
160
|
+
}), I({ _: 2 }, [
|
|
161
|
+
j(e.$slots, (c, d) => ({
|
|
155
162
|
name: d,
|
|
156
|
-
fn:
|
|
157
|
-
|
|
163
|
+
fn: U((v) => [
|
|
164
|
+
H(e.$slots, d, z(K(v || {})))
|
|
158
165
|
])
|
|
159
166
|
}))
|
|
160
167
|
]), 1040, ["value", "picker", "format"]));
|
|
@@ -162,5 +169,5 @@ const ie = /* @__PURE__ */ A({
|
|
|
162
169
|
}
|
|
163
170
|
});
|
|
164
171
|
export {
|
|
165
|
-
|
|
172
|
+
de as default
|
|
166
173
|
};
|
|
@@ -69,9 +69,9 @@ export type ApFieldTextAreaExpose = {
|
|
|
69
69
|
};
|
|
70
70
|
export type ApFieldDateRangeProps = BasicApFieldProps<Omit<RangePickerProps, 'value' | 'onChange' | 'onPanelChange' | 'defaultValue' | 'onOk' | 'renderExtraFooter' | 'onUpdate:value' | 'mode'>> & {
|
|
71
71
|
emptyText?: string;
|
|
72
|
-
value?: RangeValue<number
|
|
72
|
+
value?: RangeValue<number> | null;
|
|
73
73
|
defaultValue?: RangeValue<number>;
|
|
74
|
-
onChange?: (ts: RangeValue<number
|
|
74
|
+
onChange?: (ts: RangeValue<number> | null, dayStr: [string, string]) => void;
|
|
75
75
|
onOk?: (ts: RangeValue<number>) => void;
|
|
76
76
|
format?: LiteralUnion<ApFormatPresetType, string>;
|
|
77
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),v=require("../date/constant.js");require("../../hooks/index.js");const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),v=require("../date/constant.js");require("../../hooks/index.js");const l=require("lodash-unified"),i=require("dayjs"),T=require("ant-design-vue"),d=require("../date/helper.js"),_=require("@ant-design/icons-vue"),M=require("../../utils/index.js"),R=require("../../hooks/useControllableValue.js"),w=e.defineComponent({__name:"index",props:{mode:{default:"edit"},id:{},defaultPickerValue:{},placeholder:{},disabled:{type:[Boolean,Array],default:void 0},disabledTime:{},presets:{},ranges:{},separator:{type:[Object,String,Number,Boolean,null,Array],default:void 0},allowEmpty:{},onCalendarChange:{},onFocus:{},onBlur:{},onMousedown:{},onMouseup:{},onMouseenter:{},onMouseleave:{},onClick:{},direction:{},autocomplete:{},activePickerIndex:{},dateRender:{},panelRender:{},dropdownClassName:{},dropdownAlign:{},popupStyle:{},transitionName:{},allowClear:{type:Boolean,default:void 0},autofocus:{type:Boolean,default:void 0},tabindex:{},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},inputReadOnly:{type:Boolean,default:void 0},format:{default:"Y-D"},suffixIcon:{type:[Object,String,Number,Boolean,null,Array],default:void 0},clearIcon:{type:[Object,String,Number,Boolean,null,Array],default:void 0},getPopupContainer:{},inputRender:{},onOpenChange:{},onContextmenu:{},onKeydown:{},role:{},name:{},picker:{},prefixCls:{},disabledDate:{},monthCellRender:{},locale:{},size:{},bordered:{type:Boolean,default:void 0},showTime:{type:Boolean,default:void 0},showNow:{type:Boolean,default:void 0},order:{type:Boolean,default:void 0},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:{}},emits:["update:value"],setup(B,{emit:h}){const t=B,S=h,u=e.computed(()=>v.ApFieldDatePresetFormats.indexOf(t.format)>-1),r=e.computed(()=>u.value?v.PRESET_FORMAT_MAP[t.format]:t.format),{value:y,updateValue:g}=R.useControllableValue(t,S),c=e.computed(()=>{var a,n;const o=e.unref(y);return l.isNil(o)||!(o!=null&&o.length)?o:[i((a=e.unref(y))==null?void 0:a[0]),i((n=e.unref(y))==null?void 0:n[1])]}),O=e.computed(()=>e.unref(u)?t.picker??v.PRESET_FORMAT_PICK_MAP[t.format]:t.picker),C=e.computed(()=>{const o=e.unref(u)?v.PRESET_FORMAT_TIME_MAP[t.format]:{};return{...M.omitUndefined(l.omit(t,["value","onUpdate:value","onChange","onOk","format","mode"])),...o}});function D(o){if(!o){g(o);return}const a=l.isString(o[0])?i(o[0]):o[0],n=l.isString(o[1])?i(o[1]):o[1];e.unref(u)?g([d.formatDay(a,e.unref(r)),d.formatDay(n,e.unref(r),!1)]):g([d.formatValue(a),d.formatValue(n)])}function P(o){var f;const a=l.isString(o[0])?i(o[0]):o[0],n=l.isString(o[1])?i(o[1]):o[1],s=o[0]?e.unref(u)?d.formatDay(a,e.unref(r)):a.valueOf():null,p=o[1]?e.unref(u)?d.formatDay(n,e.unref(r),!1):n.valueOf():null;(f=t.onOk)==null||f.call(t,[s,p])}function b(o,a){var m,k;if(l.isNil(o)){(m=t.onChange)==null||m.call(t,o,a);return}const n=l.isString(o[0])?i(o[0]):o[0],s=l.isString(o[1])?i(o[1]):o[1],p=o[0]?e.unref(u)?d.formatDay(n,e.unref(r)):n.valueOf():null,f=o[1]?e.unref(u)?d.formatDay(s,e.unref(r),!1):s.valueOf():null;(k=t.onChange)==null||k.call(t,[p,f],a)}return(o,a)=>{var n,s;return o.mode==="read"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[c.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString((n=c.value[0])==null?void 0:n.format(r.value))+" ",1),e.createVNode(e.unref(_.SwapRightOutlined)),e.createTextVNode(" "+e.toDisplayString((s=c.value[1])==null?void 0:s.format(r.value)),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(o.emptyText),1)],64))],64)):(e.openBlock(),e.createBlock(e.unref(T.DatePicker).RangePicker,e.mergeProps({key:1},C.value,{value:c.value,"onUpdate:value":D,onChange:b,picker:O.value,format:r.value,onOk:P}),e.createSlots({_:2},[e.renderList(o.$slots,(p,f)=>({name:f,fn:e.withCtx(m=>[e.renderSlot(o.$slots,f,e.normalizeProps(e.guardReactiveProps(m||{})))])}))]),1040,["value","picker","format"]))}}});exports.default=w;
|
|
@@ -69,9 +69,9 @@ export type ApFieldTextAreaExpose = {
|
|
|
69
69
|
};
|
|
70
70
|
export type ApFieldDateRangeProps = BasicApFieldProps<Omit<RangePickerProps, 'value' | 'onChange' | 'onPanelChange' | 'defaultValue' | 'onOk' | 'renderExtraFooter' | 'onUpdate:value' | 'mode'>> & {
|
|
71
71
|
emptyText?: string;
|
|
72
|
-
value?: RangeValue<number
|
|
72
|
+
value?: RangeValue<number> | null;
|
|
73
73
|
defaultValue?: RangeValue<number>;
|
|
74
|
-
onChange?: (ts: RangeValue<number
|
|
74
|
+
onChange?: (ts: RangeValue<number> | null, dayStr: [string, string]) => void;
|
|
75
75
|
onOk?: (ts: RangeValue<number>) => void;
|
|
76
76
|
format?: LiteralUnion<ApFormatPresetType, string>;
|
|
77
77
|
};
|