ranui 0.1.0-alpha → 0.1.1-alpha.12

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 (106) hide show
  1. package/LICENSE +21 -0
  2. package/dist/_commonjs-dynamic-modules-2ceabb0b.js +12 -0
  3. package/dist/add-user-d07564bd.js +4 -0
  4. package/dist/book-2a5a596c.js +4 -0
  5. package/dist/check-circle-2c986969.js +4 -0
  6. package/dist/check-circle-fill-62eaa796.js +4 -0
  7. package/dist/close-circle-2afb6e94.js +4 -0
  8. package/dist/close-circle-fill-b6906239.js +4 -0
  9. package/dist/close-ee3ba1d1.js +4 -0
  10. package/dist/colz-746223ab.js +241 -0
  11. package/dist/components/button/index.d.ts +331 -1
  12. package/dist/components/icon/index.d.ts +2 -0
  13. package/dist/components/input/index.d.ts +435 -1
  14. package/dist/components/message/index.d.ts +8 -0
  15. package/dist/components/preview/colz.d.ts +72 -0
  16. package/dist/components/preview/docx.d.ts +8 -0
  17. package/dist/components/preview/excel/excel.d.ts +11 -0
  18. package/dist/components/preview/excel/index.d.ts +1 -0
  19. package/dist/components/preview/excel/media.d.ts +37 -0
  20. package/dist/components/preview/index.d.ts +2 -0
  21. package/dist/components/preview/pdf.d.ts +1 -0
  22. package/dist/components/preview/pptx/index.d.ts +16 -0
  23. package/dist/components/preview/pptx/process_pptx.d.ts +23 -0
  24. package/dist/components/preview/pptx/t_xml.d.ts +1 -0
  25. package/dist/components/preview/pptx/worker.d.ts +1 -0
  26. package/dist/components/skeleton/index.d.ts +2 -0
  27. package/dist/components/tabpane/index.d.ts +327 -0
  28. package/dist/components/tabs/index.d.ts +382 -1
  29. package/dist/components/video/index.d.ts +393 -0
  30. package/dist/docx-a71f9b36.js +2635 -0
  31. package/dist/eye-bd60afe1.js +4 -0
  32. package/dist/eye-close-bde3c1fc.js +4 -0
  33. package/dist/home-f824d8f4.js +4 -0
  34. package/dist/index-b14db636.js +23075 -0
  35. package/dist/index-d9a6fb36.js +1756 -0
  36. package/dist/index-eca1b437.js +85583 -0
  37. package/dist/index.d.ts +9 -0
  38. package/dist/index.js +11 -676
  39. package/dist/index.umd.cjs +53 -2
  40. package/dist/info-circle-59333e1c.js +4 -0
  41. package/dist/info-circle-fill-3ab7660d.js +4 -0
  42. package/dist/jszip.min-97cf7c6a.js +2655 -0
  43. package/dist/loading-407d8249.js +4 -0
  44. package/dist/lock-6d20715b.js +4 -0
  45. package/dist/message-ee4fe153.js +4 -0
  46. package/dist/pdf-f6057747.js +112 -0
  47. package/dist/playwright.config.d.ts +11 -0
  48. package/dist/plugins/auto-import-file.d.ts +10 -0
  49. package/dist/plugins/load-style.d.ts +6 -0
  50. package/dist/plugins/load-svg.d.ts +9 -0
  51. package/dist/power-off-bbec6b5f.js +4 -0
  52. package/dist/preview-164a4944.js +4 -0
  53. package/dist/setting-735a1963.js +4 -0
  54. package/dist/style.css +1 -1
  55. package/dist/team-42573142.js +4 -0
  56. package/dist/tests/button.spec.d.ts +1 -0
  57. package/dist/unlock-ae33c6f7.js +4 -0
  58. package/dist/user-b7098183.js +4 -0
  59. package/dist/utils/index.d.ts +34 -4
  60. package/dist/vite.config.d.ts +2 -0
  61. package/dist/warning-circle-536d4749.js +4 -0
  62. package/dist/warning-circle-fill-e4be98bc.js +4 -0
  63. package/package.json +51 -17
  64. package/readme.md +71 -0
  65. package/.vitepress/config.ts +0 -26
  66. package/.vitepress/theme/index.ts +0 -9
  67. package/assets/image/failImage.ts +0 -4
  68. package/assets/svgs/check-circle.svg +0 -4
  69. package/assets/svgs/close-circle.svg +0 -4
  70. package/assets/svgs/eye-close.svg +0 -4
  71. package/assets/svgs/eye.svg +0 -4
  72. package/assets/svgs/info-circle.svg +0 -5
  73. package/assets/svgs/lock.svg +0 -4
  74. package/assets/svgs/unlock.svg +0 -4
  75. package/assets/svgs/user.svg +0 -3
  76. package/components/button/index.less +0 -95
  77. package/components/button/index.ts +0 -64
  78. package/components/form/index.ts +0 -36
  79. package/components/image/index.less +0 -0
  80. package/components/image/index.ts +0 -62
  81. package/components/input/index.less +0 -114
  82. package/components/input/index.ts +0 -367
  83. package/components/modal/index.less +0 -0
  84. package/components/modal/index.ts +0 -118
  85. package/components/tabPane/index.less +0 -0
  86. package/components/tabPane/index.ts +0 -71
  87. package/components/tabs/index.less +0 -47
  88. package/components/tabs/index.ts +0 -207
  89. package/dist/index.js.map +0 -1
  90. package/dist/index.umd.cjs.map +0 -1
  91. package/dist/typings.d.ts +0 -4
  92. package/docs/button/index.md +0 -25
  93. package/docs/image/index.md +0 -9
  94. package/docs/input/index.md +0 -146
  95. package/docs/tabs/index.md +0 -121
  96. package/index.html +0 -67
  97. package/index.md +0 -1
  98. package/index.ts +0 -6
  99. package/plugins/auto-import-file.ts +0 -59
  100. package/plugins/load-style.ts +0 -31
  101. package/tsconfig.json +0 -31
  102. package/typings.d.ts +0 -4
  103. package/utils/index.ts +0 -12
  104. package/vite.config.ts +0 -58
  105. /package/{components/form/index.less → dist/component.d.ts} +0 -0
  106. /package/dist/components/{tabPane → form}/index.d.ts +0 -0
