@nocobase/client 1.4.24 → 1.4.25
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/index.mjs +57 -44
- package/es/schema-component/antd/date-picker/util.d.ts +1 -0
- package/lib/index.js +4 -4
- package/package.json +5 -5
package/es/index.mjs
CHANGED
|
@@ -754,6 +754,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
754
754
|
get isFileCollection() {
|
|
755
755
|
return isFileCollection;
|
|
756
756
|
},
|
|
757
|
+
get isMobile() {
|
|
758
|
+
return isMobile;
|
|
759
|
+
},
|
|
757
760
|
get isShowFilePicker() {
|
|
758
761
|
return isShowFilePicker;
|
|
759
762
|
},
|
|
@@ -2817,6 +2820,9 @@ const bp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
2817
2820
|
get isInitializersSame() {
|
|
2818
2821
|
return isInitializersSame;
|
|
2819
2822
|
},
|
|
2823
|
+
get isMobile() {
|
|
2824
|
+
return isMobile;
|
|
2825
|
+
},
|
|
2820
2826
|
get isPatternDisabled() {
|
|
2821
2827
|
return isPatternDisabled;
|
|
2822
2828
|
},
|
|
@@ -4295,7 +4301,7 @@ function addAppVersion(e, t) {
|
|
|
4295
4301
|
addAppVersion((n = e.properties) == null ? void 0 : n[o], t);
|
|
4296
4302
|
}), e;
|
|
4297
4303
|
}
|
|
4298
|
-
const name = "@nocobase/client", version$1 = "1.4.
|
|
4304
|
+
const name = "@nocobase/client", version$1 = "1.4.25", license = "AGPL-3.0", main = "lib/index.js", module = "es/index.mjs", types = "es/index.d.ts", dependencies = {
|
|
4299
4305
|
"@ahooksjs/use-url-state": "3.5.1",
|
|
4300
4306
|
"@ant-design/cssinjs": "^1.11.1",
|
|
4301
4307
|
"@ant-design/icons": "^5.1.4",
|
|
@@ -4317,9 +4323,9 @@ const name = "@nocobase/client", version$1 = "1.4.24", license = "AGPL-3.0", mai
|
|
|
4317
4323
|
"@formily/reactive-react": "^2.2.27",
|
|
4318
4324
|
"@formily/shared": "^2.2.27",
|
|
4319
4325
|
"@formily/validator": "^2.2.27",
|
|
4320
|
-
"@nocobase/evaluators": "1.4.
|
|
4321
|
-
"@nocobase/sdk": "1.4.
|
|
4322
|
-
"@nocobase/utils": "1.4.
|
|
4326
|
+
"@nocobase/evaluators": "1.4.25",
|
|
4327
|
+
"@nocobase/sdk": "1.4.25",
|
|
4328
|
+
"@nocobase/utils": "1.4.25",
|
|
4323
4329
|
ahooks: "^3.7.2",
|
|
4324
4330
|
antd: "5.12.8",
|
|
4325
4331
|
"antd-style": "3.7.1",
|
|
@@ -7065,25 +7071,33 @@ const REGEX_OF_VARIABLE = /^\s*\{\{\s*([a-zA-Z0-9_$-.]+?)\s*\}\}\s*$/g, REGEX_OF
|
|
|
7065
7071
|
}
|
|
7066
7072
|
return r ? dayjs(e).format(a) : dayjs(e).startOf(n).format(a);
|
|
7067
7073
|
}, mapDatePicker = function() {
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7074
|
+
const e = isMobile();
|
|
7075
|
+
return (t) => {
|
|
7076
|
+
const { dateOnly: o, showTime: n, picker: r = "date", utc: i, gmt: a, underFilter: l } = t, c = getDefaultFormat(t), u = t.onChange;
|
|
7077
|
+
return v(x({}, t), {
|
|
7078
|
+
inputReadOnly: e,
|
|
7079
|
+
format: c,
|
|
7080
|
+
value: str2moment(t.value, t),
|
|
7081
|
+
onChange: (d, p) => {
|
|
7082
|
+
u && u(l ? handleChangeOnFilter(d, r, n) : handleDateChangeOnForm(d, o, i, r, n, a));
|
|
7075
7083
|
}
|
|
7076
7084
|
});
|
|
7077
7085
|
};
|
|
7078
|
-
}
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7086
|
+
};
|
|
7087
|
+
function isMobile() {
|
|
7088
|
+
return window.matchMedia("(max-width: 768px)").matches;
|
|
7089
|
+
}
|
|
7090
|
+
const mapRangePicker = function() {
|
|
7091
|
+
const e = isMobile();
|
|
7092
|
+
return (t) => {
|
|
7093
|
+
const o = getDefaultFormat(t), n = t.onChange, { dateOnly: r, showTime: i, picker: a = "date", utc: l, gmt: c, underFilter: u } = t;
|
|
7094
|
+
return v(x({}, t), {
|
|
7095
|
+
format: o,
|
|
7096
|
+
value: str2moment(t.value, t),
|
|
7097
|
+
inputReadOnly: e,
|
|
7098
|
+
onChange: (d) => {
|
|
7099
|
+
n && n(
|
|
7100
|
+
u ? d ? [handleChangeOnFilter(d[0], a, i), handleChangeOnFilter(d[1], a, i)] : [] : d ? [moment2str(getRangeStart(d[0], t), t), moment2str(getRangeEnd(d[1], t), t)] : []
|
|
7087
7101
|
);
|
|
7088
7102
|
}
|
|
7089
7103
|
});
|
|
@@ -10698,8 +10712,7 @@ const DatePickerContext = React.createContext({ utc: !0 }), useDatePickerContext
|
|
|
10698
10712
|
const { utc: t = !0 } = useDatePickerContext(), o = Array.isArray(e.value) ? e.value[0] : e.value, n = v(x({
|
|
10699
10713
|
utc: t
|
|
10700
10714
|
}, e), {
|
|
10701
|
-
showTime: e.showTime ? { defaultValue: dayjs("00:00:00", "HH:mm:ss") } : !1
|
|
10702
|
-
inputReadOnly: !0
|
|
10715
|
+
showTime: e.showTime ? { defaultValue: dayjs("00:00:00", "HH:mm:ss") } : !1
|
|
10703
10716
|
});
|
|
10704
10717
|
return /* @__PURE__ */ jsx(InternalDatePicker, v(x({}, n), { value: o }));
|
|
10705
10718
|
};
|
|
@@ -10731,8 +10744,7 @@ DatePicker.RangePicker = function(t) {
|
|
|
10731
10744
|
}, t), {
|
|
10732
10745
|
format: getDateTimeFormat(f, C, i, a),
|
|
10733
10746
|
picker: f,
|
|
10734
|
-
showTime: i ? { defaultValue: [dayjs("00:00:00", "HH:mm:ss"), dayjs("23:59:59", "HH:mm:ss")] } : !1
|
|
10735
|
-
inputReadOnly: !0
|
|
10747
|
+
showTime: i ? { defaultValue: [dayjs("00:00:00", "HH:mm:ss"), dayjs("23:59:59", "HH:mm:ss")] } : !1
|
|
10736
10748
|
}), [b, y] = useState(S);
|
|
10737
10749
|
return h ? /* @__PURE__ */ jsxs(Space$1.Compact, { children: [
|
|
10738
10750
|
/* @__PURE__ */ jsx(
|
|
@@ -10777,20 +10789,20 @@ DatePicker.RangePicker = function(t) {
|
|
|
10777
10789
|
] }) : /* @__PURE__ */ jsx(InternalRangePicker, x({}, S));
|
|
10778
10790
|
};
|
|
10779
10791
|
DatePicker.FilterWithPicker = function(t) {
|
|
10780
|
-
const { picker: o = "date", format: n, showTime: r, timeFormat: i } = t, { utc:
|
|
10781
|
-
utc:
|
|
10792
|
+
const { picker: o = "date", format: n, showTime: r, timeFormat: i } = t, a = isMobile(), { utc: l = !0 } = useDatePickerContext(), c = Array.isArray(t.value) ? t.value[0] : t.value, u = useCompile(), d = useFieldSchema(), p = c ? inferPickerType(c) : o, m = getPickerFormat(p) || n, h = v(x({
|
|
10793
|
+
utc: l,
|
|
10794
|
+
inputReadOnly: a
|
|
10782
10795
|
}, t), {
|
|
10783
10796
|
underFilter: !0,
|
|
10784
10797
|
showTime: r ? { defaultValue: dayjs("00:00:00", "HH:mm:ss") } : !1,
|
|
10785
|
-
format: getDateTimeFormat(
|
|
10786
|
-
picker:
|
|
10787
|
-
|
|
10788
|
-
onChange: (C) => {
|
|
10798
|
+
format: getDateTimeFormat(p, m, r, i),
|
|
10799
|
+
picker: p,
|
|
10800
|
+
onChange: (S) => {
|
|
10789
10801
|
t.onChange(void 0), setTimeout(() => {
|
|
10790
|
-
t.onChange(
|
|
10802
|
+
t.onChange(S);
|
|
10791
10803
|
});
|
|
10792
10804
|
}
|
|
10793
|
-
}),
|
|
10805
|
+
}), g = useField(), [f, C] = useState(h);
|
|
10794
10806
|
return /* @__PURE__ */ jsxs(Space$1.Compact, { children: [
|
|
10795
10807
|
/* @__PURE__ */ jsx(
|
|
10796
10808
|
Select$1,
|
|
@@ -10799,8 +10811,8 @@ DatePicker.FilterWithPicker = function(t) {
|
|
|
10799
10811
|
"data-testid": "select-picker",
|
|
10800
10812
|
style: { width: "100px" },
|
|
10801
10813
|
popupMatchSelectWidth: !1,
|
|
10802
|
-
defaultValue:
|
|
10803
|
-
options:
|
|
10814
|
+
defaultValue: p,
|
|
10815
|
+
options: u([
|
|
10804
10816
|
{
|
|
10805
10817
|
label: '{{t("Date")}}',
|
|
10806
10818
|
value: "date"
|
|
@@ -10818,19 +10830,19 @@ DatePicker.FilterWithPicker = function(t) {
|
|
|
10818
10830
|
value: "year"
|
|
10819
10831
|
}
|
|
10820
10832
|
]),
|
|
10821
|
-
onChange: (
|
|
10822
|
-
const
|
|
10823
|
-
|
|
10824
|
-
picker:
|
|
10825
|
-
format: S
|
|
10826
|
-
}), m.picker = C, m.format = b, f(m), u["x-component-props"] = v(x({}, t), {
|
|
10827
|
-
picker: C,
|
|
10833
|
+
onChange: (S) => {
|
|
10834
|
+
const b = getPickerFormat(S), y = getDateTimeFormat(S, b, r, i);
|
|
10835
|
+
g.setComponentProps({
|
|
10836
|
+
picker: S,
|
|
10828
10837
|
format: b
|
|
10829
|
-
}), h.
|
|
10838
|
+
}), h.picker = S, h.format = y, C(h), d["x-component-props"] = v(x({}, t), {
|
|
10839
|
+
picker: S,
|
|
10840
|
+
format: y
|
|
10841
|
+
}), g.value = null;
|
|
10830
10842
|
}
|
|
10831
10843
|
}
|
|
10832
10844
|
),
|
|
10833
|
-
/* @__PURE__ */ jsx(InternalDatePicker, v(x({},
|
|
10845
|
+
/* @__PURE__ */ jsx(InternalDatePicker, v(x({}, f), { value: c }))
|
|
10834
10846
|
] });
|
|
10835
10847
|
};
|
|
10836
10848
|
const useDateVariable = ({ operator: e, schema: t, noDisabled: o }) => {
|
|
@@ -54956,7 +54968,7 @@ function PluginInfo(e) {
|
|
|
54956
54968
|
`,
|
|
54957
54969
|
actions: [
|
|
54958
54970
|
/* @__PURE__ */ jsxs(Space$1, { split: /* @__PURE__ */ jsx(Divider$1, { type: "vertical" }), children: [
|
|
54959
|
-
/* @__PURE__ */ jsxs(
|
|
54971
|
+
g && /* @__PURE__ */ jsxs(
|
|
54960
54972
|
"a",
|
|
54961
54973
|
{
|
|
54962
54974
|
href: g,
|
|
@@ -62259,6 +62271,7 @@ export {
|
|
|
62259
62271
|
isFileCollection,
|
|
62260
62272
|
isInFilterFormBlock,
|
|
62261
62273
|
isInitializersSame,
|
|
62274
|
+
isMobile,
|
|
62262
62275
|
isPatternDisabled,
|
|
62263
62276
|
isSameCollection,
|
|
62264
62277
|
isShowFilePicker,
|
|
@@ -16,6 +16,7 @@ export interface Moment2strOptions {
|
|
|
16
16
|
export declare const moment2str: (value?: Dayjs | null, options?: Moment2strOptions) => any;
|
|
17
17
|
export declare const handleDateChangeOnForm: (value: any, dateOnly: any, utc: any, picker: any, showTime: any, gmt: any) => any;
|
|
18
18
|
export declare const mapDatePicker: () => (props: any) => any;
|
|
19
|
+
export declare function isMobile(): boolean;
|
|
19
20
|
export declare const mapRangePicker: () => (props: any) => any;
|
|
20
21
|
export declare const getDateRanges: (props?: {
|
|
21
22
|
/** 日期是否是 UTC 格式 */
|