funda-ui 4.6.151 → 4.6.333
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.
- package/Chatbox/index.css +88 -14
- package/Chatbox/index.d.ts +5 -0
- package/Chatbox/index.js +457 -281
- package/Utils/format-string.d.ts +64 -0
- package/Utils/format-string.js +157 -0
- package/lib/cjs/Chatbox/index.d.ts +5 -0
- package/lib/cjs/Chatbox/index.js +457 -281
- package/lib/cjs/Utils/format-string.d.ts +64 -0
- package/lib/cjs/Utils/format-string.js +157 -0
- package/lib/css/Chatbox/index.css +88 -14
- package/lib/esm/Chatbox/PureLoader.tsx +4 -2
- package/lib/esm/Chatbox/TypingEffect.tsx +12 -41
- package/lib/esm/Chatbox/index.scss +118 -28
- package/lib/esm/Chatbox/index.tsx +148 -36
- package/lib/esm/Chatbox/utils/func.ts +52 -1
- package/lib/esm/Textarea/index.tsx +0 -2
- package/lib/esm/Utils/libs/format-string.ts +106 -0
- package/package.json +1 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* String formatting utility functions
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Remove all special characters except space from a string
|
|
6
|
+
* @param {string} input - The input string to process
|
|
7
|
+
* @returns {string} The processed string
|
|
8
|
+
*/
|
|
9
|
+
declare function rmSpec(input: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Allow only numbers and letters in a string
|
|
12
|
+
* @param {string} input - The input string to process
|
|
13
|
+
* @returns {string} The processed string
|
|
14
|
+
*/
|
|
15
|
+
declare function onlyNumAndLetter(input: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Remove all spaces including those in the middle
|
|
18
|
+
* @param {string} input - The input string to process
|
|
19
|
+
* @returns {string} The processed string
|
|
20
|
+
*/
|
|
21
|
+
declare function rmAllSpace(input: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Remove whitespace from both sides of a string
|
|
24
|
+
* @param {string} input - The input string to process
|
|
25
|
+
* @returns {string} The processed string
|
|
26
|
+
*/
|
|
27
|
+
declare function trimAll(input: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Replace multiple spaces with a single space
|
|
30
|
+
* @param {string} input - The input string to process
|
|
31
|
+
* @returns {string} The processed string
|
|
32
|
+
*/
|
|
33
|
+
declare function multiSpacesToSingle(input: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Convert HTML text to plain text
|
|
36
|
+
* @param {string} input - The input string to process
|
|
37
|
+
* @returns {string} The processed string
|
|
38
|
+
*/
|
|
39
|
+
declare function htmlToPlain(input: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Strip HTML tags and their content
|
|
42
|
+
* @param {string} input - The input string to process
|
|
43
|
+
* @returns {string} The processed string
|
|
44
|
+
*/
|
|
45
|
+
declare function stripTagsAndContent(input: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Remove first and last slash from a URL
|
|
48
|
+
* @param {string} input - The input URL to process
|
|
49
|
+
* @returns {string} The processed URL
|
|
50
|
+
*/
|
|
51
|
+
declare function removeFirstLastSlash(input: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Remove trailing slash from a URL
|
|
54
|
+
* @param {string} input - The input URL to process
|
|
55
|
+
* @returns {string} The processed URL
|
|
56
|
+
*/
|
|
57
|
+
declare function removeTrailingSlash(input: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Remove first slash from a URL
|
|
60
|
+
* @param {string} input - The input URL to process
|
|
61
|
+
* @returns {string} The processed URL
|
|
62
|
+
*/
|
|
63
|
+
declare function removeFirstSlash(input: string): string;
|
|
64
|
+
export { rmSpec, onlyNumAndLetter, rmAllSpace, trimAll, multiSpacesToSingle, htmlToPlain, stripTagsAndContent, removeFirstLastSlash, removeTrailingSlash, removeFirstSlash };
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define([], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["RPB"] = factory();
|
|
8
|
+
else
|
|
9
|
+
root["RPB"] = factory();
|
|
10
|
+
})(this, () => {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
12
|
+
/******/ "use strict";
|
|
13
|
+
/******/ // The require scope
|
|
14
|
+
/******/ var __webpack_require__ = {};
|
|
15
|
+
/******/
|
|
16
|
+
/************************************************************************/
|
|
17
|
+
/******/ /* webpack/runtime/define property getters */
|
|
18
|
+
/******/ (() => {
|
|
19
|
+
/******/ // define getter functions for harmony exports
|
|
20
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
21
|
+
/******/ for(var key in definition) {
|
|
22
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
23
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
24
|
+
/******/ }
|
|
25
|
+
/******/ }
|
|
26
|
+
/******/ };
|
|
27
|
+
/******/ })();
|
|
28
|
+
/******/
|
|
29
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
30
|
+
/******/ (() => {
|
|
31
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
32
|
+
/******/ })();
|
|
33
|
+
/******/
|
|
34
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
35
|
+
/******/ (() => {
|
|
36
|
+
/******/ // define __esModule on exports
|
|
37
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
38
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
39
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
40
|
+
/******/ }
|
|
41
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
42
|
+
/******/ };
|
|
43
|
+
/******/ })();
|
|
44
|
+
/******/
|
|
45
|
+
/************************************************************************/
|
|
46
|
+
var __webpack_exports__ = {};
|
|
47
|
+
__webpack_require__.r(__webpack_exports__);
|
|
48
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
49
|
+
/* harmony export */ "htmlToPlain": () => (/* binding */ htmlToPlain),
|
|
50
|
+
/* harmony export */ "multiSpacesToSingle": () => (/* binding */ multiSpacesToSingle),
|
|
51
|
+
/* harmony export */ "onlyNumAndLetter": () => (/* binding */ onlyNumAndLetter),
|
|
52
|
+
/* harmony export */ "removeFirstLastSlash": () => (/* binding */ removeFirstLastSlash),
|
|
53
|
+
/* harmony export */ "removeFirstSlash": () => (/* binding */ removeFirstSlash),
|
|
54
|
+
/* harmony export */ "removeTrailingSlash": () => (/* binding */ removeTrailingSlash),
|
|
55
|
+
/* harmony export */ "rmAllSpace": () => (/* binding */ rmAllSpace),
|
|
56
|
+
/* harmony export */ "rmSpec": () => (/* binding */ rmSpec),
|
|
57
|
+
/* harmony export */ "stripTagsAndContent": () => (/* binding */ stripTagsAndContent),
|
|
58
|
+
/* harmony export */ "trimAll": () => (/* binding */ trimAll)
|
|
59
|
+
/* harmony export */ });
|
|
60
|
+
/**
|
|
61
|
+
* String formatting utility functions
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Remove all special characters except space from a string
|
|
66
|
+
* @param {string} input - The input string to process
|
|
67
|
+
* @returns {string} The processed string
|
|
68
|
+
*/
|
|
69
|
+
function rmSpec(input) {
|
|
70
|
+
return input.replace(/[^a-zA-Z0-9 \u4E00-\u9FFF]/g, "");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Allow only numbers and letters in a string
|
|
75
|
+
* @param {string} input - The input string to process
|
|
76
|
+
* @returns {string} The processed string
|
|
77
|
+
*/
|
|
78
|
+
function onlyNumAndLetter(input) {
|
|
79
|
+
return input.replace(/[^a-zA-Z0-9 ]/g, "");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Remove all spaces including those in the middle
|
|
84
|
+
* @param {string} input - The input string to process
|
|
85
|
+
* @returns {string} The processed string
|
|
86
|
+
*/
|
|
87
|
+
function rmAllSpace(input) {
|
|
88
|
+
return input.replace(/\s/g, "");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Remove whitespace from both sides of a string
|
|
93
|
+
* @param {string} input - The input string to process
|
|
94
|
+
* @returns {string} The processed string
|
|
95
|
+
*/
|
|
96
|
+
function trimAll(input) {
|
|
97
|
+
return input.replace(/(^\s+)|(\s+$)/g, "");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Replace multiple spaces with a single space
|
|
102
|
+
* @param {string} input - The input string to process
|
|
103
|
+
* @returns {string} The processed string
|
|
104
|
+
*/
|
|
105
|
+
function multiSpacesToSingle(input) {
|
|
106
|
+
return input.replace(/\s+(\W)/g, ' ');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Convert HTML text to plain text
|
|
111
|
+
* @param {string} input - The input string to process
|
|
112
|
+
* @returns {string} The processed string
|
|
113
|
+
*/
|
|
114
|
+
function htmlToPlain(input) {
|
|
115
|
+
return input.replace(/(<([^>]+)>)/ig, '');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Strip HTML tags and their content
|
|
120
|
+
* @param {string} input - The input string to process
|
|
121
|
+
* @returns {string} The processed string
|
|
122
|
+
*/
|
|
123
|
+
function stripTagsAndContent(input) {
|
|
124
|
+
return input.replace(/<\/?[^>]+(>|$)(.*?)<\/?[^>]+(>|$)/ig, '');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Remove first and last slash from a URL
|
|
129
|
+
* @param {string} input - The input URL to process
|
|
130
|
+
* @returns {string} The processed URL
|
|
131
|
+
*/
|
|
132
|
+
function removeFirstLastSlash(input) {
|
|
133
|
+
return input.replace(/^\/|\/$/g, '');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Remove trailing slash from a URL
|
|
138
|
+
* @param {string} input - The input URL to process
|
|
139
|
+
* @returns {string} The processed URL
|
|
140
|
+
*/
|
|
141
|
+
function removeTrailingSlash(input) {
|
|
142
|
+
return input.replace(/\/+$/, '');
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Remove first slash from a URL
|
|
147
|
+
* @param {string} input - The input URL to process
|
|
148
|
+
* @returns {string} The processed URL
|
|
149
|
+
*/
|
|
150
|
+
function removeFirstSlash(input) {
|
|
151
|
+
return input.replace(/\//, '');
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/******/ return __webpack_exports__;
|
|
155
|
+
/******/ })()
|
|
156
|
+
;
|
|
157
|
+
});
|
|
@@ -18,6 +18,7 @@ export interface FloatingButton {
|
|
|
18
18
|
value: string;
|
|
19
19
|
onClick: string;
|
|
20
20
|
isSelect?: boolean;
|
|
21
|
+
dynamicOptions?: boolean;
|
|
21
22
|
[key: string]: any;
|
|
22
23
|
}
|
|
23
24
|
export interface FloatingButtonSelectOption {
|
|
@@ -71,10 +72,14 @@ export declare type ChatboxProps = {
|
|
|
71
72
|
newChatButton?: FloatingButton;
|
|
72
73
|
customMethods?: CustomMethod[];
|
|
73
74
|
defaultQuestions?: QuestionData;
|
|
75
|
+
showCopyBtn?: boolean;
|
|
76
|
+
autoCopyReply?: boolean;
|
|
74
77
|
customRequest?: CustomRequestFunction;
|
|
75
78
|
renderParser?: (input: string) => Promise<string>;
|
|
76
79
|
requestBodyFormatter?: (body: any, contextData: Record<string, any>, conversationHistory: MessageDetail[]) => Promise<Record<string, any>>;
|
|
80
|
+
copiedContentFormatter?: (string: string) => string;
|
|
77
81
|
nameFormatter?: (input: string) => string;
|
|
82
|
+
onCopyCallback?: (res: Record<string, any>) => void;
|
|
78
83
|
onQuestionClick?: (text: string, methods: Record<string, Function>) => void;
|
|
79
84
|
onInputChange?: (controlRef: React.RefObject<any>, val: string) => any;
|
|
80
85
|
onInputCallback?: (input: string) => Promise<string>;
|