@@ -1,367 +0,0 @@
1
- import { isDisabled, falseList } from '@/utils/index'
2
-
3
- class CustomElement extends HTMLElement {
4
- static get observedAttributes() {
5
- return [
6
- "label",
7
- "disabled",
8
- "name",
9
- "pattern",
10
- "required",
11
- "placeholder",
12
- "type",
13
- ];
14
- }
15
- private _container: HTMLDivElement;
16
- private _label: HTMLLabelElement | undefined;
17
- private _input: HTMLInputElement;
18
- constructor() {
19
- super();
20
- const shadowRoot = this.attachShadow({ mode: "closed" });
21
- this._container = document.createElement("div");
22
- this._container.setAttribute("class", "input");
23
- this._input = document.createElement("input");
24
- this._input.setAttribute("class", "input-main");
25
- this._container.appendChild(this._input);
26
- shadowRoot.appendChild(this._container);
27
- }
28
- /**
29
- * @description: 获取input的值
30
- * @return {String}
31
- */
32
- get value() {
33
- return this.getAttribute("value");
34
- }
35
- /**
36
- * @description: 设置input的值
37
- * @param {String} value
38
- */
39
- set value(value) {
40
- if (!isDisabled(this) && value) {
41
- this.setAttribute("value", value);
42
- this._container.setAttribute("value", value);
43
- } else {
44
- this.removeAttribute("value");
45
- this._container.removeAttribute("value");
46
- }
47
- }
48
- /**
49
- * @description: 获取input的占位字符
50
- * @return {String}
51
- */
52
- get placeholder() {
53
- return this.getAttribute("placeholder");
54
- }
55
- /**
56
- * @description: 设置input的占位字符
57
- * @param {String} value
58
- */
59
- set placeholder(value) {
60
- if (value) {
61
- this.setAttribute("placeholder", value);
62
- } else {
63
- this.removeAttribute("placeholder");
64
- }
65
- }
66
- /**
67
- * @description: input是否为必选
68
- * @return {String}
69
- */
70
- get required() {
71
- return this.getAttribute("required");
72
- }
73
- /**
74
- * @description: 设置input是否为必选,除非设置成false,否则都是必填
75
- * @param {*} value
76
- */
77
- set required(value) {
78
- if (!value || value === "false") {
79
- this.removeAttribute("required");
80
- } else {
81
- this.setAttribute("required", "");
82
- }
83
- }
84
- /**
85
- * @description: 获取input校验失败的提示
86
- * @return {String}
87
- */
88
- get warning() {
89
- return this.getAttribute("warning");
90
- }
91
- /**
92
- * @description: 设置input校验失败的提示信息
93
- * @param {String} value
94
- */
95
- set warning(value) {
96
- if (!value) {
97
- this.removeAttribute("warning");
98
- } else {
99
- this.setAttribute("warning", value);
100
- }
101
- }
102
- /**
103
- * @description: 获取校验的正则
104
- * @return {String}
105
- */
106
- get pattern() {
107
- return this.getAttribute("pattern");
108
- }
109
- /**
110
- * @description: 设置input校验的正则
111
- * @param {*} value
112
- */
113
- set pattern(value) {
114
- if (!value || value === "false") {
115
- this.removeAttribute("pattern");
116
- } else {
117
- this.setAttribute("pattern", value);
118
- }
119
- }
120
- /**
121
- * @description: 获取input上disabled属性
122
- * @return {String | null}
123
- */
124
- get disabled() {
125
- return isDisabled(this);
126
- }
127
- /**
128
- * @description: 设置input的disabled属性
129
- * @param {String} value
130
- */
131
- set disabled(value) {
132
- if (falseList.includes(value)) {
133
- this.removeAttribute("disabled");
134
- this._container.removeAttribute("disabled");
135
- this._input.removeAttribute("disabled");
136
- } else {
137
- this.setAttribute("disabled", "");
138
- this._container.setAttribute("disabled", "");
139
- this._input.setAttribute("disabled", "");
140
- }
141
- }
142
- /**
143
- * @description: 获取类似于Metiral Design的输入体验。
144
- */
145
- get label() {
146
- return this.getAttribute("label") || "";
147
- }
148
- /**
149
- * @description: 设置类似于Metiral Design的输入体验。
150
- */
151
- set label(value: string) {
152
- this.setAttribute("label", value);
153
- }
154
- /**
155
- * @description: 与form组件联动时,收集的属性名
156
- * @return {String}
157
- */
158
- get name() {
159
- return this.getAttribute("name") || "";
160
- }
161
- /**
162
- * @description: 设置name属性
163
- * @param {string} value
164
- */
165
- set name(value: string) {
166
- this.setAttribute("name", value);
167
- }
168
- /**
169
- * @description: 获取一个icon
170
- * @return {String}
171
- */
172
- get icon() {
173
- return this.getAttribute("icon");
174
- }
175
- /**
176
- * @description: 设置icon来表示标识
177
- * @param {string|null} value
178
- */
179
- set icon(value) {
180
- if (value) {
181
- this.setAttribute("icon", value);
182
- } else {
183
- this.removeAttribute("icon");
184
- }
185
- }
186
- /**
187
- * @description: 获取input的类型
188
- * @return {string|null}
189
- */
190
- get type() {
191
- return this.getAttribute("type");
192
- }
193
- /**
194
- * @description: 设置input的类型
195
- * @param {string|null} value
196
- */
197
- set type(value) {
198
- if (value) {
199
- this.setAttribute("type", value);
200
- } else {
201
- this.removeAttribute("type");
202
- }
203
- }
204
-
205
- /**
206
- * @description: 原生的input方法
207
- * @param {Event} event
208
- */
209
- inputValue = (event: Event) => {
210
- event.stopPropagation();
211
- const target = event.target as HTMLInputElement;
212
- this.value = target ? target.value : "";
213
- this.dispatchEvent(
214
- new CustomEvent("input", {
215
- detail: {
216
- value: this.value,
217
- },
218
- })
219
- );
220
- };
221
- /**
222
- * @description: 增加change方法
223
- */
224
- change = () => {
225
- this.dispatchEvent(
226
- new CustomEvent("change", {
227
- detail: {
228
- value: this.value,
229
- },
230
- })
231
- );
232
- };
233
- /**
234
- * @description: 增加focus方法
235
- */
236
- focus = () => {
237
- this.dispatchEvent(
238
- new CustomEvent("focus", {
239
- detail: {
240
- value: this.value,
241
- },
242
- })
243
- );
244
- };
245
- /**
246
- * @description: 检查校验是否成功
247
- * @return {Boolean}
248
- */
249
- checkout = () => {};
250
- /**
251
- * @description: 监听placeholder属性函数
252
- * @param {string} name
253
- * @param {string} value
254
- */
255
- listenPlaceholder(name: string, value: string) {
256
- if (name === "placeholder" && this._input) {
257
- if (value !== null) {
258
- this._input.setAttribute("placeholder", value);
259
- } else {
260
- this._input.removeAttribute("placeholder");
261
- }
262
- }
263
- }
264
- /**
265
- * @description: 监听required属性函数
266
- * @param {string} name
267
- * @param {string} value
268
- * @return {*}
269
- */
270
- listenRequired(name: string, value: string) {
271
- if (name === "required" && this._input) {
272
- if (value && value !== "false") {
273
- this._input.setAttribute("required", "");
274
- } else {
275
- this._input.removeAttribute("required");
276
- }
277
- }
278
- }
279
- /**
280
- * @description: 监听pattern属性函数
281
- * @param {string} name
282
- * @param {string} value
283
- */
284
- listenPattern(name: string, value: string) {
285
- if (name === "pattern" && this._input) {
286
- if (value && value !== "false") {
287
- this._input.setAttribute("pattern", value);
288
- } else {
289
- this._input.removeAttribute("pattern");
290
- }
291
- }
292
- }
293
- /**
294
- * @description: 监听label属性函数
295
- * @param {string} name
296
- * @param {string} value
297
- */
298
- listenLabel(name: string, value: string) {
299
- if (name === "label" && this._input) {
300
- if (value !== null) {
301
- if (this._label) {
302
- this._label.innerHTML = value;
303
- } else {
304
- this._label = document.createElement("label");
305
- this._label.innerHTML = value;
306
- this._label.setAttribute("class", "input-label");
307
- this._container.appendChild(this._label);
308
- }
309
- } else {
310
- this._container.removeAttribute("label");
311
- if (this._label) {
312
- this._container.removeChild(this._label);
313
- this._label = undefined;
314
- }
315
- }
316
- }
317
- }
318
- /**
319
- * @description: 监听type属性
320
- * @param {string} name
321
- * @param {string} value
322
- */
323
- listenType(name: string, value: string) {
324
- if (name === "type" && this._input) {
325
- if (value) {
326
- this._input.setAttribute("type", value);
327
- } else {
328
- this._input.removeAttribute("type");
329
- }
330
- }
331
- }
332
- connectedCallback() {
333
- // 如果一开始就设置了input的值,则初始化input的值
334
- if (this.value) {
335
- this._input.value = this.value;
336
- this._container.setAttribute("value", this.value);
337
- }
338
- if (isDisabled(this)) {
339
- this._container.setAttribute("disabled", "");
340
- this._input.setAttribute("disabled", "");
341
- }
342
- if (this.type) {
343
- this._input.setAttribute("type", this.type);
344
- }
345
- this._input.addEventListener("input", this.inputValue);
346
- this._input.addEventListener("change", this.change);
347
- this._input.addEventListener("focus", this.focus);
348
- }
349
- disconnectCallback() {
350
- this._input.removeEventListener("input", this.inputValue);
351
- this._input.removeEventListener("change", this.change);
352
- }
353
- attributeChangedCallback(name: string, oldValue: string, newValue: string) {
354
- this.listenPlaceholder(name, newValue);
355
- this.listenRequired(name, newValue);
356
- this.listenPattern(name, newValue);
357
- this.listenLabel(name, newValue);
358
- }
359
- }
360
-
361
- function Custom() {
362
- if (!customElements.get("r-input")) {
363
- customElements.define("r-input", CustomElement);
364
- }
365
- }
366
-
367
- export default Custom()
File without changes
@@ -1,118 +0,0 @@
1
-
2
- function Modal() {
3
- const template = document.createElement('template')
4
- const div = document.createElement('div')
5
- div.setAttribute('class', 'modal-content')
6
- const slot = document.createElement('slot')
7
- slot.setAttribute('name', 'modal-content')
8
- div.appendChild(slot)
9
- template?.appendChild(div)
10
- class Modal extends HTMLElement {
11
- constructor() {
12
- super();
13
- // 获取模板内容
14
- const templateContent = template.content;
15
-
16
- const shadowRoot = this.attachShadow({ mode: 'open' });
17
- const wrap = document.createElement('div');
18
- const modal = document.createElement('div');
19
- const header = document.createElement('header');
20
- const btnClose = document.createElement('span');
21
- const mask = document.createElement('div');
22
- const footer = document.createElement('footer');
23
- const btnCancel = document.createElement('xu-button');
24
- const btnOk = document.createElement('xu-button');
25
-
26
- // wrap
27
- wrap.setAttribute('class', 'wrap');
28
-
29
- // modal
30
- modal.setAttribute('class', 'xu-modal');
31
-
32
- // header
33
- let title = this.getAttribute('title');
34
- header.textContent = title;
35
- btnClose.setAttribute('class', 'xu-close');
36
- btnClose.textContent = 'x';
37
- header.appendChild(btnClose);
38
- modal.appendChild(header);
39
-
40
- btnClose.addEventListener('click', () => {
41
- wrap.style.display = 'none';
42
- })
43
-
44
- // content
45
- modal.appendChild(templateContent.cloneNode(true));
46
-
47
- // footer
48
- btnOk.setAttribute('type', 'primary');
49
- const slot1 = document.createElement('span');
50
- slot1.setAttribute('slot', 'btn-content');
51
- slot1.textContent = '确认';
52
- btnOk.appendChild(slot1);
53
-
54
- const slot2 = document.createElement('span');
55
- slot2.setAttribute('slot', 'btn-content');
56
- slot2.textContent = '取消';
57
- btnCancel.appendChild(slot2);
58
-
59
- footer.appendChild(btnCancel);
60
- footer.appendChild(btnOk);
61
- modal.appendChild(footer);
62
-
63
- // mask
64
- mask.setAttribute('class', 'mask');
65
- wrap.appendChild(mask);
66
- wrap.appendChild(modal);
67
-
68
- // 创建样式
69
- const style = document.createElement('style');
70
- const width = this.getAttribute('width');
71
- const isVisible = this.getAttribute('visible');
72
- // 为shadow Dom添加样式
73
- style.textContent = `
74
- .wrap {
75
- position: fixed;
76
- left: 0;
77
- right: 0;
78
- bottom: 0;
79
- top: 0;
80
- display: ${isVisible === 'true' ? 'block' : 'none'}
81
- }
82
- // 忽略部分样式
83
- `
84
- shadowRoot.appendChild(style);
85
- shadowRoot.appendChild(wrap);
86
- }
87
- connectedCallback(el: any) {
88
- console.log('insert dom', el)
89
- }
90
- disconnectedCallback() {
91
- console.log('Custom square element removed from page.');
92
- }
93
- adoptedCallback() {
94
- console.log('Custom square element moved to new page.');
95
- }
96
- attributeChangedCallback(name: string, oldValue: string | number | undefined, newValue: string | number | undefined) {
97
- if (oldValue && this.shadowRoot) {
98
- const children = [...this.shadowRoot.children] as Array<HTMLElement>
99
- for (let i = 0; i < children.length; i++) {
100
- if (children[i].nodeName === 'DIV' && children[i]?.className === 'wrap') {
101
- if (newValue === 'true') {
102
- children[i].style.display = 'block';
103
- } else {
104
- children[i].style.display = 'none';
105
- }
106
- }
107
- }
108
- }
109
- }
110
- // 如果需要在元素属性变化后,触发 attributeChangedCallback()回调函数,
111
- // 你必须监听这个属性。这可以通过定义observedAttributes() get函数来实现
112
- static get observedAttributes() {
113
- return ['visible'];
114
- }
115
- }
116
- window.customElements.define('xu-modal', Modal);
117
- }
118
- export default Modal()
File without changes
@@ -1,71 +0,0 @@
1
- class TabPane extends HTMLElement {
2
- static get observedAttributes() {
3
- return ["label", "key", "disabled", "icon"];
4
- }
5
- _div: HTMLElement;
6
- constructor() {
7
- super();
8
- this._div = document.createElement("slot");
9
- const shadowRoot = this.attachShadow({ mode: "closed" });
10
- shadowRoot.appendChild(this._div);
11
- }
12
- get label() {
13
- return this.getAttribute("label") || "";
14
- }
15
- set label(value) {
16
- this.setAttribute("label", value);
17
- }
18
- get icon() {
19
- return this.getAttribute("icon");
20
- }
21
-
22
- get key() {
23
- return this.getAttribute("key");
24
- }
25
- set key(value) {
26
- if (value) {
27
- this.setAttribute("key", value);
28
- } else {
29
- this.removeAttribute("key");
30
- }
31
- }
32
- get disabled() {
33
- return this.getAttribute("disabled");
34
- }
35
- set disabled(value) {
36
- if (!value || value === "false") {
37
- this.removeAttribute("disabled");
38
- } else {
39
- this.setAttribute("disabled", value);
40
- }
41
- }
42
- onClick(e: Event) {
43
- console.log('e',e);
44
- }
45
- connectedCallback() {
46
- this._div.addEventListener('click', this.onClick)
47
- }
48
- disconnectCallback() { }
49
- attributeChangedCallback(name: string, oldValue: string, newValue: string) {
50
- if (oldValue !== newValue && newValue) {
51
- // const { emitLabel } = this.parentNode;
52
- // if (name === "label") {
53
- // emitLabel;
54
- // this.parentNode?.update &&
55
- // this.parentNode.updatalabel(this.key, newValue);
56
- // }
57
- // if (name === "disabled") {
58
- // this.parentNode?.updatadisabled &&
59
- // this.parentNode.updatadisabled(this.key, newValue);
60
- // }
61
- }
62
- }
63
- }
64
-
65
- function CustomElement() {
66
- if (!customElements.get("r-tab")) {
67
- customElements.define("r-tab", TabPane);
68
- }
69
- }
70
-
71
- export default CustomElement()
@@ -1,47 +0,0 @@
1
- .tab {
2
- ::slotted(r-tab) {
3
- box-sizing: border-box;
4
- width: 100%;
5
- height: 100%;
6
- padding: 10px;
7
- flex-shrink: 0;
8
- overflow: auto;
9
- }
10
- // &([type="line"]) {
11
- // .tab-header_line {
12
- // visibility: hidden;
13
- // }
14
- // }
15
- &-header {
16
- position: relative;
17
- overflow: hidden;
18
- scroll-behavior: smooth;
19
- &_nav {
20
- display: flex;
21
- flex-flow: row nowrap;
22
- justify-content: flex-start;
23
- align-items: center;
24
- &__item {
25
- }
26
- }
27
- &_line {
28
- position: absolute;
29
- width: 0;
30
- margin-top: -2px;
31
- height: 2px;
32
- border-radius: 2px;
33
- background: var(--themeColor, #1890ff);
34
- transition: 0.2s;
35
- }
36
- }
37
-
38
- &-content {
39
- overflow: hidden;
40
- &_wrap {
41
- display: flex;
42
- width: 100%;
43
- height: 100%;
44
- transition: 0.2s;
45
- }
46
- }
47
- }