@tiny-codes/react-easy 1.6.4 → 1.7.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.
- package/CHANGELOG.md +33 -2
- package/es/components/ConfigProvider/context.d.ts +27 -27
- package/es/components/ConfigProvider/context.js.map +1 -1
- package/es/components/ConfirmAction/index.js +20 -19
- package/es/components/ConfirmAction/index.js.map +1 -1
- package/es/components/DeleteConfirmAction/withDeleteConfirmAction.d.ts +3 -3
- package/es/components/ModalAction/index.js +15 -12
- package/es/components/ModalAction/index.js.map +1 -1
- package/es/components/OverflowTags/index.d.ts +11 -13
- package/es/components/OverflowTags/index.js +25 -15
- package/es/components/OverflowTags/index.js.map +1 -1
- package/es/hooks/useValidatorBuilder.js +3 -1
- package/es/hooks/useValidatorBuilder.js.map +1 -1
- package/es/locales/index.d.ts +6 -0
- package/es/locales/langs/en-US.d.ts +2 -0
- package/es/locales/langs/en-US.js +2 -0
- package/es/locales/langs/en-US.js.map +1 -1
- package/es/locales/langs/zh-CN.d.ts +2 -0
- package/es/locales/langs/zh-CN.js +2 -0
- package/es/locales/langs/zh-CN.js.map +1 -1
- package/lib/components/ConfigProvider/context.d.ts +27 -27
- package/lib/components/ConfigProvider/context.js.map +2 -2
- package/lib/components/ConfirmAction/index.js +23 -12
- package/lib/components/ConfirmAction/index.js.map +2 -2
- package/lib/components/DeleteConfirmAction/withDeleteConfirmAction.d.ts +3 -3
- package/lib/components/ModalAction/index.js +21 -9
- package/lib/components/ModalAction/index.js.map +3 -3
- package/lib/components/OverflowTags/index.d.ts +11 -13
- package/lib/components/OverflowTags/index.js +22 -10
- package/lib/components/OverflowTags/index.js.map +2 -2
- package/lib/hooks/useValidatorBuilder.js +5 -1
- package/lib/hooks/useValidatorBuilder.js.map +2 -2
- package/lib/locales/index.d.ts +6 -0
- package/lib/locales/langs/en-US.d.ts +2 -0
- package/lib/locales/langs/en-US.js +2 -0
- package/lib/locales/langs/en-US.js.map +2 -2
- package/lib/locales/langs/zh-CN.d.ts +2 -0
- package/lib/locales/langs/zh-CN.js +2 -0
- package/lib/locales/langs/zh-CN.js.map +2 -2
- package/package.json +1 -1
package/es/locales/index.d.ts
CHANGED
|
@@ -25,12 +25,14 @@ export declare const resources: {
|
|
|
25
25
|
readonly 'validation.rule.buildRule.maxLength': ", up to {{max}} characters";
|
|
26
26
|
readonly 'validation.rule.buildRule.rangeLength': ", {{min}}~{{max}} characters";
|
|
27
27
|
readonly 'validation.rule.buildRule.token.separator': ", ";
|
|
28
|
+
readonly 'validation.rule.buildRule.token.delimiter': "";
|
|
28
29
|
readonly 'validation.rule.buildRule.token.chinese': "Chinese characters";
|
|
29
30
|
readonly 'validation.rule.buildRule.token.chinesePunctuation': "Chinese punctuation";
|
|
30
31
|
readonly 'validation.rule.buildRule.token.letter': "letter";
|
|
31
32
|
readonly 'validation.rule.buildRule.token.lowerLetter': "lowercase letter";
|
|
32
33
|
readonly 'validation.rule.buildRule.token.upperLetter': "uppercase letter";
|
|
33
34
|
readonly 'validation.rule.buildRule.token.number': "number";
|
|
35
|
+
readonly 'validation.rule.buildRule.token.specialChars': "special characters ({{-value}})";
|
|
34
36
|
readonly 'hooks.useUserMedia.microphone': "Microphone";
|
|
35
37
|
readonly 'hooks.useUserMedia.camera': "Camera";
|
|
36
38
|
readonly 'hooks.featureName.microphone': "Speech";
|
|
@@ -75,12 +77,14 @@ export declare const resources: {
|
|
|
75
77
|
readonly 'validation.rule.buildRule.maxLength': ", up to {{max}} characters";
|
|
76
78
|
readonly 'validation.rule.buildRule.rangeLength': ", {{min}}~{{max}} characters";
|
|
77
79
|
readonly 'validation.rule.buildRule.token.separator': ", ";
|
|
80
|
+
readonly 'validation.rule.buildRule.token.delimiter': "";
|
|
78
81
|
readonly 'validation.rule.buildRule.token.chinese': "Chinese characters";
|
|
79
82
|
readonly 'validation.rule.buildRule.token.chinesePunctuation': "Chinese punctuation";
|
|
80
83
|
readonly 'validation.rule.buildRule.token.letter': "letter";
|
|
81
84
|
readonly 'validation.rule.buildRule.token.lowerLetter': "lowercase letter";
|
|
82
85
|
readonly 'validation.rule.buildRule.token.upperLetter': "uppercase letter";
|
|
83
86
|
readonly 'validation.rule.buildRule.token.number': "number";
|
|
87
|
+
readonly 'validation.rule.buildRule.token.specialChars': "special characters ({{-value}})";
|
|
84
88
|
readonly 'hooks.useUserMedia.microphone': "Microphone";
|
|
85
89
|
readonly 'hooks.useUserMedia.camera': "Camera";
|
|
86
90
|
readonly 'hooks.featureName.microphone': "Speech";
|
|
@@ -125,12 +129,14 @@ export declare const resources: {
|
|
|
125
129
|
readonly 'validation.rule.buildRule.maxLength': ",{{max}}字符以内";
|
|
126
130
|
readonly 'validation.rule.buildRule.rangeLength': ",{{min}}~{{max}}个字符";
|
|
127
131
|
readonly 'validation.rule.buildRule.token.separator': "、";
|
|
132
|
+
readonly 'validation.rule.buildRule.token.delimiter': "";
|
|
128
133
|
readonly 'validation.rule.buildRule.token.chinese': "汉字";
|
|
129
134
|
readonly 'validation.rule.buildRule.token.chinesePunctuation': "中文标点";
|
|
130
135
|
readonly 'validation.rule.buildRule.token.letter': "字母";
|
|
131
136
|
readonly 'validation.rule.buildRule.token.lowerLetter': "小写字母";
|
|
132
137
|
readonly 'validation.rule.buildRule.token.upperLetter': "大写字母";
|
|
133
138
|
readonly 'validation.rule.buildRule.token.number': "数字";
|
|
139
|
+
readonly 'validation.rule.buildRule.token.specialChars': "特殊字符{{-value}}";
|
|
134
140
|
readonly 'hooks.useUserMedia.microphone': "麦克风";
|
|
135
141
|
readonly 'hooks.useUserMedia.camera': "摄像头";
|
|
136
142
|
readonly 'hooks.featureName.microphone': "语音";
|
|
@@ -20,12 +20,14 @@ declare const enUS: {
|
|
|
20
20
|
readonly 'validation.rule.buildRule.maxLength': ", up to {{max}} characters";
|
|
21
21
|
readonly 'validation.rule.buildRule.rangeLength': ", {{min}}~{{max}} characters";
|
|
22
22
|
readonly 'validation.rule.buildRule.token.separator': ", ";
|
|
23
|
+
readonly 'validation.rule.buildRule.token.delimiter': "";
|
|
23
24
|
readonly 'validation.rule.buildRule.token.chinese': "Chinese characters";
|
|
24
25
|
readonly 'validation.rule.buildRule.token.chinesePunctuation': "Chinese punctuation";
|
|
25
26
|
readonly 'validation.rule.buildRule.token.letter': "letter";
|
|
26
27
|
readonly 'validation.rule.buildRule.token.lowerLetter': "lowercase letter";
|
|
27
28
|
readonly 'validation.rule.buildRule.token.upperLetter': "uppercase letter";
|
|
28
29
|
readonly 'validation.rule.buildRule.token.number': "number";
|
|
30
|
+
readonly 'validation.rule.buildRule.token.specialChars': "special characters ({{-value}})";
|
|
29
31
|
readonly 'hooks.useUserMedia.microphone': "Microphone";
|
|
30
32
|
readonly 'hooks.useUserMedia.camera': "Camera";
|
|
31
33
|
readonly 'hooks.featureName.microphone': "Speech";
|
|
@@ -20,12 +20,14 @@ var enUS = {
|
|
|
20
20
|
'validation.rule.buildRule.maxLength': ", up to {{max}} characters",
|
|
21
21
|
'validation.rule.buildRule.rangeLength': ", {{min}}~{{max}} characters",
|
|
22
22
|
'validation.rule.buildRule.token.separator': ', ',
|
|
23
|
+
'validation.rule.buildRule.token.delimiter': '',
|
|
23
24
|
'validation.rule.buildRule.token.chinese': 'Chinese characters',
|
|
24
25
|
'validation.rule.buildRule.token.chinesePunctuation': 'Chinese punctuation',
|
|
25
26
|
'validation.rule.buildRule.token.letter': 'letter',
|
|
26
27
|
'validation.rule.buildRule.token.lowerLetter': 'lowercase letter',
|
|
27
28
|
'validation.rule.buildRule.token.upperLetter': 'uppercase letter',
|
|
28
29
|
'validation.rule.buildRule.token.number': 'number',
|
|
30
|
+
'validation.rule.buildRule.token.specialChars': 'special characters ({{-value}})',
|
|
29
31
|
'hooks.useUserMedia.microphone': 'Microphone',
|
|
30
32
|
'hooks.useUserMedia.camera': 'Camera',
|
|
31
33
|
'hooks.featureName.microphone': 'Speech',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["enUS"],"sources":["../../../src/locales/langs/en-US.ts"],"sourcesContent":["const enUS = {\n 'components.EditableText.requiredMsg': 'Please enter text content',\n 'components.EditableText.placeholder': 'Please input text content, press Enter or click the OK button',\n 'components.EditableText.edit': 'Edit',\n 'components.EditableText.save': 'Save',\n 'components.EditableText.cancel': 'Cancel',\n 'components.ColumnSetting.title': 'Column Setting',\n 'components.ColumnSetting.selectAll': 'Select All',\n 'components.ColumnSetting.reset': 'Reset',\n\n 'validation.rule.number.message': 'Please enter a number',\n 'validation.rule.floatNumber.message': 'Please enter a number',\n 'validation.rule.email.message': 'Please enter the correct email address',\n 'validation.rule.ip.message': 'Please enter the correct ip address',\n 'validation.rule.chineseMobile.message': 'Please enter the correct mobile number',\n 'validation.rule.password.message': '8-16 digit password, at least two of numbers, letters, and symbols',\n 'validation.rule.buildRule.includeMandatory': 'At least one field in the include option is true',\n 'validation.rule.buildRule.messageFormat': 'Allow {{content}}',\n 'validation.rule.buildRule.startsWithFormat': `, start with {{prefix}}`,\n 'validation.rule.buildRule.minLength': `, at least {{min}} characters`,\n 'validation.rule.buildRule.maxLength': `, up to {{max}} characters`,\n 'validation.rule.buildRule.rangeLength': `, {{min}}~{{max}} characters`,\n 'validation.rule.buildRule.token.separator': ', ',\n 'validation.rule.buildRule.token.chinese': 'Chinese characters',\n 'validation.rule.buildRule.token.chinesePunctuation': 'Chinese punctuation',\n 'validation.rule.buildRule.token.letter': 'letter',\n 'validation.rule.buildRule.token.lowerLetter': 'lowercase letter',\n 'validation.rule.buildRule.token.upperLetter': 'uppercase letter',\n 'validation.rule.buildRule.token.number': 'number',\n 'hooks.useUserMedia.microphone': 'Microphone',\n 'hooks.useUserMedia.camera': 'Camera',\n 'hooks.featureName.microphone': 'Speech',\n 'hooks.featureName.camera': 'Video',\n 'hooks.useUserMedia.disabledWarning': 'User media is disabled',\n 'hooks.useUserMedia.isRecordingNow': 'User media is currently recording and cannot be operated on',\n 'hooks.useUserMedia.devicePermission': '{{deviceType}} Permission',\n 'hooks.useUserMedia.requestTip1':\n 'The browser is requesting {{deviceType}} permission. Please click the \"Allow when visiting this site\" button in the popup on the left.',\n 'hooks.useUserMedia.requestTip2':\n 'Please DO NOT click the \"Deny\" button, otherwise you will not be able to use the {{featureName}} related feature.',\n 'hooks.useUserMedia.deniedPermission':\n 'You have denied the {{deviceType}} permission, which will prevent you from using the {{featureName}} related feature!',\n 'hooks.useUserMedia.reopenPermissionGuide':\n 'Please click the site settings icon in the address bar, and then follow these steps to reopen {{deviceType}} permission.',\n 'hooks.useUserMedia.notSupport': 'Current browser does not support audio recording',\n 'hooks.useUserMedia.soundDetectTitle': 'Sound Issue Detected',\n 'hooks.useUserMedia.soundDetectDescription':\n 'No sound seems to be detected. Please check if the microphone is working properly or if the correct audio input device is selected.',\n 'hooks.useUserMedia.chooseMicrophoneDevice': 'Please reselect the audio device',\n 'hooks.useUserMedia.rememberDefaultAudioDevice': 'Remember default device?',\n 'hooks.useUserMedia.rememberDefaultAudioDeviceTip':\n 'Please follow these steps to save the default audio device for automatic selection next time.',\n 'hooks.useStompSocket.connectError': 'Connection failed, please try again later',\n 'hooks.useStompSocket.serverDisconnected': 'Server disconnected',\n} as const;\nexport default enUS;\n"],"mappings":"AAAA,IAAMA,IAAI,GAAG;EACX,qCAAqC,EAAE,2BAA2B;EAClE,qCAAqC,EAAE,+DAA+D;EACtG,8BAA8B,EAAE,MAAM;EACtC,8BAA8B,EAAE,MAAM;EACtC,gCAAgC,EAAE,QAAQ;EAC1C,gCAAgC,EAAE,gBAAgB;EAClD,oCAAoC,EAAE,YAAY;EAClD,gCAAgC,EAAE,OAAO;EAEzC,gCAAgC,EAAE,uBAAuB;EACzD,qCAAqC,EAAE,uBAAuB;EAC9D,+BAA+B,EAAE,wCAAwC;EACzE,4BAA4B,EAAE,qCAAqC;EACnE,uCAAuC,EAAE,wCAAwC;EACjF,kCAAkC,EAAE,oEAAoE;EACxG,4CAA4C,EAAE,kDAAkD;EAChG,yCAAyC,EAAE,mBAAmB;EAC9D,4CAA4C,2BAA2B;EACvE,qCAAqC,iCAAiC;EACtE,qCAAqC,8BAA8B;EACnE,uCAAuC,gCAAgC;EACvE,2CAA2C,EAAE,IAAI;EACjD,yCAAyC,EAAE,oBAAoB;EAC/D,oDAAoD,EAAE,qBAAqB;EAC3E,wCAAwC,EAAE,QAAQ;EAClD,6CAA6C,EAAE,kBAAkB;EACjE,6CAA6C,EAAE,kBAAkB;EACjE,wCAAwC,EAAE,QAAQ;EAClD,+BAA+B,EAAE,YAAY;EAC7C,2BAA2B,EAAE,QAAQ;EACrC,8BAA8B,EAAE,QAAQ;EACxC,0BAA0B,EAAE,OAAO;EACnC,oCAAoC,EAAE,wBAAwB;EAC9D,mCAAmC,EAAE,6DAA6D;EAClG,qCAAqC,EAAE,2BAA2B;EAClE,gCAAgC,EAC9B,wIAAwI;EAC1I,gCAAgC,EAC9B,mHAAmH;EACrH,qCAAqC,EACnC,uHAAuH;EACzH,0CAA0C,EACxC,0HAA0H;EAC5H,+BAA+B,EAAE,kDAAkD;EACnF,qCAAqC,EAAE,sBAAsB;EAC7D,2CAA2C,EACzC,qIAAqI;EACvI,2CAA2C,EAAE,kCAAkC;EAC/E,+CAA+C,EAAE,0BAA0B;EAC3E,kDAAkD,EAChD,+FAA+F;EACjG,mCAAmC,EAAE,2CAA2C;EAChF,yCAAyC,EAAE;AAC7C,CAAU;AACV,eAAeA,IAAI"}
|
|
1
|
+
{"version":3,"names":["enUS"],"sources":["../../../src/locales/langs/en-US.ts"],"sourcesContent":["const enUS = {\n 'components.EditableText.requiredMsg': 'Please enter text content',\n 'components.EditableText.placeholder': 'Please input text content, press Enter or click the OK button',\n 'components.EditableText.edit': 'Edit',\n 'components.EditableText.save': 'Save',\n 'components.EditableText.cancel': 'Cancel',\n 'components.ColumnSetting.title': 'Column Setting',\n 'components.ColumnSetting.selectAll': 'Select All',\n 'components.ColumnSetting.reset': 'Reset',\n\n 'validation.rule.number.message': 'Please enter a number',\n 'validation.rule.floatNumber.message': 'Please enter a number',\n 'validation.rule.email.message': 'Please enter the correct email address',\n 'validation.rule.ip.message': 'Please enter the correct ip address',\n 'validation.rule.chineseMobile.message': 'Please enter the correct mobile number',\n 'validation.rule.password.message': '8-16 digit password, at least two of numbers, letters, and symbols',\n 'validation.rule.buildRule.includeMandatory': 'At least one field in the include option is true',\n 'validation.rule.buildRule.messageFormat': 'Allow {{content}}',\n 'validation.rule.buildRule.startsWithFormat': `, start with {{prefix}}`,\n 'validation.rule.buildRule.minLength': `, at least {{min}} characters`,\n 'validation.rule.buildRule.maxLength': `, up to {{max}} characters`,\n 'validation.rule.buildRule.rangeLength': `, {{min}}~{{max}} characters`,\n 'validation.rule.buildRule.token.separator': ', ',\n 'validation.rule.buildRule.token.delimiter': '',\n 'validation.rule.buildRule.token.chinese': 'Chinese characters',\n 'validation.rule.buildRule.token.chinesePunctuation': 'Chinese punctuation',\n 'validation.rule.buildRule.token.letter': 'letter',\n 'validation.rule.buildRule.token.lowerLetter': 'lowercase letter',\n 'validation.rule.buildRule.token.upperLetter': 'uppercase letter',\n 'validation.rule.buildRule.token.number': 'number',\n 'validation.rule.buildRule.token.specialChars': 'special characters ({{-value}})',\n 'hooks.useUserMedia.microphone': 'Microphone',\n 'hooks.useUserMedia.camera': 'Camera',\n 'hooks.featureName.microphone': 'Speech',\n 'hooks.featureName.camera': 'Video',\n 'hooks.useUserMedia.disabledWarning': 'User media is disabled',\n 'hooks.useUserMedia.isRecordingNow': 'User media is currently recording and cannot be operated on',\n 'hooks.useUserMedia.devicePermission': '{{deviceType}} Permission',\n 'hooks.useUserMedia.requestTip1':\n 'The browser is requesting {{deviceType}} permission. Please click the \"Allow when visiting this site\" button in the popup on the left.',\n 'hooks.useUserMedia.requestTip2':\n 'Please DO NOT click the \"Deny\" button, otherwise you will not be able to use the {{featureName}} related feature.',\n 'hooks.useUserMedia.deniedPermission':\n 'You have denied the {{deviceType}} permission, which will prevent you from using the {{featureName}} related feature!',\n 'hooks.useUserMedia.reopenPermissionGuide':\n 'Please click the site settings icon in the address bar, and then follow these steps to reopen {{deviceType}} permission.',\n 'hooks.useUserMedia.notSupport': 'Current browser does not support audio recording',\n 'hooks.useUserMedia.soundDetectTitle': 'Sound Issue Detected',\n 'hooks.useUserMedia.soundDetectDescription':\n 'No sound seems to be detected. Please check if the microphone is working properly or if the correct audio input device is selected.',\n 'hooks.useUserMedia.chooseMicrophoneDevice': 'Please reselect the audio device',\n 'hooks.useUserMedia.rememberDefaultAudioDevice': 'Remember default device?',\n 'hooks.useUserMedia.rememberDefaultAudioDeviceTip':\n 'Please follow these steps to save the default audio device for automatic selection next time.',\n 'hooks.useStompSocket.connectError': 'Connection failed, please try again later',\n 'hooks.useStompSocket.serverDisconnected': 'Server disconnected',\n} as const;\nexport default enUS;\n"],"mappings":"AAAA,IAAMA,IAAI,GAAG;EACX,qCAAqC,EAAE,2BAA2B;EAClE,qCAAqC,EAAE,+DAA+D;EACtG,8BAA8B,EAAE,MAAM;EACtC,8BAA8B,EAAE,MAAM;EACtC,gCAAgC,EAAE,QAAQ;EAC1C,gCAAgC,EAAE,gBAAgB;EAClD,oCAAoC,EAAE,YAAY;EAClD,gCAAgC,EAAE,OAAO;EAEzC,gCAAgC,EAAE,uBAAuB;EACzD,qCAAqC,EAAE,uBAAuB;EAC9D,+BAA+B,EAAE,wCAAwC;EACzE,4BAA4B,EAAE,qCAAqC;EACnE,uCAAuC,EAAE,wCAAwC;EACjF,kCAAkC,EAAE,oEAAoE;EACxG,4CAA4C,EAAE,kDAAkD;EAChG,yCAAyC,EAAE,mBAAmB;EAC9D,4CAA4C,2BAA2B;EACvE,qCAAqC,iCAAiC;EACtE,qCAAqC,8BAA8B;EACnE,uCAAuC,gCAAgC;EACvE,2CAA2C,EAAE,IAAI;EACjD,2CAA2C,EAAE,EAAE;EAC/C,yCAAyC,EAAE,oBAAoB;EAC/D,oDAAoD,EAAE,qBAAqB;EAC3E,wCAAwC,EAAE,QAAQ;EAClD,6CAA6C,EAAE,kBAAkB;EACjE,6CAA6C,EAAE,kBAAkB;EACjE,wCAAwC,EAAE,QAAQ;EAClD,8CAA8C,EAAE,iCAAiC;EACjF,+BAA+B,EAAE,YAAY;EAC7C,2BAA2B,EAAE,QAAQ;EACrC,8BAA8B,EAAE,QAAQ;EACxC,0BAA0B,EAAE,OAAO;EACnC,oCAAoC,EAAE,wBAAwB;EAC9D,mCAAmC,EAAE,6DAA6D;EAClG,qCAAqC,EAAE,2BAA2B;EAClE,gCAAgC,EAC9B,wIAAwI;EAC1I,gCAAgC,EAC9B,mHAAmH;EACrH,qCAAqC,EACnC,uHAAuH;EACzH,0CAA0C,EACxC,0HAA0H;EAC5H,+BAA+B,EAAE,kDAAkD;EACnF,qCAAqC,EAAE,sBAAsB;EAC7D,2CAA2C,EACzC,qIAAqI;EACvI,2CAA2C,EAAE,kCAAkC;EAC/E,+CAA+C,EAAE,0BAA0B;EAC3E,kDAAkD,EAChD,+FAA+F;EACjG,mCAAmC,EAAE,2CAA2C;EAChF,yCAAyC,EAAE;AAC7C,CAAU;AACV,eAAeA,IAAI"}
|
|
@@ -20,12 +20,14 @@ declare const zhCN: {
|
|
|
20
20
|
readonly 'validation.rule.buildRule.maxLength': ",{{max}}字符以内";
|
|
21
21
|
readonly 'validation.rule.buildRule.rangeLength': ",{{min}}~{{max}}个字符";
|
|
22
22
|
readonly 'validation.rule.buildRule.token.separator': "、";
|
|
23
|
+
readonly 'validation.rule.buildRule.token.delimiter': "";
|
|
23
24
|
readonly 'validation.rule.buildRule.token.chinese': "汉字";
|
|
24
25
|
readonly 'validation.rule.buildRule.token.chinesePunctuation': "中文标点";
|
|
25
26
|
readonly 'validation.rule.buildRule.token.letter': "字母";
|
|
26
27
|
readonly 'validation.rule.buildRule.token.lowerLetter': "小写字母";
|
|
27
28
|
readonly 'validation.rule.buildRule.token.upperLetter': "大写字母";
|
|
28
29
|
readonly 'validation.rule.buildRule.token.number': "数字";
|
|
30
|
+
readonly 'validation.rule.buildRule.token.specialChars': "特殊字符{{-value}}";
|
|
29
31
|
readonly 'hooks.useUserMedia.microphone': "麦克风";
|
|
30
32
|
readonly 'hooks.useUserMedia.camera': "摄像头";
|
|
31
33
|
readonly 'hooks.featureName.microphone': "语音";
|
|
@@ -20,12 +20,14 @@ var zhCN = {
|
|
|
20
20
|
'validation.rule.buildRule.maxLength': "\uFF0C{{max}}\u5B57\u7B26\u4EE5\u5185",
|
|
21
21
|
'validation.rule.buildRule.rangeLength': "\uFF0C{{min}}~{{max}}\u4E2A\u5B57\u7B26",
|
|
22
22
|
'validation.rule.buildRule.token.separator': '、',
|
|
23
|
+
'validation.rule.buildRule.token.delimiter': '',
|
|
23
24
|
'validation.rule.buildRule.token.chinese': '汉字',
|
|
24
25
|
'validation.rule.buildRule.token.chinesePunctuation': '中文标点',
|
|
25
26
|
'validation.rule.buildRule.token.letter': '字母',
|
|
26
27
|
'validation.rule.buildRule.token.lowerLetter': '小写字母',
|
|
27
28
|
'validation.rule.buildRule.token.upperLetter': '大写字母',
|
|
28
29
|
'validation.rule.buildRule.token.number': '数字',
|
|
30
|
+
'validation.rule.buildRule.token.specialChars': '特殊字符{{-value}}',
|
|
29
31
|
'hooks.useUserMedia.microphone': '麦克风',
|
|
30
32
|
'hooks.useUserMedia.camera': '摄像头',
|
|
31
33
|
'hooks.featureName.microphone': '语音',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["zhCN"],"sources":["../../../src/locales/langs/zh-CN.ts"],"sourcesContent":["const zhCN = {\n 'components.EditableText.requiredMsg': '请输入文本内容',\n 'components.EditableText.placeholder': '输入文本内容,按回车或点击确定按钮',\n 'components.EditableText.edit': '编辑',\n 'components.EditableText.save': '保存',\n 'components.EditableText.cancel': '取消',\n 'components.ColumnSetting.title': '列设置',\n 'components.ColumnSetting.selectAll': '全选',\n 'components.ColumnSetting.reset': '重置',\n\n 'validation.rule.number.message': '请输入数字',\n 'validation.rule.floatNumber.message': '请输入数字',\n 'validation.rule.email.message': '请输入正确的邮箱地址',\n 'validation.rule.ip.message': '请输入正确的ip地址',\n 'validation.rule.chineseMobile.message': '请输入正确的手机号',\n 'validation.rule.password.message': '8-16位密码,数字、字母、符号至少包含两种',\n 'validation.rule.buildRule.includeMandatory': 'include选项中至少有一个字段为true',\n 'validation.rule.buildRule.messageFormat': '支持{{content}}',\n 'validation.rule.buildRule.startsWithFormat': `,以{{prefix}}开头`,\n 'validation.rule.buildRule.minLength': `,至少{{min}}字符`,\n 'validation.rule.buildRule.maxLength': `,{{max}}字符以内`,\n 'validation.rule.buildRule.rangeLength': `,{{min}}~{{max}}个字符`,\n 'validation.rule.buildRule.token.separator': '、',\n 'validation.rule.buildRule.token.chinese': '汉字',\n 'validation.rule.buildRule.token.chinesePunctuation': '中文标点',\n 'validation.rule.buildRule.token.letter': '字母',\n 'validation.rule.buildRule.token.lowerLetter': '小写字母',\n 'validation.rule.buildRule.token.upperLetter': '大写字母',\n 'validation.rule.buildRule.token.number': '数字',\n 'hooks.useUserMedia.microphone': '麦克风',\n 'hooks.useUserMedia.camera': '摄像头',\n 'hooks.featureName.microphone': '语音',\n 'hooks.featureName.camera': '视频',\n 'hooks.useUserMedia.disabledWarning': '用户媒体已禁用',\n 'hooks.useUserMedia.isRecordingNow': '用户媒体正在录制,不可操作',\n 'hooks.useUserMedia.devicePermission': '{{deviceType}}权限',\n 'hooks.useUserMedia.requestTip1': '浏览器正在申请{{deviceType}}权限,请点击左侧弹窗的“访问该网站时允许”按钮。',\n 'hooks.useUserMedia.requestTip2': '请勿点击“一律不允许”按钮,否则将无法使用{{featureName}}相关功能。',\n 'hooks.useUserMedia.deniedPermission': '您已经拒绝了{{deviceType}}权限,将无法使用{{featureName}}相关功能!',\n 'hooks.useUserMedia.reopenPermissionGuide':\n '请点击地址栏的站点设置图标,然后按照以下步骤重新打开{{deviceType}}权限。',\n 'hooks.useUserMedia.notSupport': '当前浏览器不支持录制语音',\n 'hooks.useUserMedia.soundDetectTitle': '声音检测到问题',\n 'hooks.useUserMedia.soundDetectDescription':\n '似乎没有检测到声音,请检查麦克风是否正常工作,或者可能没有选择正确的音频输入设备。',\n 'hooks.useUserMedia.chooseMicrophoneDevice': '请重新选择音频设备',\n 'hooks.useUserMedia.rememberDefaultAudioDevice': '记住默认设备?',\n 'hooks.useUserMedia.rememberDefaultAudioDeviceTip': '请按照以下步骤保存默认音频设备,以便下次使用时自动选择。',\n 'hooks.useStompSocket.connectError': '连接失败,请稍后重试',\n 'hooks.useStompSocket.serverDisconnected': '服务端已断开连接',\n} as const;\nexport default zhCN;\n"],"mappings":"AAAA,IAAMA,IAAI,GAAG;EACX,qCAAqC,EAAE,SAAS;EAChD,qCAAqC,EAAE,mBAAmB;EAC1D,8BAA8B,EAAE,IAAI;EACpC,8BAA8B,EAAE,IAAI;EACpC,gCAAgC,EAAE,IAAI;EACtC,gCAAgC,EAAE,KAAK;EACvC,oCAAoC,EAAE,IAAI;EAC1C,gCAAgC,EAAE,IAAI;EAEtC,gCAAgC,EAAE,OAAO;EACzC,qCAAqC,EAAE,OAAO;EAC9C,+BAA+B,EAAE,YAAY;EAC7C,4BAA4B,EAAE,YAAY;EAC1C,uCAAuC,EAAE,WAAW;EACpD,kCAAkC,EAAE,wBAAwB;EAC5D,4CAA4C,EAAE,wBAAwB;EACtE,yCAAyC,EAAE,eAAe;EAC1D,4CAA4C,sCAAkB;EAC9D,qCAAqC,yCAAgB;EACrD,qCAAqC,yCAAgB;EACrD,uCAAuC,2CAAuB;EAC9D,2CAA2C,EAAE,GAAG;EAChD,yCAAyC,EAAE,IAAI;EAC/C,oDAAoD,EAAE,MAAM;EAC5D,wCAAwC,EAAE,IAAI;EAC9C,6CAA6C,EAAE,MAAM;EACrD,6CAA6C,EAAE,MAAM;EACrD,wCAAwC,EAAE,IAAI;EAC9C,+BAA+B,EAAE,KAAK;EACtC,2BAA2B,EAAE,KAAK;EAClC,8BAA8B,EAAE,IAAI;EACpC,0BAA0B,EAAE,IAAI;EAChC,oCAAoC,EAAE,SAAS;EAC/C,mCAAmC,EAAE,eAAe;EACpD,qCAAqC,EAAE,kBAAkB;EACzD,gCAAgC,EAAE,+CAA+C;EACjF,gCAAgC,EAAE,2CAA2C;EAC7E,qCAAqC,EAAE,kDAAkD;EACzF,0CAA0C,EACxC,6CAA6C;EAC/C,+BAA+B,EAAE,cAAc;EAC/C,qCAAqC,EAAE,SAAS;EAChD,2CAA2C,EACzC,2CAA2C;EAC7C,2CAA2C,EAAE,WAAW;EACxD,+CAA+C,EAAE,SAAS;EAC1D,kDAAkD,EAAE,8BAA8B;EAClF,mCAAmC,EAAE,YAAY;EACjD,yCAAyC,EAAE;AAC7C,CAAU;AACV,eAAeA,IAAI"}
|
|
1
|
+
{"version":3,"names":["zhCN"],"sources":["../../../src/locales/langs/zh-CN.ts"],"sourcesContent":["const zhCN = {\n 'components.EditableText.requiredMsg': '请输入文本内容',\n 'components.EditableText.placeholder': '输入文本内容,按回车或点击确定按钮',\n 'components.EditableText.edit': '编辑',\n 'components.EditableText.save': '保存',\n 'components.EditableText.cancel': '取消',\n 'components.ColumnSetting.title': '列设置',\n 'components.ColumnSetting.selectAll': '全选',\n 'components.ColumnSetting.reset': '重置',\n\n 'validation.rule.number.message': '请输入数字',\n 'validation.rule.floatNumber.message': '请输入数字',\n 'validation.rule.email.message': '请输入正确的邮箱地址',\n 'validation.rule.ip.message': '请输入正确的ip地址',\n 'validation.rule.chineseMobile.message': '请输入正确的手机号',\n 'validation.rule.password.message': '8-16位密码,数字、字母、符号至少包含两种',\n 'validation.rule.buildRule.includeMandatory': 'include选项中至少有一个字段为true',\n 'validation.rule.buildRule.messageFormat': '支持{{content}}',\n 'validation.rule.buildRule.startsWithFormat': `,以{{prefix}}开头`,\n 'validation.rule.buildRule.minLength': `,至少{{min}}字符`,\n 'validation.rule.buildRule.maxLength': `,{{max}}字符以内`,\n 'validation.rule.buildRule.rangeLength': `,{{min}}~{{max}}个字符`,\n 'validation.rule.buildRule.token.separator': '、',\n 'validation.rule.buildRule.token.delimiter': '',\n 'validation.rule.buildRule.token.chinese': '汉字',\n 'validation.rule.buildRule.token.chinesePunctuation': '中文标点',\n 'validation.rule.buildRule.token.letter': '字母',\n 'validation.rule.buildRule.token.lowerLetter': '小写字母',\n 'validation.rule.buildRule.token.upperLetter': '大写字母',\n 'validation.rule.buildRule.token.number': '数字',\n 'validation.rule.buildRule.token.specialChars': '特殊字符{{-value}}',\n 'hooks.useUserMedia.microphone': '麦克风',\n 'hooks.useUserMedia.camera': '摄像头',\n 'hooks.featureName.microphone': '语音',\n 'hooks.featureName.camera': '视频',\n 'hooks.useUserMedia.disabledWarning': '用户媒体已禁用',\n 'hooks.useUserMedia.isRecordingNow': '用户媒体正在录制,不可操作',\n 'hooks.useUserMedia.devicePermission': '{{deviceType}}权限',\n 'hooks.useUserMedia.requestTip1': '浏览器正在申请{{deviceType}}权限,请点击左侧弹窗的“访问该网站时允许”按钮。',\n 'hooks.useUserMedia.requestTip2': '请勿点击“一律不允许”按钮,否则将无法使用{{featureName}}相关功能。',\n 'hooks.useUserMedia.deniedPermission': '您已经拒绝了{{deviceType}}权限,将无法使用{{featureName}}相关功能!',\n 'hooks.useUserMedia.reopenPermissionGuide':\n '请点击地址栏的站点设置图标,然后按照以下步骤重新打开{{deviceType}}权限。',\n 'hooks.useUserMedia.notSupport': '当前浏览器不支持录制语音',\n 'hooks.useUserMedia.soundDetectTitle': '声音检测到问题',\n 'hooks.useUserMedia.soundDetectDescription':\n '似乎没有检测到声音,请检查麦克风是否正常工作,或者可能没有选择正确的音频输入设备。',\n 'hooks.useUserMedia.chooseMicrophoneDevice': '请重新选择音频设备',\n 'hooks.useUserMedia.rememberDefaultAudioDevice': '记住默认设备?',\n 'hooks.useUserMedia.rememberDefaultAudioDeviceTip': '请按照以下步骤保存默认音频设备,以便下次使用时自动选择。',\n 'hooks.useStompSocket.connectError': '连接失败,请稍后重试',\n 'hooks.useStompSocket.serverDisconnected': '服务端已断开连接',\n} as const;\nexport default zhCN;\n"],"mappings":"AAAA,IAAMA,IAAI,GAAG;EACX,qCAAqC,EAAE,SAAS;EAChD,qCAAqC,EAAE,mBAAmB;EAC1D,8BAA8B,EAAE,IAAI;EACpC,8BAA8B,EAAE,IAAI;EACpC,gCAAgC,EAAE,IAAI;EACtC,gCAAgC,EAAE,KAAK;EACvC,oCAAoC,EAAE,IAAI;EAC1C,gCAAgC,EAAE,IAAI;EAEtC,gCAAgC,EAAE,OAAO;EACzC,qCAAqC,EAAE,OAAO;EAC9C,+BAA+B,EAAE,YAAY;EAC7C,4BAA4B,EAAE,YAAY;EAC1C,uCAAuC,EAAE,WAAW;EACpD,kCAAkC,EAAE,wBAAwB;EAC5D,4CAA4C,EAAE,wBAAwB;EACtE,yCAAyC,EAAE,eAAe;EAC1D,4CAA4C,sCAAkB;EAC9D,qCAAqC,yCAAgB;EACrD,qCAAqC,yCAAgB;EACrD,uCAAuC,2CAAuB;EAC9D,2CAA2C,EAAE,GAAG;EAChD,2CAA2C,EAAE,EAAE;EAC/C,yCAAyC,EAAE,IAAI;EAC/C,oDAAoD,EAAE,MAAM;EAC5D,wCAAwC,EAAE,IAAI;EAC9C,6CAA6C,EAAE,MAAM;EACrD,6CAA6C,EAAE,MAAM;EACrD,wCAAwC,EAAE,IAAI;EAC9C,8CAA8C,EAAE,gBAAgB;EAChE,+BAA+B,EAAE,KAAK;EACtC,2BAA2B,EAAE,KAAK;EAClC,8BAA8B,EAAE,IAAI;EACpC,0BAA0B,EAAE,IAAI;EAChC,oCAAoC,EAAE,SAAS;EAC/C,mCAAmC,EAAE,eAAe;EACpD,qCAAqC,EAAE,kBAAkB;EACzD,gCAAgC,EAAE,+CAA+C;EACjF,gCAAgC,EAAE,2CAA2C;EAC7E,qCAAqC,EAAE,kDAAkD;EACzF,0CAA0C,EACxC,6CAA6C;EAC/C,+BAA+B,EAAE,cAAc;EAC/C,qCAAqC,EAAE,SAAS;EAChD,2CAA2C,EACzC,2CAA2C;EAC7C,2CAA2C,EAAE,WAAW;EACxD,+CAA+C,EAAE,SAAS;EAC1D,kDAAkD,EAAE,8BAA8B;EAClF,mCAAmC,EAAE,YAAY;EACjD,yCAAyC,EAAE;AAC7C,CAAU;AACV,eAAeA,IAAI"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { Langs } from '../../locales';
|
|
3
|
+
import type { ConfirmActionProps } from '../ConfirmAction';
|
|
4
|
+
import type { ModalActionProps } from '../ModalAction';
|
|
3
5
|
export interface ReactEasyContextProps {
|
|
4
6
|
/**
|
|
5
7
|
* - **EN:** Language of the component, used for global configuration, can be 'en-US' or 'zh-CN'
|
|
@@ -7,43 +9,41 @@ export interface ReactEasyContextProps {
|
|
|
7
9
|
*/
|
|
8
10
|
lang?: Langs;
|
|
9
11
|
/**
|
|
10
|
-
* - **EN:**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* - **EN:** Get localized text
|
|
13
|
+
* - **CN:** 获取本地化文本
|
|
14
|
+
*
|
|
15
|
+
* @param key Normal text or key of local resource | 普通文本或本地资源的键值
|
|
16
|
+
* @param args Parameters of the localized text | 本地化文本的参数
|
|
17
|
+
*
|
|
18
|
+
* @returns Localized text | 本地化文本
|
|
14
19
|
*/
|
|
15
|
-
|
|
20
|
+
localize?: <T>(key: T, args?: Record<string, unknown>) => ReactNode;
|
|
16
21
|
/**
|
|
17
|
-
* - **EN:**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* - **CN:** 确认弹框的默认内容,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本
|
|
22
|
+
* - **EN:** Global configuration for `ConfirmAction` component, which can be used to set default
|
|
23
|
+
* modal title and content for all `ConfirmAction` components in the application.
|
|
24
|
+
* - **CN:** `ConfirmAction`组件的全局配置,可以用来设置应用中所有`ConfirmAction`组件的默认模态框标题和内容。
|
|
21
25
|
*/
|
|
26
|
+
ConfirmAction?: ConfirmActionProps<any, never>;
|
|
27
|
+
/** @deprecated Use `ConfirmAction.title` instead */
|
|
28
|
+
defaultConfirmTitle?: ReactNode;
|
|
29
|
+
/** @deprecated Use `ConfirmAction.content` instead */
|
|
22
30
|
defaultConfirmContent?: ReactNode;
|
|
23
31
|
/**
|
|
24
|
-
* - **EN:**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* - **CN:** 删除确认弹框的默认标题,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本
|
|
32
|
+
* - **EN:** Global configuration for `DeleteConfirmAction` component, which can be used to set
|
|
33
|
+
* default modal title and content for all `DeleteConfirmAction` components in the application.
|
|
34
|
+
* - **CN:** `DeleteConfirmAction`组件的全局配置,可以用来设置应用中所有`DeleteConfirmAction`组件的默认模态框标题和内容。
|
|
28
35
|
*/
|
|
36
|
+
DeletionConfirmAction?: ConfirmActionProps<any, never>;
|
|
37
|
+
/** @deprecated Use `DeletionConfirmAction.title` instead */
|
|
29
38
|
defaultDeletionConfirmTitle?: ReactNode;
|
|
30
|
-
/**
|
|
31
|
-
* - **EN:** Default content of the deletion confirmation dialog, used for global configuration, can
|
|
32
|
-
* be normal text or the key of localized resources, the key of localized resources will be
|
|
33
|
-
* converted into localized text through the `localize` method
|
|
34
|
-
* - **CN:** 删除确认弹框的默认内容,用于全局配置,可以是普通文本或本地化资源的键值,本地化资源的键值会通过`localize`方法转换成本地化文本
|
|
35
|
-
*/
|
|
39
|
+
/** @deprecated Use `DeletionConfirmAction.content` instead */
|
|
36
40
|
defaultDeletionConfirmContent?: ReactNode;
|
|
37
41
|
/**
|
|
38
|
-
* - **EN:**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @param key Normal text or key of local resource | 普通文本或本地资源的键值
|
|
42
|
-
* @param args Parameters of the localized text | 本地化文本的参数
|
|
43
|
-
*
|
|
44
|
-
* @returns Localized text | 本地化文本
|
|
42
|
+
* - **EN:** Global configuration for `ModalAction` component, which can be used to set default
|
|
43
|
+
* modal title and content for all `ModalAction` components in the application.
|
|
44
|
+
* - **CN:** `ModalAction`组件的全局配置,可以用来设置应用中所有`ModalAction`组件的默认模态框标题和内容。
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
ModalAction?: Partial<ModalActionProps<any, any, any, any, any>>;
|
|
47
47
|
}
|
|
48
48
|
export declare const defaultContextValue: ReactEasyContextProps;
|
|
49
49
|
declare const ReactEasyContext: import("react").Context<ReactEasyContextProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/ConfigProvider/context.tsx"],
|
|
4
|
-
"sourcesContent": ["import { createContext, type ReactNode } from 'react';\nimport type { Langs } from '../../locales';\n\nexport interface ReactEasyContextProps {\n /**\n * - **EN:** Language of the component, used for global configuration, can be 'en-US' or 'zh-CN'\n * - **CN:** 组件的语言,用于全局配置,可以是'en-US'或'zh-CN'\n */\n lang?: Langs;\n /**\n * - **EN:**
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8C;
|
|
4
|
+
"sourcesContent": ["import { createContext, type ReactNode } from 'react';\nimport type { Langs } from '../../locales';\nimport type { ConfirmActionProps } from '../ConfirmAction';\nimport type { ModalActionProps } from '../ModalAction';\n\nexport interface ReactEasyContextProps {\n /**\n * - **EN:** Language of the component, used for global configuration, can be 'en-US' or 'zh-CN'\n * - **CN:** 组件的语言,用于全局配置,可以是'en-US'或'zh-CN'\n */\n lang?: Langs;\n /**\n * - **EN:** Get localized text\n * - **CN:** 获取本地化文本\n *\n * @param key Normal text or key of local resource | 普通文本或本地资源的键值\n * @param args Parameters of the localized text | 本地化文本的参数\n *\n * @returns Localized text | 本地化文本\n */\n localize?: <T>(key: T, args?: Record<string, unknown>) => ReactNode;\n\n /**\n * - **EN:** Global configuration for `ConfirmAction` component, which can be used to set default\n * modal title and content for all `ConfirmAction` components in the application.\n * - **CN:** `ConfirmAction`组件的全局配置,可以用来设置应用中所有`ConfirmAction`组件的默认模态框标题和内容。\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ConfirmAction?: ConfirmActionProps<any, never>;\n /** @deprecated Use `ConfirmAction.title` instead */\n defaultConfirmTitle?: ReactNode;\n /** @deprecated Use `ConfirmAction.content` instead */\n defaultConfirmContent?: ReactNode;\n\n /**\n * - **EN:** Global configuration for `DeleteConfirmAction` component, which can be used to set\n * default modal title and content for all `DeleteConfirmAction` components in the application.\n * - **CN:** `DeleteConfirmAction`组件的全局配置,可以用来设置应用中所有`DeleteConfirmAction`组件的默认模态框标题和内容。\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n DeletionConfirmAction?: ConfirmActionProps<any, never>;\n /** @deprecated Use `DeletionConfirmAction.title` instead */\n defaultDeletionConfirmTitle?: ReactNode;\n /** @deprecated Use `DeletionConfirmAction.content` instead */\n defaultDeletionConfirmContent?: ReactNode;\n\n /**\n * - **EN:** Global configuration for `ModalAction` component, which can be used to set default\n * modal title and content for all `ModalAction` components in the application.\n * - **CN:** `ModalAction`组件的全局配置,可以用来设置应用中所有`ModalAction`组件的默认模态框标题和内容。\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ModalAction?: Partial<ModalActionProps<any, any, any, any, any>>;\n}\n\nexport const defaultContextValue: ReactEasyContextProps = {\n lang: 'en',\n};\n\nconst ReactEasyContext = createContext<ReactEasyContextProps>(defaultContextValue);\n\nexport default ReactEasyContext;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8C;AAuDvC,IAAM,sBAA6C;AAAA,EACxD,MAAM;AACR;AAEA,IAAM,uBAAmB,4BAAqC,mBAAmB;AAEjF,IAAO,kBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -43,54 +43,65 @@ var import_useRefFunction = __toESM(require("../../hooks/useRefFunction"));
|
|
|
43
43
|
var import_context = __toESM(require("../ConfigProvider/context"));
|
|
44
44
|
var genRenderer = (defaultProps) => {
|
|
45
45
|
const Render = (props, ref) => {
|
|
46
|
-
var _a, _b;
|
|
46
|
+
var _a, _b, _c, _d, _e, _f;
|
|
47
47
|
const { confirmType, ...restDefaults } = defaultProps;
|
|
48
|
+
const context = (0, import_react.useContext)(import_context.default);
|
|
49
|
+
const globalDefaults = confirmType === "delete" ? context.DeletionConfirmAction : context.ConfirmAction;
|
|
50
|
+
const defaultTitle = (0, import_useLocalizedText.default)(
|
|
51
|
+
confirmType === "delete" ? ((_a = context.DeletionConfirmAction) == null ? void 0 : _a.title) || context.defaultDeletionConfirmTitle : ((_b = context.ConfirmAction) == null ? void 0 : _b.title) || context.defaultConfirmTitle
|
|
52
|
+
);
|
|
53
|
+
const defaultContent = (0, import_useLocalizedText.default)(
|
|
54
|
+
confirmType === "delete" ? ((_c = context.DeletionConfirmAction) == null ? void 0 : _c.content) || context.defaultDeletionConfirmContent : ((_d = context.ConfirmAction) == null ? void 0 : _d.content) || context.defaultConfirmContent
|
|
55
|
+
);
|
|
48
56
|
const mergedProps = {
|
|
49
57
|
...restDefaults,
|
|
58
|
+
...globalDefaults,
|
|
50
59
|
...props,
|
|
60
|
+
title: props.title ?? defaultTitle ?? restDefaults.title,
|
|
61
|
+
content: props.content ?? defaultContent ?? restDefaults.content,
|
|
51
62
|
okButtonProps: {
|
|
52
63
|
...restDefaults.okButtonProps,
|
|
64
|
+
...globalDefaults == null ? void 0 : globalDefaults.okButtonProps,
|
|
53
65
|
...props.okButtonProps
|
|
54
66
|
},
|
|
55
67
|
cancelButtonProps: {
|
|
56
68
|
...restDefaults.cancelButtonProps,
|
|
69
|
+
...globalDefaults == null ? void 0 : globalDefaults.cancelButtonProps,
|
|
57
70
|
...props.cancelButtonProps
|
|
58
71
|
},
|
|
59
72
|
bodyProps: {
|
|
60
73
|
...restDefaults.bodyProps,
|
|
74
|
+
...globalDefaults == null ? void 0 : globalDefaults.bodyProps,
|
|
61
75
|
...props.bodyProps
|
|
62
76
|
},
|
|
63
77
|
maskProps: {
|
|
64
78
|
...restDefaults.maskProps,
|
|
79
|
+
...globalDefaults == null ? void 0 : globalDefaults.maskProps,
|
|
65
80
|
...props.maskProps
|
|
66
81
|
},
|
|
67
82
|
wrapProps: {
|
|
68
83
|
...restDefaults.wrapProps,
|
|
84
|
+
...globalDefaults == null ? void 0 : globalDefaults.wrapProps,
|
|
69
85
|
...props.wrapProps
|
|
70
86
|
},
|
|
71
87
|
triggerProps: {
|
|
72
88
|
...restDefaults.triggerProps,
|
|
89
|
+
...globalDefaults == null ? void 0 : globalDefaults.triggerProps,
|
|
73
90
|
...props.triggerProps,
|
|
74
91
|
style: {
|
|
75
|
-
...(
|
|
92
|
+
...(_e = restDefaults.triggerProps) == null ? void 0 : _e.style,
|
|
93
|
+
...(globalDefaults == null ? void 0 : globalDefaults.triggerProps) && "style" in globalDefaults.triggerProps && typeof globalDefaults.triggerProps.style === "object" ? globalDefaults.triggerProps.style : {},
|
|
76
94
|
...props.triggerProps && "style" in props.triggerProps && typeof props.triggerProps.style === "object" ? props.triggerProps.style : {}
|
|
77
95
|
}
|
|
78
96
|
}
|
|
79
97
|
};
|
|
80
|
-
const context = (0, import_react.useContext)(import_context.default);
|
|
81
|
-
const defaultTitle = (0, import_useLocalizedText.default)(
|
|
82
|
-
confirmType === "delete" ? context.defaultDeletionConfirmTitle : context.defaultConfirmTitle
|
|
83
|
-
);
|
|
84
|
-
const defaultContent = (0, import_useLocalizedText.default)(
|
|
85
|
-
confirmType === "delete" ? context.defaultDeletionConfirmContent : context.defaultConfirmContent
|
|
86
|
-
);
|
|
87
98
|
const {
|
|
88
99
|
triggerComponent: Trigger = import_antd.Button,
|
|
89
100
|
triggerEvent = "onClick",
|
|
90
101
|
triggerProps,
|
|
91
102
|
danger,
|
|
92
|
-
title
|
|
93
|
-
content
|
|
103
|
+
title,
|
|
104
|
+
content,
|
|
94
105
|
titleColor,
|
|
95
106
|
contentColor,
|
|
96
107
|
icon,
|
|
@@ -104,7 +115,7 @@ var genRenderer = (defaultProps) => {
|
|
|
104
115
|
} = mergedProps;
|
|
105
116
|
(0, import_useContextValidator.default)();
|
|
106
117
|
const app = import_antd.App.useApp();
|
|
107
|
-
const modal = ((
|
|
118
|
+
const modal = ((_f = app.modal) == null ? void 0 : _f.confirm) ? app.modal : import_antd.Modal;
|
|
108
119
|
const { localize } = (0, import_react.useContext)(import_context.default);
|
|
109
120
|
const [, token] = (0, import_useToken.default)();
|
|
110
121
|
const [confirmApi, setConfirmApi] = (0, import_react.useState)();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/ConfirmAction/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { ComponentType, ForwardedRef, PropsWithoutRef, ReactElement, ReactNode, RefAttributes } from 'react';\nimport { forwardRef, useContext, useImperativeHandle, useRef, useState } from 'react';\nimport type { ButtonProps, ModalFuncProps, SwitchProps } from 'antd';\nimport { App, Button, Modal, Switch, Typography } from 'antd';\nimport type { ModalFunc } from 'antd/es/modal/confirm';\nimport type confirm from 'antd/es/modal/confirm';\nimport useToken from 'antd/es/theme/useToken';\nimport type { LinkProps } from 'antd/es/typography/Link';\nimport type { TextProps } from 'antd/es/typography/Text';\nimport useContextValidator from '../../hooks/useContextValidator';\nimport useLocalizedText from '../../hooks/useLocalizedText';\nimport useRefFunction from '../../hooks/useRefFunction';\nimport ReactEasyContext from '../ConfigProvider/context';\n\nexport type ConfirmActionProps<TriggerProp extends object, Event extends keyof TriggerProp> = Omit<\n ModalFuncProps,\n 'onOk'\n> &\n ConfirmActionTrigger<TriggerProp, Event> & {\n /**\n * - **EN:** Whether to display in red danger mode, which will automatically affect the color of\n * the title, icon, and confirm button. Default is `false`, for DeleteConfirmAction, the\n * defaults is `true`.\n *\n * > You can explicitly set `titleColor`, `iconColor`, and `okButtonProps.type` to override\n *\n * - **CN:** 是否显示为红色危险模式,会自动影响标题、图标和确认按钮的颜色。默认`false`,DeleteConfirmAction组件的默认值为`true`。\n *\n * > 可以显式设置`titleColor`、`iconColor`和`okButtonProps.type`来覆盖\n */\n danger?: boolean;\n /**\n * - **EN:** The color of confirm box title, default is `warning`\n * - **CN:** 弹框标题颜色,默认`warning`\n */\n titleColor?: TextProps['type'] | 'primary';\n /**\n * - **EN:** The color of confirm box content\n * - **CN:** 弹框内容文本颜色\n */\n contentColor?: TextProps['type'] | 'primary';\n /**\n * - **EN:** The color of confirm box title icon, default is the same as `titleColor`\n * - **CN:** 弹框标题图标颜色,默认与`titleColor`相同\n */\n iconColor?: TextProps['type'] | 'primary';\n /**\n * - **EN:** Callback when click confirm button\n * - **CN:** 点击确认按钮的回调\n */\n // @ts-expect-error: because TriggerProp[Event] should be casted to function type\n onOk?: (...args: Parameters<TriggerProp[Event]>) => unknown | Promise<unknown>;\n /**\n * - **EN:** Callback after confirm event, won't trigger if failed, the argument is the return\n * value of `onOk`\n * - **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n afterOk?: (data?: any) => void;\n };\n\nexport interface ConfirmActionTrigger<TriggerProp extends object, Event extends keyof TriggerProp> {\n /**\n * - **EN:** Trigger component, trigger to show confirm box\n * - **CN:** 触发器组件,触发显示确认弹框\n */\n triggerComponent?: ComponentType<TriggerProp>;\n /**\n * - **EN:** Props of trigger component\n * - **CN:** 触发器组件的Props属性\n */\n triggerProps?: TriggerProp;\n /**\n * **EN:** The event name that triggers the dialog\n *\n * **CN:** 触发弹窗的事件名称\n *\n * - `Button`: 'onClick'\n * - `Switch`: 'onChange'\n * - `Link`: 'onClick'\n */\n triggerEvent?: Event;\n /**\n * - **EN:** Custom trigger content\n * - **CN:** 自定义触发器内容\n */\n children?: ReactNode;\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type ConfirmActionRef<R = {}> = R &\n ReturnType<ModalFunc> & {\n /**\n * - **EN:** Show confirm box\n * - **CN:** 显示确认弹框\n */\n show: (props?: Parameters<ModalFunc>[0]) => ReturnType<ModalFunc>;\n };\n\n/**\n * - **EN:** Generate a confirm box component\n * - **CN:** 生成一个确认弹框组件\n *\n * @param defaultProps Default props | 默认属性\n *\n * @returns Component render method | 组件render方法\n */\nexport const genRenderer = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultProps: Partial<ConfirmActionProps<any, never>> & { confirmType: 'normal' | 'delete' }\n) => {\n const Render = <TriggerProp extends object, Event extends keyof TriggerProp>(\n props: ConfirmActionProps<TriggerProp, Event>,\n ref: ForwardedRef<ConfirmActionRef>\n ) => {\n const { confirmType, ...restDefaults } = defaultProps;\n const mergedProps: ConfirmActionProps<TriggerProp, Event> = {\n ...restDefaults,\n ...props,\n okButtonProps: {\n ...restDefaults.okButtonProps,\n ...props.okButtonProps,\n },\n cancelButtonProps: {\n ...restDefaults.cancelButtonProps,\n ...props.cancelButtonProps,\n },\n bodyProps: {\n ...restDefaults.bodyProps,\n ...props.bodyProps,\n },\n maskProps: {\n ...restDefaults.maskProps,\n ...props.maskProps,\n },\n wrapProps: {\n ...restDefaults.wrapProps,\n ...props.wrapProps,\n },\n triggerProps: {\n ...restDefaults.triggerProps,\n ...props.triggerProps,\n style: {\n ...restDefaults.triggerProps?.style,\n ...(props.triggerProps && 'style' in props.triggerProps && typeof props.triggerProps.style === 'object'\n ? props.triggerProps.style\n : {}),\n },\n } as TriggerProp,\n };\n const context = useContext(ReactEasyContext);\n const defaultTitle = useLocalizedText(\n confirmType === 'delete' ? context.defaultDeletionConfirmTitle : context.defaultConfirmTitle\n );\n const defaultContent = useLocalizedText(\n confirmType === 'delete' ? context.defaultDeletionConfirmContent : context.defaultConfirmContent\n );\n const {\n triggerComponent: Trigger = Button,\n triggerEvent = 'onClick' as Event,\n triggerProps,\n danger,\n title = defaultTitle,\n content = defaultContent,\n titleColor,\n contentColor,\n icon,\n iconColor,\n okButtonProps,\n cancelButtonProps,\n onOk,\n afterOk,\n children,\n ...restProps\n } = mergedProps;\n\n useContextValidator();\n\n const app = App.useApp();\n // @ts-expect-error: because app may return a stub object when App is not used\n const modal = app.modal?.confirm ? app.modal : Modal;\n const { localize } = useContext(ReactEasyContext);\n const [, token] = useToken();\n const [confirmApi, setConfirmApi] = useState<ReturnType<typeof confirm>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const triggerEventArgsRef = useRef<any[]>(undefined);\n\n const fallbackColor = danger ? 'danger' : undefined;\n // Text with color\n const coloredText = (text: ReactNode, color?: TextProps['type'] | 'primary') => {\n const textContent = typeof text === 'string' ? (localize?.(text) ?? text) : text;\n if (!color) {\n return textContent;\n }\n if (color === 'primary') {\n return <Typography.Text style={{ color: token.colorPrimary }}>{textContent}</Typography.Text>;\n }\n return textContent ? <Typography.Text type={color}>{textContent}</Typography.Text> : undefined;\n };\n\n // Show confirm box\n const showConfirm: ConfirmActionRef['show'] = useRefFunction(() => {\n const okProps: ButtonProps = {\n ...(danger ? { type: 'primary', danger: true } : {}),\n ...(okButtonProps ?? {}),\n };\n const cancelProps: ButtonProps = {\n ...(cancelButtonProps ?? {}),\n };\n const api = modal.confirm({\n title: coloredText(title, titleColor ?? fallbackColor ?? 'warning'),\n content: coloredText(content, contentColor),\n icon: coloredText(icon, iconColor ?? fallbackColor ?? 'warning'),\n autoFocusButton: null,\n closable: true,\n okButtonProps: okProps,\n cancelButtonProps: cancelProps,\n onOk: async () => {\n try {\n api.update({\n closable: false,\n okButtonProps: {\n loading: true,\n ...okProps,\n },\n cancelButtonProps: {\n disabled: true,\n ...cancelProps,\n },\n });\n const result = await onOk?.(...((triggerEventArgsRef.current ?? []) as Parameters<typeof onOk>));\n afterOk?.(result);\n } finally {\n api.update({\n closable: true,\n okButtonProps: {\n loading: false,\n ...okProps,\n },\n cancelButtonProps: {\n disabled: false,\n ...cancelProps,\n },\n });\n }\n },\n ...restProps,\n });\n setConfirmApi(api);\n return api;\n });\n\n // Output ref\n useImperativeHandle(ref, () => ({ show: showConfirm, ...confirmApi! }), [showConfirm, confirmApi]);\n\n // Render trigger component\n return (\n <Trigger\n {...triggerProps}\n // Trigger event\n {...((triggerEvent\n ? {\n [triggerEvent]: (...args: any[]) => {\n triggerEventArgsRef.current = args;\n const api = showConfirm();\n if (triggerProps && typeof triggerProps[triggerEvent] === 'function') {\n (triggerProps[triggerEvent] as (...args: any[]) => void)(...args, { api });\n }\n },\n }\n : {}) as TriggerProp)}\n >\n {(triggerProps as { children?: ReactNode }).children ?? children}\n </Trigger>\n );\n };\n Render.displayName = 'ConfirmAction';\n return Render;\n};\n\n/**\n * - **EN:** Add default properties to the ConfirmAction component\n * - **CN:** 给ConfirmAction组件添加默认属性\n *\n * @param RenderComponent The component that renders the ConfirmAction | 实际渲染组件\n * @param defaultProps Add some default values based on the props passed to the component |\n * 在组件传入的props基础上,添加一些默认值\n */\nexport const withDefaultConfirmActionProps = <\n P extends ActionCompConstraint,\n TriggerProp extends object,\n Event extends keyof TriggerProp,\n Ref extends object,\n>(\n RenderComponent: ComponentType<\n PropsWithoutRef<P & ConfirmActionProps<TriggerProp, Event>> & RefAttributes<ConfirmActionRef<Ref>>\n >,\n defaultProps?:\n | Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event>>\n | ((\n actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event>\n ) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event>>)\n) => {\n const WithDefaultProps = forwardRef(\n (\n props: PropsWithoutRef<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event>>,\n ref: ForwardedRef<ConfirmActionRef<Ref>>\n ) => {\n const actualProps = props as Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event>;\n const useDefaultProps = typeof defaultProps === 'function' ? defaultProps : () => defaultProps;\n const defaults = useDefaultProps(actualProps);\n const mergedProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event> =\n typeof defaultProps === 'function'\n ? {\n ...actualProps,\n ...defaults,\n triggerProps: {\n ...actualProps.triggerProps,\n ...defaults?.triggerProps,\n },\n }\n : {\n ...defaults,\n ...actualProps,\n triggerProps: {\n ...defaults?.triggerProps,\n ...actualProps.triggerProps,\n },\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return <RenderComponent ref={ref} {...(mergedProps as any)} />;\n }\n );\n WithDefaultProps.displayName = 'ForwardRef(WithDefaultProps)';\n return WithDefaultProps;\n};\n\nconst renderConfirmAction = genRenderer({\n confirmType: 'normal',\n});\nconst forwarded = forwardRef(renderConfirmAction);\nforwarded.displayName = 'ForwardRef(ConfirmAction)';\n\n/**\n * - **EN:** Confirm box component with trigger\n * - **CN:** 带触发器的确认框组件\n */\nconst ConfirmAction = forwarded as unknown as ConfirmActionWithStatic;\n// Type of button\n// eslint-disable-next-line @typescript-eslint/ban-types\nConfirmAction.Button = withDefaultConfirmActionProps<ActionCompConstraint, ButtonProps, 'onClick', {}>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n forwarded as any,\n {\n triggerComponent: Button,\n triggerEvent: 'onClick',\n triggerProps: {},\n }\n);\n// Type of switch\n// eslint-disable-next-line @typescript-eslint/ban-types\nConfirmAction.Switch = withDefaultConfirmActionProps<ActionCompConstraint, SwitchProps, 'onChange', {}>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n forwarded as any,\n {\n triggerComponent: Switch,\n triggerEvent: 'onChange',\n triggerProps: {},\n }\n);\n// Type of link\n// eslint-disable-next-line @typescript-eslint/ban-types\nConfirmAction.Link = withDefaultConfirmActionProps<ActionCompConstraint, LinkProps, 'onClick', {}>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n forwarded as any,\n {\n triggerComponent: Typography.Link,\n triggerEvent: 'onClick',\n triggerProps: {\n style: { whiteSpace: 'nowrap' },\n },\n }\n);\n\nexport interface ActionCompConstraint extends ReturnType<ModalFunc> {\n /**\n * - **EN:** Register the confirm action save event, the passed callback function will be called\n * when the confirm button is clicked, supports asynchronous saving\n * - **CN:** 注册确认框保存事件,传入的回调函数会在点击确认按钮时调用,支持异步保存\n *\n * @param handler Event handler | 事件处理函数\n */\n setOK: (\n handler: (\n /**\n * - **EN:** Trigger click event data, for example, for the `Switch` type trigger, you can get\n * the value of the switch; for the `Button` type trigger, you can get the click event\n * object of the button\n * - **CN:** 触发器点击的事件数据,例如,对于`Switch`类型的触发器,可以获取点击开关的值;对于`Button`类型的触发器,可以获取按钮的点击事件对象\n */\n ...triggerEventArgs: any[]\n ) => unknown | Promise<unknown>\n ) => void;\n\n /**\n * - **EN:** Default trigger DOM element used to render the trigger\n * - **CN:** 默认的触发器组件的 DOM 元素,用于渲染触发器\n */\n triggerDom: ReactNode;\n}\n\n/**\n * - **EN:** Interface of generic type component\n * - **CN:** 泛型组件的接口\n */\nexport type GenericConfirmActionInterface = <TriggerProp extends object, Event extends keyof TriggerProp>(\n props: PropsWithoutRef<TypedConfirmActionProps<TriggerProp, Event>> & RefAttributes<ConfirmActionRef>\n) => ReactElement;\n\n/**\n * - **EN:** Interface of specific type component\n * - **CN:** 具体类型组件的接口\n */\nexport type TypedConfirmActionInterface<TriggerProp extends object, Event extends keyof TriggerProp> = ComponentType<\n PropsWithoutRef<TypedConfirmActionProps<TriggerProp, Event>> & RefAttributes<ConfirmActionRef>\n>;\n\n/**\n * - **EN:** Props definition of specific type component\n * - **CN:** 具体类型组件的Props定义\n */\ntype TypedConfirmActionProps<TriggerProp extends object, Event extends keyof TriggerProp> = Omit<\n ConfirmActionProps<TriggerProp, Event>,\n 'triggerComponent' | 'triggerEvent'\n>;\nexport type ConfirmActionWithStatic = GenericConfirmActionInterface & {\n /**\n * - **EN:** Confirm box with button trigger\n * - **CN:** 按钮类型的确认框\n */\n Button: TypedConfirmActionInterface<ButtonProps, 'onClick'>;\n /**\n * - **EN:** Confirm box with switch trigger\n * - **CN:** 开关类型的确认框\n */\n Switch: TypedConfirmActionInterface<SwitchProps, 'onChange'>;\n /**\n * - **EN:** Confirm box with link trigger\n * - **CN:** 链接类型的确认框\n */\n Link: TypedConfirmActionInterface<LinkProps, 'onClick'>;\n};\n\nexport default ConfirmAction;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA8E;AAE9E,kBAAuD;AAGvD,sBAAqB;AAGrB,iCAAgC;AAChC,8BAA6B;AAC7B,4BAA2B;AAC3B,qBAA6B;AA8FtB,IAAM,cAAc,CAEzB,iBACG;AACH,QAAM,SAAS,CACb,OACA,QACG;AAjHP;AAkHI,UAAM,EAAE,aAAa,GAAG,aAAa,IAAI;
|
|
4
|
+
"sourcesContent": ["import type { ComponentType, ForwardedRef, PropsWithoutRef, ReactElement, ReactNode, RefAttributes } from 'react';\nimport { forwardRef, useContext, useImperativeHandle, useRef, useState } from 'react';\nimport type { ButtonProps, ModalFuncProps, SwitchProps } from 'antd';\nimport { App, Button, Modal, Switch, Typography } from 'antd';\nimport type { ModalFunc } from 'antd/es/modal/confirm';\nimport type confirm from 'antd/es/modal/confirm';\nimport useToken from 'antd/es/theme/useToken';\nimport type { LinkProps } from 'antd/es/typography/Link';\nimport type { TextProps } from 'antd/es/typography/Text';\nimport useContextValidator from '../../hooks/useContextValidator';\nimport useLocalizedText from '../../hooks/useLocalizedText';\nimport useRefFunction from '../../hooks/useRefFunction';\nimport ReactEasyContext from '../ConfigProvider/context';\n\nexport type ConfirmActionProps<TriggerProp extends object, Event extends keyof TriggerProp> = Omit<\n ModalFuncProps,\n 'onOk'\n> &\n ConfirmActionTrigger<TriggerProp, Event> & {\n /**\n * - **EN:** Whether to display in red danger mode, which will automatically affect the color of\n * the title, icon, and confirm button. Default is `false`, for DeleteConfirmAction, the\n * defaults is `true`.\n *\n * > You can explicitly set `titleColor`, `iconColor`, and `okButtonProps.type` to override\n *\n * - **CN:** 是否显示为红色危险模式,会自动影响标题、图标和确认按钮的颜色。默认`false`,DeleteConfirmAction组件的默认值为`true`。\n *\n * > 可以显式设置`titleColor`、`iconColor`和`okButtonProps.type`来覆盖\n */\n danger?: boolean;\n /**\n * - **EN:** The color of confirm box title, default is `warning`\n * - **CN:** 弹框标题颜色,默认`warning`\n */\n titleColor?: TextProps['type'] | 'primary';\n /**\n * - **EN:** The color of confirm box content\n * - **CN:** 弹框内容文本颜色\n */\n contentColor?: TextProps['type'] | 'primary';\n /**\n * - **EN:** The color of confirm box title icon, default is the same as `titleColor`\n * - **CN:** 弹框标题图标颜色,默认与`titleColor`相同\n */\n iconColor?: TextProps['type'] | 'primary';\n /**\n * - **EN:** Callback when click confirm button\n * - **CN:** 点击确认按钮的回调\n */\n // @ts-expect-error: because TriggerProp[Event] should be casted to function type\n onOk?: (...args: Parameters<TriggerProp[Event]>) => unknown | Promise<unknown>;\n /**\n * - **EN:** Callback after confirm event, won't trigger if failed, the argument is the return\n * value of `onOk`\n * - **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n afterOk?: (data?: any) => void;\n };\n\nexport interface ConfirmActionTrigger<TriggerProp extends object, Event extends keyof TriggerProp> {\n /**\n * - **EN:** Trigger component, trigger to show confirm box\n * - **CN:** 触发器组件,触发显示确认弹框\n */\n triggerComponent?: ComponentType<TriggerProp>;\n /**\n * - **EN:** Props of trigger component\n * - **CN:** 触发器组件的Props属性\n */\n triggerProps?: TriggerProp;\n /**\n * **EN:** The event name that triggers the dialog\n *\n * **CN:** 触发弹窗的事件名称\n *\n * - `Button`: 'onClick'\n * - `Switch`: 'onChange'\n * - `Link`: 'onClick'\n */\n triggerEvent?: Event;\n /**\n * - **EN:** Custom trigger content\n * - **CN:** 自定义触发器内容\n */\n children?: ReactNode;\n}\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type ConfirmActionRef<R = {}> = R &\n ReturnType<ModalFunc> & {\n /**\n * - **EN:** Show confirm box\n * - **CN:** 显示确认弹框\n */\n show: (props?: Parameters<ModalFunc>[0]) => ReturnType<ModalFunc>;\n };\n\n/**\n * - **EN:** Generate a confirm box component\n * - **CN:** 生成一个确认弹框组件\n *\n * @param defaultProps Default props | 默认属性\n *\n * @returns Component render method | 组件render方法\n */\nexport const genRenderer = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultProps: Partial<ConfirmActionProps<any, never>> & { confirmType: 'normal' | 'delete' }\n) => {\n const Render = <TriggerProp extends object, Event extends keyof TriggerProp>(\n props: ConfirmActionProps<TriggerProp, Event>,\n ref: ForwardedRef<ConfirmActionRef>\n ) => {\n const { confirmType, ...restDefaults } = defaultProps;\n\n const context = useContext(ReactEasyContext);\n const globalDefaults = confirmType === 'delete' ? context.DeletionConfirmAction : context.ConfirmAction;\n\n const defaultTitle = useLocalizedText(\n confirmType === 'delete'\n ? context.DeletionConfirmAction?.title || context.defaultDeletionConfirmTitle\n : context.ConfirmAction?.title || context.defaultConfirmTitle\n );\n const defaultContent = useLocalizedText(\n confirmType === 'delete'\n ? context.DeletionConfirmAction?.content || context.defaultDeletionConfirmContent\n : context.ConfirmAction?.content || context.defaultConfirmContent\n );\n\n const mergedProps: ConfirmActionProps<TriggerProp, Event> = {\n ...restDefaults,\n ...globalDefaults,\n ...props,\n title: props.title ?? defaultTitle ?? restDefaults.title,\n content: props.content ?? defaultContent ?? restDefaults.content,\n okButtonProps: {\n ...restDefaults.okButtonProps,\n ...globalDefaults?.okButtonProps,\n ...props.okButtonProps,\n },\n cancelButtonProps: {\n ...restDefaults.cancelButtonProps,\n ...globalDefaults?.cancelButtonProps,\n ...props.cancelButtonProps,\n },\n bodyProps: {\n ...restDefaults.bodyProps,\n ...globalDefaults?.bodyProps,\n ...props.bodyProps,\n },\n maskProps: {\n ...restDefaults.maskProps,\n ...globalDefaults?.maskProps,\n ...props.maskProps,\n },\n wrapProps: {\n ...restDefaults.wrapProps,\n ...globalDefaults?.wrapProps,\n ...props.wrapProps,\n },\n triggerProps: {\n ...restDefaults.triggerProps,\n ...globalDefaults?.triggerProps,\n ...props.triggerProps,\n style: {\n ...restDefaults.triggerProps?.style,\n ...(globalDefaults?.triggerProps &&\n 'style' in globalDefaults.triggerProps &&\n typeof globalDefaults.triggerProps.style === 'object'\n ? globalDefaults.triggerProps.style\n : {}),\n ...(props.triggerProps && 'style' in props.triggerProps && typeof props.triggerProps.style === 'object'\n ? props.triggerProps.style\n : {}),\n },\n } as TriggerProp,\n };\n const {\n triggerComponent: Trigger = Button,\n triggerEvent = 'onClick' as Event,\n triggerProps,\n danger,\n title,\n content,\n titleColor,\n contentColor,\n icon,\n iconColor,\n okButtonProps,\n cancelButtonProps,\n onOk,\n afterOk,\n children,\n ...restProps\n } = mergedProps;\n\n useContextValidator();\n\n const app = App.useApp();\n // @ts-expect-error: because app may return a stub object when App is not used\n const modal = app.modal?.confirm ? app.modal : Modal;\n const { localize } = useContext(ReactEasyContext);\n const [, token] = useToken();\n const [confirmApi, setConfirmApi] = useState<ReturnType<typeof confirm>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const triggerEventArgsRef = useRef<any[]>(undefined);\n\n const fallbackColor = danger ? 'danger' : undefined;\n // Text with color\n const coloredText = (text: ReactNode, color?: TextProps['type'] | 'primary') => {\n const textContent = typeof text === 'string' ? (localize?.(text) ?? text) : text;\n if (!color) {\n return textContent;\n }\n if (color === 'primary') {\n return <Typography.Text style={{ color: token.colorPrimary }}>{textContent}</Typography.Text>;\n }\n return textContent ? <Typography.Text type={color}>{textContent}</Typography.Text> : undefined;\n };\n\n // Show confirm box\n const showConfirm: ConfirmActionRef['show'] = useRefFunction(() => {\n const okProps: ButtonProps = {\n ...(danger ? { type: 'primary', danger: true } : {}),\n ...(okButtonProps ?? {}),\n };\n const cancelProps: ButtonProps = {\n ...(cancelButtonProps ?? {}),\n };\n const api = modal.confirm({\n title: coloredText(title, titleColor ?? fallbackColor ?? 'warning'),\n content: coloredText(content, contentColor),\n icon: coloredText(icon, iconColor ?? fallbackColor ?? 'warning'),\n autoFocusButton: null,\n closable: true,\n okButtonProps: okProps,\n cancelButtonProps: cancelProps,\n onOk: async () => {\n try {\n api.update({\n closable: false,\n okButtonProps: {\n loading: true,\n ...okProps,\n },\n cancelButtonProps: {\n disabled: true,\n ...cancelProps,\n },\n });\n const result = await onOk?.(...((triggerEventArgsRef.current ?? []) as Parameters<typeof onOk>));\n afterOk?.(result);\n } finally {\n api.update({\n closable: true,\n okButtonProps: {\n loading: false,\n ...okProps,\n },\n cancelButtonProps: {\n disabled: false,\n ...cancelProps,\n },\n });\n }\n },\n ...restProps,\n });\n setConfirmApi(api);\n return api;\n });\n\n // Output ref\n useImperativeHandle(ref, () => ({ show: showConfirm, ...confirmApi! }), [showConfirm, confirmApi]);\n\n // Render trigger component\n return (\n <Trigger\n {...triggerProps}\n // Trigger event\n {...((triggerEvent\n ? {\n [triggerEvent]: (...args: any[]) => {\n triggerEventArgsRef.current = args;\n const api = showConfirm();\n if (triggerProps && typeof triggerProps[triggerEvent] === 'function') {\n (triggerProps[triggerEvent] as (...args: any[]) => void)(...args, { api });\n }\n },\n }\n : {}) as TriggerProp)}\n >\n {(triggerProps as { children?: ReactNode }).children ?? children}\n </Trigger>\n );\n };\n Render.displayName = 'ConfirmAction';\n return Render;\n};\n\n/**\n * - **EN:** Add default properties to the ConfirmAction component\n * - **CN:** 给ConfirmAction组件添加默认属性\n *\n * @param RenderComponent The component that renders the ConfirmAction | 实际渲染组件\n * @param defaultProps Add some default values based on the props passed to the component |\n * 在组件传入的props基础上,添加一些默认值\n */\nexport const withDefaultConfirmActionProps = <\n P extends ActionCompConstraint,\n TriggerProp extends object,\n Event extends keyof TriggerProp,\n Ref extends object,\n>(\n RenderComponent: ComponentType<\n PropsWithoutRef<P & ConfirmActionProps<TriggerProp, Event>> & RefAttributes<ConfirmActionRef<Ref>>\n >,\n defaultProps?:\n | Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event>>\n | ((\n actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event>\n ) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event>>)\n) => {\n const WithDefaultProps = forwardRef(\n (\n props: PropsWithoutRef<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event>>,\n ref: ForwardedRef<ConfirmActionRef<Ref>>\n ) => {\n const actualProps = props as Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event>;\n const useDefaultProps = typeof defaultProps === 'function' ? defaultProps : () => defaultProps;\n const defaults = useDefaultProps(actualProps);\n const mergedProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event> =\n typeof defaultProps === 'function'\n ? {\n ...actualProps,\n ...defaults,\n triggerProps: {\n ...actualProps.triggerProps,\n ...defaults?.triggerProps,\n },\n }\n : {\n ...defaults,\n ...actualProps,\n triggerProps: {\n ...defaults?.triggerProps,\n ...actualProps.triggerProps,\n },\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return <RenderComponent ref={ref} {...(mergedProps as any)} />;\n }\n );\n WithDefaultProps.displayName = 'ForwardRef(WithDefaultProps)';\n return WithDefaultProps;\n};\n\nconst renderConfirmAction = genRenderer({\n confirmType: 'normal',\n});\nconst forwarded = forwardRef(renderConfirmAction);\nforwarded.displayName = 'ForwardRef(ConfirmAction)';\n\n/**\n * - **EN:** Confirm box component with trigger\n * - **CN:** 带触发器的确认框组件\n */\nconst ConfirmAction = forwarded as unknown as ConfirmActionWithStatic;\n// Type of button\n// eslint-disable-next-line @typescript-eslint/ban-types\nConfirmAction.Button = withDefaultConfirmActionProps<ActionCompConstraint, ButtonProps, 'onClick', {}>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n forwarded as any,\n {\n triggerComponent: Button,\n triggerEvent: 'onClick',\n triggerProps: {},\n }\n);\n// Type of switch\n// eslint-disable-next-line @typescript-eslint/ban-types\nConfirmAction.Switch = withDefaultConfirmActionProps<ActionCompConstraint, SwitchProps, 'onChange', {}>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n forwarded as any,\n {\n triggerComponent: Switch,\n triggerEvent: 'onChange',\n triggerProps: {},\n }\n);\n// Type of link\n// eslint-disable-next-line @typescript-eslint/ban-types\nConfirmAction.Link = withDefaultConfirmActionProps<ActionCompConstraint, LinkProps, 'onClick', {}>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n forwarded as any,\n {\n triggerComponent: Typography.Link,\n triggerEvent: 'onClick',\n triggerProps: {\n style: { whiteSpace: 'nowrap' },\n },\n }\n);\n\nexport interface ActionCompConstraint extends ReturnType<ModalFunc> {\n /**\n * - **EN:** Register the confirm action save event, the passed callback function will be called\n * when the confirm button is clicked, supports asynchronous saving\n * - **CN:** 注册确认框保存事件,传入的回调函数会在点击确认按钮时调用,支持异步保存\n *\n * @param handler Event handler | 事件处理函数\n */\n setOK: (\n handler: (\n /**\n * - **EN:** Trigger click event data, for example, for the `Switch` type trigger, you can get\n * the value of the switch; for the `Button` type trigger, you can get the click event\n * object of the button\n * - **CN:** 触发器点击的事件数据,例如,对于`Switch`类型的触发器,可以获取点击开关的值;对于`Button`类型的触发器,可以获取按钮的点击事件对象\n */\n ...triggerEventArgs: any[]\n ) => unknown | Promise<unknown>\n ) => void;\n\n /**\n * - **EN:** Default trigger DOM element used to render the trigger\n * - **CN:** 默认的触发器组件的 DOM 元素,用于渲染触发器\n */\n triggerDom: ReactNode;\n}\n\n/**\n * - **EN:** Interface of generic type component\n * - **CN:** 泛型组件的接口\n */\nexport type GenericConfirmActionInterface = <TriggerProp extends object, Event extends keyof TriggerProp>(\n props: PropsWithoutRef<TypedConfirmActionProps<TriggerProp, Event>> & RefAttributes<ConfirmActionRef>\n) => ReactElement;\n\n/**\n * - **EN:** Interface of specific type component\n * - **CN:** 具体类型组件的接口\n */\nexport type TypedConfirmActionInterface<TriggerProp extends object, Event extends keyof TriggerProp> = ComponentType<\n PropsWithoutRef<TypedConfirmActionProps<TriggerProp, Event>> & RefAttributes<ConfirmActionRef>\n>;\n\n/**\n * - **EN:** Props definition of specific type component\n * - **CN:** 具体类型组件的Props定义\n */\ntype TypedConfirmActionProps<TriggerProp extends object, Event extends keyof TriggerProp> = Omit<\n ConfirmActionProps<TriggerProp, Event>,\n 'triggerComponent' | 'triggerEvent'\n>;\nexport type ConfirmActionWithStatic = GenericConfirmActionInterface & {\n /**\n * - **EN:** Confirm box with button trigger\n * - **CN:** 按钮类型的确认框\n */\n Button: TypedConfirmActionInterface<ButtonProps, 'onClick'>;\n /**\n * - **EN:** Confirm box with switch trigger\n * - **CN:** 开关类型的确认框\n */\n Switch: TypedConfirmActionInterface<SwitchProps, 'onChange'>;\n /**\n * - **EN:** Confirm box with link trigger\n * - **CN:** 链接类型的确认框\n */\n Link: TypedConfirmActionInterface<LinkProps, 'onClick'>;\n};\n\nexport default ConfirmAction;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": ["ReactEasyContext", "useLocalizedText", "useContextValidator", "useToken", "useRefFunction"]
|
|
7
7
|
}
|
|
@@ -11,9 +11,9 @@ import { type ActionComponentInterface } from '../ConfirmAction/withConfirmActio
|
|
|
11
11
|
*/
|
|
12
12
|
export default function withDeleteConfirmAction<P extends ActionCompConstraint, OuterTriggerProp extends object, OuterEvent extends keyof OuterTriggerProp, Ref extends object>(ActionComponent: ActionComponentInterface<P, Ref>, defaultProps?: Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>> | ((actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)): (<TriggerProp extends object, Event extends keyof TriggerProp>(props: import("react").PropsWithoutRef<Omit<P, keyof ActionCompConstraint>> & Omit<import("antd").ModalFuncProps, "onOk"> & import("../ConfirmAction").ConfirmActionTrigger<TriggerProp, Event> & {
|
|
13
13
|
danger?: boolean | undefined;
|
|
14
|
-
titleColor?:
|
|
15
|
-
contentColor?:
|
|
16
|
-
iconColor?:
|
|
14
|
+
titleColor?: import("antd/es/typography/Base").BaseType | "primary" | undefined;
|
|
15
|
+
contentColor?: import("antd/es/typography/Base").BaseType | "primary" | undefined;
|
|
16
|
+
iconColor?: import("antd/es/typography/Base").BaseType | "primary" | undefined;
|
|
17
17
|
onOk?: ((...args: Parameters<TriggerProp[Event]>) => unknown) | undefined;
|
|
18
18
|
afterOk?: ((data?: any) => void) | undefined;
|
|
19
19
|
} & import("react").RefAttributes<import("../ConfirmAction").ConfirmActionRef<Ref>>) => import("react").ReactNode) & import("../ConfirmAction/withConfirmAction").TypedTriggers<P, Ref>;
|
|
@@ -40,6 +40,7 @@ var import_react = require("react");
|
|
|
40
40
|
var import_antd = require("antd");
|
|
41
41
|
var import_react_is = require("react-is");
|
|
42
42
|
var import_useContextValidator = __toESM(require("../../hooks/useContextValidator"));
|
|
43
|
+
var import_context = __toESM(require("../ConfigProvider/context"));
|
|
43
44
|
var SubmitWithoutClosingSymbol = Symbol("[SubmitWithoutClose]");
|
|
44
45
|
var genModalActionRenderer = (defaultProps) => {
|
|
45
46
|
const ModalActionRenderer = (props, ref) => {
|
|
@@ -220,40 +221,49 @@ var genModalActionRenderer = (defaultProps) => {
|
|
|
220
221
|
};
|
|
221
222
|
return ModalActionRenderer;
|
|
222
223
|
};
|
|
223
|
-
function mergeProps(first, second) {
|
|
224
|
+
function mergeProps(first, second, third) {
|
|
224
225
|
return {
|
|
225
226
|
...first,
|
|
226
227
|
...second,
|
|
228
|
+
...third,
|
|
227
229
|
okButtonProps: {
|
|
228
230
|
...first == null ? void 0 : first.okButtonProps,
|
|
229
|
-
...second == null ? void 0 : second.okButtonProps
|
|
231
|
+
...second == null ? void 0 : second.okButtonProps,
|
|
232
|
+
...third == null ? void 0 : third.okButtonProps
|
|
230
233
|
},
|
|
231
234
|
cancelButtonProps: {
|
|
232
235
|
...first == null ? void 0 : first.cancelButtonProps,
|
|
233
|
-
...second == null ? void 0 : second.cancelButtonProps
|
|
236
|
+
...second == null ? void 0 : second.cancelButtonProps,
|
|
237
|
+
...third == null ? void 0 : third.cancelButtonProps
|
|
234
238
|
},
|
|
235
239
|
bodyProps: {
|
|
236
240
|
...first == null ? void 0 : first.bodyProps,
|
|
237
|
-
...second == null ? void 0 : second.bodyProps
|
|
241
|
+
...second == null ? void 0 : second.bodyProps,
|
|
242
|
+
...third == null ? void 0 : third.bodyProps
|
|
238
243
|
},
|
|
239
244
|
maskProps: {
|
|
240
245
|
...first == null ? void 0 : first.maskProps,
|
|
241
|
-
...second == null ? void 0 : second.maskProps
|
|
246
|
+
...second == null ? void 0 : second.maskProps,
|
|
247
|
+
...third == null ? void 0 : third.maskProps
|
|
242
248
|
},
|
|
243
249
|
wrapProps: {
|
|
244
250
|
...first == null ? void 0 : first.wrapProps,
|
|
245
|
-
...second == null ? void 0 : second.wrapProps
|
|
251
|
+
...second == null ? void 0 : second.wrapProps,
|
|
252
|
+
...third == null ? void 0 : third.wrapProps
|
|
246
253
|
},
|
|
247
254
|
formProps: {
|
|
248
255
|
...first == null ? void 0 : first.formProps,
|
|
249
|
-
...second == null ? void 0 : second.formProps
|
|
256
|
+
...second == null ? void 0 : second.formProps,
|
|
257
|
+
...third == null ? void 0 : third.formProps
|
|
250
258
|
},
|
|
251
259
|
triggerProps: {
|
|
252
260
|
...first == null ? void 0 : first.triggerProps,
|
|
253
261
|
...second == null ? void 0 : second.triggerProps,
|
|
262
|
+
...third == null ? void 0 : third.triggerProps,
|
|
254
263
|
style: {
|
|
255
264
|
...(first == null ? void 0 : first.triggerProps) && "style" in first.triggerProps && typeof first.triggerProps.style === "object" ? first.triggerProps.style : {},
|
|
256
|
-
...(second == null ? void 0 : second.triggerProps) && "style" in second.triggerProps && typeof second.triggerProps.style === "object" ? second.triggerProps.style : {}
|
|
265
|
+
...(second == null ? void 0 : second.triggerProps) && "style" in second.triggerProps && typeof second.triggerProps.style === "object" ? second.triggerProps.style : {},
|
|
266
|
+
...(third == null ? void 0 : third.triggerProps) && "style" in third.triggerProps && typeof third.triggerProps.style === "object" ? third.triggerProps.style : {}
|
|
257
267
|
}
|
|
258
268
|
}
|
|
259
269
|
};
|
|
@@ -321,10 +331,12 @@ ModalAction.SubmitWithoutClosing = SubmitWithoutClosingSymbol;
|
|
|
321
331
|
function withModalAction(formComp, defaultProps) {
|
|
322
332
|
const ForwardedModalAction = forwardedModalAction;
|
|
323
333
|
const WithDefaultProps = (0, import_react.forwardRef)((props, ref) => {
|
|
334
|
+
const context = (0, import_react.useContext)(import_context.default);
|
|
335
|
+
const globalDefaults = context == null ? void 0 : context.ModalAction;
|
|
324
336
|
const [modalActionRef, setModalActionRef] = (0, import_react.useState)(null);
|
|
325
337
|
const useDefaultProps = typeof defaultProps === "function" ? defaultProps : () => defaultProps;
|
|
326
338
|
const defaults = useDefaultProps(props, modalActionRef);
|
|
327
|
-
const mergedProps = typeof defaultProps === "function" ? mergeProps(props, defaults) : mergeProps(defaults, props);
|
|
339
|
+
const mergedProps = typeof defaultProps === "function" ? mergeProps(globalDefaults, props, defaults) : mergeProps(globalDefaults, defaults, props);
|
|
328
340
|
WithDefaultProps.displayName = "ForwardRef(WithDefaultProps)";
|
|
329
341
|
(0, import_react.useImperativeHandle)(ref, () => modalActionRef, [modalActionRef]);
|
|
330
342
|
return /* @__PURE__ */ React.createElement(
|