@opentiny/vue-renderless 3.16.1 → 3.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/action-sheet/index.js +0 -1
  2. package/base-select/index.js +1510 -0
  3. package/base-select/vue.js +555 -0
  4. package/breadcrumb-item/vue.js +4 -2
  5. package/card/index.js +15 -0
  6. package/card/vue.js +6 -3
  7. package/carousel/index.js +89 -17
  8. package/carousel/vue.js +29 -24
  9. package/carousel-item/index.js +24 -9
  10. package/carousel-item/vue.js +10 -9
  11. package/cascader/vue.js +2 -1
  12. package/cascader-panel/index.js +8 -1
  13. package/cascader-panel/vue.js +1 -1
  14. package/cascader-select/column-index.js +11 -6
  15. package/cascader-select/column.js +8 -5
  16. package/cascader-select/usePicker.js +3 -2
  17. package/checkbox/index.js +0 -17
  18. package/checkbox/vue.js +4 -10
  19. package/collapse-item/vue.js +4 -2
  20. package/common/deps/clickoutside.js +15 -8
  21. package/common/deps/popper.js +15 -1
  22. package/common/deps/throttle.js +7 -0
  23. package/common/deps/touch-emulator.js +1 -1
  24. package/common/deps/tree-model/node.js +1 -0
  25. package/common/deps/tree-model/tree-store.js +4 -1
  26. package/common/deps/useEventListener.js +9 -2
  27. package/common/deps/useInstanceSlots.js +22 -0
  28. package/common/deps/useRelation.js +72 -0
  29. package/common/deps/vue-popper.js +1 -0
  30. package/common/function.js +28 -0
  31. package/common/index.js +1 -1
  32. package/common/runtime.js +1 -1
  33. package/common/type.js +2 -0
  34. package/dialog-box/index.js +0 -22
  35. package/dialog-box/vue.js +1 -4
  36. package/drawer/index.js +28 -29
  37. package/drawer/vue.js +7 -11
  38. package/file-upload/index.js +1 -1
  39. package/fluent-editor/index.js +679 -0
  40. package/fluent-editor/options.js +234 -0
  41. package/fluent-editor/vue.js +192 -0
  42. package/form/index.js +5 -1
  43. package/grid/utils/column.js +4 -2
  44. package/grid/utils/common.js +18 -29
  45. package/grid/utils/event.js +14 -9
  46. package/guide/index.js +6 -5
  47. package/guide/vue.js +2 -2
  48. package/input/index.js +32 -2
  49. package/input/vue.js +21 -2
  50. package/nav-menu/index.js +1 -1
  51. package/numeric/index.js +4 -1
  52. package/option/vue.js +6 -6
  53. package/package.json +1 -1
  54. package/picker/mb.js +6 -1
  55. package/picker/vue.js +2 -1
  56. package/select/index.js +65 -40
  57. package/select/vue.js +1 -1
  58. package/split/index.js +16 -9
  59. package/split/vue.js +7 -2
  60. package/statistic/index.js +7 -0
  61. package/tabs-mf/index.js +116 -13
  62. package/tabs-mf/vue-bar.js +6 -0
  63. package/tabs-mf/vue-nav-item.js +1 -1
  64. package/tabs-mf/vue.js +42 -7
  65. package/tag-group/vue.js +7 -1
  66. package/time/index.js +1 -1
  67. package/time-line/index.js +2 -2
  68. package/time-line/vue.js +4 -13
  69. package/timeline-item/index.js +5 -5
  70. package/timeline-item/vue.js +13 -6
  71. package/tree/index.js +29 -2
  72. package/tree/vue.js +5 -2
  73. package/tree-node/vue.js +2 -1
  74. package/types/cascader-menu.type.d.ts +1 -1
  75. package/types/cascader-node.type.d.ts +1 -1
  76. package/types/{cascader-panel.type-2bd03be3.d.ts → cascader-panel.type-8f58e628.d.ts} +1 -1
  77. package/types/cascader-panel.type.d.ts +1 -1
  78. package/types/cascader.type.d.ts +1 -1
  79. package/types/collapse-item.type.d.ts +3 -0
  80. package/types/dialog-box.type.d.ts +2 -6
  81. package/types/drawer.type.d.ts +29 -34
  82. package/types/file-upload.type.d.ts +1 -1
  83. package/types/form-item.type.d.ts +1 -1
  84. package/types/{form.type-8e30b25c.d.ts → form.type-33aa784a.d.ts} +4 -0
  85. package/types/form.type.d.ts +1 -1
  86. package/types/input.type.d.ts +5 -1
  87. package/types/ip-address.type.d.ts +1 -6
  88. package/types/numeric.type.d.ts +1 -0
  89. package/types/popover.type.d.ts +1 -1
  90. package/types/search.type.d.ts +1 -3
  91. package/types/{time-line.type-1b501c41.d.ts → time-line.type-9fb16096.d.ts} +7 -5
  92. package/types/time-line.type.d.ts +1 -1
  93. package/types/timeline-item.type.d.ts +1 -1
  94. package/types/transfer.type.d.ts +3 -3
  95. package/types/upload-dragger.type.d.ts +1 -1
  96. package/types/{upload-list.type-02a1effb.d.ts → upload-list.type-023fd6e9.d.ts} +3 -3
  97. package/types/upload-list.type.d.ts +1 -1
  98. package/types/upload.type.d.ts +1 -1
  99. package/user/index.js +10 -4
  100. package/year-table/index.js +5 -3
  101. package/year-table/vue.js +1 -1
  102. package/common/deps/letter-only.js +0 -19
  103. package/common/deps/number-only.js +0 -20
