@knockout-js/layout 0.1.1-beta.1 → 0.1.1-beta.3
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/es2017/components/dictionary/index.d.ts +6 -0
- package/es2017/components/dictionary/index.js +64 -0
- package/es2017/components/dictionary/index.js.map +1 -0
- package/es2017/components/dictionary/index.module.css +4 -0
- package/es2017/components/dictionary/select.d.ts +19 -0
- package/es2017/components/dictionary/select.js +51 -0
- package/es2017/components/dictionary/select.js.map +1 -0
- package/es2017/components/dictionary/text.d.ts +23 -0
- package/es2017/components/dictionary/text.js +28 -0
- package/es2017/components/dictionary/text.js.map +1 -0
- package/es2017/components/icons/index.d.ts +2 -0
- package/es2017/components/icons/index.js +20 -0
- package/es2017/components/icons/index.js.map +1 -1
- package/es2017/components/index.d.ts +2 -0
- package/es2017/components/index.js +2 -0
- package/es2017/components/index.js.map +1 -1
- package/es2017/components/layout/index.js +6 -3
- package/es2017/components/layout/index.js.map +1 -1
- package/es2017/components/msg-dropdown/index.js +45 -48
- package/es2017/components/msg-dropdown/index.js.map +1 -1
- package/es2017/components/theme-switch/index.d.ts +0 -5
- package/es2017/components/theme-switch/index.js +16 -14
- package/es2017/components/theme-switch/index.js.map +1 -1
- package/es2017/components/theme-switch/index.module.css +14 -0
- package/esm/components/dictionary/index.d.ts +6 -0
- package/esm/components/dictionary/index.js +86 -0
- package/esm/components/dictionary/index.js.map +1 -0
- package/esm/components/dictionary/index.module.css +4 -0
- package/esm/components/dictionary/select.d.ts +19 -0
- package/esm/components/dictionary/select.js +71 -0
- package/esm/components/dictionary/select.js.map +1 -0
- package/esm/components/dictionary/text.d.ts +23 -0
- package/esm/components/dictionary/text.js +31 -0
- package/esm/components/dictionary/text.js.map +1 -0
- package/esm/components/icons/index.d.ts +2 -0
- package/esm/components/icons/index.js +24 -0
- package/esm/components/icons/index.js.map +1 -1
- package/esm/components/index.d.ts +2 -0
- package/esm/components/index.js +2 -0
- package/esm/components/index.js.map +1 -1
- package/esm/components/layout/index.js +8 -3
- package/esm/components/layout/index.js.map +1 -1
- package/esm/components/msg-dropdown/index.js +76 -101
- package/esm/components/msg-dropdown/index.js.map +1 -1
- package/esm/components/theme-switch/index.d.ts +0 -5
- package/esm/components/theme-switch/index.js +16 -14
- package/esm/components/theme-switch/index.js.map +1 -1
- package/esm/components/theme-switch/index.module.css +14 -0
- package/package.json +4 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs";
|
|
2
2
|
import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs";
|
|
3
3
|
import _ts_generator from "@swc/helpers/src/_ts_generator.mjs";
|
|
4
|
-
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
|
+
import { jsx as _jsx, Fragment as _Fragment } from "@ice/jsx-runtime/jsx-runtime";
|
|
5
5
|
import { Badge, Dropdown, List } from "antd";
|
|
6
6
|
import styles from "./index.module.css";
|
|
7
|
-
import { useEffect, useState, forwardRef, useImperativeHandle } from "react";
|
|
7
|
+
import { useEffect, useState, forwardRef, useImperativeHandle, useCallback } from "react";
|
|
8
8
|
import { BellOutlined } from "@ant-design/icons";
|
|
9
9
|
import { MsgInternalToOrderField, OrderDirection } from "@knockout-js/api/msgcenter";
|
|
10
10
|
import { getDate } from "../_util/index";
|
|
@@ -16,73 +16,41 @@ var userUnreadQuery = gql("query layoutPkgUserUnreadMsgInternals{\n userUnreadM
|
|
|
16
16
|
export default /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
17
17
|
var _props_maxLength;
|
|
18
18
|
var locale = useLocale("MsgDropdown"), _useState = _sliced_to_array(useState([]), 2), items = _useState[0], setItems = _useState[1], _useState1 = _sliced_to_array(useState(false), 2), open = _useState1[0], setOpen = _useState1[1], _useState2 = _sliced_to_array(useState(false), 2), showDot = _useState2[0], setShowDot = _useState2[1], _useState3 = _sliced_to_array(useState(false), 2), loading = _useState3[0], setLoading = _useState3[1], maxLength = (_props_maxLength = props.maxLength) !== null && _props_maxLength !== void 0 ? _props_maxLength : 5;
|
|
19
|
-
var requestData = function() {
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return [
|
|
53
|
-
2
|
|
54
|
-
];
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
return function requestData() {
|
|
59
|
-
return _ref.apply(this, arguments);
|
|
60
|
-
};
|
|
61
|
-
}(), requestUnread = function() {
|
|
62
|
-
var _ref = _async_to_generator(function() {
|
|
63
|
-
var _result_data, result, _result_data_userUnreadMsgInternals;
|
|
64
|
-
return _ts_generator(this, function(_state) {
|
|
65
|
-
switch(_state.label){
|
|
66
|
-
case 0:
|
|
67
|
-
return [
|
|
68
|
-
4,
|
|
69
|
-
query(userUnreadQuery, {}, {
|
|
70
|
-
instanceName: instanceName.MSGCENTER
|
|
71
|
-
})
|
|
72
|
-
];
|
|
73
|
-
case 1:
|
|
74
|
-
result = _state.sent();
|
|
75
|
-
setShowDot(((_result_data_userUnreadMsgInternals = (_result_data = result.data) === null || _result_data === void 0 ? void 0 : _result_data.userUnreadMsgInternals) !== null && _result_data_userUnreadMsgInternals !== void 0 ? _result_data_userUnreadMsgInternals : 0) > 0);
|
|
76
|
-
return [
|
|
77
|
-
2
|
|
78
|
-
];
|
|
79
|
-
}
|
|
80
|
-
});
|
|
19
|
+
var requestData = useCallback(/*#__PURE__*/ _async_to_generator(function() {
|
|
20
|
+
var _result_data, _result_data_userMsgInternalTos_edges, result, list;
|
|
21
|
+
return _ts_generator(this, function(_state) {
|
|
22
|
+
switch(_state.label){
|
|
23
|
+
case 0:
|
|
24
|
+
setLoading(true);
|
|
25
|
+
return [
|
|
26
|
+
4,
|
|
27
|
+
paging(userMsgQuery, {
|
|
28
|
+
first: maxLength,
|
|
29
|
+
where: {
|
|
30
|
+
readAtIsNil: true
|
|
31
|
+
},
|
|
32
|
+
orderBy: {
|
|
33
|
+
direction: OrderDirection.Desc,
|
|
34
|
+
field: MsgInternalToOrderField.CreatedAt
|
|
35
|
+
}
|
|
36
|
+
}, 1, {
|
|
37
|
+
instanceName: instanceName.MSGCENTER
|
|
38
|
+
})
|
|
39
|
+
];
|
|
40
|
+
case 1:
|
|
41
|
+
result = _state.sent(), list = [];
|
|
42
|
+
if ((_result_data = result.data) === null || _result_data === void 0 ? void 0 : _result_data.userMsgInternalTos) (_result_data_userMsgInternalTos_edges = result.data.userMsgInternalTos.edges) === null || _result_data_userMsgInternalTos_edges === void 0 ? void 0 : _result_data_userMsgInternalTos_edges.forEach(function(item) {
|
|
43
|
+
if (item === null || item === void 0 ? void 0 : item.node) list.push(item.node);
|
|
44
|
+
});
|
|
45
|
+
setShowDot(list.length > 0);
|
|
46
|
+
setItems(list);
|
|
47
|
+
setLoading(false);
|
|
48
|
+
return [
|
|
49
|
+
2
|
|
50
|
+
];
|
|
51
|
+
}
|
|
81
52
|
});
|
|
82
|
-
|
|
83
|
-
return _ref.apply(this, arguments);
|
|
84
|
-
};
|
|
85
|
-
}();
|
|
53
|
+
}), []);
|
|
86
54
|
useImperativeHandle(ref, function() {
|
|
87
55
|
return {
|
|
88
56
|
setShowDot: function() {
|
|
@@ -96,48 +64,55 @@ export default /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
96
64
|
open
|
|
97
65
|
]);
|
|
98
66
|
useEffect(function() {
|
|
99
|
-
|
|
67
|
+
query(userUnreadQuery, {}, {
|
|
68
|
+
instanceName: instanceName.MSGCENTER
|
|
69
|
+
}).then(function(result) {
|
|
70
|
+
var _result_data;
|
|
71
|
+
var _result_data_userUnreadMsgInternals;
|
|
72
|
+
setShowDot(((_result_data_userUnreadMsgInternals = (_result_data = result.data) === null || _result_data === void 0 ? void 0 : _result_data.userUnreadMsgInternals) !== null && _result_data_userUnreadMsgInternals !== void 0 ? _result_data_userUnreadMsgInternals : 0) > 0);
|
|
73
|
+
});
|
|
100
74
|
}, []);
|
|
101
75
|
return /*#__PURE__*/ _jsx(Dropdown, {
|
|
102
|
-
menu: {
|
|
103
|
-
items: items
|
|
104
|
-
},
|
|
105
76
|
trigger: [
|
|
106
77
|
"click"
|
|
107
78
|
],
|
|
108
79
|
open: open,
|
|
109
|
-
onOpenChange:
|
|
110
|
-
|
|
80
|
+
onOpenChange: useCallback(function(v) {
|
|
81
|
+
setOpen(v);
|
|
82
|
+
}, []),
|
|
83
|
+
placement: "bottom",
|
|
111
84
|
dropdownRender: function() {
|
|
112
|
-
/*#__PURE__*/ return _jsx(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
var _props_onMoreClick;
|
|
122
|
-
(_props_onMoreClick = props.onMoreClick) === null || _props_onMoreClick === void 0 ? void 0 : _props_onMoreClick.call(props);
|
|
123
|
-
},
|
|
124
|
-
children: locale.footer
|
|
125
|
-
}) : undefined,
|
|
126
|
-
bordered: true,
|
|
127
|
-
size: "small",
|
|
128
|
-
dataSource: items,
|
|
129
|
-
renderItem: function(item) {
|
|
130
|
-
/*#__PURE__*/ return _jsx(List.Item, {
|
|
85
|
+
/*#__PURE__*/ return _jsx(_Fragment, {
|
|
86
|
+
children: /*#__PURE__*/ _jsx(List, {
|
|
87
|
+
loading: loading,
|
|
88
|
+
className: styles.list,
|
|
89
|
+
header: /*#__PURE__*/ _jsx("div", {
|
|
90
|
+
children: locale.title
|
|
91
|
+
}),
|
|
92
|
+
footer: props.onMoreClick ? /*#__PURE__*/ _jsx("span", {
|
|
93
|
+
className: styles.footer,
|
|
131
94
|
onClick: function() {
|
|
132
|
-
var
|
|
133
|
-
(
|
|
95
|
+
var _props_onMoreClick;
|
|
96
|
+
(_props_onMoreClick = props.onMoreClick) === null || _props_onMoreClick === void 0 ? void 0 : _props_onMoreClick.call(props);
|
|
134
97
|
},
|
|
135
|
-
children:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
98
|
+
children: locale.footer
|
|
99
|
+
}) : undefined,
|
|
100
|
+
bordered: true,
|
|
101
|
+
size: "small",
|
|
102
|
+
dataSource: items,
|
|
103
|
+
renderItem: function(item) {
|
|
104
|
+
/*#__PURE__*/ return _jsx(List.Item, {
|
|
105
|
+
onClick: function() {
|
|
106
|
+
var _props_onItemClick;
|
|
107
|
+
(_props_onItemClick = props.onItemClick) === null || _props_onItemClick === void 0 ? void 0 : _props_onItemClick.call(props, item);
|
|
108
|
+
},
|
|
109
|
+
children: /*#__PURE__*/ _jsx(List.Item.Meta, {
|
|
110
|
+
title: item.msgInternal.subject,
|
|
111
|
+
description: getDate(item.createdAt, "YYYY-MM-DD HH:mm:ss")
|
|
112
|
+
})
|
|
113
|
+
}, item.id);
|
|
114
|
+
}
|
|
115
|
+
})
|
|
141
116
|
});
|
|
142
117
|
},
|
|
143
118
|
children: /*#__PURE__*/ _jsx("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["D:\\codeing\\git\\github\\knockout-js\\packages\\layout\\src\\components\\msg-dropdown\\index.tsx"],"sourcesContent":["import { Badge, Dropdown, List } from 'antd';\r\nimport styles from './index.module.css';\r\nimport { useEffect, useState, forwardRef, useImperativeHandle, ForwardedRef } from 'react';\r\nimport { BellOutlined } from '@ant-design/icons';\r\nimport { LayoutPkgUserMsgInternalToListQuery, LayoutPkgUserMsgInternalToListQueryVariables, LayoutPkgUserUnreadMsgInternalsQuery, LayoutPkgUserUnreadMsgInternalsQueryVariables, MsgInternalTo, MsgInternalToOrderField, OrderDirection } from '@knockout-js/api/msgcenter';\r\nimport { getDate } from '../_util';\r\nimport { useLocale } from '../locale';\r\nimport { gql, paging, query } from '@knockout-js/ice-urql/request';\r\nimport { instanceName } from '@knockout-js/api';\r\n\r\nexport interface MsgDropdownLocale {\r\n title: string;\r\n footer: string;\r\n}\r\n\r\nexport interface MsgDropdownProps {\r\n /**\r\n * 最多显示几条\r\n */\r\n maxLength?: number;\r\n /**\r\n * 选中一项\r\n * @param data\r\n * @returns\r\n */\r\n onItemClick?: (data: MsgInternalTo) => void;\r\n /**\r\n * 查看更多\r\n * @returns\r\n */\r\n onMoreClick?: () => void;\r\n}\r\n\r\
|
|
1
|
+
{"version":3,"sources":["D:\\codeing\\git\\github\\knockout-js\\packages\\layout\\src\\components\\msg-dropdown\\index.tsx"],"sourcesContent":["import { Badge, Dropdown, List } from 'antd';\r\nimport styles from './index.module.css';\r\nimport { useEffect, useState, forwardRef, useImperativeHandle, ForwardedRef, useCallback } from 'react';\r\nimport { BellOutlined } from '@ant-design/icons';\r\nimport { LayoutPkgUserMsgInternalToListQuery, LayoutPkgUserMsgInternalToListQueryVariables, LayoutPkgUserUnreadMsgInternalsQuery, LayoutPkgUserUnreadMsgInternalsQueryVariables, MsgInternalTo, MsgInternalToOrderField, OrderDirection } from '@knockout-js/api/msgcenter';\r\nimport { getDate } from '../_util';\r\nimport { useLocale } from '../locale';\r\nimport { gql, paging, query } from '@knockout-js/ice-urql/request';\r\nimport { instanceName } from '@knockout-js/api';\r\n\r\nexport interface MsgDropdownLocale {\r\n title: string;\r\n footer: string;\r\n}\r\n\r\nexport interface MsgDropdownProps {\r\n /**\r\n * 最多显示几条\r\n */\r\n maxLength?: number;\r\n /**\r\n * 选中一项\r\n * @param data\r\n * @returns\r\n */\r\n onItemClick?: (data: MsgInternalTo) => void;\r\n /**\r\n * 查看更多\r\n * @returns\r\n */\r\n onMoreClick?: () => void;\r\n}\r\n\r\nconst userMsgQuery = gql(/* GraphQL */`query layoutPkgUserMsgInternalToList($first: Int,$orderBy: MsgInternalToOrder,$where:MsgInternalToWhereInput){\r\n userMsgInternalTos(first:$first,orderBy: $orderBy,where: $where){\r\n totalCount,pageInfo{ hasNextPage,hasPreviousPage,startCursor,endCursor }\r\n edges{\r\n cursor,node{\r\n id,msgInternalID,createdAt,deleteAt,readAt,userID\r\n msgInternal{\r\n id,tenantID,createdBy,createdAt,subject,body,format,redirect,category\r\n }\r\n }\r\n }\r\n }\r\n}`)\r\n\r\nconst userUnreadQuery = gql(/* GraphQL */`query layoutPkgUserUnreadMsgInternals{\r\n userUnreadMsgInternals\r\n}`)\r\n\r\nexport type MsgDropdownRef = {\r\n setShowDot: () => void;\r\n}\r\n\r\nexport default forwardRef((props: MsgDropdownProps, ref: ForwardedRef<MsgDropdownRef>) => {\r\n const locale = useLocale('MsgDropdown'),\r\n [items, setItems] = useState<MsgInternalTo[]>([]),\r\n [open, setOpen] = useState(false),\r\n [showDot, setShowDot] = useState(false),\r\n [loading, setLoading] = useState(false),\r\n maxLength = props.maxLength ?? 5;\r\n\r\n const\r\n requestData = useCallback(async () => {\r\n setLoading(true);\r\n const result = await paging<LayoutPkgUserMsgInternalToListQuery, LayoutPkgUserMsgInternalToListQueryVariables>(\r\n userMsgQuery, {\r\n first: maxLength,\r\n where: {\r\n readAtIsNil: true,\r\n },\r\n orderBy: {\r\n direction: OrderDirection.Desc,\r\n field: MsgInternalToOrderField.CreatedAt\r\n },\r\n }, 1, {\r\n instanceName: instanceName.MSGCENTER,\r\n }), list: MsgInternalTo[] = [];\r\n if (result.data?.userMsgInternalTos) {\r\n result.data.userMsgInternalTos.edges?.forEach(item => {\r\n if (item?.node) {\r\n list.push(item.node as MsgInternalTo);\r\n }\r\n })\r\n }\r\n setShowDot(list.length > 0);\r\n setItems(list);\r\n setLoading(false);\r\n }, []);\r\n\r\n useImperativeHandle(ref, () => ({\r\n setShowDot: () => {\r\n setShowDot(true);\r\n }\r\n }))\r\n\r\n useEffect(() => {\r\n if (open) {\r\n requestData();\r\n }\r\n }, [open])\r\n\r\n useEffect(() => {\r\n query<LayoutPkgUserUnreadMsgInternalsQuery, LayoutPkgUserUnreadMsgInternalsQueryVariables>(userUnreadQuery, {}, {\r\n instanceName: instanceName.MSGCENTER,\r\n }).then(result => {\r\n setShowDot((result.data?.userUnreadMsgInternals ?? 0) > 0);\r\n });\r\n }, [])\r\n\r\n return <Dropdown\r\n trigger={['click']}\r\n open={open}\r\n onOpenChange={useCallback((v: boolean) => {\r\n setOpen(v);\r\n }, [])}\r\n placement=\"bottom\"\r\n dropdownRender={() => <>\r\n <List\r\n loading={loading}\r\n className={styles.list}\r\n header={<div>{locale.title}</div>}\r\n footer={props.onMoreClick ? <span\r\n className={styles.footer}\r\n onClick={() => {\r\n props.onMoreClick?.();\r\n }}\r\n >\r\n {locale.footer}\r\n </span> : undefined}\r\n bordered\r\n size=\"small\"\r\n dataSource={items}\r\n renderItem={(item) => <List.Item\r\n key={item.id}\r\n onClick={() => {\r\n props.onItemClick?.(item)\r\n }}\r\n >\r\n <List.Item.Meta title={item.msgInternal.subject} description={getDate(item.createdAt, 'YYYY-MM-DD HH:mm:ss')} />\r\n </List.Item>\r\n }\r\n />\r\n </>}\r\n >\r\n <span className={styles.action}>\r\n <Badge dot={showDot}>\r\n <BellOutlined rev={undefined} />\r\n </Badge>\r\n </span>\r\n </Dropdown>;\r\n});\r\n"],"names":["Badge","Dropdown","List","styles","useEffect","useState","forwardRef","useImperativeHandle","useCallback","BellOutlined","MsgInternalToOrderField","OrderDirection","getDate","useLocale","gql","paging","query","instanceName","userMsgQuery","userUnreadQuery","props","ref","locale","items","setItems","open","setOpen","showDot","setShowDot","loading","setLoading","maxLength","requestData","result","list","first","where","readAtIsNil","orderBy","direction","Desc","field","CreatedAt","MSGCENTER","data","userMsgInternalTos","edges","forEach","item","node","push","length","then","userUnreadMsgInternals","trigger","onOpenChange","v","placement","dropdownRender","className","header","div","title","footer","onMoreClick","span","onClick","undefined","bordered","size","dataSource","renderItem","Item","onItemClick","Meta","msgInternal","subject","description","createdAt","id","action","dot","rev"],"mappings":"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"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SwitchProps } from 'antd';
|
|
3
2
|
export interface ThemeSwitchLocale {
|
|
4
3
|
bright: string;
|
|
5
4
|
dark: string;
|
|
@@ -9,10 +8,6 @@ export interface ThemeSwitchProps {
|
|
|
9
8
|
* 值
|
|
10
9
|
*/
|
|
11
10
|
value: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* switch的设置
|
|
14
|
-
*/
|
|
15
|
-
switchProps?: SwitchProps;
|
|
16
11
|
/**
|
|
17
12
|
* 值变更事件 (value: boolean) => void;
|
|
18
13
|
*/
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import _object_spread from "@swc/helpers/src/_object_spread.mjs";
|
|
2
|
-
import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
|
|
3
1
|
import { jsx as _jsx } from "@ice/jsx-runtime/jsx-runtime";
|
|
4
2
|
import React from "react";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
3
|
+
import { Moon, Sun } from "../icons/index";
|
|
4
|
+
import styles from "./index.module.css";
|
|
7
5
|
var ThemeSwitch = function(props) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
return /*#__PURE__*/ _jsx("span", {
|
|
7
|
+
className: styles.action,
|
|
8
|
+
children: /*#__PURE__*/ _jsx("span", {
|
|
9
|
+
children: props.value ? /*#__PURE__*/ _jsx(Moon, {
|
|
10
|
+
onClick: function() {
|
|
11
|
+
props.onChange(false);
|
|
12
|
+
}
|
|
13
|
+
}) : /*#__PURE__*/ _jsx(Sun, {
|
|
14
|
+
onClick: function() {
|
|
15
|
+
props.onChange(true);
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
});
|
|
18
20
|
};
|
|
19
21
|
export default ThemeSwitch;
|
|
20
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["D:\\codeing\\git\\github\\knockout-js\\packages\\layout\\src\\components\\theme-switch\\index.tsx"],"sourcesContent":["import React from 'react';\r\nimport {
|
|
1
|
+
{"version":3,"sources":["D:\\codeing\\git\\github\\knockout-js\\packages\\layout\\src\\components\\theme-switch\\index.tsx"],"sourcesContent":["import React from 'react';\r\nimport { Moon, Sun } from '../icons';\r\nimport styles from './index.module.css';\r\n\r\nexport interface ThemeSwitchLocale {\r\n bright: string;\r\n dark: string;\r\n}\r\n\r\nexport interface ThemeSwitchProps {\r\n /**\r\n * 值\r\n */\r\n value: boolean;\r\n /**\r\n * 值变更事件 (value: boolean) => void;\r\n */\r\n onChange: (value: boolean) => void;\r\n}\r\n\r\nconst ThemeSwitch: React.FC<ThemeSwitchProps> = (props: ThemeSwitchProps) => {\r\n return <span className={styles.action}>\r\n <span>{\r\n props.value ? <Moon onClick={() => {\r\n props.onChange(false)\r\n\r\n }} /> : <Sun onClick={() => {\r\n props.onChange(true)\r\n\r\n }} />}\r\n </span>\r\n </span>\r\n};\r\n\r\nexport default ThemeSwitch;\r\n"],"names":["React","Moon","Sun","styles","ThemeSwitch","props","span","className","action","value","onClick","onChange"],"mappings":";AAAA,OAAOA,WAAW,QAAQ;AAC1B,SAASC,IAAI,EAAEC,GAAG,QAAQ,iBAAW;AACrC,OAAOC,YAAY,qBAAqB;AAkBxC,IAAMC,cAA0C,SAACC,OAA4B;IAC3E,qBAAO,KAACC;QAAKC,WAAWJ,OAAOK,MAAM;kBACnC,cAAA,KAACF;sBACCD,MAAMI,KAAK,iBAAG,KAACR;gBAAKS,SAAS,WAAM;oBACjCL,MAAMM,QAAQ,CAAC,KAAK;gBAEtB;+BAAQ,KAACT;gBAAIQ,SAAS,WAAM;oBAC1BL,MAAMM,QAAQ,CAAC,IAAI;gBAErB;cAAK;;;AAGX;AAEA,eAAeP,YAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knockout-js/layout",
|
|
3
|
-
"version": "0.1.1-beta.
|
|
3
|
+
"version": "0.1.1-beta.3",
|
|
4
4
|
"description": "组件功能描述",
|
|
5
5
|
"files": [
|
|
6
6
|
"esm",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"dayjs": "^1.11.9",
|
|
51
51
|
"react-activation": "^0.12.4",
|
|
52
52
|
"react-draggable": "^4.4.5",
|
|
53
|
-
"@knockout-js/api": "^0.1.1-beta.
|
|
54
|
-
"@knockout-js/ice-urql": "^0.1.1-beta.
|
|
53
|
+
"@knockout-js/api": "^0.1.1-beta.4",
|
|
54
|
+
"@knockout-js/ice-urql": "^0.1.1-beta.3"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@ice/pkg": "^1.5.0",
|
|
@@ -74,6 +74,6 @@
|
|
|
74
74
|
"license": "MIT",
|
|
75
75
|
"scripts": {
|
|
76
76
|
"start": "ice-pkg start",
|
|
77
|
-
"build": "ice-pkg build"
|
|
77
|
+
"build": "rimraf esm es2017 && ice-pkg build"
|
|
78
78
|
}
|
|
79
79
|
}
|