dtable-ui-component 0.1.84 → 0.1.85

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 (115) hide show
  1. package/lib/DTablePopover/index.js +115 -0
  2. package/lib/DTablePopover/utils.js +5 -0
  3. package/lib/DTableSelect/index.js +140 -0
  4. package/lib/DTableSwitch/index.js +27 -0
  5. package/lib/FormulaFormatter/index.js +7 -7
  6. package/lib/index.js +5 -1
  7. package/package.json +2 -1
  8. package/es/app.css +0 -20
  9. package/es/app.js +0 -91
  10. package/es/assets/images/avatar/default_avatar.png +0 -0
  11. package/es/assets/images/file/192/excel.png +0 -0
  12. package/es/assets/images/file/192/file.png +0 -0
  13. package/es/assets/images/file/192/music.png +0 -0
  14. package/es/assets/images/file/192/pdf.png +0 -0
  15. package/es/assets/images/file/192/pic.png +0 -0
  16. package/es/assets/images/file/192/ppt.png +0 -0
  17. package/es/assets/images/file/192/txt.png +0 -0
  18. package/es/assets/images/file/192/video.png +0 -0
  19. package/es/assets/images/file/192/word.png +0 -0
  20. package/es/assets/images/file/24/excel.png +0 -0
  21. package/es/assets/images/file/24/file.png +0 -0
  22. package/es/assets/images/file/24/music.png +0 -0
  23. package/es/assets/images/file/24/pdf.png +0 -0
  24. package/es/assets/images/file/24/pic.png +0 -0
  25. package/es/assets/images/file/24/ppt.png +0 -0
  26. package/es/assets/images/file/24/txt.png +0 -0
  27. package/es/assets/images/file/24/video.png +0 -0
  28. package/es/assets/images/file/24/word.png +0 -0
  29. package/es/assets/images/folder/folder-192.png +0 -0
  30. package/es/assets/images/folder/folder-24.png +0 -0
  31. package/es/components/cell-editor/checkbox-editor.js +0 -104
  32. package/es/components/cell-editor/collaborator-editor.js +0 -236
  33. package/es/components/cell-editor/date-editor.js +0 -151
  34. package/es/components/cell-editor/index.js +0 -9
  35. package/es/components/cell-editor/link-editor.js +0 -303
  36. package/es/components/cell-editor/multiple-select-editor.js +0 -237
  37. package/es/components/cell-editor/number-editor.js +0 -154
  38. package/es/components/cell-editor/single-select-editor.js +0 -202
  39. package/es/components/cell-editor/text-editor.js +0 -122
  40. package/es/components/cell-editor-dialog/pc-file-editor-dialog.js +0 -46
  41. package/es/components/cell-editor-dialog/pc-files-addition/index.js +0 -0
  42. package/es/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +0 -0
  43. package/es/components/cell-editor-dialog/pc-files-preview/index.js +0 -0
  44. package/es/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +0 -0
  45. package/es/components/cell-editor-popover/mb-collaborator-editor-popover.js +0 -177
  46. package/es/components/cell-editor-popover/mb-date-editor-popover.js +0 -245
  47. package/es/components/cell-editor-popover/mb-link-editor-popover.js +0 -170
  48. package/es/components/cell-editor-popover/mb-select-editor-popover.js +0 -230
  49. package/es/components/cell-editor-popover/pc-collaborator-editor-popover.js +0 -109
  50. package/es/components/cell-editor-popover/pc-date-editor-popover.js +0 -142
  51. package/es/components/cell-editor-popover/pc-link-editor-popover.js +0 -114
  52. package/es/components/cell-editor-popover/pc-select-editor-popover.js +0 -143
  53. package/es/components/cell-factory/cell-formatter-factory.js +0 -25
  54. package/es/components/cell-formatter/auto-number-formatter.js +0 -35
  55. package/es/components/cell-formatter/button-formatter.js +0 -55
  56. package/es/components/cell-formatter/checkbox-formatter.js +0 -44
  57. package/es/components/cell-formatter/collaborator-formatter.js +0 -91
  58. package/es/components/cell-formatter/creator-formatter.js +0 -87
  59. package/es/components/cell-formatter/ctime-formatter.js +0 -57
  60. package/es/components/cell-formatter/date-formatter.js +0 -59
  61. package/es/components/cell-formatter/duration-formatter.js +0 -37
  62. package/es/components/cell-formatter/email-formatter.js +0 -35
  63. package/es/components/cell-formatter/file-formatter.js +0 -63
  64. package/es/components/cell-formatter/formatter-config.js +0 -31
  65. package/es/components/cell-formatter/formula-formatter.js +0 -164
  66. package/es/components/cell-formatter/geolocation-formatter.js +0 -52
  67. package/es/components/cell-formatter/image-formatter.js +0 -153
  68. package/es/components/cell-formatter/index.js +0 -27
  69. package/es/components/cell-formatter/last-modifier-formatter.js +0 -87
  70. package/es/components/cell-formatter/link-formatter.js +0 -144
  71. package/es/components/cell-formatter/long-text-formatter.js +0 -106
  72. package/es/components/cell-formatter/mtime-formatter.js +0 -57
  73. package/es/components/cell-formatter/multiple-select-formatter.js +0 -69
  74. package/es/components/cell-formatter/number-formatter.js +0 -46
  75. package/es/components/cell-formatter/rate-formatter.js +0 -79
  76. package/es/components/cell-formatter/single-select-formatter.js +0 -69
  77. package/es/components/cell-formatter/text-formatter.js +0 -55
  78. package/es/components/cell-formatter/url-formatter.js +0 -35
  79. package/es/components/cell-formatter/widgets/file-item-formatter.js +0 -50
  80. package/es/components/cell-formatter/widgets/image-previewer-lightbox.js +0 -119
  81. package/es/components/common/collaborator-item.js +0 -63
  82. package/es/components/common/edit-editor-button.js +0 -56
  83. package/es/components/common/images-lazy-load.js +0 -150
  84. package/es/components/common/link-editor-option.js +0 -113
  85. package/es/components/common/mobile/mb-editor-header.js +0 -48
  86. package/es/components/common/modal-portal.js +0 -44
  87. package/es/components/common/select-editor-option.js +0 -106
  88. package/es/components/common/select-item.js +0 -58
  89. package/es/components/file-uploader/index.js +0 -53
  90. package/es/components/loading.js +0 -7
  91. package/es/components/toast/alert.js +0 -150
  92. package/es/components/toast/index.js +0 -3
  93. package/es/components/toast/toast.js +0 -179
  94. package/es/components/toast/toastManager.js +0 -170
  95. package/es/components/toast/toaster.js +0 -76
  96. package/es/constants/cell-types.js +0 -25
  97. package/es/constants/index.js +0 -48
  98. package/es/css/cell-editor.css +0 -614
  99. package/es/css/cell-formatter.css +0 -241
  100. package/es/css/custom-rc-calendar.css +0 -118
  101. package/es/css/image-previewer-ligntbox.css +0 -87
  102. package/es/css/loading.css +0 -54
  103. package/es/index.js +0 -6
  104. package/es/lang/index.js +0 -50
  105. package/es/locals/de.js +0 -2
  106. package/es/locals/en.js +0 -17
  107. package/es/locals/fr.js +0 -2
  108. package/es/locals/zh-CN.js +0 -17
  109. package/es/utils/cell-value-validator.js +0 -32
  110. package/es/utils/column-utils.js +0 -7
  111. package/es/utils/editor-utils.js +0 -71
  112. package/es/utils/normalize-long-text-value.js +0 -68
  113. package/es/utils/number-precision.js +0 -163
  114. package/es/utils/utils.js +0 -116
  115. package/es/utils/value-format-utils.js +0 -495
