@opentiny/vue-renderless 3.20.3 → 3.21.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 (92) hide show
  1. package/badge/vue.js +1 -1
  2. package/base-select/index.js +3 -0
  3. package/bulletin-board/index.js +1 -1
  4. package/button/index.js +1 -1
  5. package/cascader/index.js +10 -8
  6. package/cascader-panel/vue.js +1 -1
  7. package/cascader-select/column-index.js +3 -0
  8. package/chart-core/deps/utils.js +1 -1
  9. package/chart-core/index.js +1 -1
  10. package/common/browser.js +2 -0
  11. package/common/deps/eSpaceCtrl.js +3 -2
  12. package/common/deps/fastdom/singleton.js +9 -1
  13. package/common/deps/fullscreen/screenfull.js +54 -25
  14. package/common/deps/popper.js +18 -18
  15. package/common/deps/touch-emulator.js +15 -10
  16. package/common/deps/upload-ajax.js +1 -1
  17. package/common/index.js +2 -2
  18. package/common/runtime.js +1 -1
  19. package/common/string.js +5 -2
  20. package/common/validate/util.js +1 -1
  21. package/dialog-box/index.js +6 -3
  22. package/divider/index.js +47 -0
  23. package/divider/vue.js +24 -3
  24. package/dropdown/index.js +44 -26
  25. package/dropdown/vue.js +17 -8
  26. package/espace/index.js +1 -1
  27. package/fall-menu/index.js +1 -1
  28. package/file-upload/index.js +71 -67
  29. package/file-upload/vue.js +6 -6
  30. package/floatbar/index.js +1 -1
  31. package/fluent-editor/index.js +25 -9
  32. package/form/vue.js +1 -1
  33. package/grid/plugins/export.js +1 -1
  34. package/guide/index.js +1 -1
  35. package/image/index.js +1 -1
  36. package/image-viewer/index.js +3 -2
  37. package/input/vue.js +3 -0
  38. package/link/vue.js +1 -1
  39. package/locales/index.js +1 -1
  40. package/logout/index.js +1 -1
  41. package/menu/index.js +1 -1
  42. package/milestone/index.js +2 -1
  43. package/modal/index.js +0 -1
  44. package/nav-menu/index.js +80 -11
  45. package/nav-menu/vue.js +13 -1
  46. package/package.json +2 -2
  47. package/picker/index.js +10 -0
  48. package/rich-text/index.js +1 -1
  49. package/rich-text/module/file-upload.js +1 -1
  50. package/rich-text/module/image-upload.js +1 -1
  51. package/rich-text-editor/vue.js +11 -10
  52. package/roles/index.js +1 -1
  53. package/select/index.js +27 -17
  54. package/select/vue.js +33 -5
  55. package/select-dropdown/vue.js +2 -1
  56. package/split/index.js +2 -1
  57. package/statistic/index.js +5 -2
  58. package/tabbar-item/vue.js +1 -1
  59. package/tabs-mf/wheel.js +14 -9
  60. package/time-panel/index.js +8 -1
  61. package/time-panel/vue.js +2 -0
  62. package/time-spinner/index.js +2 -1
  63. package/toggle-menu/index.js +1 -1
  64. package/transfer/index.js +1 -5
  65. package/tree-menu/index.js +5 -1
  66. package/tree-menu/vue.js +5 -2
  67. package/types/alert.type.d.ts +4 -0
  68. package/types/dialog-box.type.d.ts +10 -0
  69. package/types/divider.type.d.ts +94 -0
  70. package/types/dropdown.type.d.ts +9 -1
  71. package/types/file-upload.type.d.ts +1 -1
  72. package/types/float-button.type.d.ts +2 -2
  73. package/types/form-item.type.d.ts +1 -1
  74. package/types/{form.type-f6fb4c38.d.ts → form.type-4e0ec0a1.d.ts} +2 -1
  75. package/types/form.type.d.ts +1 -1
  76. package/types/image.type.d.ts +1 -1
  77. package/types/nav-menu.type.d.ts +1 -0
  78. package/types/statistic.type.d.ts +2 -5
  79. package/types/tree-menu.type.d.ts +19 -0
  80. package/types/upload-dragger.type.d.ts +2 -2
  81. package/types/{upload-list.type-6189e4c9.d.ts → upload-list.type-eaf82b7a.d.ts} +4 -8
  82. package/types/upload-list.type.d.ts +1 -1
  83. package/types/upload.type.d.ts +1 -1
  84. package/types/user-contact.type.d.ts +1 -1
  85. package/upload-dragger/index.js +49 -24
  86. package/upload-dragger/vue.js +1 -0
  87. package/upload-list/index.js +1 -1
  88. package/upload-list/vue.js +2 -1
  89. package/user/index.js +1 -1
  90. package/user-contact/index.js +1 -1
  91. package/year-table/index.js +2 -2
  92. package/common/xss.js +0 -191
