luckymarmot / paw-regexdynamicvalue Goto Github PK
View Code? Open in Web Editor NEWPaw Dynamic Value to match and replace a pattern in an input string.
License: MIT License
Paw Dynamic Value to match and replace a pattern in an input string.
License: MIT License
Hello,
I'm working on a dynamic value extension that outputs a date string with RFC 3339 format strings. I'd like to offer the ability to input custom strings as well as choose from a list of presets. I have a radio button to switch between the two options but I can't figure out a way to dynamically switch between a text entry input field and a dropdown. Where do I write the logic to change the input fields? I've attached my code below:
var moment = require("moment.js")
var inputFields = {
"choiceRadioButtons": InputField(
"format",
"Format",
"Radio",
{
"choices": {
"radio-preset": "Preset",
"radio-custom": "Custom"
},
"defaultValue": "radio-preset",
"persisted": true
}
),
"presetDropdown": InputField(
"cs",
"Checksum",
"Select",
{
"choices": {
"iso": "ISO 8601"
},
"defaultValue": "md2",
"persisted": true
}
),
"customStringField": InputField(
"customString",
"Custom String",
"String"
)
}
// Extensions are implemented as JavaScript classes
var StringFormattedDate = function() {
// implement the evaluate() method to generate the dynamic value
this.evaluate = function() {
if(this.format == "radio-preset") {
// set inputs to: [
// inputFields.choiceRadioButtons,
// inputFields.presetDropdown
// ]
} else if(this.format == "radio-custom") {
// set inputs to: [
// inputFields.choiceRadioButtons,
// inputFields.customStringField
// ]
}
return this.format
// return moment().format(this.customString);
}
}
StringFormattedDate.inputs = [
inputFields.choiceRadioButtons
]
// set the Extension Identifier (must be same as the directory name)
StringFormattedDate.identifier = "com.prtmshk.StringFormattedDate";
// give a display name to your Dynamic Value
StringFormattedDate.title = "String Formatted Date";
// link to the Dynamic Value documentation
// StringFormattedDate.help = "https://luckymarmot.com/paw/doc/";
// call to register function is required
registerDynamicValueClass(StringFormattedDate)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.