@kubohiroya/turbowarp-extension-data-editor 0.2.0 → 0.2.2
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 +9 -6
- package/dist/build-info.json +3 -3
- package/dist/fixed-input-branches.d.ts +12 -0
- package/dist/fixed-input-branches.js +180 -0
- package/dist/fixed-input-editor.d.ts +39 -0
- package/dist/fixed-input-editor.js +538 -0
- package/dist/fixed-input-schema.d.ts +15 -0
- package/dist/fixed-input-schema.js +21 -0
- package/dist/fixed-input-snapshot.d.ts +7 -0
- package/dist/fixed-input-snapshot.js +180 -0
- package/dist/fixed-input-types.d.ts +138 -0
- package/dist/fixed-input-types.js +23 -0
- package/dist/fixed-input-view.d.ts +14 -0
- package/dist/fixed-input-view.js +168 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4 -0
- package/dist/react.css +168 -0
- package/dist/react.d.ts +8 -0
- package/dist/react.js +19 -2
- package/dist/registry.d.ts +4 -0
- package/dist/registry.js +45 -7
- package/dist/rjsf-templates.d.ts +11 -0
- package/dist/rjsf-templates.js +129 -0
- package/dist/rjsf.d.ts +24 -1
- package/dist/rjsf.js +35 -3
- package/dist/schema.d.ts +2 -0
- package/dist/schema.js +1 -0
- package/dist/session.d.ts +3 -1
- package/dist/session.js +205 -7
- package/dist/turbowarp/bridge.d.ts +2 -1
- package/dist/turbowarp/bridge.js +37 -5
- package/dist/turbowarp/fixed-fields.d.ts +82 -0
- package/dist/turbowarp/fixed-fields.js +311 -0
- package/dist/turbowarp/fixed-transaction.d.ts +18 -0
- package/dist/turbowarp/fixed-transaction.js +460 -0
- package/dist/turbowarp/host.d.ts +3 -8
- package/dist/turbowarp/host.js +68 -1
- package/dist/turbowarp.d.ts +4 -0
- package/dist/turbowarp.js +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/view.js +4 -0
- package/dist/webpack4/index.js +22 -5
- package/dist/webpack4/metafile.json +592 -299
- package/dist/webpack4/react.js +20 -6
- package/dist/webpack4/react.js.map +2 -2
- package/dist/webpack4/rjsf.js +450 -60
- package/dist/webpack4/rjsf.js.map +4 -4
- package/dist/webpack4/schema.js +6 -3
- package/dist/webpack4/{shared-KQOUMWJ4.js → shared-75QIWLZY.js} +1129 -1244
- package/dist/webpack4/{shared-KQOUMWJ4.js.map → shared-75QIWLZY.js.map} +4 -4
- package/dist/webpack4/shared-FYUILHED.js +1 -0
- package/dist/webpack4/shared-GQLPPRT2.js +210 -0
- package/dist/webpack4/shared-GQLPPRT2.js.map +7 -0
- package/dist/webpack4/shared-P2JBRZFP.js +2206 -0
- package/dist/webpack4/shared-P2JBRZFP.js.map +7 -0
- package/dist/webpack4/turbowarp.js +913 -9
- package/dist/webpack4/turbowarp.js.map +4 -4
- package/docs/api.md +7 -0
- package/docs/fixed-input-contracts.md +77 -0
- package/docs/package-distribution.md +5 -0
- package/docs/stage-2-publication.ja.md +6 -0
- package/package.json +2 -1
- package/dist/webpack4/shared-CQB3NG2A.js +0 -1
- package/dist/webpack4/shared-MRPGBJIH.js +0 -75
- package/dist/webpack4/shared-MRPGBJIH.js.map +0 -7
- package/dist/webpack4/shared-N6YQE2X6.js +0 -1029
- package/dist/webpack4/shared-N6YQE2X6.js.map +0 -7
- /package/dist/webpack4/{shared-CQB3NG2A.js.map → shared-FYUILHED.js.map} +0 -0
package/dist/webpack4/rjsf.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EditorRegistry,
|
|
3
|
-
cloneJson
|
|
4
|
-
|
|
3
|
+
cloneJson,
|
|
4
|
+
createFixedInputEditor
|
|
5
|
+
} from "./shared-P2JBRZFP.js";
|
|
5
6
|
import {
|
|
6
7
|
EDITOR_API_VERSION
|
|
7
8
|
} from "./shared-BKTRZUZH.js";
|
|
9
|
+
import {
|
|
10
|
+
toValidationIssues,
|
|
11
|
+
validateSchemaInput
|
|
12
|
+
} from "./shared-GQLPPRT2.js";
|
|
8
13
|
import {
|
|
9
14
|
compileSchemaBundle,
|
|
15
|
+
isJsonRecord,
|
|
16
|
+
parseFixedNumberInput,
|
|
10
17
|
prepare,
|
|
11
18
|
require__,
|
|
12
19
|
require_ajv,
|
|
13
20
|
require_dist,
|
|
14
21
|
require_fast_uri,
|
|
15
|
-
toValidationIssues,
|
|
16
|
-
validateSchemaInput
|
|
17
|
-
} from "./shared-KQOUMWJ4.js";
|
|
18
|
-
import {
|
|
19
|
-
isJsonRecord,
|
|
20
22
|
snapshotJson
|
|
21
|
-
} from "./shared-
|
|
23
|
+
} from "./shared-75QIWLZY.js";
|
|
22
24
|
import {
|
|
23
25
|
__commonJS,
|
|
24
26
|
__export,
|
|
@@ -4915,7 +4917,7 @@ var require_react_is_development = __commonJS({
|
|
|
4915
4917
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
4916
4918
|
var Element = REACT_ELEMENT_TYPE;
|
|
4917
4919
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
4918
|
-
var
|
|
4920
|
+
var Fragment4 = REACT_FRAGMENT_TYPE;
|
|
4919
4921
|
var Lazy = REACT_LAZY_TYPE;
|
|
4920
4922
|
var Memo = REACT_MEMO_TYPE;
|
|
4921
4923
|
var Portal = REACT_PORTAL_TYPE;
|
|
@@ -4983,7 +4985,7 @@ var require_react_is_development = __commonJS({
|
|
|
4983
4985
|
exports2.ContextProvider = ContextProvider;
|
|
4984
4986
|
exports2.Element = Element;
|
|
4985
4987
|
exports2.ForwardRef = ForwardRef;
|
|
4986
|
-
exports2.Fragment =
|
|
4988
|
+
exports2.Fragment = Fragment4;
|
|
4987
4989
|
exports2.Lazy = Lazy;
|
|
4988
4990
|
exports2.Memo = Memo;
|
|
4989
4991
|
exports2.Portal = Portal;
|
|
@@ -5025,7 +5027,7 @@ var require_react_is = __commonJS({
|
|
|
5025
5027
|
});
|
|
5026
5028
|
|
|
5027
5029
|
// dist/rjsf.js
|
|
5028
|
-
import * as
|
|
5030
|
+
import * as React4 from "react";
|
|
5029
5031
|
|
|
5030
5032
|
// node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/browser/dist/nodes/identity.js
|
|
5031
5033
|
var ALIAS = /* @__PURE__ */ Symbol.for("yaml.alias");
|
|
@@ -11632,11 +11634,11 @@ function checkYamlKeys(node) {
|
|
|
11632
11634
|
}
|
|
11633
11635
|
}
|
|
11634
11636
|
function yamlDocument(source) {
|
|
11635
|
-
const
|
|
11636
|
-
if (
|
|
11637
|
+
const document2 = parseDocument(source[0] === "\uFEFF" ? source.slice(1) : source, { keepSourceTokens: true, uniqueKeys: true, strict: true, version: "1.2", prettyErrors: false });
|
|
11638
|
+
if (document2.errors.length || document2.warnings.length)
|
|
11637
11639
|
fail();
|
|
11638
|
-
checkYamlKeys(
|
|
11639
|
-
return
|
|
11640
|
+
checkYamlKeys(document2.contents);
|
|
11641
|
+
return document2;
|
|
11640
11642
|
}
|
|
11641
11643
|
function yamlValue(source) {
|
|
11642
11644
|
return snapshot(yamlDocument(source).toJS({ maxAliasCount: 100 }));
|
|
@@ -11645,7 +11647,7 @@ function patchYaml(source, original, edited) {
|
|
|
11645
11647
|
var _a;
|
|
11646
11648
|
if (source[0] === "\uFEFF")
|
|
11647
11649
|
return "\uFEFF" + patchYaml(source.slice(1), original, edited);
|
|
11648
|
-
const
|
|
11650
|
+
const document2 = yamlDocument(source);
|
|
11649
11651
|
const patches = [];
|
|
11650
11652
|
const comments = [];
|
|
11651
11653
|
const annotations = [];
|
|
@@ -11668,7 +11670,7 @@ function patchYaml(source, original, edited) {
|
|
|
11668
11670
|
for (const child of Object.values(value))
|
|
11669
11671
|
tokens(child);
|
|
11670
11672
|
};
|
|
11671
|
-
tokens((_a =
|
|
11673
|
+
tokens((_a = document2.contents) === null || _a === void 0 ? void 0 : _a.srcToken);
|
|
11672
11674
|
const remove = (start, end) => {
|
|
11673
11675
|
if (comments.some(([a2, b2]) => a2 < end && b2 > start) || annotations.some(([a2, b2]) => a2 < end && b2 > start))
|
|
11674
11676
|
fail();
|
|
@@ -11782,7 +11784,7 @@ function patchYaml(source, original, edited) {
|
|
|
11782
11784
|
text += " ";
|
|
11783
11785
|
patches.push({ start, end, text });
|
|
11784
11786
|
};
|
|
11785
|
-
visit3(
|
|
11787
|
+
visit3(document2.contents, original, edited);
|
|
11786
11788
|
return apply(source, patches);
|
|
11787
11789
|
}
|
|
11788
11790
|
function patchSource(source, format, original, edited) {
|
|
@@ -11939,11 +11941,11 @@ function Tree({ value, path, schema: schema4, ui, variant, invalidNumbers, chang
|
|
|
11939
11941
|
const type = typeOf(value);
|
|
11940
11942
|
let field;
|
|
11941
11943
|
if (choices) {
|
|
11942
|
-
const
|
|
11944
|
+
const serialized2 = JSON.stringify(value);
|
|
11943
11945
|
const options = choices.map((item) => JSON.stringify(item));
|
|
11944
|
-
if (!options.includes(
|
|
11945
|
-
options.unshift(
|
|
11946
|
-
field = React.createElement("select", { ...props, value:
|
|
11946
|
+
if (!options.includes(serialized2))
|
|
11947
|
+
options.unshift(serialized2);
|
|
11948
|
+
field = React.createElement("select", { ...props, value: serialized2, onChange: (e2) => change(JSON.parse(e2.target.value)) }, options.map((item) => React.createElement("option", { key: item, value: item }, item)));
|
|
11947
11949
|
} else if (typeof value === "string") {
|
|
11948
11950
|
field = React.createElement("textarea", { ...props, value, onChange: (e2) => change(e2.target.value) });
|
|
11949
11951
|
} else if (typeof value === "number") {
|
|
@@ -12070,11 +12072,11 @@ function SourceView({ context, bindings }) {
|
|
|
12070
12072
|
var _a, _b;
|
|
12071
12073
|
const entry = sources[binding.argument];
|
|
12072
12074
|
const selectedCreation = Object.hasOwn(creating, binding.argument) ? creating[binding.argument] : "";
|
|
12073
|
-
let
|
|
12075
|
+
let document2;
|
|
12074
12076
|
let variant;
|
|
12075
12077
|
try {
|
|
12076
|
-
|
|
12077
|
-
variant = binding.presentationVariants.find((v2) => v2.format ===
|
|
12078
|
+
document2 = readSourceDocument(binding, entry.source);
|
|
12079
|
+
variant = binding.presentationVariants.find((v2) => v2.format === document2.format && v2.variantId === document2.variantId);
|
|
12078
12080
|
} catch (_c) {
|
|
12079
12081
|
}
|
|
12080
12082
|
if (record2(entry.creating)) {
|
|
@@ -12089,7 +12091,7 @@ function SourceView({ context, bindings }) {
|
|
|
12089
12091
|
try {
|
|
12090
12092
|
if (entry.invalidForm === true)
|
|
12091
12093
|
throw new TypeError();
|
|
12092
|
-
const source = record2(entry.creating) ? createSourceCandidate(entry.creating.format, entry.data) : entry.mode === "form" &&
|
|
12094
|
+
const source = record2(entry.creating) ? createSourceCandidate(entry.creating.format, entry.data) : entry.mode === "form" && document2 && Object.hasOwn(entry, "data") ? patchDecodedSource(document2, entry.data, (source2) => readSourceDocument(binding, source2)) : entry.source;
|
|
12093
12095
|
const next = { ...entry, mode: "source", source, invalidForm: false, invalidNumbers: {} };
|
|
12094
12096
|
delete next.creating;
|
|
12095
12097
|
update(binding.argument, next);
|
|
@@ -12117,8 +12119,8 @@ function SourceView({ context, bindings }) {
|
|
|
12117
12119
|
update(binding.argument, { mode: "form", source: entry.source, sourceEdited: true, creating: { format, variantId }, data: initial(type) });
|
|
12118
12120
|
} }, "Create document (replace source)"),
|
|
12119
12121
|
React.createElement("button", { type: "button", disabled: !variant, "aria-pressed": entry.mode === "form", onClick: () => {
|
|
12120
|
-
if (
|
|
12121
|
-
update(binding.argument, { ...entry, mode: "form", data: Object.hasOwn(entry, "data") ? entry.data :
|
|
12122
|
+
if (document2 || entry.creating)
|
|
12123
|
+
update(binding.argument, { ...entry, mode: "form", data: Object.hasOwn(entry, "data") ? entry.data : document2.data });
|
|
12122
12124
|
} }, "Form"),
|
|
12123
12125
|
entry.mode === "form" && React.createElement("button", { type: "button", onClick: () => {
|
|
12124
12126
|
var _a2;
|
|
@@ -12175,14 +12177,14 @@ function createSourceCandidate(format, data) {
|
|
|
12175
12177
|
const value = snapshotJson(data);
|
|
12176
12178
|
return format === "json" ? JSON.stringify(value, null, 2) : "---\n" + stringify3(value, { version: "1.2" });
|
|
12177
12179
|
}
|
|
12178
|
-
function patchDecodedSource(
|
|
12179
|
-
if (
|
|
12180
|
-
const body =
|
|
12181
|
-
const start =
|
|
12182
|
-
return
|
|
12180
|
+
function patchDecodedSource(document2, data, decode) {
|
|
12181
|
+
if (document2.format === "json") {
|
|
12182
|
+
const body = document2.source.trim();
|
|
12183
|
+
const start = document2.source.length - document2.source.trimStart().length;
|
|
12184
|
+
return document2.source.slice(0, start) + patchSource(body, "json", document2.data, data) + document2.source.slice(start + body.length);
|
|
12183
12185
|
}
|
|
12184
|
-
let candidate = patchSource(
|
|
12185
|
-
if (decode && decode(candidate).format !==
|
|
12186
|
+
let candidate = patchSource(document2.source, document2.format, document2.data, data);
|
|
12187
|
+
if (decode && decode(candidate).format !== document2.format) {
|
|
12186
12188
|
candidate = candidate.startsWith("\uFEFF") ? "\uFEFF---\n" + candidate.slice(1) : "---\n" + candidate;
|
|
12187
12189
|
}
|
|
12188
12190
|
return candidate;
|
|
@@ -12353,19 +12355,19 @@ function createSourceEditor(options) {
|
|
|
12353
12355
|
}
|
|
12354
12356
|
if (validation.result.diagnostics.length)
|
|
12355
12357
|
throw new TypeError();
|
|
12356
|
-
const
|
|
12357
|
-
if (isJsonRecord(entry.creating) && (
|
|
12358
|
+
const document2 = readSourceDocument(binding, candidate);
|
|
12359
|
+
if (isJsonRecord(entry.creating) && (document2.format !== entry.creating.format || document2.variantId !== entry.creating.variantId)) {
|
|
12358
12360
|
issues.push(issue("variant-unrecognized", path));
|
|
12359
12361
|
continue;
|
|
12360
12362
|
}
|
|
12361
|
-
const validator = binding.validators.get(keyFor(
|
|
12363
|
+
const validator = binding.validators.get(keyFor(document2.format, document2.variantId));
|
|
12362
12364
|
if (validator) {
|
|
12363
|
-
const result = validator.validate(
|
|
12365
|
+
const result = validator.validate(document2.data, { consumerId: context.consumerId });
|
|
12364
12366
|
if (result.kind !== "valid") {
|
|
12365
12367
|
issues.push(issue("schema-data-invalid", path));
|
|
12366
12368
|
continue;
|
|
12367
12369
|
}
|
|
12368
|
-
} else if (entry.mode === "form" || candidate !== slot.value && !((_a2 = binding.sourceOnlyVariants) === null || _a2 === void 0 ? void 0 : _a2.some((v2) => v2.variantId ===
|
|
12370
|
+
} else if (entry.mode === "form" || candidate !== slot.value && !((_a2 = binding.sourceOnlyVariants) === null || _a2 === void 0 ? void 0 : _a2.some((v2) => v2.variantId === document2.variantId && v2.format === document2.format))) {
|
|
12369
12371
|
issues.push(issue("variant-unrecognized", path));
|
|
12370
12372
|
continue;
|
|
12371
12373
|
}
|
|
@@ -12381,8 +12383,200 @@ function createSourceEditor(options) {
|
|
|
12381
12383
|
});
|
|
12382
12384
|
}
|
|
12383
12385
|
|
|
12384
|
-
// dist/
|
|
12386
|
+
// dist/fixed-input-view.js
|
|
12387
|
+
import * as React2 from "react";
|
|
12385
12388
|
import * as ReactDOM2 from "react-dom";
|
|
12389
|
+
var defaultMessages = Object.freeze({
|
|
12390
|
+
reset: "Reset",
|
|
12391
|
+
readOnly: "This input cannot be edited safely.",
|
|
12392
|
+
unverified: "The expression is retained without evaluation. Its runtime validity has not been checked.",
|
|
12393
|
+
currentValue: "Current value",
|
|
12394
|
+
colorPicker: "color picker",
|
|
12395
|
+
invalidValue: "Check this value before saving.",
|
|
12396
|
+
inactiveDraft: "Hidden edits are retained in this dialog and will not be saved while hidden."
|
|
12397
|
+
});
|
|
12398
|
+
function captureFixedInputMessages(input) {
|
|
12399
|
+
if (input === void 0)
|
|
12400
|
+
return defaultMessages;
|
|
12401
|
+
if (!input || typeof input !== "object" || Array.isArray(input) || Object.getPrototypeOf(input) !== Object.prototype && Object.getPrototypeOf(input) !== null || Object.getOwnPropertySymbols(input).length)
|
|
12402
|
+
throw new TypeError("Invalid fixed form messages.");
|
|
12403
|
+
const result = { ...defaultMessages };
|
|
12404
|
+
for (const key of Object.getOwnPropertyNames(input)) {
|
|
12405
|
+
const descriptor = Object.getOwnPropertyDescriptor(input, key);
|
|
12406
|
+
if (!Object.hasOwn(defaultMessages, key) || !("value" in descriptor) || typeof descriptor.value !== "string" || !descriptor.value)
|
|
12407
|
+
throw new TypeError("Invalid fixed form messages.");
|
|
12408
|
+
Object.defineProperty(result, key, { value: descriptor.value, enumerable: true });
|
|
12409
|
+
}
|
|
12410
|
+
return Object.freeze(result);
|
|
12411
|
+
}
|
|
12412
|
+
function resolveFixedInputMessages(source) {
|
|
12413
|
+
const value = typeof source === "function" ? source() : source;
|
|
12414
|
+
try {
|
|
12415
|
+
return captureFixedInputMessages(value);
|
|
12416
|
+
} catch (error) {
|
|
12417
|
+
try {
|
|
12418
|
+
void Promise.prototype.then.call(value, () => void 0, () => void 0);
|
|
12419
|
+
} catch (_a) {
|
|
12420
|
+
}
|
|
12421
|
+
throw error;
|
|
12422
|
+
}
|
|
12423
|
+
}
|
|
12424
|
+
var record3 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
12425
|
+
var display = (value) => typeof value === "string" ? value : typeof value === "number" && Object.is(value, -0) ? "-0" : value === void 0 ? "" : JSON.stringify(value);
|
|
12426
|
+
var serialized = (value) => value === void 0 ? "unavailable" : JSON.stringify(value);
|
|
12427
|
+
function preview(value) {
|
|
12428
|
+
if (/^#[\da-f]{6}$/iu.test(value))
|
|
12429
|
+
return value.toLowerCase();
|
|
12430
|
+
return /^#[\da-f]{3}$/iu.test(value) ? `#${value.slice(1).split("").map((part) => part + part).join("").toLowerCase()}` : void 0;
|
|
12431
|
+
}
|
|
12432
|
+
function describe(context) {
|
|
12433
|
+
if (typeof context.getFixedInputView !== "function")
|
|
12434
|
+
throw new TypeError("A fixed form requires a fixed session.");
|
|
12435
|
+
const result = context.getFixedInputView();
|
|
12436
|
+
if (!result)
|
|
12437
|
+
throw new TypeError("A fixed form requires a fixed session.");
|
|
12438
|
+
return result;
|
|
12439
|
+
}
|
|
12440
|
+
var nextFixedViewId = 0;
|
|
12441
|
+
function FixedInputView({ context, messages }) {
|
|
12442
|
+
const [, redraw] = React2.useState(0);
|
|
12443
|
+
const [viewId] = React2.useState(() => `block-editor-fixed-${++nextFixedViewId}`);
|
|
12444
|
+
React2.useEffect(() => {
|
|
12445
|
+
const stop = context.subscribe(() => redraw((value) => value + 1));
|
|
12446
|
+
if (context.getState().status === "editing" && !context.getState().issues.length) {
|
|
12447
|
+
context.setValidationIssues(describe(context).issues);
|
|
12448
|
+
}
|
|
12449
|
+
return stop;
|
|
12450
|
+
}, [context]);
|
|
12451
|
+
const state = context.getState();
|
|
12452
|
+
if (state.status !== "editing" && state.status !== "saving")
|
|
12453
|
+
return React2.createElement(React2.Fragment, null);
|
|
12454
|
+
const description = describe(context);
|
|
12455
|
+
const draft = context.getDraft();
|
|
12456
|
+
const inputs = record3(draft.inputs) ? draft.inputs : {};
|
|
12457
|
+
const update = (argument, value, buffer) => {
|
|
12458
|
+
if (context.getState().status !== "editing")
|
|
12459
|
+
return;
|
|
12460
|
+
const latest = describe(context).inputs[argument];
|
|
12461
|
+
if (!latest || latest.state !== "editable")
|
|
12462
|
+
return;
|
|
12463
|
+
const next = context.getDraft();
|
|
12464
|
+
if (!record3(next.inputs))
|
|
12465
|
+
throw new TypeError("Invalid fixed form draft.");
|
|
12466
|
+
const previous = next.inputs[argument];
|
|
12467
|
+
const entry = { value, changed: true };
|
|
12468
|
+
if (buffer !== void 0)
|
|
12469
|
+
entry.buffer = buffer;
|
|
12470
|
+
if (record3(previous) && (previous.readOnly === true || previous.repair === true))
|
|
12471
|
+
entry.repair = true;
|
|
12472
|
+
Object.defineProperty(next.inputs, argument, { value: entry, enumerable: true, configurable: true, writable: true });
|
|
12473
|
+
context.setDraft(next);
|
|
12474
|
+
context.setValidationIssues(describe(context).issues);
|
|
12475
|
+
};
|
|
12476
|
+
const hasInactiveEdits = Object.entries(description.inputs).some(([argument, input]) => input.state === "hidden" && record3(inputs[argument]) && inputs[argument].changed === true);
|
|
12477
|
+
return React2.createElement(
|
|
12478
|
+
"div",
|
|
12479
|
+
{ className: "block-editor-fixed-inputs" },
|
|
12480
|
+
hasInactiveEdits && React2.createElement("p", { className: "block-editor-fixed-inactive", "data-fixed-inactive-draft": "", role: "status" }, messages.inactiveDraft),
|
|
12481
|
+
Object.entries(description.inputs).map(([argument, input], index) => {
|
|
12482
|
+
var _a, _b, _c, _d, _e2;
|
|
12483
|
+
if (input.state === "hidden")
|
|
12484
|
+
return null;
|
|
12485
|
+
const entry = record3(inputs[argument]) ? inputs[argument] : {};
|
|
12486
|
+
const value = Object.hasOwn(entry, "value") ? entry.value : void 0;
|
|
12487
|
+
const label = (_a = input.label) !== null && _a !== void 0 ? _a : argument;
|
|
12488
|
+
const text = typeof entry.buffer === "string" ? entry.buffer : value === void 0 ? (_b = input.rawDisplay) !== null && _b !== void 0 ? _b : "" : display(value);
|
|
12489
|
+
const disabled = state.status !== "editing" || input.state !== "editable";
|
|
12490
|
+
const path = `/${argument.replace(/~/g, "~0").replace(/\//g, "~1")}`;
|
|
12491
|
+
const invalid = [...state.issues, ...description.issues].some((issue2) => {
|
|
12492
|
+
var _a2;
|
|
12493
|
+
return issue2.path === path || ((_a2 = issue2.path) === null || _a2 === void 0 ? void 0 : _a2.startsWith(`${path}/`));
|
|
12494
|
+
});
|
|
12495
|
+
const errorId2 = `${viewId}-${index}-error`;
|
|
12496
|
+
const reasonId = `${viewId}-${index}-reason`;
|
|
12497
|
+
const unverifiedId = `${viewId}-${index}-unverified`;
|
|
12498
|
+
const originalId = `${viewId}-${index}-original`;
|
|
12499
|
+
const showOriginal = input.control === "enum" && input.rawDisplay !== void 0 && entry.changed !== true && input.rawDisplay !== display(value);
|
|
12500
|
+
const descriptions = [input.state === "readonly" ? reasonId : "", invalid ? errorId2 : "", input.unverified ? unverifiedId : "", showOriginal ? originalId : ""].filter(Boolean).join(" ");
|
|
12501
|
+
const attributes = {
|
|
12502
|
+
"aria-invalid": invalid || void 0,
|
|
12503
|
+
"data-block-editor-invalid": invalid ? "true" : void 0,
|
|
12504
|
+
"aria-describedby": descriptions || void 0
|
|
12505
|
+
};
|
|
12506
|
+
let control;
|
|
12507
|
+
if (input.state === "readonly") {
|
|
12508
|
+
control = React2.createElement(
|
|
12509
|
+
React2.Fragment,
|
|
12510
|
+
null,
|
|
12511
|
+
React2.createElement("output", { "aria-label": label, ...attributes }, (_c = input.rawDisplay) !== null && _c !== void 0 ? _c : text),
|
|
12512
|
+
React2.createElement("p", { id: reasonId, className: "block-editor-fixed-readonly" }, messages.readOnly)
|
|
12513
|
+
);
|
|
12514
|
+
} else if (input.control === "enum") {
|
|
12515
|
+
const choices = (_d = input.choices) !== null && _d !== void 0 ? _d : [];
|
|
12516
|
+
const current = serialized(value);
|
|
12517
|
+
const known = choices.some((choice) => serialized(choice.value) === current);
|
|
12518
|
+
control = React2.createElement(
|
|
12519
|
+
"select",
|
|
12520
|
+
{ "aria-label": label, ...attributes, value: known ? current : "existing-raw", disabled, onChange: (event) => {
|
|
12521
|
+
const choice = choices.find((item) => serialized(item.value) === event.target.value);
|
|
12522
|
+
if (choice)
|
|
12523
|
+
update(argument, choice.value);
|
|
12524
|
+
} },
|
|
12525
|
+
!known && React2.createElement("option", { value: "existing-raw", disabled: true }, ((_e2 = input.rawDisplay) !== null && _e2 !== void 0 ? _e2 : text) || messages.currentValue),
|
|
12526
|
+
choices.map((choice, index2) => {
|
|
12527
|
+
var _a2;
|
|
12528
|
+
return React2.createElement("option", { key: index2, value: serialized(choice.value) }, (_a2 = choice.label) !== null && _a2 !== void 0 ? _a2 : display(choice.value));
|
|
12529
|
+
})
|
|
12530
|
+
);
|
|
12531
|
+
} else if (input.control === "number") {
|
|
12532
|
+
control = React2.createElement("input", { "aria-label": label, ...attributes, type: "text", inputMode: "decimal", value: text, disabled, onChange: (event) => {
|
|
12533
|
+
const buffer = event.target.value;
|
|
12534
|
+
if (input.valueType === "string" || input.valueType === void 0 && typeof value === "string") {
|
|
12535
|
+
update(argument, buffer);
|
|
12536
|
+
} else {
|
|
12537
|
+
const parsed = parseFixedNumberInput(buffer);
|
|
12538
|
+
update(argument, parsed.kind === "valid" ? parsed.value : value !== null && value !== void 0 ? value : null, buffer);
|
|
12539
|
+
}
|
|
12540
|
+
} });
|
|
12541
|
+
} else if (input.control === "color") {
|
|
12542
|
+
const color = preview(text);
|
|
12543
|
+
control = React2.createElement(
|
|
12544
|
+
"div",
|
|
12545
|
+
{ className: "block-editor-fixed-color" },
|
|
12546
|
+
React2.createElement("input", { "aria-label": label, ...attributes, type: "text", value: text, disabled, onChange: (event) => update(argument, event.target.value) }),
|
|
12547
|
+
color !== void 0 && React2.createElement("input", { type: "color", "aria-label": `${label} ${messages.colorPicker}`, ...attributes, value: color, disabled, onChange: (event) => update(argument, event.target.value) })
|
|
12548
|
+
);
|
|
12549
|
+
} else
|
|
12550
|
+
control = React2.createElement("textarea", { "aria-label": label, ...attributes, value: text, disabled, onChange: (event) => update(argument, event.target.value) });
|
|
12551
|
+
return React2.createElement(
|
|
12552
|
+
"fieldset",
|
|
12553
|
+
{ key: argument, "data-fixed-argument": argument, disabled },
|
|
12554
|
+
React2.createElement("legend", null, label),
|
|
12555
|
+
control,
|
|
12556
|
+
input.state === "editable" && input.reset !== void 0 && React2.createElement("button", { type: "button", disabled, "aria-label": `${label} ${messages.reset}`, onClick: () => update(argument, input.reset) }, messages.reset),
|
|
12557
|
+
showOriginal && React2.createElement(
|
|
12558
|
+
"p",
|
|
12559
|
+
{ id: originalId, className: "block-editor-fixed-original", "data-fixed-original-value": "" },
|
|
12560
|
+
messages.currentValue,
|
|
12561
|
+
": ",
|
|
12562
|
+
React2.createElement("output", null, input.rawDisplay)
|
|
12563
|
+
),
|
|
12564
|
+
invalid && React2.createElement("p", { id: errorId2, className: "block-editor-fixed-error" }, messages.invalidValue),
|
|
12565
|
+
input.unverified && React2.createElement("p", { id: unverifiedId, className: "block-editor-fixed-unverified" }, messages.unverified)
|
|
12566
|
+
);
|
|
12567
|
+
})
|
|
12568
|
+
);
|
|
12569
|
+
}
|
|
12570
|
+
function mountFixedInputView(container, context, messages = defaultMessages) {
|
|
12571
|
+
describe(context);
|
|
12572
|
+
ReactDOM2.render(React2.createElement(FixedInputView, { context, messages }), container);
|
|
12573
|
+
return () => {
|
|
12574
|
+
ReactDOM2.unmountComponentAtNode(container);
|
|
12575
|
+
};
|
|
12576
|
+
}
|
|
12577
|
+
|
|
12578
|
+
// dist/rjsf.js
|
|
12579
|
+
import * as ReactDOM3 from "react-dom";
|
|
12386
12580
|
|
|
12387
12581
|
// node_modules/.pnpm/@rjsf+core@5.24.13_@rjsf+utils@5.24.13_react@16.14.0__react@16.14.0/node_modules/@rjsf/core/lib/index.js
|
|
12388
12582
|
var lib_exports2 = {};
|
|
@@ -17031,7 +17225,7 @@ function getTemplate(name, registry, uiOptions = {}) {
|
|
|
17031
17225
|
// node_modules/.pnpm/@rjsf+utils@5.24.13_react@16.14.0/node_modules/@rjsf/utils/lib/getWidget.js
|
|
17032
17226
|
var import_react_is = __toESM(require_react_is());
|
|
17033
17227
|
import { jsx as _jsx } from "react/jsx-runtime.js";
|
|
17034
|
-
import { createElement as
|
|
17228
|
+
import { createElement as createElement3 } from "react";
|
|
17035
17229
|
var widgetMap = {
|
|
17036
17230
|
boolean: {
|
|
17037
17231
|
checkbox: "CheckboxWidget",
|
|
@@ -17097,7 +17291,7 @@ function mergeWidgetOptions(AWidget) {
|
|
|
17097
17291
|
}
|
|
17098
17292
|
function getWidget(schema4, widget, registeredWidgets = {}) {
|
|
17099
17293
|
const type = getSchemaType(schema4);
|
|
17100
|
-
if (typeof widget === "function" || widget && import_react_is.default.isForwardRef(
|
|
17294
|
+
if (typeof widget === "function" || widget && import_react_is.default.isForwardRef(createElement3(widget)) || import_react_is.default.isMemo(widget)) {
|
|
17101
17295
|
return mergeWidgetOptions(widget);
|
|
17102
17296
|
}
|
|
17103
17297
|
if (typeof widget !== "string") {
|
|
@@ -18410,12 +18604,12 @@ var MultiSchemaField_default = AnyOfField;
|
|
|
18410
18604
|
|
|
18411
18605
|
// node_modules/.pnpm/@rjsf+core@5.24.13_@rjsf+utils@5.24.13_react@16.14.0__react@16.14.0/node_modules/@rjsf/core/lib/components/fields/NumberField.js
|
|
18412
18606
|
import { jsx as _jsx5 } from "react/jsx-runtime.js";
|
|
18413
|
-
import { useState as
|
|
18607
|
+
import { useState as useState3, useCallback } from "react";
|
|
18414
18608
|
var trailingCharMatcherWithPrefix = /\.([0-9]*0)*$/;
|
|
18415
18609
|
var trailingCharMatcher = /[0.]0*$/;
|
|
18416
18610
|
function NumberField(props) {
|
|
18417
18611
|
const { registry, onChange, formData, value: initialValue } = props;
|
|
18418
|
-
const [lastValue, setLastValue] =
|
|
18612
|
+
const [lastValue, setLastValue] = useState3(initialValue);
|
|
18419
18613
|
const { StringField: StringField2 } = registry.fields;
|
|
18420
18614
|
let value = formData;
|
|
18421
18615
|
const handleChange = useCallback((value2, errorSchema, id) => {
|
|
@@ -19244,10 +19438,10 @@ function StringField(props) {
|
|
|
19244
19438
|
var StringField_default = StringField;
|
|
19245
19439
|
|
|
19246
19440
|
// node_modules/.pnpm/@rjsf+core@5.24.13_@rjsf+utils@5.24.13_react@16.14.0__react@16.14.0/node_modules/@rjsf/core/lib/components/fields/NullField.js
|
|
19247
|
-
import { useEffect as
|
|
19441
|
+
import { useEffect as useEffect3 } from "react";
|
|
19248
19442
|
function NullField(props) {
|
|
19249
19443
|
const { formData, onChange } = props;
|
|
19250
|
-
|
|
19444
|
+
useEffect3(() => {
|
|
19251
19445
|
if (formData === void 0) {
|
|
19252
19446
|
onChange(null);
|
|
19253
19447
|
}
|
|
@@ -19588,7 +19782,7 @@ var templates_default = templates;
|
|
|
19588
19782
|
|
|
19589
19783
|
// node_modules/.pnpm/@rjsf+core@5.24.13_@rjsf+utils@5.24.13_react@16.14.0__react@16.14.0/node_modules/@rjsf/core/lib/components/widgets/AltDateWidget.js
|
|
19590
19784
|
import { jsx as _jsx27, jsxs as _jsxs14 } from "react/jsx-runtime.js";
|
|
19591
|
-
import { useCallback as useCallback4, useEffect as
|
|
19785
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useReducer, useState as useState4 } from "react";
|
|
19592
19786
|
function readyForChange(state) {
|
|
19593
19787
|
return Object.values(state).every((value) => value !== -1);
|
|
19594
19788
|
}
|
|
@@ -19599,11 +19793,11 @@ function DateElement({ type, range, value, select, rootId, name, disabled, reado
|
|
|
19599
19793
|
}
|
|
19600
19794
|
function AltDateWidget({ time = false, disabled = false, readonly = false, autofocus = false, options, id, name, registry, onBlur, onFocus, onChange, value }) {
|
|
19601
19795
|
const { translateString } = registry;
|
|
19602
|
-
const [lastValue, setLastValue] =
|
|
19796
|
+
const [lastValue, setLastValue] = useState4(value);
|
|
19603
19797
|
const [state, setState] = useReducer((state2, action) => {
|
|
19604
19798
|
return { ...state2, ...action };
|
|
19605
19799
|
}, parseDateString(value, time));
|
|
19606
|
-
|
|
19800
|
+
useEffect4(() => {
|
|
19607
19801
|
const stateValue = toDateString(state, time);
|
|
19608
19802
|
if (readyForChange(state) && stateValue !== value) {
|
|
19609
19803
|
onChange(stateValue);
|
|
@@ -19764,7 +19958,7 @@ function FileInfoPreview({ fileInfo, registry }) {
|
|
|
19764
19958
|
}
|
|
19765
19959
|
return _jsxs17(_Fragment3, { children: [" ", _jsx35("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(TranslatableString.PreviewLabel) })] });
|
|
19766
19960
|
}
|
|
19767
|
-
function FilesInfo({ filesInfo, registry, preview, onRemove, options }) {
|
|
19961
|
+
function FilesInfo({ filesInfo, registry, preview: preview2, onRemove, options }) {
|
|
19768
19962
|
if (filesInfo.length === 0) {
|
|
19769
19963
|
return null;
|
|
19770
19964
|
}
|
|
@@ -19773,7 +19967,7 @@ function FilesInfo({ filesInfo, registry, preview, onRemove, options }) {
|
|
|
19773
19967
|
return _jsx35("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
|
|
19774
19968
|
const { name, size, type } = fileInfo;
|
|
19775
19969
|
const handleRemove = () => onRemove(key);
|
|
19776
|
-
return _jsxs17("li", { children: [_jsx35(index_modern_default, { children: translateString(TranslatableString.FilesInfo, [name, type, String(size)]) }),
|
|
19970
|
+
return _jsxs17("li", { children: [_jsx35(index_modern_default, { children: translateString(TranslatableString.FilesInfo, [name, type, String(size)]) }), preview2 && _jsx35(FileInfoPreview, { fileInfo, registry }), _jsx35(RemoveButton2, { onClick: handleRemove, registry })] }, key);
|
|
19777
19971
|
}) });
|
|
19778
19972
|
}
|
|
19779
19973
|
function extractFileInfo(dataURLs) {
|
|
@@ -21108,14 +21302,182 @@ function fieldErrors(issues) {
|
|
|
21108
21302
|
return root2;
|
|
21109
21303
|
}
|
|
21110
21304
|
|
|
21305
|
+
// dist/rjsf-templates.js
|
|
21306
|
+
import * as React3 from "react";
|
|
21307
|
+
var ItemNumber = React3.createContext(1);
|
|
21308
|
+
var PropertyKey = React3.createContext(void 0);
|
|
21309
|
+
function valueFieldTemplate(DefaultTemplate, flag) {
|
|
21310
|
+
return function ValueField2(props) {
|
|
21311
|
+
if (!(flag in props.schema))
|
|
21312
|
+
return React3.createElement(DefaultTemplate, { ...props });
|
|
21313
|
+
return React3.createElement(
|
|
21314
|
+
PropertyKey.Provider,
|
|
21315
|
+
{ value: props.label },
|
|
21316
|
+
React3.createElement(DefaultTemplate, { ...props, label: "\u5024" })
|
|
21317
|
+
);
|
|
21318
|
+
};
|
|
21319
|
+
}
|
|
21320
|
+
function numberedObjectTemplate(DefaultTemplate, flag) {
|
|
21321
|
+
return function ObjectItems2(props) {
|
|
21322
|
+
let number = 0;
|
|
21323
|
+
const properties = props.properties.map((property2) => {
|
|
21324
|
+
var _a;
|
|
21325
|
+
const schema4 = (_a = props.schema.properties) === null || _a === void 0 ? void 0 : _a[property2.name];
|
|
21326
|
+
if (!schema4 || typeof schema4 !== "object" || !(flag in schema4) || property2.hidden)
|
|
21327
|
+
return property2;
|
|
21328
|
+
return { ...property2, content: React3.createElement(ItemNumber.Provider, { key: property2.name, value: ++number }, property2.content) };
|
|
21329
|
+
});
|
|
21330
|
+
return React3.createElement(DefaultTemplate, { ...props, properties });
|
|
21331
|
+
};
|
|
21332
|
+
}
|
|
21333
|
+
function additionalItemTemplate(flag) {
|
|
21334
|
+
return function AdditionalItem2(props) {
|
|
21335
|
+
const number = React3.useContext(ItemNumber);
|
|
21336
|
+
const propertyKey = React3.useContext(PropertyKey);
|
|
21337
|
+
const { id, classNames, style, children, schema: schema4, label, disabled, readonly, onKeyChange, onDropPropertyClick } = props;
|
|
21338
|
+
if (!(flag in schema4))
|
|
21339
|
+
return React3.createElement("div", { className: classNames, style }, children);
|
|
21340
|
+
const key = propertyKey !== null && propertyKey !== void 0 ? propertyKey : label;
|
|
21341
|
+
return React3.createElement(
|
|
21342
|
+
"div",
|
|
21343
|
+
{ className: classNames, style, "data-block-editor-item": "" },
|
|
21344
|
+
React3.createElement(
|
|
21345
|
+
"div",
|
|
21346
|
+
{ "data-block-editor-item-heading": "" },
|
|
21347
|
+
React3.createElement(
|
|
21348
|
+
"span",
|
|
21349
|
+
null,
|
|
21350
|
+
"\u30FB\u9805\u76EE",
|
|
21351
|
+
number
|
|
21352
|
+
),
|
|
21353
|
+
React3.createElement(ItemMenu, { disabled: disabled || readonly, onClick: onDropPropertyClick(key) })
|
|
21354
|
+
),
|
|
21355
|
+
React3.createElement(
|
|
21356
|
+
"div",
|
|
21357
|
+
{ "data-block-editor-pair-row": "" },
|
|
21358
|
+
React3.createElement("label", { htmlFor: `${id}-key` }, "\u30AD\u30FC"),
|
|
21359
|
+
React3.createElement("input", { id: `${id}-key`, type: "text", defaultValue: key, disabled, readOnly: readonly, onBlur: (event) => onKeyChange(event.target.value) })
|
|
21360
|
+
),
|
|
21361
|
+
React3.createElement("div", { "data-block-editor-pair-row": "" }, children)
|
|
21362
|
+
);
|
|
21363
|
+
};
|
|
21364
|
+
}
|
|
21365
|
+
function ItemMenu({ disabled, onClick }) {
|
|
21366
|
+
const [open, setOpen] = React3.useState(false);
|
|
21367
|
+
const container = React3.useRef(null);
|
|
21368
|
+
const trigger = React3.useRef(null);
|
|
21369
|
+
const item = React3.useRef(null);
|
|
21370
|
+
React3.useEffect(() => {
|
|
21371
|
+
var _a;
|
|
21372
|
+
if (!open)
|
|
21373
|
+
return;
|
|
21374
|
+
(_a = item.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
21375
|
+
const closeOutside = (event) => {
|
|
21376
|
+
var _a2;
|
|
21377
|
+
if (!((_a2 = container.current) === null || _a2 === void 0 ? void 0 : _a2.contains(event.target)))
|
|
21378
|
+
setOpen(false);
|
|
21379
|
+
};
|
|
21380
|
+
const keepEscapeInMenu = (event) => {
|
|
21381
|
+
var _a2;
|
|
21382
|
+
if (event.key !== "Escape" || event.isComposing || event.keyCode === 229)
|
|
21383
|
+
return;
|
|
21384
|
+
event.preventDefault();
|
|
21385
|
+
event.stopPropagation();
|
|
21386
|
+
setOpen(false);
|
|
21387
|
+
(_a2 = trigger.current) === null || _a2 === void 0 ? void 0 : _a2.focus();
|
|
21388
|
+
};
|
|
21389
|
+
const menu = container.current;
|
|
21390
|
+
menu === null || menu === void 0 ? void 0 : menu.addEventListener("keydown", keepEscapeInMenu);
|
|
21391
|
+
document.addEventListener("mousedown", closeOutside);
|
|
21392
|
+
return () => {
|
|
21393
|
+
menu === null || menu === void 0 ? void 0 : menu.removeEventListener("keydown", keepEscapeInMenu);
|
|
21394
|
+
document.removeEventListener("mousedown", closeOutside);
|
|
21395
|
+
};
|
|
21396
|
+
}, [open]);
|
|
21397
|
+
React3.useEffect(() => {
|
|
21398
|
+
if (disabled)
|
|
21399
|
+
setOpen(false);
|
|
21400
|
+
}, [disabled]);
|
|
21401
|
+
return React3.createElement(
|
|
21402
|
+
"div",
|
|
21403
|
+
{ "data-block-editor-item-menu": "", ref: container, onBlur: (event) => {
|
|
21404
|
+
if (!event.currentTarget.contains(event.relatedTarget))
|
|
21405
|
+
setOpen(false);
|
|
21406
|
+
}, onKeyDown: (event) => {
|
|
21407
|
+
var _a, _b;
|
|
21408
|
+
if (event.key === "Escape" && open && !event.nativeEvent.isComposing && event.keyCode !== 229) {
|
|
21409
|
+
event.preventDefault();
|
|
21410
|
+
event.stopPropagation();
|
|
21411
|
+
setOpen(false);
|
|
21412
|
+
(_a = trigger.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
21413
|
+
} else if (["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) {
|
|
21414
|
+
event.preventDefault();
|
|
21415
|
+
if (open)
|
|
21416
|
+
(_b = item.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
21417
|
+
else if (!disabled)
|
|
21418
|
+
setOpen(true);
|
|
21419
|
+
}
|
|
21420
|
+
} },
|
|
21421
|
+
React3.createElement("button", { "aria-label": "\u9805\u76EE\u306E\u30E1\u30CB\u30E5\u30FC", "aria-haspopup": "menu", "aria-expanded": open && !disabled, disabled, ref: trigger, type: "button", onClick: () => setOpen(!open) }, "\u2026"),
|
|
21422
|
+
open && !disabled ? React3.createElement(
|
|
21423
|
+
"div",
|
|
21424
|
+
{ role: "menu", "aria-label": "\u9805\u76EE\u306E\u64CD\u4F5C" },
|
|
21425
|
+
React3.createElement("button", { ref: item, role: "menuitem", type: "button", onClick: (event) => {
|
|
21426
|
+
var _a;
|
|
21427
|
+
setOpen(false);
|
|
21428
|
+
(_a = trigger.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
21429
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
21430
|
+
} }, "\u{1F5D1}\uFE0F\u3053\u306E\u9805\u76EE\u3092\u524A\u9664")
|
|
21431
|
+
) : null
|
|
21432
|
+
);
|
|
21433
|
+
}
|
|
21434
|
+
function AddItemButton({ disabled, onClick, className }) {
|
|
21435
|
+
return React3.createElement("button", { className, "data-block-editor-add-item": "", disabled, type: "button", onClick }, "\u2795\u9805\u76EE\u3092\u8FFD\u52A0");
|
|
21436
|
+
}
|
|
21437
|
+
function ArrayItem(props) {
|
|
21438
|
+
const { children, className, disabled, readonly, index, hasMoveUp, hasMoveDown, hasCopy, hasRemove, onReorderClick, onCopyIndexClick, onDropIndexClick } = props;
|
|
21439
|
+
const locked = disabled || readonly;
|
|
21440
|
+
return React3.createElement(
|
|
21441
|
+
"div",
|
|
21442
|
+
{ className, "data-block-editor-item": "" },
|
|
21443
|
+
React3.createElement(
|
|
21444
|
+
"div",
|
|
21445
|
+
{ "data-block-editor-item-heading": "" },
|
|
21446
|
+
React3.createElement(
|
|
21447
|
+
"span",
|
|
21448
|
+
null,
|
|
21449
|
+
"\u30FB\u9805\u76EE",
|
|
21450
|
+
index + 1
|
|
21451
|
+
),
|
|
21452
|
+
React3.createElement(
|
|
21453
|
+
"div",
|
|
21454
|
+
{ "data-block-editor-item-actions": "" },
|
|
21455
|
+
hasMoveUp || hasMoveDown ? React3.createElement(
|
|
21456
|
+
React3.Fragment,
|
|
21457
|
+
null,
|
|
21458
|
+
React3.createElement("button", { "aria-label": "\u9805\u76EE\u3092\u4E0A\u3078\u79FB\u52D5", disabled: locked || !hasMoveUp, type: "button", onClick: onReorderClick(index, index - 1) }, "\u2191"),
|
|
21459
|
+
React3.createElement("button", { "aria-label": "\u9805\u76EE\u3092\u4E0B\u3078\u79FB\u52D5", disabled: locked || !hasMoveDown, type: "button", onClick: onReorderClick(index, index + 1) }, "\u2193")
|
|
21460
|
+
) : null,
|
|
21461
|
+
hasCopy ? React3.createElement("button", { disabled: locked, type: "button", onClick: onCopyIndexClick(index) }, "\u9805\u76EE\u3092\u8907\u88FD") : null,
|
|
21462
|
+
hasRemove ? React3.createElement(ItemMenu, { disabled: locked, onClick: onDropIndexClick(index) }) : null
|
|
21463
|
+
)
|
|
21464
|
+
),
|
|
21465
|
+
children
|
|
21466
|
+
);
|
|
21467
|
+
}
|
|
21468
|
+
|
|
21111
21469
|
// dist/rjsf.js
|
|
21112
21470
|
function moduleExports4(namespace) {
|
|
21113
21471
|
const fallback = namespace.default;
|
|
21114
21472
|
return fallback && typeof fallback === "object" && "__esModule" in fallback ? fallback : namespace;
|
|
21115
21473
|
}
|
|
21116
21474
|
var Form2 = moduleExports4(lib_exports2).default;
|
|
21117
|
-
var { getDefaultFormState: getDefaultFormState2 } = moduleExports4(lib_exports);
|
|
21475
|
+
var { getDefaultFormState: getDefaultFormState2, ADDITIONAL_PROPERTY_FLAG: ADDITIONAL_PROPERTY_FLAG2 } = moduleExports4(lib_exports);
|
|
21118
21476
|
var { customizeValidator: customizeValidator2 } = moduleExports4(lib_exports3);
|
|
21477
|
+
var defaultTemplates = moduleExports4(lib_exports2).getDefaultRegistry().templates;
|
|
21478
|
+
var ObjectItems = numberedObjectTemplate(defaultTemplates.ObjectFieldTemplate, ADDITIONAL_PROPERTY_FLAG2);
|
|
21479
|
+
var AdditionalItem = additionalItemTemplate(ADDITIONAL_PROPERTY_FLAG2);
|
|
21480
|
+
var ValueField = valueFieldTemplate(defaultTemplates.FieldTemplate, ADDITIONAL_PROPERTY_FLAG2);
|
|
21119
21481
|
var nextViewId = 0;
|
|
21120
21482
|
function createSchemaBundleEditor(options) {
|
|
21121
21483
|
const { schemaBundle, validationContext: provider, ownerValidate, apiVersion, extensionId, editorId, opcodes, argument, format, uiSchema, validateData } = options;
|
|
@@ -21164,14 +21526,34 @@ function createSchemaBundleEditor(options) {
|
|
|
21164
21526
|
...validateData === void 0 ? {} : { validateData }
|
|
21165
21527
|
}, { issuesFor, dialect: result.validator.dialect });
|
|
21166
21528
|
}
|
|
21167
|
-
function createBlockEditorService() {
|
|
21529
|
+
function createBlockEditorService(options) {
|
|
21530
|
+
if ((options === null || options === void 0 ? void 0 : options.fixedInputs) !== void 0 && typeof options.fixedInputs !== "boolean")
|
|
21531
|
+
throw new TypeError("Invalid fixed input capability option.");
|
|
21532
|
+
const messageSource = options === null || options === void 0 ? void 0 : options.fixedInputMessages;
|
|
21533
|
+
const fixedMessages = typeof messageSource === "function" ? messageSource : captureFixedInputMessages(messageSource);
|
|
21168
21534
|
const registry = new EditorRegistry();
|
|
21169
21535
|
const listeners = /* @__PURE__ */ new Set();
|
|
21170
21536
|
const notify = () => {
|
|
21171
21537
|
for (const listener of [...listeners])
|
|
21172
21538
|
listener();
|
|
21173
21539
|
};
|
|
21540
|
+
const fixed = (options === null || options === void 0 ? void 0 : options.fixedInputs) === true ? {
|
|
21541
|
+
registerFixedInputEditor: (definition) => {
|
|
21542
|
+
const fixedDefinition = createFixedInputEditor(definition);
|
|
21543
|
+
const remove = registry.registerFixed({ ...fixedDefinition, mount: (container, context) => mountFixedInputView(container, context, resolveFixedInputMessages(fixedMessages)) });
|
|
21544
|
+
notify();
|
|
21545
|
+
let active = true;
|
|
21546
|
+
return () => {
|
|
21547
|
+
if (active) {
|
|
21548
|
+
active = false;
|
|
21549
|
+
remove();
|
|
21550
|
+
notify();
|
|
21551
|
+
}
|
|
21552
|
+
};
|
|
21553
|
+
}
|
|
21554
|
+
} : {};
|
|
21174
21555
|
const api = Object.freeze({
|
|
21556
|
+
...fixed,
|
|
21175
21557
|
apiVersion: EDITOR_API_VERSION,
|
|
21176
21558
|
register: (definition) => {
|
|
21177
21559
|
const custom = definition;
|
|
@@ -21284,7 +21666,7 @@ function createSchemaEditorImpl(options, bundle) {
|
|
|
21284
21666
|
if (context.getState().issues.length === 0) {
|
|
21285
21667
|
context.setValidationIssues(issuesFor(dataFor(context.getDraft())));
|
|
21286
21668
|
}
|
|
21287
|
-
const
|
|
21669
|
+
const render4 = () => {
|
|
21288
21670
|
if (!active)
|
|
21289
21671
|
return;
|
|
21290
21672
|
const state = context.getState();
|
|
@@ -21293,6 +21675,13 @@ function createSchemaEditorImpl(options, bundle) {
|
|
|
21293
21675
|
uiSchema,
|
|
21294
21676
|
validator,
|
|
21295
21677
|
idPrefix,
|
|
21678
|
+
templates: {
|
|
21679
|
+
ArrayFieldItemTemplate: ArrayItem,
|
|
21680
|
+
ObjectFieldTemplate: ObjectItems,
|
|
21681
|
+
WrapIfAdditionalTemplate: AdditionalItem,
|
|
21682
|
+
FieldTemplate: ValueField,
|
|
21683
|
+
ButtonTemplates: { AddButton: AddItemButton, RemoveButton: ItemMenu }
|
|
21684
|
+
},
|
|
21296
21685
|
formData: dataFor(context.getDraft()),
|
|
21297
21686
|
// Defaults belong to read(), not subsequent renders or remounts.
|
|
21298
21687
|
experimental_defaultFormStateBehavior: {
|
|
@@ -21313,7 +21702,7 @@ function createSchemaEditorImpl(options, bundle) {
|
|
|
21313
21702
|
context.setValidationIssues(issuesFor(data));
|
|
21314
21703
|
}
|
|
21315
21704
|
};
|
|
21316
|
-
|
|
21705
|
+
ReactDOM3.render(React4.createElement(Form2, props, React4.createElement("span", { hidden: true })), container);
|
|
21317
21706
|
};
|
|
21318
21707
|
const schedule = () => {
|
|
21319
21708
|
if (scheduled || !active)
|
|
@@ -21322,28 +21711,29 @@ function createSchemaEditorImpl(options, bundle) {
|
|
|
21322
21711
|
void Promise.resolve().then(() => {
|
|
21323
21712
|
scheduled = false;
|
|
21324
21713
|
if (active)
|
|
21325
|
-
|
|
21714
|
+
render4();
|
|
21326
21715
|
});
|
|
21327
21716
|
};
|
|
21328
21717
|
unsubscribe = context.subscribe(schedule);
|
|
21329
21718
|
try {
|
|
21330
|
-
|
|
21719
|
+
render4();
|
|
21331
21720
|
} catch (error) {
|
|
21332
21721
|
active = false;
|
|
21333
21722
|
unsubscribe();
|
|
21334
|
-
|
|
21723
|
+
ReactDOM3.unmountComponentAtNode(container);
|
|
21335
21724
|
throw error;
|
|
21336
21725
|
}
|
|
21337
21726
|
return () => {
|
|
21338
21727
|
active = false;
|
|
21339
21728
|
unsubscribe();
|
|
21340
|
-
|
|
21729
|
+
ReactDOM3.unmountComponentAtNode(container);
|
|
21341
21730
|
};
|
|
21342
21731
|
}
|
|
21343
21732
|
};
|
|
21344
21733
|
}
|
|
21345
21734
|
export {
|
|
21346
21735
|
createBlockEditorService,
|
|
21736
|
+
createFixedInputEditor,
|
|
21347
21737
|
createSchemaBundleEditor,
|
|
21348
21738
|
createSchemaEditor,
|
|
21349
21739
|
createSourceEditor
|