@opentiny/vue-renderless 3.9.2 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/action-sheet/vue.js +25 -2
  2. package/anchor/index.js +3 -3
  3. package/anchor/vue.js +7 -1
  4. package/area/index.js +4 -4
  5. package/button/vue.js +4 -2
  6. package/button-group/index.js +8 -1
  7. package/button-group/vue.js +5 -10
  8. package/calendar/index.js +14 -14
  9. package/calendar-bar/index.js +3 -3
  10. package/carousel-item/index.js +1 -1
  11. package/cascader/vue.js +1 -1
  12. package/cascader-mobile/index.js +299 -0
  13. package/cascader-mobile/vue.js +102 -0
  14. package/cascader-panel/store.js +3 -1
  15. package/chart-boxplot/index.js +0 -1
  16. package/chart-core/deps/constants.js +20 -2
  17. package/chart-core/index.js +9 -1
  18. package/chart-core/modules/extend.js +14 -1
  19. package/chart-gauge/index.js +3 -1
  20. package/chart-graph/index.js +3 -1
  21. package/chart-map/index.js +11 -1
  22. package/chart-scatter/index.js +10 -2
  23. package/chart-waterfall/index.js +4 -1
  24. package/checkbox/index.js +16 -14
  25. package/checkbox/vue.js +14 -10
  26. package/checkbox-button/vue.js +7 -3
  27. package/column-list-item/vue.js +10 -1
  28. package/common/bigInt.js +4 -11
  29. package/common/date.js +2 -2
  30. package/common/deps/ResizeObserver.js +3 -1
  31. package/common/deps/date-util.js +9 -1
  32. package/common/deps/date.js +18 -5
  33. package/common/deps/fastdom/async.js +41 -0
  34. package/common/deps/fastdom/index.js +9 -0
  35. package/common/deps/fastdom/sandbox.js +53 -0
  36. package/common/deps/fastdom/singleton.js +80 -0
  37. package/common/deps/fullscreen/screenfull.js +16 -2
  38. package/common/deps/memorize.js +3 -3
  39. package/common/deps/popup-manager.js +0 -1
  40. package/common/deps/requestAnimationFrame.js +1 -1
  41. package/common/deps/throttle.js +2 -2
  42. package/common/deps/tree-model/node.js +23 -11
  43. package/common/deps/tree-model/tree-store.js +28 -7
  44. package/common/deps/vue-popper.js +14 -2
  45. package/common/deps/vue-popup.js +16 -23
  46. package/common/index.js +7 -35
  47. package/common/runtime.js +1 -1
  48. package/common/validate/rules/type.js +3 -1
  49. package/credit-card-form/vue.js +2 -2
  50. package/date-panel/index.js +35 -31
  51. package/date-panel/vue.js +12 -12
  52. package/date-picker/index.js +9 -5
  53. package/date-picker/vue.js +20 -8
  54. package/date-picker-mobile/index.js +3 -3
  55. package/date-range/index.js +91 -19
  56. package/date-range/vue.js +19 -11
  57. package/date-table/index.js +39 -6
  58. package/date-table/vue.js +2 -2
  59. package/dept/index.js +1 -1
  60. package/detail-page/vue.js +9 -1
  61. package/dialog-box/index.js +11 -2
  62. package/dialog-box/vue.js +30 -6
  63. package/dialog-select/index.js +27 -5
  64. package/dialog-select/vue.js +11 -4
  65. package/drop-roles/index.js +3 -1
  66. package/dropdown/index.js +28 -7
  67. package/dropdown/vue.js +12 -7
  68. package/dropdown-item/index.js +9 -1
  69. package/dropdown-item/mf.js +3 -3
  70. package/dropdown-item/vue.js +12 -10
  71. package/dropdown-menu/index.js +13 -14
  72. package/dropdown-menu/vue.js +8 -7
  73. package/espace/vue.js +9 -1
  74. package/fall-menu/vue.js +12 -1
  75. package/file-upload/index.js +137 -89
  76. package/file-upload/vue.js +24 -14
  77. package/filter/index.js +1 -1
  78. package/filter/vue.js +1 -3
  79. package/floating-button/index.js +73 -0
  80. package/floating-button/vue.js +35 -0
  81. package/form/index.js +13 -4
  82. package/form/vue.js +7 -2
  83. package/form-item/index.js +4 -1
  84. package/form-item/vue.js +6 -3
  85. package/fullscreen/vue.js +24 -3
  86. package/grid/plugins/exportExcel.js +54 -8
  87. package/grid/static/base/helperGetHGSKeys.js +1 -4
  88. package/grid/utils/common.js +15 -11
  89. package/grid/utils/dom.js +5 -1
  90. package/guide/index.js +2 -3
  91. package/hrapprover/index.js +3 -1
  92. package/index-bar/vue.js +8 -1
  93. package/input/index.js +1 -11
  94. package/input/vue.js +6 -12
  95. package/ip-address/index.js +66 -33
  96. package/ip-address/vue.js +8 -1
  97. package/link-menu/vue.js +22 -2
  98. package/locales/index.js +4 -2
  99. package/logon-user/index.js +3 -1
  100. package/logout/index.js +6 -2
  101. package/milestone/vue.js +1 -1
  102. package/mini-picker/index.js +12 -10
  103. package/mini-picker/vue.js +10 -10
  104. package/modal/index.js +5 -3
  105. package/modal/vue.js +4 -2
  106. package/month-range/index.js +18 -18
  107. package/month-range/vue.js +16 -4
  108. package/month-table/index.js +7 -3
  109. package/multi-select/vue.js +1 -9
  110. package/nav-menu/index.js +33 -4
  111. package/nav-menu/vue.js +9 -1
  112. package/notify/vue.js +12 -1
  113. package/numeric/vue.js +6 -2
  114. package/option/index.js +10 -2
  115. package/option/vue.js +20 -9
  116. package/option-group/index.js +3 -1
  117. package/package.json +2 -1
  118. package/picker/index.js +88 -17
  119. package/picker/vue.js +42 -17
  120. package/picker-column/index.js +6 -6
  121. package/picker-column/vue.js +5 -5
  122. package/popconfirm/vue.js +3 -1
  123. package/popeditor/index.js +55 -13
  124. package/popeditor/vue.js +23 -7
  125. package/popover/vue.js +1 -2
  126. package/popup/vue.js +15 -2
  127. package/progress/index.js +9 -7
  128. package/progress/vue.js +12 -4
  129. package/pull-refresh/vue.js +10 -1
  130. package/query-builder/index.js +9 -0
  131. package/query-builder/vue.js +18 -0
  132. package/radio/vue.js +3 -1
  133. package/radio-button/vue.js +1 -1
  134. package/rate/index.js +8 -2
  135. package/rate/vue.js +27 -4
  136. package/recycle-scroller/index.js +0 -1
  137. package/scrollbar/vue-bar.js +18 -2
  138. package/search/index.js +12 -5
  139. package/search/vue.js +7 -5
  140. package/select/index.js +596 -304
  141. package/select/vue.js +167 -101
  142. package/select-dropdown/vue.js +8 -6
  143. package/select-mobile/index.js +26 -13
  144. package/select-mobile/vue.js +14 -5
  145. package/select-view/index.js +5 -21
  146. package/select-view/vue.js +0 -3
  147. package/selected-box/index.js +3 -1
  148. package/slider/index.js +5 -5
  149. package/slider/vue.js +16 -0
  150. package/slider-button/index.js +41 -0
  151. package/slider-button/vue.js +36 -0
  152. package/slider-button-group/slide-button.js +142 -0
  153. package/slider-button-group/vue.js +52 -0
  154. package/steps/slide-bar.js +0 -1
  155. package/switch/index.js +1 -1
  156. package/switch/vue.js +1 -1
  157. package/tab-bar/index.js +8 -6
  158. package/tab-nav/index.js +19 -13
  159. package/tab-nav/vue.js +10 -9
  160. package/tabs/index.js +21 -17
  161. package/tabs/vue.js +1 -4
  162. package/tag/vue.js +2 -1
  163. package/tag-group/index.js +23 -10
  164. package/tag-group/vue.js +5 -4
  165. package/time/index.js +8 -8
  166. package/time/vue.js +9 -9
  167. package/time-line/index.js +24 -2
  168. package/time-line/vue.js +30 -4
  169. package/time-panel/index.js +2 -2
  170. package/time-panel/vue.js +2 -2
  171. package/time-range/index.js +24 -21
  172. package/time-range/vue.js +26 -16
  173. package/time-spinner/index.js +32 -21
  174. package/time-spinner/vue.js +37 -12
  175. package/timeline-item/index.js +77 -0
  176. package/timeline-item/vue.js +44 -0
  177. package/toggle-menu/vue.js +0 -1
  178. package/tooltip/index.js +11 -12
  179. package/tooltip/vue.js +11 -1
  180. package/top-box/vue.js +13 -1
  181. package/tree/index.js +228 -15
  182. package/tree/vue.js +119 -15
  183. package/tree-menu/index.js +35 -0
  184. package/tree-menu/vue.js +27 -5
  185. package/tree-node/index.js +75 -10
  186. package/tree-node/vue.js +45 -23
  187. package/upload/index.js +90 -49
  188. package/upload/vue.js +22 -10
  189. package/upload-dragger/index.js +4 -3
  190. package/upload-list/index.js +67 -16
  191. package/upload-list/vue.js +26 -9
  192. package/user/index.js +7 -4
  193. package/user-link/index.js +2 -1
  194. package/wizard/index.js +4 -1
  195. package/wizard/vue.js +19 -2
  196. package/year-range/index.js +1 -1
  197. package/year-range/vue.js +3 -3
  198. package/year-table/index.js +2 -2
