@alifd/chat 0.1.14 → 0.1.15-beta.1

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 (91) hide show
  1. package/es/button/index.d.ts +1 -9
  2. package/es/card/index.d.ts +1 -5
  3. package/es/card/view/card.d.ts +1 -4
  4. package/es/date-picker/index.d.ts +24 -0
  5. package/es/date-picker/index.js +33 -0
  6. package/es/date-picker/main.scss +6 -0
  7. package/es/date-picker/style.d.ts +1 -0
  8. package/es/date-picker/style.js +1 -0
  9. package/es/date-picker/types.d.ts +123 -0
  10. package/es/date-picker/types.js +1 -0
  11. package/es/feedback/index.d.ts +1 -6
  12. package/es/float-button/index.d.ts +4 -26
  13. package/es/float-button/main.scss +0 -1
  14. package/es/float-button/view/backtop.d.ts +1 -9
  15. package/es/float-button/view/drawer.d.ts +1 -4
  16. package/es/float-button/view/float-button.d.ts +1 -9
  17. package/es/float-button/view/inner-drawer.d.ts +1 -4
  18. package/es/index.d.ts +4 -0
  19. package/es/index.js +5 -1
  20. package/es/input/index.d.ts +24 -0
  21. package/es/input/index.js +33 -0
  22. package/es/input/main.scss +5 -0
  23. package/es/input/style.d.ts +1 -0
  24. package/es/input/style.js +1 -0
  25. package/es/input/types.d.ts +518 -0
  26. package/es/input/types.js +1 -0
  27. package/es/person-picker/index.d.ts +24 -0
  28. package/es/person-picker/index.js +40 -0
  29. package/es/person-picker/main.scss +5 -0
  30. package/es/person-picker/style.d.ts +1 -0
  31. package/es/person-picker/style.js +1 -0
  32. package/es/person-picker/types.d.ts +20 -0
  33. package/es/person-picker/types.js +1 -0
  34. package/es/tab/index.d.ts +1 -8
  35. package/es/tag/index.d.ts +1 -9
  36. package/es/text/index.d.ts +1 -7
  37. package/es/time-picker/index.d.ts +23 -0
  38. package/es/time-picker/index.js +79 -0
  39. package/es/time-picker/main.scss +6 -0
  40. package/es/time-picker/style.d.ts +1 -0
  41. package/es/time-picker/style.js +1 -0
  42. package/es/time-picker/types.d.ts +20 -0
  43. package/es/time-picker/types.js +1 -0
  44. package/es/utils/dingtalk.d.ts +4 -0
  45. package/es/utils/dingtalk.js +53 -0
  46. package/lib/button/index.d.ts +1 -9
  47. package/lib/card/index.d.ts +1 -5
  48. package/lib/card/view/card.d.ts +1 -4
  49. package/lib/date-picker/index.d.ts +24 -0
  50. package/lib/date-picker/index.js +35 -0
  51. package/lib/date-picker/main.scss +6 -0
  52. package/lib/date-picker/style.d.ts +1 -0
  53. package/lib/date-picker/style.js +3 -0
  54. package/lib/date-picker/types.d.ts +123 -0
  55. package/lib/date-picker/types.js +2 -0
  56. package/lib/feedback/index.d.ts +1 -6
  57. package/lib/float-button/index.d.ts +4 -26
  58. package/lib/float-button/main.scss +0 -1
  59. package/lib/float-button/view/backtop.d.ts +1 -9
  60. package/lib/float-button/view/drawer.d.ts +1 -4
  61. package/lib/float-button/view/float-button.d.ts +1 -9
  62. package/lib/float-button/view/inner-drawer.d.ts +1 -4
  63. package/lib/index.d.ts +4 -0
  64. package/lib/index.js +10 -2
  65. package/lib/input/index.d.ts +24 -0
  66. package/lib/input/index.js +35 -0
  67. package/lib/input/main.scss +5 -0
  68. package/lib/input/style.d.ts +1 -0
  69. package/lib/input/style.js +3 -0
  70. package/lib/input/types.d.ts +518 -0
  71. package/lib/input/types.js +2 -0
  72. package/lib/person-picker/index.d.ts +24 -0
  73. package/lib/person-picker/index.js +42 -0
  74. package/lib/person-picker/main.scss +5 -0
  75. package/lib/person-picker/style.d.ts +1 -0
  76. package/lib/person-picker/style.js +3 -0
  77. package/lib/person-picker/types.d.ts +20 -0
  78. package/lib/person-picker/types.js +2 -0
  79. package/lib/tab/index.d.ts +1 -8
  80. package/lib/tag/index.d.ts +1 -9
  81. package/lib/text/index.d.ts +1 -7
  82. package/lib/time-picker/index.d.ts +23 -0
  83. package/lib/time-picker/index.js +81 -0
  84. package/lib/time-picker/main.scss +6 -0
  85. package/lib/time-picker/style.d.ts +1 -0
  86. package/lib/time-picker/style.js +3 -0
  87. package/lib/time-picker/types.d.ts +20 -0
  88. package/lib/time-picker/types.js +2 -0
  89. package/lib/utils/dingtalk.d.ts +4 -0
  90. package/lib/utils/dingtalk.js +60 -0
  91. package/package.json +53 -1
