4.12.99 • Published 1 year ago

@hishprorg/autem-sint-quas v4.12.99

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@hishprorg/autem-sint-quas

Common Utils For React Component.

NPM version npm download build status Codecov bundle size dumi

Install

@hishprorg/autem-sint-quas

API

createChainedFunction

(...functions): Function

Create a function which will call all the functions with it's arguments from left to right.

import createChainedFunction from '@hishprorg/autem-sint-quas/lib/createChainedFunction';

deprecated

(prop: string, instead: string, component: string): void

Log an error message to warn developers that prop is deprecated.

import deprecated from '@hishprorg/autem-sint-quas/lib/deprecated';

getContainerRenderMixin

(config: Object): Object

To generate a mixin which will render specific component into specific container automatically.

import getContainerRenderMixin from '@hishprorg/autem-sint-quas/lib/getContainerRenderMixin';

Fields in config and their meanings.

FieldTypeDescriptionDefault
autoMountbooleanWhether to render component into container automaticallytrue
autoDestroybooleanWhether to remove container automatically while the component is unmountedtrue
isVisible(instance): booleanA function to get current visibility of the component-
isForceRender(instance): booleanA function to determine whether to render popup even it's not visible-
getComponent(instance, extra): ReactNodeA function to get the component which will be rendered into container-
getContainer(instance): HTMLElementA function to get the container

Portal

Render children to the specific container;

import Portal from '@hishprorg/autem-sint-quas/lib/Portal';

Props:

PropTypeDescriptionDefault
childrenReactChildrenContent render to the container-
getContainer(): HTMLElementA function to get the container-

getScrollBarSize

(fresh?: boolean): number

Get the width of scrollbar.

import getScrollBarSize from '@hishprorg/autem-sint-quas/lib/getScrollBarSize';

guid

(): string

To generate a global unique id across current application.

import guid from '@hishprorg/autem-sint-quas/lib/guid';

pickAttrs

(props: Object): Object

Pick valid HTML attributes and events from props.

import pickAttrs from '@hishprorg/autem-sint-quas/lib/pickAttrs';

warn

(msg: string): void

A shallow wrapper of console.warn.

import warn from '@hishprorg/autem-sint-quas/lib/warn';

warning

(valid: boolean, msg: string): void

A shallow wrapper of warning, but only warning once for the same message.

import warning, { noteOnce } from '@hishprorg/autem-sint-quas/lib/warning';

warning(false, '[antd Component] test hello world');

// Low level note
noteOnce(false, '[antd Component] test hello world');

Children

A collection of functions to operate React elements' children.

Children/mapSelf

(children): children

Return a shallow copy of children.

import mapSelf from '@hishprorg/autem-sint-quas/lib/Children/mapSelf';

Children/toArray

(children: ReactNode[]): ReactNode[]

Convert children into an array.

import toArray from '@hishprorg/autem-sint-quas/lib/Children/toArray';

Dom

A collection of functions to operate DOM elements.

Dom/addEventlistener

(target: ReactNode, eventType: string, listener: Function): { remove: Function }

A shallow wrapper of add-dom-event-listener.

import addEventlistener from '@hishprorg/autem-sint-quas/lib/Dom/addEventlistener';

Dom/canUseDom

(): boolean

Check if DOM is available.

import canUseDom from '@hishprorg/autem-sint-quas/lib/Dom/canUseDom';

Dom/class

A collection of functions to operate DOM nodes' class name.

  • hasClass(node: HTMLElement, className: string): boolean
  • addClass(node: HTMLElement, className: string): void
  • removeClass(node: HTMLElement, className: string): void
import cssClass from '@hishprorg/autem-sint-quas/lib/Dom/class;

Dom/contains

(root: HTMLElement, node: HTMLElement): boolean

Check if node is equal to root or in the subtree of root.

import contains from '@hishprorg/autem-sint-quas/lib/Dom/contains';

Dom/css

A collection of functions to get or set css styles.

  • get(node: HTMLElement, name?: string): any
  • set(node: HTMLElement, name?: string, value: any) | set(node, object)
  • getOuterWidth(el: HTMLElement): number
  • getOuterHeight(el: HTMLElement): number
  • getDocSize(): { width: number, height: number }
  • getClientSize(): { width: number, height: number }
  • getScroll(): { scrollLeft: number, scrollTop: number }
  • getOffset(node: HTMLElement): { left: number, top: number }
