@king-design/react 3.0.1 → 3.1.0-beta.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/components/affix/index.d.ts +1 -0
- package/components/affix/index.js +2 -0
- package/components/affix/index.vdt.js +5 -5
- package/components/affix/styles.d.ts +1 -1
- package/components/affix/styles.js +1 -1
- package/components/badge/index.d.ts +1 -0
- package/components/badge/index.js +13 -1
- package/components/badge/index.vdt.js +5 -4
- package/components/badge/styles.d.ts +1 -1
- package/components/badge/styles.js +2 -2
- package/components/breadcrumb/index.d.ts +1 -0
- package/components/breadcrumb/index.js +13 -1
- package/components/breadcrumb/index.vdt.js +4 -5
- package/components/breadcrumb/item.d.ts +1 -0
- package/components/breadcrumb/item.js +2 -0
- package/components/breadcrumb/item.vdt.js +4 -5
- package/components/breadcrumb/styles.d.ts +1 -1
- package/components/breadcrumb/styles.js +2 -2
- package/components/button/group.d.ts +1 -0
- package/components/button/group.js +13 -1
- package/components/button/group.vdt.js +2 -6
- package/components/button/index.d.ts +1 -0
- package/components/button/index.js +2 -0
- package/components/button/index.vdt.js +7 -7
- package/components/button/styles.d.ts +2 -4
- package/components/button/styles.js +19 -20
- package/components/card/column.d.ts +1 -0
- package/components/card/column.js +13 -1
- package/components/card/column.vdt.js +2 -5
- package/components/card/index.d.ts +1 -0
- package/components/card/index.js +13 -1
- package/components/card/index.vdt.js +5 -11
- package/components/card/styles.d.ts +1 -1
- package/components/card/styles.js +2 -2
- package/components/carousel/index.d.ts +1 -0
- package/components/carousel/index.js +2 -0
- package/components/carousel/index.vdt.js +15 -19
- package/components/carousel/item.d.ts +1 -0
- package/components/carousel/item.js +13 -1
- package/components/carousel/item.vdt.js +2 -3
- package/components/carousel/styles.d.ts +2 -2
- package/components/carousel/styles.js +4 -4
- package/components/cascader/index.vdt.js +20 -29
- package/components/cascader/styles.d.ts +2 -2
- package/components/cascader/styles.js +3 -3
- package/components/checkbox/index.d.ts +1 -0
- package/components/checkbox/index.js +2 -0
- package/components/checkbox/index.vdt.js +4 -8
- package/components/checkbox/styles.d.ts +1 -1
- package/components/checkbox/styles.js +2 -2
- package/components/code/index.d.ts +1 -0
- package/components/code/index.js +2 -0
- package/components/code/index.vdt.js +2 -3
- package/components/code/styles.d.ts +1 -1
- package/components/code/styles.js +1 -1
- package/components/collapse/index.d.ts +1 -0
- package/components/collapse/index.js +13 -1
- package/components/collapse/index.vdt.js +2 -3
- package/components/collapse/item.d.ts +1 -0
- package/components/collapse/item.js +2 -0
- package/components/collapse/item.vdt.js +6 -8
- package/components/collapse/styles.d.ts +2 -3
- package/components/collapse/styles.js +5 -9
- package/components/colorpicker/drag.d.ts +1 -0
- package/components/colorpicker/drag.js +2 -0
- package/components/colorpicker/drag.vdt.js +3 -2
- package/components/colorpicker/index.d.ts +1 -0
- package/components/colorpicker/index.js +13 -1
- package/components/colorpicker/index.vdt.js +5 -6
- package/components/colorpicker/panel.d.ts +1 -0
- package/components/colorpicker/panel.js +2 -0
- package/components/colorpicker/panel.vdt.js +16 -19
- package/components/colorpicker/styles.d.ts +3 -3
- package/components/colorpicker/styles.js +8 -8
- package/components/config/index.d.ts +10 -0
- package/components/config/index.js +23 -0
- package/components/config/index.spec.d.ts +1 -0
- package/components/config/index.spec.js +71 -0
- package/components/context.d.ts +2 -1
- package/components/context.js +8 -2
- package/components/copy/index.d.ts +1 -0
- package/components/copy/index.js +2 -0
- package/components/copy/index.vdt.js +9 -9
- package/components/copy/styles.d.ts +1 -1
- package/components/copy/styles.js +1 -1
- package/components/datepicker/calendar.d.ts +1 -0
- package/components/datepicker/calendar.js +2 -0
- package/components/datepicker/calendar.vdt.js +38 -51
- package/components/datepicker/index.vdt.js +13 -16
- package/components/datepicker/styles.d.ts +3 -3
- package/components/datepicker/styles.js +6 -6
- package/components/datepicker/time.d.ts +1 -0
- package/components/datepicker/time.js +2 -0
- package/components/datepicker/time.vdt.js +2 -3
- package/components/diagram/diagram.d.ts +1 -0
- package/components/diagram/diagram.js +2 -0
- package/components/diagram/diagram.vdt.js +3 -4
- package/components/diagram/styles.d.ts +1 -1
- package/components/diagram/styles.js +1 -1
- package/components/dialog/alert.vdt.js +6 -10
- package/components/dialog/base.d.ts +4 -0
- package/components/dialog/base.js +2 -0
- package/components/dialog/base.vdt.js +15 -21
- package/components/dialog/index.d.ts +1 -1
- package/components/dialog/styles.d.ts +3 -3
- package/components/dialog/styles.js +12 -12
- package/components/drawer/index.vdt.js +3 -4
- package/components/drawer/styles.d.ts +1 -1
- package/components/drawer/styles.js +3 -3
- package/components/dropdown/dropdown.d.ts +1 -0
- package/components/dropdown/dropdown.js +4 -3
- package/components/dropdown/item.d.ts +1 -0
- package/components/dropdown/item.js +2 -0
- package/components/dropdown/item.vdt.js +2 -4
- package/components/dropdown/menu.d.ts +1 -0
- package/components/dropdown/menu.js +2 -0
- package/components/dropdown/menu.vdt.js +2 -3
- package/components/dropdown/styles.d.ts +2 -2
- package/components/dropdown/styles.js +4 -4
- package/components/editable/index.d.ts +1 -0
- package/components/editable/index.js +2 -0
- package/components/editable/index.vdt.js +3 -7
- package/components/editable/styles.d.ts +1 -1
- package/components/editable/styles.js +2 -2
- package/components/form/form.d.ts +1 -0
- package/components/form/form.js +2 -0
- package/components/form/form.vdt.js +2 -3
- package/components/form/item.d.ts +1 -0
- package/components/form/item.js +2 -0
- package/components/form/item.vdt.js +13 -19
- package/components/form/styles.d.ts +2 -2
- package/components/form/styles.js +5 -5
- package/components/form/useError.d.ts +1 -0
- package/components/grid/col.d.ts +1 -0
- package/components/grid/col.js +2 -0
- package/components/grid/col.vdt.js +3 -6
- package/components/grid/row.d.ts +1 -0
- package/components/grid/row.js +2 -0
- package/components/grid/row.vdt.js +2 -3
- package/components/grid/styles.d.ts +2 -2
- package/components/grid/styles.js +8 -18
- package/components/grid/useBreakpoints.d.ts +1 -1
- package/components/grid/useBreakpoints.js +2 -2
- package/components/grid/useGutter.d.ts +1 -0
- package/components/icon/index.d.ts +1 -0
- package/components/icon/index.js +2 -0
- package/components/icon/index.vdt.js +7 -11
- package/components/icon/styles.d.ts +1 -2
- package/components/icon/styles.js +7 -5
- package/components/input/index.d.ts +1 -0
- package/components/input/index.js +2 -0
- package/components/input/index.vdt.js +16 -26
- package/components/input/search.d.ts +1 -0
- package/components/input/search.js +2 -0
- package/components/input/search.vdt.js +5 -7
- package/components/input/styles.d.ts +2 -2
- package/components/input/styles.js +11 -11
- package/components/layout/aside.d.ts +1 -0
- package/components/layout/aside.js +2 -0
- package/components/layout/aside.vdt.js +5 -8
- package/components/layout/body.d.ts +1 -0
- package/components/layout/body.js +4 -3
- package/components/layout/footer.d.ts +1 -0
- package/components/layout/footer.js +15 -4
- package/components/layout/header.d.ts +1 -0
- package/components/layout/header.js +4 -6
- package/components/layout/layout.d.ts +1 -0
- package/components/layout/layout.js +4 -3
- package/components/layout/styles.d.ts +3 -3
- package/components/layout/styles.js +8 -8
- package/components/layout/template.vdt.js +2 -1
- package/components/menu/item.d.ts +1 -0
- package/components/menu/item.js +2 -0
- package/components/menu/item.vdt.js +7 -12
- package/components/menu/menu.d.ts +1 -0
- package/components/menu/menu.js +2 -0
- package/components/menu/menu.vdt.js +3 -6
- package/components/menu/styles.d.ts +3 -3
- package/components/menu/styles.js +10 -10
- package/components/message/message.d.ts +1 -0
- package/components/message/message.js +2 -0
- package/components/message/message.vdt.js +12 -17
- package/components/message/messages.d.ts +1 -0
- package/components/message/messages.js +2 -0
- package/components/message/messages.vdt.js +2 -3
- package/components/message/styles.d.ts +2 -2
- package/components/message/styles.js +4 -4
- package/components/pagination/index.d.ts +1 -0
- package/components/pagination/index.js +2 -0
- package/components/pagination/index.vdt.js +14 -17
- package/components/pagination/styles.d.ts +1 -1
- package/components/pagination/styles.js +4 -4
- package/components/popover/content.vdt.js +5 -4
- package/components/popover/styles.d.ts +1 -1
- package/components/popover/styles.js +2 -2
- package/components/portal.d.ts +1 -0
- package/components/portal.js +3 -1
- package/components/progress/index.d.ts +1 -0
- package/components/progress/index.js +2 -0
- package/components/progress/index.vdt.js +14 -17
- package/components/progress/styles.d.ts +1 -1
- package/components/progress/styles.js +6 -6
- package/components/radio/index.d.ts +1 -0
- package/components/radio/index.js +2 -0
- package/components/radio/index.vdt.js +4 -7
- package/components/radio/styles.d.ts +1 -1
- package/components/radio/styles.js +2 -2
- package/components/rate/index.d.ts +1 -0
- package/components/rate/index.js +2 -0
- package/components/rate/index.vdt.js +4 -8
- package/components/rate/styles.d.ts +1 -1
- package/components/rate/styles.js +2 -2
- package/components/scrollSelect/index.d.ts +1 -0
- package/components/scrollSelect/index.js +2 -0
- package/components/scrollSelect/index.vdt.js +7 -12
- package/components/scrollSelect/styles.d.ts +1 -1
- package/components/scrollSelect/styles.js +2 -2
- package/components/select/base.d.ts +4 -0
- package/components/select/base.js +2 -0
- package/components/select/base.vdt.js +17 -21
- package/components/select/group.d.ts +1 -0
- package/components/select/group.js +2 -0
- package/components/select/group.vdt.js +3 -4
- package/components/select/menu.d.ts +1 -0
- package/components/select/menu.js +2 -0
- package/components/select/menu.vdt.js +9 -13
- package/components/select/option.d.ts +1 -0
- package/components/select/option.js +2 -0
- package/components/select/option.vdt.js +6 -8
- package/components/select/styles.d.ts +3 -3
- package/components/select/styles.js +8 -8
- package/components/select/useSearchable.d.ts +1 -0
- package/components/skeleton/item.d.ts +1 -0
- package/components/skeleton/item.js +13 -1
- package/components/skeleton/item.vdt.js +4 -7
- package/components/skeleton/skeleton.d.ts +1 -0
- package/components/skeleton/skeleton.js +13 -1
- package/components/skeleton/skeleton.vdt.js +4 -6
- package/components/skeleton/styles.d.ts +6 -0
- package/components/skeleton/styles.js +35 -0
- package/components/slider/index.d.ts +1 -0
- package/components/slider/index.js +2 -0
- package/components/slider/index.vdt.js +18 -22
- package/components/slider/styles.d.ts +1 -1
- package/components/slider/styles.js +2 -2
- package/components/spin/index.d.ts +1 -0
- package/components/spin/index.js +13 -1
- package/components/spin/index.vdt.js +6 -7
- package/components/spin/styles.d.ts +1 -1
- package/components/spin/styles.js +4 -4
- package/components/spinner/index.d.ts +1 -0
- package/components/spinner/index.js +2 -0
- package/components/spinner/index.vdt.js +15 -21
- package/components/spinner/styles.d.ts +1 -1
- package/components/spinner/styles.js +7 -7
- package/components/split/index.d.ts +2 -1
- package/components/split/index.js +2 -0
- package/components/split/index.vdt.js +7 -9
- package/components/split/styles.d.ts +4 -0
- package/components/split/styles.js +55 -0
- package/components/steps/context.d.ts +1 -0
- package/components/steps/index.d.ts +1 -0
- package/components/steps/index.js +13 -1
- package/components/steps/index.vdt.js +2 -3
- package/components/steps/step.d.ts +1 -0
- package/components/steps/step.js +13 -1
- package/components/steps/step.vdt.js +10 -16
- package/components/steps/styles.d.ts +3 -3
- package/components/steps/styles.js +18 -18
- package/components/switch/index.d.ts +1 -0
- package/components/switch/index.js +2 -0
- package/components/switch/index.vdt.js +6 -7
- package/components/switch/styles.d.ts +1 -1
- package/components/switch/styles.js +4 -4
- package/components/table/cell.d.ts +1 -0
- package/components/table/cell.js +13 -1
- package/components/table/cell.vdt.js +6 -6
- package/components/table/column.d.ts +1 -0
- package/components/table/column.js +2 -0
- package/components/table/column.vdt.js +24 -32
- package/components/table/row.d.ts +1 -0
- package/components/table/row.js +13 -1
- package/components/table/row.vdt.js +3 -10
- package/components/table/styles.d.ts +2 -2
- package/components/table/styles.js +6 -6
- package/components/table/table.d.ts +1 -0
- package/components/table/table.js +2 -0
- package/components/table/table.vdt.js +16 -20
- package/components/table/useColumns.d.ts +1 -0
- package/components/table/useFixedColumns.d.ts +2 -1
- package/components/table/useGroup.d.ts +1 -0
- package/components/table/useResizable.d.ts +1 -0
- package/components/table/useSortable.d.ts +1 -0
- package/components/tabs/index.d.ts +4 -0
- package/components/tabs/index.js +2 -0
- package/components/tabs/index.vdt.js +9 -10
- package/components/tabs/styles.d.ts +1 -1
- package/components/tabs/styles.js +15 -15
- package/components/tabs/tab.d.ts +1 -0
- package/components/tabs/tab.js +2 -0
- package/components/tabs/tab.vdt.js +3 -5
- package/components/tabs/useActiveBar.js +2 -1
- package/components/tabs/useScroll.js +2 -1
- package/components/tag/base.d.ts +1 -0
- package/components/tag/base.js +13 -1
- package/components/tag/index.vdt.js +4 -5
- package/components/tag/styles.d.ts +2 -2
- package/components/tag/styles.js +7 -7
- package/components/tag/tags.d.ts +1 -0
- package/components/tag/tags.js +2 -0
- package/components/tag/tags.vdt.js +5 -11
- package/components/timeline/item.d.ts +1 -0
- package/components/timeline/item.js +13 -1
- package/components/timeline/item.vdt.js +4 -5
- package/components/timeline/styles.d.ts +2 -2
- package/components/timeline/styles.js +6 -6
- package/components/timeline/timeline.d.ts +1 -0
- package/components/timeline/timeline.js +13 -1
- package/components/timeline/timeline.vdt.js +2 -3
- package/components/timepicker/index.d.ts +2 -1
- package/components/timepicker/panelPicker.vdt.js +13 -17
- package/components/timepicker/selectPicker.d.ts +1 -0
- package/components/timepicker/selectPicker.js +2 -0
- package/components/timepicker/selectPicker.vdt.js +4 -4
- package/components/timepicker/styles.d.ts +1 -1
- package/components/timepicker/styles.js +2 -2
- package/components/tip/index.vdt.js +5 -6
- package/components/tip/styles.d.ts +1 -1
- package/components/tip/styles.js +2 -2
- package/components/tooltip/content.vdt.js +4 -9
- package/components/tooltip/styles.d.ts +1 -1
- package/components/tooltip/styles.js +6 -6
- package/components/transfer/index.d.ts +1 -0
- package/components/transfer/index.js +2 -0
- package/components/transfer/index.vdt.js +20 -25
- package/components/transfer/styles.d.ts +1 -1
- package/components/transfer/styles.js +2 -2
- package/components/tree/index.d.ts +1 -0
- package/components/tree/index.js +2 -0
- package/components/tree/index.vdt.js +19 -30
- package/components/tree/styles.d.ts +1 -1
- package/components/tree/styles.js +2 -2
- package/components/treeSelect/index.vdt.js +2 -3
- package/components/treeSelect/styles.d.ts +1 -1
- package/components/treeSelect/styles.js +1 -1
- package/components/upload/index.d.ts +1 -0
- package/components/upload/index.js +2 -0
- package/components/upload/index.vdt.js +39 -50
- package/components/upload/styles.d.ts +2 -2
- package/components/upload/styles.js +3 -3
- package/components/utils.d.ts +2 -1
- package/components/utils.js +20 -9
- package/components/wave/index.d.ts +1 -0
- package/components/wave/index.js +4 -2
- package/components/wave/styles.d.ts +1 -1
- package/components/wave/styles.js +2 -2
- package/index.d.ts +3 -2
- package/index.js +3 -2
- package/package.json +1 -1
- package/styles/fonts/iconfont.d.ts +1 -1
- package/styles/fonts/iconfont.js +4 -1
- package/styles/global.js +4 -4
- package/styles/theme.d.ts +1 -1
- package/styles/theme.js +4 -53
- package/components/skeleton/style.d.ts +0 -6
- package/components/skeleton/style.js +0 -35
- package/components/split/style.d.ts +0 -4
- package/components/split/style.js +0 -55
|
@@ -3,6 +3,7 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/con
|
|
|
3
3
|
import { Component } from 'intact-react';
|
|
4
4
|
import template from './drag.vdt';
|
|
5
5
|
import { useDrag } from './useDrag';
|
|
6
|
+
import { useConfigContext } from '../config';
|
|
6
7
|
export var ColorpickerDrag = /*#__PURE__*/function (_Component) {
|
|
7
8
|
_inheritsLoose(ColorpickerDrag, _Component);
|
|
8
9
|
|
|
@@ -17,6 +18,7 @@ export var ColorpickerDrag = /*#__PURE__*/function (_Component) {
|
|
|
17
18
|
|
|
18
19
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
19
20
|
_this.drag = useDrag();
|
|
21
|
+
_this.config = useConfigContext();
|
|
20
22
|
return _this;
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { createElementVNode as _$ce } from 'intact-react';
|
|
1
|
+
import { createElementVNode as _$ce, className as _$cn } from 'intact-react';
|
|
2
2
|
export default function ($props, $blocks, $__proto__) {
|
|
3
3
|
$blocks || ($blocks = {});
|
|
4
4
|
$props || ($props = {});
|
|
5
5
|
var $this = this;
|
|
6
|
-
|
|
6
|
+
var k = this.config.k;
|
|
7
|
+
return _$ce(2, 'div', this.get('children'), 0, _$cn(k + "-colorpicker-drag " + k + "-colorpicker-text"), {
|
|
7
8
|
'ev-mousedown': this.drag.start
|
|
8
9
|
});
|
|
9
10
|
}
|
|
@@ -17,4 +17,5 @@ export declare class Colorpicker extends Component<ColorpickerProps, Colorpicker
|
|
|
17
17
|
static template: string | import("intact").Template<any>;
|
|
18
18
|
static typeDefs: Required<TypeDefs<ColorpickerProps>>;
|
|
19
19
|
static defaults: () => Partial<ColorpickerProps>;
|
|
20
|
+
private config;
|
|
20
21
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
2
3
|
import { Component } from 'intact-react';
|
|
3
4
|
import template from './index.vdt';
|
|
4
5
|
import { sizes } from '../../styles/utils';
|
|
5
6
|
import { Dropdown } from '../dropdown';
|
|
7
|
+
import { useConfigContext } from '../config';
|
|
6
8
|
var typeDefs = {
|
|
7
9
|
value: {
|
|
8
10
|
type: String,
|
|
@@ -30,7 +32,17 @@ export var Colorpicker = /*#__PURE__*/function (_Component) {
|
|
|
30
32
|
_inheritsLoose(Colorpicker, _Component);
|
|
31
33
|
|
|
32
34
|
function Colorpicker() {
|
|
33
|
-
|
|
35
|
+
var _context;
|
|
36
|
+
|
|
37
|
+
var _this;
|
|
38
|
+
|
|
39
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
40
|
+
args[_key] = arguments[_key];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
44
|
+
_this.config = useConfigContext();
|
|
45
|
+
return _this;
|
|
34
46
|
}
|
|
35
47
|
|
|
36
48
|
return Colorpicker;
|
|
@@ -22,9 +22,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
22
22
|
container = _this$get.container,
|
|
23
23
|
position = _this$get.position;
|
|
24
24
|
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
}, _classNameObj[className] = className, _classNameObj["k-" + size] = size !== 'default', _classNameObj['k-disabled'] = disabled, _classNameObj[makeStyles()] = true, _classNameObj);
|
|
25
|
+
var k = this.config.k;
|
|
26
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-colorpicker"] = true, _classNameObj[className] = className, _classNameObj[k + "-" + size] = size !== 'default', _classNameObj[k + "-disabled"] = disabled, _classNameObj[makeStyles(k)] = true, _classNameObj);
|
|
28
27
|
return _$cv('div', _extends({
|
|
29
28
|
'className': _$cn(classNameObj)
|
|
30
29
|
}, getRestProps(this)), _$cc(Dropdown, {
|
|
@@ -32,12 +31,12 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
32
31
|
'trigger': 'click',
|
|
33
32
|
'disabled': disabled,
|
|
34
33
|
'container': container,
|
|
35
|
-
'children': [_$ce(2, 'div', _$ce(2, 'div', null, 1,
|
|
34
|
+
'children': [_$ce(2, 'div', _$ce(2, 'div', null, 1, _$cn(k + "-colorpicker-inner"), {
|
|
36
35
|
'style': {
|
|
37
36
|
backgroundColor: value
|
|
38
37
|
}
|
|
39
|
-
}), 2,
|
|
40
|
-
'className':
|
|
38
|
+
}), 2, _$cn(k + "-colorpicker-color")), _$cc(DropdownMenu, {
|
|
39
|
+
'className': _$cn(k + "-colorpicker-content"),
|
|
41
40
|
'children': _$cc(ColorpickerPanel, {
|
|
42
41
|
'presets': presets,
|
|
43
42
|
'ev-$model:value': function ev$modelValue($v) {
|
|
@@ -5,6 +5,7 @@ import template from './panel.vdt';
|
|
|
5
5
|
import { useValue } from './useValue';
|
|
6
6
|
import { usePointer } from './usePointer';
|
|
7
7
|
import { useInput } from './useInput';
|
|
8
|
+
import { useConfigContext } from '../config';
|
|
8
9
|
export var ColorpickerPanel = /*#__PURE__*/function (_Component) {
|
|
9
10
|
_inheritsLoose(ColorpickerPanel, _Component);
|
|
10
11
|
|
|
@@ -21,6 +22,7 @@ export var ColorpickerPanel = /*#__PURE__*/function (_Component) {
|
|
|
21
22
|
_this.value = useValue();
|
|
22
23
|
_this.pointer = usePointer(_this.value.hsv, _this.value.format);
|
|
23
24
|
_this.input = useInput(_this.value.hsv, _this.value.rgb, _this.value.hsl);
|
|
25
|
+
_this.config = useConfigContext();
|
|
24
26
|
return _this;
|
|
25
27
|
}
|
|
26
28
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
2
|
-
import { createElementVNode as _$ce,
|
|
2
|
+
import { createElementVNode as _$ce, className as _$cn, createUnknownComponentVNode as _$cc, createTextVNode as _$ct, map as _$ma } from 'intact-react';
|
|
3
3
|
import { Row, Col } from '../grid';
|
|
4
4
|
import { Slider } from '../slider';
|
|
5
5
|
import { Input } from '../input';
|
|
@@ -20,9 +20,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
20
20
|
value = _this$get.value,
|
|
21
21
|
presets = _this$get.presets;
|
|
22
22
|
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
}, _classNameObj[makePanelStyles()] = true, _classNameObj);
|
|
23
|
+
var k = this.config.k;
|
|
24
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-colorpicker-panel"] = true, _classNameObj[makePanelStyles(k)] = true, _classNameObj);
|
|
26
25
|
var _this$value = this.value,
|
|
27
26
|
hex = _this$value.hex.value,
|
|
28
27
|
hsv = _this$value.hsv.value,
|
|
@@ -44,18 +43,18 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
44
43
|
dragging = _this$input.dragging,
|
|
45
44
|
setInputValue = _this$input.setInputValue;
|
|
46
45
|
var alpha = Math.round(rgb.a * 100);
|
|
47
|
-
return _$ce(2, 'div', [_$ce(2, 'div', [_$ce(2, 'div', null, 1,
|
|
46
|
+
return _$ce(2, 'div', [_$ce(2, 'div', [_$ce(2, 'div', null, 1, _$cn(k + "-colorpicker-white")), _$ce(2, 'div', null, 1, _$cn(k + "-colorpicker-black")), _$ce(2, 'div', _$ce(2, 'div', null, 1, _$cn(k + "-colorpicker-circle")), 2, _$cn(k + "-colorpicker-pointer"), {
|
|
48
47
|
'style': {
|
|
49
48
|
left: hsv.s * 100 + "%",
|
|
50
49
|
top: -hsv.v * 100 + 100 + "%"
|
|
51
50
|
}
|
|
52
|
-
})], 4,
|
|
51
|
+
})], 4, _$cn(k + "-colorpicker-saturation"), {
|
|
53
52
|
'style': {
|
|
54
53
|
backgroundColor: "hsl(" + hsv.h + ", 100%, 50%)"
|
|
55
54
|
},
|
|
56
55
|
'ev-mousedown': start
|
|
57
56
|
}, null, areaRef), _$ce(2, 'div', [_$ce(2, 'div', [_$cc(Slider, {
|
|
58
|
-
'className':
|
|
57
|
+
'className': _$cn(k + "-colorpicker-hue"),
|
|
59
58
|
'showInput': false,
|
|
60
59
|
'showEnd': false,
|
|
61
60
|
'step': 0,
|
|
@@ -64,9 +63,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
64
63
|
'ev-$change:value': changeHue,
|
|
65
64
|
'animate': !dragging.value
|
|
66
65
|
}), _$cc(Slider, {
|
|
67
|
-
'className': _$cn((_$cn2 = {
|
|
68
|
-
"k-colorpicker-alpha k-colorpicker-alpha-bg": true
|
|
69
|
-
}, _$cn2[makeAlphaBgColor(rgb)] = true, _$cn2)),
|
|
66
|
+
'className': _$cn((_$cn2 = {}, _$cn2[k + "-colorpicker-alpha " + k + "-colorpicker-alpha-bg"] = true, _$cn2[makeAlphaBgColor(rgb, k)] = true, _$cn2)),
|
|
70
67
|
'showInput': false,
|
|
71
68
|
'showEnd': false,
|
|
72
69
|
'step': 0,
|
|
@@ -74,11 +71,11 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
74
71
|
'value': rgb.a,
|
|
75
72
|
'ev-$change:value': changeAlpha,
|
|
76
73
|
'animate': !dragging.value
|
|
77
|
-
})], 4,
|
|
74
|
+
})], 4, _$cn(k + "-colorpicker-sliders")), _$ce(2, 'div', _$ce(2, 'div', null, 1, _$cn(k + "-colorpicker-color"), {
|
|
78
75
|
'style': {
|
|
79
76
|
backgroundColor: value
|
|
80
77
|
}
|
|
81
|
-
}), 2,
|
|
78
|
+
}), 2, _$cn(k + "-colorpicker-color-wrapper " + k + "-colorpicker-alpha-bg"))], 4, _$cn(k + "-colorpicker-controls")), _$cc(Row, {
|
|
82
79
|
'gutter': '6',
|
|
83
80
|
'children': [_$cc(Col, {
|
|
84
81
|
'span': '8',
|
|
@@ -86,10 +83,10 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
86
83
|
'fluid': true,
|
|
87
84
|
'size': 'small',
|
|
88
85
|
'frozenOnInput': true,
|
|
89
|
-
'className':
|
|
86
|
+
'className': _$cn(k + "-colorpicker-input"),
|
|
90
87
|
'value': hex,
|
|
91
88
|
'ev-input': onInputHex
|
|
92
|
-
}), _$ce(2, 'div', 'Hex', 16,
|
|
89
|
+
}), _$ce(2, 'div', 'Hex', 16, _$cn(k + "-colorpicker-text"))]
|
|
93
90
|
}), function () {
|
|
94
91
|
var params;
|
|
95
92
|
var color;
|
|
@@ -121,7 +118,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
121
118
|
'fluid': true,
|
|
122
119
|
'size': 'small',
|
|
123
120
|
'value': v,
|
|
124
|
-
'className':
|
|
121
|
+
'className': _$cn(k + "-colorpicker-input"),
|
|
125
122
|
'ev-input': setInputValue.bind(null, value, realMax)
|
|
126
123
|
}), _$cc(Drag, {
|
|
127
124
|
'value': v,
|
|
@@ -140,7 +137,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
140
137
|
'fluid': true,
|
|
141
138
|
'size': 'small',
|
|
142
139
|
'value': alpha,
|
|
143
|
-
'className':
|
|
140
|
+
'className': _$cn(k + "-colorpicker-input"),
|
|
144
141
|
'ev-input': setInputValue.bind(null, 'a', 100)
|
|
145
142
|
}), _$cc(Drag, {
|
|
146
143
|
'value': alpha,
|
|
@@ -152,13 +149,13 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
152
149
|
})]
|
|
153
150
|
})]
|
|
154
151
|
}), presets && presets.length ? _$ce(2, 'div', _$ma(presets, function ($value, $key) {
|
|
155
|
-
return _$ce(2, 'div', _$ce(2, 'div', null, 1,
|
|
152
|
+
return _$ce(2, 'div', _$ce(2, 'div', null, 1, _$cn(k + "-colorpicker-preset-color"), {
|
|
156
153
|
'style': {
|
|
157
154
|
backgroundColor: $value
|
|
158
155
|
}
|
|
159
|
-
}), 2,
|
|
156
|
+
}), 2, _$cn(k + "-colorpicker-preset-color-wrapper " + k + "-colorpicker-alpha-bg"), {
|
|
160
157
|
'ev-click': linkEvent($value, setValue)
|
|
161
158
|
});
|
|
162
|
-
}, $this), 4,
|
|
159
|
+
}, $this), 4, _$cn(k + "-colorpicker-presets")) : undefined], 0, _$cn(classNameObj));
|
|
163
160
|
}
|
|
164
161
|
;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../../styles/global';
|
|
2
2
|
import { ColorFormats } from 'tinycolor2';
|
|
3
|
-
export declare function makeStyles(): string;
|
|
4
|
-
export declare function makePanelStyles(): string;
|
|
5
|
-
export declare function makeAlphaBgColor({ r, g, b }: ColorFormats.RGBA): string;
|
|
3
|
+
export declare function makeStyles(k: string): string;
|
|
4
|
+
export declare function makePanelStyles(k: string): string;
|
|
5
|
+
export declare function makeAlphaBgColor({ r, g, b }: ColorFormats.RGBA, k: string): string;
|
|
@@ -116,18 +116,18 @@ setDefault(function () {
|
|
|
116
116
|
}).colorpicker;
|
|
117
117
|
});
|
|
118
118
|
var _sizes = ['large', 'small', 'mini'];
|
|
119
|
-
export function makeStyles() {
|
|
120
|
-
return /*#__PURE__*/css("display:inline-block;vertical-align:middle;.k-colorpicker-color{height:", colorpicker.height, ";width:", colorpicker.width, ";border:", colorpicker.border, ";cursor:", colorpicker.cursor, ";border-radius:", colorpicker.borderRadius, ";background:", colorpicker.bgColor, ";padding:", colorpicker.padding, ";}.k-colorpicker-inner{border-radius:", colorpicker.innerBorderRadius, ";height:100%;}", _mapInstanceProperty(_sizes).call(_sizes, function (size) {
|
|
119
|
+
export function makeStyles(k) {
|
|
120
|
+
return /*#__PURE__*/css("display:inline-block;vertical-align:middle;.", k, "-colorpicker-color{height:", colorpicker.height, ";width:", colorpicker.width, ";border:", colorpicker.border, ";cursor:", colorpicker.cursor, ";border-radius:", colorpicker.borderRadius, ";background:", colorpicker.bgColor, ";padding:", colorpicker.padding, ";}.", k, "-colorpicker-inner{border-radius:", colorpicker.innerBorderRadius, ";height:100%;}", _mapInstanceProperty(_sizes).call(_sizes, function (size) {
|
|
121
121
|
var styles = colorpicker[size];
|
|
122
|
-
return /*#__PURE__*/css("&.k-", size, "{.k-colorpicker-color{height:", styles.height, ";width:", styles.width, ";", styles.padding && "padding: " + styles.padding, ";}}");
|
|
123
|
-
}), "&.k-disabled{.k-colorpicker-color{background:", colorpicker.disabled.bgColor, ";border-color:", colorpicker.disabled.borderColor, ";cursor:", colorpicker.disabled.cursor, ";}}");
|
|
122
|
+
return /*#__PURE__*/css("&.", k, "-", size, "{.", k, "-colorpicker-color{height:", styles.height, ";width:", styles.width, ";", styles.padding && "padding: " + styles.padding, ";}}");
|
|
123
|
+
}), "&.", k, "-disabled{.", k, "-colorpicker-color{background:", colorpicker.disabled.bgColor, ";border-color:", colorpicker.disabled.borderColor, ";cursor:", colorpicker.disabled.cursor, ";}}");
|
|
124
124
|
}
|
|
125
|
-
export function makePanelStyles() {
|
|
126
|
-
return /*#__PURE__*/css("padding:", colorpicker.panel.padding, ";width:", colorpicker.panel.width, ";.k-colorpicker-saturation{height:", colorpicker.panel.saturationHeight, ";position:relative;overflow:hidden;user-select:none;}.k-colorpicker-white,.k-colorpicker-black{position:absolute;width:100%;height:100%;}.k-colorpicker-white{background:linear-gradient(90deg, #fff, rgba(255, 255, 255, 0));}.k-colorpicker-black{background:linear-gradient(0, #000, rgba(0, 0, 0, 0));}.k-colorpicker-pointer{position:absolute;}.k-colorpicker-circle{width:", colorpicker.panel.circle.width, ";height:", colorpicker.panel.circle.width, ";box-shadow:", colorpicker.panel.circle.boxShadow, ";border-radius:50%;transform:translate(-50%, -50%);}.k-colorpicker-controls{display:flex;margin-top:", colorpicker.panel.gutter, ";}.k-colorpicker-sliders{flex:1;.k-slider{margin-bottom:", colorpicker.panel.gutter, ";}.k-slider-
|
|
125
|
+
export function makePanelStyles(k) {
|
|
126
|
+
return /*#__PURE__*/css("padding:", colorpicker.panel.padding, ";width:", colorpicker.panel.width, ";.", k, "-colorpicker-saturation{height:", colorpicker.panel.saturationHeight, ";position:relative;overflow:hidden;user-select:none;}.", k, "-colorpicker-white,.", k, "-colorpicker-black{position:absolute;width:100%;height:100%;}.", k, "-colorpicker-white{background:linear-gradient(90deg, #fff, rgba(255, 255, 255, 0));}.", k, "-colorpicker-black{background:linear-gradient(0, #000, rgba(0, 0, 0, 0));}.", k, "-colorpicker-pointer{position:absolute;}.", k, "-colorpicker-circle{width:", colorpicker.panel.circle.width, ";height:", colorpicker.panel.circle.width, ";box-shadow:", colorpicker.panel.circle.boxShadow, ";border-radius:50%;transform:translate(-50%, -50%);}.", k, "-colorpicker-controls{display:flex;margin-top:", colorpicker.panel.gutter, ";}.", k, "-colorpicker-sliders{flex:1;.", k, "-slider{margin-bottom:", colorpicker.panel.gutter, ";}.", k, "-slider-tra.", k, "-wrapper,.", k, "-slider-track{height:", colorpicker.slider.height, ";}.", k, "-slider-tra.", k, "-wrapper{cursor:", colorpicker.slider.cursor, ";}.", k, "-slider-track{border-radius:", colorpicker.slider.borderRadius, ";margin:0 calc(", colorpicker.slider.thumb.width, " / 2 + 1px);background-color:transparent;}.", k, "-slider-bar{background:transparent;}.", k, "-slider-thumb{height:", colorpicker.slider.thumb.height, ";width:", colorpicker.slider.thumb.width, ";border:", colorpicker.slider.thumb.border, ";border-radius:", colorpicker.slider.thumb.borderRadius, ";box-shadow:", colorpicker.slider.thumb.boxShadow, ";&:focus,&:hover{transform:", colorpicker.slider.thumb.hover.transform, ";cursor:", colorpicker.slider.thumb.hover.cursor, ";background-color:", colorpicker.slider.thumb.hover.bgColor, ";}}}.", k, "-colorpicker-hue{.", k, "-slider-tra.", k, "-wrapper{background:linear-gradient(90deg, red 0, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, red);}}.", k, "-colorpicker-alpha{background-size:contain;}.", k, "-colorpicker-alpha-bg{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMElEQVQ4T2N89uzZfwY8QFJSEp80A+OoAcMiDP7//483HTx//hx/Ohg1gIFx6IcBALl+VXknOCvFAAAAAElFTkSuQmCC\");}.", k, "-colorpicker-color-wrapper{width:", colorpicker.color.width, ";height:", colorpicker.color.height, ";border-radius:", colorpicker.color.borderRadius, ";margin-left:", colorpicker.panel.gutter, ";overflow:hidden;}.", k, "-colorpicker-color{height:100%;box-shadow:", colorpicker.color.boxShadow, ";}.", k, "-colorpicker-input.", k, "-small{.", k, "-input-inner{height:", colorpicker.input.height, ";line-height:", colorpicker.input.height, ";padding:", colorpicker.input.padding, ";font-size:", colorpicker.panel.fontSize, ";}}.", k, "-colorpicker-text{text-align:center;font-size:", colorpicker.panel.fontSize, ";padding:", colorpicker.input.textPadding, ";}.", k, "-colorpicker-presets{border-top:", colorpicker.presets.delimiter, ";margin:0 -", colorpicker.panel.padding, ";overflow:hidden;}.", k, "-colorpicker-preset-color-wrapper{float:left;border-radius:", colorpicker.presets.borderRadius, ";cursor:pointer;overflow:hidden;margin:", colorpicker.panel.padding, " 0 0 ", colorpicker.panel.padding, ";}.", k, "-colorpicker-preset-color{width:", colorpicker.presets.width, ";height:", colorpicker.presets.height, ";box-shadow:", colorpicker.presets.boxShadow, ";}.", k, "-colorpicker-drag{cursor:ew-resize;user-select:none;}");
|
|
127
127
|
}
|
|
128
|
-
export function makeAlphaBgColor(_ref) {
|
|
128
|
+
export function makeAlphaBgColor(_ref, k) {
|
|
129
129
|
var r = _ref.r,
|
|
130
130
|
g = _ref.g,
|
|
131
131
|
b = _ref.b;
|
|
132
|
-
return /*#__PURE__*/css(".k-slider-
|
|
132
|
+
return /*#__PURE__*/css(".", k, "-slider-tra.", k, "-wrapper{background:linear-gradient(to right, rgba(", r, ", ", g, ", ", b, ", 0) 0%, rgb(", r, ", ", g, ", ", b, ") 100%);}");
|
|
133
133
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ProviderProps } from '../context';
|
|
2
|
+
export interface ConfigProps {
|
|
3
|
+
classNamePrefix?: string;
|
|
4
|
+
}
|
|
5
|
+
declare const ConfigProvider: import('intact-react').ComponentConstructor<import("intact").Component<ProviderProps<ConfigProps>, {}, {}, {}>>, ConfigConsumer: import("intact").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<ConfigProps>, {}, {}, {}>>;
|
|
6
|
+
declare function useConfigContext(): {
|
|
7
|
+
cls: (name: string) => string;
|
|
8
|
+
readonly k: string;
|
|
9
|
+
};
|
|
10
|
+
export { ConfigProvider, ConfigConsumer, useConfigContext, };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createContext } from '../context';
|
|
2
|
+
import { EMPTY_OBJ } from 'intact-react';
|
|
3
|
+
|
|
4
|
+
var _createContext = createContext(EMPTY_OBJ),
|
|
5
|
+
ConfigProvider = _createContext.Provider,
|
|
6
|
+
ConfigConsumer = _createContext.Consumer,
|
|
7
|
+
useContext = _createContext.useContext;
|
|
8
|
+
|
|
9
|
+
function useConfigContext() {
|
|
10
|
+
var config = useContext();
|
|
11
|
+
return {
|
|
12
|
+
cls: function cls(name) {
|
|
13
|
+
return (config.value.classNamePrefix || 'k') + "-" + name;
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
get k() {
|
|
17
|
+
return config.value.classNamePrefix || 'k';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { ConfigProvider, ConfigConsumer, useConfigContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
4
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
5
|
+
import { Component } from 'intact-react';
|
|
6
|
+
import { mount, wait } from '../../test/utils';
|
|
7
|
+
import { ConfigProvider } from '.';
|
|
8
|
+
import { Button, ButtonGroup } from '../button';
|
|
9
|
+
describe('Config', function () {
|
|
10
|
+
// afterEach(async () => {
|
|
11
|
+
// unmount();
|
|
12
|
+
// });
|
|
13
|
+
it('should change classname prefix', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
14
|
+
var Demo, _mount, instance, element;
|
|
15
|
+
|
|
16
|
+
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
17
|
+
while (1) {
|
|
18
|
+
switch (_context2.prev = _context2.next) {
|
|
19
|
+
case 0:
|
|
20
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
21
|
+
_inheritsLoose(Demo, _Component);
|
|
22
|
+
|
|
23
|
+
function Demo() {
|
|
24
|
+
var _context;
|
|
25
|
+
|
|
26
|
+
var _this;
|
|
27
|
+
|
|
28
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
|
+
args[_key] = arguments[_key];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
33
|
+
_this.ConfigProvider = ConfigProvider;
|
|
34
|
+
_this.ButtonGroup = ButtonGroup;
|
|
35
|
+
_this.Button = Button;
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
Demo.defaults = function defaults() {
|
|
40
|
+
return {
|
|
41
|
+
k: null
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return Demo;
|
|
46
|
+
}(Component);
|
|
47
|
+
|
|
48
|
+
Demo.template = "\n const { ConfigProvider, ButtonGroup, Button } = this;\n <div>\n <ConfigProvider value={{classNamePrefix: this.get('k')}}>\n <ButtonGroup>\n <Button ev-click={() => this.set('k', 'a')}>change to a</Button>\n <Button type=\"primary\" ev-click={() => this.set('k', 'b')}>change to b</Button>\n </ButtonGroup>\n </ConfigProvider>\n <Button>should not change</Button>\n </div>\n ";
|
|
49
|
+
_mount = mount(Demo), instance = _mount[0], element = _mount[1];
|
|
50
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
51
|
+
instance.set('k', 'a');
|
|
52
|
+
_context2.next = 7;
|
|
53
|
+
return wait();
|
|
54
|
+
|
|
55
|
+
case 7:
|
|
56
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
57
|
+
instance.set('k', 'b');
|
|
58
|
+
_context2.next = 11;
|
|
59
|
+
return wait();
|
|
60
|
+
|
|
61
|
+
case 11:
|
|
62
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
63
|
+
|
|
64
|
+
case 12:
|
|
65
|
+
case "end":
|
|
66
|
+
return _context2.stop();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, _callee);
|
|
70
|
+
})));
|
|
71
|
+
});
|
package/components/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, ComponentConstructor } from 'intact-react';
|
|
1
|
+
import { Component, RefObject, ComponentConstructor } from 'intact-react';
|
|
2
2
|
export interface ProviderProps<T> {
|
|
3
3
|
value?: T;
|
|
4
4
|
}
|
|
@@ -10,5 +10,6 @@ declare type ConsumerConstructor<T> = ComponentConstructor<Component<ConsumerPro
|
|
|
10
10
|
export declare function createContext<T = any>(defaultValue?: T): {
|
|
11
11
|
Provider: ProviderConstructor<T>;
|
|
12
12
|
Consumer: ConsumerConstructor<T>;
|
|
13
|
+
useContext: () => RefObject<T | undefined>;
|
|
13
14
|
};
|
|
14
15
|
export {};
|
package/components/context.js
CHANGED
|
@@ -53,7 +53,7 @@ export function createContext(defaultValue) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context2 = [this]).call(_context2, args)) || this;
|
|
56
|
-
_this2.ref = inject(injectionKey,
|
|
56
|
+
_this2.ref = inject(injectionKey, createRef(defaultValue));
|
|
57
57
|
return _this2;
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -61,9 +61,15 @@ export function createContext(defaultValue) {
|
|
|
61
61
|
}(Component);
|
|
62
62
|
|
|
63
63
|
Consumer.template = consumerTemplate;
|
|
64
|
+
|
|
65
|
+
function useContext() {
|
|
66
|
+
return inject(injectionKey, createRef(defaultValue));
|
|
67
|
+
}
|
|
68
|
+
|
|
64
69
|
return {
|
|
65
70
|
Provider: Provider,
|
|
66
|
-
Consumer: Consumer
|
|
71
|
+
Consumer: Consumer,
|
|
72
|
+
useContext: useContext
|
|
67
73
|
};
|
|
68
74
|
}
|
|
69
75
|
|
package/components/copy/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/con
|
|
|
3
3
|
import { Component } from 'intact-react';
|
|
4
4
|
import template from './index.vdt';
|
|
5
5
|
import { useCopy } from './useCopy';
|
|
6
|
+
import { useConfigContext } from '../config';
|
|
6
7
|
var typeDefs = {
|
|
7
8
|
text: String,
|
|
8
9
|
showMessage: Boolean
|
|
@@ -32,6 +33,7 @@ export var Copy = /*#__PURE__*/function (_Component) {
|
|
|
32
33
|
|
|
33
34
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
34
35
|
_this.copy = useCopy();
|
|
36
|
+
_this.config = useConfigContext();
|
|
35
37
|
return _this;
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -6,12 +6,6 @@ import { Virtual } from '../virtual';
|
|
|
6
6
|
import { Transition } from 'intact';
|
|
7
7
|
import { makeStyles } from './styles';
|
|
8
8
|
import { _$ } from '../../i18n';
|
|
9
|
-
var _$tmp0 = {
|
|
10
|
-
'key': '2',
|
|
11
|
-
'className': 'k-icon-check',
|
|
12
|
-
'hoverable': true,
|
|
13
|
-
'color': 'success'
|
|
14
|
-
};
|
|
15
9
|
export default function ($props, $blocks, $__proto__) {
|
|
16
10
|
var _classNameObj;
|
|
17
11
|
|
|
@@ -26,7 +20,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
26
20
|
var _this$copy = this.copy,
|
|
27
21
|
startCopy = _this$copy.startCopy,
|
|
28
22
|
success = _this$copy.success;
|
|
29
|
-
var
|
|
23
|
+
var k = this.config.k;
|
|
24
|
+
var classNameObj = (_classNameObj = {}, _classNameObj[k + "-copy"] = true, _classNameObj[makeStyles(k)] = true, _classNameObj[className] = className, _classNameObj);
|
|
30
25
|
return _$cc(Transition, {
|
|
31
26
|
'name': 'k-fade',
|
|
32
27
|
'children': _$cc(Virtual, _extends({
|
|
@@ -35,10 +30,15 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
35
30
|
}, getRestProps(this), {
|
|
36
31
|
'children': children ? children : !success.value ? _$cc(Icon, {
|
|
37
32
|
'key': '1',
|
|
38
|
-
'className':
|
|
33
|
+
'className': _$cn(k + "-icon-clone"),
|
|
39
34
|
'hoverable': true,
|
|
40
35
|
'title': _$('复制')
|
|
41
|
-
}, '1') : _$cc(Icon,
|
|
36
|
+
}, '1') : _$cc(Icon, {
|
|
37
|
+
'key': '2',
|
|
38
|
+
'className': _$cn(k + "-icon-check"),
|
|
39
|
+
'hoverable': true,
|
|
40
|
+
'color': 'success'
|
|
41
|
+
}, '2')
|
|
42
42
|
}))
|
|
43
43
|
});
|
|
44
44
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import '../../styles/global';
|
|
2
|
-
export declare function makeStyles(): string;
|
|
2
|
+
export declare function makeStyles(k: string): string;
|
|
@@ -2,7 +2,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
2
2
|
|
|
3
3
|
import { css } from '@emotion/css';
|
|
4
4
|
import '../../styles/global';
|
|
5
|
-
export function makeStyles() {
|
|
5
|
+
export function makeStyles(k) {
|
|
6
6
|
return /*#__PURE__*/css(process.env.NODE_ENV === "production" ? {
|
|
7
7
|
name: "t3aops",
|
|
8
8
|
styles: "cursor:pointer;vertical-align:middle"
|
|
@@ -12,6 +12,7 @@ import { bind } from '../utils';
|
|
|
12
12
|
import { useYears } from './useYears';
|
|
13
13
|
import { useMonths } from './useMonths';
|
|
14
14
|
import { useStatus } from './useStatus';
|
|
15
|
+
import { useConfigContext } from '../config';
|
|
15
16
|
|
|
16
17
|
var defaults = function defaults() {
|
|
17
18
|
return {
|
|
@@ -39,6 +40,7 @@ export var DatepickerCalendar = /*#__PURE__*/function (_Component) {
|
|
|
39
40
|
_this.days = useDays(_this.showDate.date, _this.status, _this.datepicker.focusDate.focusDate);
|
|
40
41
|
_this.years = useYears(_this.showDate.date, _this.status, _this.datepicker.focusDate.focusDate);
|
|
41
42
|
_this.months = useMonths(_this.showDate.date, _this.status, _this.datepicker.focusDate.focusDate);
|
|
43
|
+
_this.config = useConfigContext();
|
|
42
44
|
return _this;
|
|
43
45
|
}
|
|
44
46
|
|