primereact 10.0.0 → 10.0.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.
- package/README.md +1 -1
- package/componentbase/componentbase.cjs.js +12 -7
- package/componentbase/componentbase.cjs.min.js +1 -1
- package/componentbase/componentbase.esm.min.mjs +1 -1
- package/componentbase/componentbase.esm.mjs +12 -7
- package/componentbase/componentbase.js +12 -7
- package/componentbase/componentbase.min.js +1 -1
- package/core/core.js +12 -7
- package/core/core.min.js +1 -1
- package/package.json +1 -1
- package/primereact.all.cjs.js +12 -7
- package/primereact.all.cjs.min.js +1 -1
- package/primereact.all.esm.min.mjs +1 -1
- package/primereact.all.esm.mjs +12 -7
- package/primereact.all.js +12 -7
- package/primereact.all.min.js +1 -1
- package/web-types.json +1 -1
- package/accordion/accordion.esm.js +0 -421
- package/accordion/accordion.esm.min.js +0 -1
- package/api/api.esm.js +0 -944
- package/api/api.esm.min.js +0 -1
- package/autocomplete/autocomplete.esm.js +0 -1127
- package/autocomplete/autocomplete.esm.min.js +0 -1
- package/avatar/avatar.esm.js +0 -245
- package/avatar/avatar.esm.min.js +0 -1
- package/avatargroup/avatargroup.esm.js +0 -55
- package/avatargroup/avatargroup.esm.min.js +0 -1
- package/badge/badge.esm.js +0 -110
- package/badge/badge.esm.min.js +0 -1
- package/blockui/blockui.esm.js +0 -265
- package/blockui/blockui.esm.min.js +0 -1
- package/breadcrumb/breadcrumb.esm.js +0 -351
- package/breadcrumb/breadcrumb.esm.min.js +0 -1
- package/button/button.esm.js +0 -295
- package/button/button.esm.min.js +0 -1
- package/calendar/calendar.esm.js +0 -3473
- package/calendar/calendar.esm.min.js +0 -1
- package/card/card.esm.js +0 -98
- package/card/card.esm.min.js +0 -1
- package/carousel/carousel.esm.js +0 -801
- package/carousel/carousel.esm.min.js +0 -1
- package/cascadeselect/cascadeselect.esm.js +0 -819
- package/cascadeselect/cascadeselect.esm.min.js +0 -1
- package/chart/chart.esm.js +0 -155
- package/chart/chart.esm.min.js +0 -1
- package/checkbox/checkbox.esm.js +0 -357
- package/checkbox/checkbox.esm.min.js +0 -1
- package/chip/chip.esm.js +0 -248
- package/chip/chip.esm.min.js +0 -1
- package/chips/chips.esm.js +0 -501
- package/chips/chips.esm.min.js +0 -1
- package/colorpicker/colorpicker.esm.js +0 -788
- package/colorpicker/colorpicker.esm.min.js +0 -1
- package/column/column.esm.js +0 -8
- package/column/column.esm.min.js +0 -1
- package/columngroup/columngroup.esm.js +0 -6
- package/columngroup/columngroup.esm.min.js +0 -1
- package/componentbase/componentbase.esm.js +0 -323
- package/componentbase/componentbase.esm.min.js +0 -1
- package/confirmdialog/confirmdialog.esm.js +0 -376
- package/confirmdialog/confirmdialog.esm.min.js +0 -1
- package/confirmpopup/confirmpopup.esm.js +0 -610
- package/confirmpopup/confirmpopup.esm.min.js +0 -1
- package/contextmenu/contextmenu.esm.js +0 -664
- package/contextmenu/contextmenu.esm.min.js +0 -1
- package/csstransition/csstransition.esm.js +0 -138
- package/csstransition/csstransition.esm.min.js +0 -1
- package/datascroller/datascroller.esm.js +0 -320
- package/datascroller/datascroller.esm.min.js +0 -1
- package/datatable/datatable.esm.js +0 -6636
- package/datatable/datatable.esm.min.js +0 -1
- package/dataview/dataview.esm.js +0 -506
- package/dataview/dataview.esm.min.js +0 -1
- package/deferredcontent/deferredcontent.esm.js +0 -133
- package/deferredcontent/deferredcontent.esm.min.js +0 -1
- package/dialog/dialog.esm.js +0 -983
- package/dialog/dialog.esm.min.js +0 -1
- package/divider/divider.esm.js +0 -79
- package/divider/divider.esm.min.js +0 -1
- package/dock/dock.esm.js +0 -348
- package/dock/dock.esm.min.js +0 -1
- package/dropdown/dropdown.esm.js +0 -1380
- package/dropdown/dropdown.esm.min.js +0 -1
- package/editor/editor.esm.js +0 -338
- package/editor/editor.esm.min.js +0 -1
- package/fieldset/fieldset.esm.js +0 -270
- package/fieldset/fieldset.esm.min.js +0 -1
- package/fileupload/fileupload.esm.js +0 -1005
- package/fileupload/fileupload.esm.min.js +0 -1
- package/galleria/galleria.esm.js +0 -1090
- package/galleria/galleria.esm.min.js +0 -1
- package/hooks/hooks.esm.js +0 -1042
- package/hooks/hooks.esm.min.js +0 -1
- package/iconbase/iconbase.esm.js +0 -33
- package/iconbase/iconbase.esm.min.js +0 -1
- package/icons/angledoubledown/index.esm.js +0 -39
- package/icons/angledoubledown/index.esm.min.js +0 -1
- package/icons/angledoubleleft/index.esm.js +0 -39
- package/icons/angledoubleleft/index.esm.min.js +0 -1
- package/icons/angledoubleright/index.esm.js +0 -39
- package/icons/angledoubleright/index.esm.min.js +0 -1
- package/icons/angledoubleup/index.esm.js +0 -39
- package/icons/angledoubleup/index.esm.min.js +0 -1
- package/icons/angledown/index.esm.js +0 -37
- package/icons/angledown/index.esm.min.js +0 -1
- package/icons/angleleft/index.esm.js +0 -37
- package/icons/angleleft/index.esm.min.js +0 -1
- package/icons/angleright/index.esm.js +0 -37
- package/icons/angleright/index.esm.min.js +0 -1
- package/icons/angleup/index.esm.js +0 -37
- package/icons/angleup/index.esm.min.js +0 -1
- package/icons/arrowdown/index.esm.js +0 -661
- package/icons/arrowdown/index.esm.min.js +0 -1
- package/icons/arrowup/index.esm.js +0 -661
- package/icons/arrowup/index.esm.min.js +0 -1
- package/icons/ban/index.esm.js +0 -659
- package/icons/ban/index.esm.min.js +0 -1
- package/icons/bars/index.esm.js +0 -39
- package/icons/bars/index.esm.min.js +0 -1
- package/icons/calendar/index.esm.js +0 -37
- package/icons/calendar/index.esm.min.js +0 -1
- package/icons/check/index.esm.js +0 -37
- package/icons/check/index.esm.min.js +0 -1
- package/icons/chevrondown/index.esm.js +0 -37
- package/icons/chevrondown/index.esm.min.js +0 -1
- package/icons/chevronleft/index.esm.js +0 -37
- package/icons/chevronleft/index.esm.min.js +0 -1
- package/icons/chevronright/index.esm.js +0 -37
- package/icons/chevronright/index.esm.min.js +0 -1
- package/icons/chevronup/index.esm.js +0 -37
- package/icons/chevronup/index.esm.min.js +0 -1
- package/icons/download/index.esm.js +0 -661
- package/icons/download/index.esm.min.js +0 -1
- package/icons/exclamationtriangle/index.esm.js +0 -665
- package/icons/exclamationtriangle/index.esm.min.js +0 -1
- package/icons/eye/index.esm.js +0 -39
- package/icons/eye/index.esm.min.js +0 -1
- package/icons/eyeslash/index.esm.js +0 -661
- package/icons/eyeslash/index.esm.min.js +0 -1
- package/icons/filter/index.esm.js +0 -659
- package/icons/filter/index.esm.min.js +0 -1
- package/icons/filterslash/index.esm.js +0 -661
- package/icons/filterslash/index.esm.min.js +0 -1
- package/icons/infocircle/index.esm.js +0 -661
- package/icons/infocircle/index.esm.min.js +0 -1
- package/icons/minus/index.esm.js +0 -37
- package/icons/minus/index.esm.min.js +0 -1
- package/icons/pencil/index.esm.js +0 -659
- package/icons/pencil/index.esm.min.js +0 -1
- package/icons/plus/index.esm.js +0 -659
- package/icons/plus/index.esm.min.js +0 -1
- package/icons/refresh/index.esm.js +0 -661
- package/icons/refresh/index.esm.min.js +0 -1
- package/icons/search/index.esm.js +0 -661
- package/icons/search/index.esm.min.js +0 -1
- package/icons/searchminus/index.esm.js +0 -661
- package/icons/searchminus/index.esm.min.js +0 -1
- package/icons/searchplus/index.esm.js +0 -661
- package/icons/searchplus/index.esm.min.js +0 -1
- package/icons/sortalt/index.esm.js +0 -668
- package/icons/sortalt/index.esm.min.js +0 -1
- package/icons/sortamountdown/index.esm.js +0 -674
- package/icons/sortamountdown/index.esm.min.js +0 -1
- package/icons/sortamountupalt/index.esm.js +0 -674
- package/icons/sortamountupalt/index.esm.min.js +0 -1
- package/icons/spinner/index.esm.js +0 -659
- package/icons/spinner/index.esm.min.js +0 -1
- package/icons/star/index.esm.js +0 -659
- package/icons/star/index.esm.min.js +0 -1
- package/icons/starfill/index.esm.js +0 -659
- package/icons/starfill/index.esm.min.js +0 -1
- package/icons/thlarge/index.esm.js +0 -661
- package/icons/thlarge/index.esm.min.js +0 -1
- package/icons/times/index.esm.js +0 -37
- package/icons/times/index.esm.min.js +0 -1
- package/icons/timescircle/index.esm.js +0 -661
- package/icons/timescircle/index.esm.min.js +0 -1
- package/icons/trash/index.esm.js +0 -661
- package/icons/trash/index.esm.min.js +0 -1
- package/icons/undo/index.esm.js +0 -661
- package/icons/undo/index.esm.min.js +0 -1
- package/icons/upload/index.esm.js +0 -661
- package/icons/upload/index.esm.min.js +0 -1
- package/icons/windowmaximize/index.esm.js +0 -661
- package/icons/windowmaximize/index.esm.min.js +0 -1
- package/icons/windowminimize/index.esm.js +0 -661
- package/icons/windowminimize/index.esm.min.js +0 -1
- package/image/image.esm.js +0 -1162
- package/image/image.esm.min.js +0 -1
- package/inplace/inplace.esm.js +0 -243
- package/inplace/inplace.esm.min.js +0 -1
- package/inputmask/inputmask.esm.js +0 -560
- package/inputmask/inputmask.esm.min.js +0 -1
- package/inputnumber/inputnumber.esm.js +0 -1209
- package/inputnumber/inputnumber.esm.min.js +0 -1
- package/inputswitch/inputswitch.esm.js +0 -291
- package/inputswitch/inputswitch.esm.min.js +0 -1
- package/inputtext/inputtext.esm.js +0 -171
- package/inputtext/inputtext.esm.min.js +0 -1
- package/inputtextarea/inputtextarea.esm.js +0 -220
- package/inputtextarea/inputtextarea.esm.min.js +0 -1
- package/keyfilter/keyfilter.esm.js +0 -108
- package/keyfilter/keyfilter.esm.min.js +0 -1
- package/knob/knob.esm.js +0 -318
- package/knob/knob.esm.min.js +0 -1
- package/listbox/listbox.esm.js +0 -810
- package/listbox/listbox.esm.min.js +0 -1
- package/megamenu/megamenu.esm.js +0 -716
- package/megamenu/megamenu.esm.min.js +0 -1
- package/mention/mention.esm.js +0 -771
- package/mention/mention.esm.min.js +0 -1
- package/menu/menu.esm.js +0 -485
- package/menu/menu.esm.min.js +0 -1
- package/menubar/menubar.esm.js +0 -584
- package/menubar/menubar.esm.min.js +0 -1
- package/message/message.esm.js +0 -169
- package/message/message.esm.min.js +0 -1
- package/messages/messages.esm.js +0 -439
- package/messages/messages.esm.min.js +0 -1
- package/multiselect/multiselect.esm.js +0 -1724
- package/multiselect/multiselect.esm.min.js +0 -1
- package/multistatecheckbox/multistatecheckbox.esm.js +0 -352
- package/multistatecheckbox/multistatecheckbox.esm.min.js +0 -1
- package/orderlist/orderlist.esm.js +0 -816
- package/orderlist/orderlist.esm.min.js +0 -1
- package/organizationchart/organizationchart.esm.js +0 -480
- package/organizationchart/organizationchart.esm.min.js +0 -1
- package/overlaypanel/overlaypanel.esm.js +0 -516
- package/overlaypanel/overlaypanel.esm.min.js +0 -1
- package/overlayservice/overlayservice.esm.js +0 -7
- package/overlayservice/overlayservice.esm.min.js +0 -1
- package/paginator/paginator.esm.js +0 -933
- package/paginator/paginator.esm.min.js +0 -1
- package/panel/panel.esm.js +0 -316
- package/panel/panel.esm.min.js +0 -1
- package/panelmenu/panelmenu.esm.js +0 -645
- package/panelmenu/panelmenu.esm.min.js +0 -1
- package/passthrough/index.esm.js +0 -71
- package/passthrough/index.esm.min.js +0 -1
- package/passthrough/tailwind/index.esm.js +0 -3509
- package/passthrough/tailwind/index.esm.min.js +0 -1
- package/password/password.esm.js +0 -567
- package/password/password.esm.min.js +0 -1
- package/picklist/picklist.esm.js +0 -1119
- package/picklist/picklist.esm.min.js +0 -1
- package/portal/portal.esm.js +0 -110
- package/portal/portal.esm.min.js +0 -1
- package/primereact.all.esm.js +0 -51646
- package/primereact.all.esm.min.js +0 -1
- package/progressbar/progressbar.esm.js +0 -190
- package/progressbar/progressbar.esm.min.js +0 -1
- package/progressspinner/progressspinner.esm.js +0 -88
- package/progressspinner/progressspinner.esm.min.js +0 -1
- package/radiobutton/radiobutton.esm.js +0 -329
- package/radiobutton/radiobutton.esm.min.js +0 -1
- package/rating/rating.esm.js +0 -273
- package/rating/rating.esm.min.js +0 -1
- package/ripple/ripple.esm.js +0 -100
- package/ripple/ripple.esm.min.js +0 -1
- package/row/row.esm.js +0 -36
- package/row/row.esm.min.js +0 -1
- package/scrollpanel/scrollpanel.esm.js +0 -210
- package/scrollpanel/scrollpanel.esm.min.js +0 -1
- package/scrolltop/scrolltop.esm.js +0 -269
- package/scrolltop/scrolltop.esm.min.js +0 -1
- package/selectbutton/selectbutton.esm.js +0 -327
- package/selectbutton/selectbutton.esm.min.js +0 -1
- package/sidebar/sidebar.esm.js +0 -543
- package/sidebar/sidebar.esm.min.js +0 -1
- package/skeleton/skeleton.esm.js +0 -125
- package/skeleton/skeleton.esm.min.js +0 -1
- package/slidemenu/slidemenu.esm.js +0 -689
- package/slidemenu/slidemenu.esm.min.js +0 -1
- package/slider/slider.esm.js +0 -478
- package/slider/slider.esm.min.js +0 -1
- package/speeddial/speeddial.esm.js +0 -521
- package/speeddial/speeddial.esm.min.js +0 -1
- package/splitbutton/splitbutton.esm.js +0 -545
- package/splitbutton/splitbutton.esm.min.js +0 -1
- package/splitter/splitter.esm.js +0 -466
- package/splitter/splitter.esm.min.js +0 -1
- package/steps/steps.esm.js +0 -294
- package/steps/steps.esm.min.js +0 -1
- package/styleclass/styleclass.esm.js +0 -269
- package/styleclass/styleclass.esm.min.js +0 -1
- package/tabmenu/tabmenu.esm.js +0 -332
- package/tabmenu/tabmenu.esm.min.js +0 -1
- package/tabview/tabview.esm.js +0 -678
- package/tabview/tabview.esm.min.js +0 -1
- package/tag/tag.esm.js +0 -117
- package/tag/tag.esm.min.js +0 -1
- package/terminal/terminal.esm.js +0 -280
- package/terminal/terminal.esm.min.js +0 -1
- package/terminalservice/terminalservice.esm.js +0 -7
- package/terminalservice/terminalservice.esm.min.js +0 -1
- package/tieredmenu/tieredmenu.esm.js +0 -699
- package/tieredmenu/tieredmenu.esm.min.js +0 -1
- package/timeline/timeline.esm.js +0 -164
- package/timeline/timeline.esm.min.js +0 -1
- package/toast/toast.esm.js +0 -739
- package/toast/toast.esm.min.js +0 -1
- package/togglebutton/togglebutton.esm.js +0 -217
- package/togglebutton/togglebutton.esm.min.js +0 -1
- package/toolbar/toolbar.esm.js +0 -79
- package/toolbar/toolbar.esm.min.js +0 -1
- package/tooltip/tooltip.esm.js +0 -696
- package/tooltip/tooltip.esm.min.js +0 -1
- package/tree/tree.esm.js +0 -1403
- package/tree/tree.esm.min.js +0 -1
- package/treeselect/treeselect.esm.js +0 -930
- package/treeselect/treeselect.esm.min.js +0 -1
- package/treetable/treetable.esm.js +0 -3094
- package/treetable/treetable.esm.min.js +0 -1
- package/tristatecheckbox/tristatecheckbox.esm.js +0 -292
- package/tristatecheckbox/tristatecheckbox.esm.min.js +0 -1
- package/utils/utils.esm.js +0 -2383
- package/utils/utils.esm.min.js +0 -1
- package/virtualscroller/virtualscroller.esm.js +0 -972
- package/virtualscroller/virtualscroller.esm.min.js +0 -1
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { PrimeReactContext } from 'primereact/api';
|
|
5
|
-
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
6
|
-
import { KeyFilter } from 'primereact/keyfilter';
|
|
7
|
-
import { Tooltip } from 'primereact/tooltip';
|
|
8
|
-
import { classNames, ObjectUtils, mergeProps, DomHandler } from 'primereact/utils';
|
|
9
|
-
|
|
10
|
-
function _extends() {
|
|
11
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
12
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
13
|
-
var source = arguments[i];
|
|
14
|
-
for (var key in source) {
|
|
15
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
16
|
-
target[key] = source[key];
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return target;
|
|
21
|
-
};
|
|
22
|
-
return _extends.apply(this, arguments);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function _typeof(o) {
|
|
26
|
-
"@babel/helpers - typeof";
|
|
27
|
-
|
|
28
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
29
|
-
return typeof o;
|
|
30
|
-
} : function (o) {
|
|
31
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
32
|
-
}, _typeof(o);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function _toPrimitive(input, hint) {
|
|
36
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
37
|
-
var prim = input[Symbol.toPrimitive];
|
|
38
|
-
if (prim !== undefined) {
|
|
39
|
-
var res = prim.call(input, hint || "default");
|
|
40
|
-
if (_typeof(res) !== "object") return res;
|
|
41
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
42
|
-
}
|
|
43
|
-
return (hint === "string" ? String : Number)(input);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function _toPropertyKey(arg) {
|
|
47
|
-
var key = _toPrimitive(arg, "string");
|
|
48
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function _defineProperty(obj, key, value) {
|
|
52
|
-
key = _toPropertyKey(key);
|
|
53
|
-
if (key in obj) {
|
|
54
|
-
Object.defineProperty(obj, key, {
|
|
55
|
-
value: value,
|
|
56
|
-
enumerable: true,
|
|
57
|
-
configurable: true,
|
|
58
|
-
writable: true
|
|
59
|
-
});
|
|
60
|
-
} else {
|
|
61
|
-
obj[key] = value;
|
|
62
|
-
}
|
|
63
|
-
return obj;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
var classes = {
|
|
67
|
-
root: function root(_ref) {
|
|
68
|
-
var props = _ref.props,
|
|
69
|
-
isFilled = _ref.isFilled;
|
|
70
|
-
return classNames('p-inputtextarea p-inputtext p-component', {
|
|
71
|
-
'p-disabled': props.disabled,
|
|
72
|
-
'p-filled': isFilled,
|
|
73
|
-
'p-inputtextarea-resizable': props.autoResize
|
|
74
|
-
}, props.className);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
var styles = "\n@layer primereact {\n .p-inputtextarea-resizable {\n overflow: hidden;\n resize: none;\n }\n \n .p-fluid .p-inputtextarea {\n width: 100%;\n }\n}\n";
|
|
78
|
-
var InputTextareaBase = ComponentBase.extend({
|
|
79
|
-
defaultProps: {
|
|
80
|
-
__TYPE: 'InputTextarea',
|
|
81
|
-
__parentMetadata: null,
|
|
82
|
-
autoResize: false,
|
|
83
|
-
keyfilter: null,
|
|
84
|
-
onBlur: null,
|
|
85
|
-
onFocus: null,
|
|
86
|
-
onBeforeInput: null,
|
|
87
|
-
onInput: null,
|
|
88
|
-
onKeyDown: null,
|
|
89
|
-
onKeyUp: null,
|
|
90
|
-
onPaste: null,
|
|
91
|
-
tooltip: null,
|
|
92
|
-
tooltipOptions: null,
|
|
93
|
-
validateOnly: false,
|
|
94
|
-
children: undefined
|
|
95
|
-
},
|
|
96
|
-
css: {
|
|
97
|
-
classes: classes,
|
|
98
|
-
styles: styles
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
103
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
104
|
-
var InputTextarea = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
105
|
-
var context = React.useContext(PrimeReactContext);
|
|
106
|
-
var props = InputTextareaBase.getProps(inProps, context);
|
|
107
|
-
var elementRef = React.useRef(ref);
|
|
108
|
-
var cachedScrollHeight = React.useRef(0);
|
|
109
|
-
var _InputTextareaBase$se = InputTextareaBase.setMetaData(_objectSpread(_objectSpread({
|
|
110
|
-
props: props
|
|
111
|
-
}, props.__parentMetadata), {}, {
|
|
112
|
-
context: {
|
|
113
|
-
disabled: props.disabled
|
|
114
|
-
}
|
|
115
|
-
})),
|
|
116
|
-
ptm = _InputTextareaBase$se.ptm,
|
|
117
|
-
cx = _InputTextareaBase$se.cx,
|
|
118
|
-
isUnstyled = _InputTextareaBase$se.isUnstyled;
|
|
119
|
-
useHandleStyle(InputTextareaBase.css.styles, isUnstyled, {
|
|
120
|
-
name: 'inputtextarea'
|
|
121
|
-
});
|
|
122
|
-
var onFocus = function onFocus(event) {
|
|
123
|
-
if (props.autoResize) {
|
|
124
|
-
resize();
|
|
125
|
-
}
|
|
126
|
-
props.onFocus && props.onFocus(event);
|
|
127
|
-
};
|
|
128
|
-
var onBlur = function onBlur(event) {
|
|
129
|
-
if (props.autoResize) {
|
|
130
|
-
resize();
|
|
131
|
-
}
|
|
132
|
-
props.onBlur && props.onBlur(event);
|
|
133
|
-
};
|
|
134
|
-
var onKeyUp = function onKeyUp(event) {
|
|
135
|
-
if (props.autoResize) {
|
|
136
|
-
resize();
|
|
137
|
-
}
|
|
138
|
-
props.onKeyUp && props.onKeyUp(event);
|
|
139
|
-
};
|
|
140
|
-
var onKeyDown = function onKeyDown(event) {
|
|
141
|
-
props.onKeyDown && props.onKeyDown(event);
|
|
142
|
-
if (props.keyfilter) {
|
|
143
|
-
KeyFilter.onKeyPress(event, props.keyfilter, props.validateOnly);
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
var onBeforeInput = function onBeforeInput(event) {
|
|
147
|
-
props.onBeforeInput && props.onBeforeInput(event);
|
|
148
|
-
if (props.keyfilter) {
|
|
149
|
-
KeyFilter.onBeforeInput(event, props.keyfilter, props.validateOnly);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
var onPaste = function onPaste(event) {
|
|
153
|
-
props.onPaste && props.onPaste(event);
|
|
154
|
-
if (props.keyfilter) {
|
|
155
|
-
KeyFilter.onPaste(event, props.keyfilter, props.validateOnly);
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
var onInput = function onInput(event) {
|
|
159
|
-
var target = event.target;
|
|
160
|
-
if (props.autoResize) {
|
|
161
|
-
resize(ObjectUtils.isEmpty(target.value));
|
|
162
|
-
}
|
|
163
|
-
props.onInput && props.onInput(event);
|
|
164
|
-
ObjectUtils.isNotEmpty(target.value) ? DomHandler.addClass(target, 'p-filled') : DomHandler.removeClass(target, 'p-filled');
|
|
165
|
-
};
|
|
166
|
-
var resize = function resize(initial) {
|
|
167
|
-
var inputEl = elementRef.current;
|
|
168
|
-
if (inputEl && DomHandler.isVisible(inputEl)) {
|
|
169
|
-
if (!cachedScrollHeight.current) {
|
|
170
|
-
cachedScrollHeight.current = inputEl.scrollHeight;
|
|
171
|
-
inputEl.style.overflow = 'hidden';
|
|
172
|
-
}
|
|
173
|
-
if (cachedScrollHeight.current !== inputEl.scrollHeight || initial) {
|
|
174
|
-
inputEl.style.height = '';
|
|
175
|
-
inputEl.style.height = inputEl.scrollHeight + 'px';
|
|
176
|
-
if (parseFloat(inputEl.style.height) >= parseFloat(inputEl.style.maxHeight)) {
|
|
177
|
-
inputEl.style.overflowY = 'scroll';
|
|
178
|
-
inputEl.style.height = inputEl.style.maxHeight;
|
|
179
|
-
} else {
|
|
180
|
-
inputEl.style.overflow = 'hidden';
|
|
181
|
-
}
|
|
182
|
-
cachedScrollHeight.current = inputEl.scrollHeight;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
React.useEffect(function () {
|
|
187
|
-
ObjectUtils.combinedRefs(elementRef, ref);
|
|
188
|
-
}, [elementRef, ref]);
|
|
189
|
-
React.useEffect(function () {
|
|
190
|
-
if (props.autoResize) {
|
|
191
|
-
resize(true);
|
|
192
|
-
}
|
|
193
|
-
}, [props.autoResize]);
|
|
194
|
-
var isFilled = React.useMemo(function () {
|
|
195
|
-
return ObjectUtils.isNotEmpty(props.value) || ObjectUtils.isNotEmpty(props.defaultValue);
|
|
196
|
-
}, [props.value, props.defaultValue]);
|
|
197
|
-
var hasTooltip = ObjectUtils.isNotEmpty(props.tooltip);
|
|
198
|
-
var rootProps = mergeProps({
|
|
199
|
-
ref: elementRef,
|
|
200
|
-
className: cx('root', {
|
|
201
|
-
isFilled: isFilled
|
|
202
|
-
}),
|
|
203
|
-
onFocus: onFocus,
|
|
204
|
-
onBlur: onBlur,
|
|
205
|
-
onKeyUp: onKeyUp,
|
|
206
|
-
onKeyDown: onKeyDown,
|
|
207
|
-
onBeforeInput: onBeforeInput,
|
|
208
|
-
onInput: onInput,
|
|
209
|
-
onPaste: onPaste
|
|
210
|
-
}, InputTextareaBase.getOtherProps(props), ptm('root'));
|
|
211
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("textarea", rootProps), hasTooltip && /*#__PURE__*/React.createElement(Tooltip, _extends({
|
|
212
|
-
target: elementRef,
|
|
213
|
-
content: props.tooltip
|
|
214
|
-
}, props.tooltipOptions, {
|
|
215
|
-
pt: ptm('tooltip')
|
|
216
|
-
})));
|
|
217
|
-
}));
|
|
218
|
-
InputTextarea.displayName = 'InputTextarea';
|
|
219
|
-
|
|
220
|
-
export { InputTextarea };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"react";import{PrimeReactContext as t}from"primereact/api";import{ComponentBase as n,useHandleStyle as r}from"primereact/componentbase";import{KeyFilter as o}from"primereact/keyfilter";import{Tooltip as i}from"primereact/tooltip";import{classNames as l,ObjectUtils as a,mergeProps as u,DomHandler as s}from"primereact/utils";function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p.apply(this,arguments)}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,t){if("object"!==c(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function y(e){var t=f(e,"string");return"symbol"===c(t)?t:String(t)}var m=n.extend({defaultProps:{__TYPE:"InputTextarea",__parentMetadata:null,autoResize:!1,keyfilter:null,onBlur:null,onFocus:null,onBeforeInput:null,onInput:null,onKeyDown:null,onKeyUp:null,onPaste:null,tooltip:null,tooltipOptions:null,validateOnly:!1,children:void 0},css:{classes:{root:function(e){var t=e.props;return l("p-inputtextarea p-inputtext p-component",{"p-disabled":t.disabled,"p-filled":e.isFilled,"p-inputtextarea-resizable":t.autoResize},t.className)}},styles:"\n@layer primereact {\n .p-inputtextarea-resizable {\n overflow: hidden;\n resize: none;\n }\n \n .p-fluid .p-inputtextarea {\n width: 100%;\n }\n}\n"}});function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){var r,o,i;r=e,i=n[t],(o=y(o=t))in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var v=e.memo(e.forwardRef((function(n,l){var c=e.useContext(t),f=m.getProps(n,c),y=e.useRef(l),d=e.useRef(0),v=m.setMetaData(b(b({props:f},f.__parentMetadata),{},{context:{disabled:f.disabled}})),g=v.ptm,O=v.cx;r(m.css.styles,v.isUnstyled,{name:"inputtextarea"});var h=function(e){var t=y.current;t&&s.isVisible(t)&&(d.current||(d.current=t.scrollHeight,t.style.overflow="hidden"),(d.current!==t.scrollHeight||e)&&(t.style.height="",t.style.height=t.scrollHeight+"px",parseFloat(t.style.height)>=parseFloat(t.style.maxHeight)?(t.style.overflowY="scroll",t.style.height=t.style.maxHeight):t.style.overflow="hidden",d.current=t.scrollHeight))};e.useEffect((function(){a.combinedRefs(y,l)}),[y,l]),e.useEffect((function(){f.autoResize&&h(!0)}),[f.autoResize]);var P=e.useMemo((function(){return a.isNotEmpty(f.value)||a.isNotEmpty(f.defaultValue)}),[f.value,f.defaultValue]),w=a.isNotEmpty(f.tooltip),j=u({ref:y,className:O("root",{isFilled:P}),onFocus:function(e){f.autoResize&&h(),f.onFocus&&f.onFocus(e)},onBlur:function(e){f.autoResize&&h(),f.onBlur&&f.onBlur(e)},onKeyUp:function(e){f.autoResize&&h(),f.onKeyUp&&f.onKeyUp(e)},onKeyDown:function(e){f.onKeyDown&&f.onKeyDown(e),f.keyfilter&&o.onKeyPress(e,f.keyfilter,f.validateOnly)},onBeforeInput:function(e){f.onBeforeInput&&f.onBeforeInput(e),f.keyfilter&&o.onBeforeInput(e,f.keyfilter,f.validateOnly)},onInput:function(e){var t=e.target;f.autoResize&&h(a.isEmpty(t.value)),f.onInput&&f.onInput(e),a.isNotEmpty(t.value)?s.addClass(t,"p-filled"):s.removeClass(t,"p-filled")},onPaste:function(e){f.onPaste&&f.onPaste(e),f.keyfilter&&o.onPaste(e,f.keyfilter,f.validateOnly)}},m.getOtherProps(f),g("root"));return e.createElement(e.Fragment,null,e.createElement("textarea",j),w&&e.createElement(i,p({target:y,content:f.tooltip},f.tooltipOptions,{pt:g("tooltip")})))})));v.displayName="InputTextarea";export{v as InputTextarea};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { DomHandler } from 'primereact/utils';
|
|
4
|
-
|
|
5
|
-
function _arrayLikeToArray(arr, len) {
|
|
6
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
7
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
8
|
-
return arr2;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function _arrayWithoutHoles(arr) {
|
|
12
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function _iterableToArray(iter) {
|
|
16
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
20
|
-
if (!o) return;
|
|
21
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
22
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
23
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
24
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
25
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function _nonIterableSpread() {
|
|
29
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function _toConsumableArray(arr) {
|
|
33
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var KeyFilter = {
|
|
37
|
-
/* eslint-disable */
|
|
38
|
-
DEFAULT_MASKS: {
|
|
39
|
-
pint: /[\d]/,
|
|
40
|
-
"int": /[\d\-]/,
|
|
41
|
-
pnum: /[\d\.]/,
|
|
42
|
-
money: /[\d\.\s,]/,
|
|
43
|
-
num: /[\d\-\.]/,
|
|
44
|
-
hex: /[0-9a-f]/i,
|
|
45
|
-
email: /[a-z0-9_\.\-@]/i,
|
|
46
|
-
alpha: /[a-z_]/i,
|
|
47
|
-
alphanum: /[a-z0-9_]/i
|
|
48
|
-
},
|
|
49
|
-
/* eslint-enable */getRegex: function getRegex(keyfilter) {
|
|
50
|
-
return KeyFilter.DEFAULT_MASKS[keyfilter] ? KeyFilter.DEFAULT_MASKS[keyfilter] : keyfilter;
|
|
51
|
-
},
|
|
52
|
-
onBeforeInput: function onBeforeInput(e, keyfilter, validateOnly) {
|
|
53
|
-
// android devices must use beforeinput https://stackoverflow.com/questions/36753548/keycode-on-android-is-always-229
|
|
54
|
-
if (validateOnly || !DomHandler.isAndroid()) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
this.validateKey(e, e.data, keyfilter);
|
|
58
|
-
},
|
|
59
|
-
onKeyPress: function onKeyPress(e, keyfilter, validateOnly) {
|
|
60
|
-
// non android devices use keydown
|
|
61
|
-
if (validateOnly || DomHandler.isAndroid()) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
if (e.ctrlKey || e.altKey) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
this.validateKey(e, e.key, keyfilter);
|
|
68
|
-
},
|
|
69
|
-
onPaste: function onPaste(e, keyfilter, validateOnly) {
|
|
70
|
-
if (validateOnly) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
var regex = this.getRegex(keyfilter);
|
|
74
|
-
var clipboard = e.clipboardData.getData('text');
|
|
75
|
-
|
|
76
|
-
// loop over each letter pasted and if any fail prevent the paste
|
|
77
|
-
_toConsumableArray(clipboard).forEach(function (c) {
|
|
78
|
-
if (!regex.test(c)) {
|
|
79
|
-
e.preventDefault();
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
},
|
|
84
|
-
validateKey: function validateKey(e, key, keyfilter) {
|
|
85
|
-
if (key === null || key === undefined) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
var isPrintableKey = key.length === 1;
|
|
89
|
-
if (!isPrintableKey) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
var regex = this.getRegex(keyfilter);
|
|
93
|
-
if (!regex.test(key)) {
|
|
94
|
-
e.preventDefault();
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
validate: function validate(e, keyfilter) {
|
|
98
|
-
var value = e.target.value,
|
|
99
|
-
validatePattern = true;
|
|
100
|
-
var regex = this.getRegex(keyfilter);
|
|
101
|
-
if (value && !regex.test(value)) {
|
|
102
|
-
validatePattern = false;
|
|
103
|
-
}
|
|
104
|
-
return validatePattern;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export { KeyFilter };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{DomHandler as t}from"primereact/utils";function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function r(t){if(Array.isArray(t))return e(t)}function n(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function a(t,r){if(t){if("string"==typeof t)return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}function i(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o={DEFAULT_MASKS:{pint:/[\d]/,int:/[\d\-]/,pnum:/[\d\.]/,money:/[\d\.\s,]/,num:/[\d\-\.]/,hex:/[0-9a-f]/i,email:/[a-z0-9_\.\-@]/i,alpha:/[a-z_]/i,alphanum:/[a-z0-9_]/i},getRegex:function(t){return o.DEFAULT_MASKS[t]?o.DEFAULT_MASKS[t]:t},onBeforeInput:function(e,r,n){!n&&t.isAndroid()&&this.validateKey(e,e.data,r)},onKeyPress:function(e,r,n){n||t.isAndroid()||e.ctrlKey||e.altKey||this.validateKey(e,e.key,r)},onPaste:function(t,e,o){if(!o){var u,l=this.getRegex(e),f=t.clipboardData.getData("text");(u=f,r(u)||n(u)||a(u)||i()).forEach((function(e){if(!l.test(e))return t.preventDefault(),!1}))}},validateKey:function(t,e,r){null!=e&&(1===e.length&&(this.getRegex(r).test(e)||t.preventDefault()))},validate:function(t,e){var r=t.target.value,n=!0,a=this.getRegex(e);return r&&!a.test(r)&&(n=!1),n}};export{o as KeyFilter};
|
package/knob/knob.esm.js
DELETED
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { PrimeReactContext } from 'primereact/api';
|
|
5
|
-
import { useEventListener } from 'primereact/hooks';
|
|
6
|
-
import { classNames, mergeProps } from 'primereact/utils';
|
|
7
|
-
import { ComponentBase, useHandleStyle } from 'primereact/componentbase';
|
|
8
|
-
|
|
9
|
-
function _arrayWithHoles(arr) {
|
|
10
|
-
if (Array.isArray(arr)) return arr;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function _iterableToArrayLimit(r, l) {
|
|
14
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
15
|
-
if (null != t) {
|
|
16
|
-
var e,
|
|
17
|
-
n,
|
|
18
|
-
i,
|
|
19
|
-
u,
|
|
20
|
-
a = [],
|
|
21
|
-
f = !0,
|
|
22
|
-
o = !1;
|
|
23
|
-
try {
|
|
24
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
25
|
-
if (Object(t) !== t) return;
|
|
26
|
-
f = !1;
|
|
27
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
28
|
-
} catch (r) {
|
|
29
|
-
o = !0, n = r;
|
|
30
|
-
} finally {
|
|
31
|
-
try {
|
|
32
|
-
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
|
33
|
-
} finally {
|
|
34
|
-
if (o) throw n;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return a;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function _arrayLikeToArray(arr, len) {
|
|
42
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
43
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
44
|
-
return arr2;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
48
|
-
if (!o) return;
|
|
49
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
50
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
51
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
52
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
53
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function _nonIterableRest() {
|
|
57
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function _slicedToArray(arr, i) {
|
|
61
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
var KnobBase = ComponentBase.extend({
|
|
65
|
-
defaultProps: {
|
|
66
|
-
__TYPE: 'Knob',
|
|
67
|
-
id: null,
|
|
68
|
-
style: null,
|
|
69
|
-
className: null,
|
|
70
|
-
value: null,
|
|
71
|
-
size: 100,
|
|
72
|
-
disabled: false,
|
|
73
|
-
readOnly: false,
|
|
74
|
-
showValue: true,
|
|
75
|
-
step: 1,
|
|
76
|
-
min: 0,
|
|
77
|
-
max: 100,
|
|
78
|
-
strokeWidth: 14,
|
|
79
|
-
name: null,
|
|
80
|
-
valueColor: 'var(--primary-color, Black)',
|
|
81
|
-
rangeColor: 'var(--surface-border, LightGray)',
|
|
82
|
-
textColor: 'var(--text-color-secondary, Black)',
|
|
83
|
-
valueTemplate: '{value}',
|
|
84
|
-
onChange: null,
|
|
85
|
-
children: undefined
|
|
86
|
-
},
|
|
87
|
-
css: {
|
|
88
|
-
classes: {
|
|
89
|
-
range: 'p-knob-range',
|
|
90
|
-
value: 'p-knob-value',
|
|
91
|
-
label: 'p-knob-text',
|
|
92
|
-
root: function root(_ref) {
|
|
93
|
-
var props = _ref.props;
|
|
94
|
-
return classNames('p-knob p-component', {
|
|
95
|
-
'p-disabled': props.disabled
|
|
96
|
-
}, props.className);
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
styles: "\n @keyframes dash-frame {\n 100% {\n stroke-dashoffset: 0;\n }\n }\n @layer primereact {\n .p-knob-range {\n fill: none;\n transition: stroke .1s ease-in;\n }\n .p-knob-value {\n animation-name: dash-frame;\n animation-fill-mode: forwards;\n fill: none;\n }\n .p-knob-text {\n font-size: 1.3rem;\n text-align: center;\n }\n }\n "
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
var radius = 40;
|
|
104
|
-
var midX = 50;
|
|
105
|
-
var midY = 50;
|
|
106
|
-
var minRadians = 4 * Math.PI / 3;
|
|
107
|
-
var maxRadians = -Math.PI / 3;
|
|
108
|
-
var Knob = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (inProps, ref) {
|
|
109
|
-
var context = React.useContext(PrimeReactContext);
|
|
110
|
-
var props = KnobBase.getProps(inProps, context);
|
|
111
|
-
var _KnobBase$setMetaData = KnobBase.setMetaData({
|
|
112
|
-
props: props
|
|
113
|
-
}),
|
|
114
|
-
ptm = _KnobBase$setMetaData.ptm,
|
|
115
|
-
cx = _KnobBase$setMetaData.cx,
|
|
116
|
-
isUnstyled = _KnobBase$setMetaData.isUnstyled;
|
|
117
|
-
useHandleStyle(KnobBase.css.styles, isUnstyled, {
|
|
118
|
-
name: 'knob'
|
|
119
|
-
});
|
|
120
|
-
var elementRef = React.useRef(null);
|
|
121
|
-
var enabled = !props.disabled && !props.readOnly;
|
|
122
|
-
var _useEventListener = useEventListener({
|
|
123
|
-
target: 'window',
|
|
124
|
-
type: 'mousemove',
|
|
125
|
-
listener: function listener(event) {
|
|
126
|
-
updateValue(event.offsetX, event.offsetY);
|
|
127
|
-
event.preventDefault();
|
|
128
|
-
},
|
|
129
|
-
when: enabled
|
|
130
|
-
}),
|
|
131
|
-
_useEventListener2 = _slicedToArray(_useEventListener, 2),
|
|
132
|
-
bindWindowMouseMoveListener = _useEventListener2[0],
|
|
133
|
-
unbindWindowMouseMoveListener = _useEventListener2[1];
|
|
134
|
-
var _useEventListener3 = useEventListener({
|
|
135
|
-
target: 'window',
|
|
136
|
-
type: 'mouseup',
|
|
137
|
-
listener: function listener(event) {
|
|
138
|
-
unbindWindowMouseMoveListener();
|
|
139
|
-
unbindWindowMouseUpListener();
|
|
140
|
-
event.preventDefault();
|
|
141
|
-
},
|
|
142
|
-
when: enabled
|
|
143
|
-
}),
|
|
144
|
-
_useEventListener4 = _slicedToArray(_useEventListener3, 2),
|
|
145
|
-
bindWindowMouseUpListener = _useEventListener4[0],
|
|
146
|
-
unbindWindowMouseUpListener = _useEventListener4[1];
|
|
147
|
-
var _useEventListener5 = useEventListener({
|
|
148
|
-
target: 'window',
|
|
149
|
-
type: 'touchmove',
|
|
150
|
-
listener: function listener(event) {
|
|
151
|
-
if (event.touches.length === 1) {
|
|
152
|
-
var rect = elementRef.current.getBoundingClientRect();
|
|
153
|
-
var touch = event.targetTouches.item(0);
|
|
154
|
-
var offsetX = touch.clientX - rect.left;
|
|
155
|
-
var offsetY = touch.clientY - rect.top;
|
|
156
|
-
updateValue(offsetX, offsetY);
|
|
157
|
-
event.preventDefault();
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
when: enabled
|
|
161
|
-
}),
|
|
162
|
-
_useEventListener6 = _slicedToArray(_useEventListener5, 2),
|
|
163
|
-
bindWindowTouchMoveListener = _useEventListener6[0],
|
|
164
|
-
unbindWindowTouchMoveListener = _useEventListener6[1];
|
|
165
|
-
var _useEventListener7 = useEventListener({
|
|
166
|
-
target: 'window',
|
|
167
|
-
type: 'touchend',
|
|
168
|
-
listener: function listener() {
|
|
169
|
-
unbindWindowTouchMoveListener();
|
|
170
|
-
unbindWindowTouchEndListener();
|
|
171
|
-
},
|
|
172
|
-
when: enabled
|
|
173
|
-
}),
|
|
174
|
-
_useEventListener8 = _slicedToArray(_useEventListener7, 2),
|
|
175
|
-
bindWindowTouchEndListener = _useEventListener8[0],
|
|
176
|
-
unbindWindowTouchEndListener = _useEventListener8[1];
|
|
177
|
-
var mapRange = function mapRange(x, inMin, inMax, outMin, outMax) {
|
|
178
|
-
return (x - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
|
|
179
|
-
};
|
|
180
|
-
var zeroRadians = function zeroRadians() {
|
|
181
|
-
return mapRange(props.min > 0 && props.max > 0 ? props.min : 0, props.min, props.max, minRadians, maxRadians);
|
|
182
|
-
};
|
|
183
|
-
var valueRadians = function valueRadians() {
|
|
184
|
-
return mapRange(props.value, props.min, props.max, minRadians, maxRadians);
|
|
185
|
-
};
|
|
186
|
-
var minX = function minX() {
|
|
187
|
-
return midX + Math.cos(minRadians) * radius;
|
|
188
|
-
};
|
|
189
|
-
var minY = function minY() {
|
|
190
|
-
return midY - Math.sin(minRadians) * radius;
|
|
191
|
-
};
|
|
192
|
-
var maxX = function maxX() {
|
|
193
|
-
return midX + Math.cos(maxRadians) * radius;
|
|
194
|
-
};
|
|
195
|
-
var maxY = function maxY() {
|
|
196
|
-
return midY - Math.sin(maxRadians) * radius;
|
|
197
|
-
};
|
|
198
|
-
var zeroX = function zeroX() {
|
|
199
|
-
return midX + Math.cos(zeroRadians()) * radius;
|
|
200
|
-
};
|
|
201
|
-
var zeroY = function zeroY() {
|
|
202
|
-
return midY - Math.sin(zeroRadians()) * radius;
|
|
203
|
-
};
|
|
204
|
-
var valueX = function valueX() {
|
|
205
|
-
return midX + Math.cos(valueRadians()) * radius;
|
|
206
|
-
};
|
|
207
|
-
var valueY = function valueY() {
|
|
208
|
-
return midY - Math.sin(valueRadians()) * radius;
|
|
209
|
-
};
|
|
210
|
-
var largeArc = function largeArc() {
|
|
211
|
-
return Math.abs(zeroRadians() - valueRadians()) < Math.PI ? 0 : 1;
|
|
212
|
-
};
|
|
213
|
-
var sweep = function sweep() {
|
|
214
|
-
return valueRadians() > zeroRadians() ? 0 : 1;
|
|
215
|
-
};
|
|
216
|
-
var rangePath = "M ".concat(minX(), " ").concat(minY(), " A ").concat(radius, " ").concat(radius, " 0 1 1 ").concat(maxX(), " ").concat(maxY());
|
|
217
|
-
var valuePath = "M ".concat(zeroX(), " ").concat(zeroY(), " A ").concat(radius, " ").concat(radius, " 0 ").concat(largeArc(), " ").concat(sweep(), " ").concat(valueX(), " ").concat(valueY());
|
|
218
|
-
var valueToDisplay = function valueToDisplay() {
|
|
219
|
-
return props.valueTemplate.replace('{value}', props.value.toString());
|
|
220
|
-
};
|
|
221
|
-
var updateValue = function updateValue(offsetX, offsetY) {
|
|
222
|
-
var dx = offsetX - props.size / 2;
|
|
223
|
-
var dy = props.size / 2 - offsetY;
|
|
224
|
-
var angle = Math.atan2(dy, dx);
|
|
225
|
-
var start = -Math.PI / 2 - Math.PI / 6;
|
|
226
|
-
updateModel(angle, start);
|
|
227
|
-
};
|
|
228
|
-
var updateModel = function updateModel(angle, start) {
|
|
229
|
-
var mappedValue;
|
|
230
|
-
if (angle > maxRadians) mappedValue = mapRange(angle, minRadians, maxRadians, props.min, props.max);else if (angle < start) mappedValue = mapRange(angle + 2 * Math.PI, minRadians, maxRadians, props.min, props.max);else return;
|
|
231
|
-
if (props.onChange) {
|
|
232
|
-
props.onChange({
|
|
233
|
-
value: Math.round((mappedValue - props.min) / props.step) * props.step + props.min
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
var _onClick = function onClick(event) {
|
|
238
|
-
if (!props.disabled && !props.readOnly) {
|
|
239
|
-
updateValue(event.nativeEvent.offsetX, event.nativeEvent.offsetY);
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
var _onMouseDown = function onMouseDown(event) {
|
|
243
|
-
bindWindowMouseMoveListener();
|
|
244
|
-
bindWindowMouseUpListener();
|
|
245
|
-
event.preventDefault();
|
|
246
|
-
};
|
|
247
|
-
var _onMouseUp = function onMouseUp() {
|
|
248
|
-
unbindWindowMouseMoveListener();
|
|
249
|
-
unbindWindowMouseUpListener();
|
|
250
|
-
};
|
|
251
|
-
var _onTouchStart = function onTouchStart() {
|
|
252
|
-
bindWindowTouchMoveListener();
|
|
253
|
-
bindWindowTouchEndListener();
|
|
254
|
-
};
|
|
255
|
-
var _onTouchEnd = function onTouchEnd() {
|
|
256
|
-
unbindWindowTouchMoveListener();
|
|
257
|
-
unbindWindowTouchEndListener();
|
|
258
|
-
};
|
|
259
|
-
React.useImperativeHandle(ref, function () {
|
|
260
|
-
return {
|
|
261
|
-
props: props,
|
|
262
|
-
getElement: function getElement() {
|
|
263
|
-
return elementRef.current;
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
});
|
|
267
|
-
var labelProps = mergeProps({
|
|
268
|
-
x: 50,
|
|
269
|
-
y: 57,
|
|
270
|
-
textAnchor: 'middle',
|
|
271
|
-
fill: props.textColor,
|
|
272
|
-
className: cx('label'),
|
|
273
|
-
name: props.name
|
|
274
|
-
}, ptm('label'));
|
|
275
|
-
var text = props.showValue && /*#__PURE__*/React.createElement("text", labelProps, valueToDisplay());
|
|
276
|
-
var rootProps = mergeProps({
|
|
277
|
-
ref: elementRef,
|
|
278
|
-
id: props.id,
|
|
279
|
-
className: cx('root'),
|
|
280
|
-
style: props.style
|
|
281
|
-
}, ptm('root'));
|
|
282
|
-
var svgProps = mergeProps({
|
|
283
|
-
viewBox: '0 0 100 100',
|
|
284
|
-
width: props.size,
|
|
285
|
-
height: props.size,
|
|
286
|
-
onClick: function onClick(e) {
|
|
287
|
-
return _onClick(e);
|
|
288
|
-
},
|
|
289
|
-
onMouseDown: function onMouseDown(e) {
|
|
290
|
-
return _onMouseDown(e);
|
|
291
|
-
},
|
|
292
|
-
onMouseUp: function onMouseUp(e) {
|
|
293
|
-
return _onMouseUp();
|
|
294
|
-
},
|
|
295
|
-
onTouchStart: function onTouchStart(e) {
|
|
296
|
-
return _onTouchStart();
|
|
297
|
-
},
|
|
298
|
-
onTouchEnd: function onTouchEnd(e) {
|
|
299
|
-
return _onTouchEnd();
|
|
300
|
-
}
|
|
301
|
-
}, ptm('svg'));
|
|
302
|
-
var rangeProps = mergeProps({
|
|
303
|
-
d: rangePath,
|
|
304
|
-
strokeWidth: props.strokeWidth,
|
|
305
|
-
stroke: props.rangeColor,
|
|
306
|
-
className: cx('range')
|
|
307
|
-
}, ptm('range'));
|
|
308
|
-
var valueProps = mergeProps({
|
|
309
|
-
d: valuePath,
|
|
310
|
-
strokeWidth: props.strokeWidth,
|
|
311
|
-
stroke: props.valueColor,
|
|
312
|
-
className: cx('value')
|
|
313
|
-
}, ptm('value'));
|
|
314
|
-
return /*#__PURE__*/React.createElement("div", rootProps, /*#__PURE__*/React.createElement("svg", svgProps, /*#__PURE__*/React.createElement("path", rangeProps), /*#__PURE__*/React.createElement("path", valueProps), text));
|
|
315
|
-
}));
|
|
316
|
-
Knob.displayName = 'Knob';
|
|
317
|
-
|
|
318
|
-
export { Knob };
|
package/knob/knob.esm.min.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import*as e from"react";import{PrimeReactContext as t}from"primereact/api";import{useEventListener as n}from"primereact/hooks";import{classNames as r,mergeProps as a}from"primereact/utils";import{ComponentBase as o,useHandleStyle as i}from"primereact/componentbase";function l(e){if(Array.isArray(e))return e}function c(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,l=[],c=!0,s=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=o.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,a=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw a}}return l}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function u(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function m(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(e,t){return l(e)||c(e,t)||u(e,t)||m()}var d=o.extend({defaultProps:{__TYPE:"Knob",id:null,style:null,className:null,value:null,size:100,disabled:!1,readOnly:!1,showValue:!0,step:1,min:0,max:100,strokeWidth:14,name:null,valueColor:"var(--primary-color, Black)",rangeColor:"var(--surface-border, LightGray)",textColor:"var(--text-color-secondary, Black)",valueTemplate:"{value}",onChange:null,children:void 0},css:{classes:{range:"p-knob-range",value:"p-knob-value",label:"p-knob-text",root:function(e){var t=e.props;return r("p-knob p-component",{"p-disabled":t.disabled},t.className)}},styles:"\n @keyframes dash-frame {\n 100% {\n stroke-dashoffset: 0;\n }\n }\n @layer primereact {\n .p-knob-range {\n fill: none;\n transition: stroke .1s ease-in;\n }\n .p-knob-value {\n animation-name: dash-frame;\n animation-fill-mode: forwards;\n fill: none;\n }\n .p-knob-text {\n font-size: 1.3rem;\n text-align: center;\n }\n }\n "}}),p=40,h=4*Math.PI/3,v=-Math.PI/3,y=e.memo(e.forwardRef((function(r,o){var l=e.useContext(t),c=d.getProps(r,l),s=d.setMetaData({props:c}),u=s.ptm,m=s.cx;i(d.css.styles,s.isUnstyled,{name:"knob"});var y=e.useRef(null),b=!c.disabled&&!c.readOnly,g=f(n({target:"window",type:"mousemove",listener:function(e){W(e.offsetX,e.offsetY),e.preventDefault()},when:b}),2),w=g[0],M=g[1],k=f(n({target:"window",type:"mouseup",listener:function(e){M(),C(),e.preventDefault()},when:b}),2),x=k[0],C=k[1],E=f(n({target:"window",type:"touchmove",listener:function(e){if(1===e.touches.length){var t=y.current.getBoundingClientRect(),n=e.targetTouches.item(0);W(n.clientX-t.left,n.clientY-t.top),e.preventDefault()}},when:b}),2),I=E[0],A=E[1],P=f(n({target:"window",type:"touchend",listener:function(){A(),O()},when:b}),2),N=P[0],O=P[1],S=function(e,t,n,r,a){return(e-t)*(a-r)/(n-t)+r},T=function(){return S(c.min>0&&c.max>0?c.min:0,c.min,c.max,h,v)},z=function(){return S(c.value,c.min,c.max,h,v)},D="M ".concat(50+Math.cos(h)*p," ").concat(50-Math.sin(h)*p," A ").concat(p," ").concat(p," 0 1 1 ").concat(50+Math.cos(v)*p," ").concat(50-Math.sin(v)*p),j="M ".concat(50+Math.cos(T())*p," ").concat(50-Math.sin(T())*p," A ").concat(p," ").concat(p," 0 ").concat(Math.abs(T()-z())<Math.PI?0:1," ").concat(z()>T()?0:1," ").concat(50+Math.cos(z())*p," ").concat(50-Math.sin(z())*p),W=function(e,t){var n=Math.atan2(c.size/2-t,e-c.size/2),r=-Math.PI/2-Math.PI/6;B(n,r)},B=function(e,t){var n;if(e>v)n=S(e,h,v,c.min,c.max);else{if(!(e<t))return;n=S(e+2*Math.PI,h,v,c.min,c.max)}c.onChange&&c.onChange({value:Math.round((n-c.min)/c.step)*c.step+c.min})};e.useImperativeHandle(o,(function(){return{props:c,getElement:function(){return y.current}}}));var Y=a({x:50,y:57,textAnchor:"middle",fill:c.textColor,className:m("label"),name:c.name},u("label")),R=c.showValue&&e.createElement("text",Y,c.valueTemplate.replace("{value}",c.value.toString())),U=a({ref:y,id:c.id,className:m("root"),style:c.style},u("root")),X=a({viewBox:"0 0 100 100",width:c.size,height:c.size,onClick:function(e){return t=e,void(c.disabled||c.readOnly||W(t.nativeEvent.offsetX,t.nativeEvent.offsetY));var t},onMouseDown:function(e){return t=e,w(),x(),void t.preventDefault();var t},onMouseUp:function(e){return M(),void C()},onTouchStart:function(e){return I(),void N()},onTouchEnd:function(e){return A(),void O()}},u("svg")),K=a({d:D,strokeWidth:c.strokeWidth,stroke:c.rangeColor,className:m("range")},u("range")),V=a({d:j,strokeWidth:c.strokeWidth,stroke:c.valueColor,className:m("value")},u("value"));return e.createElement("div",U,e.createElement("svg",X,e.createElement("path",K),e.createElement("path",V),R))})));y.displayName="Knob";export{y as Knob};
|