@sdata/web-vue 3.18.0 → 3.20.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.
- package/dist/sd.css +489 -0
- package/dist/sd.min.css +2 -2
- package/es/_components/icon-hover.vue.d.ts +1 -1
- package/es/_components/input-label/input-label.d.ts +13 -1
- package/es/_components/input-label/input-label.js +35 -5
- package/es/_components/input-label/style/index.css +6 -0
- package/es/_components/input-label/style/input-label.scss +8 -0
- package/es/_components/picker/input-range.vue.d.ts +24 -1
- package/es/_components/picker/input-range.vue_vue_type_script_setup_true_lang.js +42 -6
- package/es/_components/picker/input.vue.d.ts +24 -1
- package/es/_components/picker/input.vue_vue_type_script_setup_true_lang.js +31 -4
- package/es/_components/picker/style/index.scss +8 -0
- package/es/_components/select-view/select-view.d.ts +15 -3
- package/es/_components/select-view/select-view.js +10 -1
- package/es/_components/select-view/style/index.css +12 -0
- package/es/_components/virtual-list/virtual-list.vue.d.ts +6 -6
- package/es/_hooks/use-fit-width.d.ts +22 -0
- package/es/_hooks/use-fit-width.js +76 -0
- package/es/_hooks/use-form-item.d.ts +1 -1
- package/es/_hooks/use-size.d.ts +1 -1
- package/es/anchor/anchor.vue.d.ts +1 -1
- package/es/anchor/index.d.ts +3 -3
- package/es/auto-complete/auto-complete.d.ts +20 -2
- package/es/auto-complete/auto-complete.js +18 -0
- package/es/auto-complete/index.d.ts +36 -6
- package/es/basic-crud-table/basic-crud-table.vue.d.ts +2 -2
- package/es/basic-crud-table/basic-crud-table.vue_vue_type_script_setup_true_lang.js +6 -4
- package/es/basic-crud-table/index.d.ts +5 -5
- package/es/basic-crud-table/types.d.ts +2 -0
- package/es/button/button.vue.d.ts +2 -2
- package/es/button/index.d.ts +6 -6
- package/es/card/card.d.ts +25 -3
- package/es/card/card.js +11 -2
- package/es/card/index.d.ts +45 -6
- package/es/carousel/carousel-indicator.vue.d.ts +1 -1
- package/es/cascader/base-cascader-panel.d.ts +4 -1
- package/es/cascader/base-cascader-panel.js +2 -1
- package/es/cascader/cascader-option.d.ts +1 -1
- package/es/cascader/cascader-panel.vue.d.ts +1 -1
- package/es/cascader/cascader-search-panel.d.ts +4 -1
- package/es/cascader/cascader-search-panel.js +2 -1
- package/es/cascader/cascader.vue.d.ts +7 -5
- package/es/cascader/cascader.vue_vue_type_script_setup_true_lang.js +22 -2
- package/es/cascader/types.d.ts +4 -1
- package/es/checkbox/checkbox.d.ts +3 -3
- package/es/checkbox/index.d.ts +6 -6
- package/es/collapse/collapse-item.d.ts +3 -3
- package/es/collapse/index.d.ts +3 -3
- package/es/color-picker/color-picker.d.ts +2 -2
- package/es/color-picker/index.d.ts +6 -6
- package/es/components.d.ts +4 -0
- package/es/config-provider/config-provider.vue.d.ts +68 -1
- package/es/config-provider/config-provider.vue_vue_type_script_setup_true_lang.js +67 -1
- package/es/config-provider/context.d.ts +12 -0
- package/es/config-provider/index.d.ts +102 -3
- package/es/date-picker/index.d.ts +87 -23
- package/es/date-picker/interface.d.ts +2 -1
- package/es/date-picker/picker-panel.vue.d.ts +1 -1
- package/es/date-picker/picker.vue.d.ts +39 -17
- package/es/date-picker/picker.vue_vue_type_script_setup_true_lang.js +30 -1
- package/es/date-picker/pickers/date-picker.d.ts +18 -0
- package/es/date-picker/pickers/date-picker.js +16 -0
- package/es/date-picker/range-picker-panel.vue.d.ts +1 -1
- package/es/date-picker/range-picker.vue.d.ts +39 -17
- package/es/date-picker/range-picker.vue_vue_type_script_setup_true_lang.js +27 -1
- package/es/date-picker/style/index.css +6 -0
- package/es/descriptions/descriptions.d.ts +3 -3
- package/es/descriptions/index.d.ts +9 -9
- package/es/divider/divider.d.ts +1 -1
- package/es/divider/index.d.ts +3 -3
- package/es/drawer/drawer.vue.d.ts +4 -4
- package/es/drawer/drawer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/drawer/index.d.ts +11 -11
- package/es/dropdown/dropdown-button.vue.d.ts +2 -2
- package/es/dropdown/dropdown-option.vue.d.ts +1 -1
- package/es/dropdown/dropdown-submenu.vue.d.ts +2 -2
- package/es/dropdown/dropdown.vue.d.ts +1 -1
- package/es/dropdown/index.d.ts +21 -21
- package/es/ellipsis/ellipsis.vue.d.ts +1 -1
- package/es/ellipsis/index.d.ts +6 -6
- package/es/ellipsis/performant-ellipsis.vue.d.ts +1 -1
- package/es/form/form-item.vue.d.ts +1 -1
- package/es/form/form.vue.d.ts +1 -1
- package/es/form/index.d.ts +9 -9
- package/es/grid/grid-row.vue.d.ts +3 -3
- package/es/grid/index.d.ts +9 -9
- package/es/icon/icon-arrow-up/icon-arrow-up.js +5 -0
- package/es/icon/icon-arrow-up/icon-arrow-up.vue_vue_type_script_setup_true_lang.js +52 -0
- package/es/icon/icon-arrow-up/index.js +9 -0
- package/es/icon/icon-mute/icon-mute.js +5 -0
- package/es/icon/icon-mute/icon-mute.vue_vue_type_script_setup_true_lang.js +52 -0
- package/es/icon/icon-mute/index.js +9 -0
- package/es/icon/icon-voice/icon-voice.js +5 -0
- package/es/icon/icon-voice/icon-voice.vue_vue_type_script_setup_true_lang.js +52 -0
- package/es/icon/icon-voice/index.js +9 -0
- package/es/image/preview-action.d.ts +6 -6
- package/es/image/preview-group.vue.d.ts +1 -1
- package/es/index.css +489 -0
- package/es/index.d.ts +6 -1
- package/es/index.js +5 -1
- package/es/index.scss +2 -0
- package/es/input/index.d.ts +99 -6
- package/es/input/input-password.vue.d.ts +18 -0
- package/es/input/input-password.vue_vue_type_script_setup_true_lang.js +24 -2
- package/es/input/input-search.d.ts +18 -0
- package/es/input/input-search.js +20 -2
- package/es/input/input.d.ts +29 -2
- package/es/input/input.js +45 -3
- package/es/input/style/index.css +16 -0
- package/es/input/style/index.scss +21 -0
- package/es/input-number/index.d.ts +36 -6
- package/es/input-number/input-number.d.ts +20 -2
- package/es/input-number/input-number.js +19 -0
- package/es/input-tag/index.d.ts +36 -6
- package/es/input-tag/input-tag.d.ts +20 -2
- package/es/input-tag/input-tag.js +35 -4
- package/es/input-tag/style/index.css +6 -0
- package/es/input-tag/style/input-tag.scss +8 -0
- package/es/kv-list/index.d.ts +72 -32
- package/es/link/index.d.ts +6 -6
- package/es/link/link.vue.d.ts +2 -2
- package/es/list/index.d.ts +9 -0
- package/es/list/list.d.ts +7 -0
- package/es/list/list.js +8 -2
- package/es/locale/interface.d.ts +22 -0
- package/es/locale/lang/ar-eg.js +21 -1
- package/es/locale/lang/de-de.js +21 -1
- package/es/locale/lang/en-us.js +21 -1
- package/es/locale/lang/es-es.js +21 -1
- package/es/locale/lang/fr-fr.js +21 -1
- package/es/locale/lang/id-id.js +21 -1
- package/es/locale/lang/it-it.js +21 -1
- package/es/locale/lang/ja-jp.js +21 -1
- package/es/locale/lang/km-kh.js +21 -1
- package/es/locale/lang/ko-kr.js +21 -1
- package/es/locale/lang/ms-my.js +21 -1
- package/es/locale/lang/nl-nl.js +21 -1
- package/es/locale/lang/pt-pt.js +21 -1
- package/es/locale/lang/ru-ru.js +21 -1
- package/es/locale/lang/th-th.js +21 -1
- package/es/locale/lang/vi-vn.js +21 -1
- package/es/locale/lang/zh-cn.js +21 -1
- package/es/locale/lang/zh-tw.js +21 -1
- package/es/mention/index.d.ts +39 -9
- package/es/mention/mention.d.ts +21 -3
- package/es/mention/mention.js +24 -1
- package/es/mention/style/index.css +6 -0
- package/es/mention/style/index.scss +8 -0
- package/es/menu/item.d.ts +1 -1
- package/es/message/message-list.d.ts +1 -1
- package/es/modal/index.d.ts +9 -9
- package/es/modal/modal.vue.d.ts +3 -3
- package/es/modal/modal.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/popconfirm/index.d.ts +3 -3
- package/es/popconfirm/popconfirm.vue.d.ts +1 -1
- package/es/popover/index.d.ts +6 -6
- package/es/popover/popover.vue.d.ts +2 -2
- package/es/progress/circle.vue.d.ts +1 -1
- package/es/progress/line.vue.d.ts +1 -1
- package/es/qr-code/index.d.ts +27 -21
- package/es/qr-code/qr-code.vue.d.ts +8 -6
- package/es/qr-code/qr-code.vue_vue_type_script_setup_true_lang.js +5 -2
- package/es/radio/index.d.ts +6 -6
- package/es/radio/radio.d.ts +3 -3
- package/es/rate/index.d.ts +3 -3
- package/es/rate/rate.d.ts +1 -1
- package/es/resize-box/index.d.ts +5 -5
- package/es/resize-box/resize-box.vue.d.ts +3 -3
- package/es/rich-text-editor/built-in-components.d.ts +5 -0
- package/es/rich-text-editor/built-in-components.js +6 -0
- package/es/rich-text-editor/index.d.ts +195 -0
- package/es/rich-text-editor/index.js +12 -0
- package/es/rich-text-editor/nodes/inline-component-node.d.ts +30 -0
- package/es/rich-text-editor/nodes/inline-component-node.js +86 -0
- package/es/rich-text-editor/rich-text-editor.js +5 -0
- package/es/rich-text-editor/rich-text-editor.vue.d.ts +76 -0
- package/es/rich-text-editor/rich-text-editor.vue_vue_type_script_setup_true_lang.js +630 -0
- package/es/rich-text-editor/rich-text-node-renderer.js +5 -0
- package/es/rich-text-editor/rich-text-node-renderer.vue.d.ts +28 -0
- package/es/rich-text-editor/rich-text-node-renderer.vue_vue_type_script_setup_true_lang.js +133 -0
- package/es/rich-text-editor/style/css.js +2 -0
- package/es/rich-text-editor/style/index.css +164 -0
- package/es/rich-text-editor/style/index.d.ts +2 -0
- package/es/rich-text-editor/style/index.js +2 -0
- package/es/rich-text-editor/style/index.scss +193 -0
- package/es/rich-text-editor/style/token.scss +36 -0
- package/es/rich-text-editor/types.d.ts +148 -0
- package/es/sd-vue.js +6 -0
- package/es/select/index.d.ts +117 -54
- package/es/select/interface.d.ts +2 -1
- package/es/select/select-dropdown.vue.d.ts +3 -0
- package/es/select/select-dropdown.vue_vue_type_script_setup_true_lang.js +2 -4
- package/es/select/select.d.ts +62 -25
- package/es/select/select.js +28 -1
- package/es/sender/context.d.ts +8 -0
- package/es/sender/context.js +4 -0
- package/es/sender/index.d.ts +119 -0
- package/es/sender/index.js +20 -0
- package/es/sender/sender-header.js +5 -0
- package/es/sender/sender-header.vue.d.ts +28 -0
- package/es/sender/sender-header.vue_vue_type_script_setup_true_lang.js +127 -0
- package/es/sender/sender-switch.js +5 -0
- package/es/sender/sender-switch.vue.d.ts +32 -0
- package/es/sender/sender-switch.vue_vue_type_script_setup_true_lang.js +95 -0
- package/es/sender/sender.js +5 -0
- package/es/sender/sender.vue_vue_type_script_setup_true_lang.js +895 -0
- package/es/sender/style/css.js +3 -0
- package/es/sender/style/index.css +301 -0
- package/es/sender/style/index.d.ts +3 -0
- package/es/sender/style/index.js +3 -0
- package/es/sender/style/index.scss +359 -0
- package/es/sender/style/token.scss +43 -0
- package/es/sender/types.d.ts +228 -0
- package/es/sender/use-speech.d.ts +19 -0
- package/es/sender/use-speech.js +338 -0
- package/es/slider/index.d.ts +3 -3
- package/es/slider/slider-input.vue.d.ts +1 -1
- package/es/slider/slider.vue.d.ts +1 -1
- package/es/space/index.d.ts +9 -9
- package/es/space/space.d.ts +2 -2
- package/es/spin/index.d.ts +18 -3
- package/es/spin/spin.d.ts +10 -1
- package/es/spin/spin.js +72 -10
- package/es/statistic/index.d.ts +3 -3
- package/es/statistic/statistic.vue.d.ts +1 -1
- package/es/steps/index.d.ts +5 -5
- package/es/steps/step.vue.d.ts +2 -2
- package/es/steps/steps.vue.d.ts +1 -1
- package/es/table/index.d.ts +68 -23
- package/es/table/interface.d.ts +3 -0
- package/es/table/table-column.d.ts +1 -1
- package/es/table/table-operation-td.d.ts +12 -12
- package/es/table/table-td.d.ts +2 -2
- package/es/table/table.d.ts +27 -8
- package/es/table/table.js +7 -2
- package/es/tabs/index.d.ts +12 -12
- package/es/tabs/tabs-nav.d.ts +1 -1
- package/es/tabs/tabs.d.ts +4 -4
- package/es/tag/index.d.ts +6 -6
- package/es/tag/tag.vue.d.ts +2 -2
- package/es/textarea/index.d.ts +38 -8
- package/es/textarea/style/index.css +6 -0
- package/es/textarea/style/index.scss +8 -0
- package/es/textarea/textarea.vue.d.ts +21 -3
- package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +36 -3
- package/es/time-picker/index.d.ts +36 -6
- package/es/time-picker/interface.d.ts +2 -1
- package/es/time-picker/range-panel.js +58 -0
- package/es/time-picker/time-picker.vue.d.ts +20 -2
- package/es/time-picker/time-picker.vue_vue_type_script_setup_true_lang.js +30 -1
- package/es/timeline/index.d.ts +45 -6
- package/es/timeline/timeline.d.ts +25 -3
- package/es/timeline/timeline.js +11 -2
- package/es/toolbar/toolbar.vue_vue_type_script_setup_true_lang.js +9 -5
- package/es/toolbar/types.d.ts +2 -0
- package/es/tooltip/index.d.ts +6 -6
- package/es/tooltip/tooltip.vue.d.ts +2 -2
- package/es/tour/index.d.ts +3 -3
- package/es/tour/tour.vue.d.ts +1 -1
- package/es/transfer/index.d.ts +3 -3
- package/es/transfer/transfer.vue.d.ts +1 -1
- package/es/tree/tree.vue.d.ts +4 -4
- package/es/tree-select/interface.d.ts +2 -1
- package/es/tree-select/tree-select.vue.d.ts +32 -7
- package/es/tree-select/tree-select.vue_vue_type_script_setup_true_lang.js +27 -1
- package/es/trigger/index.d.ts +12 -12
- package/es/trigger/trigger.d.ts +4 -4
- package/es/typography/base.d.ts +4 -4
- package/es/typography/edit-content.vue.d.ts +2 -2
- package/es/upload/index.d.ts +6 -6
- package/es/upload/upload-button.d.ts +1 -1
- package/es/upload/upload.d.ts +2 -2
- package/es/verification-code/index.d.ts +3 -3
- package/es/verification-code/verification-code.d.ts +1 -1
- package/es/watermark/index.d.ts +3 -3
- package/es/watermark/watermark.d.ts +1 -1
- package/json/vetur-attributes.json +295 -2
- package/json/vetur-tags.json +103 -3
- package/json/web-types.json +746 -53
- package/package.json +10 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { configProviderInjectionKey } from "../config-provider/context.js";
|
|
2
|
+
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/objectSpread2.js";
|
|
3
|
+
import { getPrefixCls } from "../_utils/global-config.js";
|
|
4
|
+
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/objectWithoutProperties.js";
|
|
5
|
+
import Tag from "../tag/index.js";
|
|
6
|
+
import { JSON_FORM_COMPONENT_TYPES } from "../json-form/types.js";
|
|
7
|
+
import { resolveJsonFormComponents, shouldStretchJsonFormControl } from "../json-form/utils.js";
|
|
8
|
+
import { computed, createBlock, createElementBlock, createTextVNode, defineComponent, inject, mergeProps, normalizeClass, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, unref, withCtx } from "vue";
|
|
9
|
+
//#region components/rich-text-editor/rich-text-node-renderer.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
+
var _excluded = [
|
|
11
|
+
"class",
|
|
12
|
+
"disabled",
|
|
13
|
+
"readonly"
|
|
14
|
+
];
|
|
15
|
+
var _excluded2 = ["class", "label"];
|
|
16
|
+
var rich_text_node_renderer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent(_objectSpread2(_objectSpread2({}, { name: "RichTextNodeRenderer" }), {}, {
|
|
17
|
+
__name: "rich-text-node-renderer",
|
|
18
|
+
props: {
|
|
19
|
+
node: {},
|
|
20
|
+
disabled: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
readonly: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
emits: ["update", "remove"],
|
|
30
|
+
setup(__props, { emit: __emit }) {
|
|
31
|
+
const emit = __emit;
|
|
32
|
+
const prefixCls = getPrefixCls("rich-text-editor");
|
|
33
|
+
const configProvider = inject(configProviderInjectionKey, void 0);
|
|
34
|
+
const resolvedComponents = computed(() => {
|
|
35
|
+
var _configProvider$jsonF;
|
|
36
|
+
return resolveJsonFormComponents(configProvider === null || configProvider === void 0 || (_configProvider$jsonF = configProvider.jsonForm) === null || _configProvider$jsonF === void 0 ? void 0 : _configProvider$jsonF.components);
|
|
37
|
+
});
|
|
38
|
+
const resolvedComponent = computed(() => resolvedComponents.value[__props.node.name]);
|
|
39
|
+
const componentSupportsFitWidth = computed(() => {
|
|
40
|
+
var _resolvedComponent$va;
|
|
41
|
+
const componentProps = (_resolvedComponent$va = resolvedComponent.value) === null || _resolvedComponent$va === void 0 ? void 0 : _resolvedComponent$va.props;
|
|
42
|
+
return Array.isArray(componentProps) ? componentProps.includes("fitWidth") : Boolean(componentProps && "fitWidth" in componentProps);
|
|
43
|
+
});
|
|
44
|
+
const componentFitWidth = computed(() => {
|
|
45
|
+
var _props$node$props;
|
|
46
|
+
return componentSupportsFitWidth.value && ((_props$node$props = __props.node.props) === null || _props$node$props === void 0 ? void 0 : _props$node$props.fitWidth) !== false;
|
|
47
|
+
});
|
|
48
|
+
const componentDisabled = computed(() => {
|
|
49
|
+
var _props$node$props2;
|
|
50
|
+
return __props.disabled || __props.readonly || ((_props$node$props2 = __props.node.props) === null || _props$node$props2 === void 0 ? void 0 : _props$node$props2.disabled) === true;
|
|
51
|
+
});
|
|
52
|
+
const componentClass = computed(() => [
|
|
53
|
+
`${prefixCls}-component-control`,
|
|
54
|
+
`${prefixCls}-component-${__props.node.name}`,
|
|
55
|
+
{ [`${prefixCls}-component-stretch`]: (shouldStretchJsonFormControl(__props.node.name) || __props.node.name === JSON_FORM_COMPONENT_TYPES.slider) && !componentFitWidth.value }
|
|
56
|
+
]);
|
|
57
|
+
const componentUsesDefaultContent = computed(() => [
|
|
58
|
+
JSON_FORM_COMPONENT_TYPES.checkbox,
|
|
59
|
+
JSON_FORM_COMPONENT_TYPES.radio,
|
|
60
|
+
JSON_FORM_COMPONENT_TYPES.row
|
|
61
|
+
].includes(__props.node.name));
|
|
62
|
+
const componentProps = computed(() => {
|
|
63
|
+
var _props$node$props3;
|
|
64
|
+
const _ref = (_props$node$props3 = __props.node.props) !== null && _props$node$props3 !== void 0 ? _props$node$props3 : {}, { class: _class, disabled: _disabled, readonly: _readonly } = _ref;
|
|
65
|
+
return _objectSpread2(_objectSpread2({}, _objectWithoutProperties(_ref, _excluded)), componentSupportsFitWidth.value ? { fitWidth: componentFitWidth.value } : {});
|
|
66
|
+
});
|
|
67
|
+
const componentLabel = computed(() => {
|
|
68
|
+
var _ref2, _props$node$props$lab, _props$node$props4;
|
|
69
|
+
const label = (_ref2 = (_props$node$props$lab = (_props$node$props4 = __props.node.props) === null || _props$node$props4 === void 0 ? void 0 : _props$node$props4.label) !== null && _props$node$props$lab !== void 0 ? _props$node$props$lab : __props.node.textValue) !== null && _ref2 !== void 0 ? _ref2 : __props.node.value;
|
|
70
|
+
return ["string", "number"].includes(typeof label) ? String(label) : "";
|
|
71
|
+
});
|
|
72
|
+
const tagComponentProps = computed(() => {
|
|
73
|
+
var _props$node$props5;
|
|
74
|
+
const _ref3 = (_props$node$props5 = __props.node.props) !== null && _props$node$props5 !== void 0 ? _props$node$props5 : {}, { class: _class, label: _label } = _ref3;
|
|
75
|
+
return _objectWithoutProperties(_ref3, _excluded2);
|
|
76
|
+
});
|
|
77
|
+
return (_ctx, _cache) => {
|
|
78
|
+
var _props$node$props6, _props$node$props7, _props$node$props9, _props$node$props10;
|
|
79
|
+
return __props.node.name === "tag" ? (openBlock(), createBlock(unref(Tag), mergeProps({ key: 0 }, tagComponentProps.value, {
|
|
80
|
+
closable: Boolean((_props$node$props6 = __props.node.props) === null || _props$node$props6 === void 0 ? void 0 : _props$node$props6.closable) && !__props.disabled && !__props.readonly,
|
|
81
|
+
class: [
|
|
82
|
+
`${unref(prefixCls)}-component-control`,
|
|
83
|
+
`${unref(prefixCls)}-component-tag`,
|
|
84
|
+
(_props$node$props7 = __props.node.props) === null || _props$node$props7 === void 0 ? void 0 : _props$node$props7.class
|
|
85
|
+
],
|
|
86
|
+
onClose: _cache[0] || (_cache[0] = ($event) => emit("remove"))
|
|
87
|
+
}), {
|
|
88
|
+
default: withCtx(() => {
|
|
89
|
+
var _ref4, _props$node$props$lab2, _props$node$props8;
|
|
90
|
+
return [createTextVNode(toDisplayString((_ref4 = (_props$node$props$lab2 = (_props$node$props8 = __props.node.props) === null || _props$node$props8 === void 0 ? void 0 : _props$node$props8.label) !== null && _props$node$props$lab2 !== void 0 ? _props$node$props$lab2 : __props.node.textValue) !== null && _ref4 !== void 0 ? _ref4 : __props.node.value), 1)];
|
|
91
|
+
}),
|
|
92
|
+
_: 1
|
|
93
|
+
}, 16, ["closable", "class"])) : __props.node.name === unref(JSON_FORM_COMPONENT_TYPES).noFormItem ? (openBlock(), createElementBlock("span", {
|
|
94
|
+
key: 1,
|
|
95
|
+
class: normalizeClass([
|
|
96
|
+
`${unref(prefixCls)}-component-control`,
|
|
97
|
+
`${unref(prefixCls)}-component-noFormItem`,
|
|
98
|
+
`${unref(prefixCls)}-component-fallback`
|
|
99
|
+
])
|
|
100
|
+
}, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(componentLabel.value), 1)])], 2)) : resolvedComponent.value ? (openBlock(), createElementBlock("span", {
|
|
101
|
+
key: 2,
|
|
102
|
+
class: normalizeClass(componentClass.value)
|
|
103
|
+
}, [componentUsesDefaultContent.value ? (openBlock(), createBlock(resolveDynamicComponent(resolvedComponent.value), mergeProps({ key: 0 }, componentProps.value, {
|
|
104
|
+
"model-value": __props.node.value,
|
|
105
|
+
disabled: componentDisabled.value,
|
|
106
|
+
readonly: __props.readonly,
|
|
107
|
+
class: (_props$node$props9 = __props.node.props) === null || _props$node$props9 === void 0 ? void 0 : _props$node$props9.class,
|
|
108
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => emit("update", $event))
|
|
109
|
+
}), {
|
|
110
|
+
default: withCtx(() => [createTextVNode(toDisplayString(componentLabel.value), 1)]),
|
|
111
|
+
_: 1
|
|
112
|
+
}, 16, [
|
|
113
|
+
"model-value",
|
|
114
|
+
"disabled",
|
|
115
|
+
"readonly",
|
|
116
|
+
"class"
|
|
117
|
+
])) : (openBlock(), createBlock(resolveDynamicComponent(resolvedComponent.value), mergeProps({ key: 1 }, componentProps.value, {
|
|
118
|
+
"model-value": __props.node.value,
|
|
119
|
+
disabled: componentDisabled.value,
|
|
120
|
+
readonly: __props.readonly,
|
|
121
|
+
class: (_props$node$props10 = __props.node.props) === null || _props$node$props10 === void 0 ? void 0 : _props$node$props10.class,
|
|
122
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => emit("update", $event))
|
|
123
|
+
}), null, 16, [
|
|
124
|
+
"model-value",
|
|
125
|
+
"disabled",
|
|
126
|
+
"readonly",
|
|
127
|
+
"class"
|
|
128
|
+
]))], 2)) : renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 3);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}));
|
|
132
|
+
//#endregion
|
|
133
|
+
export { rich_text_node_renderer_vue_vue_type_script_setup_true_lang_default as default };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/******** borderSize *******/
|
|
2
|
+
/******** borderStyle *******/
|
|
3
|
+
/******** radius *******/
|
|
4
|
+
/******** shadow distance *******/
|
|
5
|
+
/******** size *******/
|
|
6
|
+
/******** spacing *******/
|
|
7
|
+
/******** shadow *******/
|
|
8
|
+
/******** opacity *******/
|
|
9
|
+
/******** fontSize *******/
|
|
10
|
+
/******** fontWeight ********/
|
|
11
|
+
/******** Primary *******/
|
|
12
|
+
/******** success *******/
|
|
13
|
+
/******** warning *******/
|
|
14
|
+
/******** danger *******/
|
|
15
|
+
/******** link *******/
|
|
16
|
+
/******** radius *******/
|
|
17
|
+
/********* icon hover *********/
|
|
18
|
+
.sd-rich-text-editor {
|
|
19
|
+
position: relative;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
width: 100%;
|
|
22
|
+
color: var(--sd-color-neutral-10);
|
|
23
|
+
font-size: 14px;
|
|
24
|
+
line-height: 1.5715;
|
|
25
|
+
background: #fff;
|
|
26
|
+
border: 1px solid var(--sd-color-neutral-3);
|
|
27
|
+
border-radius: var(--sd-border-radius-medium);
|
|
28
|
+
transition: border-color 0.2s cubic-bezier(0.34, 0.69, 0.1, 1), box-shadow 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
|
|
29
|
+
}
|
|
30
|
+
.sd-rich-text-editor-focusable:hover {
|
|
31
|
+
border-color: rgb(var(--sd-primary-5));
|
|
32
|
+
}
|
|
33
|
+
.sd-rich-text-editor:focus-within {
|
|
34
|
+
border-color: rgb(var(--sd-primary-6));
|
|
35
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, rgb(var(--sd-primary-6)) 15%, transparent);
|
|
36
|
+
}
|
|
37
|
+
.sd-rich-text-editor-content {
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
width: 100%;
|
|
40
|
+
min-height: calc(14px * 1.5715 + 24px);
|
|
41
|
+
padding-block: 12px;
|
|
42
|
+
padding-inline: 16px;
|
|
43
|
+
white-space: pre-wrap;
|
|
44
|
+
overflow-wrap: anywhere;
|
|
45
|
+
outline: none;
|
|
46
|
+
caret-color: rgb(var(--sd-primary-6));
|
|
47
|
+
}
|
|
48
|
+
.sd-rich-text-editor-placeholder {
|
|
49
|
+
position: absolute;
|
|
50
|
+
inset-block-start: 12px;
|
|
51
|
+
inset-inline-start: 16px;
|
|
52
|
+
overflow: hidden;
|
|
53
|
+
color: var(--sd-color-neutral-4);
|
|
54
|
+
white-space: nowrap;
|
|
55
|
+
text-overflow: ellipsis;
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
}
|
|
58
|
+
.sd-rich-text-editor-disabled {
|
|
59
|
+
color: var(--sd-color-neutral-4);
|
|
60
|
+
background: var(--sd-color-neutral-2);
|
|
61
|
+
cursor: not-allowed;
|
|
62
|
+
}
|
|
63
|
+
.sd-rich-text-editor-readonly {
|
|
64
|
+
cursor: default;
|
|
65
|
+
}
|
|
66
|
+
.sd-rich-text-editor-paragraph {
|
|
67
|
+
margin: 0;
|
|
68
|
+
}
|
|
69
|
+
.sd-rich-text-editor-heading-h1, .sd-rich-text-editor-heading-h2, .sd-rich-text-editor-heading-h3, .sd-rich-text-editor-heading-h4, .sd-rich-text-editor-heading-h5, .sd-rich-text-editor-heading-h6 {
|
|
70
|
+
margin-block: 0 12px;
|
|
71
|
+
}
|
|
72
|
+
.sd-rich-text-editor-quote {
|
|
73
|
+
margin-block: 12px;
|
|
74
|
+
margin-inline: 0;
|
|
75
|
+
padding-inline-start: 16px;
|
|
76
|
+
border-inline-start: 3px solid var(--sd-color-neutral-4);
|
|
77
|
+
}
|
|
78
|
+
.sd-rich-text-editor-list-ordered, .sd-rich-text-editor-list-unordered {
|
|
79
|
+
margin-block: 12px;
|
|
80
|
+
padding-inline-start: 32px;
|
|
81
|
+
}
|
|
82
|
+
.sd-rich-text-editor-list-item-nested {
|
|
83
|
+
list-style: none;
|
|
84
|
+
}
|
|
85
|
+
.sd-rich-text-editor-link {
|
|
86
|
+
color: rgb(var(--sd-link-6));
|
|
87
|
+
text-decoration: underline;
|
|
88
|
+
}
|
|
89
|
+
.sd-rich-text-editor-code {
|
|
90
|
+
display: block;
|
|
91
|
+
padding: 16px;
|
|
92
|
+
overflow-x: auto;
|
|
93
|
+
font-family: consolas, menlo;
|
|
94
|
+
white-space: pre;
|
|
95
|
+
background: var(--sd-color-neutral-2);
|
|
96
|
+
border-radius: var(--sd-border-radius-medium);
|
|
97
|
+
}
|
|
98
|
+
.sd-rich-text-editor-text-bold {
|
|
99
|
+
font-weight: 600;
|
|
100
|
+
}
|
|
101
|
+
.sd-rich-text-editor-text-italic {
|
|
102
|
+
font-style: italic;
|
|
103
|
+
}
|
|
104
|
+
.sd-rich-text-editor-text-underline {
|
|
105
|
+
text-decoration: underline;
|
|
106
|
+
}
|
|
107
|
+
.sd-rich-text-editor-text-strikethrough {
|
|
108
|
+
text-decoration: line-through;
|
|
109
|
+
}
|
|
110
|
+
.sd-rich-text-editor-text-code {
|
|
111
|
+
padding-inline: 4px;
|
|
112
|
+
font-family: consolas, menlo;
|
|
113
|
+
background: var(--sd-color-neutral-2);
|
|
114
|
+
border-radius: var(--sd-border-radius-medium);
|
|
115
|
+
}
|
|
116
|
+
.sd-rich-text-editor-component {
|
|
117
|
+
display: inline-flex;
|
|
118
|
+
gap: 4px;
|
|
119
|
+
align-items: center;
|
|
120
|
+
margin-inline: 4px;
|
|
121
|
+
vertical-align: middle;
|
|
122
|
+
}
|
|
123
|
+
.sd-rich-text-editor-component-selected {
|
|
124
|
+
border-radius: var(--sd-border-radius-medium);
|
|
125
|
+
outline: 2px solid rgb(var(--sd-primary-6));
|
|
126
|
+
outline-offset: 1px;
|
|
127
|
+
}
|
|
128
|
+
.sd-rich-text-editor-component-input > .sd-input-wrapper, .sd-rich-text-editor-component-select > .sd-select-view {
|
|
129
|
+
display: inline-flex;
|
|
130
|
+
background: color-mix(in srgb, rgb(var(--sd-primary-6)) 6%, transparent);
|
|
131
|
+
}
|
|
132
|
+
.sd-rich-text-editor-component-control {
|
|
133
|
+
max-width: 100%;
|
|
134
|
+
vertical-align: middle;
|
|
135
|
+
}
|
|
136
|
+
.sd-rich-text-editor-component-stretch {
|
|
137
|
+
display: inline-flex;
|
|
138
|
+
width: 12em;
|
|
139
|
+
max-width: none;
|
|
140
|
+
}
|
|
141
|
+
.sd-rich-text-editor-component-stretch > * {
|
|
142
|
+
box-sizing: border-box;
|
|
143
|
+
width: 100%;
|
|
144
|
+
}
|
|
145
|
+
.sd-rich-text-editor-component-rangePicker {
|
|
146
|
+
width: 22em;
|
|
147
|
+
}
|
|
148
|
+
.sd-rich-text-editor-component-tag {
|
|
149
|
+
margin: 0;
|
|
150
|
+
}
|
|
151
|
+
.sd-rich-text-editor-component-fallback {
|
|
152
|
+
display: inline-flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
min-height: 1.5em;
|
|
155
|
+
padding-inline: 4px;
|
|
156
|
+
background: color-mix(in srgb, rgb(var(--sd-primary-6)) 6%, transparent);
|
|
157
|
+
border-radius: var(--sd-border-radius-medium);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@media (prefers-reduced-motion: reduce) {
|
|
161
|
+
.sd-rich-text-editor {
|
|
162
|
+
transition-duration: 0.01ms;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
@use 'sass:string';
|
|
2
|
+
@use '@style/theme/index.scss' as theme;
|
|
3
|
+
@use './token.scss' as *;
|
|
4
|
+
|
|
5
|
+
$rich-text-editor-prefix-cls: string.unquote('#{theme.$prefix}-rich-text-editor');
|
|
6
|
+
|
|
7
|
+
.#{$rich-text-editor-prefix-cls} {
|
|
8
|
+
position: relative;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
width: 100%;
|
|
11
|
+
color: $rich-text-editor-color-text;
|
|
12
|
+
font-size: $rich-text-editor-font-size;
|
|
13
|
+
line-height: $rich-text-editor-line-height;
|
|
14
|
+
background: $rich-text-editor-color-background;
|
|
15
|
+
border: $rich-text-editor-border-width solid $rich-text-editor-color-border;
|
|
16
|
+
border-radius: $rich-text-editor-border-radius;
|
|
17
|
+
transition:
|
|
18
|
+
border-color $rich-text-editor-motion-duration $rich-text-editor-motion-easing,
|
|
19
|
+
box-shadow $rich-text-editor-motion-duration $rich-text-editor-motion-easing;
|
|
20
|
+
|
|
21
|
+
&-focusable:hover {
|
|
22
|
+
border-color: $rich-text-editor-color-border-hover;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:focus-within {
|
|
26
|
+
border-color: $rich-text-editor-color-border-focus;
|
|
27
|
+
box-shadow: $rich-text-editor-focus-shadow;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&-content {
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
width: 100%;
|
|
33
|
+
min-height: calc(
|
|
34
|
+
#{$rich-text-editor-font-size} * #{$rich-text-editor-line-height} +
|
|
35
|
+
#{$rich-text-editor-padding-block * 2}
|
|
36
|
+
);
|
|
37
|
+
padding-block: $rich-text-editor-padding-block;
|
|
38
|
+
padding-inline: $rich-text-editor-padding-inline;
|
|
39
|
+
white-space: pre-wrap;
|
|
40
|
+
overflow-wrap: anywhere;
|
|
41
|
+
outline: none;
|
|
42
|
+
caret-color: $rich-text-editor-color-border-focus;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&-placeholder {
|
|
46
|
+
position: absolute;
|
|
47
|
+
inset-block-start: $rich-text-editor-padding-block;
|
|
48
|
+
inset-inline-start: $rich-text-editor-padding-inline;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
color: $rich-text-editor-color-placeholder;
|
|
51
|
+
white-space: nowrap;
|
|
52
|
+
text-overflow: ellipsis;
|
|
53
|
+
pointer-events: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&-disabled {
|
|
57
|
+
color: $rich-text-editor-color-text-disabled;
|
|
58
|
+
background: $rich-text-editor-color-background-disabled;
|
|
59
|
+
cursor: not-allowed;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&-readonly {
|
|
63
|
+
cursor: default;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&-paragraph {
|
|
67
|
+
margin: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&-heading-h1,
|
|
71
|
+
&-heading-h2,
|
|
72
|
+
&-heading-h3,
|
|
73
|
+
&-heading-h4,
|
|
74
|
+
&-heading-h5,
|
|
75
|
+
&-heading-h6 {
|
|
76
|
+
margin-block: 0 $rich-text-editor-padding-block;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&-quote {
|
|
80
|
+
margin-block: $rich-text-editor-padding-block;
|
|
81
|
+
margin-inline: 0;
|
|
82
|
+
padding-inline-start: $rich-text-editor-padding-inline;
|
|
83
|
+
border-inline-start: $rich-text-editor-border-width * 3 solid
|
|
84
|
+
$rich-text-editor-color-quote-border;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&-list-ordered,
|
|
88
|
+
&-list-unordered {
|
|
89
|
+
margin-block: $rich-text-editor-padding-block;
|
|
90
|
+
padding-inline-start: $rich-text-editor-padding-inline * 2;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
&-list-item-nested {
|
|
94
|
+
list-style: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&-link {
|
|
98
|
+
color: $rich-text-editor-color-link;
|
|
99
|
+
text-decoration: underline;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&-code {
|
|
103
|
+
display: block;
|
|
104
|
+
padding: $rich-text-editor-padding-inline;
|
|
105
|
+
overflow-x: auto;
|
|
106
|
+
font-family: theme.$code-family;
|
|
107
|
+
white-space: pre;
|
|
108
|
+
background: $rich-text-editor-color-code-background;
|
|
109
|
+
border-radius: $rich-text-editor-border-radius;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&-text-bold {
|
|
113
|
+
font-weight: theme.$font-weight-600;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&-text-italic {
|
|
117
|
+
font-style: italic;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&-text-underline {
|
|
121
|
+
text-decoration: underline;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&-text-strikethrough {
|
|
125
|
+
text-decoration: line-through;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&-text-code {
|
|
129
|
+
padding-inline: $rich-text-editor-code-padding;
|
|
130
|
+
font-family: theme.$code-family;
|
|
131
|
+
background: $rich-text-editor-color-code-background;
|
|
132
|
+
border-radius: $rich-text-editor-border-radius;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&-component {
|
|
136
|
+
display: inline-flex;
|
|
137
|
+
gap: $rich-text-editor-component-gap;
|
|
138
|
+
align-items: center;
|
|
139
|
+
margin-inline: $rich-text-editor-component-gap;
|
|
140
|
+
vertical-align: middle;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
&-component-selected {
|
|
144
|
+
border-radius: $rich-text-editor-border-radius;
|
|
145
|
+
outline: 2px solid $rich-text-editor-color-border-focus;
|
|
146
|
+
outline-offset: 1px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&-component-input > .sd-input-wrapper,
|
|
150
|
+
&-component-select > .sd-select-view {
|
|
151
|
+
display: inline-flex;
|
|
152
|
+
background: $rich-text-editor-color-component-background;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&-component-control {
|
|
156
|
+
max-width: 100%;
|
|
157
|
+
vertical-align: middle;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&-component-stretch {
|
|
161
|
+
display: inline-flex;
|
|
162
|
+
width: $rich-text-editor-component-inline-width;
|
|
163
|
+
max-width: none;
|
|
164
|
+
|
|
165
|
+
> * {
|
|
166
|
+
box-sizing: border-box;
|
|
167
|
+
width: 100%;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&-component-rangePicker {
|
|
172
|
+
width: $rich-text-editor-component-range-width;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&-component-tag {
|
|
176
|
+
margin: 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&-component-fallback {
|
|
180
|
+
display: inline-flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
min-height: 1.5em;
|
|
183
|
+
padding-inline: $rich-text-editor-code-padding;
|
|
184
|
+
background: $rich-text-editor-color-component-background;
|
|
185
|
+
border-radius: $rich-text-editor-border-radius;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@media (prefers-reduced-motion: reduce) {
|
|
190
|
+
.#{$rich-text-editor-prefix-cls} {
|
|
191
|
+
transition-duration: 0.01ms;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
@use '@style/theme/index.scss' as global;
|
|
2
|
+
|
|
3
|
+
@forward '@style/theme/index.scss';
|
|
4
|
+
|
|
5
|
+
$rich-text-editor-font-size: global.$font-size-body-3;
|
|
6
|
+
$rich-text-editor-line-height: global.$line-height-base;
|
|
7
|
+
$rich-text-editor-border-width: global.$border-1;
|
|
8
|
+
$rich-text-editor-border-radius: global.$radius-medium;
|
|
9
|
+
$rich-text-editor-padding-block: global.$spacing-6;
|
|
10
|
+
$rich-text-editor-padding-inline: global.$spacing-7;
|
|
11
|
+
$rich-text-editor-component-gap: global.$spacing-2;
|
|
12
|
+
$rich-text-editor-component-inline-width: 12em;
|
|
13
|
+
$rich-text-editor-component-range-width: 22em;
|
|
14
|
+
$rich-text-editor-code-padding: global.$spacing-2;
|
|
15
|
+
|
|
16
|
+
$rich-text-editor-color-text: global.$color-text-1;
|
|
17
|
+
$rich-text-editor-color-text-disabled: global.$color-text-4;
|
|
18
|
+
$rich-text-editor-color-placeholder: global.$color-text-4;
|
|
19
|
+
$rich-text-editor-color-background: global.$color-bg-2;
|
|
20
|
+
$rich-text-editor-color-background-disabled: global.$color-fill-2;
|
|
21
|
+
$rich-text-editor-color-border: global.$color-border-2;
|
|
22
|
+
$rich-text-editor-color-border-hover: global.$color-primary-5;
|
|
23
|
+
$rich-text-editor-color-border-focus: global.$color-primary-6;
|
|
24
|
+
$rich-text-editor-color-link: global.$color-link-6;
|
|
25
|
+
$rich-text-editor-color-code-background: global.$color-fill-2;
|
|
26
|
+
$rich-text-editor-color-quote-border: global.$color-border-3;
|
|
27
|
+
$rich-text-editor-color-component-background: color-mix(
|
|
28
|
+
in srgb,
|
|
29
|
+
#{global.$color-primary-6} 6%,
|
|
30
|
+
transparent
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
$rich-text-editor-focus-shadow: 0 0 0 2px
|
|
34
|
+
color-mix(in srgb, #{global.$color-primary-6} 15%, transparent);
|
|
35
|
+
$rich-text-editor-motion-duration: global.$transition-duration-2;
|
|
36
|
+
$rich-text-editor-motion-easing: global.$transition-timing-function-standard;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { Transformer } from '@lexical/markdown';
|
|
2
|
+
import type { CommandListener, CommandListenerPriority, CreateEditorArgs, EditorSetOptions, EditorState, EditorUpdateOptions, Klass, LexicalCommand, LexicalEditor, LexicalNode, MutationListener, NodeKey, SerializedEditorState, TextFormatType, Transform, UpdateListener } from 'lexical';
|
|
3
|
+
import type { Except, JsonObject, JsonValue, ReadonlyDeep } from 'type-fest';
|
|
4
|
+
import type { CSSProperties, VNodeChild } from 'vue';
|
|
5
|
+
import type { SelectOption } from '../select';
|
|
6
|
+
import type { TagColor } from '../tag';
|
|
7
|
+
import type { RichTextEditorBuiltInNodeName, RichTextEditorJsonFormNodeName } from './built-in-components';
|
|
8
|
+
export type RichTextEditorValue = SerializedEditorState;
|
|
9
|
+
export type RichTextEditorSemanticType = 'root' | 'content' | 'placeholder' | 'component';
|
|
10
|
+
export interface RichTextEditorFocusOptions {
|
|
11
|
+
defaultSelection?: 'rootStart' | 'rootEnd';
|
|
12
|
+
selection?: 'start' | 'end' | 'all';
|
|
13
|
+
preventScroll?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface RichTextEditorMutationListenerOptions {
|
|
16
|
+
skipInitialization?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export type RichTextEditorConfig = Except<CreateEditorArgs, 'editable' | 'editorState'>;
|
|
19
|
+
export interface RichTextEditorAutoSize {
|
|
20
|
+
minRows?: number;
|
|
21
|
+
maxRows?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface RichTextEditorComponentNodeData {
|
|
24
|
+
key: string;
|
|
25
|
+
name: string;
|
|
26
|
+
value?: JsonValue;
|
|
27
|
+
props?: JsonObject;
|
|
28
|
+
textValue?: string;
|
|
29
|
+
}
|
|
30
|
+
export type RichTextEditorComponentNodeSnapshot = ReadonlyDeep<RichTextEditorComponentNodeData>;
|
|
31
|
+
export type RichTextEditorContentItem = string | RichTextEditorComponentNodeData;
|
|
32
|
+
export type RichTextEditorContentSnapshot = string | RichTextEditorComponentNodeSnapshot;
|
|
33
|
+
export interface RichTextEditorInsertOptions extends EditorUpdateOptions {
|
|
34
|
+
position?: 'start' | 'end' | 'cursor';
|
|
35
|
+
replaceCharacters?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface RichTextEditorInputNodeData extends RichTextEditorComponentNodeData {
|
|
38
|
+
name: 'input';
|
|
39
|
+
value?: string | number;
|
|
40
|
+
props?: {
|
|
41
|
+
placeholder?: string;
|
|
42
|
+
} & JsonObject;
|
|
43
|
+
}
|
|
44
|
+
export interface RichTextEditorSelectNodeData extends RichTextEditorComponentNodeData {
|
|
45
|
+
name: 'select';
|
|
46
|
+
value?: JsonValue;
|
|
47
|
+
props: {
|
|
48
|
+
options: SelectOption[];
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
} & JsonObject;
|
|
51
|
+
}
|
|
52
|
+
export interface RichTextEditorJsonFormNodeData extends RichTextEditorComponentNodeData {
|
|
53
|
+
name: RichTextEditorJsonFormNodeName;
|
|
54
|
+
}
|
|
55
|
+
export interface RichTextEditorTagNodeData extends RichTextEditorComponentNodeData {
|
|
56
|
+
name: 'tag';
|
|
57
|
+
value?: JsonValue;
|
|
58
|
+
props?: {
|
|
59
|
+
label?: string;
|
|
60
|
+
color?: TagColor | string;
|
|
61
|
+
closable?: boolean;
|
|
62
|
+
} & JsonObject;
|
|
63
|
+
}
|
|
64
|
+
export type RichTextEditorBuiltInNodeData = RichTextEditorJsonFormNodeData | RichTextEditorTagNodeData;
|
|
65
|
+
export type { RichTextEditorBuiltInNodeName, RichTextEditorJsonFormNodeName };
|
|
66
|
+
export interface RichTextEditorNodeRenderContext {
|
|
67
|
+
nodeKey: NodeKey;
|
|
68
|
+
node: RichTextEditorComponentNodeSnapshot;
|
|
69
|
+
disabled: boolean;
|
|
70
|
+
readonly: boolean;
|
|
71
|
+
update: (value: JsonValue) => void;
|
|
72
|
+
remove: () => void;
|
|
73
|
+
editor: LexicalEditor;
|
|
74
|
+
}
|
|
75
|
+
export interface RichTextEditorPluginContext {
|
|
76
|
+
rootElement: HTMLElement;
|
|
77
|
+
}
|
|
78
|
+
export type RichTextEditorPlugin = (editor: LexicalEditor, context: RichTextEditorPluginContext) => undefined | (() => void);
|
|
79
|
+
export interface RichTextEditorChangeContext {
|
|
80
|
+
editor: LexicalEditor;
|
|
81
|
+
editorState: EditorState;
|
|
82
|
+
tags: ReadonlySet<string>;
|
|
83
|
+
}
|
|
84
|
+
export interface RichTextEditorProps {
|
|
85
|
+
modelValue?: RichTextEditorValue;
|
|
86
|
+
defaultValue?: RichTextEditorValue | string | readonly RichTextEditorContentItem[];
|
|
87
|
+
editorConfig?: RichTextEditorConfig;
|
|
88
|
+
plugins?: readonly RichTextEditorPlugin[];
|
|
89
|
+
transformers?: readonly Transformer[];
|
|
90
|
+
placeholder?: string;
|
|
91
|
+
disabled?: boolean;
|
|
92
|
+
readonly?: boolean;
|
|
93
|
+
history?: boolean;
|
|
94
|
+
historyDelay?: number;
|
|
95
|
+
historyMaxDepth?: number | null;
|
|
96
|
+
autoSize?: boolean | RichTextEditorAutoSize;
|
|
97
|
+
spellcheck?: boolean;
|
|
98
|
+
ariaLabel?: string;
|
|
99
|
+
classNames?: Partial<Record<RichTextEditorSemanticType, string>>;
|
|
100
|
+
styles?: Partial<Record<RichTextEditorSemanticType, CSSProperties>>;
|
|
101
|
+
}
|
|
102
|
+
export interface RichTextEditorEmits {
|
|
103
|
+
'update:modelValue': [value: RichTextEditorValue];
|
|
104
|
+
'change': [value: RichTextEditorValue, context: RichTextEditorChangeContext];
|
|
105
|
+
'update': [context: RichTextEditorChangeContext];
|
|
106
|
+
'ready': [editor: LexicalEditor];
|
|
107
|
+
'focus': [event: FocusEvent];
|
|
108
|
+
'blur': [event: FocusEvent];
|
|
109
|
+
'error': [error: Error];
|
|
110
|
+
}
|
|
111
|
+
export interface RichTextEditorSlots {
|
|
112
|
+
placeholder?: () => VNodeChild;
|
|
113
|
+
[name: `node-${string}`]: ((context: RichTextEditorNodeRenderContext) => VNodeChild) | undefined;
|
|
114
|
+
}
|
|
115
|
+
export interface RichTextEditorRef {
|
|
116
|
+
readonly editor: LexicalEditor | null;
|
|
117
|
+
readonly editorState: EditorState | null;
|
|
118
|
+
readonly rootElement: HTMLDivElement | null;
|
|
119
|
+
readonly canUndo: boolean;
|
|
120
|
+
readonly canRedo: boolean;
|
|
121
|
+
focus: (callback?: () => void, options?: RichTextEditorFocusOptions) => void;
|
|
122
|
+
blur: () => void;
|
|
123
|
+
clear: () => void;
|
|
124
|
+
undo: () => boolean;
|
|
125
|
+
redo: () => boolean;
|
|
126
|
+
getJSON: () => RichTextEditorValue | undefined;
|
|
127
|
+
setJSON: (value: RichTextEditorValue | string, options?: EditorSetOptions) => void;
|
|
128
|
+
getContent: () => RichTextEditorContentSnapshot[];
|
|
129
|
+
setContent: (content: readonly RichTextEditorContentItem[], options?: EditorUpdateOptions) => void;
|
|
130
|
+
insertContent: (content: readonly RichTextEditorContentItem[], options?: RichTextEditorInsertOptions) => void;
|
|
131
|
+
getText: () => string;
|
|
132
|
+
getHTML: () => string;
|
|
133
|
+
setHTML: (html: string, options?: EditorUpdateOptions) => void;
|
|
134
|
+
getMarkdown: (transformers?: readonly Transformer[]) => string;
|
|
135
|
+
setMarkdown: (markdown: string, transformers?: readonly Transformer[], options?: EditorUpdateOptions) => void;
|
|
136
|
+
insertText: (text: string, options?: RichTextEditorInsertOptions) => void;
|
|
137
|
+
insertComponent: (data: RichTextEditorComponentNodeData, options?: RichTextEditorInsertOptions) => void;
|
|
138
|
+
updateComponent: (nodeKey: NodeKey, value: JsonValue, options?: EditorUpdateOptions) => void;
|
|
139
|
+
removeComponent: (nodeKey: NodeKey, options?: EditorUpdateOptions) => void;
|
|
140
|
+
formatText: (format: TextFormatType) => boolean;
|
|
141
|
+
read: <T>(callback: () => T) => T | undefined;
|
|
142
|
+
update: (callback: () => void, options?: EditorUpdateOptions) => void;
|
|
143
|
+
dispatchCommand: <T>(command: LexicalCommand<T>, payload: T) => boolean;
|
|
144
|
+
registerCommand: <T>(command: LexicalCommand<T>, listener: CommandListener<T>, priority: CommandListenerPriority) => () => void;
|
|
145
|
+
registerUpdateListener: (listener: UpdateListener) => () => void;
|
|
146
|
+
registerMutationListener: (klass: Klass<LexicalNode>, listener: MutationListener, options?: RichTextEditorMutationListenerOptions) => () => void;
|
|
147
|
+
registerNodeTransform: <T extends LexicalNode>(klass: Klass<T>, listener: Transform<T>) => () => void;
|
|
148
|
+
}
|