openxiangda 1.0.16 → 1.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.
@@ -2062,6 +2062,7 @@ interface StandardFormPageProps {
2062
2062
  mode?: StandardFormPageMode;
2063
2063
  initialValues?: Record<string, any> | null;
2064
2064
  permissions?: FormEngineConfig['permissions'];
2065
+ api?: FormEngineConfig['api'];
2065
2066
  formUuid?: string;
2066
2067
  appType?: string;
2067
2068
  formInstanceId?: string;
@@ -2062,6 +2062,7 @@ interface StandardFormPageProps {
2062
2062
  mode?: StandardFormPageMode;
2063
2063
  initialValues?: Record<string, any> | null;
2064
2064
  permissions?: FormEngineConfig['permissions'];
2065
+ api?: FormEngineConfig['api'];
2065
2066
  formUuid?: string;
2066
2067
  appType?: string;
2067
2068
  formInstanceId?: string;
@@ -30714,26 +30714,35 @@ var secondOptions = Array.from({ length: 60 }, (_, second) => ({
30714
30714
  label: `${second}\u79D2`,
30715
30715
  value: pad2(second)
30716
30716
  }));
30717
- function formatMobileTime(date4) {
30718
- return dayjs14(date4).format("HH:mm:ss");
30717
+ function resolveTimePickerPrecision(dateFormat) {
30718
+ return dateFormat && /s/i.test(dateFormat) ? "second" : "minute";
30719
30719
  }
30720
- function getTimePickerValue(date4) {
30721
- return [dayjs14(date4).format("HH"), dayjs14(date4).format("mm"), dayjs14(date4).format("ss")];
30720
+ function formatMobileTime(date4, dateFormat) {
30721
+ return dayjs14(date4).format(resolveTimePickerPrecision(dateFormat) === "second" ? "HH:mm:ss" : "HH:mm");
30722
30722
  }
30723
- function applyTimePickerValue(base, value) {
30723
+ function getTimePickerColumns(precision = "second") {
30724
+ return precision === "second" ? [hourOptions, minuteOptions, secondOptions] : [hourOptions, minuteOptions];
30725
+ }
30726
+ function getTimePickerValue(date4, precision = "second") {
30727
+ const base = [dayjs14(date4).format("HH"), dayjs14(date4).format("mm")];
30728
+ return precision === "second" ? [...base, dayjs14(date4).format("ss")] : base;
30729
+ }
30730
+ function applyTimePickerValue(base, value, precision = "second") {
30724
30731
  const [hour, minute, second] = value;
30725
- return dayjs14(base).hour(Number(hour ?? 0)).minute(Number(minute ?? 0)).second(Number(second ?? 0)).millisecond(0).toDate();
30732
+ return dayjs14(base).hour(Number(hour ?? 0)).minute(Number(minute ?? 0)).second(precision === "second" ? Number(second ?? 0) : 0).millisecond(0).toDate();
30726
30733
  }
30727
30734
  function MobileTimePickerView({
30728
30735
  value,
30736
+ dateFormat,
30729
30737
  onChange
30730
30738
  }) {
30739
+ const precision = resolveTimePickerPrecision(dateFormat);
30731
30740
  return /* @__PURE__ */ jsx34(
30732
30741
  picker_view_default,
30733
30742
  {
30734
- columns: [hourOptions, minuteOptions, secondOptions],
30735
- value: getTimePickerValue(value),
30736
- onChange: (nextValue) => onChange(applyTimePickerValue(value, nextValue)),
30743
+ columns: getTimePickerColumns(precision),
30744
+ value: getTimePickerValue(value, precision),
30745
+ onChange: (nextValue) => onChange(applyTimePickerValue(value, nextValue, precision)),
30737
30746
  className: "sy-mobile-time-picker",
30738
30747
  renderLabel: (item) => item.label
30739
30748
  }
@@ -30770,30 +30779,32 @@ function getDateOptions(center, min2, max2) {
30770
30779
  };
30771
30780
  });
30772
30781
  }
30773
- function getDateTimePickerValue(date4) {
30774
- return [dayjs14(date4).format("YYYY-MM-DD"), ...getTimePickerValue(date4)];
30782
+ function getDateTimePickerValue(date4, precision = "second") {
30783
+ return [dayjs14(date4).format("YYYY-MM-DD"), ...getTimePickerValue(date4, precision)];
30775
30784
  }
30776
- function applyDateTimePickerValue(base, value) {
30785
+ function applyDateTimePickerValue(base, value, precision = "second") {
30777
30786
  const [dateValue, hour, minute, second] = value;
30778
30787
  const date4 = dayjs14(String(dateValue || dayjs14(base).format("YYYY-MM-DD")));
30779
- return date4.hour(Number(hour ?? 0)).minute(Number(minute ?? 0)).second(Number(second ?? 0)).millisecond(0).toDate();
30788
+ return date4.hour(Number(hour ?? 0)).minute(Number(minute ?? 0)).second(precision === "second" ? Number(second ?? 0) : 0).millisecond(0).toDate();
30780
30789
  }
30781
30790
  function MobileDateTimePickerView({
30782
30791
  value,
30792
+ dateFormat,
30783
30793
  min: min2,
30784
30794
  max: max2,
30785
30795
  onChange
30786
30796
  }) {
30797
+ const precision = resolveTimePickerPrecision(dateFormat);
30787
30798
  const columns = React202.useMemo(
30788
- () => [getDateOptions(value, min2, max2), hourOptions, minuteOptions, secondOptions],
30789
- [value, min2, max2]
30799
+ () => [getDateOptions(value, min2, max2), ...getTimePickerColumns(precision)],
30800
+ [value, min2, max2, precision]
30790
30801
  );
30791
30802
  return /* @__PURE__ */ jsx34(
30792
30803
  picker_view_default,
30793
30804
  {
30794
30805
  columns,
30795
- value: getDateTimePickerValue(value),
30796
- onChange: (nextValue) => onChange(applyDateTimePickerValue(value, nextValue)),
30806
+ value: getDateTimePickerValue(value, precision),
30807
+ onChange: (nextValue) => onChange(applyDateTimePickerValue(value, nextValue, precision)),
30797
30808
  className: "sy-mobile-time-picker sy-mobile-date-time-picker",
30798
30809
  renderLabel: (item) => item.label
30799
30810
  }
@@ -30874,10 +30885,10 @@ function DateFieldMobile({
30874
30885
  }
30875
30886
  ),
30876
30887
  mode === "time" ? /* @__PURE__ */ jsxs9(Fragment5, { children: [
30877
- /* @__PURE__ */ jsx35(MobileTimePickerView, { value: tempDate, onChange: setTempDate }),
30888
+ /* @__PURE__ */ jsx35(MobileTimePickerView, { value: tempDate, dateFormat: format2, onChange: setTempDate }),
30878
30889
  /* @__PURE__ */ jsxs9("div", { className: "sy-mobile-date-time-footer", children: [
30879
30890
  /* @__PURE__ */ jsx35("span", { children: "\u9009\u62E9\u65F6\u95F4" }),
30880
- /* @__PURE__ */ jsx35("button", { type: "button", className: "sy-mobile-time-pill is-active", children: formatMobileTime(tempDate) })
30891
+ /* @__PURE__ */ jsx35("button", { type: "button", className: "sy-mobile-time-pill is-active", children: formatMobileTime(tempDate, format2) })
30881
30892
  ] })
30882
30893
  ] }) : /* @__PURE__ */ jsxs9(Fragment5, { children: [
30883
30894
  /* @__PURE__ */ jsx35(
@@ -30908,7 +30919,7 @@ function DateFieldMobile({
30908
30919
  type: "button",
30909
30920
  className: "sy-mobile-time-pill",
30910
30921
  onClick: () => setMode("time"),
30911
- children: formatMobileTime(tempDate)
30922
+ children: formatMobileTime(tempDate, format2)
30912
30923
  }
30913
30924
  )
30914
30925
  ] }) : null
@@ -31164,6 +31175,7 @@ function CascadeDateFieldMobile({
31164
31175
  MobileDateTimePickerView,
31165
31176
  {
31166
31177
  value: timeStep === "start" ? tempStart : tempEnd,
31178
+ dateFormat: format2,
31167
31179
  min: timeStep === "start" ? min2 : endMin,
31168
31180
  max: max2,
31169
31181
  onChange: timeStep === "start" ? updateTempStart : updateTempEnd
@@ -45095,6 +45107,7 @@ var StandardFormPage = ({
45095
45107
  mode,
45096
45108
  initialValues,
45097
45109
  permissions,
45110
+ api: externalApi,
45098
45111
  formUuid,
45099
45112
  appType,
45100
45113
  formInstanceId,
@@ -45108,7 +45121,7 @@ var StandardFormPage = ({
45108
45121
  const formType = normalizeStandardFormType(
45109
45122
  schema.template?.formType || (resolvedMode === "process" ? "process" : "form")
45110
45123
  );
45111
- const api = useMemo60(() => {
45124
+ const submitApi = useMemo60(() => {
45112
45125
  if (!onSubmit) return void 0;
45113
45126
  return {
45114
45127
  submitFormData: async (payload) => onSubmit(
@@ -45121,6 +45134,13 @@ var StandardFormPage = ({
45121
45134
  }
45122
45135
  };
45123
45136
  }, [formType, onSubmit]);
45137
+ const api = useMemo60(() => {
45138
+ if (!externalApi && !submitApi) return void 0;
45139
+ return {
45140
+ ...externalApi ?? {},
45141
+ ...submitApi ?? {}
45142
+ };
45143
+ }, [externalApi, submitApi]);
45124
45144
  if (resolvedMode === "process") {
45125
45145
  return /* @__PURE__ */ jsx100(
45126
45146
  ProcessDetailTemplate,