@@ -9,13 +9,5 @@ import React from 'react';
9
9
  import { Tag as NextTag } from '@alifd/next';
10
10
  import type { TagProps } from '@alifd/next/types/tag';
11
11
  export type { TagProps } from '@alifd/next/types/tag';
12
- declare const _default: {
13
- new (props: TagProps & React.RefAttributes<NextTag> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<TagProps & React.RefAttributes<NextTag> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, NextTag>;
14
- contextType?: React.Context<any> | undefined;
15
- } & {
16
- displayName: string;
17
- defaultProps: Partial<TagProps & React.RefAttributes<NextTag>> | undefined;
18
- propTypes: React.WeakValidationMap<TagProps & React.RefAttributes<NextTag>> | undefined;
19
- $$typeof: symbol;
20
- };
12
+ declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<TagProps & React.RefAttributes<NextTag>, "key" | keyof TagProps> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, NextTag, {}>;
21
13
  export default _default;
@@ -1,9 +1,3 @@
1
- import React from 'react';
2
1
  import type { TextProps } from './types';
3
- declare const _default: {
4
- new (props: TextProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, context?: unknown): import("@alifd/next/types/config-provider/types").ConfiguredComponent<TextProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, unknown>;
5
- contextType?: React.Context<any> | undefined;
6
- } & {
7
- displayName: string;
8
- };
2
+ declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<TextProps & import("@alifd/next/types/config-provider/types").ComponentCommonProps, undefined, {}>;
9
3
  export default _default;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @component 时间选择器
3
+ * @en TimePicker
4
+ * @type 通用 - General
5
+ * @remarks 同 Next TimePicker,按钮用于开始一个即时操作。- Same as Next.Button, Button used to trigger an action.
6
+ * @when 标记一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。- Buttons are used for emphasizing important functions on your page.
7
+ * @others
8
+ * ## 无障碍键盘操作指南
9
+ * | 按键 | 说明 |
10
+ * | :---- | :---------- |
11
+ * | Enter | 触发 onClick 事件 |
12
+ * | SPACE | 触发 onClick 事件 |
13
+ * @othersEn
14
+ * ## ARIA and KeyBoard
15
+ * | KeyBoard | Description |
16
+ * | :---------- | :------------------------------ |
17
+ * | Enter | Trigger the onClick event |
18
+ * | SPACE | Trigger the onClick event |
19
+ */
20
+ import React from 'react';
21
+ export * from './types';
22
+ declare const _default: import("@alifd/next/types/config-provider/types").ConfiguredComponentClass<Pick<Pick<any, string | number | symbol> & React.RefAttributes<any>, string | number | symbol> & import("@alifd/next/types/config-provider/types").ComponentCommonProps, any, {}>;
23
+ export default _default;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ /**
3
+ * @component 时间选择器
4
+ * @en TimePicker
5
+ * @type 通用 - General
6
+ * @remarks 同 Next TimePicker,按钮用于开始一个即时操作。- Same as Next.Button, Button used to trigger an action.
7
+ * @when 标记一个(或封装一组)操作命令,响应用户点击行为,触发相应的业务逻辑。- Buttons are used for emphasizing important functions on your page.
8
+ * @others
9
+ * ## 无障碍键盘操作指南
10
+ * | 按键 | 说明 |
11
+ * | :---- | :---------- |
12
+ * | Enter | 触发 onClick 事件 |
13
+ * | SPACE | 触发 onClick 事件 |
14
+ * @othersEn
15
+ * ## ARIA and KeyBoard
16
+ * | KeyBoard | Description |
17
+ * | :---------- | :------------------------------ |
18
+ * | Enter | Trigger the onClick event |
19
+ * | SPACE | Trigger the onClick event |
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ const tslib_1 = require("tslib");
23
+ const react_1 = tslib_1.__importStar(require("react"));
24
+ const next_1 = require("@alifd/next");
25
+ const classnames_1 = tslib_1.__importDefault(require("classnames"));
26
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
27
+ const utils_1 = require("../utils");
28
+ // Todo: ComponentInstance 与 CombinedProps 类型补全
29
+ // type ComponentInstance = InstanceType<typeof NextTimePicker> | InstanceType<typeof NextSelect>;
30
+ // type CombinedProps = TimePickerProps & SelectProps & {
31
+ // mode: 'timePicker' | 'select';
32
+ // };
33
+ const TimePicker = (0, react_1.forwardRef)((_a, ref) => {
34
+ var { className, size = 'small', mode = 'normal' } = _a, props = tslib_1.__rest(_a, ["className", "size", "mode"]);
35
+ const getTimeArray = () => {
36
+ const now = (0, dayjs_1.default)();
37
+ const TODAY = now.hour(0).minute(0).second(0);
38
+ const TOMORROW = (0, dayjs_1.default)(TODAY).add(1, 'day');
39
+ const { format = 'HH:mm', hourStep = 0, minuteStep = 0, secondStep = 0, } = props;
40
+ let todayClone = (0, dayjs_1.default)(TODAY);
41
+ const timeArray = [];
42
+ while (todayClone.isBefore(TOMORROW)) {
43
+ timeArray.push({
44
+ label: todayClone.format(format),
45
+ value: todayClone.format(format),
46
+ });
47
+ if (hourStep > 0) {
48
+ todayClone = todayClone.add(hourStep, 'hour');
49
+ }
50
+ else if (minuteStep > 0) {
51
+ todayClone = todayClone.add(minuteStep, 'minute');
52
+ }
53
+ else if (secondStep > 0) {
54
+ todayClone = todayClone.add(secondStep, 'second');
55
+ }
56
+ else {
57
+ break;
58
+ }
59
+ }
60
+ return timeArray;
61
+ };
62
+ const formatSelectValue = () => {
63
+ const { value, format = 'HH:mm' } = props;
64
+ return {
65
+ label: (0, dayjs_1.default)(value).format(format),
66
+ value,
67
+ };
68
+ };
69
+ if (mode === 'dingtalk') {
70
+ const { format, hourStep, minuteStep, secondStep } = props, otherProps = tslib_1.__rest(props, ["format", "hourStep", "minuteStep", "secondStep"]);
71
+ return (react_1.default.createElement(next_1.Select, Object.assign({}, otherProps, { className: (0, classnames_1.default)(`${utils_1.PREFIX_DEFAULT}time-picker2`, className), value: formatSelectValue(), size: size, ref: ref }), getTimeArray().map((time, index) => (react_1.default.createElement(next_1.Select.Option, { value: time.value, key: index }, time.label)))));
72
+ }
73
+ else {
74
+ return (react_1.default.createElement(next_1.TimePicker2, Object.assign({}, props, { className: (0, classnames_1.default)(`${utils_1.PREFIX_DEFAULT}time-picker2`, className), size: size, ref: ref })));
75
+ }
76
+ });
77
+ const TimePickerWithSub = (0, utils_1.assignSubComponent)(TimePicker, {
78
+ displayName: 'TimePicker',
79
+ });
80
+ tslib_1.__exportStar(require("./types"), exports);
81
+ exports.default = next_1.ConfigProvider.config(TimePickerWithSub);
@@ -0,0 +1,6 @@
1
+ @import '@alifd/next/variables.scss';
2
+ @import "../core/variables.scss";
3
+
4
+ .#{$prefix}time-picker2 {
5
+
6
+ }
@@ -0,0 +1 @@
1
+ import '@alifd/next/lib/time-picker2/style';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ require("@alifd/next/lib/time-picker2/style");
@@ -0,0 +1,20 @@
1
+ import type React from 'react';
2
+ type HTMLAttributesWeak = Omit<React.ButtonHTMLAttributes<HTMLElement>, 'type' | 'onClick'>;
3
+ /**
4
+ * @api TimePicker
5
+ */
6
+ export interface TimePickerProps extends HTMLAttributesWeak {
7
+ /**
8
+ * 采用模式
9
+ * @en mode of time-picker
10
+ * @defaultValue 'normal'
11
+ */
12
+ mode?: 'normal' | 'dingtalk';
13
+ /**
14
+ * 时间选择器其他属性
15
+ * @en key of time-picker
16
+ * @defaultValue 'medium'
17
+ */
18
+ [key: string]: any;
19
+ }
20
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import '@ali/dingtalk-jsapi/entry/union';
2
+ export declare function userPicker({ pickedUsers, onSuccess }: any): void;
3
+ export declare function quitApp(): void;
4
+ export declare function addZeroInWorkNo(workNo: any): any;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addZeroInWorkNo = exports.quitApp = exports.userPicker = void 0;
4
+ const tslib_1 = require("tslib");
5
+ require("@ali/dingtalk-jsapi/entry/union");
6
+ const quit_1 = tslib_1.__importDefault(require("@ali/dingtalk-jsapi/api/biz/navigation/quit"));
7
+ const close_1 = tslib_1.__importDefault(require("@ali/dingtalk-jsapi/api/biz/navigation/close"));
8
+ const complexPicker_1 = tslib_1.__importDefault(require("@ali/dingtalk-jsapi/api/biz/contact/complexPicker"));
9
+ const dingtalk_jsapi_1 = require("@ali/dingtalk-jsapi");
10
+ function userPicker({ pickedUsers, onSuccess }) {
11
+ (0, complexPicker_1.default)({
12
+ title: '请选择人员', // 标题
13
+ corpId: 'dingd8e1123006514592', // 企业的corpId
14
+ multiple: true, // 是否多选
15
+ limitTips: '超出了', // 超过限定人数返回提示
16
+ maxUsers: 1000, // 最大可选人数
17
+ pickedUsers, // 已选用户
18
+ pickedDepartments: [], // 已选部门
19
+ disabledUsers: [], // 不可选用户
20
+ disabledDepartments: [], // 不可选部门
21
+ requiredUsers: [], // 必选用户(不可取消选中状态)
22
+ requiredDepartments: [], // 必选部门(不可取消选中状态)
23
+ appId: 158, // 微应用Id,企业内部应用查看AgentId
24
+ permissionType: 'GLOBAL', // 可添加权限校验,选人权限,目前只有GLOBAL这个参数
25
+ responseUserOnly: true, // 返回人,或者返回人和部门
26
+ startWithDepartmentId: 0, // 仅支持0和-1
27
+ showRootOrg: true,
28
+ onSuccess,
29
+ });
30
+ }
31
+ exports.userPicker = userPicker;
32
+ function quitApp() {
33
+ try {
34
+ if (dingtalk_jsapi_1.env.platform === 'pc') {
35
+ (0, quit_1.default)({});
36
+ }
37
+ else if (dingtalk_jsapi_1.env.platform === 'android' || dingtalk_jsapi_1.env.platform === 'ios') {
38
+ (0, close_1.default)({});
39
+ }
40
+ else {
41
+ window.close && window.close();
42
+ }
43
+ }
44
+ catch (err) {
45
+ console.log('quitApp error:', err);
46
+ }
47
+ }
48
+ exports.quitApp = quitApp;
49
+ function addZeroInWorkNo(workNo) {
50
+ if (!workNo) {
51
+ return '';
52
+ }
53
+ const workNoLength = workNo.length;
54
+ if (workNoLength.length >= 6) {
55
+ return workNo;
56
+ }
57
+ const str = `0000000${workNo}`;
58
+ return str.slice(str.length - 6, str.length);
59
+ }
60
+ exports.addZeroInWorkNo = addZeroInWorkNo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alifd/chat",
3
- "version": "0.1.14",
3
+ "version": "0.1.15-beta.1",
4
4
  "description": "A configurable component library for chat built on React.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -118,9 +118,57 @@
118
118
  "import": "./es/text/style.js",
119
119
  "require": "./lib/text/style.js"
120
120
  },
