@rytass/bpm-core-react 0.3.0 → 0.3.1
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/README.md +13 -1
- package/dist/chunks/{app-navigation-BRRFCkxZ.cjs → app-navigation-C_mbz7jx.cjs} +2 -2
- package/dist/chunks/app-navigation-C_mbz7jx.cjs.map +1 -0
- package/dist/chunks/{app-navigation-rxhpHCch.js → app-navigation-uwbNEw9P.js} +65 -65
- package/dist/chunks/app-navigation-uwbNEw9P.js.map +1 -0
- package/dist/chunks/approval-instance-list-page-Mo6wpDPb.cjs +2 -0
- package/dist/chunks/approval-instance-list-page-Mo6wpDPb.cjs.map +1 -0
- package/dist/chunks/approval-instance-list-page-nmzMrj0b.js +281 -0
- package/dist/chunks/approval-instance-list-page-nmzMrj0b.js.map +1 -0
- package/dist/chunks/builder-DPhAH381.cjs +3 -0
- package/dist/chunks/builder-DPhAH381.cjs.map +1 -0
- package/dist/chunks/{builder-Du_0apkh.js → builder-DqZskyXC.js} +333 -330
- package/dist/chunks/builder-DqZskyXC.js.map +1 -0
- package/dist/chunks/categories-DEijUOnw.cjs +2 -0
- package/dist/chunks/categories-DEijUOnw.cjs.map +1 -0
- package/dist/chunks/{categories-DG4k7S8V.js → categories-DTEl182t.js} +129 -126
- package/dist/chunks/categories-DTEl182t.js.map +1 -0
- package/dist/chunks/{dashboard-page-DcDiWQp2.cjs → dashboard-page-DCmuB0Rw.cjs} +2 -2
- package/dist/chunks/dashboard-page-DCmuB0Rw.cjs.map +1 -0
- package/dist/chunks/dashboard-page-Dx5PeEeN.js +117 -0
- package/dist/chunks/dashboard-page-Dx5PeEeN.js.map +1 -0
- package/dist/chunks/delegations-C-ZrwzvU.js +572 -0
- package/dist/chunks/delegations-C-ZrwzvU.js.map +1 -0
- package/dist/chunks/delegations-C5PzZ5Kn.js +645 -0
- package/dist/chunks/delegations-C5PzZ5Kn.js.map +1 -0
- package/dist/chunks/delegations-DOGDvybX.cjs +2 -0
- package/dist/chunks/delegations-DOGDvybX.cjs.map +1 -0
- package/dist/chunks/delegations-DkDBWOQ7.cjs +2 -0
- package/dist/chunks/delegations-DkDBWOQ7.cjs.map +1 -0
- package/dist/chunks/detail-B2gcOPkd.cjs +2 -0
- package/dist/chunks/detail-B2gcOPkd.cjs.map +1 -0
- package/dist/chunks/{detail-DilI0PPe.js → detail-CfFyU5zC.js} +667 -664
- package/dist/chunks/detail-CfFyU5zC.js.map +1 -0
- package/dist/chunks/{format-date-time-hKLVMxq4.cjs → format-date-time-isOa3e9q.cjs} +2 -2
- package/dist/chunks/{format-date-time-hKLVMxq4.cjs.map → format-date-time-isOa3e9q.cjs.map} +1 -1
- package/dist/chunks/notifications-CPQ-nVar.cjs +2 -0
- package/dist/chunks/notifications-CPQ-nVar.cjs.map +1 -0
- package/dist/chunks/notifications-DweexUVy.js +197 -0
- package/dist/chunks/notifications-DweexUVy.js.map +1 -0
- package/dist/chunks/orgs-DgZ0DQ3-.cjs +2 -0
- package/dist/chunks/orgs-DgZ0DQ3-.cjs.map +1 -0
- package/dist/chunks/{orgs-c29y74w2.js → orgs-xrdhb3hS.js} +668 -665
- package/dist/chunks/orgs-xrdhb3hS.js.map +1 -0
- package/dist/chunks/templates-PK_VYvcy.js +383 -0
- package/dist/chunks/templates-PK_VYvcy.js.map +1 -0
- package/dist/chunks/{templates-Cd0WFheA.cjs → templates-x1OJZmsG.cjs} +2 -2
- package/dist/chunks/templates-x1OJZmsG.cjs.map +1 -0
- package/dist/chunks/users-CY4-NK3j.js +218 -0
- package/dist/chunks/users-CY4-NK3j.js.map +1 -0
- package/dist/chunks/users-DHnu_056.cjs +2 -0
- package/dist/chunks/users-DHnu_056.cjs.map +1 -0
- package/dist/components/app-navigation.d.ts +17 -10
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/notification-drawer-provider.d.ts +1 -1
- package/dist/lib/notification-unread-provider.d.ts +1 -1
- package/dist/lib/providers.d.ts +1 -1
- package/dist/pages/admin/delegations/index.cjs +1 -1
- package/dist/pages/admin/delegations/index.js +1 -1
- package/dist/pages/admin/orgs/index.cjs +1 -1
- package/dist/pages/admin/orgs/index.js +1 -1
- package/dist/pages/admin/users/index.cjs +1 -1
- package/dist/pages/admin/users/index.js +1 -1
- package/dist/pages/delegations/index.cjs +1 -1
- package/dist/pages/delegations/index.js +1 -1
- package/dist/pages/forms/builder/index.cjs +1 -1
- package/dist/pages/forms/builder/index.js +1 -1
- package/dist/pages/instances/detail/index.cjs +1 -1
- package/dist/pages/instances/detail/index.js +1 -1
- package/dist/pages/settings/notifications/index.cjs +1 -1
- package/dist/pages/settings/notifications/index.js +1 -1
- package/dist/pages/templates/categories/index.cjs +1 -1
- package/dist/pages/templates/categories/index.js +1 -1
- package/dist/pages/templates/index.cjs +1 -1
- package/dist/pages/templates/index.js +1 -1
- package/dist/views/admin/delegations/index.cjs +1 -1
- package/dist/views/admin/delegations/index.js +1 -1
- package/dist/views/admin/index.cjs +1 -1
- package/dist/views/admin/index.js +3 -3
- package/dist/views/admin/orgs/index.cjs +1 -1
- package/dist/views/admin/orgs/index.js +1 -1
- package/dist/views/admin/users/index.cjs +1 -1
- package/dist/views/admin/users/index.js +1 -1
- package/dist/views/cc/index.cjs +1 -1
- package/dist/views/cc/index.js +1 -1
- package/dist/views/dashboard/index.cjs +1 -1
- package/dist/views/dashboard/index.js +1 -1
- package/dist/views/delegations/index.cjs +1 -1
- package/dist/views/delegations/index.js +1 -1
- package/dist/views/forms/builder/index.cjs +1 -1
- package/dist/views/forms/builder/index.js +1 -1
- package/dist/views/forms/index.cjs +1 -1
- package/dist/views/forms/index.cjs.map +1 -1
- package/dist/views/forms/index.js +93 -90
- package/dist/views/forms/index.js.map +1 -1
- package/dist/views/inbox/index.cjs +1 -1
- package/dist/views/inbox/index.cjs.map +1 -1
- package/dist/views/inbox/index.js +127 -124
- package/dist/views/inbox/index.js.map +1 -1
- package/dist/views/instances/detail/index.cjs +1 -1
- package/dist/views/instances/detail/index.js +1 -1
- package/dist/views/instances/new/index.cjs +1 -1
- package/dist/views/instances/new/index.cjs.map +1 -1
- package/dist/views/instances/new/index.js +120 -114
- package/dist/views/instances/new/index.js.map +1 -1
- package/dist/views/search/index.cjs +1 -1
- package/dist/views/search/index.js +1 -1
- package/dist/views/sent/index.cjs +1 -1
- package/dist/views/sent/index.js +1 -1
- package/dist/views/settings/index.cjs +1 -1
- package/dist/views/settings/index.js +1 -1
- package/dist/views/settings/notifications/index.cjs +1 -1
- package/dist/views/settings/notifications/index.js +1 -1
- package/dist/views/templates/categories/index.cjs +1 -1
- package/dist/views/templates/categories/index.js +1 -1
- package/dist/views/templates/designer/index.cjs +2 -2
- package/dist/views/templates/designer/index.cjs.map +1 -1
- package/dist/views/templates/designer/index.js +573 -570
- package/dist/views/templates/designer/index.js.map +1 -1
- package/dist/views/templates/index.cjs +1 -1
- package/dist/views/templates/index.js +2 -2
- package/dist/views/templates/versions/index.cjs +1 -1
- package/dist/views/templates/versions/index.cjs.map +1 -1
- package/dist/views/templates/versions/index.js +50 -47
- package/dist/views/templates/versions/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/app-navigation-BRRFCkxZ.cjs.map +0 -1
- package/dist/chunks/app-navigation-rxhpHCch.js.map +0 -1
- package/dist/chunks/approval-instance-list-page-2vUWc5-c.cjs +0 -2
- package/dist/chunks/approval-instance-list-page-2vUWc5-c.cjs.map +0 -1
- package/dist/chunks/approval-instance-list-page-BgE4vQw8.js +0 -278
- package/dist/chunks/approval-instance-list-page-BgE4vQw8.js.map +0 -1
- package/dist/chunks/builder-B8X-m6C5.cjs +0 -3
- package/dist/chunks/builder-B8X-m6C5.cjs.map +0 -1
- package/dist/chunks/builder-Du_0apkh.js.map +0 -1
- package/dist/chunks/categories-DG4k7S8V.js.map +0 -1
- package/dist/chunks/categories-DshBQG33.cjs +0 -2
- package/dist/chunks/categories-DshBQG33.cjs.map +0 -1
- package/dist/chunks/dashboard-page-CTBwpu_D.js +0 -114
- package/dist/chunks/dashboard-page-CTBwpu_D.js.map +0 -1
- package/dist/chunks/dashboard-page-DcDiWQp2.cjs.map +0 -1
- package/dist/chunks/delegations-BAZQbElH.js +0 -642
- package/dist/chunks/delegations-BAZQbElH.js.map +0 -1
- package/dist/chunks/delegations-DzrckrPp.js +0 -569
- package/dist/chunks/delegations-DzrckrPp.js.map +0 -1
- package/dist/chunks/delegations-Z8hTajLj.cjs +0 -2
- package/dist/chunks/delegations-Z8hTajLj.cjs.map +0 -1
- package/dist/chunks/delegations-hb9JoVZe.cjs +0 -2
- package/dist/chunks/delegations-hb9JoVZe.cjs.map +0 -1
- package/dist/chunks/detail-DilI0PPe.js.map +0 -1
- package/dist/chunks/detail-DuRg3Y7b.cjs +0 -2
- package/dist/chunks/detail-DuRg3Y7b.cjs.map +0 -1
- package/dist/chunks/notifications-B2Lk3grg.js +0 -194
- package/dist/chunks/notifications-B2Lk3grg.js.map +0 -1
- package/dist/chunks/notifications-C8ADhnxF.cjs +0 -2
- package/dist/chunks/notifications-C8ADhnxF.cjs.map +0 -1
- package/dist/chunks/orgs-CGv3VNDR.cjs +0 -2
- package/dist/chunks/orgs-CGv3VNDR.cjs.map +0 -1
- package/dist/chunks/orgs-c29y74w2.js.map +0 -1
- package/dist/chunks/templates-Cd0WFheA.cjs.map +0 -1
- package/dist/chunks/templates-Dn9QHFSy.js +0 -380
- package/dist/chunks/templates-Dn9QHFSy.js.map +0 -1
- package/dist/chunks/users-B-trMu0E.cjs +0 -2
- package/dist/chunks/users-B-trMu0E.cjs.map +0 -1
- package/dist/chunks/users-itVXXRj7.js +0 -215
- package/dist/chunks/users-itVXXRj7.js.map +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { a as e } from "./auth-provider-Bnox5gsx.js";
|
|
3
3
|
import { t } from "./format-date-time-CB-LxzqT.js";
|
|
4
|
-
import { t as n } from "./app-navigation-
|
|
4
|
+
import { t as n } from "./app-navigation-uwbNEw9P.js";
|
|
5
5
|
import { t as r } from "./bpm-form-field-Cao0rMol.js";
|
|
6
6
|
import { t as i } from "./FormRendererView-DrHsuSVo.js";
|
|
7
7
|
import { t as a } from "./form-name-modal-C3OEvkCV.js";
|
|
8
8
|
import { useEffect as o, useMemo as s, useState as c } from "react";
|
|
9
|
-
import { Accordion as l, Badge as u, BaseCard as d, Button as f, DatePicker as ee, DateTimePicker as te, Icon as ne, Input as p,
|
|
9
|
+
import { Accordion as l, Badge as u, BaseCard as d, Button as f, DatePicker as ee, DateTimePicker as te, Icon as ne, Input as p, PageHeader as re, Section as ie, SectionGroup as ae, Select as m, Tab as oe, TabItem as h, Table as se, Textarea as ce, Toggle as le, Typography as g } from "@mezzanine-ui/react";
|
|
10
10
|
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
11
|
-
import { AlignLeftIcon as
|
|
12
|
-
import
|
|
13
|
-
import { buildConditionExpression as T, buildFormRendererValues as
|
|
14
|
-
import { DragDropContext as
|
|
11
|
+
import { AlignLeftIcon as ue, CalendarIcon as de, CheckedIcon as fe, CheckedOutlineIcon as b, CurrencyDollarIcon as x, DotDragVerticalIcon as pe, DotGridIcon as me, EditIcon as he, FileAttachmentIcon as S, FileIcon as C, ListIcon as w, PlusIcon as ge, SaveIcon as _e, TrashIcon as ve } from "@mezzanine-ui/icons";
|
|
12
|
+
import ye from "@mezzanine-ui/react/ContentHeader";
|
|
13
|
+
import { buildConditionExpression as T, buildFormRendererValues as be, clampOptionalNumber as xe, createFieldDefinition as Se, forkFormDefinition as Ce, formatDatePickerValue as we, formatDateTimePickerValue as Te, isDateFieldDefinition as Ee, isNumberFieldDefinition as De, isSelectFieldDefinition as Oe, parseConditionRule as ke, parseOptionalNumberInput as Ae, publishFormDefinitionVersion as je, readConditionOperatorOption as Me, readConditionOperatorOptions as Ne, readDatePickerValue as Pe, readDefaultConditionOperator as Fe, readDefaultConditionValue as Ie, readFieldOptionAsSelectOption as E, readFormBuilder as Le, readSelectOption as D, updateFormDefinition as Re, updateFormDefinitionDraft as ze } from "@rytass/bpm-core-client/form";
|
|
14
|
+
import { DragDropContext as Be, Draggable as Ve, Droppable as He } from "@hello-pangea/dnd";
|
|
15
15
|
import O from "next/dynamic";
|
|
16
16
|
import { json as k } from "@codemirror/lang-json";
|
|
17
17
|
import { EditorView as A } from "@codemirror/view";
|
|
18
18
|
//#region src/views/forms/builder/json-code-editor.tsx
|
|
19
|
-
var
|
|
19
|
+
var Ue = {
|
|
20
20
|
alignItems: "center",
|
|
21
21
|
border: "1px solid var(--mzn-color-border-neutral)",
|
|
22
22
|
borderRadius: 4,
|
|
@@ -44,15 +44,15 @@ var We = {
|
|
|
44
44
|
".cm-gutters": { borderRight: "1px solid var(--mzn-color-border-neutral)" },
|
|
45
45
|
".cm-scroller": { fontFamily: "ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", monospace" }
|
|
46
46
|
})
|
|
47
|
-
],
|
|
47
|
+
], We = O(() => import("@uiw/react-codemirror"), {
|
|
48
48
|
loading: () => /* @__PURE__ */ v("div", {
|
|
49
|
-
style:
|
|
49
|
+
style: Ue,
|
|
50
50
|
children: "載入 JSON 編輯器"
|
|
51
51
|
}),
|
|
52
52
|
ssr: !1
|
|
53
53
|
});
|
|
54
|
-
function
|
|
55
|
-
return /* @__PURE__ */ v(
|
|
54
|
+
function Ge({ disabled: e, height: t, name: n, onChange: r, placeholder: i, value: a }) {
|
|
55
|
+
return /* @__PURE__ */ v(We, {
|
|
56
56
|
"aria-label": n,
|
|
57
57
|
basicSetup: {
|
|
58
58
|
autocompletion: !0,
|
|
@@ -79,16 +79,16 @@ function Ke({ disabled: e, height: t, name: n, onChange: r, placeholder: i, valu
|
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
81
|
//#region src/views/forms/builder/FormBuilderView.tsx
|
|
82
|
-
var
|
|
82
|
+
var Ke = [
|
|
83
83
|
{
|
|
84
84
|
description: "單行文字、姓名、編號",
|
|
85
|
-
icon:
|
|
85
|
+
icon: ue,
|
|
86
86
|
label: "文字",
|
|
87
87
|
type: "text"
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
description: "多行補充內容",
|
|
91
|
-
icon:
|
|
91
|
+
icon: C,
|
|
92
92
|
label: "長文字",
|
|
93
93
|
type: "textarea"
|
|
94
94
|
},
|
|
@@ -106,19 +106,19 @@ var qe = [
|
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
108
|
description: "日期或到期日",
|
|
109
|
-
icon:
|
|
109
|
+
icon: de,
|
|
110
110
|
label: "日期",
|
|
111
111
|
type: "date"
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
114
|
description: "日期與時間",
|
|
115
|
-
icon:
|
|
115
|
+
icon: de,
|
|
116
116
|
label: "日期時間",
|
|
117
117
|
type: "datetime"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
description: "是 / 否狀態",
|
|
121
|
-
icon:
|
|
121
|
+
icon: fe,
|
|
122
122
|
label: "開關",
|
|
123
123
|
type: "boolean"
|
|
124
124
|
},
|
|
@@ -130,7 +130,7 @@ var qe = [
|
|
|
130
130
|
},
|
|
131
131
|
{
|
|
132
132
|
description: "固定選項單選",
|
|
133
|
-
icon:
|
|
133
|
+
icon: me,
|
|
134
134
|
label: "單選",
|
|
135
135
|
type: "radio"
|
|
136
136
|
},
|
|
@@ -142,55 +142,55 @@ var qe = [
|
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
144
|
description: "附件或佐證資料",
|
|
145
|
-
icon:
|
|
145
|
+
icon: S,
|
|
146
146
|
label: "附件",
|
|
147
147
|
type: "file_upload"
|
|
148
148
|
}
|
|
149
|
-
],
|
|
149
|
+
], qe = {
|
|
150
150
|
alignItems: "start",
|
|
151
151
|
display: "flex",
|
|
152
152
|
flexWrap: "wrap",
|
|
153
153
|
gap: 16
|
|
154
|
-
},
|
|
154
|
+
}, Je = {
|
|
155
155
|
flex: "0.55 1 300px",
|
|
156
156
|
minWidth: 0
|
|
157
|
-
},
|
|
157
|
+
}, Ye = {
|
|
158
158
|
flex: "1.45 1 720px",
|
|
159
159
|
minWidth: 620
|
|
160
160
|
}, M = {
|
|
161
161
|
display: "grid",
|
|
162
162
|
gap: 12
|
|
163
|
-
},
|
|
163
|
+
}, Xe = {
|
|
164
164
|
display: "flex",
|
|
165
165
|
flexWrap: "wrap",
|
|
166
166
|
gap: 6
|
|
167
|
-
},
|
|
167
|
+
}, Ze = {
|
|
168
168
|
flex: "0 0 auto",
|
|
169
169
|
whiteSpace: "nowrap"
|
|
170
|
-
},
|
|
170
|
+
}, Qe = {
|
|
171
171
|
display: "grid",
|
|
172
172
|
gap: 8
|
|
173
|
-
},
|
|
173
|
+
}, $e = {
|
|
174
174
|
alignItems: "center",
|
|
175
175
|
cursor: "grab",
|
|
176
176
|
display: "flex",
|
|
177
177
|
gap: 12,
|
|
178
178
|
touchAction: "none"
|
|
179
|
-
},
|
|
179
|
+
}, et = {
|
|
180
180
|
display: "grid",
|
|
181
181
|
flex: "1 1 auto",
|
|
182
182
|
gap: 2,
|
|
183
183
|
minWidth: 0
|
|
184
|
-
},
|
|
184
|
+
}, tt = {
|
|
185
185
|
alignItems: "center",
|
|
186
186
|
display: "flex",
|
|
187
187
|
flex: "0 0 auto",
|
|
188
188
|
gap: 4
|
|
189
|
-
},
|
|
189
|
+
}, nt = {
|
|
190
190
|
alignItems: "center",
|
|
191
191
|
display: "flex",
|
|
192
192
|
gap: 6
|
|
193
|
-
},
|
|
193
|
+
}, rt = { userSelect: "none" }, it = { filter: "drop-shadow(0 8px 18px rgba(0, 0, 0, 0.12))" }, at = {
|
|
194
194
|
alignItems: "center",
|
|
195
195
|
border: "1px dashed var(--mzn-color-border-neutral)",
|
|
196
196
|
borderRadius: 6,
|
|
@@ -199,72 +199,72 @@ var qe = [
|
|
|
199
199
|
minHeight: 240,
|
|
200
200
|
padding: 32,
|
|
201
201
|
textAlign: "center"
|
|
202
|
-
},
|
|
202
|
+
}, ot = {
|
|
203
203
|
display: "flex",
|
|
204
204
|
gap: 8,
|
|
205
205
|
justifyContent: "center"
|
|
206
|
-
},
|
|
206
|
+
}, st = {
|
|
207
207
|
display: "grid",
|
|
208
208
|
gap: 14
|
|
209
|
-
},
|
|
209
|
+
}, ct = {
|
|
210
210
|
display: "grid",
|
|
211
211
|
columnGap: 16,
|
|
212
212
|
gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))",
|
|
213
213
|
rowGap: 8
|
|
214
|
-
},
|
|
214
|
+
}, lt = { gridColumn: "1 / -1" }, ut = {
|
|
215
215
|
alignItems: "center",
|
|
216
216
|
display: "flex",
|
|
217
217
|
gap: 8,
|
|
218
218
|
gridColumn: "1 / -1",
|
|
219
219
|
justifyContent: "flex-end"
|
|
220
|
-
},
|
|
220
|
+
}, dt = { gridColumn: "1 / -1" }, ft = {
|
|
221
221
|
alignItems: "start",
|
|
222
222
|
display: "block",
|
|
223
223
|
width: "100%"
|
|
224
|
-
},
|
|
225
|
-
...
|
|
224
|
+
}, pt = {
|
|
225
|
+
...ft,
|
|
226
226
|
gridColumn: "1 / -1"
|
|
227
|
-
},
|
|
227
|
+
}, mt = {
|
|
228
228
|
minWidth: 0,
|
|
229
229
|
width: "100%"
|
|
230
|
-
},
|
|
230
|
+
}, ht = {
|
|
231
231
|
minWidth: "100%",
|
|
232
232
|
width: "100%"
|
|
233
|
-
},
|
|
233
|
+
}, gt = {
|
|
234
234
|
display: "grid",
|
|
235
235
|
gap: 14
|
|
236
|
-
},
|
|
236
|
+
}, _t = {
|
|
237
237
|
alignItems: "start",
|
|
238
238
|
display: "block",
|
|
239
239
|
width: "100%"
|
|
240
|
-
},
|
|
240
|
+
}, vt = {
|
|
241
241
|
minWidth: 0,
|
|
242
242
|
width: "100%"
|
|
243
|
-
},
|
|
243
|
+
}, yt = { gridColumn: "2 / -1" }, bt = {
|
|
244
244
|
display: "grid",
|
|
245
245
|
gap: 10,
|
|
246
246
|
width: "100%"
|
|
247
|
-
},
|
|
247
|
+
}, xt = {
|
|
248
248
|
display: "grid",
|
|
249
249
|
gap: 8,
|
|
250
250
|
gridTemplateColumns: "repeat(auto-fit, minmax(160px, 1fr))"
|
|
251
|
-
},
|
|
251
|
+
}, St = { display: "inline-flex" }, Ct = {
|
|
252
252
|
display: "grid",
|
|
253
253
|
gap: 16
|
|
254
|
-
},
|
|
254
|
+
}, wt = {
|
|
255
255
|
display: "grid",
|
|
256
256
|
gap: 8
|
|
257
|
-
},
|
|
257
|
+
}, Tt = {
|
|
258
258
|
display: "flex",
|
|
259
259
|
justifyContent: "flex-end"
|
|
260
|
-
},
|
|
260
|
+
}, Et = {
|
|
261
261
|
color: "var(--mzn-color-text-error)",
|
|
262
262
|
fontSize: "0.72em",
|
|
263
263
|
lineHeight: 0,
|
|
264
264
|
marginLeft: 2,
|
|
265
265
|
verticalAlign: "super"
|
|
266
266
|
};
|
|
267
|
-
function
|
|
267
|
+
function Dt(e) {
|
|
268
268
|
e && (e.style.width = "100%");
|
|
269
269
|
}
|
|
270
270
|
var N = {
|
|
@@ -273,7 +273,7 @@ var N = {
|
|
|
273
273
|
}, P = {
|
|
274
274
|
layout: [],
|
|
275
275
|
schemaVersion: 1
|
|
276
|
-
},
|
|
276
|
+
}, Ot = [
|
|
277
277
|
{
|
|
278
278
|
id: "unset",
|
|
279
279
|
name: "不預設"
|
|
@@ -286,13 +286,13 @@ var N = {
|
|
|
286
286
|
id: "false",
|
|
287
287
|
name: "否"
|
|
288
288
|
}
|
|
289
|
-
],
|
|
289
|
+
], kt = [{
|
|
290
290
|
id: "true",
|
|
291
291
|
name: "是"
|
|
292
292
|
}, {
|
|
293
293
|
id: "false",
|
|
294
294
|
name: "否"
|
|
295
|
-
}],
|
|
295
|
+
}], At = [
|
|
296
296
|
{
|
|
297
297
|
label: "顯示",
|
|
298
298
|
name: "fieldVisibleWhen",
|
|
@@ -312,28 +312,28 @@ var N = {
|
|
|
312
312
|
target: "readonlyWhen"
|
|
313
313
|
}
|
|
314
314
|
];
|
|
315
|
-
function F({ formId:
|
|
316
|
-
let
|
|
315
|
+
function F({ formId: ue }) {
|
|
316
|
+
let de = e(), b = ue, [x, me] = c(null), [S, C] = c(null), [w, O] = c(N), [k, A] = c(P), [Ue, j] = c(L(N)), [We, F] = c(L(P)), [zt, Ut] = c({}), [qt, R] = c(null), [z, Jt] = c("design"), [B, V] = c(null), [Yt, H] = c(null), [Xt, Zt] = c(!1), [Qt, $t] = c(Bt(N, P)), [en, tn] = c(!0), [nn, rn] = c(!1), [U, W] = c(!1);
|
|
317
317
|
o(() => {
|
|
318
|
-
|
|
318
|
+
hn();
|
|
319
319
|
}, [b]), o(() => {
|
|
320
320
|
w.fields.some((e) => e.fieldKey === B) || V(w.fields[0]?.fieldKey ?? null);
|
|
321
321
|
}, [w.fields, B]), o(() => {
|
|
322
|
-
|
|
322
|
+
Ut((e) => be(w.fields, e));
|
|
323
323
|
}, [w.fields]), o(() => {
|
|
324
|
-
z !== "advanced" && (j(
|
|
324
|
+
z !== "advanced" && (j(L(w)), F(L(k)));
|
|
325
325
|
}, [
|
|
326
326
|
z,
|
|
327
327
|
w,
|
|
328
328
|
k
|
|
329
329
|
]);
|
|
330
|
-
let G = s(() => w.fields.find((e) => e.fieldKey === B) ?? w.fields[0] ?? null, [w.fields, B]),
|
|
330
|
+
let G = s(() => w.fields.find((e) => e.fieldKey === B) ?? w.fields[0] ?? null, [w.fields, B]), an = s(() => (x?.versions ?? []).map((e) => ({
|
|
331
331
|
key: e.id,
|
|
332
332
|
publishedAt: t(e.publishedAt),
|
|
333
333
|
status: e.status,
|
|
334
334
|
updatedAt: t(e.updatedAt),
|
|
335
335
|
version: `v${e.version}`
|
|
336
|
-
})), [x]),
|
|
336
|
+
})), [x]), on = s(() => [
|
|
337
337
|
{
|
|
338
338
|
dataIndex: "version",
|
|
339
339
|
key: "version",
|
|
@@ -342,7 +342,7 @@ function F({ formId: de }) {
|
|
|
342
342
|
},
|
|
343
343
|
{
|
|
344
344
|
key: "status",
|
|
345
|
-
render: (e) => /* @__PURE__ */ v(
|
|
345
|
+
render: (e) => /* @__PURE__ */ v(Gt, { status: e.status }),
|
|
346
346
|
title: "狀態",
|
|
347
347
|
width: 140
|
|
348
348
|
},
|
|
@@ -358,7 +358,7 @@ function F({ formId: de }) {
|
|
|
358
358
|
title: "發布時間",
|
|
359
359
|
width: 180
|
|
360
360
|
}
|
|
361
|
-
], []),
|
|
361
|
+
], []), sn = s(() => Bt(w, k), [w, k]), K = sn.schemaJson !== Qt.schemaJson || sn.uiSchemaJson !== Qt.uiSchemaJson;
|
|
362
362
|
o(() => {
|
|
363
363
|
function e(e) {
|
|
364
364
|
K && (e.preventDefault(), e.returnValue = "");
|
|
@@ -367,67 +367,67 @@ function F({ formId: de }) {
|
|
|
367
367
|
window.removeEventListener("beforeunload", e);
|
|
368
368
|
};
|
|
369
369
|
}, [K]);
|
|
370
|
-
function
|
|
371
|
-
K && !window.confirm("目前有尚未儲存的表單草稿,確定要離開嗎?") ||
|
|
370
|
+
function cn() {
|
|
371
|
+
K && !window.confirm("目前有尚未儲存的表單草稿,確定要離開嗎?") || de.push("/forms");
|
|
372
372
|
}
|
|
373
|
-
let
|
|
373
|
+
let ln = s(() => Vt(x?.versions ?? [], x?.definition.currentVersionId), [x?.definition.currentVersionId, x?.versions]), un = S ?? ln ?? x?.versions[0] ?? null, dn = !K && un?.status === "PUBLISHED", fn = Ht({
|
|
374
374
|
hasUnsavedChanges: K,
|
|
375
|
-
latestPublishedVersion:
|
|
376
|
-
openedContentPublished:
|
|
377
|
-
openedVersion:
|
|
378
|
-
}),
|
|
379
|
-
async function
|
|
380
|
-
|
|
375
|
+
latestPublishedVersion: ln,
|
|
376
|
+
openedContentPublished: dn,
|
|
377
|
+
openedVersion: un
|
|
378
|
+
}), pn = U || !K && dn && !S, mn = K ? "保存並發布" : S ? "發布草稿" : dn ? "已發布" : "發布版本";
|
|
379
|
+
async function hn() {
|
|
380
|
+
tn(!0), H(null);
|
|
381
381
|
try {
|
|
382
|
-
let e = await
|
|
383
|
-
|
|
382
|
+
let e = await Le(b), t = e.versions.find((e) => e.status === "DRAFT") ?? null;
|
|
383
|
+
me(e), C(t);
|
|
384
384
|
let n = t?.schema ?? e.versions[0]?.schema ?? N, r = t?.uiSchema ?? e.versions[0]?.uiSchema ?? P;
|
|
385
|
-
O(n), A(r),
|
|
385
|
+
O(n), A(r), $t(Bt(n, r)), j(L(n)), F(L(r)), V(t?.schema.fields[0]?.fieldKey ?? e.versions[0]?.schema.fields[0]?.fieldKey ?? null), R(null);
|
|
386
386
|
} catch (e) {
|
|
387
|
-
H(
|
|
387
|
+
H(Kt(e));
|
|
388
388
|
} finally {
|
|
389
|
-
|
|
389
|
+
tn(!1);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
async function
|
|
393
|
-
let e = await
|
|
394
|
-
return
|
|
392
|
+
async function gn() {
|
|
393
|
+
let e = await ze((S ?? await Ce(b)).id, w, k);
|
|
394
|
+
return C(e), e;
|
|
395
395
|
}
|
|
396
|
-
async function
|
|
396
|
+
async function _n() {
|
|
397
397
|
W(!0), H(null);
|
|
398
398
|
try {
|
|
399
|
-
await
|
|
399
|
+
await gn(), await hn();
|
|
400
400
|
} catch (e) {
|
|
401
|
-
H(
|
|
401
|
+
H(Kt(e));
|
|
402
402
|
} finally {
|
|
403
403
|
W(!1);
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
async function
|
|
406
|
+
async function vn() {
|
|
407
407
|
W(!0), H(null);
|
|
408
408
|
try {
|
|
409
|
-
await
|
|
409
|
+
await je((await gn()).id), await hn();
|
|
410
410
|
} catch (e) {
|
|
411
|
-
H(
|
|
411
|
+
H(Kt(e));
|
|
412
412
|
} finally {
|
|
413
413
|
W(!1);
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
async function
|
|
416
|
+
async function yn(e) {
|
|
417
417
|
if (!x) throw Error("尚未載入表單資料");
|
|
418
|
-
|
|
418
|
+
rn(!0);
|
|
419
419
|
try {
|
|
420
|
-
let t = await
|
|
421
|
-
|
|
420
|
+
let t = await Re(x.definition.id, e);
|
|
421
|
+
me({
|
|
422
422
|
...x,
|
|
423
423
|
definition: t
|
|
424
|
-
}),
|
|
424
|
+
}), Zt(!1);
|
|
425
425
|
} finally {
|
|
426
|
-
|
|
426
|
+
rn(!1);
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
function
|
|
430
|
-
let t =
|
|
429
|
+
function bn(e) {
|
|
430
|
+
let t = Se(e, w.fields.length + 1);
|
|
431
431
|
O({
|
|
432
432
|
...w,
|
|
433
433
|
fields: [...w.fields, t]
|
|
@@ -437,13 +437,13 @@ function F({ formId: de }) {
|
|
|
437
437
|
fieldKey: t.fieldKey,
|
|
438
438
|
width: e === "textarea" || e === "file_upload" ? "FULL" : "HALF"
|
|
439
439
|
}]
|
|
440
|
-
}), V(t.fieldKey),
|
|
440
|
+
}), V(t.fieldKey), Jt("design"), R(null);
|
|
441
441
|
}
|
|
442
|
-
function
|
|
442
|
+
function xn(e) {
|
|
443
443
|
let t = e;
|
|
444
|
-
t === "advanced" && z !== "advanced" && (j(
|
|
444
|
+
t === "advanced" && z !== "advanced" && (j(L(w)), F(L(k))), Jt(t);
|
|
445
445
|
}
|
|
446
|
-
function
|
|
446
|
+
function Sn(e) {
|
|
447
447
|
let t = w.fields.filter((t) => t.fieldKey !== e);
|
|
448
448
|
O({
|
|
449
449
|
...w,
|
|
@@ -453,14 +453,14 @@ function F({ formId: de }) {
|
|
|
453
453
|
layout: k.layout.filter((t) => t.fieldKey !== e)
|
|
454
454
|
}), V(B === e ? t[0]?.fieldKey ?? null : B), R(null);
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function Cn(e) {
|
|
457
457
|
let t = e.destination;
|
|
458
458
|
t && e.source.index !== t.index && (O((n) => ({
|
|
459
459
|
...n,
|
|
460
|
-
fields:
|
|
460
|
+
fields: Wt(n.fields, e.source.index, t.index)
|
|
461
461
|
})), A((n) => ({
|
|
462
462
|
...n,
|
|
463
|
-
layout:
|
|
463
|
+
layout: Wt(n.layout, e.source.index, t.index)
|
|
464
464
|
})), R(null));
|
|
465
465
|
}
|
|
466
466
|
function q(e) {
|
|
@@ -484,45 +484,45 @@ function F({ formId: de }) {
|
|
|
484
484
|
}), V(r), R(null);
|
|
485
485
|
}
|
|
486
486
|
function Y(e) {
|
|
487
|
-
J((t) =>
|
|
487
|
+
J((t) => Pt(t) ? {
|
|
488
488
|
...t,
|
|
489
489
|
...e
|
|
490
490
|
} : t);
|
|
491
491
|
}
|
|
492
|
-
function
|
|
493
|
-
J((t) =>
|
|
492
|
+
function wn(e) {
|
|
493
|
+
J((t) => De(t) ? {
|
|
494
494
|
...t,
|
|
495
495
|
...e
|
|
496
496
|
} : t);
|
|
497
497
|
}
|
|
498
|
-
function
|
|
499
|
-
J((t) =>
|
|
498
|
+
function Tn(e) {
|
|
499
|
+
J((t) => Ee(t) ? {
|
|
500
500
|
...t,
|
|
501
501
|
...e
|
|
502
502
|
} : t);
|
|
503
503
|
}
|
|
504
504
|
function X(e) {
|
|
505
|
-
J((t) =>
|
|
505
|
+
J((t) => Oe(t) ? {
|
|
506
506
|
...t,
|
|
507
507
|
...e
|
|
508
508
|
} : t);
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function En(e) {
|
|
511
511
|
J((t) => t.type === "boolean" ? {
|
|
512
512
|
...t,
|
|
513
513
|
...e
|
|
514
514
|
} : t);
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function Dn(e) {
|
|
517
517
|
J((t) => t.type === "file_upload" ? {
|
|
518
518
|
...t,
|
|
519
519
|
...e
|
|
520
520
|
} : t);
|
|
521
521
|
}
|
|
522
|
-
function
|
|
523
|
-
|
|
522
|
+
function On(e) {
|
|
523
|
+
Ut(e);
|
|
524
524
|
}
|
|
525
|
-
function
|
|
525
|
+
function kn(e, t) {
|
|
526
526
|
O((n) => ({
|
|
527
527
|
...n,
|
|
528
528
|
fields: n.fields.map((n) => n.fieldKey === e ? {
|
|
@@ -531,7 +531,7 @@ function F({ formId: de }) {
|
|
|
531
531
|
} : n)
|
|
532
532
|
})), R(null);
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function An(e) {
|
|
535
535
|
j(e);
|
|
536
536
|
try {
|
|
537
537
|
O(JSON.parse(e)), R(null);
|
|
@@ -539,7 +539,7 @@ function F({ formId: de }) {
|
|
|
539
539
|
R("Form Schema JSON 格式不正確");
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function jn(e) {
|
|
543
543
|
F(e);
|
|
544
544
|
try {
|
|
545
545
|
A(JSON.parse(e)), R(null);
|
|
@@ -547,123 +547,126 @@ function F({ formId: de }) {
|
|
|
547
547
|
R("UI Schema JSON 格式不正確");
|
|
548
548
|
}
|
|
549
549
|
}
|
|
550
|
-
return /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ y(
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
children:
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
550
|
+
return /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ y(n, {
|
|
551
|
+
activeHref: "/forms",
|
|
552
|
+
children: [/* @__PURE__ */ v(re, { children: /* @__PURE__ */ y(ye, {
|
|
553
|
+
description: fn,
|
|
554
|
+
onBackClick: cn,
|
|
555
|
+
title: x?.definition.name ?? "表單設計器",
|
|
556
|
+
children: [
|
|
557
|
+
/* @__PURE__ */ v(f, {
|
|
558
|
+
"aria-label": "修改表單名稱",
|
|
559
|
+
disabled: nn || !x,
|
|
560
|
+
icon: he,
|
|
561
|
+
iconType: "icon-only",
|
|
562
|
+
onClick: () => Zt(!0),
|
|
563
|
+
variant: "base-ghost",
|
|
564
|
+
children: "修改表單名稱"
|
|
565
|
+
}),
|
|
566
|
+
/* @__PURE__ */ v(f, {
|
|
567
|
+
"aria-label": "儲存草稿",
|
|
568
|
+
disabled: U || !K,
|
|
569
|
+
icon: _e,
|
|
570
|
+
iconType: "icon-only",
|
|
571
|
+
onClick: () => void _n(),
|
|
572
|
+
variant: "base-secondary",
|
|
573
|
+
children: "儲存草稿"
|
|
574
|
+
}),
|
|
575
|
+
/* @__PURE__ */ v(f, {
|
|
576
|
+
disabled: pn,
|
|
577
|
+
icon: fe,
|
|
578
|
+
iconType: "leading",
|
|
579
|
+
onClick: () => void vn(),
|
|
580
|
+
variant: "base-primary",
|
|
581
|
+
children: mn
|
|
582
|
+
})
|
|
583
|
+
]
|
|
584
|
+
}) }), /* @__PURE__ */ v(ae, { children: /* @__PURE__ */ v(ie, { children: /* @__PURE__ */ y("div", {
|
|
585
|
+
style: Ct,
|
|
586
|
+
children: [
|
|
587
|
+
Yt ? /* @__PURE__ */ v(g, {
|
|
588
|
+
color: "text-error",
|
|
589
|
+
variant: "body",
|
|
590
|
+
children: Yt
|
|
591
|
+
}) : null,
|
|
592
|
+
/* @__PURE__ */ y(oe, {
|
|
593
|
+
activeKey: z,
|
|
594
|
+
onChange: xn,
|
|
595
|
+
size: "sub",
|
|
596
|
+
children: [
|
|
597
|
+
/* @__PURE__ */ v(h, { children: "設計" }, "design"),
|
|
598
|
+
/* @__PURE__ */ v(h, { children: "預覽" }, "preview"),
|
|
599
|
+
/* @__PURE__ */ v(h, { children: "版本" }, "versions"),
|
|
600
|
+
/* @__PURE__ */ v(h, { children: "進階" }, "advanced")
|
|
601
|
+
]
|
|
602
|
+
}),
|
|
603
|
+
z === "design" ? Mn() : null,
|
|
604
|
+
z === "preview" ? Zn() : null,
|
|
605
|
+
z === "versions" ? Qn() : null,
|
|
606
|
+
z === "advanced" ? $n() : null
|
|
607
|
+
]
|
|
608
|
+
}) }) })]
|
|
609
|
+
}), /* @__PURE__ */ v(a, {
|
|
607
610
|
confirmText: "儲存",
|
|
608
611
|
initialName: x?.definition.name ?? "",
|
|
609
|
-
loading:
|
|
610
|
-
onClose: () =>
|
|
611
|
-
onSubmit:
|
|
612
|
-
open:
|
|
612
|
+
loading: nn,
|
|
613
|
+
onClose: () => Zt(!1),
|
|
614
|
+
onSubmit: yn,
|
|
615
|
+
open: Xt,
|
|
613
616
|
title: "修改表單名稱"
|
|
614
617
|
})] });
|
|
615
|
-
function
|
|
618
|
+
function Mn() {
|
|
616
619
|
return /* @__PURE__ */ y("div", {
|
|
617
620
|
style: M,
|
|
618
621
|
children: [/* @__PURE__ */ y("div", {
|
|
619
|
-
style:
|
|
622
|
+
style: Qe,
|
|
620
623
|
children: [/* @__PURE__ */ v(g, {
|
|
621
624
|
component: "h2",
|
|
622
625
|
variant: "label-primary",
|
|
623
626
|
children: "新增欄位"
|
|
624
627
|
}), /* @__PURE__ */ v("div", {
|
|
625
|
-
style:
|
|
626
|
-
children:
|
|
628
|
+
style: Xe,
|
|
629
|
+
children: Ke.map((e) => /* @__PURE__ */ v(f, {
|
|
627
630
|
disabled: U,
|
|
628
631
|
icon: e.icon,
|
|
629
632
|
iconType: "leading",
|
|
630
|
-
onClick: () =>
|
|
633
|
+
onClick: () => bn(e.type),
|
|
631
634
|
size: "sub",
|
|
632
|
-
style:
|
|
635
|
+
style: Ze,
|
|
633
636
|
type: "button",
|
|
634
637
|
variant: "base-secondary",
|
|
635
638
|
children: e.label
|
|
636
639
|
}, e.type))
|
|
637
640
|
})]
|
|
638
641
|
}), /* @__PURE__ */ y("div", {
|
|
639
|
-
style:
|
|
642
|
+
style: qe,
|
|
640
643
|
children: [/* @__PURE__ */ y("div", {
|
|
641
644
|
style: {
|
|
642
645
|
...M,
|
|
643
|
-
...
|
|
646
|
+
...Je
|
|
644
647
|
},
|
|
645
648
|
children: [/* @__PURE__ */ v(g, {
|
|
646
649
|
component: "h2",
|
|
647
650
|
variant: "label-primary",
|
|
648
651
|
children: "表單畫布"
|
|
649
|
-
}), w.fields.length > 0 ? /* @__PURE__ */ v(
|
|
650
|
-
onDragEnd:
|
|
651
|
-
children: /* @__PURE__ */ v(
|
|
652
|
+
}), w.fields.length > 0 ? /* @__PURE__ */ v(Be, {
|
|
653
|
+
onDragEnd: Cn,
|
|
654
|
+
children: /* @__PURE__ */ v(He, {
|
|
652
655
|
droppableId: "form-builder-fields",
|
|
653
656
|
children: (e) => /* @__PURE__ */ y("div", {
|
|
654
657
|
...e.droppableProps,
|
|
655
658
|
ref: e.innerRef,
|
|
656
659
|
style: M,
|
|
657
|
-
children: [w.fields.map((e, t) => /* @__PURE__ */ v(
|
|
660
|
+
children: [w.fields.map((e, t) => /* @__PURE__ */ v(Ve, {
|
|
658
661
|
draggableId: e.fieldKey,
|
|
659
662
|
index: t,
|
|
660
663
|
isDragDisabled: U,
|
|
661
|
-
children: (t, n) =>
|
|
664
|
+
children: (t, n) => Yn(e, t, n.isDragging)
|
|
662
665
|
}, e.fieldKey)), e.placeholder]
|
|
663
666
|
})
|
|
664
667
|
})
|
|
665
668
|
}) : /* @__PURE__ */ y("div", {
|
|
666
|
-
style:
|
|
669
|
+
style: at,
|
|
667
670
|
children: [/* @__PURE__ */ y("div", {
|
|
668
671
|
style: M,
|
|
669
672
|
children: [/* @__PURE__ */ v(g, {
|
|
@@ -676,15 +679,15 @@ function F({ formId: de }) {
|
|
|
676
679
|
children: "從上方新增第一個欄位,或直接建立常用文字欄位開始設計。"
|
|
677
680
|
})]
|
|
678
681
|
}), /* @__PURE__ */ y("div", {
|
|
679
|
-
style:
|
|
682
|
+
style: ot,
|
|
680
683
|
children: [/* @__PURE__ */ v(f, {
|
|
681
684
|
disabled: U,
|
|
682
|
-
onClick: () =>
|
|
685
|
+
onClick: () => bn("text"),
|
|
683
686
|
variant: "base-primary",
|
|
684
687
|
children: "新增文字欄位"
|
|
685
688
|
}), /* @__PURE__ */ v(f, {
|
|
686
689
|
disabled: U,
|
|
687
|
-
onClick: () =>
|
|
690
|
+
onClick: () => bn("textarea"),
|
|
688
691
|
variant: "base-secondary",
|
|
689
692
|
children: "新增長文字"
|
|
690
693
|
})]
|
|
@@ -693,13 +696,13 @@ function F({ formId: de }) {
|
|
|
693
696
|
}), /* @__PURE__ */ y("div", {
|
|
694
697
|
style: {
|
|
695
698
|
...M,
|
|
696
|
-
...
|
|
699
|
+
...Ye
|
|
697
700
|
},
|
|
698
701
|
children: [/* @__PURE__ */ v(g, {
|
|
699
702
|
component: "h2",
|
|
700
703
|
variant: "label-primary",
|
|
701
704
|
children: "欄位設定"
|
|
702
|
-
}), G ?
|
|
705
|
+
}), G ? Nn(G) : /* @__PURE__ */ v(g, {
|
|
703
706
|
color: "text-neutral",
|
|
704
707
|
variant: "body",
|
|
705
708
|
children: "請先新增或選取欄位。"
|
|
@@ -708,21 +711,21 @@ function F({ formId: de }) {
|
|
|
708
711
|
})]
|
|
709
712
|
});
|
|
710
713
|
}
|
|
711
|
-
function
|
|
714
|
+
function Nn(e) {
|
|
712
715
|
return /* @__PURE__ */ y("div", {
|
|
713
|
-
style:
|
|
714
|
-
children: [
|
|
716
|
+
style: st,
|
|
717
|
+
children: [Pn(e), Fn(e)]
|
|
715
718
|
});
|
|
716
719
|
}
|
|
717
|
-
function
|
|
720
|
+
function Pn(e) {
|
|
718
721
|
return /* @__PURE__ */ y("div", {
|
|
719
|
-
style:
|
|
722
|
+
style: ct,
|
|
720
723
|
children: [
|
|
721
724
|
/* @__PURE__ */ v("div", {
|
|
722
|
-
style:
|
|
725
|
+
style: ut,
|
|
723
726
|
children: /* @__PURE__ */ v(u, {
|
|
724
727
|
size: "main",
|
|
725
|
-
text:
|
|
728
|
+
text: jt(e.type),
|
|
726
729
|
variant: "text-info"
|
|
727
730
|
})
|
|
728
731
|
}),
|
|
@@ -744,71 +747,71 @@ function F({ formId: de }) {
|
|
|
744
747
|
value: e.placeholder ?? "",
|
|
745
748
|
variant: "base"
|
|
746
749
|
}), U),
|
|
747
|
-
|
|
750
|
+
In(e)
|
|
748
751
|
]
|
|
749
752
|
});
|
|
750
753
|
}
|
|
751
|
-
function
|
|
754
|
+
function Fn(e) {
|
|
752
755
|
return /* @__PURE__ */ v(l, {
|
|
753
|
-
defaultExpanded:
|
|
756
|
+
defaultExpanded: Mt(e),
|
|
754
757
|
size: "sub",
|
|
755
758
|
title: "進階設定",
|
|
756
759
|
children: /* @__PURE__ */ y("div", {
|
|
757
|
-
style:
|
|
760
|
+
style: ct,
|
|
758
761
|
children: [
|
|
759
762
|
/* @__PURE__ */ v(g, {
|
|
760
763
|
component: "h3",
|
|
761
|
-
style:
|
|
764
|
+
style: lt,
|
|
762
765
|
variant: "label-primary",
|
|
763
766
|
children: "條件規則"
|
|
764
767
|
}),
|
|
765
768
|
/* @__PURE__ */ v(g, {
|
|
766
769
|
color: "text-neutral",
|
|
767
|
-
style:
|
|
770
|
+
style: dt,
|
|
768
771
|
variant: "body",
|
|
769
772
|
children: "只有需要根據其他欄位改變顯示、必填或唯讀狀態時才需要設定。"
|
|
770
773
|
}),
|
|
771
|
-
|
|
774
|
+
Un(e)
|
|
772
775
|
]
|
|
773
776
|
})
|
|
774
777
|
});
|
|
775
778
|
}
|
|
776
|
-
function
|
|
777
|
-
return
|
|
779
|
+
function In(e) {
|
|
780
|
+
return Pt(e) ? Ln(e) : De(e) ? Rn(e) : Ee(e) ? zn(e) : Oe(e) ? Bn(e) : e.type === "boolean" ? Vn(e) : Hn(e);
|
|
778
781
|
}
|
|
779
|
-
function
|
|
782
|
+
function Ln(e) {
|
|
780
783
|
return /* @__PURE__ */ y(_, { children: [
|
|
781
|
-
$("預設值", "fieldDefaultValue", e.type === "textarea" ?
|
|
784
|
+
$("預設值", "fieldDefaultValue", e.type === "textarea" ? Kn({
|
|
782
785
|
disabled: U,
|
|
783
786
|
name: "fieldDefaultValue",
|
|
784
787
|
onChange: (e) => Y({ defaultValue: e || void 0 }),
|
|
785
788
|
placeholder: "輸入此欄位的預設文字",
|
|
786
789
|
rows: 3,
|
|
787
|
-
value:
|
|
790
|
+
value: I(e.defaultValue)
|
|
788
791
|
}) : /* @__PURE__ */ v(p, {
|
|
789
792
|
onChange: (e) => Y({ defaultValue: e.target.value || void 0 }),
|
|
790
793
|
placeholder: "輸入此欄位的預設文字",
|
|
791
|
-
value:
|
|
794
|
+
value: I(e.defaultValue),
|
|
792
795
|
variant: "base"
|
|
793
796
|
}), U),
|
|
794
797
|
$("最小長度", "fieldMinLength", Q(e.minLength, (e) => Y({ minLength: e }), "例如:2", { min: 0 }), U),
|
|
795
798
|
$("最大長度", "fieldMaxLength", Q(e.maxLength, (e) => Y({ maxLength: e }), "例如:100", { min: 1 }), U)
|
|
796
799
|
] });
|
|
797
800
|
}
|
|
798
|
-
function
|
|
801
|
+
function Rn(e) {
|
|
799
802
|
return /* @__PURE__ */ y(_, { children: [
|
|
800
|
-
$("預設值", "fieldDefaultValue", Q(typeof e.defaultValue == "number" ? e.defaultValue : void 0, (e) =>
|
|
803
|
+
$("預設值", "fieldDefaultValue", Q(typeof e.defaultValue == "number" ? e.defaultValue : void 0, (e) => wn({ defaultValue: e }), e.type === "money" ? "例如:1000" : "輸入預設數值", {
|
|
801
804
|
max: e.maximum,
|
|
802
805
|
min: e.minimum
|
|
803
806
|
}), U),
|
|
804
|
-
$("最小值", "fieldMinimum", Q(e.minimum, (e) =>
|
|
805
|
-
$("最大值", "fieldMaximum", Q(e.maximum, (e) =>
|
|
807
|
+
$("最小值", "fieldMinimum", Q(e.minimum, (e) => wn({ minimum: e }), "例如:0"), U),
|
|
808
|
+
$("最大值", "fieldMaximum", Q(e.maximum, (e) => wn({ maximum: e }), "例如:999999"), U)
|
|
806
809
|
] });
|
|
807
810
|
}
|
|
808
|
-
function
|
|
809
|
-
return $("預設值", "fieldDefaultValue",
|
|
811
|
+
function zn(e) {
|
|
812
|
+
return $("預設值", "fieldDefaultValue", qn(e, I(e.defaultValue), (e) => Tn({ defaultValue: e })), U);
|
|
810
813
|
}
|
|
811
|
-
function
|
|
814
|
+
function Bn(e) {
|
|
812
815
|
let t = Array.isArray(e.defaultValue) ? e.defaultValue : [], n = e.options.filter((e) => t.includes(e.value)).map(E);
|
|
813
816
|
return /* @__PURE__ */ y(_, { children: [$("預設值", "fieldDefaultValue", e.type === "checkbox" ? /* @__PURE__ */ v(m, {
|
|
814
817
|
clearable: !0,
|
|
@@ -823,46 +826,46 @@ function F({ formId: de }) {
|
|
|
823
826
|
options: e.options.map(E),
|
|
824
827
|
placeholder: "選擇預設選項",
|
|
825
828
|
value: typeof e.defaultValue == "string" ? D(e.options.map(E), e.defaultValue) : null
|
|
826
|
-
}), U), $("選項", "fieldOptions",
|
|
829
|
+
}), U), $("選項", "fieldOptions", Jn(e), U, !0)] });
|
|
827
830
|
}
|
|
828
|
-
function
|
|
831
|
+
function Vn(e) {
|
|
829
832
|
let t = typeof e.defaultValue == "boolean" ? String(e.defaultValue) : "unset";
|
|
830
833
|
return $("預設值", "fieldDefaultValue", /* @__PURE__ */ v(m, {
|
|
831
834
|
clearable: !1,
|
|
832
|
-
onChange: (e) =>
|
|
833
|
-
options: [...
|
|
835
|
+
onChange: (e) => En({ defaultValue: e?.id === "true" ? !0 : e?.id === "false" ? !1 : void 0 }),
|
|
836
|
+
options: [...Ot],
|
|
834
837
|
placeholder: "選擇預設狀態",
|
|
835
|
-
value: D(
|
|
838
|
+
value: D(Ot, t)
|
|
836
839
|
}), U);
|
|
837
840
|
}
|
|
838
|
-
function
|
|
839
|
-
return /* @__PURE__ */ y(_, { children: [$("檔案數", "fieldMaxFiles", Q(e.maxFiles, (e) =>
|
|
841
|
+
function Hn(e) {
|
|
842
|
+
return /* @__PURE__ */ y(_, { children: [$("檔案數", "fieldMaxFiles", Q(e.maxFiles, (e) => Dn({ maxFiles: e }), "例如:1", { min: 1 }), U), $("MIME", "fieldAcceptedMimeTypes", Kn({
|
|
840
843
|
disabled: U,
|
|
841
844
|
name: "fieldAcceptedMimeTypes",
|
|
842
|
-
onChange: (e) =>
|
|
845
|
+
onChange: (e) => Dn({ acceptedMimeTypes: Ft(e) }),
|
|
843
846
|
placeholder: "每行一個 MIME type,例如:application/pdf",
|
|
844
847
|
rows: 3,
|
|
845
|
-
value:
|
|
848
|
+
value: It(e.acceptedMimeTypes)
|
|
846
849
|
}), !1)] });
|
|
847
850
|
}
|
|
848
|
-
function
|
|
851
|
+
function Un(e) {
|
|
849
852
|
let t = w.fields.filter((t) => t.fieldKey !== e.fieldKey);
|
|
850
|
-
return t.length ? /* @__PURE__ */ v(_, { children:
|
|
853
|
+
return t.length ? /* @__PURE__ */ v(_, { children: At.map((n) => Wn(e, n, t)) }) : /* @__PURE__ */ v(g, {
|
|
851
854
|
color: "text-neutral",
|
|
852
|
-
style:
|
|
855
|
+
style: dt,
|
|
853
856
|
variant: "body",
|
|
854
857
|
children: "目前沒有其他欄位可作為條件來源。新增更多欄位後即可設定條件規則。"
|
|
855
858
|
});
|
|
856
859
|
}
|
|
857
|
-
function
|
|
858
|
-
let r = e[t.target], i = r ?
|
|
860
|
+
function Wn(e, t, n) {
|
|
861
|
+
let r = e[t.target], i = r ? ke(r) : null, a = n.find((e) => e.fieldKey === i?.fieldKey), o = a ?? n[0], s = n.map(Nt), c = Ne(o), l = i && c.some((e) => e.id === i.operator) ? i.operator : Fe(o), u = i?.value ?? Ie(o), d = !!r, f = d && (!i || !a);
|
|
859
862
|
return $(t.label, t.name, /* @__PURE__ */ y("div", {
|
|
860
|
-
style:
|
|
861
|
-
children: [/* @__PURE__ */ v(
|
|
863
|
+
style: bt,
|
|
864
|
+
children: [/* @__PURE__ */ v(le, {
|
|
862
865
|
checked: d,
|
|
863
866
|
disabled: U,
|
|
864
867
|
label: d ? "已啟用" : "不啟用",
|
|
865
|
-
onChange: (e) => Z(t.target, e.target.checked ? T(o,
|
|
868
|
+
onChange: (e) => Z(t.target, e.target.checked ? T(o, Fe(o), Ie(o)) : void 0),
|
|
866
869
|
size: "sub",
|
|
867
870
|
supportingText: t.supportingText
|
|
868
871
|
}), d ? f ? /* @__PURE__ */ v(g, {
|
|
@@ -870,13 +873,13 @@ function F({ formId: de }) {
|
|
|
870
873
|
variant: "body",
|
|
871
874
|
children: "這個規則不是目前 UI 支援的格式。重新選擇條件後會取代既有規則。"
|
|
872
875
|
}) : /* @__PURE__ */ y("div", {
|
|
873
|
-
style:
|
|
876
|
+
style: xt,
|
|
874
877
|
children: [
|
|
875
878
|
/* @__PURE__ */ v(m, {
|
|
876
879
|
clearable: !1,
|
|
877
880
|
onChange: (e) => {
|
|
878
881
|
let r = n.find((t) => t.fieldKey === e?.id) ?? o;
|
|
879
|
-
Z(t.target, T(r,
|
|
882
|
+
Z(t.target, T(r, Fe(r), Ie(r)));
|
|
880
883
|
},
|
|
881
884
|
options: s,
|
|
882
885
|
placeholder: "選擇欄位",
|
|
@@ -884,12 +887,12 @@ function F({ formId: de }) {
|
|
|
884
887
|
}),
|
|
885
888
|
/* @__PURE__ */ v(m, {
|
|
886
889
|
clearable: !1,
|
|
887
|
-
onChange: (e) => Z(t.target, T(o,
|
|
890
|
+
onChange: (e) => Z(t.target, T(o, Me(e?.id) ?? l, u)),
|
|
888
891
|
options: [...c],
|
|
889
892
|
placeholder: "判斷方式",
|
|
890
893
|
value: D(c, l)
|
|
891
894
|
}),
|
|
892
|
-
|
|
895
|
+
Gn(o, u, (e) => Z(t.target, T(o, l, e)))
|
|
893
896
|
]
|
|
894
897
|
}) : null]
|
|
895
898
|
}), U, !0);
|
|
@@ -897,15 +900,15 @@ function F({ formId: de }) {
|
|
|
897
900
|
function Z(e, t) {
|
|
898
901
|
q({ [e]: t });
|
|
899
902
|
}
|
|
900
|
-
function
|
|
903
|
+
function Gn(e, t, n) {
|
|
901
904
|
if (e.type === "boolean") return /* @__PURE__ */ v(m, {
|
|
902
905
|
clearable: !1,
|
|
903
906
|
onChange: (e) => n(e?.id ?? "true"),
|
|
904
|
-
options: [...
|
|
907
|
+
options: [...kt],
|
|
905
908
|
placeholder: "比較值",
|
|
906
|
-
value: D(
|
|
909
|
+
value: D(kt, t === "false" ? "false" : "true")
|
|
907
910
|
});
|
|
908
|
-
if (
|
|
911
|
+
if (Oe(e)) {
|
|
909
912
|
let r = e.options.map(E);
|
|
910
913
|
return /* @__PURE__ */ v(m, {
|
|
911
914
|
clearable: !1,
|
|
@@ -915,23 +918,23 @@ function F({ formId: de }) {
|
|
|
915
918
|
value: D(r, t)
|
|
916
919
|
});
|
|
917
920
|
}
|
|
918
|
-
return
|
|
921
|
+
return De(e) ? Q(Ae(t), (e) => n(String(e ?? 0)), "比較值") : Ee(e) ? qn(e, t, (e) => n(e ?? "")) : /* @__PURE__ */ v(p, {
|
|
919
922
|
onChange: (e) => n(e.target.value),
|
|
920
923
|
placeholder: "比較值",
|
|
921
924
|
value: t,
|
|
922
925
|
variant: "base"
|
|
923
926
|
});
|
|
924
927
|
}
|
|
925
|
-
function
|
|
926
|
-
return /* @__PURE__ */ v(
|
|
928
|
+
function Kn({ disabled: e, name: t, onChange: n, placeholder: r, rows: i, value: a }) {
|
|
929
|
+
return /* @__PURE__ */ v(ce, {
|
|
927
930
|
"aria-label": t,
|
|
928
931
|
disabled: e,
|
|
929
932
|
onChange: (e) => n(e.target.value),
|
|
930
933
|
placeholder: r,
|
|
931
|
-
ref:
|
|
934
|
+
ref: Dt,
|
|
932
935
|
resize: "vertical",
|
|
933
936
|
rows: i,
|
|
934
|
-
style:
|
|
937
|
+
style: ht,
|
|
935
938
|
value: a
|
|
936
939
|
});
|
|
937
940
|
}
|
|
@@ -939,7 +942,7 @@ function F({ formId: de }) {
|
|
|
939
942
|
return /* @__PURE__ */ v(p, {
|
|
940
943
|
max: r.max,
|
|
941
944
|
min: r.min,
|
|
942
|
-
onChange: (e) => t(
|
|
945
|
+
onChange: (e) => t(xe(Ae(e.target.value), r)),
|
|
943
946
|
placeholder: n,
|
|
944
947
|
showSpinner: !0,
|
|
945
948
|
step: r.step ?? 1,
|
|
@@ -947,30 +950,30 @@ function F({ formId: de }) {
|
|
|
947
950
|
variant: "measure"
|
|
948
951
|
});
|
|
949
952
|
}
|
|
950
|
-
function
|
|
953
|
+
function qn(e, t, n) {
|
|
951
954
|
return e.type === "datetime" ? /* @__PURE__ */ v(te, {
|
|
952
955
|
formatDate: "YYYY-MM-DD",
|
|
953
956
|
formatTime: "HH:mm",
|
|
954
957
|
hideSecond: !0,
|
|
955
|
-
onChange: (e) => n(
|
|
958
|
+
onChange: (e) => n(Te(e)),
|
|
956
959
|
placeholderLeft: "選擇日期",
|
|
957
960
|
placeholderRight: "選擇時間",
|
|
958
|
-
value:
|
|
961
|
+
value: Pe(t)
|
|
959
962
|
}) : /* @__PURE__ */ v(ee, {
|
|
960
963
|
format: "YYYY-MM-DD",
|
|
961
|
-
onChange: (e) => n(
|
|
964
|
+
onChange: (e) => n(we(e)),
|
|
962
965
|
placeholder: "選擇日期",
|
|
963
|
-
value:
|
|
966
|
+
value: Pe(t)
|
|
964
967
|
});
|
|
965
968
|
}
|
|
966
|
-
function
|
|
969
|
+
function Jn(e) {
|
|
967
970
|
return /* @__PURE__ */ y("div", {
|
|
968
|
-
style:
|
|
969
|
-
children: [/* @__PURE__ */ v(
|
|
971
|
+
style: wt,
|
|
972
|
+
children: [/* @__PURE__ */ v(se, {
|
|
970
973
|
actions: {
|
|
971
974
|
render: (t) => [{
|
|
972
975
|
disabled: () => U || e.options.length <= 1,
|
|
973
|
-
icon:
|
|
976
|
+
icon: ve,
|
|
974
977
|
iconType: "icon-only",
|
|
975
978
|
name: "移除選項",
|
|
976
979
|
onClick: () => X({ options: e.options.filter((e, n) => n !== t.index) }),
|
|
@@ -981,7 +984,7 @@ function F({ formId: de }) {
|
|
|
981
984
|
columns: [{
|
|
982
985
|
key: "label",
|
|
983
986
|
render: (t) => /* @__PURE__ */ v(p, {
|
|
984
|
-
onChange: (n) => X({ options:
|
|
987
|
+
onChange: (n) => X({ options: Lt(e.options, t.index, { label: n.target.value }) }),
|
|
985
988
|
placeholder: "例如:主管",
|
|
986
989
|
size: "sub",
|
|
987
990
|
value: t.label,
|
|
@@ -991,7 +994,7 @@ function F({ formId: de }) {
|
|
|
991
994
|
}, {
|
|
992
995
|
key: "value",
|
|
993
996
|
render: (t) => /* @__PURE__ */ v(p, {
|
|
994
|
-
onChange: (n) => X({ options:
|
|
997
|
+
onChange: (n) => X({ options: Lt(e.options, t.index, { value: n.target.value }) }),
|
|
995
998
|
placeholder: "例如:manager",
|
|
996
999
|
size: "sub",
|
|
997
1000
|
value: t.value,
|
|
@@ -1008,36 +1011,36 @@ function F({ formId: de }) {
|
|
|
1008
1011
|
showHeader: !0,
|
|
1009
1012
|
size: "sub"
|
|
1010
1013
|
}), /* @__PURE__ */ v("div", {
|
|
1011
|
-
style:
|
|
1014
|
+
style: Tt,
|
|
1012
1015
|
children: /* @__PURE__ */ v(f, {
|
|
1013
1016
|
disabled: U,
|
|
1014
|
-
icon:
|
|
1017
|
+
icon: ge,
|
|
1015
1018
|
iconType: "leading",
|
|
1016
|
-
onClick: () => X({ options: [...e.options,
|
|
1019
|
+
onClick: () => X({ options: [...e.options, Rt(e.options)] }),
|
|
1017
1020
|
variant: "base-secondary",
|
|
1018
1021
|
children: "新增選項"
|
|
1019
1022
|
})
|
|
1020
1023
|
})]
|
|
1021
1024
|
});
|
|
1022
1025
|
}
|
|
1023
|
-
function
|
|
1026
|
+
function Yn(e, t, n) {
|
|
1024
1027
|
return /* @__PURE__ */ v("div", {
|
|
1025
1028
|
...t.draggableProps,
|
|
1026
1029
|
"data-form-builder-field-key": e.fieldKey,
|
|
1027
1030
|
ref: t.innerRef,
|
|
1028
1031
|
style: {
|
|
1029
|
-
...
|
|
1030
|
-
...n ?
|
|
1032
|
+
...rt,
|
|
1033
|
+
...n ? it : null,
|
|
1031
1034
|
...t.draggableProps.style
|
|
1032
1035
|
},
|
|
1033
|
-
children: /* @__PURE__ */ v(d, { children:
|
|
1036
|
+
children: /* @__PURE__ */ v(d, { children: Xn(e, t, n) })
|
|
1034
1037
|
});
|
|
1035
1038
|
}
|
|
1036
1039
|
function $(e, t, n, i, a = !1) {
|
|
1037
1040
|
return /* @__PURE__ */ v("div", {
|
|
1038
|
-
style: a ?
|
|
1041
|
+
style: a ? pt : ft,
|
|
1039
1042
|
children: /* @__PURE__ */ v("div", {
|
|
1040
|
-
style:
|
|
1043
|
+
style: mt,
|
|
1041
1044
|
children: /* @__PURE__ */ v(r, {
|
|
1042
1045
|
disabled: i,
|
|
1043
1046
|
label: e,
|
|
@@ -1047,32 +1050,32 @@ function F({ formId: de }) {
|
|
|
1047
1050
|
})
|
|
1048
1051
|
});
|
|
1049
1052
|
}
|
|
1050
|
-
function
|
|
1053
|
+
function Xn(e, t, n) {
|
|
1051
1054
|
return /* @__PURE__ */ y("div", {
|
|
1052
1055
|
...t.dragHandleProps ?? {},
|
|
1053
1056
|
"aria-label": "拖曳排序欄位",
|
|
1054
|
-
style:
|
|
1057
|
+
style: $e,
|
|
1055
1058
|
title: "拖曳排序",
|
|
1056
1059
|
children: [
|
|
1057
1060
|
/* @__PURE__ */ v("span", {
|
|
1058
1061
|
"aria-label": "拖曳排序",
|
|
1059
1062
|
role: "img",
|
|
1060
|
-
style:
|
|
1063
|
+
style: St,
|
|
1061
1064
|
title: "拖曳排序",
|
|
1062
1065
|
children: /* @__PURE__ */ v(ne, {
|
|
1063
|
-
icon:
|
|
1066
|
+
icon: pe,
|
|
1064
1067
|
size: 20
|
|
1065
1068
|
})
|
|
1066
1069
|
}),
|
|
1067
1070
|
/* @__PURE__ */ y("div", {
|
|
1068
|
-
style:
|
|
1071
|
+
style: et,
|
|
1069
1072
|
children: [/* @__PURE__ */ y(g, {
|
|
1070
1073
|
component: "span",
|
|
1071
1074
|
ellipsis: !0,
|
|
1072
1075
|
variant: "label-primary",
|
|
1073
1076
|
children: [e.label, e.required ? /* @__PURE__ */ v("sup", {
|
|
1074
1077
|
"aria-label": "必填",
|
|
1075
|
-
style:
|
|
1078
|
+
style: Et,
|
|
1076
1079
|
children: "*"
|
|
1077
1080
|
}) : null]
|
|
1078
1081
|
}), /* @__PURE__ */ y(g, {
|
|
@@ -1081,7 +1084,7 @@ function F({ formId: de }) {
|
|
|
1081
1084
|
ellipsis: !0,
|
|
1082
1085
|
variant: "caption",
|
|
1083
1086
|
children: [
|
|
1084
|
-
|
|
1087
|
+
jt(e.type),
|
|
1085
1088
|
" ·",
|
|
1086
1089
|
e.required ? " 必填" : " 選填",
|
|
1087
1090
|
" ·",
|
|
@@ -1090,15 +1093,15 @@ function F({ formId: de }) {
|
|
|
1090
1093
|
})]
|
|
1091
1094
|
}),
|
|
1092
1095
|
/* @__PURE__ */ y("div", {
|
|
1093
|
-
style:
|
|
1096
|
+
style: tt,
|
|
1094
1097
|
children: [
|
|
1095
1098
|
/* @__PURE__ */ v("div", {
|
|
1096
|
-
style:
|
|
1097
|
-
children: /* @__PURE__ */ v(
|
|
1099
|
+
style: nt,
|
|
1100
|
+
children: /* @__PURE__ */ v(le, {
|
|
1098
1101
|
checked: !!e.required,
|
|
1099
1102
|
disabled: U || n,
|
|
1100
1103
|
label: "必填",
|
|
1101
|
-
onChange: (t) =>
|
|
1104
|
+
onChange: (t) => kn(e.fieldKey, t.target.checked)
|
|
1102
1105
|
})
|
|
1103
1106
|
}),
|
|
1104
1107
|
/* @__PURE__ */ v(f, {
|
|
@@ -1111,9 +1114,9 @@ function F({ formId: de }) {
|
|
|
1111
1114
|
}),
|
|
1112
1115
|
/* @__PURE__ */ v(f, {
|
|
1113
1116
|
disabled: U || n,
|
|
1114
|
-
icon:
|
|
1117
|
+
icon: ve,
|
|
1115
1118
|
iconType: "icon-only",
|
|
1116
|
-
onClick: () =>
|
|
1119
|
+
onClick: () => Sn(e.fieldKey),
|
|
1117
1120
|
variant: "destructive-ghost",
|
|
1118
1121
|
children: "移除欄位"
|
|
1119
1122
|
})
|
|
@@ -1122,7 +1125,7 @@ function F({ formId: de }) {
|
|
|
1122
1125
|
]
|
|
1123
1126
|
});
|
|
1124
1127
|
}
|
|
1125
|
-
function
|
|
1128
|
+
function Zn() {
|
|
1126
1129
|
return /* @__PURE__ */ y("div", {
|
|
1127
1130
|
style: M,
|
|
1128
1131
|
children: [/* @__PURE__ */ v(g, {
|
|
@@ -1130,28 +1133,28 @@ function F({ formId: de }) {
|
|
|
1130
1133
|
variant: "h3",
|
|
1131
1134
|
children: "填寫預覽"
|
|
1132
1135
|
}), /* @__PURE__ */ v(i, {
|
|
1133
|
-
onChange:
|
|
1136
|
+
onChange: On,
|
|
1134
1137
|
schema: w,
|
|
1135
1138
|
uiSchema: k,
|
|
1136
|
-
value:
|
|
1139
|
+
value: zt
|
|
1137
1140
|
})]
|
|
1138
1141
|
});
|
|
1139
1142
|
}
|
|
1140
|
-
function
|
|
1143
|
+
function Qn() {
|
|
1141
1144
|
return /* @__PURE__ */ y("div", {
|
|
1142
1145
|
style: M,
|
|
1143
1146
|
children: [/* @__PURE__ */ v(g, {
|
|
1144
1147
|
component: "h2",
|
|
1145
1148
|
variant: "h3",
|
|
1146
1149
|
children: "版本紀錄"
|
|
1147
|
-
}), /* @__PURE__ */ v(
|
|
1148
|
-
columns:
|
|
1149
|
-
dataSource:
|
|
1150
|
-
loading:
|
|
1150
|
+
}), /* @__PURE__ */ v(se, {
|
|
1151
|
+
columns: on,
|
|
1152
|
+
dataSource: an,
|
|
1153
|
+
loading: en
|
|
1151
1154
|
})]
|
|
1152
1155
|
});
|
|
1153
1156
|
}
|
|
1154
|
-
function
|
|
1157
|
+
function $n() {
|
|
1155
1158
|
return /* @__PURE__ */ y("div", {
|
|
1156
1159
|
style: M,
|
|
1157
1160
|
children: [/* @__PURE__ */ v(g, {
|
|
@@ -1159,39 +1162,39 @@ function F({ formId: de }) {
|
|
|
1159
1162
|
variant: "h3",
|
|
1160
1163
|
children: "Schema"
|
|
1161
1164
|
}), /* @__PURE__ */ y("div", {
|
|
1162
|
-
style:
|
|
1165
|
+
style: gt,
|
|
1163
1166
|
children: [
|
|
1164
|
-
|
|
1167
|
+
er("Form Schema", "schemaJson", /* @__PURE__ */ v(Ge, {
|
|
1165
1168
|
disabled: U,
|
|
1166
1169
|
height: "360px",
|
|
1167
1170
|
name: "schemaJson",
|
|
1168
|
-
onChange:
|
|
1171
|
+
onChange: An,
|
|
1169
1172
|
placeholder: "輸入 Form Schema JSON",
|
|
1170
|
-
value:
|
|
1173
|
+
value: Ue
|
|
1171
1174
|
})),
|
|
1172
|
-
|
|
1175
|
+
er("UI Schema", "uiSchemaJson", /* @__PURE__ */ v(Ge, {
|
|
1173
1176
|
disabled: U,
|
|
1174
1177
|
height: "240px",
|
|
1175
1178
|
name: "uiSchemaJson",
|
|
1176
|
-
onChange:
|
|
1179
|
+
onChange: jn,
|
|
1177
1180
|
placeholder: "輸入 UI Schema JSON",
|
|
1178
|
-
value:
|
|
1181
|
+
value: We
|
|
1179
1182
|
})),
|
|
1180
|
-
|
|
1183
|
+
qt ? /* @__PURE__ */ v(g, {
|
|
1181
1184
|
color: "text-error",
|
|
1182
|
-
style:
|
|
1185
|
+
style: yt,
|
|
1183
1186
|
variant: "body",
|
|
1184
|
-
children:
|
|
1187
|
+
children: qt
|
|
1185
1188
|
}) : null
|
|
1186
1189
|
]
|
|
1187
1190
|
})]
|
|
1188
1191
|
});
|
|
1189
1192
|
}
|
|
1190
|
-
function
|
|
1193
|
+
function er(e, t, n) {
|
|
1191
1194
|
return /* @__PURE__ */ v("div", {
|
|
1192
|
-
style:
|
|
1195
|
+
style: _t,
|
|
1193
1196
|
children: /* @__PURE__ */ v("div", {
|
|
1194
|
-
style:
|
|
1197
|
+
style: vt,
|
|
1195
1198
|
children: /* @__PURE__ */ v(r, {
|
|
1196
1199
|
disabled: U,
|
|
1197
1200
|
label: e,
|
|
@@ -1202,71 +1205,71 @@ function F({ formId: de }) {
|
|
|
1202
1205
|
});
|
|
1203
1206
|
}
|
|
1204
1207
|
}
|
|
1205
|
-
function
|
|
1206
|
-
return
|
|
1208
|
+
function jt(e) {
|
|
1209
|
+
return Ke.find((t) => t.type === e)?.label ?? e;
|
|
1207
1210
|
}
|
|
1208
|
-
function
|
|
1211
|
+
function Mt(e) {
|
|
1209
1212
|
return !!(e.visibleWhen || e.requiredWhen || e.readonlyWhen);
|
|
1210
1213
|
}
|
|
1211
|
-
function
|
|
1214
|
+
function Nt(e) {
|
|
1212
1215
|
return {
|
|
1213
1216
|
id: e.fieldKey,
|
|
1214
1217
|
name: e.label
|
|
1215
1218
|
};
|
|
1216
1219
|
}
|
|
1217
|
-
function
|
|
1220
|
+
function Pt(e) {
|
|
1218
1221
|
return e.type === "text" || e.type === "textarea";
|
|
1219
1222
|
}
|
|
1220
|
-
function
|
|
1223
|
+
function I(e) {
|
|
1221
1224
|
return typeof e == "string" ? e : "";
|
|
1222
1225
|
}
|
|
1223
|
-
function
|
|
1226
|
+
function Ft(e) {
|
|
1224
1227
|
let t = e.split(/[\n,]/u).map((e) => e.trim()).filter(Boolean);
|
|
1225
1228
|
return t.length ? t : void 0;
|
|
1226
1229
|
}
|
|
1227
|
-
function
|
|
1230
|
+
function It(e) {
|
|
1228
1231
|
return e?.join("\n") ?? "";
|
|
1229
1232
|
}
|
|
1230
|
-
function
|
|
1233
|
+
function L(e) {
|
|
1231
1234
|
return JSON.stringify(e, null, 2);
|
|
1232
1235
|
}
|
|
1233
|
-
function
|
|
1236
|
+
function Lt(e, t, n) {
|
|
1234
1237
|
return e.map((e, r) => r === t ? {
|
|
1235
1238
|
...e,
|
|
1236
1239
|
...n
|
|
1237
1240
|
} : e);
|
|
1238
1241
|
}
|
|
1239
|
-
function
|
|
1242
|
+
function Rt(e) {
|
|
1240
1243
|
let t = e.length + 1;
|
|
1241
1244
|
return {
|
|
1242
1245
|
label: `選項 ${t}`,
|
|
1243
|
-
value:
|
|
1246
|
+
value: zt(e, t)
|
|
1244
1247
|
};
|
|
1245
1248
|
}
|
|
1246
|
-
function
|
|
1249
|
+
function zt(e, t) {
|
|
1247
1250
|
let n = `option_${t}`;
|
|
1248
|
-
return e.some((e) => e.value === n) ?
|
|
1251
|
+
return e.some((e) => e.value === n) ? zt(e, t + 1) : n;
|
|
1249
1252
|
}
|
|
1250
|
-
function
|
|
1253
|
+
function Bt(e, t) {
|
|
1251
1254
|
return {
|
|
1252
|
-
schemaJson:
|
|
1253
|
-
uiSchemaJson:
|
|
1255
|
+
schemaJson: L(e),
|
|
1256
|
+
uiSchemaJson: L(t)
|
|
1254
1257
|
};
|
|
1255
1258
|
}
|
|
1256
|
-
function
|
|
1259
|
+
function Vt(e, t) {
|
|
1257
1260
|
return (t ? e.find((e) => e.id === t) : null) ?? e.find((e) => e.status === "PUBLISHED") ?? null;
|
|
1258
1261
|
}
|
|
1259
|
-
function
|
|
1260
|
-
return `${e ? "有未儲存修改" : "沒有未儲存修改"} · ${
|
|
1262
|
+
function Ht({ hasUnsavedChanges: e, latestPublishedVersion: n, openedContentPublished: r, openedVersion: i }) {
|
|
1263
|
+
return `${e ? "有未儲存修改" : "沒有未儲存修改"} · ${Ut({
|
|
1261
1264
|
hasUnsavedChanges: e,
|
|
1262
1265
|
openedContentPublished: r,
|
|
1263
1266
|
openedVersion: i
|
|
1264
1267
|
})} · ${n ? `目前發布 v${n.version}:${t(n.publishedAt)}` : "目前沒有已發布版本"}`;
|
|
1265
1268
|
}
|
|
1266
|
-
function
|
|
1269
|
+
function Ut({ hasUnsavedChanges: e, openedContentPublished: t, openedVersion: n }) {
|
|
1267
1270
|
return e ? n ? `修改尚未發布,來源 v${n.version}` : "修改尚未發布" : t && n ? `當前內容已發布 v${n.version}` : n ? `當前內容尚未發布 v${n.version}` : "當前內容尚未發布";
|
|
1268
1271
|
}
|
|
1269
|
-
function
|
|
1272
|
+
function Wt(e, t, n) {
|
|
1270
1273
|
let r = e[t];
|
|
1271
1274
|
if (!r || t === n) return [...e];
|
|
1272
1275
|
let i = e.filter((e, n) => n !== t);
|
|
@@ -1276,7 +1279,7 @@ function Kt(e, t, n) {
|
|
|
1276
1279
|
...i.slice(n)
|
|
1277
1280
|
];
|
|
1278
1281
|
}
|
|
1279
|
-
function
|
|
1282
|
+
function Gt({ status: e }) {
|
|
1280
1283
|
return e === "PUBLISHED" ? /* @__PURE__ */ v(u, {
|
|
1281
1284
|
size: "sub",
|
|
1282
1285
|
text: "已發布",
|
|
@@ -1291,10 +1294,10 @@ function qt({ status: e }) {
|
|
|
1291
1294
|
variant: "dot-warning"
|
|
1292
1295
|
});
|
|
1293
1296
|
}
|
|
1294
|
-
function
|
|
1297
|
+
function Kt(e) {
|
|
1295
1298
|
return e instanceof Error ? e.message : "發生未知錯誤";
|
|
1296
1299
|
}
|
|
1297
1300
|
//#endregion
|
|
1298
1301
|
export { F as t };
|
|
1299
1302
|
|
|
1300
|
-
//# sourceMappingURL=builder-
|
|
1303
|
+
//# sourceMappingURL=builder-DqZskyXC.js.map
|