@@ -1,71 +0,0 @@
1
- var zhCN = require('@seafile/seafile-calendar/lib/locale/zh_CN');
2
-
3
- var zhTW = require('@seafile/seafile-calendar/lib/locale/zh_TW');
4
-
5
- var enUS = require('@seafile/seafile-calendar/lib/locale/en_US');
6
-
7
- var frFR = require('@seafile/seafile-calendar/lib/locale/fr_FR');
8
-
9
- var deDE = require('@seafile/seafile-calendar/lib/locale/de_DE');
10
-
11
- var esES = require('@seafile/seafile-calendar/lib/locale/es_ES');
12
-
13
- var plPL = require('@seafile/seafile-calendar/lib/locale/pl_PL');
14
-
15
- var csCZ = require('@seafile/seafile-calendar/lib/locale/cs_CZ');
16
-
17
- export var initDateEditorLanguage = function initDateEditorLanguage(lang) {
18
- var language;
19
-
20
- switch (lang) {
21
- case 'zh-cn':
22
- language = zhCN;
23
- break;
24
-
25
- case 'zh-tw':
26
- language = zhTW;
27
- break;
28
-
29
- case 'en':
30
- language = enUS;
31
- break;
32
-
33
- case 'fr':
34
- language = frFR;
35
- break;
36
-
37
- case 'de':
38
- language = deDE;
39
- break;
40
-
41
- case 'es':
42
- language = esES;
43
- break;
44
-
45
- case 'es-ar':
46
- language = esES;
47
- break;
48
-
49
- case 'es-mx':
50
- language = esES;
51
- break;
52
-
53
- case 'pl':
54
- language = plPL;
55
- break;
56
-
57
- case 'cs':
58
- language = csCZ;
59
- break;
60
-
61
- default:
62
- language = zhCN;
63
- }
64
-
65
- return language;
66
- };
67
- export var getSelectOptionItem = function getSelectOptionItem(options, optionId) {
68
- return options.find(function (option) {
69
- return option.id === optionId;
70
- });
71
- };
@@ -1,68 +0,0 @@
1
- var hrefReg = /\[.+\]\(\S+\)|<img src=(\S+).+\/>|!\[\]\(\S+\)|<\S+>/g,
2
- imageReg1 = /^<img src="(\S+)" .+\/>/,
3
- imageReg2 = /^!\[\]\((\S+)\)/,
4
- linkReg1 = /^\[.+\]\(\S+\)/,
5
- linkReg2 = /^<\S+>$/;
6
-
7
- var getLinks = function getLinks(hrefList) {
8
- var hrefObj = {
9
- links: [],
10
- images: []
11
- };
12
- hrefList.forEach(function (href) {
13
- if (href.search(linkReg1) >= 0 || href.search(linkReg2) >= 0) {
14
- hrefObj.links.push(href);
15
- } else {
16
- var imageSrcList = href.match(imageReg1);
17
- var imageSrcList1 = href.match(imageReg2);
18
-
19
- if (imageSrcList) {
20
- hrefObj.images.push(imageSrcList[1]);
21
- } else if (imageSrcList1) {
22
- hrefObj.images.push(imageSrcList1[1]);
23
- }
24
- }
25
- });
26
- return hrefObj;
27
- };
28
-
29
- var getPreviewContent = function getPreviewContent(markdownContent) {
30
- var preview = '';
31
- var newMarkdownContent = markdownContent.replace(hrefReg, '');
32
-
33
- for (var index = 0; index < newMarkdownContent.length; index++) {
34
- if (newMarkdownContent[index] === '#') {
35
- continue;
36
- } else if (newMarkdownContent[index] === '\n') {
37
- preview += ' ';
38
- } else {
39
- preview += newMarkdownContent[index];
40
- }
41
-
42
- if (preview.length === 30) {
43
- break;
44
- }
45
- }
46
-
47
- var hrefList = markdownContent.match(hrefReg);
48
-
49
- if (hrefList) {
50
- var _getLinks = getLinks(hrefList),
51
- images = _getLinks.images,
52
- links = _getLinks.links;
53
-
54
- return {
55
- preview: preview,
56
- images: images,
57
- links: links
58
- };
59
- }
60
-
61
- return {
62
- preview: preview,
63
- images: [],
64
- links: []
65
- };
66
- };
67
-
68
- export default getPreviewContent;
@@ -1,163 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
-
3
- /**
4
- * @desc Solve the problem of floating calculation, avoid multiple digits after the decimal point and loss of calculation accuracy.
5
- * example: 3 + 2.4 = 4.699999999999999,1.0 - 0.9 = 0.09999999999999998
6
- */
7
-
8
- /**
9
- * Correct wrong data
10
- * strip(0.09999999999999998)=0.1
11
- */
12
- function strip(num) {
13
- var precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 12;
14
- return +parseFloat(num.toPrecision(precision));
15
- }
16
- /**
17
- * Return digits length of a number
18
- * @param {*number} num Input number
19
- */
20
-
21
-
22
- function digitLength(num) {
23
- // Get digit length of e
24
- var eSplit = num.toString().split(/[eE]/);
25
- var len = (eSplit[0].split('.')[1] || '').length - +(eSplit[1] || 0);
26
- return len > 0 ? len : 0;
27
- }
28
- /**
29
- * Convert decimals to integers and support scientific notation. If it is a decimal, it is enlarged to an integer
30
- * @param {*number} num Number of inputs
31
- */
32
-
33
-
34
- function float2Fixed(num) {
35
- if (num.toString().indexOf('e') === -1) {
36
- return Number(num.toString().replace('.', ''));
37
- }
38
-
39
- var dLen = digitLength(num);
40
- return dLen > 0 ? strip(num * Math.pow(10, dLen)) : num;
41
- }
42
- /**
43
- * Check whether the number is out of range, and give a prompt if it is out of range
44
- * @param {*number} num Number of inputs
45
- */
46
-
47
-
48
- function checkBoundary(num) {
49
- if (_boundaryCheckingState) {
50
- if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) {
51
- console.warn("".concat(num, " is beyond boundary when transfer to integer, the results may not be accurate"));
52
- }
53
- }
54
- }
55
- /**
56
- * Exact multiplication
57
- */
58
-
59
-
60
- function times(num1, num2) {
61
- for (var _len = arguments.length, others = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
62
- others[_key - 2] = arguments[_key];
63
- }
64
-
65
- if (others.length > 0) {
66
- return times.apply(void 0, [times(num1, num2), others[0]].concat(_toConsumableArray(others.slice(1))));
67
- }
68
-
69
- var num1Changed = float2Fixed(num1);
70
- var num2Changed = float2Fixed(num2);
71
- var baseNum = digitLength(num1) + digitLength(num2);
72
- var leftValue = num1Changed * num2Changed;
73
- checkBoundary(leftValue);
74
- return leftValue / Math.pow(10, baseNum);
75
- }
76
- /**
77
- * Exact addition
78
- */
79
-
80
-
81
- function plus(num1, num2) {
82
- for (var _len2 = arguments.length, others = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
83
- others[_key2 - 2] = arguments[_key2];
84
- }
85
-
86
- if (others.length > 0) {
87
- return plus.apply(void 0, [plus(num1, num2), others[0]].concat(_toConsumableArray(others.slice(1))));
88
- }
89
-
90
- var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
91
- return (times(num1, baseNum) + times(num2, baseNum)) / baseNum;
92
- }
93
- /**
94
- * Exact subtraction
95
- */
96
-
97
-
98
- function minus(num1, num2) {
99
- for (var _len3 = arguments.length, others = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
100
- others[_key3 - 2] = arguments[_key3];
101
- }
102
-
103
- if (others.length > 0) {
104
- return minus.apply(void 0, [minus(num1, num2), others[0]].concat(_toConsumableArray(others.slice(1))));
105
- }
106
-
107
- var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
108
- return (times(num1, baseNum) - times(num2, baseNum)) / baseNum;
109
- }
110
- /**
111
- * Exact division
112
- */
113
-
114
-
115
- function divide(num1, num2) {
116
- for (var _len4 = arguments.length, others = new Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
117
- others[_key4 - 2] = arguments[_key4];
118
- }
119
-
120
- if (others.length > 0) {
121
- return divide.apply(void 0, [divide(num1, num2), others[0]].concat(_toConsumableArray(others.slice(1))));
122
- }
123
-
124
- var num1Changed = float2Fixed(num1);
125
- var num2Changed = float2Fixed(num2);
126
- checkBoundary(num1Changed);
127
- checkBoundary(num2Changed); // fix: Similar to 10 ** -4 is 0.00009999999999999999, strip correction
128
-
129
- return times(num1Changed / num2Changed, strip(Math.pow(10, digitLength(num2) - digitLength(num1))));
130
- }
131
- /**
132
- * rounding
133
- */
134
-
135
-
136
- function round(num, ratio) {
137
- var base = Math.pow(10, ratio);
138
- return divide(Math.round(times(num, base)), base);
139
- }
140
-
141
- var _boundaryCheckingState = true;
142
- /**
143
- * Whether to perform boundary check, default true
144
- * @param flag Mark switch, true is on, false is off, default is true
145
- */
146
-
147
- function enableBoundaryChecking() {
148
- var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
149
- _boundaryCheckingState = flag;
150
- }
151
-
152
- export { strip, plus, minus, times, divide, round, digitLength, float2Fixed, enableBoundaryChecking };
153
- export default {
154
- strip: strip,
155
- plus: plus,
156
- minus: minus,
157
- times: times,
158
- divide: divide,
159
- round: round,
160
- digitLength: digitLength,
161
- float2Fixed: float2Fixed,
162
- enableBoundaryChecking: enableBoundaryChecking
163
- };
package/es/utils/utils.js DELETED
@@ -1,116 +0,0 @@
1
- var FILEEXT_ICON_MAP = {
2
- // text file
3
- md: "txt.png",
4
- txt: "txt.png",
5
- // pdf file
6
- pdf: "pdf.png",
7
- // document file
8
- doc: "word.png",
9
- docx: "word.png",
10
- odt: "word.png",
11
- fodt: "word.png",
12
- ppt: "ppt.png",
13
- pptx: "ppt.png",
14
- odp: "ppt.png",
15
- fodp: "ppt.png",
16
- xls: "excel.png",
17
- xlsx: "excel.png",
18
- ods: "excel.png",
19
- fods: "excel.png",
20
- // video
21
- mp4: "video.png",
22
- ogv: "video.png",
23
- webm: "video.png",
24
- mov: "video.png",
25
- flv: "video.png",
26
- wmv: "video.png",
27
- rmvb: "video.png",
28
- // music file
29
- mp3: "music.png",
30
- oga: "music.png",
31
- ogg: "music.png",
32
- flac: "music.png",
33
- aac: "music.png",
34
- ac3: "music.png",
35
- wma: "music.png",
36
- // image file
37
- jpg: "pic.png",
38
- jpeg: "pic.png",
39
- png: "pic.png",
40
- svg: "pic.png",
41
- gif: "pic.png",
42
- bmp: "pic.png",
43
- ico: "pic.png",
44
- // folder dir
45
- folder: "folder-192.png",
46
- // default
47
- default: "file.png"
48
- };
49
- export var getFileIconUrl = function getFileIconUrl(filename, direntType) {
50
- if (direntType === "dir") {
51
- var _iconUrl = "assets/images/folder/" + FILEEXT_ICON_MAP["folder"];
52
-
53
- return _iconUrl;
54
- }
55
-
56
- var iconUrl = "";
57
-
58
- if (filename.lastIndexOf(".") === -1) {
59
- iconUrl = "assets/images/file/192/" + FILEEXT_ICON_MAP["default"];
60
- return iconUrl;
61
- }
62
-
63
- var file_ext = filename.substr(filename.lastIndexOf(".") + 1).toLowerCase();
64
-
65
- if (FILEEXT_ICON_MAP[file_ext]) {
66
- iconUrl = "assets/images/file/192/" + FILEEXT_ICON_MAP[file_ext];
67
- } else {
68
- iconUrl = "assets/images/file/192/" + FILEEXT_ICON_MAP["default"];
69
- }
70
-
71
- return iconUrl;
72
- };
73
- export var getImageThumbnailUrl = function getImageThumbnailUrl(url, server) {
74
- if (server && url.indexOf(server) > -1) {
75
- return url.replace("/workspace", "/thumbnail/workspace") + "?size=256";
76
- }
77
-
78
- return url;
79
- };
80
- export var debounce = function debounce(fn, wait) {
81
- var timeout = null;
82
- return function () {
83
- if (timeout !== null) clearTimeout(timeout);
84
- timeout = setTimeout(fn, wait);
85
- };
86
- };
87
- export var throttle = function throttle(func, delay) {
88
- var timer = null;
89
- var startTime = Date.now();
90
- return function () {
91
- var curTime = Date.now();
92
- var remaining = delay - (curTime - startTime);
93
- var context = this;
94
- var args = arguments;
95
- clearTimeout(timer);
96
-
97
- if (remaining <= 0) {
98
- func.apply(context, args);
99
- startTime = Date.now();
100
- } else {
101
- timer = setTimeout(func, remaining);
102
- }
103
- };
104
- };
105
- export var isFunction = function isFunction(functionToCheck) {
106
- var getType = {};
107
- return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
108
- };
109
- export var isInternalImg = function isInternalImg(url) {
110
- if (!url) return;
111
- return url.indexOf(window.dtable.server) > -1;
112
- };
113
- export var checkSVGImage = function checkSVGImage(url) {
114
- if (!url) return false;
115
- return url.substr(-4).toLowerCase() === '.svg';
116
- };