@@ -0,0 +1,234 @@
1
+ import {
2
+ __spreadProps,
3
+ __spreadValues
4
+ } from "../chunk-G2ADBYYC.js";
5
+ import { isNull } from "../common/type";
6
+ const betterTable = {
7
+ operationMenu: {
8
+ items: {
9
+ copyCells: { text: "\u590D\u5236" },
10
+ copyTable: { text: "\u590D\u5236\u8868\u683C" },
11
+ emptyCells: { text: "\u6E05\u7A7A\u5185\u5BB9" },
12
+ insertRowUp: { text: "\u4E0A\u63D2\u5165\u884C" },
13
+ insertRowDown: { text: "\u4E0B\u63D2\u5165\u884C" },
14
+ insertColumnLeft: { text: "\u5DE6\u63D2\u5165\u5217" },
15
+ insertColumnRight: { text: "\u53F3\u63D2\u5165\u5217" },
16
+ mergeCells: { text: "\u5408\u5E76\u5355\u5143\u683C" },
17
+ unmergeCells: { text: "\u62C6\u5206\u5355\u5143\u683C" },
18
+ deleteRow: { text: "\u5220\u9664\u5F53\u524D\u884C" },
19
+ deleteColumn: { text: "\u5220\u9664\u5F53\u524D\u5217" },
20
+ deleteTable: { text: "\u5220\u9664\u8868\u683C" }
21
+ },
22
+ color: true
23
+ }
24
+ };
25
+ const toolbar = (FluentEditor) => {
26
+ const underline = ["bold", "italic", "underline", "strike"];
27
+ const list = [{ list: "ordered" }, { list: "bullet" }];
28
+ const script = [{ script: "sub" }, { script: "super" }];
29
+ return {
30
+ container: [
31
+ ["undo", "redo", "clean"],
32
+ [
33
+ { font: FluentEditor.imports["formats/font"].whitelist },
34
+ { size: FluentEditor.imports["formats/size"].whitelist },
35
+ { lineheight: FluentEditor.imports["formats/lineheight"].whitelist },
36
+ { header: [1, 2, 3, 4, 5, 6, false] }
37
+ ],
38
+ underline,
39
+ ["blockquote", "code-block"],
40
+ [{ header: 1 }, { header: 2 }],
41
+ list,
42
+ script,
43
+ [{ indent: "-1" }, { indent: "+1" }],
44
+ [{ direction: "rtl" }],
45
+ [{ color: [] }, { background: [] }],
46
+ [{ align: [] }],
47
+ ["link", "image", "video", "file"],
48
+ ["better-table"],
49
+ ["fullscreen"]
50
+ ]
51
+ };
52
+ };
53
+ const mention = (mentionObj) => ({
54
+ search: async (term) => {
55
+ const { data, searchKey } = mentionObj;
56
+ try {
57
+ return data.filter((d) => {
58
+ return d[searchKey] && String(d[searchKey]).includes(term);
59
+ });
60
+ } catch (e) {
61
+ return [];
62
+ }
63
+ }
64
+ });
65
+ const listAutofillHandler = ({ FluentEditor, state }) => (range, context) => {
66
+ const formats = state.quill.getFormat(range);
67
+ if (formats["table-cell-line"]) {
68
+ return true;
69
+ }
70
+ if (isNull(state.quill.scroll.query("list"))) {
71
+ return true;
72
+ }
73
+ const { length } = context.prefix;
74
+ const [line, offset] = state.quill.getLine(range.index);
75
+ if (offset > length) {
76
+ return true;
77
+ }
78
+ let value;
79
+ let prefix = context.prefix.trim();
80
+ if (~["[]", "[ ]"].indexOf(prefix)) {
81
+ value = "unchecked";
82
+ } else if (prefix === "[x]") {
83
+ value = "checked";
84
+ } else if (~["-", "*"].indexOf(prefix)) {
85
+ value = "bullet";
86
+ } else {
87
+ value = "ordered";
88
+ }
89
+ state.quill.insertText(range.index, " ", FluentEditor.sources.USER);
90
+ state.quill.history.cutoff();
91
+ const delta = new FluentEditor.imports["delta"]().retain(range.index - offset).delete(length + 1).retain(line.length() - 2 - offset).retain(1, { list: { value } });
92
+ state.quill.updateContents(delta, FluentEditor.sources.USER);
93
+ state.quill.history.cutoff();
94
+ state.quill.setSelection(range.index - length, FluentEditor.sources.SILENT);
95
+ return false;
96
+ };
97
+ const listAutofill = ({ FluentEditor, state }) => ({
98
+ key: " ",
99
+ shiftKey: null,
100
+ collapsed: true,
101
+ format: { list: false, "code-block": false, blockquote: false, header: false, table: true },
102
+ prefix: /^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,
103
+ handler: listAutofillHandler({ FluentEditor, state })
104
+ });
105
+ const listIgnoreRight = ({ FluentEditor, state }) => ({
106
+ key: "ArrowRight",
107
+ shiftKey: null,
108
+ format: ["list"],
109
+ collapsed: true,
110
+ offset: 0,
111
+ handler(range) {
112
+ state.quill.setSelection(range.index + 1, FluentEditor.sources.SILENT);
113
+ }
114
+ });
115
+ const listIgnoreLeft = ({ FluentEditor, state }) => ({
116
+ key: "ArrowLeft",
117
+ shiftKey: null,
118
+ format: ["list"],
119
+ collapsed: true,
120
+ offset: 0,
121
+ handler(range) {
122
+ state.quill.setSelection(range.index - 1, FluentEditor.sources.SILENT);
123
+ }
124
+ });
125
+ const listSoftBreak = ({ FluentEditor, state }) => ({
126
+ key: "Enter",
127
+ format: ["list"],
128
+ shiftKey: true,
129
+ collapsed: true,
130
+ handler(range) {
131
+ const [line, offset] = state.quill.getLine(range.index);
132
+ const length = line.length();
133
+ if (length > offset + 1) {
134
+ state.quill.insertEmbed(range.index, "soft-break", true, FluentEditor.sources.USER);
135
+ }
136
+ }
137
+ });
138
+ const keyboard = ({ FluentEditor, state }) => {
139
+ const BetterTable = FluentEditor.imports["modules/better-table"];
140
+ return {
141
+ bindings: __spreadProps(__spreadValues({}, BetterTable.keyboardBindings), {
142
+ "list autofill": listAutofill({ FluentEditor, state }),
143
+ // fix:在list的offset为0时(即只在最左侧触发)加键盘事件,使其跳过contenteditable=false的span进行移动
144
+ "list ignoreRight": listIgnoreRight({ FluentEditor, state }),
145
+ "list ignoreLeft": listIgnoreLeft({ FluentEditor, state }),
146
+ "list softBreak": listSoftBreak({ FluentEditor, state })
147
+ })
148
+ };
149
+ };
150
+ const defaultOption = ({ FluentEditor, state, mentionObj }) => {
151
+ return {
152
+ theme: "snow",
153
+ modules: {
154
+ file: true,
155
+ // 上传文件需开启
156
+ image: FluentEditor.imports["modules/image-spec"],
157
+ counter: false,
158
+ toolbar: toolbar(FluentEditor),
159
+ "better-table": betterTable,
160
+ mention: mention(mentionObj),
161
+ keyboard: keyboard({ FluentEditor, state })
162
+ },
163
+ // 上传:图片、视频和文件,相关配置
164
+ uploadOption: {
165
+ fileAccept: ".mp4,.xls,.xlsx,.doc,.docx,.ppt,.pptx",
166
+ imageAccept: ".gif,.png,.tiff,image/jpeg",
167
+ isVideoPlay: true,
168
+ imageUploadToServer: true
169
+ // 是否需要上传到服务器
170
+ },
171
+ placeholder: "Insert text here ...",
172
+ readOnly: false
173
+ };
174
+ };
175
+ const iconOption = {
176
+ align: {
177
+ default: "IconEditorAlignLeft",
178
+ center: "IconEditorAlignCenter",
179
+ right: "IconEditorAlignRight"
180
+ },
181
+ background: "IconEditorBackground",
182
+ "better-table": "IconEditorTable",
183
+ blockquote: "IconEditorQuote",
184
+ bold: "IconEditorBold",
185
+ clean: "IconEditorEraser",
186
+ code: "",
187
+ "code-block": "IconEditorCode",
188
+ color: "IconEditorTextcolor",
189
+ direction: {
190
+ default: "IconEditorRightBorder",
191
+ rtl: "IconEditorLeftBorder"
192
+ },
193
+ emoji: "",
194
+ file: "IconCloudUpload",
195
+ font: "",
196
+ formula: "",
197
+ fullscreen: "IconFullscreen",
198
+ "global-link": "",
199
+ header: {
200
+ 1: "IconEditorTitle",
201
+ 2: "IconEditorSubtitle"
202
+ },
203
+ help: "",
204
+ image: "IconPicture",
205
+ indent: {
206
+ "+1": "IconEditorMenuRight",
207
+ "-1": "IconEditorMenuLeft"
208
+ },
209
+ italic: "IconEditorItalic",
210
+ link: "IconLink",
211
+ list: {
212
+ bullet: "IconEditorListDot",
213
+ check: "",
214
+ ordered: "IconEditorListNum"
215
+ },
216
+ redo: "IconEditorRedo",
217
+ screenshot: "",
218
+ script: {
219
+ sub: "IconEditorSub",
220
+ super: "IconEditorSuper"
221
+ },
222
+ size: "",
223
+ strike: "IconEditorDeleteline",
224
+ table: "",
225
+ underline: "IconEditorUnderline",
226
+ undo: "IconEditorUndo",
227
+ video: "IconEditorVideo"
228
+ };
229
+ export {
230
+ defaultOption,
231
+ iconOption,
232
+ keyboard,
233
+ mention
234
+ };
@@ -0,0 +1,192 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import {
3
+ beforeUnmount,
4
+ computePreviewOptions,
5
+ stringToJson,
6
+ doPreview,
7
+ fileHandler,
8
+ fileOperationToSev,
9
+ getFileUploadUrl,
10
+ handleDblclick,
11
+ handlers,
12
+ handleUploadFile,
13
+ handleUploadImage,
14
+ imageHandler,
15
+ init,
16
+ initContent,
17
+ inputFileHandler,
18
+ insertFileToEditor,
19
+ insertImageToEditor,
20
+ lineheightHandler,
21
+ mounted,
22
+ redoHandler,
23
+ selectionChange,
24
+ textChange,
25
+ undoHandler,
26
+ uploaderDflsHandler,
27
+ uploadImageToSev,
28
+ setToolbarTips,
29
+ getOuterHTML,
30
+ setToolbarTitle,
31
+ addFullscreenchange,
32
+ removeFullscreenchange,
33
+ keyDownHandler,
34
+ computeZIndex,
35
+ handleComposition,
36
+ handleCompositionstart,
37
+ handleCompositionend,
38
+ removeHandleComposition,
39
+ checkTableISEndElement
40
+ } from "./index";
41
+ import { defaultOption, iconOption } from "./options";
42
+ const api = ["state", "init", "initContent", "selectionChange", "textChange", "doPreview", "handleDblclick"];
43
+ const initState = ({ api: api2, reactive, computed, props }) => {
44
+ const state = reactive({
45
+ promises: [],
46
+ promisesData: [],
47
+ cbNum: 0,
48
+ innerOptions: {},
49
+ innerContent: "",
50
+ fileUploadUrl: props.fileUpload && props.fileUpload.url || "",
51
+ quill: null,
52
+ fileInput: null,
53
+ previewOptions: computed(() => api2.computePreviewOptions()),
54
+ previewImgUrl: "",
55
+ showPreview: false,
56
+ content: props.modelValue || props.content,
57
+ isFullscreen: false,
58
+ zIndex: computed(() => api2.computeZIndex()),
59
+ icons: [
60
+ "IconEditorAlignCenter",
61
+ "IconEditorAlignLeft",
62
+ "IconEditorAlignRight",
63
+ "IconEditorBackground",
64
+ "IconEditorBold",
65
+ "IconEditorCode",
66
+ "IconEditorDeleteline",
67
+ "IconEditorEraser",
68
+ "IconEditorItalic",
69
+ "IconEditorLeftBorder",
70
+ "IconEditorList",
71
+ "IconEditorListDot",
72
+ "IconEditorListNum",
73
+ "IconEditorMenuLeft",
74
+ "IconEditorMenuRight",
75
+ "IconEditorQuote",
76
+ "IconEditorRedo",
77
+ "IconEditorRightBorder",
78
+ "IconEditorSub",
79
+ "IconEditorSubtitle",
80
+ "IconEditorSuper",
81
+ "IconEditorTable",
82
+ "IconEditorTextcolor",
83
+ "IconEditorTitle",
84
+ "IconEditorUnderline",
85
+ "IconEditorUndo",
86
+ "IconEditorVideo",
87
+ "IconLink",
88
+ "IconPicture",
89
+ "IconCloudUpload",
90
+ "IconFullscreen"
91
+ ]
92
+ });
93
+ return state;
94
+ };
95
+ const initApi = ({ api: api2, state, service, emit, props, nextTick, FluentEditor, UploaderDfls, Delta, vm, t }) => {
96
+ Object.assign(api2, {
97
+ state,
98
+ getFileUploadUrl: getFileUploadUrl({ service }),
99
+ selectionChange: selectionChange({ emit, state }),
100
+ fileOperationToSev: fileOperationToSev({ state }),
101
+ undoHandler: undoHandler({ state }),
102
+ redoHandler: redoHandler({ state }),
103
+ lineheightHandler: lineheightHandler({ state, FluentEditor }),
104
+ inputFileHandler: inputFileHandler({ state, UploaderDfls }),
105
+ insertFileToEditor: insertFileToEditor({ state, FluentEditor, Delta }),
106
+ insertImageToEditor: insertImageToEditor({ state, FluentEditor, Delta }),
107
+ uploadImageToSev: uploadImageToSev({ state }),
108
+ doPreview: doPreview({ props, state, nextTick }),
109
+ stringToJson: stringToJson({ props }),
110
+ setToolbarTips: setToolbarTips({ api: api2, vm, FluentEditor, iconOption }),
111
+ getOuterHTML: getOuterHTML(),
112
+ setToolbarTitle: setToolbarTitle({ state, t })
113
+ });
114
+ };
115
+ const mergeApi = (args) => {
116
+ let { api: api2, state, service, emit, props, vm, i18n, watch, nextTick } = args;
117
+ let { constants, FluentEditor, UploaderDfls, Delta, defaultOptions } = args;
118
+ Object.assign(api2, {
119
+ init: init({ api: api2, emit, props, service, state, FluentEditor, UploaderDfls, defaultOptions, vm }),
120
+ initContent: initContent({ state, props, api: api2, nextTick }),
121
+ fileHandler: fileHandler({ api: api2, state }),
122
+ imageHandler: imageHandler({ api: api2, state }),
123
+ uploaderDflsHandler: uploaderDflsHandler({ api: api2, modules: defaultOptions.modules }),
124
+ handleUploadFile: handleUploadFile({ api: api2, UploaderDfls }),
125
+ handleUploadImage: handleUploadImage({ state, api: api2, FluentEditor, Delta, UploaderDfls }),
126
+ handlers: handlers({ api: api2 }),
127
+ mounted: mounted({ api: api2, props, state, i18n, watch }),
128
+ beforeUnmount: beforeUnmount({ api: api2, state, vm }),
129
+ computePreviewOptions: computePreviewOptions({ props, state, constants, api: api2 }),
130
+ handleDblclick: handleDblclick({ props, api: api2 }),
131
+ textChange: textChange({ emit, vm, state, props, api: api2 }),
132
+ keyDownHandler: keyDownHandler({ state }),
133
+ computeZIndex: computeZIndex({ constants, props }),
134
+ addFullscreenchange: addFullscreenchange({ api: api2 }),
135
+ removeFullscreenchange: removeFullscreenchange({ api: api2 }),
136
+ handleComposition: handleComposition({ state, api: api2 }),
137
+ handleCompositionstart: handleCompositionstart({ state }),
138
+ handleCompositionend: handleCompositionend({ state }),
139
+ removeHandleComposition: removeHandleComposition({ state, api: api2 })
140
+ });
141
+ };
142
+ const initWatch = ({ watch, state, api: api2, props, vm }) => {
143
+ watch(
144
+ () => props.modelValue,
145
+ (value) => {
146
+ if (checkTableISEndElement(vm.$refs.editor.children[0])) {
147
+ state.content = value + "<p><br></p><p><br></p>";
148
+ } else {
149
+ state.content = value;
150
+ }
151
+ api2.initContent();
152
+ }
153
+ );
154
+ watch(
155
+ () => props.content,
156
+ (value) => {
157
+ state.content = value;
158
+ api2.initContent();
159
+ }
160
+ );
161
+ watch(
162
+ () => props.disabled,
163
+ (value) => {
164
+ if (state.quill) {
165
+ state.quill.enable(!value);
166
+ }
167
+ }
168
+ );
169
+ };
170
+ const renderless = (props, { reactive, watch, onMounted, onBeforeUnmount, computed }, { service, emit, i18n, constants, nextTick, vm, t }, { FluentEditor }) => {
171
+ const api2 = {};
172
+ const { DEFAULTS: UploaderDfls } = FluentEditor.imports["modules/uploader"];
173
+ const Delta = FluentEditor.imports["delta"];
174
+ const state = initState({ reactive, computed, api: api2, props });
175
+ const defaultOptions = defaultOption({ FluentEditor, state, mentionObj: props.mentionObj });
176
+ initApi({ api: api2, state, service, emit, props, nextTick, FluentEditor, UploaderDfls, Delta, vm, t });
177
+ const args = { api: api2, state, service, emit, props, vm, i18n, watch, nextTick };
178
+ Object.assign(args, { constants, FluentEditor, UploaderDfls, Delta, defaultOptions });
179
+ mergeApi(args);
180
+ initWatch({ watch, state, api: api2, props, vm });
181
+ onMounted(api2.mounted);
182
+ onBeforeUnmount(() => {
183
+ UploaderDfls.handler = null;
184
+ UploaderDfls.imagePasteFailCallback = null;
185
+ api2.beforeUnmount();
186
+ });
187
+ return api2;
188
+ };
189
+ export {
190
+ api,
191
+ renderless
192
+ };
package/form/index.js CHANGED
@@ -100,14 +100,18 @@ const validate = ({ props, state }) => (callback) => {
100
100
  callback(true);
101
101
  }
102
102
  let invalidFields = {};
103
+ let invalidFieldArr = [];
103
104
  state.fields.forEach((field) => {
104
105
  field.validate("", (message, field2) => {
105
106
  if (message) {
106
107
  valid = false;
107
108
  }
108
109
  invalidFields = merge({}, invalidFields, field2);
110
+ if (field2) {
111
+ Object.keys(field2).forEach((item) => invalidFieldArr.push(item));
112
+ }
109
113
  if (typeof callback === "function" && ++count === state.fields.length) {
110
- callback(valid, invalidFields);
114
+ callback(valid, invalidFields, invalidFieldArr);
111
115
  }
112
116
  });
113
117
  });
@@ -2,6 +2,7 @@ import "../../chunk-G2ADBYYC.js";
2
2
  import { isBoolean } from "../static";
3
3
  import { initFilter } from "./common";
4
4
  let columnUniqueId = 0;
5
+ const setColumnFormat = (column, props) => column.format = props.formatConfig;
5
6
  function setBasicProperty(column, context) {
6
7
  column.id = `col_${++columnUniqueId}`;
7
8
  column.type = context.type;
@@ -28,7 +29,7 @@ function setBasicProperty(column, context) {
28
29
  column.indexMethod = context.indexMethod;
29
30
  column.formatText = context.formatText;
30
31
  column.formatValue = context.formatValue;
31
- column.format = context.formatConfig;
32
+ setColumnFormat(column, context);
32
33
  column.sortable = context.sortable;
33
34
  column.sortBy = context.sortBy;
34
35
  column.sortMethod = context.sortMethod;
@@ -67,5 +68,6 @@ function ColumnConfig(context, { renderHeader, renderCell, renderData } = {}, co
67
68
  }
68
69
  const getColumnConfig = (context, options, config) => context instanceof ColumnConfig ? context : new ColumnConfig(context, options, config);
69
70
  export {
70
- getColumnConfig
71
+ getColumnConfig,
72
+ setColumnFormat
71
73
  };
@@ -3,7 +3,7 @@ import {
3
3
  } from "../../chunk-G2ADBYYC.js";
4
4
  import { isNull } from "../../common/type";
5
5
  import { find } from "../../common/array";
6
- import { get, isFunction, set, findTree } from "../static";
6
+ import { get, isFunction, set } from "../static";
7
7
  const gridSize = ["medium", "small", "mini"];
8
8
  const getSize = ({ size, $parent }) => size || ($parent && gridSize.includes($parent.size) ? $parent.size : null);
9
9
  const getFuncText = (content) => isFunction(content) ? content() : content;
@@ -76,41 +76,31 @@ const setCellValue = (row, column, value) => {
76
76
  set(row, property, value);
77
77
  };
78
78
  const hasChildrenList = (item) => item && item.children && item.children.length > 0;
79
- const destroyColumn = ($table, { columnConfig }) => {
80
- const matchObj = findTree($table.collectColumn, (column) => column === columnConfig);
81
- if (matchObj) {
82
- matchObj.items.splice(matchObj.index, 1);
83
- }
84
- $table.collectColumn = $table.collectColumn.slice(0);
85
- };
86
79
  const emitEvent = (vm, type, args) => {
87
80
  if (vm.tableListeners[type]) {
88
81
  const params = [].concat(args);
89
82
  vm.$emit(type, ...params);
90
83
  }
91
84
  };
92
- const assemColumn = ($table, $column, instance) => {
93
- const { columnConfig, $el: elm, slots, $parent } = instance;
94
- const { collectColumn } = $table;
95
- columnConfig.slots = slots;
96
- const parentNode = elm.parentNode;
97
- const insertIndex = [].indexOf.call(parentNode.children, elm);
98
- if (!$column || $column !== $parent) {
99
- collectColumn.splice(insertIndex, 0, columnConfig);
100
- } else {
101
- const parentConfig = $column.columnConfig;
102
- if (!parentConfig.children) {
103
- parentConfig.children = [];
85
+ const assemColumn = ($table) => {
86
+ const collectColumn = [];
87
+ const assem = (columnVms, columns) => {
88
+ if (Array.isArray(columnVms)) {
89
+ columnVms.forEach((columnVm) => {
90
+ const column = columnVm.columnConfig;
91
+ const children = [];
92
+ if (column) {
93
+ columns.push(column);
94
+ assem(columnVm.childColumns, children);
95
+ column.children = children.length > 0 ? children : null;
96
+ }
97
+ });
104
98
  }
105
- parentConfig.children.splice(insertIndex, 0, columnConfig);
106
- }
107
- $table.collectColumn = collectColumn.slice(0);
108
- };
109
- const getCellValue = (row, column) => {
110
- const { field, prop } = column.own;
111
- const property = field || prop;
112
- return get(row, property);
99
+ };
100
+ assem($table.childColumns, collectColumn);
101
+ $table.collectColumn = collectColumn;
113
102
  };
103
+ const getCellValue = (row, column) => get(row, column.own.field);
114
104
  const getListeners = ($attrs, $listeners) => {
115
105
  const regHyphenate = /\B([A-Z])/g;
116
106
  const regEventPrefix = /^on[A-Z]/;
@@ -128,7 +118,6 @@ const getListeners = ($attrs, $listeners) => {
128
118
  };
129
119
  export {
130
120
  assemColumn,
131
- destroyColumn,
132
121
  emitEvent,
133
122
  formatText,
134
123
  getCellValue,
@@ -4,27 +4,32 @@ import { remove } from "../static";
4
4
  import { on } from "../../common/deps/dom";
5
5
  const wheelName = browser.isDoc && /Firefox/i.test(navigator.userAgent) ? "DOMMouseScroll" : "mousewheel";
6
6
  const eventStore = [];
7
+ const invoke = ({ comp, type, cb }, event) => {
8
+ if (type === event.type || type === "mousewheel" && event.type === wheelName) {
9
+ cb.call(comp, event);
10
+ }
11
+ };
7
12
  const GlobalEvent = {
8
- on(comp, type, cb) {
13
+ on(comp, type, cb, capture = false) {
9
14
  if (cb) {
10
- eventStore.push({ comp, type, cb });
15
+ eventStore.push({ comp, type, cb, capture });
11
16
  }
12
17
  },
13
- off(comp, type) {
14
- remove(eventStore, (item) => item.comp === comp && item.type === type);
18
+ off(comp, type, capture = false) {
19
+ remove(eventStore, (item) => item.comp === comp && item.type === type && item.capture === capture);
15
20
  },
16
21
  trigger(event) {
17
- eventStore.forEach(({ comp, type, cb }) => {
18
- if (type === event.type || type === "mousewheel" && event.type === wheelName) {
19
- cb.call(comp, event);
20
- }
21
- });
22
+ eventStore.filter((item) => !item.capture).forEach((item) => invoke(item, event));
23
+ },
24
+ capture(event) {
25
+ eventStore.filter((item) => item.capture).forEach((item) => invoke(item, event));
22
26
  }
23
27
  };
24
28
  if (browser.isDoc) {
25
29
  on(document, "keydown", GlobalEvent.trigger);
26
30
  on(document, "contextmenu", GlobalEvent.trigger);
27
31
  on(window, "mousedown", GlobalEvent.trigger);
32
+ on(window, "mousedown", GlobalEvent.capture, true);
28
33
  on(window, "blur", GlobalEvent.trigger);
29
34
  on(window, "resize", GlobalEvent.trigger);
30
35
  on(window, wheelName, GlobalEvent.trigger);
package/guide/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
2
  import { xss } from "../common/xss";
3
- const createShepherd = ({ state, props, Shepherd, offset }) => () => {
4
- const tour = newTour(state, Shepherd, offset);
3
+ const createShepherd = ({ state, props, Shepherd, offset, designConfig }) => () => {
4
+ const tour = newTour(state, Shepherd, offset, designConfig);
5
5
  state.tour = tour;
6
6
  const result = {};
7
7
  const deepCopy = getItemCopy(props, tour, result);
@@ -9,7 +9,7 @@ const createShepherd = ({ state, props, Shepherd, offset }) => () => {
9
9
  state.domData.forEach((item, i) => {
10
10
  let steps = itemStep(item, state, deepCopy, i, Shepherd);
11
11
  const step = tour.addStep(steps);
12
- if (steps.hightBox && steps.hightBox.length != 0) {
12
+ if (steps.hightBox && steps.hightBox.length !== 0) {
13
13
  step.on("show", () => {
14
14
  steps.hightBox.forEach((item2) => {
15
15
  document.querySelector(item2).classList.add("tiny-guide__z-top");
@@ -64,9 +64,10 @@ const getItemCopy = (props, tour, result) => {
64
64
  });
65
65
  return result;
66
66
  };
67
- const newTour = (state, Shepherd, offset) => {
67
+ const newTour = (state, Shepherd, offset, designConfig) => {
68
+ var _a;
68
69
  const tour = new Shepherd.Tour({
69
- useModalOverlay: true,
70
+ useModalOverlay: !((_a = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a.isUseModalOverlay),
70
71
  defaultStepOptions: {
71
72
  modalOverlayOpeningPadding: state.modalOverlayOpeningPadding,
72
73
  modalOverlayOpeningRadius: state.modalOverlayOpeningRadius,
package/guide/vue.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "../chunk-G2ADBYYC.js";
5
5
  import { createShepherd, mounted } from "./index";
6
6
  const api = ["state"];
7
- const renderless = (props, { reactive, onMounted, watch }, utils, { Shepherd, offset }) => {
7
+ const renderless = (props, { reactive, onMounted, watch }, { designConfig }, { Shepherd, offset }) => {
8
8
  const state = reactive({
9
9
  tour: null,
10
10
  tour1: null,
@@ -21,7 +21,7 @@ const renderless = (props, { reactive, onMounted, watch }, utils, { Shepherd, of
21
21
  });
22
22
  let baseApi = {
23
23
  state,
24
- createShepherd: createShepherd({ state, props, Shepherd, offset })
24
+ createShepherd: createShepherd({ state, props, Shepherd, offset, designConfig })
25
25
  };
26
26
  const api2 = __spreadProps(__spreadValues({}, baseApi), {
27
27
  mounted: mounted({ state, api: baseApi })