104 lines
3.5 KiB
JavaScript
104 lines
3.5 KiB
JavaScript
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
// file that has been converted to a CommonJS file using a Babel-
|
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
mod
|
|
));
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
|
|
// src/_util/warning.ts
|
|
var warning_exports = {};
|
|
__export(warning_exports, {
|
|
WarningContext: () => WarningContext,
|
|
default: () => warning_default,
|
|
devUseWarning: () => devUseWarning,
|
|
noop: () => noop,
|
|
resetWarned: () => resetWarned
|
|
});
|
|
module.exports = __toCommonJS(warning_exports);
|
|
var React = __toESM(require("react"));
|
|
var import_warning = __toESM(require("rc-util/lib/warning"));
|
|
function noop() {
|
|
}
|
|
var deprecatedWarnList = null;
|
|
function resetWarned() {
|
|
deprecatedWarnList = null;
|
|
(0, import_warning.resetWarned)();
|
|
}
|
|
var warning = noop;
|
|
if (process.env.NODE_ENV !== "production") {
|
|
warning = (valid, component, message) => {
|
|
(0, import_warning.default)(valid, `[antd: ${component}] ${message}`);
|
|
if (process.env.NODE_ENV === "test") {
|
|
resetWarned();
|
|
}
|
|
};
|
|
}
|
|
var WarningContext = React.createContext({});
|
|
var devUseWarning = process.env.NODE_ENV !== "production" ? (component) => {
|
|
const { strict } = React.useContext(WarningContext);
|
|
const typeWarning = (valid, type, message) => {
|
|
if (!valid) {
|
|
if (strict === false && type === "deprecated") {
|
|
const existWarning = deprecatedWarnList;
|
|
if (!deprecatedWarnList) {
|
|
deprecatedWarnList = {};
|
|
}
|
|
deprecatedWarnList[component] = deprecatedWarnList[component] || [];
|
|
if (!deprecatedWarnList[component].includes(message || "")) {
|
|
deprecatedWarnList[component].push(message || "");
|
|
}
|
|
if (!existWarning) {
|
|
console.warn(
|
|
"[antd] There exists deprecated usage in your code:",
|
|
deprecatedWarnList
|
|
);
|
|
}
|
|
} else {
|
|
warning(valid, component, message);
|
|
}
|
|
}
|
|
};
|
|
typeWarning.deprecated = (valid, oldProp, newProp, message) => {
|
|
typeWarning(
|
|
valid,
|
|
"deprecated",
|
|
`\`${oldProp}\` is deprecated. Please use \`${newProp}\` instead.${message ? ` ${message}` : ""}`
|
|
);
|
|
};
|
|
return typeWarning;
|
|
} : () => {
|
|
const noopWarning = () => {
|
|
};
|
|
noopWarning.deprecated = noop;
|
|
return noopWarning;
|
|
};
|
|
var warning_default = warning;
|
|
// Annotate the CommonJS export names for ESM import in node:
|
|
0 && (module.exports = {
|
|
WarningContext,
|
|
devUseWarning,
|
|
noop,
|
|
resetWarned
|
|
});
|