@chobantonov/jsonforms-react-antd-extended-renderers 0.0.0-stage → 0.1.0

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.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +46 -2
  3. package/lib/cells/asCell.d.ts +32 -0
  4. package/lib/components/AntdArrayFrame.d.ts +8 -0
  5. package/lib/components/AntdEditorButton.d.ts +10 -0
  6. package/lib/components/AntdEditorFrame.d.ts +3 -0
  7. package/lib/components/AntdEditorLoading.d.ts +8 -0
  8. package/lib/components/AntdEditorSurface.d.ts +7 -0
  9. package/lib/components/AntdMaskInput.d.ts +40 -0
  10. package/lib/components/PickerFormItem.d.ts +6 -0
  11. package/lib/hooks/useAntdEditorTheme.d.ts +8 -0
  12. package/lib/index.d.ts +45 -0
  13. package/lib/jsonforms-react-antd-extended.cjs.js +2 -0
  14. package/lib/jsonforms-react-antd-extended.cjs.js.map +1 -0
  15. package/lib/jsonforms-react-antd-extended.esm.js +906 -0
  16. package/lib/jsonforms-react-antd-extended.esm.js.map +1 -0
  17. package/lib/renderers/AntdAgGridControlRenderer.d.ts +2 -0
  18. package/lib/renderers/AntdButtonRenderer.d.ts +3 -0
  19. package/lib/renderers/AntdColorControlRenderer.d.ts +30 -0
  20. package/lib/renderers/AntdCronControlRenderer.d.ts +43 -0
  21. package/lib/renderers/AntdDurationControlRenderer.d.ts +5 -0
  22. package/lib/renderers/AntdMarkupLabelRenderer.d.ts +18 -0
  23. package/lib/renderers/AntdMaskControlRenderer.d.ts +9 -0
  24. package/lib/renderers/AntdMonacoControlRenderer.d.ts +1 -0
  25. package/lib/renderers/AntdNullControlRenderer.d.ts +5 -0
  26. package/lib/renderers/AntdSplitLayoutRenderer.d.ts +6 -0
  27. package/lib/renderers/index.d.ts +8 -0
  28. package/lib/util/colorFormat.d.ts +11 -0
  29. package/package.json +78 -3
  30. package/src/cells/asCell.tsx +47 -0
  31. package/src/components/AntdArrayFrame.tsx +69 -0
  32. package/src/components/AntdEditorButton.tsx +37 -0
  33. package/src/components/AntdEditorFrame.tsx +16 -0
  34. package/src/components/AntdEditorLoading.tsx +13 -0
  35. package/src/components/AntdEditorSurface.tsx +52 -0
  36. package/src/components/AntdMaskInput.tsx +95 -0
  37. package/src/components/PickerFormItem.tsx +23 -0
  38. package/src/hooks/useAntdEditorTheme.ts +63 -0
  39. package/src/index.tsx +166 -0
  40. package/src/renderers/AntdAgGridControlRenderer.tsx +56 -0
  41. package/src/renderers/AntdButtonRenderer.tsx +49 -0
  42. package/src/renderers/AntdColorControlRenderer.tsx +313 -0
  43. package/src/renderers/AntdCronControlRenderer.tsx +393 -0
  44. package/src/renderers/AntdDurationControlRenderer.tsx +274 -0
  45. package/src/renderers/AntdMarkupLabelRenderer.tsx +27 -0
  46. package/src/renderers/AntdMaskControlRenderer.tsx +19 -0
  47. package/src/renderers/AntdMonacoControlRenderer.tsx +21 -0
  48. package/src/renderers/AntdNullControlRenderer.tsx +70 -0
  49. package/src/renderers/AntdSplitLayoutRenderer.tsx +122 -0
  50. package/src/renderers/index.ts +8 -0
  51. package/src/util/colorFormat.ts +42 -0