package/upload/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  import { KEY_CODE } from "../common";
3
- const isImage = (str) => str.includes("image");
3
+ const isImage = (str) => str.indexOf("image") !== -1;
4
4
  const handleChange = (api) => (event) => {
5
5
  const files = event.target.files;
6
6
  if (!files) {
@@ -8,9 +8,16 @@ const handleChange = (api) => (event) => {
8
8
  }
9
9
  api.uploadFiles(files);
10
10
  };
11
- const getFormData = ({ constants, state, parent, props }) => ({ formData, file, type }) => {
11
+ const getFormData = ({ constants, state, props }) => ({ formData, file, type }) => {
12
+ const uploaderInner = state.uploader.$refs[constants.FILE_UPLOAD_INNER_TEMPLATE];
13
+ if (uploaderInner.edm.upload) {
14
+ const params = uploaderInner.edm.upload.params;
15
+ for (let key in params) {
16
+ formData.set(key, params[key] || "");
17
+ }
18
+ }
12
19
  formData.append(constants.EDM.FILENAME, file.name);
13
- if (parent.edm.isCheckCode === true) {
20
+ if (uploaderInner.edm.isCheckCode === true) {
14
21
  formData.append(constants.EDM.ISCHECKCODE, "Y");
15
22
  formData.append(constants.EDM.CHECKCODE, file.hash);
16
23
  } else {
@@ -19,7 +26,7 @@ const getFormData = ({ constants, state, parent, props }) => ({ formData, file,
19
26
  if (props.isFolder) {
20
27
  formData.append("filePath", file.path);
21
28
  }
22
- const updateId = state.updateId || parent.edm.updateId;
29
+ const updateId = state.updateId || uploaderInner.edm.updateId;
23
30
  if (type === constants.EDM.SINGLEUPLOAD) {
24
31
  formData.append(constants.EDM.MULTIPART, file, props.isFolder ? file.path + file.name : file.name);
25
32
  updateId && formData.append(constants.EDM.DOCID, updateId);
@@ -34,10 +41,18 @@ const getFormData = ({ constants, state, parent, props }) => ({ formData, file,
34
41
  }
35
42
  };
36
43
  const uploadFiles = ({ state, constants, Modal, props, t }) => (files) => {
37
- const { limit, fileList } = props;
38
- if (limit && fileList.length + files.length > limit) {
39
- props.onExceed && props.onExceed(files, fileList);
40
- return;
44
+ if (state.updateId === "") {
45
+ if (props.limit && props.fileList.length + files.length > props.limit) {
46
+ const fileUploadTem = state.uploader.$refs[constants.FILE_UPLOAD_INNER_TEMPLATE];
47
+ if (fileUploadTem && !fileUploadTem.state.listeners.exceed) {
48
+ Modal.message({
49
+ message: t(constants.EDM.NumberExceed, { number: props.limit }),
50
+ status: "warning"
51
+ });
52
+ }
53
+ props.onExceed && props.onExceed(files, props.fileList);
54
+ return;
55
+ }
41
56
  }
42
57
  let postFiles = Array.prototype.slice.call(files);
43
58
  if (props.isFolder) {
@@ -79,9 +94,11 @@ const upload = ({ api, props, refs }) => (rawFile) => {
79
94
  type: rawFile.type
80
95
  });
81
96
  }
82
- Object.keys(rawFile).forEach((p) => {
83
- fileProcessed[p] = rawFile[p];
84
- });
97
+ for (const p in rawFile) {
98
+ if (Object.prototype.hasOwnProperty.call(rawFile, p)) {
99
+ fileProcessed[p] = rawFile[p];
100
+ }
101
+ }
85
102
  api.post(fileProcessed);
86
103
  } else {
87
104
  api.post(rawFile);
@@ -97,7 +114,7 @@ const upload = ({ api, props, refs }) => (rawFile) => {
97
114
  props.onRemove(null, rawFile);
98
115
  }
99
116
  };
100
- const abort = ({ state, props }) => (file) => {
117
+ const abort = ({ state, props, constants }) => (file) => {
101
118
  const { reqs } = state;
102
119
  const cancel = function(uid) {
103
120
  const fn = reqs[uid] && reqs[uid].abort || state.cancelToken[uid];
@@ -115,33 +132,38 @@ const abort = ({ state, props }) => (file) => {
115
132
  }
116
133
  cancel(uid);
117
134
  } else {
135
+ const { READY, UPLOADING, FAIL } = constants.FILE_STATUS;
118
136
  Object.keys(reqs).forEach((uid) => cancel(uid));
119
137
  props.fileList.forEach((file2) => {
120
138
  file2.cancelToken && file2.cancelToken.forEach((cancel2) => cancel2());
121
- file2.status = "fail";
139
+ if ([READY, UPLOADING].includes(file2.status)) {
140
+ file2.status = FAIL;
141
+ }
122
142
  });
123
143
  }
124
144
  };
125
- const getOptionsOfPost = ({ props, state, rawFile, parent, uid }) => ({
126
- headers: Object.assign(props.headers, state.headers),
127
- withCredentials: props.withCredentials,
128
- file: rawFile,
129
- data: props.data,
130
- filename: props.name,
131
- action: parent.action || props.action,
132
- onProgress: (event) => {
133
- props.onProgress(event, rawFile);
134
- },
135
- onSuccess: (res) => {
136
- props.onSuccess(res, rawFile);
137
- delete state.reqs[uid];
138
- },
139
- onError: (error) => {
140
- props.onError(error, rawFile);
141
- delete state.reqs[uid];
142
- }
143
- });
144
- const modifyOptionsOfPost = ({ service, props, options, rawFile, state, uid, parent, api, constants }) => {
145
+ const getOptionsOfPost = ({ props, state, rawFile, uploaderInner, uid }) => {
146
+ return {
147
+ headers: Object.assign(props.headers, state.headers),
148
+ withCredentials: props.withCredentials,
149
+ file: rawFile,
150
+ data: props.data,
151
+ filename: props.name,
152
+ action: uploaderInner.action || props.action,
153
+ onSuccess: (res) => {
154
+ props.onSuccess(res, rawFile);
155
+ delete state.reqs[uid];
156
+ },
157
+ onProgress: (event) => {
158
+ props.onProgress(event, rawFile);
159
+ },
160
+ onError: (error) => {
161
+ props.onError(error, rawFile);
162
+ delete state.reqs[uid];
163
+ }
164
+ };
165
+ };
166
+ const modifyOptionsOfPost = ({ service, props, options, rawFile, state, uid, uploaderInner, api, constants }) => {
145
167
  if (service && service.network && props.httpRequest === service.network.request) {
146
168
  options.method = "post";
147
169
  options.url = options.action;
@@ -154,7 +176,7 @@ const modifyOptionsOfPost = ({ service, props, options, rawFile, state, uid, par
154
176
  const source = service.network.CancelToken.source();
155
177
  options.cancelToken = source.token;
156
178
  state.cancelToken[uid] = source.cancel;
157
- if (parent.edm.upload) {
179
+ if (uploaderInner.edm.upload) {
158
180
  !rawFile.isLargeFile && (options.method = "put");
159
181
  options.data = options.data || {};
160
182
  }
@@ -179,20 +201,37 @@ const modifyOptionsOfPost = ({ service, props, options, rawFile, state, uid, par
179
201
  options.data = formData;
180
202
  }
181
203
  };
182
- const post = ({ api, constants, parent, props, state, service }) => (rawFile) => {
204
+ const getOptionsOfHwh5 = ({ state, props, rawFile, uploaderInner, uid }) => {
205
+ return {
206
+ edmAuth: {
207
+ edmToken: props.edmToken.edmToken,
208
+ appId: uploaderInner.hwh5.appId
209
+ },
210
+ filePath: rawFile.filePath,
211
+ progress: 1,
212
+ onProgress: (data) => {
213
+ props.onProgress(data, rawFile);
214
+ },
215
+ onSuccess: (res) => {
216
+ props.onSuccess(res, rawFile);
217
+ delete state.reqs[uid];
218
+ },
219
+ onError: (error) => {
220
+ props.onError(error, rawFile);
221
+ delete state.reqs[uid];
222
+ }
223
+ };
224
+ };
225
+ const post = ({ api, constants, props, state, service }) => (rawFile) => {
183
226
  const { uid } = rawFile;
184
- let options = getOptionsOfPost({ props, state, rawFile, parent, uid });
185
- modifyOptionsOfPost({
186
- service,
187
- props,
188
- options,
189
- rawFile,
190
- state,
191
- uid,
192
- parent,
193
- api,
194
- constants
195
- });
227
+ const uploaderInner = state.uploader.$refs[constants.FILE_UPLOAD_INNER_TEMPLATE];
228
+ let options;
229
+ if (uploaderInner.state.isHwh5) {
230
+ options = getOptionsOfHwh5({ state, props, rawFile, uploaderInner, uid });
231
+ } else {
232
+ options = getOptionsOfPost({ props, state, rawFile, uploaderInner, uid });
233
+ modifyOptionsOfPost({ service, props, options, rawFile, state, uid, uploaderInner, api, constants });
234
+ }
196
235
  const excuteReq = (options2) => {
197
236
  const req = props.httpRequest(options2);
198
237
  state.reqs[uid] = req;
@@ -209,8 +248,9 @@ const post = ({ api, constants, parent, props, state, service }) => (rawFile) =>
209
248
  excuteReq(options);
210
249
  }
211
250
  };
212
- const handleClick = ({ props, refs }) => () => {
213
- if (!props.disabled) {
251
+ const handleClick = ({ props, refs }) => ($event, type) => {
252
+ if (!props.disabled && !props.displayOnly) {
253
+ props.handleTriggerClick($event, type);
214
254
  refs.input.value = null;
215
255
  refs.input.click();
216
256
  }
@@ -239,6 +279,7 @@ const mounted = ({ state, props, api }) => () => {
239
279
  state.updateInput = Object.freeze(updateInput);
240
280
  };
241
281
  const onBeforeDestroy = (state) => () => {
282
+ state.updateInput.onchange = null;
242
283
  state.updateInput = null;
243
284
  };
244
285
  export {
package/upload/vue.js CHANGED
@@ -13,17 +13,29 @@ import {
13
13
  mounted,
14
14
  onBeforeDestroy
15
15
  } from "./index";
16
- const api = ["state", "isImage", "handleChange", "uploadFiles", "upload", "abort", "post", "handleClick", "handleKeydown", "handleUpdate"];
17
- const renderless = (props, { computed, inject, reactive, onMounted, onBeforeUnmount }, { refs, service, parent, t }, { Modal }) => {
16
+ const api = [
17
+ "state",
18
+ "isImage",
19
+ "handleChange",
20
+ "uploadFiles",
21
+ "upload",
22
+ "abort",
23
+ "post",
24
+ "handleClick",
25
+ "handleKeydown",
26
+ "handleUpdate"
27
+ ];
28
+ const renderless = (props, { computed, inject, reactive, onMounted, onBeforeUnmount }, { refs, service, t }, { Modal }) => {
18
29
  const api2 = {};
19
- const constants = parent.$parent.$constants;
30
+ const uploader = inject("uploader");
31
+ const constants = uploader.$constants;
20
32
  const state = reactive({
21
33
  mouseover: false,
22
34
  reqs: {},
23
- uploader: inject("uploader"),
35
+ uploader,
24
36
  accecpt: "",
25
- isEdm: computed(() => state.uploader.$refs[constants.FILE_UPLOAD_INNER].state.isEdm),
26
- openEdmDownload: computed(() => state.uploader.$refs[constants.FILE_UPLOAD_INNER].edm.download),
37
+ isEdm: computed(() => state.uploader.$refs[constants.FILE_UPLOAD_INNER_TEMPLATE].state.isEdm),
38
+ openEdmDownload: computed(() => state.uploader.$refs[constants.FILE_UPLOAD_INNER_TEMPLATE].edm.download),
27
39
  headers: computed(() => {
28
40
  if (state.isEdm) {
29
41
  return {
@@ -40,13 +52,13 @@ const renderless = (props, { computed, inject, reactive, onMounted, onBeforeUnmo
40
52
  Object.assign(api2, {
41
53
  state,
42
54
  isImage,
43
- abort: abort({ state, props }),
44
- getFormData: getFormData({ state, constants, parent, props }),
55
+ abort: abort({ state, props, constants }),
56
+ getFormData: getFormData({ state, constants, props }),
45
57
  handleClick: handleClick({ props, refs }),
46
58
  onBeforeDestroy: onBeforeDestroy(state),
47
59
  handleUpdate: handleUpdate({ state, props }),
48
- uploadFiles: uploadFiles({ api: api2, constants, Modal, props, state, t }),
49
- post: post({ api: api2, constants, parent, props, state, service }),
60
+ uploadFiles: uploadFiles({ constants, Modal, props, state, t }),
61
+ post: post({ api: api2, constants, props, state, service }),
50
62
  handleChange: handleChange(api2),
51
63
  handleKeydown: handleKeydown(api2),
52
64
  upload: upload({ api: api2, props, refs }),
@@ -6,12 +6,13 @@ const onDrop = ({ emit, props, state }) => (event) => {
6
6
  }
7
7
  const accept = state.uploader.accept;
8
8
  state.dragover = false;
9
+ const files = event.dataTransfer.files;
9
10
  if (!accept) {
10
- emit("file", event.dataTransfer.files);
11
+ emit("file", files);
11
12
  return;
12
13
  }
13
14
  const notAcceptedFiles = [];
14
- const filteredFile = [].slice.call(event.dataTransfer.files).filter((file) => {
15
+ const filteredFile = [].slice.call(files).filter((file) => {
15
16
  const { type, name } = file;
16
17
  const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
17
18
  const baseType = type.replace(/\/.*$/, "");
@@ -34,7 +35,7 @@ const onDrop = ({ emit, props, state }) => (event) => {
34
35
  emit("file", filteredFile);
35
36
  };
36
37
  const watchDragover = ({ state, constants }) => () => {
37
- state.uploader.$refs[constants.FILE_UPLOAD_INNER].$emit("drag-over", state.dragover);
38
+ state.uploader.$refs[constants.FILE_UPLOAD_INNER_TEMPLATE].$emit("drag-over", state.dragover);
38
39
  };
39
40
  export {
40
41
  onDragOver,
@@ -2,7 +2,8 @@ import "../chunk-PKUHTIDK.js";
2
2
  import { xss } from "../common/xss";
3
3
  import { addResizeListener, removeResizeListener } from "../common/deps/resize-event";
4
4
  const parsePercentage = () => (val) => parseInt(val, 10);
5
- const handleClick = ({ props, api, parent }) => (file) => {
5
+ const handleClick = ({ props, api, parent }) => (e, file) => {
6
+ e.preventDefault();
6
7
  if (parent.state.isEdm) {
7
8
  const { downloadFile: downloadFile2 } = api.getApi();
8
9
  props.openDownloadFile && downloadFile2 && downloadFile2(file);
@@ -48,8 +49,11 @@ const reUpload = ({ emit, props, parent }) => (file) => {
48
49
  };
49
50
  const addPlayEventListener = ({ type, el }, fn) => el && el.addEventListener(type, fn);
50
51
  const removePlayEventListener = ({ type, el }, fn) => el && el.removeEventListener(type, fn);
51
- const play = ({ vm, api }) => ({ file, index, type }) => {
52
- const videoOrAudioEle = vm.$refs[type + (file.uid || index)] && vm.$refs[type + (file.uid || index)][index];
52
+ const play = ({ vm, api, props }) => ({ file, index, type }) => {
53
+ if (props.isHwh5) {
54
+ return props.triggerPlay(file, type, "play");
55
+ }
56
+ const videoOrAudioEle = vm.$refs[type + (file.uid || index)] && vm.$refs[type + (file.uid || index)][0];
53
57
  if (file.isPlay)
54
58
  return api.pause({ file, index, type });
55
59
  if (videoOrAudioEle && videoOrAudioEle.play) {
@@ -66,8 +70,11 @@ const play = ({ vm, api }) => ({ file, index, type }) => {
66
70
  videoOrAudioEle.play();
67
71
  }
68
72
  };
69
- const pause = ({ vm }) => ({ file, index, type }) => {
70
- const videoOrAudioEle = vm.$refs[type + (file.uid || index)] && vm.$refs[type + (file.uid || index)][index];
73
+ const pause = ({ vm, props }) => ({ file, index, type }) => {
74
+ if (props.isHwh5) {
75
+ return props.triggerPlay(file, type, "pause");
76
+ }
77
+ const videoOrAudioEle = vm.$refs[type + (file.uid || index)] && vm.$refs[type + (file.uid || index)][0];
71
78
  if (videoOrAudioEle && videoOrAudioEle.pause) {
72
79
  removePlayEventListener({ type: "ended", el: videoOrAudioEle }, file.playEvent);
73
80
  file.isPlay = false;
@@ -82,45 +89,46 @@ const handleTimeupdate = () => ({ e, file }) => {
82
89
  file.currentSecond = parseInt(e.target.currentTime);
83
90
  };
84
91
  const getFileType = () => ({ file }) => file.name && file.name.split(".")[file.name.split(".").length - 1].toLowerCase();
85
- const getFileIcon = () => ({ type }) => {
92
+ const getFileIcon = ({ constants }) => ({ type }) => {
93
+ const { EXCEL, FILE, PDF, PICTURE, PPT, TEXT, WORD, ZIP, VIDEO, AUDIO } = constants.FILE_TYPE;
86
94
  let iconTypes = {
87
- "xls/xlsx": {
95
+ [EXCEL]: {
88
96
  name: "icon-excel-type",
89
97
  color: "#00A2B5"
90
98
  },
91
- file: {
99
+ [FILE]: {
92
100
  name: "icon-file-type",
93
101
  color: "#71C14C"
94
102
  },
95
- pdf: {
103
+ [PDF]: {
96
104
  name: "icon-pdf-type",
97
105
  color: "#FC916E"
98
106
  },
99
- "png/jpg/jpeg/gif/svg/webp/bmp/tif/pjp/apng/xbm/jxl/svgz/ico/tiff/jfif/pjpeg/avif": {
107
+ [PICTURE]: {
100
108
  name: "icon-picture-type",
101
109
  color: "#2E94FF"
102
110
  },
103
- "ppt/pptx": {
111
+ [PPT]: {
104
112
  name: "icon-ppt-type",
105
113
  color: "#F46087"
106
114
  },
107
- txt: {
115
+ [TEXT]: {
108
116
  name: "icon-text-type",
109
117
  color: "#9185F0"
110
118
  },
111
- "doc/docx": {
119
+ [WORD]: {
112
120
  name: "icon-word-type",
113
121
  color: "#2070F3"
114
122
  },
115
- "zip/rar/arj/z/jar/lzh": {
123
+ [ZIP]: {
116
124
  name: "icon-zip-type",
117
125
  color: "#FDC000"
118
126
  },
119
- "mp4/ogg/webm": {
127
+ [VIDEO]: {
120
128
  name: "icon-video-type",
121
129
  color: "#2E94FF"
122
130
  },
123
- "mp3/ogg/wav": {
131
+ [AUDIO]: {
124
132
  name: "icon-audio",
125
133
  color: "#2E94FF"
126
134
  },
@@ -162,6 +170,45 @@ const calcUploadListLiWidth = ({ vm, nextTick, props, constants }) => () => {
162
170
  }
163
171
  });
164
172
  };
173
+ const calcVisible = ({ props, constants, emit }) => () => {
174
+ const { SUCESS } = constants.FILE_STATUS;
175
+ const isAllSuccess = props.files.every(({ status }) => status === SUCESS || !status);
176
+ emit("update:visible", !isAllSuccess);
177
+ };
178
+ const getNotSuccessFiles = ({ props, constants }) => () => {
179
+ const { SUCESS } = constants.FILE_STATUS;
180
+ let files = props.files;
181
+ if (props.mode === constants.MODE.BUBBLE && props.listType === constants.LIST_TYPE.TEXT) {
182
+ files = props.files.filter(({ status }) => status !== SUCESS);
183
+ }
184
+ return files;
185
+ };
186
+ const chooseFile = ({ state, constants }) => (type) => {
187
+ const { SOURCE_AUDIO } = constants.SOURCE_TYPE;
188
+ if (type === SOURCE_AUDIO) {
189
+ state.showAudioPanel = true;
190
+ } else {
191
+ state.showTriggerPanel = true;
192
+ }
193
+ state.triggerClickType = type;
194
+ };
195
+ const handleTriggerClick = ({ state, props }) => ($event, type) => {
196
+ return new Promise((resolve) => {
197
+ let res = props.triggerClick($event, state.triggerClickType, type);
198
+ if (res && res.then) {
199
+ res.then(() => {
200
+ state.showTriggerPanel = false;
201
+ resolve();
202
+ }).catch(() => {
203
+ state.showTriggerPanel = false;
204
+ state.showAudioPanel = false;
205
+ });
206
+ } else {
207
+ state.showTriggerPanel = false;
208
+ resolve();
209
+ }
210
+ });
211
+ };
165
212
  const mounted = ({ api, vm }) => () => {
166
213
  const el = vm.$refs["upload-list"];
167
214
  el && addResizeListener(el, api.calcUploadListLiWidth);
@@ -177,14 +224,18 @@ const destroyed = ({ api, props, vm }) => () => {
177
224
  };
178
225
  export {
179
226
  calcUploadListLiWidth,
227
+ calcVisible,
228
+ chooseFile,
180
229
  destroyed,
181
230
  downloadFile,
182
231
  getDeleteData,
183
232
  getFileIcon,
184
233
  getFileType,
234
+ getNotSuccessFiles,
185
235
  handleClick,
186
236
  handleLoadedmetadata,
187
237
  handleTimeupdate,
238
+ handleTriggerClick,
188
239
  mounted,
189
240
  parsePercentage,
190
241
  pause,
@@ -16,7 +16,11 @@ import {
16
16
  mounted,
17
17
  calcUploadListLiWidth,
18
18
  reUpload,
19
- remove
19
+ remove,
20
+ handleTriggerClick,
21
+ chooseFile,
22
+ calcVisible,
23
+ getNotSuccessFiles
20
24
  } from "./index";
21
25
  import { getToken, initService } from "../file-upload";
22
26
  import { getApi } from "../file-upload/vue";
@@ -37,11 +41,13 @@ const api = [
37
41
  "getFileType",
38
42
  "getFileIcon",
39
43
  "reUpload",
40
- "remove"
44
+ "remove",
45
+ "handleTriggerClick",
46
+ "chooseFile"
41
47
  ];
42
- const renderless = (props, { reactive, onMounted, onUnmounted, watch }, { t, parent, mode, emit, service, vm, nextTick }, { Modal }) => {
48
+ const renderless = (props, { reactive, onMounted, onUnmounted, watch, inject, computed }, { t, parent, mode, emit, service, vm, nextTick }, { Modal }) => {
43
49
  const api2 = { getApi };
44
- parent = parent.$parent;
50
+ parent = inject("uploader").$children[0];
45
51
  const constants = parent.$constants;
46
52
  const $service = initService({ props, service });
47
53
  const state = reactive({
@@ -49,7 +55,11 @@ const renderless = (props, { reactive, onMounted, onUnmounted, watch }, { t, par
49
55
  shows: false,
50
56
  startPostion: 0,
51
57
  screenType: mode === "mobile" ? true : false,
52
- showPanel: false
58
+ showPanel: false,
59
+ showTriggerPanel: false,
60
+ triggerClickType: "",
61
+ showAudioPanel: false,
62
+ files: computed(() => api2.getNotSuccessFiles())
53
63
  });
54
64
  parent.getToken = getToken({ constants, props: parent, state: parent.state, t, Modal });
55
65
  Object.assign(api2, {
@@ -59,18 +69,22 @@ const renderless = (props, { reactive, onMounted, onUnmounted, watch }, { t, par
59
69
  downloadFile: downloadFile($service),
60
70
  picturefilePreview: picturefilePreview(state),
61
71
  handleClick: handleClick({ props, api: api2, parent }),
62
- play: play({ vm, api: api2 }),
63
- pause: pause({ vm }),
72
+ play: play({ vm, api: api2, props }),
73
+ pause: pause({ vm, props }),
64
74
  handleLoadedmetadata: handleLoadedmetadata({ vm }),
65
75
  handleTimeupdate: handleTimeupdate(),
66
76
  destroyed: destroyed({ api: api2, props, vm }),
67
77
  showOperatePanel: showOperatePanel({ state }),
68
78
  getFileType: getFileType(),
69
- getFileIcon: getFileIcon(),
79
+ getFileIcon: getFileIcon({ constants }),
70
80
  mounted: mounted({ api: api2, vm }),
71
81
  calcUploadListLiWidth: calcUploadListLiWidth({ vm, nextTick, props, constants }),
72
82
  reUpload: reUpload({ emit, props, parent }),
73
- remove: remove({ emit })
83
+ remove: remove({ emit }),
84
+ handleTriggerClick: handleTriggerClick({ state, props }),
85
+ chooseFile: chooseFile({ state, constants }),
86
+ calcVisible: calcVisible({ props, constants, emit }),
87
+ getNotSuccessFiles: getNotSuccessFiles({ props, constants })
74
88
  });
75
89
  props.listType === constants.LIST_TYPE.DRAG_SINGLE && watch(
76
90
  () => props.files && props.files[0],
@@ -84,6 +98,9 @@ const renderless = (props, { reactive, onMounted, onUnmounted, watch }, { t, par
84
98
  { immediate: true, deep: true }
85
99
  );
86
100
  watch(() => props.files, api2.calcUploadListLiWidth);
101
+ if (props.mode === constants.MODE.BUBBLE && props.listType === constants.LIST_TYPE.TEXT) {
102
+ constants && watch(() => props.files, api2.calcVisible, { immediate: true, deep: true });
103
+ }
87
104
  onMounted(api2.mounted);
88
105
  onUnmounted(api2.destroyed);
89
106
  return api2;
package/user/index.js CHANGED
@@ -317,7 +317,7 @@ const getUsers = ({ api, props, state }) => (value) => {
317
317
  };
318
318
  const updateCache = ({ props, state }) => () => {
319
319
  const users = toJson(window.localStorage.getItem(props.cacheKey)) || {};
320
- const currDate = toDateStr(/* @__PURE__ */ new Date(), "yyyyMMdd");
320
+ const currDate = toDateStr(new Date(), "yyyyMMdd");
321
321
  if (currDate !== users.t) {
322
322
  users.t = currDate;
323
323
  for (let u in users) {
@@ -351,7 +351,6 @@ const cacheUser = ({ api, props, service, state }) => (users) => {
351
351
  } else {
352
352
  const us = {
353
353
  p: u[valueField],
354
- // 增加一个主键
355
354
  i: u[cacheFields.userId],
356
355
  u: u[cacheFields.userCN],
357
356
  d: u[cacheFields.dept],
@@ -434,9 +433,13 @@ const handleBlur = ({ constants, dispatch, state }) => () => {
434
433
  const initService = ({ props, service }) => {
435
434
  const noopFnCreator = (propName) => () => {
436
435
  if (propName) {
437
- return Promise.reject(new Error(`[TINY Error][User]] Prop ${propName} is not configured`));
436
+ return Promise.reject(
437
+ new Error(`[TINY Error][User]] Prop ${propName} is mandatory when the framework service is not used`)
438
+ );
438
439
  } else {
439
- return Promise.reject(new Error("[TINY Error][User]] This component depends on @opentiny/service"));
440
+ return Promise.reject(
441
+ new Error("[TINY Error][User]] Prop service is mandatory when the framework service is not used")
442
+ );
440
443
  }
441
444
  };
442
445
  const $service = service || {};
@@ -16,7 +16,8 @@ const initUser = ({ api, props, state }) => (value) => {
16
16
  props.cache && api.cacheUser(info);
17
17
  });
18
18
  };
19
- const showCard = ({ api, service, state }) => (user) => {
19
+ const showCard = ({ api, service, state }) => (e, user) => {
20
+ e.preventDefault();
20
21
  state.spinner = true;
21
22
  state.expand = false;
22
23
  service.fetchUser(user.employeeNumber).then((data) => {
package/wizard/index.js CHANGED
@@ -59,7 +59,10 @@ const timelineflowData = ({ state, props, api }) => () => {
59
59
  item._dateTime = new Date(typeof item.date === "string" ? item.date.replace(/-/g, "/") : item.date);
60
60
  return item;
61
61
  }).sort((a, b) => a._dateTime.getTime() - b._dateTime.getTime()).map((item) => {
62
- item.date = format(item._dateTime, typeof state.datas[0].date === "string" && ~state.datas[0].date.indexOf("/") ? "yyyy/MM/dd" : "yyyy-MM-dd");
62
+ item.date = format(
63
+ item._dateTime,
64
+ typeof state.datas[0].date === "string" && ~state.datas[0].date.indexOf("/") ? "yyyy/MM/dd" : "yyyy-MM-dd"
65
+ );
63
66
  item.time = format(item._dateTime, "hh:mm");
64
67
  delete item._dateTime;
65
68
  return item;
package/wizard/vue.js CHANGED
@@ -1,6 +1,23 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
- import { btnSaveHandle, nodeClick, submitHandle, lastStepHandle, nextStepHandle, showNode, timelineflowData, setTimelineflowNodeStatus } from "./index";
3
- const api = ["state", "btnSaveHandle", "nodeClick", "submitHandle", "lastStepHandle", "nextStepHandle", "showNode"];
2
+ import {
3
+ btnSaveHandle,
4
+ nodeClick,
5
+ submitHandle,
6
+ lastStepHandle,
7
+ nextStepHandle,
8
+ showNode,
9
+ timelineflowData,
10
+ setTimelineflowNodeStatus
11
+ } from "./index";
12
+ const api = [
13
+ "state",
14
+ "btnSaveHandle",
15
+ "nodeClick",
16
+ "submitHandle",
17
+ "lastStepHandle",
18
+ "nextStepHandle",
19
+ "showNode"
20
+ ];
4
21
  const renderless = (props, { onMounted, reactive }, { emit, constants }) => {
5
22
  const state = reactive({
6
23
  datas: props.data,
@@ -7,7 +7,7 @@ const calcDefaultValue = (value) => {
7
7
  } else if (value) {
8
8
  return [new Date(value), nextMonth(new Date(value))];
9
9
  }
10
- return [/* @__PURE__ */ new Date(), nextMonth(/* @__PURE__ */ new Date())];
10
+ return [new Date(), nextMonth(new Date())];
11
11
  };
12
12
  const watchValue = ({ state }) => (data) => {
13
13
  if (!data) {
package/year-range/vue.js CHANGED
@@ -32,8 +32,8 @@ const initState = ({ reactive, computed, api: api2, t }) => {
32
32
  defaultTime: null,
33
33
  minDate: "",
34
34
  maxDate: "",
35
- leftDate: /* @__PURE__ */ new Date(),
36
- rightDate: nextYear(/* @__PURE__ */ new Date()),
35
+ leftDate: new Date(),
36
+ rightDate: nextYear(new Date()),
37
37
  rangeState: { startDate: null, endDate: null, selecting: false, row: null, column: null },
38
38
  shortcuts: "",
39
39
  visible: "",
@@ -41,7 +41,7 @@ const initState = ({ reactive, computed, api: api2, t }) => {
41
41
  format: "",
42
42
  arrowControl: false,
43
43
  unlinkPanels: false,
44
- leftStartYear: Math.floor((/* @__PURE__ */ new Date()).getFullYear() / 10) * 10,
44
+ leftStartYear: Math.floor(new Date().getFullYear() / 10) * 10,
45
45
  rightStartYear: computed(() => state.leftStartYear + DATEPICKER.PanelYearNum),
46
46
  btnDisabled: computed(
47
47
  () => !(state.minDate && state.maxDate && !state.selecting && api2.isValidValue([state.minDate, state.maxDate]))
@@ -13,7 +13,7 @@ const getCellStyle = ({ props }) => (cell) => {
13
13
  const { defaultValue } = props;
14
14
  const year = cell.text;
15
15
  const style = {};
16
- const today = /* @__PURE__ */ new Date();
16
+ const today = new Date();
17
17
  style.disabled = typeof props.disabledDate === "function" ? datesInYear(year).every(props.disabledDate) : false;
18
18
  const execDate = typeof props.value === "object" ? props.value : toDate(props.value);
19
19
  style.current = arrayFindIndex(coerceTruthyValueToArray(execDate), (date) => date.getFullYear() === year) >= 0;
@@ -46,7 +46,7 @@ const getRows = ({ props, state, vm }) => () => {
46
46
  const { tableRows } = state;
47
47
  const { minDate, maxDate, disabledDate, startYear, selectionMode } = props;
48
48
  const selectedDate = [];
49
- const now = (/* @__PURE__ */ new Date()).getFullYear();
49
+ const now = new Date().getFullYear();
50
50
  for (let i = 0; i < 3; i++) {
51
51
  const row = tableRows[i];
52
52
  for (let j = 0; j < 4; j++) {