121
+ "./input": {
122
+ "import": "./es/input/index.js",
123
+ "require": "./lib/input/index.js"
124
+ },
125
+ "./input/style": {
126
+ "import": "./es/input/style.js",
127
+ "require": "./lib/input/style.js"
128
+ },
129
+ "./input/style.js": {
130
+ "import": "./es/input/style.js",
131
+ "require": "./lib/input/style.js"
132
+ },
133
+ "./date-picker": {
134
+ "import": "./es/date-picker/index.js",
135
+ "require": "./lib/date-picker/index.js"
136
+ },
137
+ "./date-picker/style": {
138
+ "import": "./es/date-picker/style.js",
139
+ "require": "./lib/date-picker/style.js"
140
+ },
141
+ "./date-picker/style.js": {
142
+ "import": "./es/date-picker/style.js",
143
+ "require": "./lib/date-picker/style.js"
144
+ },
145
+ "./time-picker": {
146
+ "import": "./es/time-picker/index.js",
147
+ "require": "./lib/time-picker/index.js"
148
+ },
149
+ "./time-picker/style": {
150
+ "import": "./es/time-picker/style.js",
151
+ "require": "./lib/time-picker/style.js"
152
+ },
153
+ "./time-picker/style.js": {
154
+ "import": "./es/time-picker/style.js",
155
+ "require": "./lib/time-picker/style.js"
156
+ },
121
157
  "./utils": {
122
158
  "import": "./es/utils/index.js",
123
159
  "require": "./lib/utils/index.js"
160
+ },
161
+ "./person-picker": {
162
+ "import": "./es/person-picker/index.js",
163
+ "require": "./lib/person-picker/index.js"
164
+ },
165
+ "./person-picker/style": {
166
+ "import": "./es/person-picker/style.js",
167
+ "require": "./lib/person-picker/style.js"
168
+ },
169
+ "./person-picker/style.js": {
170
+ "import": "./es/person-picker/style.js",
171
+ "require": "./lib/person-picker/style.js"
124
172
  }
125
173
  },
126
174
  "files": [
@@ -189,7 +237,11 @@
189
237
  "react-dom": ">=16.0.0"
190
238
  },
191
239
  "dependencies": {
240
+ "@ali/dingtalk-jsapi": "^3.0.33",
241
+ "dd-icons": "^1.6.20",
242
+ "dingtalk-jsapi": "^3.0.33",
192
243
  "hoist-non-react-statics": "^3.3.2",
244
+ "ice": "^3.7.100",
193
245
  "tslib": "^2.6.2"
194
246
  },
195
247
  "sideEffects": [