@@ -0,0 +1,906 @@
1
+ import { CRON_FIELDS as e, DEFAULT_CRON as t, FIELD_RANGE as n, buttonRendererTester as r, createAgGridControlRenderer as i, createButtonRenderer as a, createExtendedRenderers as o, createMarkupLabelRenderer as s, createMonacoControlRenderer as c, durationComponentFields as l, durationFieldMax as u, extendedAgGridTester as d, extendedColorTester as f, extendedMaskTester as p, formatField as m, initialSplitSizes as h, labelFor as g, markupLabelTester as _, monacoControlTester as v, parseField as y, resolveExtendedOption as ee, splitCssSize as b, useCronPicker as te, useDurationControl as x, useExtendedTranslator as S } from "@chobantonov/jsonforms-react-extended-renderers";
2
+ import { createDeleteConfirmation as C } from "@chobantonov/jsonforms-react-renderer-common/interaction/createDeleteConfirmation";
3
+ import w, { useCallback as T, useRef as E, useState as ne } from "react";
4
+ import { AntdClearableInput as D, ArrayPanel as re, ConnectedCellFrame as ie, ControlFormItem as O, InputControl as ae, RowDetailFrame as oe, ValidationIcon as se, useClearAffordance as ce, useConfirmation as le, useI18n as ue, usePreTouchErrors as k } from "@chobantonov/jsonforms-react-antd-renderers";
5
+ import { DeleteOutlined as de, EditOutlined as fe, EyeInvisibleOutlined as pe, EyeOutlined as me, FullscreenExitOutlined as he, FullscreenOutlined as ge, PlusOutlined as _e } from "@ant-design/icons";
6
+ import { Alert as ve, Button as A, Card as ye, Checkbox as be, Col as xe, ColorPicker as Se, Flex as j, Input as M, InputNumber as Ce, Popover as we, Row as Te, Segmented as Ee, Select as De, Skeleton as Oe, Space as N, Splitter as ke, Tooltip as Ae, Typography as P, theme as F } from "antd";
7
+ import { Fragment as je, jsx as I, jsxs as L } from "react/jsx-runtime";
8
+ import { JsonFormsDispatch as Me, withJsonFormsControlProps as R, withJsonFormsLayoutProps as Ne } from "@jsonforms/react";
9
+ import { COLOR_SAVE_FORMATS as Pe, DEFAULT_COLOR_SAVE_FORMAT as Fe, asColorSaveFormat as Ie, hsbToRgb as Le, hslToRgb as Re, isColor as ze, isTransparent as Be, normalizeHue as Ve, parseColor as He, placeholderKeyFor as Ue, rgbToHsb as We, serializeColor as z, toCssColor as Ge } from "@chobantonov/jsonforms-react-renderer-common/formats/colorFormat";
10
+ import Ke from "@ant-design/icons/ScheduleOutlined";
11
+ import { and as B, formatIs as qe, isStringControl as Je, optionIs as Ye, or as Xe, rankWith as V, schemaMatches as Ze, uiTypeIs as H } from "@jsonforms/core";
12
+ import Qe from "@ant-design/icons/ClockCircleOutlined";
13
+ import $e from "@ant-design/icons/CloseOutlined";
14
+ import { useMaskedInput as et } from "@chobantonov/jsonforms-react-renderer-common/formats/useMaskedInput";
15
+ import { useEffectiveElements as tt } from "@chobantonov/jsonforms-react-renderer-common/layout/layoutContext";
16
+ import { EMPTY_DURATION as nt, formatDuration as rt, parseDuration as it } from "@chobantonov/jsonforms-react-renderer-common/formats/duration";
17
+ import { DEFAULT_MASK_SETTINGS as at, DEFAULT_MASK_TOKENS as ot, MASKA_DEFAULT_TOKENS as st, codePointLength as ct, compileTokenPattern as lt, createMask as ut, displayValue as dt, fitsMask as ft, maskEdit as pt, nextCaret as mt, resolveMaskSettings as ht, storedValue as gt, toMaskTokens as _t, withinMaxLength as vt } from "@chobantonov/jsonforms-react-renderer-common/formats/maskFormat";
18
+ export * from "@chobantonov/jsonforms-react-extended-renderers";
19
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/objectWithoutPropertiesLoose.js
20
+ function yt(e, t) {
21
+ if (e == null) return {};
22
+ var n = {};
23
+ for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
24
+ if (t.includes(r)) continue;
25
+ n[r] = e[r];
26
+ }
27
+ return n;
28
+ }
29
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/objectWithoutProperties.js
30
+ function U(e, t) {
31
+ if (e == null) return {};
32
+ var n, r, i = yt(e, t);
33
+ if (Object.getOwnPropertySymbols) {
34
+ var a = Object.getOwnPropertySymbols(e);
35
+ for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
36
+ }
37
+ return i;
38
+ }
39
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/typeof.js
40
+ function W(e) {
41
+ "@babel/helpers - typeof";
42
+ return W = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
43
+ return typeof e;
44
+ } : function(e) {
45
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
46
+ }, W(e);
47
+ }
48
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPrimitive.js
49
+ function bt(e, t) {
50
+ if (W(e) != "object" || !e) return e;
51
+ var n = e[Symbol.toPrimitive];
52
+ if (n !== void 0) {
53
+ var r = n.call(e, t || "default");
54
+ if (W(r) != "object") return r;
55
+ throw TypeError("@@toPrimitive must return a primitive value.");
56
+ }
57
+ return (t === "string" ? String : Number)(e);
58
+ }
59
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/toPropertyKey.js
60
+ function xt(e) {
61
+ var t = bt(e, "string");
62
+ return W(t) == "symbol" ? t : t + "";
63
+ }
64
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/defineProperty.js
65
+ function St(e, t, n) {
66
+ return (t = xt(t)) in e ? Object.defineProperty(e, t, {
67
+ value: n,
68
+ enumerable: !0,
69
+ configurable: !0,
70
+ writable: !0
71
+ }) : e[t] = n, e;
72
+ }
73
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/objectSpread2.js
74
+ function Ct(e, t) {
75
+ var n = Object.keys(e);
76
+ if (Object.getOwnPropertySymbols) {
77
+ var r = Object.getOwnPropertySymbols(e);
78
+ t && (r = r.filter(function(t) {
79
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
80
+ })), n.push.apply(n, r);
81
+ }
82
+ return n;
83
+ }
84
+ function G(e) {
85
+ for (var t = 1; t < arguments.length; t++) {
86
+ var n = arguments[t] == null ? {} : arguments[t];
87
+ t % 2 ? Ct(Object(n), !0).forEach(function(t) {
88
+ St(e, t, n[t]);
89
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Ct(Object(n)).forEach(function(t) {
90
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
91
+ });
92
+ }
93
+ return e;
94
+ }
95
+ // src/components/AntdEditorButton.tsx
96
+ var wt = [
97
+ "variant",
98
+ "icon",
99
+ "children"
100
+ ], Tt = [
101
+ "icon",
102
+ "children",
103
+ "variant"
104
+ ], Et = (e) => {
105
+ let { variant: t, icon: n, children: r } = e, i = U(e, wt);
106
+ return /* @__PURE__ */ I(A, G(G({}, i), {}, {
107
+ icon: n,
108
+ type: t === "primary" ? "primary" : "default",
109
+ danger: t === "danger",
110
+ children: r
111
+ }));
112
+ }, Dt = (e) => {
113
+ let { icon: t, children: n, variant: r } = e, i = U(e, Tt);
114
+ return /* @__PURE__ */ I(A, G(G({}, i), {}, {
115
+ icon: t,
116
+ type: "text",
117
+ size: "small",
118
+ children: n
119
+ }));
120
+ }, { Title: Ot } = P, kt = ({ options: e, config: t, label: n, description: r, errors: i, actions: a = [], children: o }) => /* @__PURE__ */ I(re, {
121
+ options: e,
122
+ config: t,
123
+ panelLabel: n,
124
+ style: { width: "100%" },
125
+ size: "small",
126
+ type: "inner",
127
+ title: /* @__PURE__ */ L(je, { children: [/* @__PURE__ */ L(Te, {
128
+ align: "middle",
129
+ children: [/* @__PURE__ */ I(xe, { children: /* @__PURE__ */ I(Ot, {
130
+ level: 5,
131
+ style: { marginBottom: 0 },
132
+ children: n
133
+ }) }), /* @__PURE__ */ I(xe, {
134
+ style: { paddingLeft: 8 },
135
+ children: /* @__PURE__ */ I(se, {
136
+ local: !0,
137
+ id: "tooltip-validation",
138
+ errorMessages: i == null ? "" : i
139
+ })
140
+ })]
141
+ }), r && /* @__PURE__ */ I(ye.Meta, { description: r })] }),
142
+ extra: a.map((e) => /* @__PURE__ */ I(Ae, {
143
+ title: e.label,
144
+ placement: "bottom",
145
+ children: /* @__PURE__ */ I("span", {
146
+ style: { display: "inline-flex" },
147
+ children: /* @__PURE__ */ I(A, {
148
+ disabled: e.disabled,
149
+ danger: e.danger,
150
+ "aria-label": e.label,
151
+ onClick: e.onClick,
152
+ shape: "circle",
153
+ icon: e.icon
154
+ })
155
+ })
156
+ }, e.key)),
157
+ children: o
158
+ }), At = ["children"], jt = (e) => {
159
+ let { children: t } = e, n = U(e, At);
160
+ return /* @__PURE__ */ I(O, {
161
+ label: n.label,
162
+ required: n.required,
163
+ errors: n.errors || void 0,
164
+ help: n.errors || n.description,
165
+ children: t
166
+ });
167
+ }, Mt = ({ label: e }) => /* @__PURE__ */ I(Oe.Node, {
168
+ active: !0,
169
+ style: {
170
+ width: "100%",
171
+ height: 120
172
+ },
173
+ children: /* @__PURE__ */ I("span", {
174
+ style: { fontSize: 12 },
175
+ children: e
176
+ })
177
+ }), Nt = ({ label: e }) => /* @__PURE__ */ I(ve, {
178
+ type: "error",
179
+ showIcon: !0,
180
+ message: e
181
+ }), Pt = () => {
182
+ var e, t, n;
183
+ let { token: r } = F.useToken();
184
+ return {
185
+ isDark: It(Ft(r.colorBgBase, r.colorBgContainer)),
186
+ background: r.colorBgContainer,
187
+ foreground: r.colorText,
188
+ border: (e = r.colorBorderSecondary) == null ? r.colorBorder : e,
189
+ accent: r.colorPrimary,
190
+ headerBackground: (t = r.colorFillAlter) == null ? r.colorFillQuaternary : t,
191
+ headerForeground: (n = r.colorTextHeading) == null ? r.colorText : n,
192
+ rowHover: r.controlItemBgHover,
193
+ selectedRowBackground: r.controlItemBgActive,
194
+ fontFamily: r.fontFamily
195
+ };
196
+ }, Ft = (...e) => e.find((e) => typeof e == "string" && e.trim() !== ""), It = (e) => {
197
+ var t;
198
+ if (typeof e != "string") return;
199
+ let n = e.startsWith("#") ? Lt(e) : (t = e.match(/[\d.]+/g)) == null ? void 0 : t.map(Number).slice(0, 3);
200
+ if (!(!n || n.length < 3)) return n[0] * .299 + n[1] * .587 + n[2] * .114 < 128;
201
+ }, Lt = (e) => {
202
+ let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
203
+ if (!(n.length < 6)) return [
204
+ parseInt(n.slice(0, 2), 16),
205
+ parseInt(n.slice(2, 4), 16),
206
+ parseInt(n.slice(4, 6), 16)
207
+ ];
208
+ }, Rt = C(le, "agGrid"), zt = i({
209
+ RowErrorIndicator: ({ message: e }) => /* @__PURE__ */ I(se, {
210
+ errorMessages: e,
211
+ id: w.useId()
212
+ }),
213
+ Frame: jt,
214
+ RowDetailFrame: oe,
215
+ EditIcon: fe,
216
+ ShowDetailsIcon: me,
217
+ HideDetailsIcon: pe,
218
+ ArrayFrame: kt,
219
+ CellFrame: ie,
220
+ Button: Et,
221
+ AddIcon: _e,
222
+ RemoveIcon: de,
223
+ useEditorTheme: Pt,
224
+ Loading: Mt,
225
+ LoadError: Nt,
226
+ useRemoveConfirmation: Rt
227
+ }), Bt = c({
228
+ Frame: jt,
229
+ Button: Dt,
230
+ MaximizeIcon: ge,
231
+ MinimizeIcon: he,
232
+ Surface: ({ children: e, hovered: t, focused: n, disabled: r, invalid: i, maximized: a }) => {
233
+ let { token: o } = F.useToken(), s = i ? n || t ? o.colorErrorBorderHover : o.colorError : r ? o.colorBorder : n ? o.colorPrimary : t ? o.colorPrimaryHover : o.colorBorder;
234
+ return /* @__PURE__ */ I("div", {
235
+ style: {
236
+ position: "relative",
237
+ height: a ? "100%" : void 0,
238
+ overflow: "hidden",
239
+ boxSizing: "border-box",
240
+ border: `${o.lineWidth}px ${o.lineType} ${s}`,
241
+ borderRadius: o.borderRadius,
242
+ background: r ? o.colorBgContainerDisabled : o.colorBgContainer,
243
+ boxShadow: n ? `0 0 0 ${o.controlOutlineWidth}px ${i ? o.colorErrorOutline : o.controlOutline}` : void 0,
244
+ transition: `border-color ${o.motionDurationMid}, box-shadow ${o.motionDurationMid}`
245
+ },
246
+ children: e
247
+ });
248
+ },
249
+ useEditorTheme: Pt,
250
+ Loading: Mt,
251
+ LoadError: Nt
252
+ }), Vt = r, Ht = {
253
+ primary: { type: "primary" },
254
+ secondary: { type: "default" },
255
+ alternative: { type: "dashed" },
256
+ success: { type: "primary" },
257
+ warning: {
258
+ type: "default",
259
+ danger: !0
260
+ },
261
+ error: {
262
+ type: "primary",
263
+ danger: !0
264
+ }
265
+ }, Ut = a({
266
+ ButtonComponent: A,
267
+ buttonProps: {
268
+ htmlType: "button",
269
+ type: "primary"
270
+ },
271
+ getButtonProps: ({ pending: e, color: t, uischema: n }) => {
272
+ var r, i;
273
+ return G({
274
+ loading: e,
275
+ block: ((r = n.options) == null ? void 0 : r.fullWidth) === !0
276
+ }, t ? (i = Ht[t]) == null ? {} : i : {});
277
+ }
278
+ }), Wt = (e) => {
279
+ switch (e) {
280
+ case "rgb": return "rgb";
281
+ case "hsb": return "hsb";
282
+ default: return "hex";
283
+ }
284
+ }, K = f, Gt = (e) => {
285
+ let { r: t, g: n, b: r, a: i } = e.toRgb();
286
+ return {
287
+ r: t,
288
+ g: n,
289
+ b: r,
290
+ a: typeof i == "number" ? i : 1
291
+ };
292
+ }, Kt = (e) => {
293
+ var t;
294
+ let { token: n } = F.useToken(), r = ue(), { errors: i, onBlur: a } = k({
295
+ errors: e.errors,
296
+ path: e.path,
297
+ schema: e.schema,
298
+ uischema: e.uischema,
299
+ config: e.config
300
+ }), o = S(), s = typeof e.data == "string" ? e.data : void 0, [c, l] = ne(!1), [u, d] = ne(), { allowClear: f, affordanceProps: p } = ce(!!s), m = e.uischema.options, h = G(G({}, e.config), m), g = h.clearable !== !1, _ = !e.enabled || !!e.readonly, v = Ie(ee(m, e.config, "colorSaveFormat", Fe)), y = ee(m, e.config, "colorTextEntry", !0) !== !1;
301
+ if (!e.visible) return null;
302
+ let b = (t) => {
303
+ l(!1), e.handleChange(e.path, t || void 0);
304
+ }, te = (e) => {
305
+ if (e.cleared) {
306
+ b(void 0);
307
+ return;
308
+ }
309
+ let t = z(Gt(e), v);
310
+ t === void 0 ? l(!0) : b(t);
311
+ }, x = () => {
312
+ let t = He(s);
313
+ if (!t) return;
314
+ let n = z(t, v);
315
+ n === void 0 ? l(!0) : (l(!1), n !== s && e.handleChange(e.path, n));
316
+ }, C = c ? o("color.hex3Transparency") : void 0, w = Ge(s), T = (t) => /* @__PURE__ */ I("span", { style: {
317
+ display: "block",
318
+ width: t,
319
+ height: t,
320
+ borderRadius: n.borderRadiusSM,
321
+ border: `1px solid ${n.colorBorder}`,
322
+ background: w == null ? "transparent" : w,
323
+ cursor: e.enabled ? "pointer" : "not-allowed"
324
+ } }), E = Wt(v), D = (e) => /* @__PURE__ */ I(Se, {
325
+ disabled: _,
326
+ value: w == null ? null : w,
327
+ format: u == null ? E : u,
328
+ onFormatChange: d,
329
+ onOpenChange: (e) => {
330
+ e && d(E);
331
+ },
332
+ panelRender: (e) => /* @__PURE__ */ L("div", { children: [e, g && s !== void 0 && s !== "" && /* @__PURE__ */ I(A, {
333
+ block: !0,
334
+ type: "text",
335
+ disabled: _,
336
+ "data-color-panel-clear": "",
337
+ onClick: () => b(void 0),
338
+ children: r("control.clearValue")
339
+ })] }),
340
+ onChangeComplete: te,
341
+ children: e
342
+ });
343
+ return /* @__PURE__ */ I(O, {
344
+ adornmentSchema: e.schema,
345
+ adornmentOptions: e.uischema.options,
346
+ id: e.id,
347
+ label: e.label,
348
+ required: e.required,
349
+ errors: i || void 0,
350
+ help: i || (C ? /* @__PURE__ */ I("span", {
351
+ role: "alert",
352
+ "data-color-guidance": !0,
353
+ children: C
354
+ }) : e.description),
355
+ children: y ? /* @__PURE__ */ I(M, G(G({ allowClear: g && f }, p), {}, {
356
+ onBlur: () => {
357
+ p.onBlur(), a(), x();
358
+ },
359
+ styles: { prefix: {
360
+ lineHeight: 0,
361
+ display: "flex",
362
+ alignItems: "center"
363
+ } },
364
+ disabled: _,
365
+ placeholder: (t = h.placeholder) == null ? o(Ue(v)) : t,
366
+ autoFocus: h.focus === !0,
367
+ status: i ? "error" : c ? "warning" : void 0,
368
+ value: s == null ? "" : s,
369
+ onChange: (e) => b(e.currentTarget.value),
370
+ prefix: D(/* @__PURE__ */ I("span", {
371
+ role: "button",
372
+ "aria-label": o("editor.chooseColor"),
373
+ children: T(14)
374
+ }))
375
+ })) : D(/* @__PURE__ */ L("button", {
376
+ type: "button",
377
+ disabled: _,
378
+ "aria-label": o("editor.chooseColor"),
379
+ autoFocus: h.focus === !0,
380
+ "data-color-trigger": !0,
381
+ style: {
382
+ display: "inline-flex",
383
+ alignItems: "center",
384
+ gap: n.paddingXS,
385
+ padding: `${n.paddingXXS}px ${n.paddingXS}px`,
386
+ borderRadius: n.borderRadius,
387
+ border: `1px solid ${i ? n.colorError : n.colorBorder}`,
388
+ background: n.colorBgContainer,
389
+ color: n.colorText,
390
+ font: "inherit",
391
+ cursor: e.enabled ? "pointer" : "not-allowed"
392
+ },
393
+ children: [T(16), /* @__PURE__ */ I("span", { children: s == null ? "" : s })]
394
+ }))
395
+ });
396
+ }, q = R(Kt);
397
+ // src/components/PickerFormItem.tsx
398
+ function qt({ props: e, error: t, children: n }) {
399
+ return /* @__PURE__ */ I(O, {
400
+ adornmentSchema: e.schema,
401
+ adornmentOptions: e.uischema.options,
402
+ id: e.id,
403
+ required: e.required,
404
+ errors: t || void 0,
405
+ label: e.label,
406
+ help: t || e.description,
407
+ children: n
408
+ });
409
+ }
410
+ // src/renderers/AntdCronControlRenderer.tsx
411
+ var J = V(3, B(Je, Xe(qe("cron"), B(H("Control"), Ye("format", "cron"))))), Jt = [
412
+ "year",
413
+ "month",
414
+ "week",
415
+ "day",
416
+ "hour",
417
+ "minute",
418
+ "second"
419
+ ], Y = 15, Yt = ({ field: e, text: t, disabled: r, label: i, onChange: a }) => {
420
+ let o = i(`cron.${e}`), s = y(t, e), [c, l] = n[e], u = /* @__PURE__ */ I(N.Addon, {
421
+ disabled: r,
422
+ style: {
423
+ width: `${Y}ch`,
424
+ justifyContent: "flex-start"
425
+ },
426
+ children: o
427
+ });
428
+ if (s === void 0) return /* @__PURE__ */ I(D, {
429
+ data: t,
430
+ enabled: !r,
431
+ onClear: () => a(""),
432
+ children: (e) => /* @__PURE__ */ L(N.Compact, {
433
+ block: !0,
434
+ children: [u, /* @__PURE__ */ I(M, {
435
+ style: {
436
+ flex: 1,
437
+ minWidth: 0
438
+ },
439
+ disabled: r,
440
+ value: t,
441
+ "aria-label": o,
442
+ suffix: e,
443
+ onChange: (e) => a(e.currentTarget.value)
444
+ })]
445
+ })
446
+ });
447
+ let d = s.length === l - c + 1 ? [] : s;
448
+ return /* @__PURE__ */ L(N.Compact, {
449
+ block: !0,
450
+ children: [u, /* @__PURE__ */ I(De, {
451
+ style: {
452
+ flex: 1,
453
+ minWidth: 0
454
+ },
455
+ mode: "multiple",
456
+ disabled: r,
457
+ value: d,
458
+ placeholder: i("cron.every"),
459
+ "aria-label": o,
460
+ maxTagCount: "responsive",
461
+ allowClear: !0,
462
+ options: Array.from({ length: l - c + 1 }, (t, n) => ({
463
+ value: c + n,
464
+ label: g(c + n, e)
465
+ })),
466
+ onChange: (t) => a(m(t, e))
467
+ })]
468
+ });
469
+ }, Xt = (n) => {
470
+ let { token: r } = F.useToken(), { label: i, expression: a, open: o, setOpen: s, text: c, period: l, options: u, showActions: d, disabled: f, localError: p, draft: m, changeField: h, changeText: g, changePeriod: _, editedProblem: v, shownFields: y, hasCustomField: ee, openOn: b, accept: x } = te(n), { errors: S, onBlur: C } = k({
471
+ errors: n.errors,
472
+ path: n.path,
473
+ schema: n.schema,
474
+ uischema: n.uischema,
475
+ config: n.config
476
+ });
477
+ if (!n.visible) return null;
478
+ let w = /* @__PURE__ */ L(j, {
479
+ vertical: !0,
480
+ gap: "small",
481
+ style: { width: 340 },
482
+ children: [
483
+ /* @__PURE__ */ L(N.Compact, {
484
+ block: !0,
485
+ children: [/* @__PURE__ */ I(N.Addon, {
486
+ disabled: f,
487
+ style: {
488
+ width: `${Y}ch`,
489
+ justifyContent: "flex-start"
490
+ },
491
+ children: i("cron.repeats")
492
+ }), /* @__PURE__ */ I(De, {
493
+ style: {
494
+ flex: 1,
495
+ minWidth: 0
496
+ },
497
+ disabled: f,
498
+ value: l,
499
+ placeholder: i("cron.chooseRepeats"),
500
+ "aria-label": i("cron.repeats"),
501
+ options: Jt.map((e) => ({
502
+ value: e,
503
+ label: i(`cron.period.${e}`)
504
+ })),
505
+ onChange: (e) => _(e)
506
+ })]
507
+ }),
508
+ y.map((t) => {
509
+ var n;
510
+ return /* @__PURE__ */ I(Yt, {
511
+ field: t,
512
+ text: (n = m[e.indexOf(t)]) == null ? "*" : n,
513
+ disabled: f,
514
+ label: i,
515
+ onChange: (e) => h(t, e)
516
+ }, t);
517
+ }),
518
+ ee && /* @__PURE__ */ I(P.Text, {
519
+ type: "secondary",
520
+ style: { fontSize: r.fontSizeSM },
521
+ children: i("cron.advanced")
522
+ }),
523
+ /* @__PURE__ */ I(D, {
524
+ data: c,
525
+ enabled: !f,
526
+ onClear: () => g(""),
527
+ children: (e) => /* @__PURE__ */ L(N.Compact, {
528
+ block: !0,
529
+ children: [/* @__PURE__ */ I(N.Addon, {
530
+ disabled: f,
531
+ style: {
532
+ width: `${Y}ch`,
533
+ justifyContent: "flex-start"
534
+ },
535
+ children: i("cron.expression")
536
+ }), /* @__PURE__ */ I(M, {
537
+ style: {
538
+ flex: 1,
539
+ minWidth: 0
540
+ },
541
+ disabled: f,
542
+ value: c,
543
+ placeholder: t,
544
+ status: v ? "error" : void 0,
545
+ "aria-label": i("cron.expression"),
546
+ suffix: e,
547
+ onChange: (e) => g(e.currentTarget.value)
548
+ })]
549
+ })
550
+ }),
551
+ d && /* @__PURE__ */ L(j, {
552
+ justify: "end",
553
+ gap: "small",
554
+ children: [/* @__PURE__ */ I(A, {
555
+ onClick: () => s(!1),
556
+ children: i("cron.cancel")
557
+ }), /* @__PURE__ */ I(A, {
558
+ type: "primary",
559
+ disabled: f || !!v,
560
+ onClick: x,
561
+ children: i("cron.ok")
562
+ })]
563
+ })
564
+ ]
565
+ });
566
+ return /* @__PURE__ */ I(qt, {
567
+ props: n,
568
+ error: p || S,
569
+ children: /* @__PURE__ */ I(D, {
570
+ clearable: u.clearable !== !1,
571
+ data: n.data,
572
+ enabled: !f,
573
+ onClear: () => n.handleChange(n.path, void 0),
574
+ children: (e) => {
575
+ var s;
576
+ return /* @__PURE__ */ I(M, {
577
+ id: n.id,
578
+ disabled: f,
579
+ value: a,
580
+ placeholder: (s = u.placeholder) == null ? t : s,
581
+ autoFocus: u.focus,
582
+ status: p || S ? "error" : void 0,
583
+ onChange: (e) => n.handleChange(n.path, e.currentTarget.value || void 0),
584
+ onBlur: C,
585
+ styles: { prefix: {
586
+ lineHeight: 0,
587
+ display: "flex",
588
+ alignItems: "center"
589
+ } },
590
+ suffix: e,
591
+ prefix: /* @__PURE__ */ I(we, {
592
+ content: w,
593
+ open: o,
594
+ placement: "bottomLeft",
595
+ trigger: "click",
596
+ onOpenChange: b,
597
+ children: /* @__PURE__ */ I(Ke, {
598
+ role: "button",
599
+ "aria-label": i("cron.choose"),
600
+ style: {
601
+ cursor: f ? "not-allowed" : "pointer",
602
+ color: r.colorTextTertiary
603
+ }
604
+ })
605
+ })
606
+ });
607
+ }
608
+ })
609
+ });
610
+ }, X = R(Xt), Z = V(3, B(Je, qe("duration"))), Q = {
611
+ weeks: "duration.weeks",
612
+ years: "duration.years",
613
+ months: "duration.months",
614
+ days: "duration.days",
615
+ hours: "duration.hours",
616
+ minutes: "duration.minutes",
617
+ seconds: "duration.seconds"
618
+ }, Zt = (e) => {
619
+ var t, n, r;
620
+ let { token: i } = F.useToken(), { errors: a, onBlur: o } = k({
621
+ errors: e.errors,
622
+ path: e.path,
623
+ schema: e.schema,
624
+ uischema: e.uischema,
625
+ config: e.config
626
+ }), s = S(), c = ue(), d = x(e), { open: f, draft: p } = d, { allowClear: m, affordanceProps: h } = ce(!!d.value);
627
+ if (!e.visible) return null;
628
+ let g = d.value, _ = d.error, v = Math.max(...(d.mode === "weeks" ? ["weeks"] : l).map((e) => c(Q[e]).length)) + 2, y = /* @__PURE__ */ L(j, {
629
+ vertical: !0,
630
+ gap: "small",
631
+ style: { width: 300 },
632
+ children: [
633
+ /* @__PURE__ */ I(Ee, {
634
+ block: !0,
635
+ size: "small",
636
+ disabled: d.disabled,
637
+ value: d.mode,
638
+ onChange: (e) => d.setMode(e),
639
+ options: [{
640
+ value: "components",
641
+ label: c("duration.modeComponents")
642
+ }, {
643
+ value: "weeks",
644
+ label: c("duration.modeWeeks")
645
+ }]
646
+ }),
647
+ d.activeFields.map((e) => /* @__PURE__ */ L("div", {
648
+ style: {
649
+ display: "grid",
650
+ gridTemplateColumns: `1fr ${i.controlHeight}px`,
651
+ alignItems: "center",
652
+ columnGap: i.paddingXXS
653
+ },
654
+ children: [/* @__PURE__ */ L(N.Compact, {
655
+ block: !0,
656
+ children: [/* @__PURE__ */ I(Ce, {
657
+ style: {
658
+ flex: 1,
659
+ minWidth: 0
660
+ },
661
+ min: 0,
662
+ max: u,
663
+ disabled: d.disabled,
664
+ "aria-label": c(Q[e]),
665
+ onChange: (t) => d.changePart(e, Number(t == null ? 0 : t)),
666
+ value: p[e]
667
+ }), /* @__PURE__ */ I(N.Addon, {
668
+ disabled: d.disabled,
669
+ style: {
670
+ width: `${v}ch`,
671
+ justifyContent: "center"
672
+ },
673
+ children: c(Q[e])
674
+ })]
675
+ }), d.mode === "components" && d.activeFields.length > 1 ? /* @__PURE__ */ I(A, {
676
+ size: "small",
677
+ type: "text",
678
+ disabled: d.disabled,
679
+ "aria-label": c("duration.removeUnit", { unit: c(Q[e]) }),
680
+ onClick: () => d.removeField(e),
681
+ children: /* @__PURE__ */ I($e, {})
682
+ }) : /* @__PURE__ */ I("span", { "aria-hidden": "true" })]
683
+ }, e)),
684
+ d.addableFields.length > 0 && /* @__PURE__ */ I(De, {
685
+ size: "small",
686
+ style: { width: `calc(100% - ${i.controlHeight + i.paddingXXS}px)` },
687
+ value: void 0,
688
+ disabled: d.disabled,
689
+ placeholder: c("duration.addUnit"),
690
+ "aria-label": c("duration.addUnit"),
691
+ onChange: (e) => d.addField(e),
692
+ options: d.addableFields.map((e) => ({
693
+ value: e,
694
+ label: c(Q[e])
695
+ }))
696
+ }),
697
+ d.showActions && /* @__PURE__ */ L(j, {
698
+ justify: "end",
699
+ gap: "small",
700
+ children: [/* @__PURE__ */ I(A, {
701
+ onClick: () => d.close(),
702
+ children: d.options.cancelLabel ? (t = s(d.options.cancelLabel)) == null ? d.options.cancelLabel : t : c("duration.cancel")
703
+ }), /* @__PURE__ */ I(A, {
704
+ onClick: () => {
705
+ d.apply();
706
+ },
707
+ type: "primary",
708
+ children: d.options.okLabel ? (n = s(d.options.okLabel)) == null ? d.options.okLabel : n : c("duration.ok")
709
+ })]
710
+ })
711
+ ]
712
+ });
713
+ return /* @__PURE__ */ I(qt, {
714
+ props: e,
715
+ error: _ || a,
716
+ children: /* @__PURE__ */ I(M, G(G({ allowClear: m }, h), {}, {
717
+ disabled: d.disabled,
718
+ onChange: (t) => e.handleChange(e.path, t.currentTarget.value || void 0),
719
+ onBlur: o,
720
+ placeholder: (r = d.options.placeholder) == null ? "P1DT2H" : r,
721
+ autoFocus: d.options.focus,
722
+ status: _ || a ? "error" : void 0,
723
+ value: g == null ? "" : g,
724
+ styles: { prefix: {
725
+ lineHeight: 0,
726
+ display: "flex",
727
+ alignItems: "center"
728
+ } },
729
+ prefix: /* @__PURE__ */ I(we, {
730
+ content: y,
731
+ onOpenChange: (e) => e ? d.openPicker() : d.close(),
732
+ open: f,
733
+ placement: "bottomLeft",
734
+ trigger: "click",
735
+ children: /* @__PURE__ */ I(Qe, {
736
+ role: "button",
737
+ "aria-label": s("editor.chooseDuration"),
738
+ style: {
739
+ cursor: d.disabled ? "not-allowed" : "pointer",
740
+ color: i.colorTextTertiary
741
+ }
742
+ })
743
+ })
744
+ }))
745
+ });
746
+ }, Qt = R(Zt), $t = w.memo(function(e) {
747
+ var t;
748
+ let { data: n, className: r, id: i, enabled: a, inputProps: o } = e, s = E(null), c = T(() => {
749
+ var e;
750
+ return (e = s.current) == null ? void 0 : e.input;
751
+ }, []), { appliedUiSchemaOptions: l, settings: u, display: d, onClear: f, onChange: p, onCompositionStart: m, onCompositionEnd: h } = et(e, c, "commit");
752
+ return /* @__PURE__ */ I(D, {
753
+ clearable: l.clearable !== !1,
754
+ data: n,
755
+ enabled: a,
756
+ onClear: f,
757
+ children: /* @__PURE__ */ I(M, G({
758
+ ref: s,
759
+ value: d,
760
+ onChange: p,
761
+ onCompositionStart: m,
762
+ onCompositionEnd: h,
763
+ className: r,
764
+ id: i,
765
+ disabled: !a,
766
+ autoFocus: l.focus,
767
+ style: { width: "100%" },
768
+ placeholder: (t = l.placeholder) == null ? typeof (u == null ? void 0 : u.mask) == "string" ? u.mask : void 0 : t,
769
+ "data-mask-input": !0
770
+ }, o))
771
+ });
772
+ }), en = p, tn = (e) => /* @__PURE__ */ I(ae, G(G({}, e), {}, { input: $t })), nn = R(tn), rn = V(3, B(H("Control"), Ze((e) => e.type === "null"))), an = (e) => {
773
+ let { errors: t, onFocus: n, onBlur: r } = k({
774
+ errors: e.errors,
775
+ path: e.path,
776
+ schema: e.schema,
777
+ uischema: e.uischema,
778
+ config: e.config
779
+ });
780
+ return e.visible ? /* @__PURE__ */ I(O, {
781
+ errors: t || void 0,
782
+ help: t || e.description,
783
+ children: /* @__PURE__ */ L(be, {
784
+ checked: e.data === null,
785
+ disabled: !e.enabled,
786
+ onFocus: n,
787
+ onBlur: r,
788
+ indeterminate: e.data !== null && e.data !== void 0,
789
+ onChange: (t) => e.handleChange(e.path, t.target.checked ? null : void 0),
790
+ children: [e.label, e.required ? " *" : ""]
791
+ })
792
+ }) : null;
793
+ }, on = R(an), sn = (e) => {
794
+ var t, n;
795
+ return String((t = (n = e.options) == null ? void 0 : n.variant) == null ? "" : t).toLowerCase() === "splitter";
796
+ }, cn = V(5, B(Xe(H("HorizontalLayout"), H("VerticalLayout")), sn)), ln = (e) => {
797
+ var t;
798
+ let n = e.uischema, r = n.type === "VerticalLayout", i = G(G({}, e.config), n.options), a = tt(n.elements, e.path, e.config), o = h(a), s = i.resizable !== !1;
799
+ return e.visible ? /* @__PURE__ */ I(ke, G(G({ orientation: r ? "vertical" : "horizontal" }, (i == null ? void 0 : i.wrap) === !0 ? { "data-layout-diagnostic": "`wrap` is not supported together with the splitter variant; ignored." } : {}), {}, {
800
+ style: {
801
+ height: r ? (t = b(i.height)) == null ? "20rem" : t : void 0,
802
+ minHeight: r ? b(i.minHeight) : void 0
803
+ },
804
+ children: a.map((t, n) => /* @__PURE__ */ I(ke.Panel, {
805
+ defaultSize: `${o[n]}%`,
806
+ min: "10%",
807
+ resizable: s,
808
+ children: /* @__PURE__ */ I("div", {
809
+ style: {
810
+ boxSizing: "border-box",
811
+ height: "100%",
812
+ minWidth: 0,
813
+ overflow: "auto",
814
+ padding: 12
815
+ },
816
+ children: /* @__PURE__ */ I(Me, {
817
+ cells: e.cells,
818
+ enabled: e.enabled,
819
+ path: e.path,
820
+ renderers: e.renderers,
821
+ schema: e.schema,
822
+ uischema: t
823
+ })
824
+ })
825
+ }, n))
826
+ }), a.length) : null;
827
+ }, un = Ne(ln), dn = s(({ children: e }) => /* @__PURE__ */ I(P.Paragraph, {
828
+ style: { marginBottom: 0 },
829
+ children: e
830
+ })), $ = (e) => {
831
+ var t, n;
832
+ let r = (t) => /* @__PURE__ */ I(e, G(G({}, t), {}, { uischema: G(G({}, t.uischema), {}, { scope: "#" }) }));
833
+ return r.displayName = `asCell(${(t = (n = e.displayName) == null ? e.name : n) == null ? "Control" : t})`, r;
834
+ }, fn = (e = {}) => [
835
+ {
836
+ tester: d,
837
+ renderer: zt
838
+ },
839
+ {
840
+ tester: v,
841
+ renderer: Bt
842
+ },
843
+ {
844
+ tester: Vt,
845
+ renderer: Ut
846
+ },
847
+ {
848
+ tester: K,
849
+ renderer: q
850
+ },
851
+ {
852
+ tester: _,
853
+ renderer: dn
854
+ },
855
+ {
856
+ tester: J,
857
+ renderer: X
858
+ },
859
+ {
860
+ tester: Z,
861
+ renderer: Qt
862
+ },
863
+ {
864
+ tester: en,
865
+ renderer: nn
866
+ },
867
+ {
868
+ tester: rn,
869
+ renderer: on
870
+ },
871
+ {
872
+ tester: cn,
873
+ renderer: un
874
+ },
875
+ ...o({
876
+ components: G({
877
+ Alert: ve,
878
+ Button: A
879
+ }, e.components),
880
+ includeButtonRenderer: !1
881
+ })
882
+ ], pn = fn(), mn = () => [
883
+ {
884
+ tester: K,
885
+ cell: $(q)
886
+ },
887
+ {
888
+ tester: J,
889
+ cell: $(X)
890
+ },
891
+ {
892
+ tester: Z,
893
+ cell: $(Qt)
894
+ },
895
+ {
896
+ tester: en,
897
+ cell: $(nn)
898
+ },
899
+ {
900
+ tester: rn,
901
+ cell: $(on)
902
+ }
903
+ ], hn = mn(), gn = pn;
904
+ export { zt as AntdAgGridControlRenderer, Ut as AntdButtonRenderer, Kt as AntdColorControl, q as AntdColorControlRenderer, Xt as AntdCronControl, X as AntdCronControlRenderer, Zt as AntdDurationControl, Qt as AntdDurationControlRenderer, dn as AntdMarkupLabelRenderer, tn as AntdMaskControl, nn as AntdMaskControlRenderer, $t as AntdMaskInput, Bt as AntdMonacoControlRenderer, an as AntdNullControl, on as AntdNullControlRenderer, ln as AntdSplitLayout, un as AntdSplitLayoutRenderer, Pe as COLOR_SAVE_FORMATS, Fe as DEFAULT_COLOR_SAVE_FORMAT, at as DEFAULT_MASK_SETTINGS, ot as DEFAULT_MASK_TOKENS, nt as EMPTY_DURATION, st as MASKA_DEFAULT_TOKENS, gn as advancedAntdRenderers, Vt as antdButtonRendererTester, K as antdColorControlTester, J as antdCronControlTester, Z as antdDurationControlTester, hn as antdExtendedCells, pn as antdExtendedRenderers, en as antdMaskControlTester, rn as antdNullControlTester, cn as antdSplitLayoutTester, $ as asCell, Ie as asColorSaveFormat, ct as codePointLength, lt as compileTokenPattern, mn as createAntdExtendedCells, fn as createAntdExtendedRenderers, ut as createMask, dt as displayValue, ft as fitsMask, rt as formatDuration, sn as hasAntdSplitLayoutVariant, Le as hsbToRgb, Re as hslToRgb, ze as isColor, Be as isTransparent, pt as maskEdit, mt as nextCaret, Ve as normalizeHue, He as parseColor, it as parseDuration, Wt as pickerFormatFor, Ue as placeholderKeyFor, ht as resolveMaskSettings, We as rgbToHsb, z as serializeColor, gt as storedValue, Ge as toCssColor, _t as toMaskTokens, vt as withinMaxLength };
905
+
906
+ //# sourceMappingURL=jsonforms-react-antd-extended.esm.js.map