@@ -1,3 +1,3 @@
1
1
  import 'vue';
2
- export { H as IUploadListApi, J as IUploadListProps, K as IUploadListRenderlessParamUtils, L as IUploadListRenderlessParams, G as IUploadListState, M as IUploadListVideoParam } from './upload-list.type-6189e4c9.js';
2
+ export { H as IUploadListApi, J as IUploadListProps, K as IUploadListRenderlessParamUtils, L as IUploadListRenderlessParams, G as IUploadListState, M as IUploadListVideoParam } from './upload-list.type-eaf82b7a.js';
3
3
  import './shared.type.js';
@@ -1,3 +1,3 @@
1
1
  import 'vue';
2
- export { d as IUploadApi, i as IUploadFormData, k as IUploadOptionsOfHwh5, j as IUploadOptionsOfPost, e as IUploadProps, h as IUploadRenderlessOtherParams, f as IUploadRenderlessParamUtils, g as IUploadRenderlessParams, c as IUploadState, b as IUploadStateHeader } from './upload-list.type-6189e4c9.js';
2
+ export { d as IUploadApi, i as IUploadFormData, k as IUploadOptionsOfHwh5, j as IUploadOptionsOfPost, e as IUploadProps, h as IUploadRenderlessOtherParams, f as IUploadRenderlessParamUtils, g as IUploadRenderlessParams, c as IUploadState, b as IUploadStateHeader } from './upload-list.type-eaf82b7a.js';
3
3
  import './shared.type.js';
