@teselagen/ui 0.6.1 → 0.6.2
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/TgSelect/index.d.ts +0 -1
- package/index.cjs.js +23 -15
- package/index.es.js +24 -16
- package/package.json +1 -1
- package/src/TgSelect/index.js +20 -12
package/TgSelect/index.d.ts
CHANGED
|
@@ -6,5 +6,4 @@ export function createNewOption(newValString: any): {
|
|
|
6
6
|
export function simplesearch(needle: any, haystack: any): boolean;
|
|
7
7
|
declare function _default(props: any): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export default _default;
|
|
9
|
-
export function renderCreateNewOption(query: any, active: any, handleClick: any): import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export function itemListPredicate(_queryString: string | undefined, items: any, isSimpleSearch: any): any;
|
package/index.cjs.js
CHANGED
|
@@ -37076,6 +37076,26 @@ const _TgSelect = class _TgSelect extends React$1.Component {
|
|
|
37076
37076
|
}
|
|
37077
37077
|
return optionRenderer;
|
|
37078
37078
|
}, "getOptionRenderer"));
|
|
37079
|
+
__publicField(this, "renderCreateNewOption", /* @__PURE__ */ __name((query, active3, handleClick) => {
|
|
37080
|
+
if (this.props.renderCreateNewOption) {
|
|
37081
|
+
return this.props.renderCreateNewOption(query, active3, handleClick);
|
|
37082
|
+
}
|
|
37083
|
+
return /* @__PURE__ */ React$1.createElement(
|
|
37084
|
+
core.MenuItem,
|
|
37085
|
+
{
|
|
37086
|
+
icon: "add",
|
|
37087
|
+
text: `Create "${query}"`,
|
|
37088
|
+
active: active3,
|
|
37089
|
+
onClick: (...args) => {
|
|
37090
|
+
const shouldStopEarly = this.props.onCreateNewOption(query);
|
|
37091
|
+
if (!shouldStopEarly) {
|
|
37092
|
+
handleClick(...args);
|
|
37093
|
+
}
|
|
37094
|
+
},
|
|
37095
|
+
shouldDismissPopover: false
|
|
37096
|
+
}
|
|
37097
|
+
);
|
|
37098
|
+
}, "renderCreateNewOption"));
|
|
37079
37099
|
const { autoOpen = false } = this.props;
|
|
37080
37100
|
this.state = {
|
|
37081
37101
|
isOpen: autoOpen,
|
|
@@ -37111,8 +37131,7 @@ const _TgSelect = class _TgSelect extends React$1.Component {
|
|
|
37111
37131
|
disabled,
|
|
37112
37132
|
popoverProps,
|
|
37113
37133
|
additionalRightEl,
|
|
37114
|
-
resetOnSelect = true
|
|
37115
|
-
renderCreateNewOption: _renderCreateNewOption = renderCreateNewOption$1
|
|
37134
|
+
resetOnSelect = true
|
|
37116
37135
|
} = _a2, rest = __objRest(_a2, [
|
|
37117
37136
|
"multi",
|
|
37118
37137
|
"asTag",
|
|
@@ -37140,8 +37159,7 @@ const _TgSelect = class _TgSelect extends React$1.Component {
|
|
|
37140
37159
|
"disabled",
|
|
37141
37160
|
"popoverProps",
|
|
37142
37161
|
"additionalRightEl",
|
|
37143
|
-
"resetOnSelect"
|
|
37144
|
-
"renderCreateNewOption"
|
|
37162
|
+
"resetOnSelect"
|
|
37145
37163
|
]);
|
|
37146
37164
|
if (asTag) {
|
|
37147
37165
|
small = true;
|
|
@@ -37180,7 +37198,7 @@ const _TgSelect = class _TgSelect extends React$1.Component {
|
|
|
37180
37198
|
}
|
|
37181
37199
|
));
|
|
37182
37200
|
const maybeCreateNewItemFromQuery = creatable ? createNewOption : void 0;
|
|
37183
|
-
const maybeCreateNewItemRenderer = creatable && !this.queryHasExactOptionMatch() ?
|
|
37201
|
+
const maybeCreateNewItemRenderer = creatable && !this.queryHasExactOptionMatch() ? this.renderCreateNewOption : null;
|
|
37184
37202
|
const selectedItems = getValueArray(value).map((value2) => {
|
|
37185
37203
|
if (value2 && value2.label)
|
|
37186
37204
|
return value2;
|
|
@@ -37319,16 +37337,6 @@ const TgSelect$1 = redux.compose(
|
|
|
37319
37337
|
)(TgSelect);
|
|
37320
37338
|
const itemDisabled = /* @__PURE__ */ __name((i) => i.disabled, "itemDisabled");
|
|
37321
37339
|
const noResultsDefault = /* @__PURE__ */ React$1.createElement("div", null, "No Results...");
|
|
37322
|
-
const renderCreateNewOption$1 = /* @__PURE__ */ __name((query, active3, handleClick) => /* @__PURE__ */ React$1.createElement(
|
|
37323
|
-
core.MenuItem,
|
|
37324
|
-
{
|
|
37325
|
-
icon: "add",
|
|
37326
|
-
text: `Create "${query}"`,
|
|
37327
|
-
active: active3,
|
|
37328
|
-
onClick: handleClick,
|
|
37329
|
-
shouldDismissPopover: false
|
|
37330
|
-
}
|
|
37331
|
-
), "renderCreateNewOption$1");
|
|
37332
37340
|
function createNewOption(newValString) {
|
|
37333
37341
|
if (!newValString)
|
|
37334
37342
|
return;
|
package/index.es.js
CHANGED
|
@@ -58,7 +58,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
58
58
|
};
|
|
59
59
|
import * as React$1 from "react";
|
|
60
60
|
import React__default, { useState, useEffect, forwardRef, useImperativeHandle, Fragment, useMemo, useRef, useReducer, useCallback, memo, Component, PureComponent, createElement, useLayoutEffect, createContext, useContext, isValidElement } from "react";
|
|
61
|
-
import { Icon, Classes, Button, Intent,
|
|
61
|
+
import { Icon, Classes, Button, Intent, MenuItem, Keys, Tag, useHotkeys, Popover, Tooltip, Toaster, Position, Menu, MenuDivider, NumericInput, InputGroup, Spinner, FormGroup, TextArea, Checkbox, Switch, EditableText, RadioGroup, Callout, ContextMenu, Dialog, Card, Tabs, Tab, Colors, Overlay, KeyCombo, ProgressBar } from "@blueprintjs/core";
|
|
62
62
|
import ReactDOM, { unstable_batchedUpdates, createPortal } from "react-dom";
|
|
63
63
|
import { FormName, formValueSelector, change, Field, reduxForm, SubmissionError, destroy, initialize, Fields } from "redux-form";
|
|
64
64
|
import { connect, useStore } from "react-redux";
|
|
@@ -37058,6 +37058,26 @@ const _TgSelect = class _TgSelect extends React__default.Component {
|
|
|
37058
37058
|
}
|
|
37059
37059
|
return optionRenderer;
|
|
37060
37060
|
}, "getOptionRenderer"));
|
|
37061
|
+
__publicField(this, "renderCreateNewOption", /* @__PURE__ */ __name((query, active3, handleClick) => {
|
|
37062
|
+
if (this.props.renderCreateNewOption) {
|
|
37063
|
+
return this.props.renderCreateNewOption(query, active3, handleClick);
|
|
37064
|
+
}
|
|
37065
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
37066
|
+
MenuItem,
|
|
37067
|
+
{
|
|
37068
|
+
icon: "add",
|
|
37069
|
+
text: `Create "${query}"`,
|
|
37070
|
+
active: active3,
|
|
37071
|
+
onClick: (...args) => {
|
|
37072
|
+
const shouldStopEarly = this.props.onCreateNewOption(query);
|
|
37073
|
+
if (!shouldStopEarly) {
|
|
37074
|
+
handleClick(...args);
|
|
37075
|
+
}
|
|
37076
|
+
},
|
|
37077
|
+
shouldDismissPopover: false
|
|
37078
|
+
}
|
|
37079
|
+
);
|
|
37080
|
+
}, "renderCreateNewOption"));
|
|
37061
37081
|
const { autoOpen = false } = this.props;
|
|
37062
37082
|
this.state = {
|
|
37063
37083
|
isOpen: autoOpen,
|
|
@@ -37093,8 +37113,7 @@ const _TgSelect = class _TgSelect extends React__default.Component {
|
|
|
37093
37113
|
disabled,
|
|
37094
37114
|
popoverProps,
|
|
37095
37115
|
additionalRightEl,
|
|
37096
|
-
resetOnSelect = true
|
|
37097
|
-
renderCreateNewOption: _renderCreateNewOption = renderCreateNewOption$1
|
|
37116
|
+
resetOnSelect = true
|
|
37098
37117
|
} = _a2, rest = __objRest(_a2, [
|
|
37099
37118
|
"multi",
|
|
37100
37119
|
"asTag",
|
|
@@ -37122,8 +37141,7 @@ const _TgSelect = class _TgSelect extends React__default.Component {
|
|
|
37122
37141
|
"disabled",
|
|
37123
37142
|
"popoverProps",
|
|
37124
37143
|
"additionalRightEl",
|
|
37125
|
-
"resetOnSelect"
|
|
37126
|
-
"renderCreateNewOption"
|
|
37144
|
+
"resetOnSelect"
|
|
37127
37145
|
]);
|
|
37128
37146
|
if (asTag) {
|
|
37129
37147
|
small = true;
|
|
@@ -37162,7 +37180,7 @@ const _TgSelect = class _TgSelect extends React__default.Component {
|
|
|
37162
37180
|
}
|
|
37163
37181
|
));
|
|
37164
37182
|
const maybeCreateNewItemFromQuery = creatable ? createNewOption : void 0;
|
|
37165
|
-
const maybeCreateNewItemRenderer = creatable && !this.queryHasExactOptionMatch() ?
|
|
37183
|
+
const maybeCreateNewItemRenderer = creatable && !this.queryHasExactOptionMatch() ? this.renderCreateNewOption : null;
|
|
37166
37184
|
const selectedItems = getValueArray(value).map((value2) => {
|
|
37167
37185
|
if (value2 && value2.label)
|
|
37168
37186
|
return value2;
|
|
@@ -37301,16 +37319,6 @@ const TgSelect$1 = compose$1(
|
|
|
37301
37319
|
)(TgSelect);
|
|
37302
37320
|
const itemDisabled = /* @__PURE__ */ __name((i) => i.disabled, "itemDisabled");
|
|
37303
37321
|
const noResultsDefault = /* @__PURE__ */ React__default.createElement("div", null, "No Results...");
|
|
37304
|
-
const renderCreateNewOption$1 = /* @__PURE__ */ __name((query, active3, handleClick) => /* @__PURE__ */ React__default.createElement(
|
|
37305
|
-
MenuItem,
|
|
37306
|
-
{
|
|
37307
|
-
icon: "add",
|
|
37308
|
-
text: `Create "${query}"`,
|
|
37309
|
-
active: active3,
|
|
37310
|
-
onClick: handleClick,
|
|
37311
|
-
shouldDismissPopover: false
|
|
37312
|
-
}
|
|
37313
|
-
), "renderCreateNewOption$1");
|
|
37314
37322
|
function createNewOption(newValString) {
|
|
37315
37323
|
if (!newValString)
|
|
37316
37324
|
return;
|
package/package.json
CHANGED
package/src/TgSelect/index.js
CHANGED
|
@@ -221,6 +221,25 @@ class TgSelect extends React.Component {
|
|
|
221
221
|
}
|
|
222
222
|
return optionRenderer;
|
|
223
223
|
};
|
|
224
|
+
renderCreateNewOption = (query, active, handleClick) => {
|
|
225
|
+
if (this.props.renderCreateNewOption) {
|
|
226
|
+
return this.props.renderCreateNewOption(query, active, handleClick);
|
|
227
|
+
}
|
|
228
|
+
return (
|
|
229
|
+
<MenuItem
|
|
230
|
+
icon="add"
|
|
231
|
+
text={`Create "${query}"`}
|
|
232
|
+
active={active}
|
|
233
|
+
onClick={(...args) => {
|
|
234
|
+
const shouldStopEarly = this.props.onCreateNewOption(query);
|
|
235
|
+
if (!shouldStopEarly) {
|
|
236
|
+
handleClick(...args);
|
|
237
|
+
}
|
|
238
|
+
}}
|
|
239
|
+
shouldDismissPopover={false}
|
|
240
|
+
/>
|
|
241
|
+
);
|
|
242
|
+
};
|
|
224
243
|
|
|
225
244
|
render() {
|
|
226
245
|
let {
|
|
@@ -250,7 +269,6 @@ class TgSelect extends React.Component {
|
|
|
250
269
|
popoverProps,
|
|
251
270
|
additionalRightEl,
|
|
252
271
|
resetOnSelect = true,
|
|
253
|
-
renderCreateNewOption: _renderCreateNewOption = renderCreateNewOption,
|
|
254
272
|
...rest
|
|
255
273
|
} = this.props;
|
|
256
274
|
if (asTag) {
|
|
@@ -304,7 +322,7 @@ class TgSelect extends React.Component {
|
|
|
304
322
|
const maybeCreateNewItemFromQuery = creatable ? createNewOption : undefined;
|
|
305
323
|
const maybeCreateNewItemRenderer =
|
|
306
324
|
creatable && !this.queryHasExactOptionMatch()
|
|
307
|
-
?
|
|
325
|
+
? this.renderCreateNewOption
|
|
308
326
|
: null;
|
|
309
327
|
const selectedItems = getValueArray(value).map(value => {
|
|
310
328
|
if (value && value.label) return value; //if the value has a label, just use that
|
|
@@ -458,16 +476,6 @@ export default compose(
|
|
|
458
476
|
const itemDisabled = i => i.disabled;
|
|
459
477
|
const noResultsDefault = <div>No Results...</div>;
|
|
460
478
|
|
|
461
|
-
export const renderCreateNewOption = (query, active, handleClick) => (
|
|
462
|
-
<MenuItem
|
|
463
|
-
icon="add"
|
|
464
|
-
text={`Create "${query}"`}
|
|
465
|
-
active={active}
|
|
466
|
-
onClick={handleClick}
|
|
467
|
-
shouldDismissPopover={false}
|
|
468
|
-
/>
|
|
469
|
-
);
|
|
470
|
-
|
|
471
479
|
export function createNewOption(newValString) {
|
|
472
480
|
if (!newValString) return;
|
|
473
481
|
return {
|