import css from '@hishprorg/autem-sint-quas/lib/Dom/css';

Dom/focus

A collection of functions to operate focus status of DOM node.

  • saveLastFocusNode(): void
  • clearLastFocusNode(): void
  • backLastFocusNode(): void
  • getFocusNodeList(node: HTMLElement): HTMLElement[] get a list of focusable nodes from the subtree of node.
  • limitTabRange(node: HTMLElement, e: Event): void
import focus from '@hishprorg/autem-sint-quas/lib/Dom/focus';

Dom/support

{ animation: boolean | Object, transition: boolean | Object }

A flag to tell whether current environment supports animationend or transitionend.

import support from '@hishprorg/autem-sint-quas/lib/Dom/support';

KeyCode

Enum

Enum of KeyCode, please check the definition of it.

import KeyCode from '@hishprorg/autem-sint-quas/lib/KeyCode';

KeyCode.isTextModifyingKeyEvent

(e: Event): boolean

Whether text and modified key is entered at the same time.

KeyCode.isCharacterKey

(keyCode: KeyCode): boolean

Whether character is entered.

ScrollLocker

ScrollLocker<{lock: (options: {container: HTMLElement}) => void, unLock: () => void}>

improve shake when page scroll bar hidden.

ScrollLocker change body style, and add a class ant-scrolling-effect when called, so if you page look abnormal, please check this;

import ScrollLocker from '@hishprorg/autem-sint-quas/lib/Dom/scrollLocker';

const scrollLocker = new ScrollLocker();

// lock
scrollLocker.lock()

// unLock
scrollLocker.unLock()

License

MIT

