Latest updates from IceHrmPro
This commit is contained in:
11
web/node_modules/mini-store/cjs/PropTypes.js
generated
vendored
Normal file
11
web/node_modules/mini-store/cjs/PropTypes.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var prop_types_1 = __importDefault(require("prop-types"));
|
||||
exports.storeShape = prop_types_1.default.shape({
|
||||
subscribe: prop_types_1.default.func.isRequired,
|
||||
setState: prop_types_1.default.func.isRequired,
|
||||
getState: prop_types_1.default.func.isRequired,
|
||||
});
|
||||
39
web/node_modules/mini-store/cjs/Provider.js
generated
vendored
Normal file
39
web/node_modules/mini-store/cjs/Provider.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var react_1 = __importStar(require("react"));
|
||||
var PropTypes_1 = require("./PropTypes");
|
||||
exports.MiniStoreContext = react_1.createContext(null);
|
||||
var Provider = /** @class */ (function (_super) {
|
||||
__extends(Provider, _super);
|
||||
function Provider() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Provider.prototype.render = function () {
|
||||
return react_1.default.createElement(exports.MiniStoreContext.Provider, { value: this.props.store }, this.props.children);
|
||||
};
|
||||
Provider.propTypes = {
|
||||
store: PropTypes_1.storeShape.isRequired,
|
||||
};
|
||||
return Provider;
|
||||
}(react_1.Component));
|
||||
exports.Provider = Provider;
|
||||
24
web/node_modules/mini-store/cjs/__tests__/Provider.test.js
generated
vendored
Normal file
24
web/node_modules/mini-store/cjs/__tests__/Provider.test.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var react_1 = __importStar(require("react"));
|
||||
var enzyme_1 = require("enzyme");
|
||||
var index_1 = require("../index");
|
||||
var Provider_1 = require("../Provider");
|
||||
test('store context', function (done) {
|
||||
var store = index_1.create({});
|
||||
var App = function () {
|
||||
var contextStore = react_1.useContext(Provider_1.MiniStoreContext);
|
||||
expect(contextStore).toBe(store);
|
||||
done();
|
||||
return react_1.default.createElement("div", null, "hello");
|
||||
};
|
||||
enzyme_1.mount(react_1.default.createElement(index_1.Provider, { store: store },
|
||||
react_1.default.createElement(App, null)));
|
||||
});
|
||||
166
web/node_modules/mini-store/cjs/__tests__/connect.test.js
generated
vendored
Normal file
166
web/node_modules/mini-store/cjs/__tests__/connect.test.js
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var react_1 = __importDefault(require("react"));
|
||||
var enzyme_1 = require("enzyme");
|
||||
var index_1 = require("../index");
|
||||
var StatelessApp;
|
||||
var Connected;
|
||||
var store;
|
||||
var wrapper;
|
||||
var StatefulApp = /** @class */ (function (_super) {
|
||||
__extends(StatefulApp, _super);
|
||||
function StatefulApp() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
StatefulApp.prototype.render = function () {
|
||||
return (react_1.default.createElement("div", null, this.props.msg));
|
||||
};
|
||||
return StatefulApp;
|
||||
}(react_1.default.Component));
|
||||
describe('stateless', function () {
|
||||
beforeEach(function () {
|
||||
StatelessApp = function (_a) {
|
||||
var msg = _a.msg;
|
||||
return react_1.default.createElement("div", null, msg);
|
||||
};
|
||||
Connected = index_1.connect(function (state) { return state; })(StatelessApp);
|
||||
store = index_1.create({ msg: 'hello', count: 0 });
|
||||
wrapper = enzyme_1.mount(react_1.default.createElement(index_1.Provider, { store: store },
|
||||
react_1.default.createElement(Connected, null)));
|
||||
});
|
||||
test('map state to props', function () {
|
||||
expect(wrapper.text()).toBe('hello');
|
||||
});
|
||||
test('renrender as subscribed state changes', function () {
|
||||
store.setState({ msg: 'halo' });
|
||||
expect(wrapper.text()).toBe('halo');
|
||||
});
|
||||
test('on rerender when unsubscribed state changes', function () {
|
||||
store.setState({ count: 1 });
|
||||
expect(wrapper.text()).toBe('hello');
|
||||
});
|
||||
test('do not subscribe', function () {
|
||||
Connected = index_1.connect()(StatelessApp);
|
||||
wrapper = enzyme_1.mount(react_1.default.createElement(index_1.Provider, { store: store },
|
||||
react_1.default.createElement(Connected, { msg: "hello" })));
|
||||
expect(wrapper.instance().unsubscribe).toBeUndefined();
|
||||
});
|
||||
test('pass own props to mapStateToProps', function () {
|
||||
Connected = index_1.connect(function (state, props) { return ({
|
||||
msg: state.msg + " " + props.name
|
||||
}); })(StatelessApp);
|
||||
wrapper = enzyme_1.mount(react_1.default.createElement(index_1.Provider, { store: store },
|
||||
react_1.default.createElement(Connected, { name: "world" })));
|
||||
expect(wrapper.text()).toBe('hello world');
|
||||
});
|
||||
test('mapStateToProps is invoked when own props changes', function () {
|
||||
Connected = index_1.connect(function (state, props) { return ({
|
||||
msg: state.msg + " " + props.name
|
||||
}); })(StatelessApp);
|
||||
var App = /** @class */ (function (_super) {
|
||||
__extends(App, _super);
|
||||
function App() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.state = {
|
||||
name: 'world'
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
App.prototype.render = function () {
|
||||
var _this = this;
|
||||
return (react_1.default.createElement("div", null,
|
||||
react_1.default.createElement("button", { onClick: function () { return _this.setState({ name: 'there' }); } }, "Click"),
|
||||
react_1.default.createElement(Connected, { name: this.state.name })));
|
||||
};
|
||||
return App;
|
||||
}(react_1.default.Component));
|
||||
wrapper = enzyme_1.mount(react_1.default.createElement(index_1.Provider, { store: store },
|
||||
react_1.default.createElement(App, null)));
|
||||
wrapper.find('button').simulate('click');
|
||||
expect(wrapper.find(Connected).text()).toBe('hello there');
|
||||
});
|
||||
test('mapStateToProps is not invoked when own props is not used', function () {
|
||||
var mapStateToProps = jest.fn(function (state) { return ({ msg: state.msg }); });
|
||||
Connected = index_1.connect(mapStateToProps)(StatelessApp);
|
||||
var App = /** @class */ (function (_super) {
|
||||
__extends(App, _super);
|
||||
function App() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.state = {
|
||||
name: 'world'
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
App.prototype.render = function () {
|
||||
var _this = this;
|
||||
return (react_1.default.createElement("div", null,
|
||||
react_1.default.createElement("button", { onClick: function () { return _this.setState({ name: 'there' }); } }, "Click"),
|
||||
react_1.default.createElement(Connected, { name: this.state.name })));
|
||||
};
|
||||
return App;
|
||||
}(react_1.default.Component));
|
||||
wrapper = enzyme_1.mount(react_1.default.createElement(index_1.Provider, { store: store },
|
||||
react_1.default.createElement(App, null)));
|
||||
wrapper.find('button').simulate('click');
|
||||
expect(mapStateToProps).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
// https://github.com/ant-design/ant-design/issues/11723
|
||||
test('rerender component when props changes', function () {
|
||||
var Dummy = function (_a) {
|
||||
var visible = _a.visible;
|
||||
return react_1.default.createElement("div", null, visible && 'hello');
|
||||
};
|
||||
Connected = index_1.connect(function (state, props) { return ({
|
||||
visible: state.visible === false ? props.ownVisible : state.visible
|
||||
}); })(Dummy);
|
||||
var App = /** @class */ (function (_super) {
|
||||
__extends(App, _super);
|
||||
function App() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
_this.state = {
|
||||
visible: true,
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
App.prototype.render = function () {
|
||||
var _this = this;
|
||||
return (react_1.default.createElement("div", null,
|
||||
react_1.default.createElement("button", { onClick: function () { return _this.setState({ visible: false }); } }, "Click"),
|
||||
react_1.default.createElement(Connected, { ownVisible: this.state.visible })));
|
||||
};
|
||||
return App;
|
||||
}(react_1.default.Component));
|
||||
store = index_1.create({ visible: false });
|
||||
wrapper = enzyme_1.mount(react_1.default.createElement(index_1.Provider, { store: store },
|
||||
react_1.default.createElement(App, null)));
|
||||
wrapper.find('button').simulate('click');
|
||||
expect(wrapper.find(Dummy).text()).toBe('');
|
||||
store.setState({ visible: true });
|
||||
wrapper.update();
|
||||
expect(wrapper.find(Dummy).text()).toBe('hello');
|
||||
});
|
||||
});
|
||||
describe('stateful', function () {
|
||||
beforeEach(function () {
|
||||
Connected = index_1.connect(function (state) { return state; })(StatefulApp);
|
||||
store = index_1.create({ msg: 'hello', count: 0 });
|
||||
wrapper = enzyme_1.mount(react_1.default.createElement(index_1.Provider, { store: store },
|
||||
react_1.default.createElement(Connected, null)));
|
||||
});
|
||||
});
|
||||
22
web/node_modules/mini-store/cjs/__tests__/create.test.js
generated
vendored
Normal file
22
web/node_modules/mini-store/cjs/__tests__/create.test.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var index_1 = require("../index");
|
||||
test('create', function () {
|
||||
var store = index_1.create({ foo: true });
|
||||
expect(store.getState()).toEqual({ foo: true });
|
||||
});
|
||||
test('setState', function () {
|
||||
var store = index_1.create({ foo: false, bar: 1 });
|
||||
store.setState({ foo: false });
|
||||
expect(store.getState()).toEqual({ foo: false, bar: 1 });
|
||||
});
|
||||
test('subscribe', function () {
|
||||
var store = index_1.create({ foo: false });
|
||||
var listener1 = jest.fn();
|
||||
var listener2 = jest.fn();
|
||||
store.subscribe(listener1);
|
||||
store.subscribe(listener2);
|
||||
store.setState({ foo: false });
|
||||
expect(listener1).toBeCalled();
|
||||
expect(listener2).toBeCalled();
|
||||
});
|
||||
120
web/node_modules/mini-store/cjs/connect.js
generated
vendored
Normal file
120
web/node_modules/mini-store/cjs/connect.js
generated
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var react_1 = __importStar(require("react"));
|
||||
var shallowequal_1 = __importDefault(require("shallowequal"));
|
||||
var hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics"));
|
||||
var react_lifecycles_compat_1 = require("react-lifecycles-compat");
|
||||
var Provider_1 = require("./Provider");
|
||||
function getDisplayName(WrappedComponent) {
|
||||
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
||||
}
|
||||
var defaultMapStateToProps = function () { return ({}); };
|
||||
function connect(mapStateToProps, options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
var shouldSubscribe = !!mapStateToProps;
|
||||
var finalMapStateToProps = mapStateToProps || defaultMapStateToProps;
|
||||
return function wrapWithConnect(WrappedComponent) {
|
||||
var Connect = /** @class */ (function (_super) {
|
||||
__extends(Connect, _super);
|
||||
function Connect(props, context) {
|
||||
var _this = _super.call(this, props, context) || this;
|
||||
_this.unsubscribe = null;
|
||||
_this.handleChange = function () {
|
||||
if (!_this.unsubscribe) {
|
||||
return;
|
||||
}
|
||||
var nextState = finalMapStateToProps(_this.store.getState(), _this.props);
|
||||
_this.setState({ subscribed: nextState });
|
||||
};
|
||||
_this.store = _this.context;
|
||||
_this.state = {
|
||||
subscribed: finalMapStateToProps(_this.store.getState(), props),
|
||||
store: _this.store,
|
||||
props: props,
|
||||
};
|
||||
return _this;
|
||||
}
|
||||
Connect.getDerivedStateFromProps = function (props, prevState) {
|
||||
// using ownProps
|
||||
if (mapStateToProps && mapStateToProps.length === 2 && props !== prevState.props) {
|
||||
return {
|
||||
subscribed: finalMapStateToProps(prevState.store.getState(), props),
|
||||
props: props,
|
||||
};
|
||||
}
|
||||
return { props: props };
|
||||
};
|
||||
Connect.prototype.componentDidMount = function () {
|
||||
this.trySubscribe();
|
||||
};
|
||||
Connect.prototype.componentWillUnmount = function () {
|
||||
this.tryUnsubscribe();
|
||||
};
|
||||
Connect.prototype.shouldComponentUpdate = function (nextProps, nextState) {
|
||||
return !shallowequal_1.default(this.props, nextProps) || !shallowequal_1.default(this.state.subscribed, nextState.subscribed);
|
||||
};
|
||||
Connect.prototype.trySubscribe = function () {
|
||||
if (shouldSubscribe) {
|
||||
this.unsubscribe = this.store.subscribe(this.handleChange);
|
||||
this.handleChange();
|
||||
}
|
||||
};
|
||||
Connect.prototype.tryUnsubscribe = function () {
|
||||
if (this.unsubscribe) {
|
||||
this.unsubscribe();
|
||||
this.unsubscribe = null;
|
||||
}
|
||||
};
|
||||
Connect.prototype.render = function () {
|
||||
var props = __assign(__assign(__assign({}, this.props), this.state.subscribed), { store: this.store });
|
||||
return react_1.default.createElement(WrappedComponent, __assign({}, props, { ref: this.props.miniStoreForwardedRef }));
|
||||
};
|
||||
Connect.displayName = "Connect(" + getDisplayName(WrappedComponent) + ")";
|
||||
Connect.contextType = Provider_1.MiniStoreContext;
|
||||
return Connect;
|
||||
}(react_1.Component));
|
||||
react_lifecycles_compat_1.polyfill(Connect);
|
||||
if (options.forwardRef) {
|
||||
var forwarded = react_1.default.forwardRef(function (props, ref) {
|
||||
return react_1.default.createElement(Connect, __assign({}, props, { miniStoreForwardedRef: ref }));
|
||||
});
|
||||
return hoist_non_react_statics_1.default(forwarded, WrappedComponent);
|
||||
}
|
||||
return hoist_non_react_statics_1.default(Connect, WrappedComponent);
|
||||
};
|
||||
}
|
||||
exports.connect = connect;
|
||||
39
web/node_modules/mini-store/cjs/create.js
generated
vendored
Normal file
39
web/node_modules/mini-store/cjs/create.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
var __assign = (this && this.__assign) || function () {
|
||||
__assign = Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
return __assign.apply(this, arguments);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function create(initialState) {
|
||||
var state = initialState;
|
||||
var listeners = [];
|
||||
function setState(partial) {
|
||||
state = __assign(__assign({}, state), partial);
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
listeners[i]();
|
||||
}
|
||||
}
|
||||
function getState() {
|
||||
return state;
|
||||
}
|
||||
function subscribe(listener) {
|
||||
listeners.push(listener);
|
||||
return function unsubscribe() {
|
||||
var index = listeners.indexOf(listener);
|
||||
listeners.splice(index, 1);
|
||||
};
|
||||
}
|
||||
return {
|
||||
setState: setState,
|
||||
getState: getState,
|
||||
subscribe: subscribe,
|
||||
};
|
||||
}
|
||||
exports.create = create;
|
||||
8
web/node_modules/mini-store/cjs/index.js
generated
vendored
Normal file
8
web/node_modules/mini-store/cjs/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var Provider_1 = require("./Provider");
|
||||
exports.Provider = Provider_1.Provider;
|
||||
var connect_1 = require("./connect");
|
||||
exports.connect = connect_1.connect;
|
||||
var create_1 = require("./create");
|
||||
exports.create = create_1.create;
|
||||
23
web/node_modules/mini-store/cjs/types.js
generated
vendored
Normal file
23
web/node_modules/mini-store/cjs/types.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
// Type definitions for react-redux 7.1
|
||||
// Project: https://github.com/reduxjs/react-redux
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>,
|
||||
// Kenzie Togami <https://github.com/kenzierocks>,
|
||||
// Curits Layne <https://github.com/clayne11>
|
||||
// Frank Tan <https://github.com/tansongyang>
|
||||
// Nicholas Boll <https://github.com/nicholasboll>
|
||||
// Dibyo Majumdar <https://github.com/mdibyo>
|
||||
// Thomas Charlat <https://github.com/kallikrein>
|
||||
// Valentin Descamps <https://github.com/val1984>
|
||||
// Johann Rakotoharisoa <https://github.com/jrakotoharisoa>
|
||||
// Anatoli Papirovski <https://github.com/apapirovski>
|
||||
// Boris Sergeyev <https://github.com/surgeboris>
|
||||
// Søren Bruus Frank <https://github.com/soerenbf>
|
||||
// Jonathan Ziller <https://github.com/mrwolfz>
|
||||
// Dylan Vann <https://github.com/dylanvann>
|
||||
// Yuki Ito <https://github.com/Lazyuki>
|
||||
// Kazuma Ebina <https://github.com/kazuma1989>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
;
|
||||
Reference in New Issue
Block a user