@@ -83,7 +83,7 @@ declare const userContactProps: {
83
83
  declare const getUserHref: ({ api, props }: {
84
84
  api: any;
85
85
  props: any;
86
- }) => () => any;
86
+ }) => () => string;
87
87
  declare const doUserAction: ({ api, props, state, eSpaceCtrl }: {
88
88
  api: any;
89
89
  props: any;
@@ -1,45 +1,70 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
2
  const onDragOver = ({ props, state }) => () => !props.disabled && (state.dragover = true);
3
- const onDrop = ({ emit, props, state }) => (event) => {
4
- var _a;
3
+ const onDrop = ({ emit, props, state }) => async (event) => {
5
4
  if (props.disabled || !state.uploader) {
6
5
  return;
7
6
  }
8
7
  const accept = state.uploader.accept;
8
+ let files = event.dataTransfer.files;
9
+ const isDirectory = event.dataTransfer.items && event.dataTransfer.items[0].webkitGetAsEntry().isDirectory;
10
+ state.uploadFiles = [];
9
11
  state.dragover = false;
10
- const files = (_a = event.dataTransfer) == null ? void 0 : _a.files;
12
+ if (isDirectory) {
13
+ const fileItems = event.dataTransfer.items[0].webkitGetAsEntry();
14
+ await readFiles(fileItems, state);
15
+ files = state.uploadFiles;
16
+ }
11
17
  if (!accept) {
12
18
  emit("file", files);
13
19
  return;
14
20
  }
15
21
  const notAcceptedFiles = [];
16
- if (files) {
17
- Array.from(files).filter((file) => {
18
- const { type, name } = file;
19
- const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
20
- const baseType = type.replace(/\/.*$/, "");
21
- let isValid = accept.split(",").map((type2) => type2.trim()).filter((type2) => type2).some((type2) => {
22
- if (/\..+$/.test(type2)) {
23
- return extension === type2;
24
- }
25
- if (/\/\*$/.test(type2)) {
26
- return baseType === type2.replace(/\/\*$/, "");
27
- }
28
- if (/^[^/]+\/[^/]+$/.test(type2)) {
29
- return true;
30
- }
31
- return false;
32
- });
33
- !isValid && notAcceptedFiles.push(file);
34
- return isValid;
22
+ [].slice.call(files).filter((file) => {
23
+ const { type, name } = file;
24
+ const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
25
+ const baseType = type.replace(/\/.*$/, "");
26
+ let isValid = accept.split(",").map((type2) => type2.trim()).filter((type2) => type2).some((type2) => {
27
+ if (/\..+$/.test(type2)) {
28
+ return extension === type2;
29
+ }
30
+ if (/\/\*$/.test(type2)) {
31
+ return baseType === type2.replace(/\/\*$/, "");
32
+ }
33
+ if (/^[^/]+\/[^/]+$/.test(type2)) {
34
+ return true;
35
+ }
36
+ return false;
35
37
  });
36
- notAcceptedFiles.length && state.uploader.$emit("drop-error", notAcceptedFiles);
37
- }
38
+ !isValid && notAcceptedFiles.push(file);
39
+ return isValid;
40
+ });
41
+ notAcceptedFiles.length && state.uploader.$emit("drop-error", notAcceptedFiles);
38
42
  emit("file", files);
39
43
  };
40
44
  const watchDragover = ({ state, constants }) => () => {
41
45
  state.uploader.$refs[constants.FILE_UPLOAD_INNER_TEMPLATE].$emit("drag-over", state.dragover);
42
46
  };
47
+ async function readFiles(directory, state) {
48
+ const reader = directory.createReader();
49
+ const entries = await new Promise((resolve) => {
50
+ reader.readEntries((entries2) => {
51
+ resolve(entries2);
52
+ });
53
+ });
54
+ for (let i = 0; i < entries.length; i++) {
55
+ const entry = entries[i];
56
+ if (entry.isFile) {
57
+ await new Promise((resolve) => {
58
+ entry.file((file) => {
59
+ state.uploadFiles.push(file);
60
+ resolve(void 0);
61
+ });
62
+ });
63
+ } else if (entry.isDirectory) {
64
+ await readFiles(entry, state);
65
+ }
66
+ }
67
+ }
43
68
  export {
44
69
  onDragOver,
45
70
  onDrop,
@@ -4,6 +4,7 @@ const api = ["state", "onDragOver", "onDrop"];
4
4
  const renderless = (props, { inject, reactive, ref, watch }, { emit }) => {
5
5
  const state = reactive({
6
6
  dragover: false,
7
+ uploadFiles: [],
7
8
  uploader: inject("uploader") || ref({ default: "" })
8
9
  });
9
10
  const constants = state.uploader.$constants || {};
@@ -1,5 +1,5 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { xss } from "../common/xss";
2
+ import { xss } from "@opentiny/utils";
3
3
  import { addResizeListener, removeResizeListener } from "../common/deps/resize-event";
4
4
  const parsePercentage = () => (val) => parseInt(val, 10);
5
5
  const handleClick = ({ props, api, parent }) => (e, file) => {
@@ -25,6 +25,7 @@ import {
25
25
  import { getToken, initService } from "../file-upload";
26
26
  import { formatFileSize } from "../common/string";
27
27
  import { getApi } from "../file-upload/vue";
28
+ import { isBrowser } from "../common/browser";
28
29
  const api = [
29
30
  "t",
30
31
  "state",
@@ -51,7 +52,7 @@ const renderless = (props, { reactive, onMounted, onUnmounted, watch, inject, co
51
52
  var _a, _b, _c, _d, _e;
52
53
  const api2 = { getApi };
53
54
  parent = inject("uploader").$children[0];
54
- const constants = parent.$constants;
55
+ const constants = isBrowser ? parent.$constants : null;
55
56
  const $service = initService({ props, service });
56
57
  const { current } = useBreakpoint();
57
58
  const state = reactive({
package/user/index.js CHANGED
@@ -6,7 +6,7 @@ import debounce from "../common/deps/debounce";
6
6
  import { toDateStr } from "../common/date";
7
7
  import { toJsonStr } from "../common/object";
8
8
  import { toJson } from "../common/string";
9
- import { log } from "../common/xss";
9
+ import { log } from "@opentiny/utils";
10
10
  const toLowerCase = (val) => {
11
11
  return typeof val === "string" ? val.toLowerCase() : val;
12
12
  };
@@ -1,5 +1,5 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { xss } from "../common/xss";
2
+ import { xss } from "@opentiny/utils";
3
3
  const getUserHref = ({ api, props }) => () => {
4
4
  let href = "javascript:;";
5
5
  if (!props.isNewImMode) {
@@ -7,7 +7,7 @@ const getIsDefault = ({ props }) => (year) => {
7
7
  return Array.isArray(defaultValue) ? defaultValue.some((v) => v && v.getFullYear() === year) : defaultValue && defaultValue.getFullYear() === year;
8
8
  };
9
9
  const getIsDisabled = ({ props }) => (year) => {
10
- return props.selectionMode.startsWith("year") && typeof props.disabledDate === "function" ? props.disabledDate(year) : false;
10
+ return props.selectionMode.startsWith("year") && typeof props.disabledDate === "function" ? props.disabledDate(new Date(year, 0, 1, 0)) : false;
11
11
  };
12
12
  const getIsCurrent = ({ props }) => (year) => {
13
13
  const execDate = typeof props.value === "object" ? props.value : toDate(props.value);
@@ -49,7 +49,7 @@ const getRows = ({ props, state, vm }) => () => {
49
49
  cell.text = year;
50
50
  cell.type = isToday ? DATEPICKER.Today : DATEPICKER.Normal;
51
51
  if (props.selectionMode.startsWith("year")) {
52
- cell.disabled = typeof disabledDate === "function" && disabledDate(year);
52
+ cell.disabled = typeof disabledDate === "function" && disabledDate(new Date(year, 0, 1, 0));
53
53
  }
54
54
  if (selectionMode === DATEPICKER.YearRange) {
55
55
  const minYear = typeof minDate === "object" && minDate ? minDate.getFullYear() : minDate;
package/common/xss.js DELETED
@@ -1,191 +0,0 @@
1
- import "../chunk-G2ADBYYC.js";
2
- import * as xss$1 from "xss";
3
- let getWindow = function() {
4
- return typeof window === "undefined" ? global : window;
5
- };
6
- let xssOptions = {
7
- enableAttrs: true,
8
- enableHtml: true,
9
- enableUrl: true,
10
- html: {
11
- whiteList: {
12
- a: ["class", "style", "contenteditable", "data-id", "data-title", "data-size", "data-last-modified", "href"],
13
- address: ["class", "style"],
14
- area: ["class", "style"],
15
- article: ["class", "style"],
16
- aside: ["class", "style"],
17
- audio: ["class", "style"],
18
- b: ["class", "style"],
19
- bdi: ["class", "style"],
20
- bdo: ["class", "style"],
21
- big: ["class", "style"],
22
- blockquote: ["class", "style"],
23
- br: ["class", "style"],
24
- caption: ["class", "style"],
25
- center: ["class", "style"],
26
- cite: ["class", "style"],
27
- code: ["class", "style"],
28
- col: ["class", "style"],
29
- colgroup: ["class", "style"],
30
- dd: ["class", "style"],
31
- del: ["class", "style"],
32
- details: ["class", "style"],
33
- div: [
34
- "class",
35
- "style",
36
- "spellcheck",
37
- "data-gramm",
38
- "spellcheck",
39
- "data-mode",
40
- "data-position",
41
- "data-row",
42
- "data-cell",
43
- "data-rowspan",
44
- "data-colspan",
45
- "data-cell-bg",
46
- "data-parent-bg"
47
- ],
48
- dl: ["class", "style"],
49
- dt: ["class", "style"],
50
- em: ["class", "style"],
51
- figcaption: ["class", "style"],
52
- figure: ["class", "style"],
53
- font: ["class", "style"],
54
- footer: ["class", "style"],
55
- h1: ["class", "style"],
56
- h2: ["class", "style"],
57
- h3: ["class", "style"],
58
- h4: ["class", "style"],
59
- h5: ["class", "style"],
60
- h6: ["class", "style"],
61
- header: ["class", "style"],
62
- hr: ["class", "style"],
63
- i: ["class", "style", "data-image-id", "data-image"],
64
- img: ["class", "style", "devui-editorx-image", "style", "data-image-id", "src"],
65
- input: ["class", "style", "data-formula", "data-link", "data-video"],
66
- ins: ["class", "style"],
67
- li: ["class", "style"],
68
- mark: ["class", "style"],
69
- nav: ["class", "style"],
70
- ol: ["class", "style"],
71
- p: ["class", "style"],
72
- pre: ["class", "style"],
73
- s: ["class", "style"],
74
- section: ["class", "style"],
75
- small: ["class", "style"],
76
- span: ["class", "style", "contenteditable", "color", "style"],
77
- sub: ["class", "style"],
78
- summary: ["class", "style"],
79
- sup: ["class", "style"],
80
- strong: ["class", "style"],
81
- strike: ["class", "style"],
82
- svg: ["class", "style", "t", "viewBox", "version", "xmlns", "p-id", "xmlns:xlink"],
83
- path: ["d", "p-id"],
84
- table: ["class", "style"],
85
- tbody: ["class", "style"],
86
- td: ["class", "style", "data-row", "data-cell", "data-cell-bg", "data-parent-bg"],
87
- tfoot: ["class", "style"],
88
- th: ["class", "style"],
89
- thead: ["class", "style"],
90
- tr: ["class", "style", "data-row"],
91
- tt: ["class", "style"],
92
- u: ["class", "style"],
93
- ul: ["class", "style"],
94
- video: ["class", "style"]
95
- }
96
- }
97
- };
98
- let defaultWhiteList = xss$1.getDefaultWhiteList && xss$1.getDefaultWhiteList() || {};
99
- xssOptions.html.whiteList = Object.assign(defaultWhiteList, xssOptions.html.whiteList);
100
- let xssFilterHtml = new xss$1.FilterXSS(xssOptions.html);
101
- let getXssOption = function() {
102
- return xssOptions;
103
- };
104
- let setXssOption = function(option) {
105
- let _a;
106
- let whiteList;
107
- if ((_a = option === null || option === void 0 ? void 0 : option.html) === null || _a === void 0 ? void 0 : _a.whiteList) {
108
- whiteList = Object.assign(xssOptions.html.whiteList, option.html.whiteList);
109
- }
110
- xssOptions = Object.assign(xssOptions, option);
111
- if (whiteList) {
112
- xssOptions.html.whiteList = whiteList;
113
- }
114
- xssFilterHtml = new xss$1.FilterXSS(xssOptions.html);
115
- };
116
- let filterHtml = function(content) {
117
- if (!xssOptions.enableHtml || typeof content !== "string") {
118
- return content;
119
- }
120
- return xssFilterHtml.process(content);
121
- };
122
- let setFilterHtml = function(filter) {
123
- filterHtml = filter;
124
- };
125
- let filterAttrs = function(content) {
126
- if (!xssOptions.enableAttrs || typeof content !== "string") {
127
- return content;
128
- }
129
- return content.replace(/<.*?>/gi, "").replace(/on[a-z]+=/gi, "");
130
- };
131
- let setFilterAttrs = function(filter) {
132
- filterAttrs = filter;
133
- };
134
- let filterUrl = function(content) {
135
- if (!xssOptions.enableUrl || typeof content !== "string") {
136
- return content;
137
- }
138
- let filteredUrl = content.replace(/&#(\w+)(^\w|;)?/g, (match, dec) => String.fromCharCode(dec)).trim();
139
- if (!filteredUrl) {
140
- return "";
141
- }
142
- if ([".", "/"].includes(filteredUrl[0])) {
143
- return filteredUrl;
144
- }
145
- let urlParse = filteredUrl.match(/^([^:]+):/gm);
146
- if (!urlParse) {
147
- return filteredUrl;
148
- }
149
- if (/^([^\w]*)(javascript|data|vbscript)/im.test(urlParse[0])) {
150
- return "";
151
- }
152
- return filteredUrl;
153
- };
154
- let setFilterUrl = function(filter) {
155
- filterUrl = filter;
156
- };
157
- let index = {
158
- getXssOption,
159
- setXssOption,
160
- filterHtml,
161
- setFilterHtml,
162
- filterAttrs,
163
- setFilterAttrs,
164
- filterUrl,
165
- setFilterUrl
166
- };
167
- let xss = Object.freeze({
168
- __proto__: null,
169
- getXssOption,
170
- setXssOption,
171
- get filterHtml() {
172
- return filterHtml;
173
- },
174
- setFilterHtml,
175
- get filterAttrs() {
176
- return filterAttrs;
177
- },
178
- setFilterAttrs,
179
- get filterUrl() {
180
- return filterUrl;
181
- },
182
- setFilterUrl,
183
- "default": index
184
- });
185
- let log = { logger: getWindow().console };
186
- let def = { xss, log };
187
- export {
188
- def as default,
189
- log,
190
- xss
191
- };