configinputfpsfullwidthfastcopyjsxYAMLtrimRightObservablesjoirapidcopyesfile systemES3formweakmapargparsedirectoryhastypedarraysInt8ArraysetterfastFunction.prototype.namesetdroputil.inspectmergeschemecolourRxwgetconsumerequestReactiveExtensionsString.prototype.trimshebangescapetypesiamquerystringspinnersWebSocketsbundlereventDispatchercensorinternaltrimES8vpcdeepefficientsettingsObject.assigntoArrayslicecacheroute53flattencloudtrailcryptoECMAScript 7ESbluebirdlimitedtakestableextendrecursivejavascriptcharactersreact-hook-formArrayBuffertypeerrorless compilerformsrmJSONlookttyyupes-abstractforEachsafeECMAScript 2021urldatastoragegatewaywritablergbratelimitopentestisstylesheetInt16Arrayoffsetfunctionkeysmulti-package0elasticacheES2016elmUint8ArraygraphqlmruassertionBigUint64ArraygroupByObject.valuesstylesnscodesstringifierpackage managerdefineqslessargsprivateconnectkinesisprettyserializesymlinkdeep-copyfindenvironmentowngetPrototypeOfcode pointsslotregularnested cssgradients cssiterationoptimizergetterSetdom-testing-librarypackage.jsonvalidatelook-upcreateruntimemodulesaccessorcolumnstypanionworkflowprogresseveryframeworkpackagescoreerrorURLSearchParamspolyfilltypescriptlibphonenumbermkdirES2019arktypeprivate datadefinePropertydescriptionlocationgenericshookformintrinsicrequireECMAScript 2022argvdataViewasyncglobcoerciblekoreanphonehardlinksESnextcloudfrontamazonuuidwhichmetadatafunctionselectronwarningECMAScript 3i18ncompareECMAScript 2015BigInt64ArraytraverseautoprefixernpmeventEmitterchromiumECMAScript 6awsworkertoobjectregexspeedemojies2016has-ownbeanstalksharedarraybufferoptimistFloat32Arraydatastructurezeroreadablestreameslintoutputpromisescss less-0limitmime-dbchannelcomputed-typesfiltercharacterlasttypeoffastifydataviewbrowserslistpluginpositivevalidationsyntaxsameValueZerogetoptcompilerzodcore-jshigher-orderfoldertoolsreal-timeimportexportec2shimbusyfigletcolorstc39modulesortTypedArrayredirectbannerrm -frcloudwatchtyperedactdependency managerterminalimmergetOwnPropertyDescriptores2017ArrayECMAScript 2018Observableecmascripttslibes-shimsmimetypescircularenumerableconsolefindupsetImmediateajaxArray.prototype.flatcompile lessspinnerCSSStyleDeclarationpersistentECMAScript 2023ArrayBuffer#slicejsdiffartautoscalingbrowserlistcommandUnderscorenegativeutilitiesconcatclassnamestoStringTagsharedgetfulltddweaksetstringifydomflagscallboundserializationcrypttrimEndURLstreams2findLastes7east-asian-widthquoteswfconfigurableES2020variablesparsermdirstylesdeletedirs3es2015dateinvariant256hasOwnPropertystructuredCloneWebSocketchromeES2021agentsidereusefast-cloneequality@@toStringTagkeycommanderobjectstreamonceexechasOwnassignstarter.envJSON-Schemareducermixinswatchingnumberratewaitcollectionxhrjapanesejasmineconcurrencypatchdeepcloneless.jsflagnopefswatchvariables in cssidleexpress
@hishprorg/ipsa-consectetur-minima@hishprorg/nemo-blanditiis@hishprorg/neque-laborum-vel@hishprorg/quis-quibusdam@hishprorg/quibusdam-dolores@hishprorg/quis-doloribus@hishprorg/quidem-delectus@hishprorg/quidem-et@hishprorg/quis-est@hishprorg/sed-nihil-iusto@hishprorg/sequi-inventore-labore@hishprorg/sed-sunt@hishprorg/temporibus-aliquam-neque@hishprorg/tempore-dolor-ut@hishprorg/accusantium-architecto@hishprorg/ad-labore-dolor@hishprorg/ad-minima@hishprorg/ad-soluta-et@hishprorg/accusantium-consectetur-incidunt@hishprorg/beatae-cumque@hishprorg/beatae-animi-commodi@hishprorg/autem-quo@hishprorg/debitis-quaerat@hishprorg/debitis-qui@hishprorg/cupiditate-ut@hishprorg/dolores-ut@hishprorg/et-esse-quasi@hishprorg/est-odio-laudantium@hishprorg/eum-eos@hishprorg/et-dicta-cum@hishprorg/eum-nihil-maiores@hishprorg/illo-voluptas@hishprorg/impedit-consectetur-dicta@hishprorg/architecto-sequi@hishprorg/architecto-sapiente@hishprorg/asperiores-hic@hishprorg/aspernatur-consequatur@hishprorg/asperiores-voluptates@hishprorg/asperiores-provident@hishprorg/consectetur-sunt@hishprorg/consectetur-ab@hishprorg/consectetur-dolores@hishprorg/deserunt-est@hishprorg/deserunt-velit-quod@hishprorg/deserunt-nihil@hishprorg/deserunt-deleniti@hishprorg/doloremque-soluta@hishprorg/doloremque-mollitia@hishprorg/dolore-suscipit@hishprorg/hic-omnis@hishprorg/hic-perferendis@hishprorg/fuga-repellat@hishprorg/fugiat-accusamus-laboriosam@hishprorg/fugiat-eius@hishprorg/fugiat-libero-itaque@hishprorg/aliquam-quibusdam-repudiandae@hishprorg/aliquid-delectus-nisi@hishprorg/aliquid-ut-debitis@hishprorg/alias-maiores-saepe@hishprorg/amet-qui@hishprorg/beatae-officia@hishprorg/earum-occaecati@hishprorg/earum-inventore@hishprorg/earum-consectetur@hishprorg/esse-voluptates-veritatis@hishprorg/id-ab@hishprorg/id-harum@hishprorg/id-modi@hishprorg/id-dignissimos@hishprorg/id-voluptas@hishprorg/id-consequuntur@hishprorg/hic-repellendus-hic@hishprorg/illo-dolores@hishprorg/cumque-optio@hishprorg/cupiditate-quaerat-qui@hishprorg/doloribus-vero@hishprorg/dolorum-commodi-architecto@hishprorg/doloribus-reiciendis@hishprorg/doloribus-minima@hishprorg/dolorum-est@hishprorg/exercitationem-ipsum@hishprorg/distinctio-repudiandae-molestias@hishprorg/distinctio-alias@hishprorg/dignissimos-sunt-quaerat@hishprorg/distinctio-in@hishprorg/eos-enim-voluptate@hishprorg/eos-asperiores@hishprorg/eligendi-laborum@hishprorg/enim-fugiat-quas@hishprorg/eligendi-neque@hishprorg/eveniet-maxime@hishprorg/ex-tempora-libero@hishprorg/architecto-consectetur@hishprorg/culpa-ea-facilis@hishprorg/culpa-ratione-dolores@hishprorg/corrupti-voluptas@hishprorg/corrupti-vero@hishprorg/culpa-iusto-corrupti@hishprorg/dignissimos-enim-adipisci@hishprorg/dignissimos-recusandae-exercitationem
3.9.59

1 year ago

3.9.58

1 year ago

2.5.40

1 year ago

2.5.41

1 year ago

4.12.99

1 year ago

3.11.77

1 year ago

3.11.79

1 year ago

3.11.78

1 year ago

3.9.64

1 year ago

3.9.65

1 year ago

3.9.62

1 year ago

3.9.63

1 year ago

3.9.60

1 year ago

3.9.61

1 year ago

3.6.48

1 year ago

3.6.47

1 year ago

3.6.46

1 year ago

3.6.45

1 year ago

3.6.44

1 year ago

3.6.43

1 year ago

3.10.75

1 year ago

3.10.76

1 year ago

3.10.73

1 year ago

3.10.74

1 year ago

3.10.77

1 year ago

3.6.49

1 year ago

2.4.18

1 year ago

2.4.17

1 year ago

2.4.19

1 year ago

3.10.71

1 year ago

3.10.72

1 year ago

2.4.16

1 year ago

3.10.70

1 year ago

2.4.15

1 year ago

3.6.56

1 year ago

3.6.55

1 year ago

3.6.54

1 year ago

3.6.53

1 year ago

3.6.52

1 year ago

3.6.51

1 year ago

3.6.50

1 year ago

2.4.20

1 year ago

4.11.98

1 year ago

4.11.97

1 year ago

4.11.96

1 year ago

4.11.95

1 year ago

4.11.99

1 year ago

4.11.90

1 year ago

4.11.94

1 year ago

4.11.93

1 year ago

4.11.92

1 year ago

4.11.91

1 year ago

4.11.87

1 year ago

4.11.86

1 year ago

4.11.85

1 year ago

3.8.58

1 year ago

4.11.84

1 year ago

3.8.57

1 year ago

4.11.89

1 year ago

4.11.88

1 year ago

3.10.65

1 year ago

3.10.68

1 year ago

3.10.69

1 year ago

3.10.66

1 year ago

3.10.67

1 year ago

4.11.83

1 year ago

4.11.82

1 year ago

4.11.81

1 year ago

3.7.57

1 year ago

3.7.56

1 year ago

2.5.29

1 year ago

3.11.80

1 year ago

2.5.25

1 year ago

3.11.81

1 year ago

2.5.26

1 year ago

2.5.27

1 year ago

2.5.28

1 year ago

2.5.21

1 year ago

2.5.22

1 year ago

2.5.23

1 year ago

2.5.24

1 year ago

2.5.20

1 year ago

3.5.43

1 year ago

3.5.42

1 year ago

3.5.41

1 year ago

2.5.36

1 year ago

2.3.13

1 year ago

2.5.37

1 year ago

2.3.12

1 year ago

2.5.38

1 year ago

2.3.15

1 year ago

2.5.39

1 year ago

2.3.14

1 year ago

2.5.32

1 year ago

2.5.33

1 year ago

2.5.34

1 year ago

2.5.35

1 year ago

2.5.30

1 year ago

2.5.31

1 year ago

2.3.11

1 year ago

2.1.9

1 year ago

2.1.10

1 year ago

2.2.10

1 year ago

2.3.10

1 year ago

2.1.8

1 year ago

2.1.7

1 year ago

2.1.6

1 year ago

2.1.5

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago